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.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 FileTooLarge *bool `json:"fileTooLarge,omitempty" cborgen:"fileTooLarge,omitempty"`
35 // isBinary: Whether the file is binary
36 IsBinary *bool `json:"isBinary,omitempty" cborgen:"isBinary,omitempty"`
37 LastCommit *RepoBlob_LastCommit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"`
38 // mimeType: MIME type of the file
39 MimeType *string `json:"mimeType,omitempty" cborgen:"mimeType,omitempty"`
40 // path: The file path
41 Path string `json:"path" cborgen:"path"`
42 // ref: The git reference used
43 Ref string `json:"ref" cborgen:"ref"`
44 // size: File size in bytes
45 Size *int64 `json:"size,omitempty" cborgen:"size,omitempty"`
46 // submodule: Submodule information if path is a submodule
47 Submodule *RepoBlob_Submodule `json:"submodule,omitempty" cborgen:"submodule,omitempty"`
48}
49
50// RepoBlob_Signature is a "signature" in the sh.tangled.repo.blob schema.
51type RepoBlob_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// RepoBlob_Submodule is a "submodule" in the sh.tangled.repo.blob schema.
61type RepoBlob_Submodule struct {
62 // branch: Branch to track in the submodule
63 Branch *string `json:"branch,omitempty" cborgen:"branch,omitempty"`
64 // name: Submodule name
65 Name string `json:"name" cborgen:"name"`
66 // url: Submodule repository URL
67 Url string `json:"url" cborgen:"url"`
68}
69
70// RepoBlob calls the XRPC method "sh.tangled.repo.blob".
71//
72// path: Path to the file within the repository
73// raw: Return raw file content instead of JSON response
74// ref: Git reference (branch, tag, or commit SHA)
75// repo: DID of the repository
76func RepoBlob(ctx context.Context, c util.LexClient, path string, raw bool, ref string, repo string) (*RepoBlob_Output, error) {
77 var out RepoBlob_Output
78
79 params := map[string]interface{}{}
80 params["path"] = path
81 if raw {
82 params["raw"] = raw
83 }
84 params["ref"] = ref
85 params["repo"] = repo
86 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.blob", params, nil, &out); err != nil {
87 return nil, err
88 }
89
90 return &out, nil
91}