forked from
tangled.org/core
Monorepo for Tangled — https://tangled.org
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package tangled
4
5// schema: sh.tangled.repo.tree
6
7import (
8 "context"
9
10 "github.com/bluesky-social/indigo/lex/util"
11)
12
13const (
14 RepoTreeNSID = "sh.tangled.repo.tree"
15)
16
17// RepoTree_LastCommit is a "lastCommit" in the sh.tangled.repo.tree schema.
18type RepoTree_LastCommit struct {
19 // hash: Commit hash
20 Hash string `json:"hash" cborgen:"hash"`
21 // message: Commit message
22 Message string `json:"message" cborgen:"message"`
23 // when: Commit timestamp
24 When string `json:"when" cborgen:"when"`
25}
26
27// RepoTree_Output is the output of a sh.tangled.repo.tree call.
28type RepoTree_Output struct {
29 // dotdot: Parent directory path
30 Dotdot *string `json:"dotdot,omitempty" cborgen:"dotdot,omitempty"`
31 Files []*RepoTree_TreeEntry `json:"files" cborgen:"files"`
32 // parent: The parent path in the tree
33 Parent *string `json:"parent,omitempty" cborgen:"parent,omitempty"`
34 // ref: The git reference used
35 Ref string `json:"ref" cborgen:"ref"`
36}
37
38// RepoTree_TreeEntry is a "treeEntry" in the sh.tangled.repo.tree schema.
39type RepoTree_TreeEntry struct {
40 // is_file: Whether this entry is a file
41 Is_file bool `json:"is_file" cborgen:"is_file"`
42 // is_subtree: Whether this entry is a directory/subtree
43 Is_subtree bool `json:"is_subtree" cborgen:"is_subtree"`
44 Last_commit *RepoTree_LastCommit `json:"last_commit,omitempty" cborgen:"last_commit,omitempty"`
45 // mode: File mode
46 Mode string `json:"mode" cborgen:"mode"`
47 // name: Relative file or directory name
48 Name string `json:"name" cborgen:"name"`
49 // size: File size in bytes
50 Size int64 `json:"size" cborgen:"size"`
51}
52
53// RepoTree calls the XRPC method "sh.tangled.repo.tree".
54//
55// path: Path within the repository tree
56// ref: Git reference (branch, tag, or commit SHA)
57// repo: Repository identifier in format 'did:plc:.../repoName'
58func RepoTree(ctx context.Context, c util.LexClient, path string, ref string, repo string) (*RepoTree_Output, error) {
59 var out RepoTree_Output
60
61 params := map[string]interface{}{}
62 if path != "" {
63 params["path"] = path
64 }
65 params["ref"] = ref
66 params["repo"] = repo
67 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.tree", params, nil, &out); err != nil {
68 return nil, err
69 }
70
71 return &out, nil
72}