1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package tangled
4
5// schema: sh.tangled.repo.blob
6
7import (
8 "context"
9
10 "github.com/bluesky-social/indigo/lex/util"
11)
12
13const (
14 RepoBlobNSID = "sh.tangled.repo.blob"
15)
16
17// RepoBlob_LastCommit is a "lastCommit" in the sh.tangled.repo.blob schema.
18type RepoBlob_LastCommit struct {
19 Author *RepoBlob_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// RepoBlob_Output is the output of a sh.tangled.repo.blob call.
29type RepoBlob_Output struct {
30 // content: File content (base64 encoded for binary files)
31 Content *string `json:"content,omitempty" cborgen:"content,omitempty"`
32 // encoding: Content encoding
33 Encoding *string `json:"encoding,omitempty" cborgen:"encoding,omitempty"`
34 // isBinary: Whether the file is binary
35 IsBinary *bool `json:"isBinary,omitempty" cborgen:"isBinary,omitempty"`
36 LastCommit *RepoBlob_LastCommit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"`
37 // mimeType: MIME type of the file
38 MimeType *string `json:"mimeType,omitempty" cborgen:"mimeType,omitempty"`
39 // path: The file path
40 Path string `json:"path" cborgen:"path"`
41 // ref: The git reference used
42 Ref string `json:"ref" cborgen:"ref"`
43 // size: File size in bytes
44 Size *int64 `json:"size,omitempty" cborgen:"size,omitempty"`
45 // submodule: Submodule information if path is a submodule
46 Submodule *RepoBlob_Submodule `json:"submodule,omitempty" cborgen:"submodule,omitempty"`
47}
48
49// RepoBlob_Signature is a "signature" in the sh.tangled.repo.blob schema.
50type RepoBlob_Signature struct {
51 // email: Author email
52 Email string `json:"email" cborgen:"email"`
53 // name: Author name
54 Name string `json:"name" cborgen:"name"`
55 // when: Author timestamp
56 When string `json:"when" cborgen:"when"`
57}
58
59// RepoBlob_Submodule is a "submodule" in the sh.tangled.repo.blob schema.
60type RepoBlob_Submodule struct {
61 // branch: Branch to track in the submodule
62 Branch *string `json:"branch,omitempty" cborgen:"branch,omitempty"`
63 // name: Submodule name
64 Name string `json:"name" cborgen:"name"`
65 // url: Submodule repository URL
66 Url string `json:"url" cborgen:"url"`
67}
68
69// RepoBlob calls the XRPC method "sh.tangled.repo.blob".
70//
71// path: Path to the file within the repository
72// raw: Return raw file content instead of JSON response
73// ref: Git reference (branch, tag, or commit SHA)
74// repo: Repository identifier in format 'did:plc:.../repoName'
75func RepoBlob(ctx context.Context, c util.LexClient, path string, raw bool, ref string, repo string) (*RepoBlob_Output, error) {
76 var out RepoBlob_Output
77
78 params := map[string]interface{}{}
79 params["path"] = path
80 if raw {
81 params["raw"] = raw
82 }
83 params["ref"] = ref
84 params["repo"] = repo
85 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.blob", params, nil, &out); err != nil {
86 return nil, err
87 }
88
89 return &out, nil
90}