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

package tangled

// schema: sh.tangled.repo.listPullsBy

import (
	"context"

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

const (
	RepoListPullsByNSID = "sh.tangled.repo.listPullsBy"
)

// RepoListPullsBy_Output is the output of a sh.tangled.repo.listPullsBy call.
type RepoListPullsBy_Output struct {
	Cursor *string                       `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
	Items  []*RepoListPulls_PullListItem `json:"items" cborgen:"items"`
}

// RepoListPullsBy calls the XRPC method "sh.tangled.repo.listPullsBy".
//
// cursor: Pagination cursor
// order: Sort direction by createdAt.
// status: Restrict to pulls whose latest derived status matches.
// subject: Actor DID whose pull authorings to list
func RepoListPullsBy(ctx context.Context, c util.LexClient, cursor string, limit int64, order string, status string, subject string) (*RepoListPullsBy_Output, error) {
	var out RepoListPullsBy_Output

	params := map[string]interface{}{}
	if cursor != "" {
		params["cursor"] = cursor
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if order != "" {
		params["order"] = order
	}
	if status != "" {
		params["status"] = status
	}
	params["subject"] = subject
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.listPullsBy", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
