This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / api / tangled / gitkeepCommit.go
3.0 kB 92 lines
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 3package tangled 4 5// schema: sh.tangled.git.keepCommit 6 7import ( 8 "context" 9 "encoding/json" 10 "fmt" 11 12 "github.com/bluesky-social/indigo/lex/util" 13) 14 15const ( 16 GitKeepCommitNSID = "sh.tangled.git.keepCommit" 17) 18 19// GitKeepCommit_Commit is a "commit" in the sh.tangled.git.keepCommit schema. 20// 21// RECORDTYPE: GitKeepCommit_Commit 22type GitKeepCommit_Commit struct { 23 LexiconTypeID string `json:"$type,const=sh.tangled.git.keepCommit#commit" cborgen:"$type,const=sh.tangled.git.keepCommit#commit"` 24 Oid string `json:"oid" cborgen:"oid"` 25 Repo string `json:"repo" cborgen:"repo"` 26} 27 28// GitKeepCommit_Input is the input argument to a sh.tangled.git.keepCommit call. 29type GitKeepCommit_Input struct { 30 // record: at-uri of target record. rkey is required 31 Record string `json:"record" cborgen:"record"` 32 Repo string `json:"repo" cborgen:"repo"` 33 Source *GitKeepCommit_Input_Source `json:"source" cborgen:"source"` 34} 35 36type GitKeepCommit_Input_Source struct { 37 GitKeepCommit_Commit *GitKeepCommit_Commit 38 GitKeepCommit_Patches *GitKeepCommit_Patches 39} 40 41func (t *GitKeepCommit_Input_Source) MarshalJSON() ([]byte, error) { 42 if t.GitKeepCommit_Commit != nil { 43 t.GitKeepCommit_Commit.LexiconTypeID = "sh.tangled.git.keepCommit#commit" 44 return json.Marshal(t.GitKeepCommit_Commit) 45 } 46 if t.GitKeepCommit_Patches != nil { 47 t.GitKeepCommit_Patches.LexiconTypeID = "sh.tangled.git.keepCommit#patches" 48 return json.Marshal(t.GitKeepCommit_Patches) 49 } 50 return nil, fmt.Errorf("cannot marshal empty enum") 51} 52func (t *GitKeepCommit_Input_Source) UnmarshalJSON(b []byte) error { 53 typ, err := util.TypeExtract(b) 54 if err != nil { 55 return err 56 } 57 58 switch typ { 59 case "sh.tangled.git.keepCommit#commit": 60 t.GitKeepCommit_Commit = new(GitKeepCommit_Commit) 61 return json.Unmarshal(b, t.GitKeepCommit_Commit) 62 case "sh.tangled.git.keepCommit#patches": 63 t.GitKeepCommit_Patches = new(GitKeepCommit_Patches) 64 return json.Unmarshal(b, t.GitKeepCommit_Patches) 65 66 default: 67 return nil 68 } 69} 70 71// GitKeepCommit_Output is the output of a sh.tangled.git.keepCommit call. 72type GitKeepCommit_Output struct { 73 Commit string `json:"commit" cborgen:"commit"` 74} 75 76// GitKeepCommit_Patches is a "patches" in the sh.tangled.git.keepCommit schema. 77// 78// RECORDTYPE: GitKeepCommit_Patches 79type GitKeepCommit_Patches struct { 80 LexiconTypeID string `json:"$type,const=sh.tangled.git.keepCommit#patches" cborgen:"$type,const=sh.tangled.git.keepCommit#patches"` 81 Patches []string `json:"patches,omitempty" cborgen:"patches,omitempty"` 82} 83 84// GitKeepCommit calls the XRPC method "sh.tangled.git.keepCommit". 85func GitKeepCommit(ctx context.Context, c util.LexClient, input *GitKeepCommit_Input) (*GitKeepCommit_Output, error) { 86 var out GitKeepCommit_Output 87 if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.git.keepCommit", nil, input, &out); err != nil { 88 return nil, err 89 } 90 91 return &out, nil 92}