// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.repo.listCollaboratorInvitesBy

import (
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

const (
	RepoListCollaboratorInvitesByNSID = "org.tangled.repo.listCollaboratorInvitesBy"
)

// RepoListCollaboratorInvitesBy_InviteItem is a "inviteItem" in the org.tangled.repo.listCollaboratorInvitesBy schema.
//
// An offer awaiting the subject's acceptance.
type RepoListCollaboratorInvitesBy_InviteItem struct {
	// addedBy: DID that made the offer.
	AddedBy string `json:"addedBy" cborgen:"addedBy"`
	// createdAt: When the repository made the offer. This listing sorts it by newest first.
	CreatedAt string `json:"createdAt" cborgen:"createdAt"`
	// knot: did:web of knot hosting this repo.
	Knot string `json:"knot" cborgen:"knot"`
	// repo: DID of repo that made the offer.
	Repo string `json:"repo" cborgen:"repo"`
	// uri: Invite record on the repository.
	Uri string `json:"uri" cborgen:"uri"`
}

// RepoListCollaboratorInvitesBy_Output is the output of a org.tangled.repo.listCollaboratorInvitesBy call.
type RepoListCollaboratorInvitesBy_Output struct {
	Items []*RepoListCollaboratorInvitesBy_InviteItem `json:"items" cborgen:"items"`
	// pending: Knots that this index hasn't read yet
	Pending []string `json:"pending" cborgen:"pending"`
	// truncated: Per-subject dropped offers from items. If truncated is true, missing offers won't say if they were withdrawn, same with pending knots.
	Truncated bool `json:"truncated" cborgen:"truncated"`
}

// RepoListCollaboratorInvitesBy calls the XRPC method "org.tangled.repo.listCollaboratorInvitesBy".
//
// subject: Actor DID offered collaboration.
func RepoListCollaboratorInvitesBy(ctx context.Context, c util.LexClient, subject string) (*RepoListCollaboratorInvitesBy_Output, error) {
	var out RepoListCollaboratorInvitesBy_Output

	params := map[string]interface{}{}
	params["subject"] = subject
	if err := c.LexDo(ctx, util.Query, "", "org.tangled.repo.listCollaboratorInvitesBy", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
