test
0

Configure Feed

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

Fix generated draft lex types

+54 -36
+36 -32
api/bsky/draftdefs.go
··· 41 41 Uri string `json:"uri" cborgen:"uri"` 42 42 } 43 43 44 + // DraftDefs_DraftEmbedGallery is a "draftEmbedGallery" in the app.bsky.draft.defs schema. 45 + type DraftDefs_DraftEmbedGallery struct { 46 + Items []DraftDefs_DraftEmbedGalleryItems_Elem `json:"items" cborgen:"items"` 47 + } 48 + 49 + type DraftDefs_DraftEmbedGalleryItems_Elem struct { 50 + DraftDefs_DraftEmbedImage *DraftDefs_DraftEmbedImage 51 + } 52 + 53 + func (t *DraftDefs_DraftEmbedGalleryItems_Elem) MarshalJSON() ([]byte, error) { 54 + if t.DraftDefs_DraftEmbedImage != nil { 55 + t.DraftDefs_DraftEmbedImage.LexiconTypeID = "app.bsky.draft.defs#draftEmbedImage" 56 + return json.Marshal(t.DraftDefs_DraftEmbedImage) 57 + } 58 + return nil, fmt.Errorf("can not marshal empty union as JSON") 59 + } 60 + 61 + func (t *DraftDefs_DraftEmbedGalleryItems_Elem) UnmarshalJSON(b []byte) error { 62 + typ, err := lexutil.TypeExtract(b) 63 + if err != nil { 64 + return err 65 + } 66 + 67 + switch typ { 68 + case "app.bsky.draft.defs#draftEmbedImage": 69 + t.DraftDefs_DraftEmbedImage = new(DraftDefs_DraftEmbedImage) 70 + return json.Unmarshal(b, t.DraftDefs_DraftEmbedImage) 71 + default: 72 + return nil 73 + } 74 + } 75 + 44 76 // DraftDefs_DraftEmbedImage is a "draftEmbedImage" in the app.bsky.draft.defs schema. 45 77 type DraftDefs_DraftEmbedImage struct { 46 78 LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.draft.defs#draftEmbedImage"` ··· 71 103 // One of the posts that compose a draft. 72 104 type DraftDefs_DraftPost struct { 73 105 EmbedExternals []*DraftDefs_DraftEmbedExternal `json:"embedExternals,omitempty" cborgen:"embedExternals,omitempty"` 74 - // embedGallery: The schema-level maxLength of 20 is a future-proof ceiling. Clients should currently enforce a soft limit of 10 items in authoring UIs. 75 - EmbedGallery []*DraftDefs_DraftPost_EmbedGallery_Elem `json:"embedGallery,omitempty" cborgen:"embedGallery,omitempty"` 76 - EmbedImages []*DraftDefs_DraftEmbedImage `json:"embedImages,omitempty" cborgen:"embedImages,omitempty"` 77 - EmbedRecords []*DraftDefs_DraftEmbedRecord `json:"embedRecords,omitempty" cborgen:"embedRecords,omitempty"` 78 - EmbedVideos []*DraftDefs_DraftEmbedVideo `json:"embedVideos,omitempty" cborgen:"embedVideos,omitempty"` 106 + EmbedGallery *DraftDefs_DraftEmbedGallery `json:"embedGallery,omitempty" cborgen:"embedGallery,omitempty"` 107 + EmbedImages []*DraftDefs_DraftEmbedImage `json:"embedImages,omitempty" cborgen:"embedImages,omitempty"` 108 + EmbedRecords []*DraftDefs_DraftEmbedRecord `json:"embedRecords,omitempty" cborgen:"embedRecords,omitempty"` 109 + EmbedVideos []*DraftDefs_DraftEmbedVideo `json:"embedVideos,omitempty" cborgen:"embedVideos,omitempty"` 79 110 // labels: Self-label values for this post. Effectively content warnings. 80 111 Labels *DraftDefs_DraftPost_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"` 81 112 // text: The primary post content. It has a higher limit than post contents to allow storing a larger text that can later be refined into smaller posts. 82 113 Text string `json:"text" cborgen:"text"` 83 - } 84 - 85 - type DraftDefs_DraftPost_EmbedGallery_Elem struct { 86 - DraftDefs_DraftEmbedImage *DraftDefs_DraftEmbedImage 87 - } 88 - 89 - func (t *DraftDefs_DraftPost_EmbedGallery_Elem) MarshalJSON() ([]byte, error) { 90 - if t.DraftDefs_DraftEmbedImage != nil { 91 - t.DraftDefs_DraftEmbedImage.LexiconTypeID = "app.bsky.draft.defs#draftEmbedImage" 92 - return json.Marshal(t.DraftDefs_DraftEmbedImage) 93 - } 94 - return nil, fmt.Errorf("can not marshal empty union as JSON") 95 - } 96 - 97 - func (t *DraftDefs_DraftPost_EmbedGallery_Elem) UnmarshalJSON(b []byte) error { 98 - typ, err := lexutil.TypeExtract(b) 99 - if err != nil { 100 - return err 101 - } 102 - 103 - switch typ { 104 - case "app.bsky.draft.defs#draftEmbedImage": 105 - t.DraftDefs_DraftEmbedImage = new(DraftDefs_DraftEmbedImage) 106 - return json.Unmarshal(b, t.DraftDefs_DraftEmbedImage) 107 - default: 108 - return nil 109 - } 110 114 } 111 115 112 116 // Self-label values for this post. Effectively content warnings.
+18 -4
lexicons/app/bsky/draft/defs.json
··· 96 96 "maxLength": 4 97 97 }, 98 98 "embedGallery": { 99 - "type": "array", 100 - "items": { "type": "union", "refs": ["#draftEmbedImage"] }, 101 - "maxLength": 20, 102 - "description": "The schema-level maxLength of 20 is a future-proof ceiling. Clients should currently enforce a soft limit of 10 items in authoring UIs." 99 + "type": "ref", 100 + "ref": "#draftEmbedGallery" 103 101 }, 104 102 "embedVideos": { 105 103 "type": "array", ··· 173 171 } 174 172 }, 175 173 174 + "draftEmbedGallery": { 175 + "type": "object", 176 + "required": ["items"], 177 + "properties": { 178 + "items": { 179 + "type": "ref", 180 + "ref": "#draftEmbedGalleryItems" 181 + } 182 + } 183 + }, 184 + "draftEmbedGalleryItems": { 185 + "type": "array", 186 + "items": { "type": "union", "refs": ["#draftEmbedImage"] }, 187 + "maxLength": 20, 188 + "description": "The schema-level maxLength of 20 is a future-proof ceiling. Clients should currently enforce a soft limit of 10 items in authoring UIs." 189 + }, 176 190 "draftEmbedImage": { 177 191 "type": "object", 178 192 "required": ["localRef"],