porting all github actions from bluesky-social/indigo to tangled CI
at main 9.3 kB view raw
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 3package bsky 4 5// schema: app.bsky.embed.record 6 7import ( 8 "encoding/json" 9 "fmt" 10 11 comatprototypes "github.com/bluesky-social/indigo/api/atproto" 12 "github.com/bluesky-social/indigo/lex/util" 13) 14 15func init() { 16 util.RegisterType("app.bsky.embed.record#main", &EmbedRecord{}) 17} // EmbedRecord is a "main" in the app.bsky.embed.record schema. 18// RECORDTYPE: EmbedRecord 19type EmbedRecord struct { 20 LexiconTypeID string `json:"$type,const=app.bsky.embed.record" cborgen:"$type,const=app.bsky.embed.record"` 21 Record *comatprototypes.RepoStrongRef `json:"record" cborgen:"record"` 22} 23 24// EmbedRecord_View is a "view" in the app.bsky.embed.record schema. 25// 26// RECORDTYPE: EmbedRecord_View 27type EmbedRecord_View struct { 28 LexiconTypeID string `json:"$type,const=app.bsky.embed.record#view" cborgen:"$type,const=app.bsky.embed.record#view"` 29 Record *EmbedRecord_View_Record `json:"record" cborgen:"record"` 30} 31 32// EmbedRecord_ViewBlocked is a "viewBlocked" in the app.bsky.embed.record schema. 33// 34// RECORDTYPE: EmbedRecord_ViewBlocked 35type EmbedRecord_ViewBlocked struct { 36 LexiconTypeID string `json:"$type,const=app.bsky.embed.record#viewBlocked" cborgen:"$type,const=app.bsky.embed.record#viewBlocked"` 37 Author *FeedDefs_BlockedAuthor `json:"author" cborgen:"author"` 38 Blocked bool `json:"blocked" cborgen:"blocked"` 39 Uri string `json:"uri" cborgen:"uri"` 40} 41 42// EmbedRecord_ViewDetached is a "viewDetached" in the app.bsky.embed.record schema. 43// 44// RECORDTYPE: EmbedRecord_ViewDetached 45type EmbedRecord_ViewDetached struct { 46 LexiconTypeID string `json:"$type,const=app.bsky.embed.record#viewDetached" cborgen:"$type,const=app.bsky.embed.record#viewDetached"` 47 Detached bool `json:"detached" cborgen:"detached"` 48 Uri string `json:"uri" cborgen:"uri"` 49} 50 51// EmbedRecord_ViewNotFound is a "viewNotFound" in the app.bsky.embed.record schema. 52// 53// RECORDTYPE: EmbedRecord_ViewNotFound 54type EmbedRecord_ViewNotFound struct { 55 LexiconTypeID string `json:"$type,const=app.bsky.embed.record#viewNotFound" cborgen:"$type,const=app.bsky.embed.record#viewNotFound"` 56 NotFound bool `json:"notFound" cborgen:"notFound"` 57 Uri string `json:"uri" cborgen:"uri"` 58} 59 60// EmbedRecord_ViewRecord is a "viewRecord" in the app.bsky.embed.record schema. 61// 62// RECORDTYPE: EmbedRecord_ViewRecord 63type EmbedRecord_ViewRecord struct { 64 LexiconTypeID string `json:"$type,const=app.bsky.embed.record#viewRecord" cborgen:"$type,const=app.bsky.embed.record#viewRecord"` 65 Author *ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` 66 Cid string `json:"cid" cborgen:"cid"` 67 Embeds []*EmbedRecord_ViewRecord_Embeds_Elem `json:"embeds,omitempty" cborgen:"embeds,omitempty"` 68 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 69 Labels []*comatprototypes.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` 70 LikeCount *int64 `json:"likeCount,omitempty" cborgen:"likeCount,omitempty"` 71 QuoteCount *int64 `json:"quoteCount,omitempty" cborgen:"quoteCount,omitempty"` 72 ReplyCount *int64 `json:"replyCount,omitempty" cborgen:"replyCount,omitempty"` 73 RepostCount *int64 `json:"repostCount,omitempty" cborgen:"repostCount,omitempty"` 74 Uri string `json:"uri" cborgen:"uri"` 75 // value: The record data itself. 76 Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 77} 78 79type EmbedRecord_ViewRecord_Embeds_Elem struct { 80 EmbedImages_View *EmbedImages_View 81 EmbedVideo_View *EmbedVideo_View 82 EmbedExternal_View *EmbedExternal_View 83 EmbedRecord_View *EmbedRecord_View 84 EmbedRecordWithMedia_View *EmbedRecordWithMedia_View 85} 86 87func (t *EmbedRecord_ViewRecord_Embeds_Elem) MarshalJSON() ([]byte, error) { 88 if t.EmbedImages_View != nil { 89 t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" 90 return json.Marshal(t.EmbedImages_View) 91 } 92 if t.EmbedVideo_View != nil { 93 t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" 94 return json.Marshal(t.EmbedVideo_View) 95 } 96 if t.EmbedExternal_View != nil { 97 t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" 98 return json.Marshal(t.EmbedExternal_View) 99 } 100 if t.EmbedRecord_View != nil { 101 t.EmbedRecord_View.LexiconTypeID = "app.bsky.embed.record#view" 102 return json.Marshal(t.EmbedRecord_View) 103 } 104 if t.EmbedRecordWithMedia_View != nil { 105 t.EmbedRecordWithMedia_View.LexiconTypeID = "app.bsky.embed.recordWithMedia#view" 106 return json.Marshal(t.EmbedRecordWithMedia_View) 107 } 108 return nil, fmt.Errorf("cannot marshal empty enum") 109} 110func (t *EmbedRecord_ViewRecord_Embeds_Elem) UnmarshalJSON(b []byte) error { 111 typ, err := util.TypeExtract(b) 112 if err != nil { 113 return err 114 } 115 116 switch typ { 117 case "app.bsky.embed.images#view": 118 t.EmbedImages_View = new(EmbedImages_View) 119 return json.Unmarshal(b, t.EmbedImages_View) 120 case "app.bsky.embed.video#view": 121 t.EmbedVideo_View = new(EmbedVideo_View) 122 return json.Unmarshal(b, t.EmbedVideo_View) 123 case "app.bsky.embed.external#view": 124 t.EmbedExternal_View = new(EmbedExternal_View) 125 return json.Unmarshal(b, t.EmbedExternal_View) 126 case "app.bsky.embed.record#view": 127 t.EmbedRecord_View = new(EmbedRecord_View) 128 return json.Unmarshal(b, t.EmbedRecord_View) 129 case "app.bsky.embed.recordWithMedia#view": 130 t.EmbedRecordWithMedia_View = new(EmbedRecordWithMedia_View) 131 return json.Unmarshal(b, t.EmbedRecordWithMedia_View) 132 133 default: 134 return nil 135 } 136} 137 138type EmbedRecord_View_Record struct { 139 EmbedRecord_ViewRecord *EmbedRecord_ViewRecord 140 EmbedRecord_ViewNotFound *EmbedRecord_ViewNotFound 141 EmbedRecord_ViewBlocked *EmbedRecord_ViewBlocked 142 EmbedRecord_ViewDetached *EmbedRecord_ViewDetached 143 FeedDefs_GeneratorView *FeedDefs_GeneratorView 144 GraphDefs_ListView *GraphDefs_ListView 145 LabelerDefs_LabelerView *LabelerDefs_LabelerView 146 GraphDefs_StarterPackViewBasic *GraphDefs_StarterPackViewBasic 147} 148 149func (t *EmbedRecord_View_Record) MarshalJSON() ([]byte, error) { 150 if t.EmbedRecord_ViewRecord != nil { 151 t.EmbedRecord_ViewRecord.LexiconTypeID = "app.bsky.embed.record#viewRecord" 152 return json.Marshal(t.EmbedRecord_ViewRecord) 153 } 154 if t.EmbedRecord_ViewNotFound != nil { 155 t.EmbedRecord_ViewNotFound.LexiconTypeID = "app.bsky.embed.record#viewNotFound" 156 return json.Marshal(t.EmbedRecord_ViewNotFound) 157 } 158 if t.EmbedRecord_ViewBlocked != nil { 159 t.EmbedRecord_ViewBlocked.LexiconTypeID = "app.bsky.embed.record#viewBlocked" 160 return json.Marshal(t.EmbedRecord_ViewBlocked) 161 } 162 if t.EmbedRecord_ViewDetached != nil { 163 t.EmbedRecord_ViewDetached.LexiconTypeID = "app.bsky.embed.record#viewDetached" 164 return json.Marshal(t.EmbedRecord_ViewDetached) 165 } 166 if t.FeedDefs_GeneratorView != nil { 167 t.FeedDefs_GeneratorView.LexiconTypeID = "app.bsky.feed.defs#generatorView" 168 return json.Marshal(t.FeedDefs_GeneratorView) 169 } 170 if t.GraphDefs_ListView != nil { 171 t.GraphDefs_ListView.LexiconTypeID = "app.bsky.graph.defs#listView" 172 return json.Marshal(t.GraphDefs_ListView) 173 } 174 if t.LabelerDefs_LabelerView != nil { 175 t.LabelerDefs_LabelerView.LexiconTypeID = "app.bsky.labeler.defs#labelerView" 176 return json.Marshal(t.LabelerDefs_LabelerView) 177 } 178 if t.GraphDefs_StarterPackViewBasic != nil { 179 t.GraphDefs_StarterPackViewBasic.LexiconTypeID = "app.bsky.graph.defs#starterPackViewBasic" 180 return json.Marshal(t.GraphDefs_StarterPackViewBasic) 181 } 182 return nil, fmt.Errorf("cannot marshal empty enum") 183} 184func (t *EmbedRecord_View_Record) UnmarshalJSON(b []byte) error { 185 typ, err := util.TypeExtract(b) 186 if err != nil { 187 return err 188 } 189 190 switch typ { 191 case "app.bsky.embed.record#viewRecord": 192 t.EmbedRecord_ViewRecord = new(EmbedRecord_ViewRecord) 193 return json.Unmarshal(b, t.EmbedRecord_ViewRecord) 194 case "app.bsky.embed.record#viewNotFound": 195 t.EmbedRecord_ViewNotFound = new(EmbedRecord_ViewNotFound) 196 return json.Unmarshal(b, t.EmbedRecord_ViewNotFound) 197 case "app.bsky.embed.record#viewBlocked": 198 t.EmbedRecord_ViewBlocked = new(EmbedRecord_ViewBlocked) 199 return json.Unmarshal(b, t.EmbedRecord_ViewBlocked) 200 case "app.bsky.embed.record#viewDetached": 201 t.EmbedRecord_ViewDetached = new(EmbedRecord_ViewDetached) 202 return json.Unmarshal(b, t.EmbedRecord_ViewDetached) 203 case "app.bsky.feed.defs#generatorView": 204 t.FeedDefs_GeneratorView = new(FeedDefs_GeneratorView) 205 return json.Unmarshal(b, t.FeedDefs_GeneratorView) 206 case "app.bsky.graph.defs#listView": 207 t.GraphDefs_ListView = new(GraphDefs_ListView) 208 return json.Unmarshal(b, t.GraphDefs_ListView) 209 case "app.bsky.labeler.defs#labelerView": 210 t.LabelerDefs_LabelerView = new(LabelerDefs_LabelerView) 211 return json.Unmarshal(b, t.LabelerDefs_LabelerView) 212 case "app.bsky.graph.defs#starterPackViewBasic": 213 t.GraphDefs_StarterPackViewBasic = new(GraphDefs_StarterPackViewBasic) 214 return json.Unmarshal(b, t.GraphDefs_StarterPackViewBasic) 215 216 default: 217 return nil 218 } 219}