// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.git.listRefs
import (
"context"
"github.com/bluesky-social/indigo/lex/util"
)
const (
GitListRefsNSID = "org.tangled.git.listRefs"
)
// GitListRefs_DefaultBranch is a "defaultBranch" in the org.tangled.git.listRefs schema.
type GitListRefs_DefaultBranch struct {
// head: Commit SHA at the tip of the default branch, for reconciling against a last-known state. Width depends on the repo's git object-format.
Head *string `json:"head,omitempty" cborgen:"head,omitempty"`
// ref: Default branch ref name that HEAD points at, eg. refs/heads/main.
Ref string `json:"ref" cborgen:"ref"`
}
// GitListRefs_Output is the output of a org.tangled.git.listRefs call.
type GitListRefs_Output struct {
// cursor: Cursor for the next page, absent when the last page is reached
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
DefaultBranch *GitListRefs_DefaultBranch `json:"defaultBranch,omitempty" cborgen:"defaultBranch,omitempty"`
Refs []*GitListRefs_Ref `json:"refs" cborgen:"refs"`
}
// GitListRefs_Ref is a "ref" in the org.tangled.git.listRefs schema.
type GitListRefs_Ref struct {
// ref: Full ref name, eg. refs/heads/main or refs/tags/v1.0
Ref string `json:"ref" cborgen:"ref"`
// sha: Object SHA the ref points at. Width depends on the repo's git object-format.
Sha string `json:"sha" cborgen:"sha"`
}
// GitListRefs calls the XRPC method "org.tangled.git.listRefs".
//
// cursor: Pagination cursor
// limit: Maximum number of refs to return in this page
// repo: DID of the git repo as minted by the knot
func GitListRefs(ctx context.Context, c util.LexClient, cursor string, limit int64, repo string) (*GitListRefs_Output, error) {
var out GitListRefs_Output
params := map[string]interface{}{}
if cursor != "" {
params["cursor"] = cursor
}
if limit != 0 {
params["limit"] = limit
}
params["repo"] = repo
if err := c.LexDo(ctx, util.Query, "", "org.tangled.git.listRefs", params, nil, &out); err != nil {
return nil, err
}
return &out, nil
}