Skip to main content

jacquard_api/app_bsky/embed/
external.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.embed.external
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::deps::smol_str::SmolStr;
18use jacquard_common::types::blob::BlobRef;
19use jacquard_common::types::string::{Datetime, UriValue};
20use jacquard_common::types::value::Data;
21use jacquard_derive::IntoStatic;
22use jacquard_lexicon::lexicon::LexiconDoc;
23use jacquard_lexicon::schema::LexiconSchema;
24
25use crate::app_bsky::actor::ProfileViewBasic;
26use crate::app_bsky::embed::external;
27use crate::com_atproto::label::Label;
28use crate::com_atproto::repo::strong_ref::StrongRef;
29#[allow(unused_imports)]
30use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
31use serde::{Deserialize, Serialize};
32/// RGB color definition, inspired by site.standard.theme.color#rgb
33
34#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
35#[serde(
36    rename_all = "camelCase",
37    bound(deserialize = "S: Deserialize<'de> + BosStr")
38)]
39pub struct ColorRgb<S: BosStr = DefaultStr> {
40    pub b: i64,
41    pub g: i64,
42    pub r: i64,
43    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
44    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
45}
46
47#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
48#[serde(
49    rename_all = "camelCase",
50    bound(deserialize = "S: Deserialize<'de> + BosStr")
51)]
52pub struct External<S: BosStr = DefaultStr> {
53    ///StrongRefs (uri+cid) of the Atmosphere records that backed this view.
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub associated_refs: Option<Vec<StrongRef<S>>>,
56    pub description: S,
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub thumb: Option<BlobRef<S>>,
59    pub title: S,
60    pub uri: UriValue<S>,
61    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
62    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
63}
64
65/// A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).
66
67#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
68#[serde(
69    rename_all = "camelCase",
70    bound(deserialize = "S: Deserialize<'de> + BosStr")
71)]
72pub struct ExternalRecord<S: BosStr = DefaultStr> {
73    pub external: external::External<S>,
74    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
75    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
76}
77
78#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
79#[serde(
80    rename_all = "camelCase",
81    bound(deserialize = "S: Deserialize<'de> + BosStr")
82)]
83pub struct View<S: BosStr = DefaultStr> {
84    pub external: external::ViewExternal<S>,
85    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
86    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
87}
88
89#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
90#[serde(
91    rename_all = "camelCase",
92    bound(deserialize = "S: Deserialize<'de> + BosStr")
93)]
94pub struct ViewExternal<S: BosStr = DefaultStr> {
95    ///Profiles of the owners of the Atmosphere records that backed this view.
96    #[serde(skip_serializing_if = "Option::is_none")]
97    pub associated_profiles: Option<Vec<ProfileViewBasic<S>>>,
98    ///StrongRefs (uri+cid) of the Atmosphere records that backed this view.
99    #[serde(skip_serializing_if = "Option::is_none")]
100    pub associated_refs: Option<Vec<StrongRef<S>>>,
101    ///When the external content was created, if available. Example: a publication date, for an article.
102    #[serde(skip_serializing_if = "Option::is_none")]
103    pub created_at: Option<Datetime>,
104    pub description: S,
105    #[serde(skip_serializing_if = "Option::is_none")]
106    pub labels: Option<Vec<Label<S>>>,
107    ///Estimated reading time in minutes, if applicable and available.
108    #[serde(skip_serializing_if = "Option::is_none")]
109    pub reading_time: Option<i64>,
110    #[serde(skip_serializing_if = "Option::is_none")]
111    pub source: Option<external::ViewExternalSource<S>>,
112    #[serde(skip_serializing_if = "Option::is_none")]
113    pub thumb: Option<UriValue<S>>,
114    pub title: S,
115    ///When the external content was updated, if available.
116    #[serde(skip_serializing_if = "Option::is_none")]
117    pub updated_at: Option<Datetime>,
118    pub uri: UriValue<S>,
119    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
120    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
121}
122
123/// The source of an external embed, such as a standard.site publication.
124
125#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
126#[serde(
127    rename_all = "camelCase",
128    bound(deserialize = "S: Deserialize<'de> + BosStr")
129)]
130pub struct ViewExternalSource<S: BosStr = DefaultStr> {
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub description: Option<S>,
133    ///Fully-qualified URL where an icon representing the source can be fetched. For example, CDN location provided by the App View.
134    #[serde(skip_serializing_if = "Option::is_none")]
135    pub icon: Option<UriValue<S>>,
136    #[serde(skip_serializing_if = "Option::is_none")]
137    pub theme: Option<external::ViewExternalSourceTheme<S>>,
138    pub title: S,
139    ///URI of the source, if available. Example: the https:// URL of a site.standard.publication record.
140    pub uri: UriValue<S>,
141    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
142    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
143}
144
145/// The theme colors of an external source, such as a site.standard.publication. These colors may be used when rendering an embed from that source.
146
147#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
148#[serde(
149    rename_all = "camelCase",
150    bound(deserialize = "S: Deserialize<'de> + BosStr")
151)]
152pub struct ViewExternalSourceTheme<S: BosStr = DefaultStr> {
153    #[serde(skip_serializing_if = "Option::is_none")]
154    pub accent_foreground_rgb: Option<external::ColorRgb<S>>,
155    #[serde(skip_serializing_if = "Option::is_none")]
156    pub accent_rgb: Option<external::ColorRgb<S>>,
157    #[serde(skip_serializing_if = "Option::is_none")]
158    pub background_rgb: Option<external::ColorRgb<S>>,
159    #[serde(skip_serializing_if = "Option::is_none")]
160    pub foreground_rgb: Option<external::ColorRgb<S>>,
161    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
162    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
163}
164
165impl<S: BosStr> LexiconSchema for ColorRgb<S> {
166    fn nsid() -> &'static str {
167        "app.bsky.embed.external"
168    }
169    fn def_name() -> &'static str {
170        "colorRGB"
171    }
172    fn lexicon_doc() -> LexiconDoc<'static> {
173        lexicon_doc_app_bsky_embed_external()
174    }
175    fn validate(&self) -> Result<(), ConstraintError> {
176        {
177            let value = &self.b;
178            if *value > 255i64 {
179                return Err(ConstraintError::Maximum {
180                    path: ValidationPath::from_field("b"),
181                    max: 255i64,
182                    actual: *value,
183                });
184            }
185        }
186        {
187            let value = &self.b;
188            if *value < 0i64 {
189                return Err(ConstraintError::Minimum {
190                    path: ValidationPath::from_field("b"),
191                    min: 0i64,
192                    actual: *value,
193                });
194            }
195        }
196        {
197            let value = &self.g;
198            if *value > 255i64 {
199                return Err(ConstraintError::Maximum {
200                    path: ValidationPath::from_field("g"),
201                    max: 255i64,
202                    actual: *value,
203                });
204            }
205        }
206        {
207            let value = &self.g;
208            if *value < 0i64 {
209                return Err(ConstraintError::Minimum {
210                    path: ValidationPath::from_field("g"),
211                    min: 0i64,
212                    actual: *value,
213                });
214            }
215        }
216        {
217            let value = &self.r;
218            if *value > 255i64 {
219                return Err(ConstraintError::Maximum {
220                    path: ValidationPath::from_field("r"),
221                    max: 255i64,
222                    actual: *value,
223                });
224            }
225        }
226        {
227            let value = &self.r;
228            if *value < 0i64 {
229                return Err(ConstraintError::Minimum {
230                    path: ValidationPath::from_field("r"),
231                    min: 0i64,
232                    actual: *value,
233                });
234            }
235        }
236        Ok(())
237    }
238}
239
240impl<S: BosStr> LexiconSchema for External<S> {
241    fn nsid() -> &'static str {
242        "app.bsky.embed.external"
243    }
244    fn def_name() -> &'static str {
245        "external"
246    }
247    fn lexicon_doc() -> LexiconDoc<'static> {
248        lexicon_doc_app_bsky_embed_external()
249    }
250    fn validate(&self) -> Result<(), ConstraintError> {
251        if let Some(ref value) = self.thumb {
252            {
253                let size = value.blob().size;
254                if size > 1000000usize {
255                    return Err(ConstraintError::BlobTooLarge {
256                        path: ValidationPath::from_field("thumb"),
257                        max: 1000000usize,
258                        actual: size,
259                    });
260                }
261            }
262        }
263        if let Some(ref value) = self.thumb {
264            {
265                let mime = value.blob().mime_type.as_str();
266                let accepted: &[&str] = &["image/*"];
267                let matched = accepted.iter().any(|pattern| {
268                    if *pattern == "*/*" {
269                        true
270                    } else if pattern.ends_with("/*") {
271                        let prefix = &pattern[..pattern.len() - 2];
272                        mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/')
273                    } else {
274                        mime == *pattern
275                    }
276                });
277                if !matched {
278                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
279                        path: ValidationPath::from_field("thumb"),
280                        accepted: vec!["image/*".to_string()],
281                        actual: mime.to_string(),
282                    });
283                }
284            }
285        }
286        Ok(())
287    }
288}
289
290impl<S: BosStr> LexiconSchema for ExternalRecord<S> {
291    fn nsid() -> &'static str {
292        "app.bsky.embed.external"
293    }
294    fn def_name() -> &'static str {
295        "main"
296    }
297    fn lexicon_doc() -> LexiconDoc<'static> {
298        lexicon_doc_app_bsky_embed_external()
299    }
300    fn validate(&self) -> Result<(), ConstraintError> {
301        Ok(())
302    }
303}
304
305impl<S: BosStr> LexiconSchema for View<S> {
306    fn nsid() -> &'static str {
307        "app.bsky.embed.external"
308    }
309    fn def_name() -> &'static str {
310        "view"
311    }
312    fn lexicon_doc() -> LexiconDoc<'static> {
313        lexicon_doc_app_bsky_embed_external()
314    }
315    fn validate(&self) -> Result<(), ConstraintError> {
316        Ok(())
317    }
318}
319
320impl<S: BosStr> LexiconSchema for ViewExternal<S> {
321    fn nsid() -> &'static str {
322        "app.bsky.embed.external"
323    }
324    fn def_name() -> &'static str {
325        "viewExternal"
326    }
327    fn lexicon_doc() -> LexiconDoc<'static> {
328        lexicon_doc_app_bsky_embed_external()
329    }
330    fn validate(&self) -> Result<(), ConstraintError> {
331        Ok(())
332    }
333}
334
335impl<S: BosStr> LexiconSchema for ViewExternalSource<S> {
336    fn nsid() -> &'static str {
337        "app.bsky.embed.external"
338    }
339    fn def_name() -> &'static str {
340        "viewExternalSource"
341    }
342    fn lexicon_doc() -> LexiconDoc<'static> {
343        lexicon_doc_app_bsky_embed_external()
344    }
345    fn validate(&self) -> Result<(), ConstraintError> {
346        Ok(())
347    }
348}
349
350impl<S: BosStr> LexiconSchema for ViewExternalSourceTheme<S> {
351    fn nsid() -> &'static str {
352        "app.bsky.embed.external"
353    }
354    fn def_name() -> &'static str {
355        "viewExternalSourceTheme"
356    }
357    fn lexicon_doc() -> LexiconDoc<'static> {
358        lexicon_doc_app_bsky_embed_external()
359    }
360    fn validate(&self) -> Result<(), ConstraintError> {
361        Ok(())
362    }
363}
364
365pub mod color_rgb_state {
366
367    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
368    #[allow(unused)]
369    use ::core::marker::PhantomData;
370    mod sealed {
371        pub trait Sealed {}
372    }
373    /// State trait tracking which required fields have been set
374    pub trait State: sealed::Sealed {
375        type B;
376        type G;
377        type R;
378    }
379    /// Empty state - all required fields are unset
380    pub struct Empty(());
381    impl sealed::Sealed for Empty {}
382    impl State for Empty {
383        type B = Unset;
384        type G = Unset;
385        type R = Unset;
386    }
387    ///State transition - sets the `b` field to Set
388    pub struct SetB<St: State = Empty>(PhantomData<fn() -> St>);
389    impl<St: State> sealed::Sealed for SetB<St> {}
390    impl<St: State> State for SetB<St> {
391        type B = Set<members::b>;
392        type G = St::G;
393        type R = St::R;
394    }
395    ///State transition - sets the `g` field to Set
396    pub struct SetG<St: State = Empty>(PhantomData<fn() -> St>);
397    impl<St: State> sealed::Sealed for SetG<St> {}
398    impl<St: State> State for SetG<St> {
399        type B = St::B;
400        type G = Set<members::g>;
401        type R = St::R;
402    }
403    ///State transition - sets the `r` field to Set
404    pub struct SetR<St: State = Empty>(PhantomData<fn() -> St>);
405    impl<St: State> sealed::Sealed for SetR<St> {}
406    impl<St: State> State for SetR<St> {
407        type B = St::B;
408        type G = St::G;
409        type R = Set<members::r>;
410    }
411    /// Marker types for field names
412    #[allow(non_camel_case_types)]
413    pub mod members {
414        ///Marker type for the `b` field
415        pub struct b(());
416        ///Marker type for the `g` field
417        pub struct g(());
418        ///Marker type for the `r` field
419        pub struct r(());
420    }
421}
422
423/// Builder for constructing an instance of this type.
424pub struct ColorRgbBuilder<St: color_rgb_state::State, S: BosStr = DefaultStr> {
425    _state: PhantomData<fn() -> St>,
426    _fields: (Option<i64>, Option<i64>, Option<i64>),
427    _type: PhantomData<fn() -> S>,
428}
429
430impl ColorRgb<DefaultStr> {
431    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
432    pub fn new() -> ColorRgbBuilder<color_rgb_state::Empty, DefaultStr> {
433        ColorRgbBuilder::new()
434    }
435}
436
437impl<S: BosStr> ColorRgb<S> {
438    /// Create a new builder for this type
439    pub fn builder() -> ColorRgbBuilder<color_rgb_state::Empty, S> {
440        ColorRgbBuilder::builder()
441    }
442}
443
444impl ColorRgbBuilder<color_rgb_state::Empty, DefaultStr> {
445    /// Create a new builder with all fields unset, using the default string type, if needed
446    pub fn new() -> Self {
447        ColorRgbBuilder {
448            _state: PhantomData,
449            _fields: (None, None, None),
450            _type: PhantomData,
451        }
452    }
453}
454
455impl<S: BosStr> ColorRgbBuilder<color_rgb_state::Empty, S> {
456    /// Create a new builder with all fields unset
457    pub fn builder() -> Self {
458        ColorRgbBuilder {
459            _state: PhantomData,
460            _fields: (None, None, None),
461            _type: PhantomData,
462        }
463    }
464}
465
466impl<St, S: BosStr> ColorRgbBuilder<St, S>
467where
468    St: color_rgb_state::State,
469    St::B: color_rgb_state::IsUnset,
470{
471    /// Set the `b` field (required)
472    pub fn b(mut self, value: impl Into<i64>) -> ColorRgbBuilder<color_rgb_state::SetB<St>, S> {
473        self._fields.0 = Option::Some(value.into());
474        ColorRgbBuilder {
475            _state: PhantomData,
476            _fields: self._fields,
477            _type: PhantomData,
478        }
479    }
480}
481
482impl<St, S: BosStr> ColorRgbBuilder<St, S>
483where
484    St: color_rgb_state::State,
485    St::G: color_rgb_state::IsUnset,
486{
487    /// Set the `g` field (required)
488    pub fn g(mut self, value: impl Into<i64>) -> ColorRgbBuilder<color_rgb_state::SetG<St>, S> {
489        self._fields.1 = Option::Some(value.into());
490        ColorRgbBuilder {
491            _state: PhantomData,
492            _fields: self._fields,
493            _type: PhantomData,
494        }
495    }
496}
497
498impl<St, S: BosStr> ColorRgbBuilder<St, S>
499where
500    St: color_rgb_state::State,
501    St::R: color_rgb_state::IsUnset,
502{
503    /// Set the `r` field (required)
504    pub fn r(mut self, value: impl Into<i64>) -> ColorRgbBuilder<color_rgb_state::SetR<St>, S> {
505        self._fields.2 = Option::Some(value.into());
506        ColorRgbBuilder {
507            _state: PhantomData,
508            _fields: self._fields,
509            _type: PhantomData,
510        }
511    }
512}
513
514impl<St, S: BosStr> ColorRgbBuilder<St, S>
515where
516    St: color_rgb_state::State,
517    St::B: color_rgb_state::IsSet,
518    St::G: color_rgb_state::IsSet,
519    St::R: color_rgb_state::IsSet,
520{
521    /// Build the final struct.
522    pub fn build(self) -> ColorRgb<S> {
523        ColorRgb {
524            b: self._fields.0.unwrap(),
525            g: self._fields.1.unwrap(),
526            r: self._fields.2.unwrap(),
527            extra_data: Default::default(),
528        }
529    }
530    /// Build the final struct with custom extra_data.
531    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ColorRgb<S> {
532        ColorRgb {
533            b: self._fields.0.unwrap(),
534            g: self._fields.1.unwrap(),
535            r: self._fields.2.unwrap(),
536            extra_data: Some(extra_data),
537        }
538    }
539}
540
541fn lexicon_doc_app_bsky_embed_external() -> LexiconDoc<'static> {
542    use alloc::collections::BTreeMap;
543    #[allow(unused_imports)]
544    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
545    use jacquard_lexicon::lexicon::*;
546    LexiconDoc {
547        lexicon: Lexicon::Lexicon1,
548        id: CowStr::new_static("app.bsky.embed.external"),
549        defs: {
550            let mut map = BTreeMap::new();
551            map.insert(
552                SmolStr::new_static("colorRGB"),
553                LexUserType::Object(LexObject {
554                    description: Some(CowStr::new_static(
555                        "RGB color definition, inspired by site.standard.theme.color#rgb",
556                    )),
557                    required: Some(vec![
558                        SmolStr::new_static("r"),
559                        SmolStr::new_static("g"),
560                        SmolStr::new_static("b"),
561                    ]),
562                    properties: {
563                        #[allow(unused_mut)]
564                        let mut map = BTreeMap::new();
565                        map.insert(
566                            SmolStr::new_static("b"),
567                            LexObjectProperty::Integer(LexInteger {
568                                minimum: Some(0i64),
569                                maximum: Some(255i64),
570                                ..Default::default()
571                            }),
572                        );
573                        map.insert(
574                            SmolStr::new_static("g"),
575                            LexObjectProperty::Integer(LexInteger {
576                                minimum: Some(0i64),
577                                maximum: Some(255i64),
578                                ..Default::default()
579                            }),
580                        );
581                        map.insert(
582                            SmolStr::new_static("r"),
583                            LexObjectProperty::Integer(LexInteger {
584                                minimum: Some(0i64),
585                                maximum: Some(255i64),
586                                ..Default::default()
587                            }),
588                        );
589                        map
590                    },
591                    ..Default::default()
592                }),
593            );
594            map.insert(
595                SmolStr::new_static("external"),
596                LexUserType::Object(LexObject {
597                    required: Some(
598                        vec![
599                            SmolStr::new_static("uri"), SmolStr::new_static("title"),
600                            SmolStr::new_static("description")
601                        ],
602                    ),
603                    properties: {
604                        #[allow(unused_mut)]
605                        let mut map = BTreeMap::new();
606                        map.insert(
607                            SmolStr::new_static("associatedRefs"),
608                            LexObjectProperty::Array(LexArray {
609                                description: Some(
610                                    CowStr::new_static(
611                                        "StrongRefs (uri+cid) of the Atmosphere records that backed this view.",
612                                    ),
613                                ),
614                                items: LexArrayItem::Ref(LexRef {
615                                    r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
616                                    ..Default::default()
617                                }),
618                                ..Default::default()
619                            }),
620                        );
621                        map.insert(
622                            SmolStr::new_static("description"),
623                            LexObjectProperty::String(LexString { ..Default::default() }),
624                        );
625                        map.insert(
626                            SmolStr::new_static("thumb"),
627                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
628                        );
629                        map.insert(
630                            SmolStr::new_static("title"),
631                            LexObjectProperty::String(LexString { ..Default::default() }),
632                        );
633                        map.insert(
634                            SmolStr::new_static("uri"),
635                            LexObjectProperty::String(LexString {
636                                format: Some(LexStringFormat::Uri),
637                                ..Default::default()
638                            }),
639                        );
640                        map
641                    },
642                    ..Default::default()
643                }),
644            );
645            map.insert(
646                SmolStr::new_static("main"),
647                LexUserType::Object(LexObject {
648                    description: Some(
649                        CowStr::new_static(
650                            "A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).",
651                        ),
652                    ),
653                    required: Some(vec![SmolStr::new_static("external")]),
654                    properties: {
655                        #[allow(unused_mut)]
656                        let mut map = BTreeMap::new();
657                        map.insert(
658                            SmolStr::new_static("external"),
659                            LexObjectProperty::Ref(LexRef {
660                                r#ref: CowStr::new_static("#external"),
661                                ..Default::default()
662                            }),
663                        );
664                        map
665                    },
666                    ..Default::default()
667                }),
668            );
669            map.insert(
670                SmolStr::new_static("view"),
671                LexUserType::Object(LexObject {
672                    required: Some(vec![SmolStr::new_static("external")]),
673                    properties: {
674                        #[allow(unused_mut)]
675                        let mut map = BTreeMap::new();
676                        map.insert(
677                            SmolStr::new_static("external"),
678                            LexObjectProperty::Ref(LexRef {
679                                r#ref: CowStr::new_static("#viewExternal"),
680                                ..Default::default()
681                            }),
682                        );
683                        map
684                    },
685                    ..Default::default()
686                }),
687            );
688            map.insert(
689                SmolStr::new_static("viewExternal"),
690                LexUserType::Object(LexObject {
691                    required: Some(
692                        vec![
693                            SmolStr::new_static("uri"), SmolStr::new_static("title"),
694                            SmolStr::new_static("description")
695                        ],
696                    ),
697                    properties: {
698                        #[allow(unused_mut)]
699                        let mut map = BTreeMap::new();
700                        map.insert(
701                            SmolStr::new_static("associatedProfiles"),
702                            LexObjectProperty::Array(LexArray {
703                                description: Some(
704                                    CowStr::new_static(
705                                        "Profiles of the owners of the Atmosphere records that backed this view.",
706                                    ),
707                                ),
708                                items: LexArrayItem::Ref(LexRef {
709                                    r#ref: CowStr::new_static(
710                                        "app.bsky.actor.defs#profileViewBasic",
711                                    ),
712                                    ..Default::default()
713                                }),
714                                ..Default::default()
715                            }),
716                        );
717                        map.insert(
718                            SmolStr::new_static("associatedRefs"),
719                            LexObjectProperty::Array(LexArray {
720                                description: Some(
721                                    CowStr::new_static(
722                                        "StrongRefs (uri+cid) of the Atmosphere records that backed this view.",
723                                    ),
724                                ),
725                                items: LexArrayItem::Ref(LexRef {
726                                    r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
727                                    ..Default::default()
728                                }),
729                                ..Default::default()
730                            }),
731                        );
732                        map.insert(
733                            SmolStr::new_static("createdAt"),
734                            LexObjectProperty::String(LexString {
735                                description: Some(
736                                    CowStr::new_static(
737                                        "When the external content was created, if available. Example: a publication date, for an article.",
738                                    ),
739                                ),
740                                format: Some(LexStringFormat::Datetime),
741                                ..Default::default()
742                            }),
743                        );
744                        map.insert(
745                            SmolStr::new_static("description"),
746                            LexObjectProperty::String(LexString { ..Default::default() }),
747                        );
748                        map.insert(
749                            SmolStr::new_static("labels"),
750                            LexObjectProperty::Array(LexArray {
751                                items: LexArrayItem::Ref(LexRef {
752                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
753                                    ..Default::default()
754                                }),
755                                ..Default::default()
756                            }),
757                        );
758                        map.insert(
759                            SmolStr::new_static("readingTime"),
760                            LexObjectProperty::Integer(LexInteger {
761                                ..Default::default()
762                            }),
763                        );
764                        map.insert(
765                            SmolStr::new_static("source"),
766                            LexObjectProperty::Ref(LexRef {
767                                r#ref: CowStr::new_static("#viewExternalSource"),
768                                ..Default::default()
769                            }),
770                        );
771                        map.insert(
772                            SmolStr::new_static("thumb"),
773                            LexObjectProperty::String(LexString {
774                                format: Some(LexStringFormat::Uri),
775                                ..Default::default()
776                            }),
777                        );
778                        map.insert(
779                            SmolStr::new_static("title"),
780                            LexObjectProperty::String(LexString { ..Default::default() }),
781                        );
782                        map.insert(
783                            SmolStr::new_static("updatedAt"),
784                            LexObjectProperty::String(LexString {
785                                description: Some(
786                                    CowStr::new_static(
787                                        "When the external content was updated, if available.",
788                                    ),
789                                ),
790                                format: Some(LexStringFormat::Datetime),
791                                ..Default::default()
792                            }),
793                        );
794                        map.insert(
795                            SmolStr::new_static("uri"),
796                            LexObjectProperty::String(LexString {
797                                format: Some(LexStringFormat::Uri),
798                                ..Default::default()
799                            }),
800                        );
801                        map
802                    },
803                    ..Default::default()
804                }),
805            );
806            map.insert(
807                SmolStr::new_static("viewExternalSource"),
808                LexUserType::Object(LexObject {
809                    description: Some(
810                        CowStr::new_static(
811                            "The source of an external embed, such as a standard.site publication.",
812                        ),
813                    ),
814                    required: Some(
815                        vec![SmolStr::new_static("uri"), SmolStr::new_static("title")],
816                    ),
817                    properties: {
818                        #[allow(unused_mut)]
819                        let mut map = BTreeMap::new();
820                        map.insert(
821                            SmolStr::new_static("description"),
822                            LexObjectProperty::String(LexString { ..Default::default() }),
823                        );
824                        map.insert(
825                            SmolStr::new_static("icon"),
826                            LexObjectProperty::String(LexString {
827                                description: Some(
828                                    CowStr::new_static(
829                                        "Fully-qualified URL where an icon representing the source can be fetched. For example, CDN location provided by the App View.",
830                                    ),
831                                ),
832                                format: Some(LexStringFormat::Uri),
833                                ..Default::default()
834                            }),
835                        );
836                        map.insert(
837                            SmolStr::new_static("theme"),
838                            LexObjectProperty::Ref(LexRef {
839                                r#ref: CowStr::new_static("#viewExternalSourceTheme"),
840                                ..Default::default()
841                            }),
842                        );
843                        map.insert(
844                            SmolStr::new_static("title"),
845                            LexObjectProperty::String(LexString { ..Default::default() }),
846                        );
847                        map.insert(
848                            SmolStr::new_static("uri"),
849                            LexObjectProperty::String(LexString {
850                                description: Some(
851                                    CowStr::new_static(
852                                        "URI of the source, if available. Example: the https:// URL of a site.standard.publication record.",
853                                    ),
854                                ),
855                                format: Some(LexStringFormat::Uri),
856                                ..Default::default()
857                            }),
858                        );
859                        map
860                    },
861                    ..Default::default()
862                }),
863            );
864            map.insert(
865                SmolStr::new_static("viewExternalSourceTheme"),
866                LexUserType::Object(LexObject {
867                    description: Some(
868                        CowStr::new_static(
869                            "The theme colors of an external source, such as a site.standard.publication. These colors may be used when rendering an embed from that source.",
870                        ),
871                    ),
872                    properties: {
873                        #[allow(unused_mut)]
874                        let mut map = BTreeMap::new();
875                        map.insert(
876                            SmolStr::new_static("accentForegroundRGB"),
877                            LexObjectProperty::Ref(LexRef {
878                                r#ref: CowStr::new_static("#colorRGB"),
879                                ..Default::default()
880                            }),
881                        );
882                        map.insert(
883                            SmolStr::new_static("accentRGB"),
884                            LexObjectProperty::Ref(LexRef {
885                                r#ref: CowStr::new_static("#colorRGB"),
886                                ..Default::default()
887                            }),
888                        );
889                        map.insert(
890                            SmolStr::new_static("backgroundRGB"),
891                            LexObjectProperty::Ref(LexRef {
892                                r#ref: CowStr::new_static("#colorRGB"),
893                                ..Default::default()
894                            }),
895                        );
896                        map.insert(
897                            SmolStr::new_static("foregroundRGB"),
898                            LexObjectProperty::Ref(LexRef {
899                                r#ref: CowStr::new_static("#colorRGB"),
900                                ..Default::default()
901                            }),
902                        );
903                        map
904                    },
905                    ..Default::default()
906                }),
907            );
908            map
909        },
910        ..Default::default()
911    }
912}
913
914pub mod external_state {
915
916    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
917    #[allow(unused)]
918    use ::core::marker::PhantomData;
919    mod sealed {
920        pub trait Sealed {}
921    }
922    /// State trait tracking which required fields have been set
923    pub trait State: sealed::Sealed {
924        type Description;
925        type Title;
926        type Uri;
927    }
928    /// Empty state - all required fields are unset
929    pub struct Empty(());
930    impl sealed::Sealed for Empty {}
931    impl State for Empty {
932        type Description = Unset;
933        type Title = Unset;
934        type Uri = Unset;
935    }
936    ///State transition - sets the `description` field to Set
937    pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>);
938    impl<St: State> sealed::Sealed for SetDescription<St> {}
939    impl<St: State> State for SetDescription<St> {
940        type Description = Set<members::description>;
941        type Title = St::Title;
942        type Uri = St::Uri;
943    }
944    ///State transition - sets the `title` field to Set
945    pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
946    impl<St: State> sealed::Sealed for SetTitle<St> {}
947    impl<St: State> State for SetTitle<St> {
948        type Description = St::Description;
949        type Title = Set<members::title>;
950        type Uri = St::Uri;
951    }
952    ///State transition - sets the `uri` field to Set
953    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
954    impl<St: State> sealed::Sealed for SetUri<St> {}
955    impl<St: State> State for SetUri<St> {
956        type Description = St::Description;
957        type Title = St::Title;
958        type Uri = Set<members::uri>;
959    }
960    /// Marker types for field names
961    #[allow(non_camel_case_types)]
962    pub mod members {
963        ///Marker type for the `description` field
964        pub struct description(());
965        ///Marker type for the `title` field
966        pub struct title(());
967        ///Marker type for the `uri` field
968        pub struct uri(());
969    }
970}
971
972/// Builder for constructing an instance of this type.
973pub struct ExternalBuilder<St: external_state::State, S: BosStr = DefaultStr> {
974    _state: PhantomData<fn() -> St>,
975    _fields: (
976        Option<Vec<StrongRef<S>>>,
977        Option<S>,
978        Option<BlobRef<S>>,
979        Option<S>,
980        Option<UriValue<S>>,
981    ),
982    _type: PhantomData<fn() -> S>,
983}
984
985impl External<DefaultStr> {
986    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
987    pub fn new() -> ExternalBuilder<external_state::Empty, DefaultStr> {
988        ExternalBuilder::new()
989    }
990}
991
992impl<S: BosStr> External<S> {
993    /// Create a new builder for this type
994    pub fn builder() -> ExternalBuilder<external_state::Empty, S> {
995        ExternalBuilder::builder()
996    }
997}
998
999impl ExternalBuilder<external_state::Empty, DefaultStr> {
1000    /// Create a new builder with all fields unset, using the default string type, if needed
1001    pub fn new() -> Self {
1002        ExternalBuilder {
1003            _state: PhantomData,
1004            _fields: (None, None, None, None, None),
1005            _type: PhantomData,
1006        }
1007    }
1008}
1009
1010impl<S: BosStr> ExternalBuilder<external_state::Empty, S> {
1011    /// Create a new builder with all fields unset
1012    pub fn builder() -> Self {
1013        ExternalBuilder {
1014            _state: PhantomData,
1015            _fields: (None, None, None, None, None),
1016            _type: PhantomData,
1017        }
1018    }
1019}
1020
1021impl<St: external_state::State, S: BosStr> ExternalBuilder<St, S> {
1022    /// Set the `associatedRefs` field (optional)
1023    pub fn associated_refs(mut self, value: impl Into<Option<Vec<StrongRef<S>>>>) -> Self {
1024        self._fields.0 = value.into();
1025        self
1026    }
1027    /// Set the `associatedRefs` field to an Option value (optional)
1028    pub fn maybe_associated_refs(mut self, value: Option<Vec<StrongRef<S>>>) -> Self {
1029        self._fields.0 = value;
1030        self
1031    }
1032}
1033
1034impl<St, S: BosStr> ExternalBuilder<St, S>
1035where
1036    St: external_state::State,
1037    St::Description: external_state::IsUnset,
1038{
1039    /// Set the `description` field (required)
1040    pub fn description(
1041        mut self,
1042        value: impl Into<S>,
1043    ) -> ExternalBuilder<external_state::SetDescription<St>, S> {
1044        self._fields.1 = Option::Some(value.into());
1045        ExternalBuilder {
1046            _state: PhantomData,
1047            _fields: self._fields,
1048            _type: PhantomData,
1049        }
1050    }
1051}
1052
1053impl<St: external_state::State, S: BosStr> ExternalBuilder<St, S> {
1054    /// Set the `thumb` field (optional)
1055    pub fn thumb(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
1056        self._fields.2 = value.into();
1057        self
1058    }
1059    /// Set the `thumb` field to an Option value (optional)
1060    pub fn maybe_thumb(mut self, value: Option<BlobRef<S>>) -> Self {
1061        self._fields.2 = value;
1062        self
1063    }
1064}
1065
1066impl<St, S: BosStr> ExternalBuilder<St, S>
1067where
1068    St: external_state::State,
1069    St::Title: external_state::IsUnset,
1070{
1071    /// Set the `title` field (required)
1072    pub fn title(
1073        mut self,
1074        value: impl Into<S>,
1075    ) -> ExternalBuilder<external_state::SetTitle<St>, S> {
1076        self._fields.3 = Option::Some(value.into());
1077        ExternalBuilder {
1078            _state: PhantomData,
1079            _fields: self._fields,
1080            _type: PhantomData,
1081        }
1082    }
1083}
1084
1085impl<St, S: BosStr> ExternalBuilder<St, S>
1086where
1087    St: external_state::State,
1088    St::Uri: external_state::IsUnset,
1089{
1090    /// Set the `uri` field (required)
1091    pub fn uri(
1092        mut self,
1093        value: impl Into<UriValue<S>>,
1094    ) -> ExternalBuilder<external_state::SetUri<St>, S> {
1095        self._fields.4 = Option::Some(value.into());
1096        ExternalBuilder {
1097            _state: PhantomData,
1098            _fields: self._fields,
1099            _type: PhantomData,
1100        }
1101    }
1102}
1103
1104impl<St, S: BosStr> ExternalBuilder<St, S>
1105where
1106    St: external_state::State,
1107    St::Description: external_state::IsSet,
1108    St::Title: external_state::IsSet,
1109    St::Uri: external_state::IsSet,
1110{
1111    /// Build the final struct.
1112    pub fn build(self) -> External<S> {
1113        External {
1114            associated_refs: self._fields.0,
1115            description: self._fields.1.unwrap(),
1116            thumb: self._fields.2,
1117            title: self._fields.3.unwrap(),
1118            uri: self._fields.4.unwrap(),
1119            extra_data: Default::default(),
1120        }
1121    }
1122    /// Build the final struct with custom extra_data.
1123    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> External<S> {
1124        External {
1125            associated_refs: self._fields.0,
1126            description: self._fields.1.unwrap(),
1127            thumb: self._fields.2,
1128            title: self._fields.3.unwrap(),
1129            uri: self._fields.4.unwrap(),
1130            extra_data: Some(extra_data),
1131        }
1132    }
1133}
1134
1135pub mod external_record_state {
1136
1137    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1138    #[allow(unused)]
1139    use ::core::marker::PhantomData;
1140    mod sealed {
1141        pub trait Sealed {}
1142    }
1143    /// State trait tracking which required fields have been set
1144    pub trait State: sealed::Sealed {
1145        type External;
1146    }
1147    /// Empty state - all required fields are unset
1148    pub struct Empty(());
1149    impl sealed::Sealed for Empty {}
1150    impl State for Empty {
1151        type External = Unset;
1152    }
1153    ///State transition - sets the `external` field to Set
1154    pub struct SetExternal<St: State = Empty>(PhantomData<fn() -> St>);
1155    impl<St: State> sealed::Sealed for SetExternal<St> {}
1156    impl<St: State> State for SetExternal<St> {
1157        type External = Set<members::external>;
1158    }
1159    /// Marker types for field names
1160    #[allow(non_camel_case_types)]
1161    pub mod members {
1162        ///Marker type for the `external` field
1163        pub struct external(());
1164    }
1165}
1166
1167/// Builder for constructing an instance of this type.
1168pub struct ExternalRecordBuilder<St: external_record_state::State, S: BosStr = DefaultStr> {
1169    _state: PhantomData<fn() -> St>,
1170    _fields: (Option<external::External<S>>,),
1171    _type: PhantomData<fn() -> S>,
1172}
1173
1174impl ExternalRecord<DefaultStr> {
1175    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1176    pub fn new() -> ExternalRecordBuilder<external_record_state::Empty, DefaultStr> {
1177        ExternalRecordBuilder::new()
1178    }
1179}
1180
1181impl<S: BosStr> ExternalRecord<S> {
1182    /// Create a new builder for this type
1183    pub fn builder() -> ExternalRecordBuilder<external_record_state::Empty, S> {
1184        ExternalRecordBuilder::builder()
1185    }
1186}
1187
1188impl ExternalRecordBuilder<external_record_state::Empty, DefaultStr> {
1189    /// Create a new builder with all fields unset, using the default string type, if needed
1190    pub fn new() -> Self {
1191        ExternalRecordBuilder {
1192            _state: PhantomData,
1193            _fields: (None,),
1194            _type: PhantomData,
1195        }
1196    }
1197}
1198
1199impl<S: BosStr> ExternalRecordBuilder<external_record_state::Empty, S> {
1200    /// Create a new builder with all fields unset
1201    pub fn builder() -> Self {
1202        ExternalRecordBuilder {
1203            _state: PhantomData,
1204            _fields: (None,),
1205            _type: PhantomData,
1206        }
1207    }
1208}
1209
1210impl<St, S: BosStr> ExternalRecordBuilder<St, S>
1211where
1212    St: external_record_state::State,
1213    St::External: external_record_state::IsUnset,
1214{
1215    /// Set the `external` field (required)
1216    pub fn external(
1217        mut self,
1218        value: impl Into<external::External<S>>,
1219    ) -> ExternalRecordBuilder<external_record_state::SetExternal<St>, S> {
1220        self._fields.0 = Option::Some(value.into());
1221        ExternalRecordBuilder {
1222            _state: PhantomData,
1223            _fields: self._fields,
1224            _type: PhantomData,
1225        }
1226    }
1227}
1228
1229impl<St, S: BosStr> ExternalRecordBuilder<St, S>
1230where
1231    St: external_record_state::State,
1232    St::External: external_record_state::IsSet,
1233{
1234    /// Build the final struct.
1235    pub fn build(self) -> ExternalRecord<S> {
1236        ExternalRecord {
1237            external: self._fields.0.unwrap(),
1238            extra_data: Default::default(),
1239        }
1240    }
1241    /// Build the final struct with custom extra_data.
1242    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ExternalRecord<S> {
1243        ExternalRecord {
1244            external: self._fields.0.unwrap(),
1245            extra_data: Some(extra_data),
1246        }
1247    }
1248}
1249
1250pub mod view_state {
1251
1252    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1253    #[allow(unused)]
1254    use ::core::marker::PhantomData;
1255    mod sealed {
1256        pub trait Sealed {}
1257    }
1258    /// State trait tracking which required fields have been set
1259    pub trait State: sealed::Sealed {
1260        type External;
1261    }
1262    /// Empty state - all required fields are unset
1263    pub struct Empty(());
1264    impl sealed::Sealed for Empty {}
1265    impl State for Empty {
1266        type External = Unset;
1267    }
1268    ///State transition - sets the `external` field to Set
1269    pub struct SetExternal<St: State = Empty>(PhantomData<fn() -> St>);
1270    impl<St: State> sealed::Sealed for SetExternal<St> {}
1271    impl<St: State> State for SetExternal<St> {
1272        type External = Set<members::external>;
1273    }
1274    /// Marker types for field names
1275    #[allow(non_camel_case_types)]
1276    pub mod members {
1277        ///Marker type for the `external` field
1278        pub struct external(());
1279    }
1280}
1281
1282/// Builder for constructing an instance of this type.
1283pub struct ViewBuilder<St: view_state::State, S: BosStr = DefaultStr> {
1284    _state: PhantomData<fn() -> St>,
1285    _fields: (Option<external::ViewExternal<S>>,),
1286    _type: PhantomData<fn() -> S>,
1287}
1288
1289impl View<DefaultStr> {
1290    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1291    pub fn new() -> ViewBuilder<view_state::Empty, DefaultStr> {
1292        ViewBuilder::new()
1293    }
1294}
1295
1296impl<S: BosStr> View<S> {
1297    /// Create a new builder for this type
1298    pub fn builder() -> ViewBuilder<view_state::Empty, S> {
1299        ViewBuilder::builder()
1300    }
1301}
1302
1303impl ViewBuilder<view_state::Empty, DefaultStr> {
1304    /// Create a new builder with all fields unset, using the default string type, if needed
1305    pub fn new() -> Self {
1306        ViewBuilder {
1307            _state: PhantomData,
1308            _fields: (None,),
1309            _type: PhantomData,
1310        }
1311    }
1312}
1313
1314impl<S: BosStr> ViewBuilder<view_state::Empty, S> {
1315    /// Create a new builder with all fields unset
1316    pub fn builder() -> Self {
1317        ViewBuilder {
1318            _state: PhantomData,
1319            _fields: (None,),
1320            _type: PhantomData,
1321        }
1322    }
1323}
1324
1325impl<St, S: BosStr> ViewBuilder<St, S>
1326where
1327    St: view_state::State,
1328    St::External: view_state::IsUnset,
1329{
1330    /// Set the `external` field (required)
1331    pub fn external(
1332        mut self,
1333        value: impl Into<external::ViewExternal<S>>,
1334    ) -> ViewBuilder<view_state::SetExternal<St>, S> {
1335        self._fields.0 = Option::Some(value.into());
1336        ViewBuilder {
1337            _state: PhantomData,
1338            _fields: self._fields,
1339            _type: PhantomData,
1340        }
1341    }
1342}
1343
1344impl<St, S: BosStr> ViewBuilder<St, S>
1345where
1346    St: view_state::State,
1347    St::External: view_state::IsSet,
1348{
1349    /// Build the final struct.
1350    pub fn build(self) -> View<S> {
1351        View {
1352            external: self._fields.0.unwrap(),
1353            extra_data: Default::default(),
1354        }
1355    }
1356    /// Build the final struct with custom extra_data.
1357    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> View<S> {
1358        View {
1359            external: self._fields.0.unwrap(),
1360            extra_data: Some(extra_data),
1361        }
1362    }
1363}
1364
1365pub mod view_external_state {
1366
1367    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1368    #[allow(unused)]
1369    use ::core::marker::PhantomData;
1370    mod sealed {
1371        pub trait Sealed {}
1372    }
1373    /// State trait tracking which required fields have been set
1374    pub trait State: sealed::Sealed {
1375        type Description;
1376        type Title;
1377        type Uri;
1378    }
1379    /// Empty state - all required fields are unset
1380    pub struct Empty(());
1381    impl sealed::Sealed for Empty {}
1382    impl State for Empty {
1383        type Description = Unset;
1384        type Title = Unset;
1385        type Uri = Unset;
1386    }
1387    ///State transition - sets the `description` field to Set
1388    pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>);
1389    impl<St: State> sealed::Sealed for SetDescription<St> {}
1390    impl<St: State> State for SetDescription<St> {
1391        type Description = Set<members::description>;
1392        type Title = St::Title;
1393        type Uri = St::Uri;
1394    }
1395    ///State transition - sets the `title` field to Set
1396    pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
1397    impl<St: State> sealed::Sealed for SetTitle<St> {}
1398    impl<St: State> State for SetTitle<St> {
1399        type Description = St::Description;
1400        type Title = Set<members::title>;
1401        type Uri = St::Uri;
1402    }
1403    ///State transition - sets the `uri` field to Set
1404    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1405    impl<St: State> sealed::Sealed for SetUri<St> {}
1406    impl<St: State> State for SetUri<St> {
1407        type Description = St::Description;
1408        type Title = St::Title;
1409        type Uri = Set<members::uri>;
1410    }
1411    /// Marker types for field names
1412    #[allow(non_camel_case_types)]
1413    pub mod members {
1414        ///Marker type for the `description` field
1415        pub struct description(());
1416        ///Marker type for the `title` field
1417        pub struct title(());
1418        ///Marker type for the `uri` field
1419        pub struct uri(());
1420    }
1421}
1422
1423/// Builder for constructing an instance of this type.
1424pub struct ViewExternalBuilder<St: view_external_state::State, S: BosStr = DefaultStr> {
1425    _state: PhantomData<fn() -> St>,
1426    _fields: (
1427        Option<Vec<ProfileViewBasic<S>>>,
1428        Option<Vec<StrongRef<S>>>,
1429        Option<Datetime>,
1430        Option<S>,
1431        Option<Vec<Label<S>>>,
1432        Option<i64>,
1433        Option<external::ViewExternalSource<S>>,
1434        Option<UriValue<S>>,
1435        Option<S>,
1436        Option<Datetime>,
1437        Option<UriValue<S>>,
1438    ),
1439    _type: PhantomData<fn() -> S>,
1440}
1441
1442impl ViewExternal<DefaultStr> {
1443    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1444    pub fn new() -> ViewExternalBuilder<view_external_state::Empty, DefaultStr> {
1445        ViewExternalBuilder::new()
1446    }
1447}
1448
1449impl<S: BosStr> ViewExternal<S> {
1450    /// Create a new builder for this type
1451    pub fn builder() -> ViewExternalBuilder<view_external_state::Empty, S> {
1452        ViewExternalBuilder::builder()
1453    }
1454}
1455
1456impl ViewExternalBuilder<view_external_state::Empty, DefaultStr> {
1457    /// Create a new builder with all fields unset, using the default string type, if needed
1458    pub fn new() -> Self {
1459        ViewExternalBuilder {
1460            _state: PhantomData,
1461            _fields: (
1462                None, None, None, None, None, None, None, None, None, None, None,
1463            ),
1464            _type: PhantomData,
1465        }
1466    }
1467}
1468
1469impl<S: BosStr> ViewExternalBuilder<view_external_state::Empty, S> {
1470    /// Create a new builder with all fields unset
1471    pub fn builder() -> Self {
1472        ViewExternalBuilder {
1473            _state: PhantomData,
1474            _fields: (
1475                None, None, None, None, None, None, None, None, None, None, None,
1476            ),
1477            _type: PhantomData,
1478        }
1479    }
1480}
1481
1482impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1483    /// Set the `associatedProfiles` field (optional)
1484    pub fn associated_profiles(
1485        mut self,
1486        value: impl Into<Option<Vec<ProfileViewBasic<S>>>>,
1487    ) -> Self {
1488        self._fields.0 = value.into();
1489        self
1490    }
1491    /// Set the `associatedProfiles` field to an Option value (optional)
1492    pub fn maybe_associated_profiles(mut self, value: Option<Vec<ProfileViewBasic<S>>>) -> Self {
1493        self._fields.0 = value;
1494        self
1495    }
1496}
1497
1498impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1499    /// Set the `associatedRefs` field (optional)
1500    pub fn associated_refs(mut self, value: impl Into<Option<Vec<StrongRef<S>>>>) -> Self {
1501        self._fields.1 = value.into();
1502        self
1503    }
1504    /// Set the `associatedRefs` field to an Option value (optional)
1505    pub fn maybe_associated_refs(mut self, value: Option<Vec<StrongRef<S>>>) -> Self {
1506        self._fields.1 = value;
1507        self
1508    }
1509}
1510
1511impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1512    /// Set the `createdAt` field (optional)
1513    pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
1514        self._fields.2 = value.into();
1515        self
1516    }
1517    /// Set the `createdAt` field to an Option value (optional)
1518    pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
1519        self._fields.2 = value;
1520        self
1521    }
1522}
1523
1524impl<St, S: BosStr> ViewExternalBuilder<St, S>
1525where
1526    St: view_external_state::State,
1527    St::Description: view_external_state::IsUnset,
1528{
1529    /// Set the `description` field (required)
1530    pub fn description(
1531        mut self,
1532        value: impl Into<S>,
1533    ) -> ViewExternalBuilder<view_external_state::SetDescription<St>, S> {
1534        self._fields.3 = Option::Some(value.into());
1535        ViewExternalBuilder {
1536            _state: PhantomData,
1537            _fields: self._fields,
1538            _type: PhantomData,
1539        }
1540    }
1541}
1542
1543impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1544    /// Set the `labels` field (optional)
1545    pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
1546        self._fields.4 = value.into();
1547        self
1548    }
1549    /// Set the `labels` field to an Option value (optional)
1550    pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
1551        self._fields.4 = value;
1552        self
1553    }
1554}
1555
1556impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1557    /// Set the `readingTime` field (optional)
1558    pub fn reading_time(mut self, value: impl Into<Option<i64>>) -> Self {
1559        self._fields.5 = value.into();
1560        self
1561    }
1562    /// Set the `readingTime` field to an Option value (optional)
1563    pub fn maybe_reading_time(mut self, value: Option<i64>) -> Self {
1564        self._fields.5 = value;
1565        self
1566    }
1567}
1568
1569impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1570    /// Set the `source` field (optional)
1571    pub fn source(mut self, value: impl Into<Option<external::ViewExternalSource<S>>>) -> Self {
1572        self._fields.6 = value.into();
1573        self
1574    }
1575    /// Set the `source` field to an Option value (optional)
1576    pub fn maybe_source(mut self, value: Option<external::ViewExternalSource<S>>) -> Self {
1577        self._fields.6 = value;
1578        self
1579    }
1580}
1581
1582impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1583    /// Set the `thumb` field (optional)
1584    pub fn thumb(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
1585        self._fields.7 = value.into();
1586        self
1587    }
1588    /// Set the `thumb` field to an Option value (optional)
1589    pub fn maybe_thumb(mut self, value: Option<UriValue<S>>) -> Self {
1590        self._fields.7 = value;
1591        self
1592    }
1593}
1594
1595impl<St, S: BosStr> ViewExternalBuilder<St, S>
1596where
1597    St: view_external_state::State,
1598    St::Title: view_external_state::IsUnset,
1599{
1600    /// Set the `title` field (required)
1601    pub fn title(
1602        mut self,
1603        value: impl Into<S>,
1604    ) -> ViewExternalBuilder<view_external_state::SetTitle<St>, S> {
1605        self._fields.8 = Option::Some(value.into());
1606        ViewExternalBuilder {
1607            _state: PhantomData,
1608            _fields: self._fields,
1609            _type: PhantomData,
1610        }
1611    }
1612}
1613
1614impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
1615    /// Set the `updatedAt` field (optional)
1616    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
1617        self._fields.9 = value.into();
1618        self
1619    }
1620    /// Set the `updatedAt` field to an Option value (optional)
1621    pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
1622        self._fields.9 = value;
1623        self
1624    }
1625}
1626
1627impl<St, S: BosStr> ViewExternalBuilder<St, S>
1628where
1629    St: view_external_state::State,
1630    St::Uri: view_external_state::IsUnset,
1631{
1632    /// Set the `uri` field (required)
1633    pub fn uri(
1634        mut self,
1635        value: impl Into<UriValue<S>>,
1636    ) -> ViewExternalBuilder<view_external_state::SetUri<St>, S> {
1637        self._fields.10 = Option::Some(value.into());
1638        ViewExternalBuilder {
1639            _state: PhantomData,
1640            _fields: self._fields,
1641            _type: PhantomData,
1642        }
1643    }
1644}
1645
1646impl<St, S: BosStr> ViewExternalBuilder<St, S>
1647where
1648    St: view_external_state::State,
1649    St::Description: view_external_state::IsSet,
1650    St::Title: view_external_state::IsSet,
1651    St::Uri: view_external_state::IsSet,
1652{
1653    /// Build the final struct.
1654    pub fn build(self) -> ViewExternal<S> {
1655        ViewExternal {
1656            associated_profiles: self._fields.0,
1657            associated_refs: self._fields.1,
1658            created_at: self._fields.2,
1659            description: self._fields.3.unwrap(),
1660            labels: self._fields.4,
1661            reading_time: self._fields.5,
1662            source: self._fields.6,
1663            thumb: self._fields.7,
1664            title: self._fields.8.unwrap(),
1665            updated_at: self._fields.9,
1666            uri: self._fields.10.unwrap(),
1667            extra_data: Default::default(),
1668        }
1669    }
1670    /// Build the final struct with custom extra_data.
1671    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewExternal<S> {
1672        ViewExternal {
1673            associated_profiles: self._fields.0,
1674            associated_refs: self._fields.1,
1675            created_at: self._fields.2,
1676            description: self._fields.3.unwrap(),
1677            labels: self._fields.4,
1678            reading_time: self._fields.5,
1679            source: self._fields.6,
1680            thumb: self._fields.7,
1681            title: self._fields.8.unwrap(),
1682            updated_at: self._fields.9,
1683            uri: self._fields.10.unwrap(),
1684            extra_data: Some(extra_data),
1685        }
1686    }
1687}
1688
1689pub mod view_external_source_state {
1690
1691    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1692    #[allow(unused)]
1693    use ::core::marker::PhantomData;
1694    mod sealed {
1695        pub trait Sealed {}
1696    }
1697    /// State trait tracking which required fields have been set
1698    pub trait State: sealed::Sealed {
1699        type Title;
1700        type Uri;
1701    }
1702    /// Empty state - all required fields are unset
1703    pub struct Empty(());
1704    impl sealed::Sealed for Empty {}
1705    impl State for Empty {
1706        type Title = Unset;
1707        type Uri = Unset;
1708    }
1709    ///State transition - sets the `title` field to Set
1710    pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
1711    impl<St: State> sealed::Sealed for SetTitle<St> {}
1712    impl<St: State> State for SetTitle<St> {
1713        type Title = Set<members::title>;
1714        type Uri = St::Uri;
1715    }
1716    ///State transition - sets the `uri` field to Set
1717    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1718    impl<St: State> sealed::Sealed for SetUri<St> {}
1719    impl<St: State> State for SetUri<St> {
1720        type Title = St::Title;
1721        type Uri = Set<members::uri>;
1722    }
1723    /// Marker types for field names
1724    #[allow(non_camel_case_types)]
1725    pub mod members {
1726        ///Marker type for the `title` field
1727        pub struct title(());
1728        ///Marker type for the `uri` field
1729        pub struct uri(());
1730    }
1731}
1732
1733/// Builder for constructing an instance of this type.
1734pub struct ViewExternalSourceBuilder<St: view_external_source_state::State, S: BosStr = DefaultStr>
1735{
1736    _state: PhantomData<fn() -> St>,
1737    _fields: (
1738        Option<S>,
1739        Option<UriValue<S>>,
1740        Option<external::ViewExternalSourceTheme<S>>,
1741        Option<S>,
1742        Option<UriValue<S>>,
1743    ),
1744    _type: PhantomData<fn() -> S>,
1745}
1746
1747impl ViewExternalSource<DefaultStr> {
1748    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1749    pub fn new() -> ViewExternalSourceBuilder<view_external_source_state::Empty, DefaultStr> {
1750        ViewExternalSourceBuilder::new()
1751    }
1752}
1753
1754impl<S: BosStr> ViewExternalSource<S> {
1755    /// Create a new builder for this type
1756    pub fn builder() -> ViewExternalSourceBuilder<view_external_source_state::Empty, S> {
1757        ViewExternalSourceBuilder::builder()
1758    }
1759}
1760
1761impl ViewExternalSourceBuilder<view_external_source_state::Empty, DefaultStr> {
1762    /// Create a new builder with all fields unset, using the default string type, if needed
1763    pub fn new() -> Self {
1764        ViewExternalSourceBuilder {
1765            _state: PhantomData,
1766            _fields: (None, None, None, None, None),
1767            _type: PhantomData,
1768        }
1769    }
1770}
1771
1772impl<S: BosStr> ViewExternalSourceBuilder<view_external_source_state::Empty, S> {
1773    /// Create a new builder with all fields unset
1774    pub fn builder() -> Self {
1775        ViewExternalSourceBuilder {
1776            _state: PhantomData,
1777            _fields: (None, None, None, None, None),
1778            _type: PhantomData,
1779        }
1780    }
1781}
1782
1783impl<St: view_external_source_state::State, S: BosStr> ViewExternalSourceBuilder<St, S> {
1784    /// Set the `description` field (optional)
1785    pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
1786        self._fields.0 = value.into();
1787        self
1788    }
1789    /// Set the `description` field to an Option value (optional)
1790    pub fn maybe_description(mut self, value: Option<S>) -> Self {
1791        self._fields.0 = value;
1792        self
1793    }
1794}
1795
1796impl<St: view_external_source_state::State, S: BosStr> ViewExternalSourceBuilder<St, S> {
1797    /// Set the `icon` field (optional)
1798    pub fn icon(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
1799        self._fields.1 = value.into();
1800        self
1801    }
1802    /// Set the `icon` field to an Option value (optional)
1803    pub fn maybe_icon(mut self, value: Option<UriValue<S>>) -> Self {
1804        self._fields.1 = value;
1805        self
1806    }
1807}
1808
1809impl<St: view_external_source_state::State, S: BosStr> ViewExternalSourceBuilder<St, S> {
1810    /// Set the `theme` field (optional)
1811    pub fn theme(mut self, value: impl Into<Option<external::ViewExternalSourceTheme<S>>>) -> Self {
1812        self._fields.2 = value.into();
1813        self
1814    }
1815    /// Set the `theme` field to an Option value (optional)
1816    pub fn maybe_theme(mut self, value: Option<external::ViewExternalSourceTheme<S>>) -> Self {
1817        self._fields.2 = value;
1818        self
1819    }
1820}
1821
1822impl<St, S: BosStr> ViewExternalSourceBuilder<St, S>
1823where
1824    St: view_external_source_state::State,
1825    St::Title: view_external_source_state::IsUnset,
1826{
1827    /// Set the `title` field (required)
1828    pub fn title(
1829        mut self,
1830        value: impl Into<S>,
1831    ) -> ViewExternalSourceBuilder<view_external_source_state::SetTitle<St>, S> {
1832        self._fields.3 = Option::Some(value.into());
1833        ViewExternalSourceBuilder {
1834            _state: PhantomData,
1835            _fields: self._fields,
1836            _type: PhantomData,
1837        }
1838    }
1839}
1840
1841impl<St, S: BosStr> ViewExternalSourceBuilder<St, S>
1842where
1843    St: view_external_source_state::State,
1844    St::Uri: view_external_source_state::IsUnset,
1845{
1846    /// Set the `uri` field (required)
1847    pub fn uri(
1848        mut self,
1849        value: impl Into<UriValue<S>>,
1850    ) -> ViewExternalSourceBuilder<view_external_source_state::SetUri<St>, S> {
1851        self._fields.4 = Option::Some(value.into());
1852        ViewExternalSourceBuilder {
1853            _state: PhantomData,
1854            _fields: self._fields,
1855            _type: PhantomData,
1856        }
1857    }
1858}
1859
1860impl<St, S: BosStr> ViewExternalSourceBuilder<St, S>
1861where
1862    St: view_external_source_state::State,
1863    St::Title: view_external_source_state::IsSet,
1864    St::Uri: view_external_source_state::IsSet,
1865{
1866    /// Build the final struct.
1867    pub fn build(self) -> ViewExternalSource<S> {
1868        ViewExternalSource {
1869            description: self._fields.0,
1870            icon: self._fields.1,
1871            theme: self._fields.2,
1872            title: self._fields.3.unwrap(),
1873            uri: self._fields.4.unwrap(),
1874            extra_data: Default::default(),
1875        }
1876    }
1877    /// Build the final struct with custom extra_data.
1878    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewExternalSource<S> {
1879        ViewExternalSource {
1880            description: self._fields.0,
1881            icon: self._fields.1,
1882            theme: self._fields.2,
1883            title: self._fields.3.unwrap(),
1884            uri: self._fields.4.unwrap(),
1885            extra_data: Some(extra_data),
1886        }
1887    }
1888}