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#[jacquard_derive::lexicon]
9#[derive(
10    serde::Serialize,
11    serde::Deserialize,
12    Debug,
13    Clone,
14    PartialEq,
15    Eq,
16    jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct External<'a> {
20    #[serde(borrow)]
21    pub description: jacquard_common::CowStr<'a>,
22    #[serde(skip_serializing_if = "std::option::Option::is_none")]
23    #[serde(borrow)]
24    pub thumb: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
25    #[serde(borrow)]
26    pub title: jacquard_common::CowStr<'a>,
27    #[serde(borrow)]
28    pub uri: jacquard_common::types::string::Uri<'a>,
29}
30
31pub mod external_state {
32
33    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
34    #[allow(unused)]
35    use ::core::marker::PhantomData;
36    mod sealed {
37        pub trait Sealed {}
38    }
39    /// State trait tracking which required fields have been set
40    pub trait State: sealed::Sealed {
41        type Title;
42        type Uri;
43        type Description;
44    }
45    /// Empty state - all required fields are unset
46    pub struct Empty(());
47    impl sealed::Sealed for Empty {}
48    impl State for Empty {
49        type Title = Unset;
50        type Uri = Unset;
51        type Description = Unset;
52    }
53    ///State transition - sets the `title` field to Set
54    pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
55    impl<S: State> sealed::Sealed for SetTitle<S> {}
56    impl<S: State> State for SetTitle<S> {
57        type Title = Set<members::title>;
58        type Uri = S::Uri;
59        type Description = S::Description;
60    }
61    ///State transition - sets the `uri` field to Set
62    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
63    impl<S: State> sealed::Sealed for SetUri<S> {}
64    impl<S: State> State for SetUri<S> {
65        type Title = S::Title;
66        type Uri = Set<members::uri>;
67        type Description = S::Description;
68    }
69    ///State transition - sets the `description` field to Set
70    pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>);
71    impl<S: State> sealed::Sealed for SetDescription<S> {}
72    impl<S: State> State for SetDescription<S> {
73        type Title = S::Title;
74        type Uri = S::Uri;
75        type Description = Set<members::description>;
76    }
77    /// Marker types for field names
78    #[allow(non_camel_case_types)]
79    pub mod members {
80        ///Marker type for the `title` field
81        pub struct title(());
82        ///Marker type for the `uri` field
83        pub struct uri(());
84        ///Marker type for the `description` field
85        pub struct description(());
86    }
87}
88
89/// Builder for constructing an instance of this type
90pub struct ExternalBuilder<'a, S: external_state::State> {
91    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
92    __unsafe_private_named: (
93        ::core::option::Option<jacquard_common::CowStr<'a>>,
94        ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
95        ::core::option::Option<jacquard_common::CowStr<'a>>,
96        ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
97    ),
98    _phantom: ::core::marker::PhantomData<&'a ()>,
99}
100
101impl<'a> External<'a> {
102    /// Create a new builder for this type
103    pub fn new() -> ExternalBuilder<'a, external_state::Empty> {
104        ExternalBuilder::new()
105    }
106}
107
108impl<'a> ExternalBuilder<'a, external_state::Empty> {
109    /// Create a new builder with all fields unset
110    pub fn new() -> Self {
111        ExternalBuilder {
112            _phantom_state: ::core::marker::PhantomData,
113            __unsafe_private_named: (None, None, None, None),
114            _phantom: ::core::marker::PhantomData,
115        }
116    }
117}
118
119impl<'a, S> ExternalBuilder<'a, S>
120where
121    S: external_state::State,
122    S::Description: external_state::IsUnset,
123{
124    /// Set the `description` field (required)
125    pub fn description(
126        mut self,
127        value: impl Into<jacquard_common::CowStr<'a>>,
128    ) -> ExternalBuilder<'a, external_state::SetDescription<S>> {
129        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
130        ExternalBuilder {
131            _phantom_state: ::core::marker::PhantomData,
132            __unsafe_private_named: self.__unsafe_private_named,
133            _phantom: ::core::marker::PhantomData,
134        }
135    }
136}
137
138impl<'a, S: external_state::State> ExternalBuilder<'a, S> {
139    /// Set the `thumb` field (optional)
140    pub fn thumb(
141        mut self,
142        value: impl Into<Option<jacquard_common::types::blob::BlobRef<'a>>>,
143    ) -> Self {
144        self.__unsafe_private_named.1 = value.into();
145        self
146    }
147    /// Set the `thumb` field to an Option value (optional)
148    pub fn maybe_thumb(
149        mut self,
150        value: Option<jacquard_common::types::blob::BlobRef<'a>>,
151    ) -> Self {
152        self.__unsafe_private_named.1 = value;
153        self
154    }
155}
156
157impl<'a, S> ExternalBuilder<'a, S>
158where
159    S: external_state::State,
160    S::Title: external_state::IsUnset,
161{
162    /// Set the `title` field (required)
163    pub fn title(
164        mut self,
165        value: impl Into<jacquard_common::CowStr<'a>>,
166    ) -> ExternalBuilder<'a, external_state::SetTitle<S>> {
167        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
168        ExternalBuilder {
169            _phantom_state: ::core::marker::PhantomData,
170            __unsafe_private_named: self.__unsafe_private_named,
171            _phantom: ::core::marker::PhantomData,
172        }
173    }
174}
175
176impl<'a, S> ExternalBuilder<'a, S>
177where
178    S: external_state::State,
179    S::Uri: external_state::IsUnset,
180{
181    /// Set the `uri` field (required)
182    pub fn uri(
183        mut self,
184        value: impl Into<jacquard_common::types::string::Uri<'a>>,
185    ) -> ExternalBuilder<'a, external_state::SetUri<S>> {
186        self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
187        ExternalBuilder {
188            _phantom_state: ::core::marker::PhantomData,
189            __unsafe_private_named: self.__unsafe_private_named,
190            _phantom: ::core::marker::PhantomData,
191        }
192    }
193}
194
195impl<'a, S> ExternalBuilder<'a, S>
196where
197    S: external_state::State,
198    S::Title: external_state::IsSet,
199    S::Uri: external_state::IsSet,
200    S::Description: external_state::IsSet,
201{
202    /// Build the final struct
203    pub fn build(self) -> External<'a> {
204        External {
205            description: self.__unsafe_private_named.0.unwrap(),
206            thumb: self.__unsafe_private_named.1,
207            title: self.__unsafe_private_named.2.unwrap(),
208            uri: self.__unsafe_private_named.3.unwrap(),
209            extra_data: Default::default(),
210        }
211    }
212    /// Build the final struct with custom extra_data
213    pub fn build_with_data(
214        self,
215        extra_data: std::collections::BTreeMap<
216            jacquard_common::smol_str::SmolStr,
217            jacquard_common::types::value::Data<'a>,
218        >,
219    ) -> External<'a> {
220        External {
221            description: self.__unsafe_private_named.0.unwrap(),
222            thumb: self.__unsafe_private_named.1,
223            title: self.__unsafe_private_named.2.unwrap(),
224            uri: self.__unsafe_private_named.3.unwrap(),
225            extra_data: Some(extra_data),
226        }
227    }
228}
229
230fn lexicon_doc_app_bsky_embed_external() -> ::jacquard_lexicon::lexicon::LexiconDoc<
231    'static,
232> {
233    ::jacquard_lexicon::lexicon::LexiconDoc {
234        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
235        id: ::jacquard_common::CowStr::new_static("app.bsky.embed.external"),
236        revision: None,
237        description: None,
238        defs: {
239            let mut map = ::std::collections::BTreeMap::new();
240            map.insert(
241                ::jacquard_common::smol_str::SmolStr::new_static("external"),
242                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
243                    description: None,
244                    required: Some(
245                        vec![
246                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
247                            ::jacquard_common::smol_str::SmolStr::new_static("title"),
248                            ::jacquard_common::smol_str::SmolStr::new_static("description")
249                        ],
250                    ),
251                    nullable: None,
252                    properties: {
253                        #[allow(unused_mut)]
254                        let mut map = ::std::collections::BTreeMap::new();
255                        map.insert(
256                            ::jacquard_common::smol_str::SmolStr::new_static(
257                                "description",
258                            ),
259                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
260                                description: None,
261                                format: None,
262                                default: None,
263                                min_length: None,
264                                max_length: None,
265                                min_graphemes: None,
266                                max_graphemes: None,
267                                r#enum: None,
268                                r#const: None,
269                                known_values: None,
270                            }),
271                        );
272                        map.insert(
273                            ::jacquard_common::smol_str::SmolStr::new_static("thumb"),
274                            ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
275                                description: None,
276                                accept: None,
277                                max_size: None,
278                            }),
279                        );
280                        map.insert(
281                            ::jacquard_common::smol_str::SmolStr::new_static("title"),
282                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
283                                description: None,
284                                format: None,
285                                default: None,
286                                min_length: None,
287                                max_length: None,
288                                min_graphemes: None,
289                                max_graphemes: None,
290                                r#enum: None,
291                                r#const: None,
292                                known_values: None,
293                            }),
294                        );
295                        map.insert(
296                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
297                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
298                                description: None,
299                                format: Some(
300                                    ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
301                                ),
302                                default: None,
303                                min_length: None,
304                                max_length: None,
305                                min_graphemes: None,
306                                max_graphemes: None,
307                                r#enum: None,
308                                r#const: None,
309                                known_values: None,
310                            }),
311                        );
312                        map
313                    },
314                }),
315            );
316            map.insert(
317                ::jacquard_common::smol_str::SmolStr::new_static("main"),
318                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
319                    description: Some(
320                        ::jacquard_common::CowStr::new_static(
321                            "A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).",
322                        ),
323                    ),
324                    required: Some(
325                        vec![
326                            ::jacquard_common::smol_str::SmolStr::new_static("external")
327                        ],
328                    ),
329                    nullable: None,
330                    properties: {
331                        #[allow(unused_mut)]
332                        let mut map = ::std::collections::BTreeMap::new();
333                        map.insert(
334                            ::jacquard_common::smol_str::SmolStr::new_static("external"),
335                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
336                                description: None,
337                                r#ref: ::jacquard_common::CowStr::new_static("#external"),
338                            }),
339                        );
340                        map
341                    },
342                }),
343            );
344            map.insert(
345                ::jacquard_common::smol_str::SmolStr::new_static("view"),
346                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
347                    description: None,
348                    required: Some(
349                        vec![
350                            ::jacquard_common::smol_str::SmolStr::new_static("external")
351                        ],
352                    ),
353                    nullable: None,
354                    properties: {
355                        #[allow(unused_mut)]
356                        let mut map = ::std::collections::BTreeMap::new();
357                        map.insert(
358                            ::jacquard_common::smol_str::SmolStr::new_static("external"),
359                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
360                                description: None,
361                                r#ref: ::jacquard_common::CowStr::new_static(
362                                    "#viewExternal",
363                                ),
364                            }),
365                        );
366                        map
367                    },
368                }),
369            );
370            map.insert(
371                ::jacquard_common::smol_str::SmolStr::new_static("viewExternal"),
372                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
373                    description: None,
374                    required: Some(
375                        vec![
376                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
377                            ::jacquard_common::smol_str::SmolStr::new_static("title"),
378                            ::jacquard_common::smol_str::SmolStr::new_static("description")
379                        ],
380                    ),
381                    nullable: None,
382                    properties: {
383                        #[allow(unused_mut)]
384                        let mut map = ::std::collections::BTreeMap::new();
385                        map.insert(
386                            ::jacquard_common::smol_str::SmolStr::new_static(
387                                "description",
388                            ),
389                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
390                                description: None,
391                                format: None,
392                                default: None,
393                                min_length: None,
394                                max_length: None,
395                                min_graphemes: None,
396                                max_graphemes: None,
397                                r#enum: None,
398                                r#const: None,
399                                known_values: None,
400                            }),
401                        );
402                        map.insert(
403                            ::jacquard_common::smol_str::SmolStr::new_static("thumb"),
404                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
405                                description: None,
406                                format: Some(
407                                    ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
408                                ),
409                                default: None,
410                                min_length: None,
411                                max_length: None,
412                                min_graphemes: None,
413                                max_graphemes: None,
414                                r#enum: None,
415                                r#const: None,
416                                known_values: None,
417                            }),
418                        );
419                        map.insert(
420                            ::jacquard_common::smol_str::SmolStr::new_static("title"),
421                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
422                                description: None,
423                                format: None,
424                                default: None,
425                                min_length: None,
426                                max_length: None,
427                                min_graphemes: None,
428                                max_graphemes: None,
429                                r#enum: None,
430                                r#const: None,
431                                known_values: None,
432                            }),
433                        );
434                        map.insert(
435                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
436                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
437                                description: None,
438                                format: Some(
439                                    ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
440                                ),
441                                default: None,
442                                min_length: None,
443                                max_length: None,
444                                min_graphemes: None,
445                                max_graphemes: None,
446                                r#enum: None,
447                                r#const: None,
448                                known_values: None,
449                            }),
450                        );
451                        map
452                    },
453                }),
454            );
455            map
456        },
457    }
458}
459
460impl<'a> ::jacquard_lexicon::schema::LexiconSchema for External<'a> {
461    fn nsid() -> &'static str {
462        "app.bsky.embed.external"
463    }
464    fn def_name() -> &'static str {
465        "external"
466    }
467    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
468        lexicon_doc_app_bsky_embed_external()
469    }
470    fn validate(
471        &self,
472    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
473        Ok(())
474    }
475}
476
477/// A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).
478#[jacquard_derive::lexicon]
479#[derive(
480    serde::Serialize,
481    serde::Deserialize,
482    Debug,
483    Clone,
484    PartialEq,
485    Eq,
486    jacquard_derive::IntoStatic
487)]
488#[serde(rename_all = "camelCase")]
489pub struct ExternalRecord<'a> {
490    #[serde(borrow)]
491    pub external: crate::app_bsky::embed::external::External<'a>,
492}
493
494pub mod external_record_state {
495
496    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
497    #[allow(unused)]
498    use ::core::marker::PhantomData;
499    mod sealed {
500        pub trait Sealed {}
501    }
502    /// State trait tracking which required fields have been set
503    pub trait State: sealed::Sealed {
504        type External;
505    }
506    /// Empty state - all required fields are unset
507    pub struct Empty(());
508    impl sealed::Sealed for Empty {}
509    impl State for Empty {
510        type External = Unset;
511    }
512    ///State transition - sets the `external` field to Set
513    pub struct SetExternal<S: State = Empty>(PhantomData<fn() -> S>);
514    impl<S: State> sealed::Sealed for SetExternal<S> {}
515    impl<S: State> State for SetExternal<S> {
516        type External = Set<members::external>;
517    }
518    /// Marker types for field names
519    #[allow(non_camel_case_types)]
520    pub mod members {
521        ///Marker type for the `external` field
522        pub struct external(());
523    }
524}
525
526/// Builder for constructing an instance of this type
527pub struct ExternalRecordBuilder<'a, S: external_record_state::State> {
528    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
529    __unsafe_private_named: (
530        ::core::option::Option<crate::app_bsky::embed::external::External<'a>>,
531    ),
532    _phantom: ::core::marker::PhantomData<&'a ()>,
533}
534
535impl<'a> ExternalRecord<'a> {
536    /// Create a new builder for this type
537    pub fn new() -> ExternalRecordBuilder<'a, external_record_state::Empty> {
538        ExternalRecordBuilder::new()
539    }
540}
541
542impl<'a> ExternalRecordBuilder<'a, external_record_state::Empty> {
543    /// Create a new builder with all fields unset
544    pub fn new() -> Self {
545        ExternalRecordBuilder {
546            _phantom_state: ::core::marker::PhantomData,
547            __unsafe_private_named: (None,),
548            _phantom: ::core::marker::PhantomData,
549        }
550    }
551}
552
553impl<'a, S> ExternalRecordBuilder<'a, S>
554where
555    S: external_record_state::State,
556    S::External: external_record_state::IsUnset,
557{
558    /// Set the `external` field (required)
559    pub fn external(
560        mut self,
561        value: impl Into<crate::app_bsky::embed::external::External<'a>>,
562    ) -> ExternalRecordBuilder<'a, external_record_state::SetExternal<S>> {
563        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
564        ExternalRecordBuilder {
565            _phantom_state: ::core::marker::PhantomData,
566            __unsafe_private_named: self.__unsafe_private_named,
567            _phantom: ::core::marker::PhantomData,
568        }
569    }
570}
571
572impl<'a, S> ExternalRecordBuilder<'a, S>
573where
574    S: external_record_state::State,
575    S::External: external_record_state::IsSet,
576{
577    /// Build the final struct
578    pub fn build(self) -> ExternalRecord<'a> {
579        ExternalRecord {
580            external: self.__unsafe_private_named.0.unwrap(),
581            extra_data: Default::default(),
582        }
583    }
584    /// Build the final struct with custom extra_data
585    pub fn build_with_data(
586        self,
587        extra_data: std::collections::BTreeMap<
588            jacquard_common::smol_str::SmolStr,
589            jacquard_common::types::value::Data<'a>,
590        >,
591    ) -> ExternalRecord<'a> {
592        ExternalRecord {
593            external: self.__unsafe_private_named.0.unwrap(),
594            extra_data: Some(extra_data),
595        }
596    }
597}
598
599impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ExternalRecord<'a> {
600    fn nsid() -> &'static str {
601        "app.bsky.embed.external"
602    }
603    fn def_name() -> &'static str {
604        "main"
605    }
606    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
607        lexicon_doc_app_bsky_embed_external()
608    }
609    fn validate(
610        &self,
611    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
612        Ok(())
613    }
614}
615
616#[jacquard_derive::lexicon]
617#[derive(
618    serde::Serialize,
619    serde::Deserialize,
620    Debug,
621    Clone,
622    PartialEq,
623    Eq,
624    jacquard_derive::IntoStatic
625)]
626#[serde(rename_all = "camelCase")]
627pub struct View<'a> {
628    #[serde(borrow)]
629    pub external: crate::app_bsky::embed::external::ViewExternal<'a>,
630}
631
632pub mod view_state {
633
634    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
635    #[allow(unused)]
636    use ::core::marker::PhantomData;
637    mod sealed {
638        pub trait Sealed {}
639    }
640    /// State trait tracking which required fields have been set
641    pub trait State: sealed::Sealed {
642        type External;
643    }
644    /// Empty state - all required fields are unset
645    pub struct Empty(());
646    impl sealed::Sealed for Empty {}
647    impl State for Empty {
648        type External = Unset;
649    }
650    ///State transition - sets the `external` field to Set
651    pub struct SetExternal<S: State = Empty>(PhantomData<fn() -> S>);
652    impl<S: State> sealed::Sealed for SetExternal<S> {}
653    impl<S: State> State for SetExternal<S> {
654        type External = Set<members::external>;
655    }
656    /// Marker types for field names
657    #[allow(non_camel_case_types)]
658    pub mod members {
659        ///Marker type for the `external` field
660        pub struct external(());
661    }
662}
663
664/// Builder for constructing an instance of this type
665pub struct ViewBuilder<'a, S: view_state::State> {
666    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
667    __unsafe_private_named: (
668        ::core::option::Option<crate::app_bsky::embed::external::ViewExternal<'a>>,
669    ),
670    _phantom: ::core::marker::PhantomData<&'a ()>,
671}
672
673impl<'a> View<'a> {
674    /// Create a new builder for this type
675    pub fn new() -> ViewBuilder<'a, view_state::Empty> {
676        ViewBuilder::new()
677    }
678}
679
680impl<'a> ViewBuilder<'a, view_state::Empty> {
681    /// Create a new builder with all fields unset
682    pub fn new() -> Self {
683        ViewBuilder {
684            _phantom_state: ::core::marker::PhantomData,
685            __unsafe_private_named: (None,),
686            _phantom: ::core::marker::PhantomData,
687        }
688    }
689}
690
691impl<'a, S> ViewBuilder<'a, S>
692where
693    S: view_state::State,
694    S::External: view_state::IsUnset,
695{
696    /// Set the `external` field (required)
697    pub fn external(
698        mut self,
699        value: impl Into<crate::app_bsky::embed::external::ViewExternal<'a>>,
700    ) -> ViewBuilder<'a, view_state::SetExternal<S>> {
701        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
702        ViewBuilder {
703            _phantom_state: ::core::marker::PhantomData,
704            __unsafe_private_named: self.__unsafe_private_named,
705            _phantom: ::core::marker::PhantomData,
706        }
707    }
708}
709
710impl<'a, S> ViewBuilder<'a, S>
711where
712    S: view_state::State,
713    S::External: view_state::IsSet,
714{
715    /// Build the final struct
716    pub fn build(self) -> View<'a> {
717        View {
718            external: self.__unsafe_private_named.0.unwrap(),
719            extra_data: Default::default(),
720        }
721    }
722    /// Build the final struct with custom extra_data
723    pub fn build_with_data(
724        self,
725        extra_data: std::collections::BTreeMap<
726            jacquard_common::smol_str::SmolStr,
727            jacquard_common::types::value::Data<'a>,
728        >,
729    ) -> View<'a> {
730        View {
731            external: self.__unsafe_private_named.0.unwrap(),
732            extra_data: Some(extra_data),
733        }
734    }
735}
736
737impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> {
738    fn nsid() -> &'static str {
739        "app.bsky.embed.external"
740    }
741    fn def_name() -> &'static str {
742        "view"
743    }
744    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
745        lexicon_doc_app_bsky_embed_external()
746    }
747    fn validate(
748        &self,
749    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
750        Ok(())
751    }
752}
753
754#[jacquard_derive::lexicon]
755#[derive(
756    serde::Serialize,
757    serde::Deserialize,
758    Debug,
759    Clone,
760    PartialEq,
761    Eq,
762    jacquard_derive::IntoStatic
763)]
764#[serde(rename_all = "camelCase")]
765pub struct ViewExternal<'a> {
766    #[serde(borrow)]
767    pub description: jacquard_common::CowStr<'a>,
768    #[serde(skip_serializing_if = "std::option::Option::is_none")]
769    #[serde(borrow)]
770    pub thumb: std::option::Option<jacquard_common::types::string::Uri<'a>>,
771    #[serde(borrow)]
772    pub title: jacquard_common::CowStr<'a>,
773    #[serde(borrow)]
774    pub uri: jacquard_common::types::string::Uri<'a>,
775}
776
777pub mod view_external_state {
778
779    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
780    #[allow(unused)]
781    use ::core::marker::PhantomData;
782    mod sealed {
783        pub trait Sealed {}
784    }
785    /// State trait tracking which required fields have been set
786    pub trait State: sealed::Sealed {
787        type Uri;
788        type Title;
789        type Description;
790    }
791    /// Empty state - all required fields are unset
792    pub struct Empty(());
793    impl sealed::Sealed for Empty {}
794    impl State for Empty {
795        type Uri = Unset;
796        type Title = Unset;
797        type Description = Unset;
798    }
799    ///State transition - sets the `uri` field to Set
800    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
801    impl<S: State> sealed::Sealed for SetUri<S> {}
802    impl<S: State> State for SetUri<S> {
803        type Uri = Set<members::uri>;
804        type Title = S::Title;
805        type Description = S::Description;
806    }
807    ///State transition - sets the `title` field to Set
808    pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
809    impl<S: State> sealed::Sealed for SetTitle<S> {}
810    impl<S: State> State for SetTitle<S> {
811        type Uri = S::Uri;
812        type Title = Set<members::title>;
813        type Description = S::Description;
814    }
815    ///State transition - sets the `description` field to Set
816    pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>);
817    impl<S: State> sealed::Sealed for SetDescription<S> {}
818    impl<S: State> State for SetDescription<S> {
819        type Uri = S::Uri;
820        type Title = S::Title;
821        type Description = Set<members::description>;
822    }
823    /// Marker types for field names
824    #[allow(non_camel_case_types)]
825    pub mod members {
826        ///Marker type for the `uri` field
827        pub struct uri(());
828        ///Marker type for the `title` field
829        pub struct title(());
830        ///Marker type for the `description` field
831        pub struct description(());
832    }
833}
834
835/// Builder for constructing an instance of this type
836pub struct ViewExternalBuilder<'a, S: view_external_state::State> {
837    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
838    __unsafe_private_named: (
839        ::core::option::Option<jacquard_common::CowStr<'a>>,
840        ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
841        ::core::option::Option<jacquard_common::CowStr<'a>>,
842        ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
843    ),
844    _phantom: ::core::marker::PhantomData<&'a ()>,
845}
846
847impl<'a> ViewExternal<'a> {
848    /// Create a new builder for this type
849    pub fn new() -> ViewExternalBuilder<'a, view_external_state::Empty> {
850        ViewExternalBuilder::new()
851    }
852}
853
854impl<'a> ViewExternalBuilder<'a, view_external_state::Empty> {
855    /// Create a new builder with all fields unset
856    pub fn new() -> Self {
857        ViewExternalBuilder {
858            _phantom_state: ::core::marker::PhantomData,
859            __unsafe_private_named: (None, None, None, None),
860            _phantom: ::core::marker::PhantomData,
861        }
862    }
863}
864
865impl<'a, S> ViewExternalBuilder<'a, S>
866where
867    S: view_external_state::State,
868    S::Description: view_external_state::IsUnset,
869{
870    /// Set the `description` field (required)
871    pub fn description(
872        mut self,
873        value: impl Into<jacquard_common::CowStr<'a>>,
874    ) -> ViewExternalBuilder<'a, view_external_state::SetDescription<S>> {
875        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
876        ViewExternalBuilder {
877            _phantom_state: ::core::marker::PhantomData,
878            __unsafe_private_named: self.__unsafe_private_named,
879            _phantom: ::core::marker::PhantomData,
880        }
881    }
882}
883
884impl<'a, S: view_external_state::State> ViewExternalBuilder<'a, S> {
885    /// Set the `thumb` field (optional)
886    pub fn thumb(
887        mut self,
888        value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>,
889    ) -> Self {
890        self.__unsafe_private_named.1 = value.into();
891        self
892    }
893    /// Set the `thumb` field to an Option value (optional)
894    pub fn maybe_thumb(
895        mut self,
896        value: Option<jacquard_common::types::string::Uri<'a>>,
897    ) -> Self {
898        self.__unsafe_private_named.1 = value;
899        self
900    }
901}
902
903impl<'a, S> ViewExternalBuilder<'a, S>
904where
905    S: view_external_state::State,
906    S::Title: view_external_state::IsUnset,
907{
908    /// Set the `title` field (required)
909    pub fn title(
910        mut self,
911        value: impl Into<jacquard_common::CowStr<'a>>,
912    ) -> ViewExternalBuilder<'a, view_external_state::SetTitle<S>> {
913        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
914        ViewExternalBuilder {
915            _phantom_state: ::core::marker::PhantomData,
916            __unsafe_private_named: self.__unsafe_private_named,
917            _phantom: ::core::marker::PhantomData,
918        }
919    }
920}
921
922impl<'a, S> ViewExternalBuilder<'a, S>
923where
924    S: view_external_state::State,
925    S::Uri: view_external_state::IsUnset,
926{
927    /// Set the `uri` field (required)
928    pub fn uri(
929        mut self,
930        value: impl Into<jacquard_common::types::string::Uri<'a>>,
931    ) -> ViewExternalBuilder<'a, view_external_state::SetUri<S>> {
932        self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
933        ViewExternalBuilder {
934            _phantom_state: ::core::marker::PhantomData,
935            __unsafe_private_named: self.__unsafe_private_named,
936            _phantom: ::core::marker::PhantomData,
937        }
938    }
939}
940
941impl<'a, S> ViewExternalBuilder<'a, S>
942where
943    S: view_external_state::State,
944    S::Uri: view_external_state::IsSet,
945    S::Title: view_external_state::IsSet,
946    S::Description: view_external_state::IsSet,
947{
948    /// Build the final struct
949    pub fn build(self) -> ViewExternal<'a> {
950        ViewExternal {
951            description: self.__unsafe_private_named.0.unwrap(),
952            thumb: self.__unsafe_private_named.1,
953            title: self.__unsafe_private_named.2.unwrap(),
954            uri: self.__unsafe_private_named.3.unwrap(),
955            extra_data: Default::default(),
956        }
957    }
958    /// Build the final struct with custom extra_data
959    pub fn build_with_data(
960        self,
961        extra_data: std::collections::BTreeMap<
962            jacquard_common::smol_str::SmolStr,
963            jacquard_common::types::value::Data<'a>,
964        >,
965    ) -> ViewExternal<'a> {
966        ViewExternal {
967            description: self.__unsafe_private_named.0.unwrap(),
968            thumb: self.__unsafe_private_named.1,
969            title: self.__unsafe_private_named.2.unwrap(),
970            uri: self.__unsafe_private_named.3.unwrap(),
971            extra_data: Some(extra_data),
972        }
973    }
974}
975
976impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewExternal<'a> {
977    fn nsid() -> &'static str {
978        "app.bsky.embed.external"
979    }
980    fn def_name() -> &'static str {
981        "viewExternal"
982    }
983    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
984        lexicon_doc_app_bsky_embed_external()
985    }
986    fn validate(
987        &self,
988    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
989        Ok(())
990    }
991}