porting all github actions from bluesky-social/indigo to tangled CI
at main 4.4 kB view raw
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 3package atproto 4 5// schema: com.atproto.moderation.createReport 6 7import ( 8 "context" 9 "encoding/json" 10 "fmt" 11 12 "github.com/bluesky-social/indigo/lex/util" 13) 14 15// ModerationCreateReport_Input is the input argument to a com.atproto.moderation.createReport call. 16type ModerationCreateReport_Input struct { 17 ModTool *ModerationCreateReport_ModTool `json:"modTool,omitempty" cborgen:"modTool,omitempty"` 18 // reason: Additional context about the content and violation. 19 Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` 20 // reasonType: Indicates the broad category of violation the report is for. 21 ReasonType *string `json:"reasonType" cborgen:"reasonType"` 22 Subject *ModerationCreateReport_Input_Subject `json:"subject" cborgen:"subject"` 23} 24 25type ModerationCreateReport_Input_Subject struct { 26 AdminDefs_RepoRef *AdminDefs_RepoRef 27 RepoStrongRef *RepoStrongRef 28} 29 30func (t *ModerationCreateReport_Input_Subject) MarshalJSON() ([]byte, error) { 31 if t.AdminDefs_RepoRef != nil { 32 t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" 33 return json.Marshal(t.AdminDefs_RepoRef) 34 } 35 if t.RepoStrongRef != nil { 36 t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" 37 return json.Marshal(t.RepoStrongRef) 38 } 39 return nil, fmt.Errorf("cannot marshal empty enum") 40} 41func (t *ModerationCreateReport_Input_Subject) UnmarshalJSON(b []byte) error { 42 typ, err := util.TypeExtract(b) 43 if err != nil { 44 return err 45 } 46 47 switch typ { 48 case "com.atproto.admin.defs#repoRef": 49 t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) 50 return json.Unmarshal(b, t.AdminDefs_RepoRef) 51 case "com.atproto.repo.strongRef": 52 t.RepoStrongRef = new(RepoStrongRef) 53 return json.Unmarshal(b, t.RepoStrongRef) 54 55 default: 56 return nil 57 } 58} 59 60// ModerationCreateReport_ModTool is a "modTool" in the com.atproto.moderation.createReport schema. 61// 62// Moderation tool information for tracing the source of the action 63type ModerationCreateReport_ModTool struct { 64 // meta: Additional arbitrary metadata about the source 65 Meta *interface{} `json:"meta,omitempty" cborgen:"meta,omitempty"` 66 // name: Name/identifier of the source (e.g., 'bsky-app/android', 'bsky-web/chrome') 67 Name string `json:"name" cborgen:"name"` 68} 69 70// ModerationCreateReport_Output is the output of a com.atproto.moderation.createReport call. 71type ModerationCreateReport_Output struct { 72 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 73 Id int64 `json:"id" cborgen:"id"` 74 Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` 75 ReasonType *string `json:"reasonType" cborgen:"reasonType"` 76 ReportedBy string `json:"reportedBy" cborgen:"reportedBy"` 77 Subject *ModerationCreateReport_Output_Subject `json:"subject" cborgen:"subject"` 78} 79 80type ModerationCreateReport_Output_Subject struct { 81 AdminDefs_RepoRef *AdminDefs_RepoRef 82 RepoStrongRef *RepoStrongRef 83} 84 85func (t *ModerationCreateReport_Output_Subject) MarshalJSON() ([]byte, error) { 86 if t.AdminDefs_RepoRef != nil { 87 t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" 88 return json.Marshal(t.AdminDefs_RepoRef) 89 } 90 if t.RepoStrongRef != nil { 91 t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" 92 return json.Marshal(t.RepoStrongRef) 93 } 94 return nil, fmt.Errorf("cannot marshal empty enum") 95} 96func (t *ModerationCreateReport_Output_Subject) UnmarshalJSON(b []byte) error { 97 typ, err := util.TypeExtract(b) 98 if err != nil { 99 return err 100 } 101 102 switch typ { 103 case "com.atproto.admin.defs#repoRef": 104 t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) 105 return json.Unmarshal(b, t.AdminDefs_RepoRef) 106 case "com.atproto.repo.strongRef": 107 t.RepoStrongRef = new(RepoStrongRef) 108 return json.Unmarshal(b, t.RepoStrongRef) 109 110 default: 111 return nil 112 } 113} 114 115// ModerationCreateReport calls the XRPC method "com.atproto.moderation.createReport". 116func ModerationCreateReport(ctx context.Context, c util.LexClient, input *ModerationCreateReport_Input) (*ModerationCreateReport_Output, error) { 117 var out ModerationCreateReport_Output 118 if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.moderation.createReport", nil, input, &out); err != nil { 119 return nil, err 120 } 121 122 return &out, nil 123}