@@ -78,36 +78,52 @@ extension AppBskyLexicon.Embed {
7878 /// in the image failing to upload.
7979 public let thumbnailImage : ComAtprotoLexicon . Repository . UploadBlobOutput ?
8080
81- public init ( uri: URL , title: String , description: String , thumbnailImage: ComAtprotoLexicon . Repository . UploadBlobOutput ? ) {
81+ /// An array of strong references to the Atmosphere records that back this embed. Optional.
82+ ///
83+ /// - Note: According to the AT Protocol specifications: "StrongRefs (uri+cid) of the
84+ /// Atmosphere records that backed this view."
85+ public let associatedRefs : [ ComAtprotoLexicon . Repository . StrongReference ] ?
86+
87+ public init (
88+ uri: URL ,
89+ title: String ,
90+ description: String ,
91+ thumbnailImage: ComAtprotoLexicon . Repository . UploadBlobOutput ? ,
92+ associatedRefs: [ ComAtprotoLexicon . Repository . StrongReference ] ? = nil
93+ ) {
8294 self . uri = uri
8395 self . title = title
8496 self . description = description
8597 self . thumbnailImage = thumbnailImage
98+ self . associatedRefs = associatedRefs
8699 }
87-
100+
88101 public init ( from decoder: any Decoder ) throws {
89102 let container = try decoder. container ( keyedBy: CodingKeys . self)
90103 self . uri = try container. decode ( URL . self, forKey: CodingKeys . uri)
91104 self . title = try container. decode ( String . self, forKey: CodingKeys . title)
92105 self . description = try container. decode ( String . self, forKey: CodingKeys . description)
93106 self . thumbnailImage = try container. decodeIfPresent ( ComAtprotoLexicon . Repository. UploadBlobOutput. self, forKey: CodingKeys . thumbnailImage)
107+ self . associatedRefs = try container. decodeIfPresent ( [ ComAtprotoLexicon . Repository . StrongReference ] . self, forKey: CodingKeys . associatedRefs)
94108 }
95-
109+
96110 public func encode( to encoder: any Encoder ) throws {
97111 var container = encoder. container ( keyedBy: CodingKeys . self)
98112 try container. encode ( self . type, forKey: CodingKeys . type)
99113 try container. encode ( self . uri, forKey: CodingKeys . uri)
100114 try container. encode ( self . title, forKey: CodingKeys . title)
101115 try container. encode ( self . description, forKey: CodingKeys . description)
102116 try container. encodeIfPresent ( self . thumbnailImage, forKey: CodingKeys . thumbnailImage)
117+ try container. encodeIfPresent ( self . associatedRefs, forKey: CodingKeys . associatedRefs)
103118 }
104-
119+
105120 enum CodingKeys : String , CodingKey {
106121 case type = " $type "
107122 case uri
108123 case title
109124 case description
110125 case thumbnailImage = " thumb "
126+ case associatedRefs
111127 }
112128 }
113129
@@ -167,36 +183,303 @@ extension AppBskyLexicon.Embed {
167183 /// The thumbnail image URL of the external content.
168184 public let thumbnailImageURL : URL ?
169185
170- public init ( uri: String , title: String , description: String , thumbnailImageURL: URL ? ) {
186+ /// The date and time the external content was created. Optional.
187+ ///
188+ /// - Note: According to the AT Protocol specifications: "When the external content was
189+ /// created, if available. Example: a publication date, for an article."
190+ public let createdAt : Date ?
191+
192+ /// The date and time the external content was last updated. Optional.
193+ ///
194+ /// - Note: According to the AT Protocol specifications: "When the external content was
195+ /// updated, if available."
196+ public let updatedAt : Date ?
197+
198+ /// The estimated reading time of the external content, in minutes. Optional.
199+ ///
200+ /// - Note: According to the AT Protocol specifications: "Estimated reading time in
201+ /// minutes, if applicable and available."
202+ public let readingTime : Int ?
203+
204+ /// An array of labels attached to the external content. Optional.
205+ public let labels : [ ComAtprotoLexicon . Label . LabelDefinition ] ?
206+
207+ /// The source of the external content. Optional.
208+ public let source : ViewExternalSource ?
209+
210+ /// An array of strong references to the Atmosphere records that backed this view. Optional.
211+ ///
212+ /// - Note: According to the AT Protocol specifications: "StrongRefs (uri+cid) of the
213+ /// Atmosphere records that backed this view."
214+ public let associatedRefs : [ ComAtprotoLexicon . Repository . StrongReference ] ?
215+
216+ /// An array of profiles of the owners of the Atmosphere records that backed this view. Optional.
217+ ///
218+ /// - Note: According to the AT Protocol specifications: "Profiles of the owners of the
219+ /// Atmosphere records that backed this view."
220+ public let associatedProfiles : [ AppBskyLexicon . Actor . ProfileViewBasicDefinition ] ?
221+
222+ public init (
223+ uri: String ,
224+ title: String ,
225+ description: String ,
226+ thumbnailImageURL: URL ? ,
227+ createdAt: Date ? = nil ,
228+ updatedAt: Date ? = nil ,
229+ readingTime: Int ? = nil ,
230+ labels: [ ComAtprotoLexicon . Label . LabelDefinition ] ? = nil ,
231+ source: ViewExternalSource ? = nil ,
232+ associatedRefs: [ ComAtprotoLexicon . Repository . StrongReference ] ? = nil ,
233+ associatedProfiles: [ AppBskyLexicon . Actor . ProfileViewBasicDefinition ] ? = nil
234+ ) {
171235 self . uri = uri
172236 self . title = title
173237 self . description = description
174238 self . thumbnailImageURL = thumbnailImageURL
239+ self . createdAt = createdAt
240+ self . updatedAt = updatedAt
241+ self . readingTime = readingTime
242+ self . labels = labels
243+ self . source = source
244+ self . associatedRefs = associatedRefs
245+ self . associatedProfiles = associatedProfiles
175246 }
176-
247+
177248 public init ( from decoder: any Decoder ) throws {
178249 let container = try decoder. container ( keyedBy: CodingKeys . self)
179250 self . uri = try container. decode ( String . self, forKey: CodingKeys . uri)
180251 self . title = try container. decode ( String . self, forKey: CodingKeys . title)
181252 self . description = try container. decode ( String . self, forKey: CodingKeys . description)
182253 self . thumbnailImageURL = try container. decodeIfPresent ( URL . self, forKey: CodingKeys . thumbnailImageURL)
254+ self . createdAt = try container. decodeDateIfPresent ( forKey: CodingKeys . createdAt)
255+ self . updatedAt = try container. decodeDateIfPresent ( forKey: CodingKeys . updatedAt)
256+ self . readingTime = try container. decodeIfPresent ( Int . self, forKey: CodingKeys . readingTime)
257+ self . labels = try container. decodeIfPresent ( [ ComAtprotoLexicon . Label . LabelDefinition ] . self, forKey: CodingKeys . labels)
258+ self . source = try container. decodeIfPresent ( ViewExternalSource . self, forKey: CodingKeys . source)
259+ self . associatedRefs = try container. decodeIfPresent ( [ ComAtprotoLexicon . Repository . StrongReference ] . self, forKey: CodingKeys . associatedRefs)
260+ self . associatedProfiles = try container. decodeIfPresent ( [ AppBskyLexicon . Actor . ProfileViewBasicDefinition ] . self, forKey: CodingKeys . associatedProfiles)
183261 }
184-
262+
185263 public func encode( to encoder: any Encoder ) throws {
186264 var container = encoder. container ( keyedBy: CodingKeys . self)
187265 try container. encode ( self . type, forKey: CodingKeys . type)
188266 try container. encode ( self . uri, forKey: CodingKeys . uri)
189267 try container. encode ( self . title, forKey: CodingKeys . title)
190268 try container. encode ( self . description, forKey: CodingKeys . description)
191269 try container. encodeIfPresent ( self . thumbnailImageURL, forKey: CodingKeys . thumbnailImageURL)
270+ try container. encodeDateIfPresent ( self . createdAt, forKey: CodingKeys . createdAt)
271+ try container. encodeDateIfPresent ( self . updatedAt, forKey: CodingKeys . updatedAt)
272+ try container. encodeIfPresent ( self . readingTime, forKey: CodingKeys . readingTime)
273+ try container. encodeIfPresent ( self . labels, forKey: CodingKeys . labels)
274+ try container. encodeIfPresent ( self . source, forKey: CodingKeys . source)
275+ try container. encodeIfPresent ( self . associatedRefs, forKey: CodingKeys . associatedRefs)
276+ try container. encodeIfPresent ( self . associatedProfiles, forKey: CodingKeys . associatedProfiles)
192277 }
193-
278+
194279 enum CodingKeys : String , CodingKey {
195280 case type = " $type "
196281 case uri
197282 case title
198283 case description
199284 case thumbnailImageURL = " thumb "
285+ case createdAt
286+ case updatedAt
287+ case readingTime
288+ case labels
289+ case source
290+ case associatedRefs
291+ case associatedProfiles
292+ }
293+ }
294+
295+ /// A data model for the source of external content.
296+ ///
297+ /// - SeeAlso: This is based on the [`app.bsky.embed.external`][github] lexicon.
298+ ///
299+ /// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/embed/external.json
300+ public struct ViewExternalSource : Sendable , Codable , Equatable , Hashable {
301+
302+ /// The identifier of the lexicon.
303+ ///
304+ /// - Warning: The value must not change.
305+ public let type : String = " app.bsky.embed.external#viewExternalSource "
306+
307+ /// The URI of the source.
308+ ///
309+ /// - Note: According to the AT Protocol specifications: "URI of the source, if available.
310+ /// Example: the https:// URL of a site.standard.publication record."
311+ public let uri : URL
312+
313+ /// The URL of an icon representing the source. Optional.
314+ ///
315+ /// - Note: According to the AT Protocol specifications: "Fully-qualified URL where an
316+ /// icon representing the source can be fetched. For example, CDN location provided by
317+ /// the App View."
318+ public let icon : URL ?
319+
320+ /// The title of the source.
321+ public let title : String
322+
323+ /// The description of the source. Optional.
324+ public let description : String ?
325+
326+ /// The theme colors of the source. Optional.
327+ public let theme : ViewExternalSourceTheme ?
328+
329+ public init ( uri: URL , icon: URL ? , title: String , description: String ? , theme: ViewExternalSourceTheme ? ) {
330+ self . uri = uri
331+ self . icon = icon
332+ self . title = title
333+ self . description = description
334+ self . theme = theme
335+ }
336+
337+ public init ( from decoder: any Decoder ) throws {
338+ let container = try decoder. container ( keyedBy: CodingKeys . self)
339+ self . uri = try container. decode ( URL . self, forKey: CodingKeys . uri)
340+ self . icon = try container. decodeIfPresent ( URL . self, forKey: CodingKeys . icon)
341+ self . title = try container. decode ( String . self, forKey: CodingKeys . title)
342+ self . description = try container. decodeIfPresent ( String . self, forKey: CodingKeys . description)
343+ self . theme = try container. decodeIfPresent ( ViewExternalSourceTheme . self, forKey: CodingKeys . theme)
344+ }
345+
346+ public func encode( to encoder: any Encoder ) throws {
347+ var container = encoder. container ( keyedBy: CodingKeys . self)
348+ try container. encode ( self . type, forKey: CodingKeys . type)
349+ try container. encode ( self . uri, forKey: CodingKeys . uri)
350+ try container. encodeIfPresent ( self . icon, forKey: CodingKeys . icon)
351+ try container. encode ( self . title, forKey: CodingKeys . title)
352+ try container. encodeIfPresent ( self . description, forKey: CodingKeys . description)
353+ try container. encodeIfPresent ( self . theme, forKey: CodingKeys . theme)
354+ }
355+
356+ enum CodingKeys : String , CodingKey {
357+ case type = " $type "
358+ case uri
359+ case icon
360+ case title
361+ case description
362+ case theme
363+ }
364+ }
365+
366+ /// A data model for the theme colors of an external source.
367+ ///
368+ /// - Note: According to the AT Protocol specifications: "The theme colors of an external
369+ /// source, such as a site.standard.publication. These colors may be used when rendering an
370+ /// embed from that source."
371+ ///
372+ /// - SeeAlso: This is based on the [`app.bsky.embed.external`][github] lexicon.
373+ ///
374+ /// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/embed/external.json
375+ public struct ViewExternalSourceTheme : Sendable , Codable , Equatable , Hashable {
376+
377+ /// The identifier of the lexicon.
378+ ///
379+ /// - Warning: The value must not change.
380+ public let type : String = " app.bsky.embed.external#viewExternalSourceTheme "
381+
382+ /// The background color of the source. Optional.
383+ public let backgroundRGB : ColorRGB ?
384+
385+ /// The foreground color of the source. Optional.
386+ public let foregroundRGB : ColorRGB ?
387+
388+ /// The accent color of the source. Optional.
389+ public let accentRGB : ColorRGB ?
390+
391+ /// The foreground color used on top of the accent color. Optional.
392+ public let accentForegroundRGB : ColorRGB ?
393+
394+ public init ( backgroundRGB: ColorRGB ? , foregroundRGB: ColorRGB ? , accentRGB: ColorRGB ? , accentForegroundRGB: ColorRGB ? ) {
395+ self . backgroundRGB = backgroundRGB
396+ self . foregroundRGB = foregroundRGB
397+ self . accentRGB = accentRGB
398+ self . accentForegroundRGB = accentForegroundRGB
399+ }
400+
401+ public init ( from decoder: any Decoder ) throws {
402+ let container = try decoder. container ( keyedBy: CodingKeys . self)
403+ self . backgroundRGB = try container. decodeIfPresent ( ColorRGB . self, forKey: CodingKeys . backgroundRGB)
404+ self . foregroundRGB = try container. decodeIfPresent ( ColorRGB . self, forKey: CodingKeys . foregroundRGB)
405+ self . accentRGB = try container. decodeIfPresent ( ColorRGB . self, forKey: CodingKeys . accentRGB)
406+ self . accentForegroundRGB = try container. decodeIfPresent ( ColorRGB . self, forKey: CodingKeys . accentForegroundRGB)
407+ }
408+
409+ public func encode( to encoder: any Encoder ) throws {
410+ var container = encoder. container ( keyedBy: CodingKeys . self)
411+ try container. encode ( self . type, forKey: CodingKeys . type)
412+ try container. encodeIfPresent ( self . backgroundRGB, forKey: CodingKeys . backgroundRGB)
413+ try container. encodeIfPresent ( self . foregroundRGB, forKey: CodingKeys . foregroundRGB)
414+ try container. encodeIfPresent ( self . accentRGB, forKey: CodingKeys . accentRGB)
415+ try container. encodeIfPresent ( self . accentForegroundRGB, forKey: CodingKeys . accentForegroundRGB)
416+ }
417+
418+ enum CodingKeys : String , CodingKey {
419+ case type = " $type "
420+ case backgroundRGB
421+ case foregroundRGB
422+ case accentRGB
423+ case accentForegroundRGB
424+ }
425+ }
426+
427+ /// A data model for an RGB color definition.
428+ ///
429+ /// - Note: According to the AT Protocol specifications: "RGB color definition, inspired by
430+ /// site.standard.theme.color#rgb."
431+ ///
432+ /// - SeeAlso: This is based on the [`app.bsky.embed.external`][github] lexicon.
433+ ///
434+ /// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/embed/external.json
435+ public struct ColorRGB : Sendable , Codable , Equatable , Hashable {
436+
437+ /// The identifier of the lexicon.
438+ ///
439+ /// - Warning: The value must not change.
440+ public let type : String = " app.bsky.embed.external#colorRGB "
441+
442+ /// The red color channel.
443+ ///
444+ /// - Note: This value can be between `0` and `255`.
445+ public let r : Int
446+
447+ /// The green color channel.
448+ ///
449+ /// - Note: This value can be between `0` and `255`.
450+ public let g : Int
451+
452+ /// The blue color channel.
453+ ///
454+ /// - Note: This value can be between `0` and `255`.
455+ public let b : Int
456+
457+ public init ( r: Int , g: Int , b: Int ) {
458+ self . r = r
459+ self . g = g
460+ self . b = b
461+ }
462+
463+ public init ( from decoder: any Decoder ) throws {
464+ let container = try decoder. container ( keyedBy: CodingKeys . self)
465+ self . r = try container. decode ( Int . self, forKey: CodingKeys . r)
466+ self . g = try container. decode ( Int . self, forKey: CodingKeys . g)
467+ self . b = try container. decode ( Int . self, forKey: CodingKeys . b)
468+ }
469+
470+ public func encode( to encoder: any Encoder ) throws {
471+ var container = encoder. container ( keyedBy: CodingKeys . self)
472+ try container. encode ( self . type, forKey: CodingKeys . type)
473+ try container. encode ( self . r, forKey: CodingKeys . r)
474+ try container. encode ( self . g, forKey: CodingKeys . g)
475+ try container. encode ( self . b, forKey: CodingKeys . b)
476+ }
477+
478+ enum CodingKeys : String , CodingKey {
479+ case type = " $type "
480+ case r
481+ case g
482+ case b
200483 }
201484 }
202485 }
0 commit comments