// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.repo.listPulls
import (
"context"
"github.com/bluesky-social/indigo/lex/util"
)
const (
RepoListPullsNSID = "org.tangled.repo.listPulls"
)
// RepoListPulls_Output is the output of a org.tangled.repo.listPulls call.
type RepoListPulls_Output struct {
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
Items []*RepoListPulls_PullListItem `json:"items" cborgen:"items"`
// total: Total items in the full list; omitted for filtered or merged views
Total *int64 `json:"total,omitempty" cborgen:"total,omitempty"`
}
// RepoListPulls_PullListItem is a "pullListItem" in the org.tangled.repo.listPulls schema.
type RepoListPulls_PullListItem struct {
// author: The account that opened the record, the editor of its first version. Left out when the author can't be told.
Author *string `json:"author,omitempty" cborgen:"author,omitempty"`
Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
// commentCount: Count of sh.tangled.repo.pull.comment records targeting this pull.
CommentCount int64 `json:"commentCount" cborgen:"commentCount"`
// state: Latest derived state.
State string `json:"state" cborgen:"state"`
// stateUpdatedAt: TID-derived timestamp of the latest pull status record.
StateUpdatedAt *string `json:"stateUpdatedAt,omitempty" cborgen:"stateUpdatedAt,omitempty"`
Uri string `json:"uri" cborgen:"uri"`
// value: Embedded sh.tangled.repo.pull record
Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"`
}
// RepoListPulls calls the XRPC method "org.tangled.repo.listPulls".
//
// author: Restrict to pulls authored by this user DID.
// cursor: Pagination cursor
// offset: Absolute offset for random-access pagination. Mutually exclusive with cursor; offsets drift under concurrent writes, so follow up with the returned cursor.
// order: Sort direction by createdAt.
// status: Restrict to pulls whose latest derived status matches.
// subject: Repo DID to list pulls for
func RepoListPulls(ctx context.Context, c util.LexClient, author string, cursor string, limit int64, offset int64, order string, status string, subject string) (*RepoListPulls_Output, error) {
var out RepoListPulls_Output
params := map[string]interface{}{}
if author != "" {
params["author"] = author
}
if cursor != "" {
params["cursor"] = cursor
}
if limit != 0 {
params["limit"] = limit
}
if offset != 0 {
params["offset"] = offset
}
if order != "" {
params["order"] = order
}
if status != "" {
params["status"] = status
}
params["subject"] = subject
if err := c.LexDo(ctx, util.Query, "", "org.tangled.repo.listPulls", params, nil, &out); err != nil {
return nil, err
}
return &out, nil
}