forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
at master 3.2 kB view raw
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 // shortHash: Short commit hash 25 ShortHash *string `json:"shortHash,omitempty" cborgen:"shortHash,omitempty"` 26 // when: Commit timestamp 27 When string `json:"when" cborgen:"when"` 28} 29 30// RepoBlob_Output is the output of a sh.tangled.repo.blob call. 31type RepoBlob_Output struct { 32 // content: File content (base64 encoded for binary files) 33 Content *string `json:"content,omitempty" cborgen:"content,omitempty"` 34 // encoding: Content encoding 35 Encoding *string `json:"encoding,omitempty" cborgen:"encoding,omitempty"` 36 // isBinary: Whether the file is binary 37 IsBinary *bool `json:"isBinary,omitempty" cborgen:"isBinary,omitempty"` 38 LastCommit *RepoBlob_LastCommit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"` 39 // mimeType: MIME type of the file 40 MimeType *string `json:"mimeType,omitempty" cborgen:"mimeType,omitempty"` 41 // path: The file path 42 Path string `json:"path" cborgen:"path"` 43 // ref: The git reference used 44 Ref string `json:"ref" cborgen:"ref"` 45 // size: File size in bytes 46 Size *int64 `json:"size,omitempty" cborgen:"size,omitempty"` 47 // submodule: Submodule information if path is a submodule 48 Submodule *RepoBlob_Submodule `json:"submodule,omitempty" cborgen:"submodule,omitempty"` 49} 50 51// RepoBlob_Signature is a "signature" in the sh.tangled.repo.blob schema. 52type RepoBlob_Signature struct { 53 // email: Author email 54 Email string `json:"email" cborgen:"email"` 55 // name: Author name 56 Name string `json:"name" cborgen:"name"` 57 // when: Author timestamp 58 When string `json:"when" cborgen:"when"` 59} 60 61// RepoBlob_Submodule is a "submodule" in the sh.tangled.repo.blob schema. 62type RepoBlob_Submodule struct { 63 // branch: Branch to track in the submodule 64 Branch *string `json:"branch,omitempty" cborgen:"branch,omitempty"` 65 // name: Submodule name 66 Name string `json:"name" cborgen:"name"` 67 // url: Submodule repository URL 68 Url string `json:"url" cborgen:"url"` 69} 70 71// RepoBlob calls the XRPC method "sh.tangled.repo.blob". 72// 73// path: Path to the file within the repository 74// raw: Return raw file content instead of JSON response 75// ref: Git reference (branch, tag, or commit SHA) 76// repo: Repository identifier in format 'did:plc:.../repoName' 77func RepoBlob(ctx context.Context, c util.LexClient, path string, raw bool, ref string, repo string) (*RepoBlob_Output, error) { 78 var out RepoBlob_Output 79 80 params := map[string]interface{}{} 81 params["path"] = path 82 if raw { 83 params["raw"] = raw 84 } 85 params["ref"] = ref 86 params["repo"] = repo 87 if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.blob", params, nil, &out); err != nil { 88 return nil, err 89 } 90 91 return &out, nil 92}