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 // readme: Readme for this file tree
35 Readme *RepoTree_Readme `json:"readme,omitempty" cborgen:"readme,omitempty"`
36 // ref: The git reference used
37 Ref string `json:"ref" cborgen:"ref"`
38}
39
40// RepoTree_Readme is a "readme" in the sh.tangled.repo.tree schema.
41type RepoTree_Readme struct {
42 // contents: Contents of the readme file
43 Contents string `json:"contents" cborgen:"contents"`
44 // filename: Name of the readme file
45 Filename string `json:"filename" cborgen:"filename"`
46}
47
48// RepoTree_TreeEntry is a "treeEntry" in the sh.tangled.repo.tree schema.
49type RepoTree_TreeEntry struct {
50 // is_file: Whether this entry is a file
51 Is_file bool `json:"is_file" cborgen:"is_file"`
52 // is_subtree: Whether this entry is a directory/subtree
53 Is_subtree bool `json:"is_subtree" cborgen:"is_subtree"`
54 Last_commit *RepoTree_LastCommit `json:"last_commit,omitempty" cborgen:"last_commit,omitempty"`
55 // mode: File mode
56 Mode string `json:"mode" cborgen:"mode"`
57 // name: Relative file or directory name
58 Name string `json:"name" cborgen:"name"`
59 // size: File size in bytes
60 Size int64 `json:"size" cborgen:"size"`
61}
62
63// RepoTree calls the XRPC method "sh.tangled.repo.tree".
64//
65// path: Path within the repository tree
66// ref: Git reference (branch, tag, or commit SHA)
67// repo: Repository identifier in format 'did:plc:.../repoName'
68func RepoTree(ctx context.Context, c util.LexClient, path string, ref string, repo string) (*RepoTree_Output, error) {
69 var out RepoTree_Output
70
71 params := map[string]interface{}{}
72 if path != "" {
73 params["path"] = path
74 }
75 params["ref"] = ref
76 params["repo"] = repo
77 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.tree", params, nil, &out); err != nil {
78 return nil, err
79 }
80
81 return &out, nil
82}