Monorepo for Tangled
tangled.org
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package tangled
4
5// schema: sh.tangled.git.listRefs
6
7import (
8 "context"
9
10 "github.com/bluesky-social/indigo/lex/util"
11)
12
13const (
14 GitListRefsNSID = "sh.tangled.git.listRefs"
15)
16
17// GitListRefs_DefaultBranch is a "defaultBranch" in the sh.tangled.git.listRefs schema.
18type GitListRefs_DefaultBranch struct {
19 // 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.
20 Head *string `json:"head,omitempty" cborgen:"head,omitempty"`
21 // ref: Default branch ref name that HEAD points at, eg. refs/heads/main.
22 Ref string `json:"ref" cborgen:"ref"`
23}
24
25// GitListRefs_Output is the output of a sh.tangled.git.listRefs call.
26type GitListRefs_Output struct {
27 // cursor: Cursor for the next page, absent when the last page is reached
28 Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
29 DefaultBranch *GitListRefs_DefaultBranch `json:"defaultBranch,omitempty" cborgen:"defaultBranch,omitempty"`
30 Refs []*GitListRefs_Ref `json:"refs" cborgen:"refs"`
31}
32
33// GitListRefs_Ref is a "ref" in the sh.tangled.git.listRefs schema.
34type GitListRefs_Ref struct {
35 // ref: Full ref name, eg. refs/heads/main or refs/tags/v1.0
36 Ref string `json:"ref" cborgen:"ref"`
37 // sha: Object SHA the ref points at. Width depends on the repo's git object-format.
38 Sha string `json:"sha" cborgen:"sha"`
39}
40
41// GitListRefs calls the XRPC method "sh.tangled.git.listRefs".
42//
43// cursor: Pagination cursor
44// limit: Maximum number of refs to return in this page
45// repo: DID of the git repo as minted by the knot
46func GitListRefs(ctx context.Context, c util.LexClient, cursor string, limit int64, repo string) (*GitListRefs_Output, error) {
47 var out GitListRefs_Output
48
49 params := map[string]interface{}{}
50 if cursor != "" {
51 params["cursor"] = cursor
52 }
53 if limit != 0 {
54 params["limit"] = limit
55 }
56 params["repo"] = repo
57 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.listRefs", params, nil, &out); err != nil {
58 return nil, err
59 }
60
61 return &out, nil
62}