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 Author *RepoTree_Signature `json:"author,omitempty" cborgen:"author,omitempty"`
20 // hash: Commit hash
21 Hash string `json:"hash" cborgen:"hash"`
22 // message: Commit message
23 Message string `json:"message" cborgen:"message"`
24 // when: Commit timestamp
25 When string `json:"when" cborgen:"when"`
26}
27
28// RepoTree_Output is the output of a sh.tangled.repo.tree call.
29type RepoTree_Output struct {
30 // dotdot: Parent directory path
31 Dotdot *string `json:"dotdot,omitempty" cborgen:"dotdot,omitempty"`
32 Files []*RepoTree_TreeEntry `json:"files" cborgen:"files"`
33 LastCommit *RepoTree_LastCommit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"`
34 // parent: The parent path in the tree
35 Parent *string `json:"parent,omitempty" cborgen:"parent,omitempty"`
36 // readme: Readme for this file tree
37 Readme *RepoTree_Readme `json:"readme,omitempty" cborgen:"readme,omitempty"`
38 // ref: The git reference used
39 Ref string `json:"ref" cborgen:"ref"`
40}
41
42// RepoTree_Readme is a "readme" in the sh.tangled.repo.tree schema.
43type RepoTree_Readme struct {
44 // contents: Contents of the readme file
45 Contents string `json:"contents" cborgen:"contents"`
46 // filename: Name of the readme file
47 Filename string `json:"filename" cborgen:"filename"`
48}
49
50// RepoTree_Signature is a "signature" in the sh.tangled.repo.tree schema.
51type RepoTree_Signature struct {
52 // email: Author email
53 Email string `json:"email" cborgen:"email"`
54 // name: Author name
55 Name string `json:"name" cborgen:"name"`
56 // when: Author timestamp
57 When string `json:"when" cborgen:"when"`
58}
59
60// RepoTree_TreeEntry is a "treeEntry" in the sh.tangled.repo.tree schema.
61type RepoTree_TreeEntry struct {
62 Last_commit *RepoTree_LastCommit `json:"last_commit,omitempty" cborgen:"last_commit,omitempty"`
63 // mode: File mode
64 Mode string `json:"mode" cborgen:"mode"`
65 // name: Relative file or directory name
66 Name string `json:"name" cborgen:"name"`
67 // size: File size in bytes
68 Size int64 `json:"size" cborgen:"size"`
69}
70
71// RepoTree calls the XRPC method "sh.tangled.repo.tree".
72//
73// path: Path within the repository tree
74// ref: Git reference (branch, tag, or commit SHA)
75// repo: Repository identifier in format 'did:plc:.../repoName'
76func RepoTree(ctx context.Context, c util.LexClient, path string, ref string, repo string) (*RepoTree_Output, error) {
77 var out RepoTree_Output
78
79 params := map[string]interface{}{}
80 if path != "" {
81 params["path"] = path
82 }
83 params["ref"] = ref
84 params["repo"] = repo
85 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.tree", params, nil, &out); err != nil {
86 return nil, err
87 }
88
89 return &out, nil
90}