Skip to main content

jacquard_api/app_bsky/embed/
record.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.embed.record
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, 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::string::{AtUri, Cid, Datetime};
19use jacquard_common::types::value::Data;
20use jacquard_derive::{IntoStatic, open_union};
21use jacquard_lexicon::lexicon::LexiconDoc;
22use jacquard_lexicon::schema::LexiconSchema;
23
24use crate::app_bsky::actor::ProfileViewBasic;
25use crate::app_bsky::embed::external;
26use crate::app_bsky::embed::gallery;
27use crate::app_bsky::embed::images;
28use crate::app_bsky::embed::record;
29use crate::app_bsky::embed::record_with_media;
30use crate::app_bsky::embed::video;
31use crate::app_bsky::feed::BlockedAuthor;
32use crate::app_bsky::feed::GeneratorView;
33use crate::app_bsky::graph::ListView;
34use crate::app_bsky::graph::StarterPackViewBasic;
35use crate::app_bsky::labeler::LabelerView;
36use crate::com_atproto::label::Label;
37use crate::com_atproto::repo::strong_ref::StrongRef;
38#[allow(unused_imports)]
39use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
40use serde::{Deserialize, Serialize};
41
42#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
43#[serde(
44    rename_all = "camelCase",
45    bound(deserialize = "S: Deserialize<'de> + BosStr")
46)]
47pub struct Record<S: BosStr = DefaultStr> {
48    pub record: StrongRef<S>,
49    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
50    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
51}
52
53#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
54#[serde(
55    rename_all = "camelCase",
56    bound(deserialize = "S: Deserialize<'de> + BosStr")
57)]
58pub struct View<S: BosStr = DefaultStr> {
59    pub record: ViewUnionRecord<S>,
60    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
61    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
62}
63
64#[open_union]
65#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
66#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
67pub enum ViewUnionRecord<S: BosStr = DefaultStr> {
68    #[serde(rename = "app.bsky.embed.record#viewRecord")]
69    ViewRecord(Box<record::ViewRecord<S>>),
70    #[serde(rename = "app.bsky.embed.record#viewNotFound")]
71    ViewNotFound(Box<record::ViewNotFound<S>>),
72    #[serde(rename = "app.bsky.embed.record#viewBlocked")]
73    ViewBlocked(Box<record::ViewBlocked<S>>),
74    #[serde(rename = "app.bsky.embed.record#viewDetached")]
75    ViewDetached(Box<record::ViewDetached<S>>),
76    #[serde(rename = "app.bsky.feed.defs#generatorView")]
77    GeneratorView(Box<GeneratorView<S>>),
78    #[serde(rename = "app.bsky.graph.defs#listView")]
79    ListView(Box<ListView<S>>),
80    #[serde(rename = "app.bsky.labeler.defs#labelerView")]
81    LabelerView(Box<LabelerView<S>>),
82    #[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")]
83    StarterPackViewBasic(Box<StarterPackViewBasic<S>>),
84}
85
86#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
87#[serde(
88    rename_all = "camelCase",
89    bound(deserialize = "S: Deserialize<'de> + BosStr")
90)]
91pub struct ViewBlocked<S: BosStr = DefaultStr> {
92    pub author: BlockedAuthor<S>,
93    pub blocked: bool,
94    pub uri: AtUri<S>,
95    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
96    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
97}
98
99#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
100#[serde(
101    rename_all = "camelCase",
102    bound(deserialize = "S: Deserialize<'de> + BosStr")
103)]
104pub struct ViewDetached<S: BosStr = DefaultStr> {
105    pub detached: bool,
106    pub uri: AtUri<S>,
107    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
108    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
109}
110
111#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
112#[serde(
113    rename_all = "camelCase",
114    bound(deserialize = "S: Deserialize<'de> + BosStr")
115)]
116pub struct ViewNotFound<S: BosStr = DefaultStr> {
117    pub not_found: bool,
118    pub uri: AtUri<S>,
119    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
120    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
121}
122
123#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
124#[serde(
125    rename_all = "camelCase",
126    bound(deserialize = "S: Deserialize<'de> + BosStr")
127)]
128pub struct ViewRecord<S: BosStr = DefaultStr> {
129    pub author: ProfileViewBasic<S>,
130    pub cid: Cid<S>,
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub embeds: Option<Vec<ViewRecordEmbedsItem<S>>>,
133    pub indexed_at: Datetime,
134    #[serde(skip_serializing_if = "Option::is_none")]
135    pub labels: Option<Vec<Label<S>>>,
136    #[serde(skip_serializing_if = "Option::is_none")]
137    pub like_count: Option<i64>,
138    #[serde(skip_serializing_if = "Option::is_none")]
139    pub quote_count: Option<i64>,
140    #[serde(skip_serializing_if = "Option::is_none")]
141    pub reply_count: Option<i64>,
142    #[serde(skip_serializing_if = "Option::is_none")]
143    pub repost_count: Option<i64>,
144    pub uri: AtUri<S>,
145    ///The record data itself.
146    pub value: Data<S>,
147    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
148    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
149}
150
151#[open_union]
152#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
153#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
154pub enum ViewRecordEmbedsItem<S: BosStr = DefaultStr> {
155    #[serde(rename = "app.bsky.embed.images#view")]
156    ImagesView(Box<images::View<S>>),
157    #[serde(rename = "app.bsky.embed.video#view")]
158    VideoView(Box<video::View<S>>),
159    #[serde(rename = "app.bsky.embed.gallery#view")]
160    GalleryView(Box<gallery::View<S>>),
161    #[serde(rename = "app.bsky.embed.external#view")]
162    ExternalView(Box<external::View<S>>),
163    #[serde(rename = "app.bsky.embed.record#view")]
164    View(Box<record::View<S>>),
165    #[serde(rename = "app.bsky.embed.recordWithMedia#view")]
166    RecordWithMediaView(Box<record_with_media::View<S>>),
167}
168
169impl<S: BosStr> LexiconSchema for Record<S> {
170    fn nsid() -> &'static str {
171        "app.bsky.embed.record"
172    }
173    fn def_name() -> &'static str {
174        "main"
175    }
176    fn lexicon_doc() -> LexiconDoc<'static> {
177        lexicon_doc_app_bsky_embed_record()
178    }
179    fn validate(&self) -> Result<(), ConstraintError> {
180        Ok(())
181    }
182}
183
184impl<S: BosStr> LexiconSchema for View<S> {
185    fn nsid() -> &'static str {
186        "app.bsky.embed.record"
187    }
188    fn def_name() -> &'static str {
189        "view"
190    }
191    fn lexicon_doc() -> LexiconDoc<'static> {
192        lexicon_doc_app_bsky_embed_record()
193    }
194    fn validate(&self) -> Result<(), ConstraintError> {
195        Ok(())
196    }
197}
198
199impl<S: BosStr> LexiconSchema for ViewBlocked<S> {
200    fn nsid() -> &'static str {
201        "app.bsky.embed.record"
202    }
203    fn def_name() -> &'static str {
204        "viewBlocked"
205    }
206    fn lexicon_doc() -> LexiconDoc<'static> {
207        lexicon_doc_app_bsky_embed_record()
208    }
209    fn validate(&self) -> Result<(), ConstraintError> {
210        Ok(())
211    }
212}
213
214impl<S: BosStr> LexiconSchema for ViewDetached<S> {
215    fn nsid() -> &'static str {
216        "app.bsky.embed.record"
217    }
218    fn def_name() -> &'static str {
219        "viewDetached"
220    }
221    fn lexicon_doc() -> LexiconDoc<'static> {
222        lexicon_doc_app_bsky_embed_record()
223    }
224    fn validate(&self) -> Result<(), ConstraintError> {
225        Ok(())
226    }
227}
228
229impl<S: BosStr> LexiconSchema for ViewNotFound<S> {
230    fn nsid() -> &'static str {
231        "app.bsky.embed.record"
232    }
233    fn def_name() -> &'static str {
234        "viewNotFound"
235    }
236    fn lexicon_doc() -> LexiconDoc<'static> {
237        lexicon_doc_app_bsky_embed_record()
238    }
239    fn validate(&self) -> Result<(), ConstraintError> {
240        Ok(())
241    }
242}
243
244impl<S: BosStr> LexiconSchema for ViewRecord<S> {
245    fn nsid() -> &'static str {
246        "app.bsky.embed.record"
247    }
248    fn def_name() -> &'static str {
249        "viewRecord"
250    }
251    fn lexicon_doc() -> LexiconDoc<'static> {
252        lexicon_doc_app_bsky_embed_record()
253    }
254    fn validate(&self) -> Result<(), ConstraintError> {
255        Ok(())
256    }
257}
258
259pub mod record_state {
260
261    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
262    #[allow(unused)]
263    use ::core::marker::PhantomData;
264    mod sealed {
265        pub trait Sealed {}
266    }
267    /// State trait tracking which required fields have been set
268    pub trait State: sealed::Sealed {
269        type Record;
270    }
271    /// Empty state - all required fields are unset
272    pub struct Empty(());
273    impl sealed::Sealed for Empty {}
274    impl State for Empty {
275        type Record = Unset;
276    }
277    ///State transition - sets the `record` field to Set
278    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
279    impl<St: State> sealed::Sealed for SetRecord<St> {}
280    impl<St: State> State for SetRecord<St> {
281        type Record = Set<members::record>;
282    }
283    /// Marker types for field names
284    #[allow(non_camel_case_types)]
285    pub mod members {
286        ///Marker type for the `record` field
287        pub struct record(());
288    }
289}
290
291/// Builder for constructing an instance of this type.
292pub struct RecordBuilder<St: record_state::State, S: BosStr = DefaultStr> {
293    _state: PhantomData<fn() -> St>,
294    _fields: (Option<StrongRef<S>>,),
295    _type: PhantomData<fn() -> S>,
296}
297
298impl Record<DefaultStr> {
299    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
300    pub fn new() -> RecordBuilder<record_state::Empty, DefaultStr> {
301        RecordBuilder::new()
302    }
303}
304
305impl<S: BosStr> Record<S> {
306    /// Create a new builder for this type
307    pub fn builder() -> RecordBuilder<record_state::Empty, S> {
308        RecordBuilder::builder()
309    }
310}
311
312impl RecordBuilder<record_state::Empty, DefaultStr> {
313    /// Create a new builder with all fields unset, using the default string type, if needed
314    pub fn new() -> Self {
315        RecordBuilder {
316            _state: PhantomData,
317            _fields: (None,),
318            _type: PhantomData,
319        }
320    }
321}
322
323impl<S: BosStr> RecordBuilder<record_state::Empty, S> {
324    /// Create a new builder with all fields unset
325    pub fn builder() -> Self {
326        RecordBuilder {
327            _state: PhantomData,
328            _fields: (None,),
329            _type: PhantomData,
330        }
331    }
332}
333
334impl<St, S: BosStr> RecordBuilder<St, S>
335where
336    St: record_state::State,
337    St::Record: record_state::IsUnset,
338{
339    /// Set the `record` field (required)
340    pub fn record(
341        mut self,
342        value: impl Into<StrongRef<S>>,
343    ) -> RecordBuilder<record_state::SetRecord<St>, S> {
344        self._fields.0 = Option::Some(value.into());
345        RecordBuilder {
346            _state: PhantomData,
347            _fields: self._fields,
348            _type: PhantomData,
349        }
350    }
351}
352
353impl<St, S: BosStr> RecordBuilder<St, S>
354where
355    St: record_state::State,
356    St::Record: record_state::IsSet,
357{
358    /// Build the final struct.
359    pub fn build(self) -> Record<S> {
360        Record {
361            record: self._fields.0.unwrap(),
362            extra_data: Default::default(),
363        }
364    }
365    /// Build the final struct with custom extra_data.
366    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Record<S> {
367        Record {
368            record: self._fields.0.unwrap(),
369            extra_data: Some(extra_data),
370        }
371    }
372}
373
374fn lexicon_doc_app_bsky_embed_record() -> LexiconDoc<'static> {
375    use alloc::collections::BTreeMap;
376    #[allow(unused_imports)]
377    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
378    use jacquard_lexicon::lexicon::*;
379    LexiconDoc {
380        lexicon: Lexicon::Lexicon1,
381        id: CowStr::new_static("app.bsky.embed.record"),
382        defs: {
383            let mut map = BTreeMap::new();
384            map.insert(
385                SmolStr::new_static("main"),
386                LexUserType::Object(LexObject {
387                    required: Some(vec![SmolStr::new_static("record")]),
388                    properties: {
389                        #[allow(unused_mut)]
390                        let mut map = BTreeMap::new();
391                        map.insert(
392                            SmolStr::new_static("record"),
393                            LexObjectProperty::Ref(LexRef {
394                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
395                                ..Default::default()
396                            }),
397                        );
398                        map
399                    },
400                    ..Default::default()
401                }),
402            );
403            map.insert(
404                SmolStr::new_static("view"),
405                LexUserType::Object(LexObject {
406                    required: Some(vec![SmolStr::new_static("record")]),
407                    properties: {
408                        #[allow(unused_mut)]
409                        let mut map = BTreeMap::new();
410                        map.insert(
411                            SmolStr::new_static("record"),
412                            LexObjectProperty::Union(LexRefUnion {
413                                refs: vec![
414                                    CowStr::new_static("#viewRecord"),
415                                    CowStr::new_static("#viewNotFound"),
416                                    CowStr::new_static("#viewBlocked"),
417                                    CowStr::new_static("#viewDetached"),
418                                    CowStr::new_static("app.bsky.feed.defs#generatorView"),
419                                    CowStr::new_static("app.bsky.graph.defs#listView"),
420                                    CowStr::new_static("app.bsky.labeler.defs#labelerView"),
421                                    CowStr::new_static("app.bsky.graph.defs#starterPackViewBasic"),
422                                ],
423                                ..Default::default()
424                            }),
425                        );
426                        map
427                    },
428                    ..Default::default()
429                }),
430            );
431            map.insert(
432                SmolStr::new_static("viewBlocked"),
433                LexUserType::Object(LexObject {
434                    required: Some(vec![
435                        SmolStr::new_static("uri"),
436                        SmolStr::new_static("blocked"),
437                        SmolStr::new_static("author"),
438                    ]),
439                    properties: {
440                        #[allow(unused_mut)]
441                        let mut map = BTreeMap::new();
442                        map.insert(
443                            SmolStr::new_static("author"),
444                            LexObjectProperty::Ref(LexRef {
445                                r#ref: CowStr::new_static("app.bsky.feed.defs#blockedAuthor"),
446                                ..Default::default()
447                            }),
448                        );
449                        map.insert(
450                            SmolStr::new_static("blocked"),
451                            LexObjectProperty::Boolean(LexBoolean {
452                                ..Default::default()
453                            }),
454                        );
455                        map.insert(
456                            SmolStr::new_static("uri"),
457                            LexObjectProperty::String(LexString {
458                                format: Some(LexStringFormat::AtUri),
459                                ..Default::default()
460                            }),
461                        );
462                        map
463                    },
464                    ..Default::default()
465                }),
466            );
467            map.insert(
468                SmolStr::new_static("viewDetached"),
469                LexUserType::Object(LexObject {
470                    required: Some(vec![
471                        SmolStr::new_static("uri"),
472                        SmolStr::new_static("detached"),
473                    ]),
474                    properties: {
475                        #[allow(unused_mut)]
476                        let mut map = BTreeMap::new();
477                        map.insert(
478                            SmolStr::new_static("detached"),
479                            LexObjectProperty::Boolean(LexBoolean {
480                                ..Default::default()
481                            }),
482                        );
483                        map.insert(
484                            SmolStr::new_static("uri"),
485                            LexObjectProperty::String(LexString {
486                                format: Some(LexStringFormat::AtUri),
487                                ..Default::default()
488                            }),
489                        );
490                        map
491                    },
492                    ..Default::default()
493                }),
494            );
495            map.insert(
496                SmolStr::new_static("viewNotFound"),
497                LexUserType::Object(LexObject {
498                    required: Some(vec![
499                        SmolStr::new_static("uri"),
500                        SmolStr::new_static("notFound"),
501                    ]),
502                    properties: {
503                        #[allow(unused_mut)]
504                        let mut map = BTreeMap::new();
505                        map.insert(
506                            SmolStr::new_static("notFound"),
507                            LexObjectProperty::Boolean(LexBoolean {
508                                ..Default::default()
509                            }),
510                        );
511                        map.insert(
512                            SmolStr::new_static("uri"),
513                            LexObjectProperty::String(LexString {
514                                format: Some(LexStringFormat::AtUri),
515                                ..Default::default()
516                            }),
517                        );
518                        map
519                    },
520                    ..Default::default()
521                }),
522            );
523            map.insert(
524                SmolStr::new_static("viewRecord"),
525                LexUserType::Object(LexObject {
526                    required: Some(vec![
527                        SmolStr::new_static("uri"),
528                        SmolStr::new_static("cid"),
529                        SmolStr::new_static("author"),
530                        SmolStr::new_static("value"),
531                        SmolStr::new_static("indexedAt"),
532                    ]),
533                    properties: {
534                        #[allow(unused_mut)]
535                        let mut map = BTreeMap::new();
536                        map.insert(
537                            SmolStr::new_static("author"),
538                            LexObjectProperty::Ref(LexRef {
539                                r#ref: CowStr::new_static("app.bsky.actor.defs#profileViewBasic"),
540                                ..Default::default()
541                            }),
542                        );
543                        map.insert(
544                            SmolStr::new_static("cid"),
545                            LexObjectProperty::String(LexString {
546                                format: Some(LexStringFormat::Cid),
547                                ..Default::default()
548                            }),
549                        );
550                        map.insert(
551                            SmolStr::new_static("embeds"),
552                            LexObjectProperty::Array(LexArray {
553                                items: LexArrayItem::Union(LexRefUnion {
554                                    refs: vec![
555                                        CowStr::new_static("app.bsky.embed.images#view"),
556                                        CowStr::new_static("app.bsky.embed.video#view"),
557                                        CowStr::new_static("app.bsky.embed.gallery#view"),
558                                        CowStr::new_static("app.bsky.embed.external#view"),
559                                        CowStr::new_static("app.bsky.embed.record#view"),
560                                        CowStr::new_static("app.bsky.embed.recordWithMedia#view"),
561                                    ],
562                                    ..Default::default()
563                                }),
564                                ..Default::default()
565                            }),
566                        );
567                        map.insert(
568                            SmolStr::new_static("indexedAt"),
569                            LexObjectProperty::String(LexString {
570                                format: Some(LexStringFormat::Datetime),
571                                ..Default::default()
572                            }),
573                        );
574                        map.insert(
575                            SmolStr::new_static("labels"),
576                            LexObjectProperty::Array(LexArray {
577                                items: LexArrayItem::Ref(LexRef {
578                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
579                                    ..Default::default()
580                                }),
581                                ..Default::default()
582                            }),
583                        );
584                        map.insert(
585                            SmolStr::new_static("likeCount"),
586                            LexObjectProperty::Integer(LexInteger {
587                                ..Default::default()
588                            }),
589                        );
590                        map.insert(
591                            SmolStr::new_static("quoteCount"),
592                            LexObjectProperty::Integer(LexInteger {
593                                ..Default::default()
594                            }),
595                        );
596                        map.insert(
597                            SmolStr::new_static("replyCount"),
598                            LexObjectProperty::Integer(LexInteger {
599                                ..Default::default()
600                            }),
601                        );
602                        map.insert(
603                            SmolStr::new_static("repostCount"),
604                            LexObjectProperty::Integer(LexInteger {
605                                ..Default::default()
606                            }),
607                        );
608                        map.insert(
609                            SmolStr::new_static("uri"),
610                            LexObjectProperty::String(LexString {
611                                format: Some(LexStringFormat::AtUri),
612                                ..Default::default()
613                            }),
614                        );
615                        map.insert(
616                            SmolStr::new_static("value"),
617                            LexObjectProperty::Unknown(LexUnknown {
618                                ..Default::default()
619                            }),
620                        );
621                        map
622                    },
623                    ..Default::default()
624                }),
625            );
626            map
627        },
628        ..Default::default()
629    }
630}
631
632pub mod view_state {
633
634    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
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 Record;
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 Record = Unset;
649    }
650    ///State transition - sets the `record` field to Set
651    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
652    impl<St: State> sealed::Sealed for SetRecord<St> {}
653    impl<St: State> State for SetRecord<St> {
654        type Record = Set<members::record>;
655    }
656    /// Marker types for field names
657    #[allow(non_camel_case_types)]
658    pub mod members {
659        ///Marker type for the `record` field
660        pub struct record(());
661    }
662}
663
664/// Builder for constructing an instance of this type.
665pub struct ViewBuilder<St: view_state::State, S: BosStr = DefaultStr> {
666    _state: PhantomData<fn() -> St>,
667    _fields: (Option<ViewUnionRecord<S>>,),
668    _type: PhantomData<fn() -> S>,
669}
670
671impl View<DefaultStr> {
672    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
673    pub fn new() -> ViewBuilder<view_state::Empty, DefaultStr> {
674        ViewBuilder::new()
675    }
676}
677
678impl<S: BosStr> View<S> {
679    /// Create a new builder for this type
680    pub fn builder() -> ViewBuilder<view_state::Empty, S> {
681        ViewBuilder::builder()
682    }
683}
684
685impl ViewBuilder<view_state::Empty, DefaultStr> {
686    /// Create a new builder with all fields unset, using the default string type, if needed
687    pub fn new() -> Self {
688        ViewBuilder {
689            _state: PhantomData,
690            _fields: (None,),
691            _type: PhantomData,
692        }
693    }
694}
695
696impl<S: BosStr> ViewBuilder<view_state::Empty, S> {
697    /// Create a new builder with all fields unset
698    pub fn builder() -> Self {
699        ViewBuilder {
700            _state: PhantomData,
701            _fields: (None,),
702            _type: PhantomData,
703        }
704    }
705}
706
707impl<St, S: BosStr> ViewBuilder<St, S>
708where
709    St: view_state::State,
710    St::Record: view_state::IsUnset,
711{
712    /// Set the `record` field (required)
713    pub fn record(
714        mut self,
715        value: impl Into<ViewUnionRecord<S>>,
716    ) -> ViewBuilder<view_state::SetRecord<St>, S> {
717        self._fields.0 = Option::Some(value.into());
718        ViewBuilder {
719            _state: PhantomData,
720            _fields: self._fields,
721            _type: PhantomData,
722        }
723    }
724}
725
726impl<St, S: BosStr> ViewBuilder<St, S>
727where
728    St: view_state::State,
729    St::Record: view_state::IsSet,
730{
731    /// Build the final struct.
732    pub fn build(self) -> View<S> {
733        View {
734            record: self._fields.0.unwrap(),
735            extra_data: Default::default(),
736        }
737    }
738    /// Build the final struct with custom extra_data.
739    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> View<S> {
740        View {
741            record: self._fields.0.unwrap(),
742            extra_data: Some(extra_data),
743        }
744    }
745}
746
747pub mod view_blocked_state {
748
749    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
750    #[allow(unused)]
751    use ::core::marker::PhantomData;
752    mod sealed {
753        pub trait Sealed {}
754    }
755    /// State trait tracking which required fields have been set
756    pub trait State: sealed::Sealed {
757        type Author;
758        type Blocked;
759        type Uri;
760    }
761    /// Empty state - all required fields are unset
762    pub struct Empty(());
763    impl sealed::Sealed for Empty {}
764    impl State for Empty {
765        type Author = Unset;
766        type Blocked = Unset;
767        type Uri = Unset;
768    }
769    ///State transition - sets the `author` field to Set
770    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
771    impl<St: State> sealed::Sealed for SetAuthor<St> {}
772    impl<St: State> State for SetAuthor<St> {
773        type Author = Set<members::author>;
774        type Blocked = St::Blocked;
775        type Uri = St::Uri;
776    }
777    ///State transition - sets the `blocked` field to Set
778    pub struct SetBlocked<St: State = Empty>(PhantomData<fn() -> St>);
779    impl<St: State> sealed::Sealed for SetBlocked<St> {}
780    impl<St: State> State for SetBlocked<St> {
781        type Author = St::Author;
782        type Blocked = Set<members::blocked>;
783        type Uri = St::Uri;
784    }
785    ///State transition - sets the `uri` field to Set
786    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
787    impl<St: State> sealed::Sealed for SetUri<St> {}
788    impl<St: State> State for SetUri<St> {
789        type Author = St::Author;
790        type Blocked = St::Blocked;
791        type Uri = Set<members::uri>;
792    }
793    /// Marker types for field names
794    #[allow(non_camel_case_types)]
795    pub mod members {
796        ///Marker type for the `author` field
797        pub struct author(());
798        ///Marker type for the `blocked` field
799        pub struct blocked(());
800        ///Marker type for the `uri` field
801        pub struct uri(());
802    }
803}
804
805/// Builder for constructing an instance of this type.
806pub struct ViewBlockedBuilder<St: view_blocked_state::State, S: BosStr = DefaultStr> {
807    _state: PhantomData<fn() -> St>,
808    _fields: (Option<BlockedAuthor<S>>, Option<bool>, Option<AtUri<S>>),
809    _type: PhantomData<fn() -> S>,
810}
811
812impl ViewBlocked<DefaultStr> {
813    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
814    pub fn new() -> ViewBlockedBuilder<view_blocked_state::Empty, DefaultStr> {
815        ViewBlockedBuilder::new()
816    }
817}
818
819impl<S: BosStr> ViewBlocked<S> {
820    /// Create a new builder for this type
821    pub fn builder() -> ViewBlockedBuilder<view_blocked_state::Empty, S> {
822        ViewBlockedBuilder::builder()
823    }
824}
825
826impl ViewBlockedBuilder<view_blocked_state::Empty, DefaultStr> {
827    /// Create a new builder with all fields unset, using the default string type, if needed
828    pub fn new() -> Self {
829        ViewBlockedBuilder {
830            _state: PhantomData,
831            _fields: (None, None, None),
832            _type: PhantomData,
833        }
834    }
835}
836
837impl<S: BosStr> ViewBlockedBuilder<view_blocked_state::Empty, S> {
838    /// Create a new builder with all fields unset
839    pub fn builder() -> Self {
840        ViewBlockedBuilder {
841            _state: PhantomData,
842            _fields: (None, None, None),
843            _type: PhantomData,
844        }
845    }
846}
847
848impl<St, S: BosStr> ViewBlockedBuilder<St, S>
849where
850    St: view_blocked_state::State,
851    St::Author: view_blocked_state::IsUnset,
852{
853    /// Set the `author` field (required)
854    pub fn author(
855        mut self,
856        value: impl Into<BlockedAuthor<S>>,
857    ) -> ViewBlockedBuilder<view_blocked_state::SetAuthor<St>, S> {
858        self._fields.0 = Option::Some(value.into());
859        ViewBlockedBuilder {
860            _state: PhantomData,
861            _fields: self._fields,
862            _type: PhantomData,
863        }
864    }
865}
866
867impl<St, S: BosStr> ViewBlockedBuilder<St, S>
868where
869    St: view_blocked_state::State,
870    St::Blocked: view_blocked_state::IsUnset,
871{
872    /// Set the `blocked` field (required)
873    pub fn blocked(
874        mut self,
875        value: impl Into<bool>,
876    ) -> ViewBlockedBuilder<view_blocked_state::SetBlocked<St>, S> {
877        self._fields.1 = Option::Some(value.into());
878        ViewBlockedBuilder {
879            _state: PhantomData,
880            _fields: self._fields,
881            _type: PhantomData,
882        }
883    }
884}
885
886impl<St, S: BosStr> ViewBlockedBuilder<St, S>
887where
888    St: view_blocked_state::State,
889    St::Uri: view_blocked_state::IsUnset,
890{
891    /// Set the `uri` field (required)
892    pub fn uri(
893        mut self,
894        value: impl Into<AtUri<S>>,
895    ) -> ViewBlockedBuilder<view_blocked_state::SetUri<St>, S> {
896        self._fields.2 = Option::Some(value.into());
897        ViewBlockedBuilder {
898            _state: PhantomData,
899            _fields: self._fields,
900            _type: PhantomData,
901        }
902    }
903}
904
905impl<St, S: BosStr> ViewBlockedBuilder<St, S>
906where
907    St: view_blocked_state::State,
908    St::Author: view_blocked_state::IsSet,
909    St::Blocked: view_blocked_state::IsSet,
910    St::Uri: view_blocked_state::IsSet,
911{
912    /// Build the final struct.
913    pub fn build(self) -> ViewBlocked<S> {
914        ViewBlocked {
915            author: self._fields.0.unwrap(),
916            blocked: self._fields.1.unwrap(),
917            uri: self._fields.2.unwrap(),
918            extra_data: Default::default(),
919        }
920    }
921    /// Build the final struct with custom extra_data.
922    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewBlocked<S> {
923        ViewBlocked {
924            author: self._fields.0.unwrap(),
925            blocked: self._fields.1.unwrap(),
926            uri: self._fields.2.unwrap(),
927            extra_data: Some(extra_data),
928        }
929    }
930}
931
932pub mod view_detached_state {
933
934    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
935    #[allow(unused)]
936    use ::core::marker::PhantomData;
937    mod sealed {
938        pub trait Sealed {}
939    }
940    /// State trait tracking which required fields have been set
941    pub trait State: sealed::Sealed {
942        type Detached;
943        type Uri;
944    }
945    /// Empty state - all required fields are unset
946    pub struct Empty(());
947    impl sealed::Sealed for Empty {}
948    impl State for Empty {
949        type Detached = Unset;
950        type Uri = Unset;
951    }
952    ///State transition - sets the `detached` field to Set
953    pub struct SetDetached<St: State = Empty>(PhantomData<fn() -> St>);
954    impl<St: State> sealed::Sealed for SetDetached<St> {}
955    impl<St: State> State for SetDetached<St> {
956        type Detached = Set<members::detached>;
957        type Uri = St::Uri;
958    }
959    ///State transition - sets the `uri` field to Set
960    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
961    impl<St: State> sealed::Sealed for SetUri<St> {}
962    impl<St: State> State for SetUri<St> {
963        type Detached = St::Detached;
964        type Uri = Set<members::uri>;
965    }
966    /// Marker types for field names
967    #[allow(non_camel_case_types)]
968    pub mod members {
969        ///Marker type for the `detached` field
970        pub struct detached(());
971        ///Marker type for the `uri` field
972        pub struct uri(());
973    }
974}
975
976/// Builder for constructing an instance of this type.
977pub struct ViewDetachedBuilder<St: view_detached_state::State, S: BosStr = DefaultStr> {
978    _state: PhantomData<fn() -> St>,
979    _fields: (Option<bool>, Option<AtUri<S>>),
980    _type: PhantomData<fn() -> S>,
981}
982
983impl ViewDetached<DefaultStr> {
984    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
985    pub fn new() -> ViewDetachedBuilder<view_detached_state::Empty, DefaultStr> {
986        ViewDetachedBuilder::new()
987    }
988}
989
990impl<S: BosStr> ViewDetached<S> {
991    /// Create a new builder for this type
992    pub fn builder() -> ViewDetachedBuilder<view_detached_state::Empty, S> {
993        ViewDetachedBuilder::builder()
994    }
995}
996
997impl ViewDetachedBuilder<view_detached_state::Empty, DefaultStr> {
998    /// Create a new builder with all fields unset, using the default string type, if needed
999    pub fn new() -> Self {
1000        ViewDetachedBuilder {
1001            _state: PhantomData,
1002            _fields: (None, None),
1003            _type: PhantomData,
1004        }
1005    }
1006}
1007
1008impl<S: BosStr> ViewDetachedBuilder<view_detached_state::Empty, S> {
1009    /// Create a new builder with all fields unset
1010    pub fn builder() -> Self {
1011        ViewDetachedBuilder {
1012            _state: PhantomData,
1013            _fields: (None, None),
1014            _type: PhantomData,
1015        }
1016    }
1017}
1018
1019impl<St, S: BosStr> ViewDetachedBuilder<St, S>
1020where
1021    St: view_detached_state::State,
1022    St::Detached: view_detached_state::IsUnset,
1023{
1024    /// Set the `detached` field (required)
1025    pub fn detached(
1026        mut self,
1027        value: impl Into<bool>,
1028    ) -> ViewDetachedBuilder<view_detached_state::SetDetached<St>, S> {
1029        self._fields.0 = Option::Some(value.into());
1030        ViewDetachedBuilder {
1031            _state: PhantomData,
1032            _fields: self._fields,
1033            _type: PhantomData,
1034        }
1035    }
1036}
1037
1038impl<St, S: BosStr> ViewDetachedBuilder<St, S>
1039where
1040    St: view_detached_state::State,
1041    St::Uri: view_detached_state::IsUnset,
1042{
1043    /// Set the `uri` field (required)
1044    pub fn uri(
1045        mut self,
1046        value: impl Into<AtUri<S>>,
1047    ) -> ViewDetachedBuilder<view_detached_state::SetUri<St>, S> {
1048        self._fields.1 = Option::Some(value.into());
1049        ViewDetachedBuilder {
1050            _state: PhantomData,
1051            _fields: self._fields,
1052            _type: PhantomData,
1053        }
1054    }
1055}
1056
1057impl<St, S: BosStr> ViewDetachedBuilder<St, S>
1058where
1059    St: view_detached_state::State,
1060    St::Detached: view_detached_state::IsSet,
1061    St::Uri: view_detached_state::IsSet,
1062{
1063    /// Build the final struct.
1064    pub fn build(self) -> ViewDetached<S> {
1065        ViewDetached {
1066            detached: self._fields.0.unwrap(),
1067            uri: self._fields.1.unwrap(),
1068            extra_data: Default::default(),
1069        }
1070    }
1071    /// Build the final struct with custom extra_data.
1072    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewDetached<S> {
1073        ViewDetached {
1074            detached: self._fields.0.unwrap(),
1075            uri: self._fields.1.unwrap(),
1076            extra_data: Some(extra_data),
1077        }
1078    }
1079}
1080
1081pub mod view_not_found_state {
1082
1083    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1084    #[allow(unused)]
1085    use ::core::marker::PhantomData;
1086    mod sealed {
1087        pub trait Sealed {}
1088    }
1089    /// State trait tracking which required fields have been set
1090    pub trait State: sealed::Sealed {
1091        type NotFound;
1092        type Uri;
1093    }
1094    /// Empty state - all required fields are unset
1095    pub struct Empty(());
1096    impl sealed::Sealed for Empty {}
1097    impl State for Empty {
1098        type NotFound = Unset;
1099        type Uri = Unset;
1100    }
1101    ///State transition - sets the `not_found` field to Set
1102    pub struct SetNotFound<St: State = Empty>(PhantomData<fn() -> St>);
1103    impl<St: State> sealed::Sealed for SetNotFound<St> {}
1104    impl<St: State> State for SetNotFound<St> {
1105        type NotFound = Set<members::not_found>;
1106        type Uri = St::Uri;
1107    }
1108    ///State transition - sets the `uri` field to Set
1109    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1110    impl<St: State> sealed::Sealed for SetUri<St> {}
1111    impl<St: State> State for SetUri<St> {
1112        type NotFound = St::NotFound;
1113        type Uri = Set<members::uri>;
1114    }
1115    /// Marker types for field names
1116    #[allow(non_camel_case_types)]
1117    pub mod members {
1118        ///Marker type for the `not_found` field
1119        pub struct not_found(());
1120        ///Marker type for the `uri` field
1121        pub struct uri(());
1122    }
1123}
1124
1125/// Builder for constructing an instance of this type.
1126pub struct ViewNotFoundBuilder<St: view_not_found_state::State, S: BosStr = DefaultStr> {
1127    _state: PhantomData<fn() -> St>,
1128    _fields: (Option<bool>, Option<AtUri<S>>),
1129    _type: PhantomData<fn() -> S>,
1130}
1131
1132impl ViewNotFound<DefaultStr> {
1133    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1134    pub fn new() -> ViewNotFoundBuilder<view_not_found_state::Empty, DefaultStr> {
1135        ViewNotFoundBuilder::new()
1136    }
1137}
1138
1139impl<S: BosStr> ViewNotFound<S> {
1140    /// Create a new builder for this type
1141    pub fn builder() -> ViewNotFoundBuilder<view_not_found_state::Empty, S> {
1142        ViewNotFoundBuilder::builder()
1143    }
1144}
1145
1146impl ViewNotFoundBuilder<view_not_found_state::Empty, DefaultStr> {
1147    /// Create a new builder with all fields unset, using the default string type, if needed
1148    pub fn new() -> Self {
1149        ViewNotFoundBuilder {
1150            _state: PhantomData,
1151            _fields: (None, None),
1152            _type: PhantomData,
1153        }
1154    }
1155}
1156
1157impl<S: BosStr> ViewNotFoundBuilder<view_not_found_state::Empty, S> {
1158    /// Create a new builder with all fields unset
1159    pub fn builder() -> Self {
1160        ViewNotFoundBuilder {
1161            _state: PhantomData,
1162            _fields: (None, None),
1163            _type: PhantomData,
1164        }
1165    }
1166}
1167
1168impl<St, S: BosStr> ViewNotFoundBuilder<St, S>
1169where
1170    St: view_not_found_state::State,
1171    St::NotFound: view_not_found_state::IsUnset,
1172{
1173    /// Set the `notFound` field (required)
1174    pub fn not_found(
1175        mut self,
1176        value: impl Into<bool>,
1177    ) -> ViewNotFoundBuilder<view_not_found_state::SetNotFound<St>, S> {
1178        self._fields.0 = Option::Some(value.into());
1179        ViewNotFoundBuilder {
1180            _state: PhantomData,
1181            _fields: self._fields,
1182            _type: PhantomData,
1183        }
1184    }
1185}
1186
1187impl<St, S: BosStr> ViewNotFoundBuilder<St, S>
1188where
1189    St: view_not_found_state::State,
1190    St::Uri: view_not_found_state::IsUnset,
1191{
1192    /// Set the `uri` field (required)
1193    pub fn uri(
1194        mut self,
1195        value: impl Into<AtUri<S>>,
1196    ) -> ViewNotFoundBuilder<view_not_found_state::SetUri<St>, S> {
1197        self._fields.1 = Option::Some(value.into());
1198        ViewNotFoundBuilder {
1199            _state: PhantomData,
1200            _fields: self._fields,
1201            _type: PhantomData,
1202        }
1203    }
1204}
1205
1206impl<St, S: BosStr> ViewNotFoundBuilder<St, S>
1207where
1208    St: view_not_found_state::State,
1209    St::NotFound: view_not_found_state::IsSet,
1210    St::Uri: view_not_found_state::IsSet,
1211{
1212    /// Build the final struct.
1213    pub fn build(self) -> ViewNotFound<S> {
1214        ViewNotFound {
1215            not_found: self._fields.0.unwrap(),
1216            uri: self._fields.1.unwrap(),
1217            extra_data: Default::default(),
1218        }
1219    }
1220    /// Build the final struct with custom extra_data.
1221    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewNotFound<S> {
1222        ViewNotFound {
1223            not_found: self._fields.0.unwrap(),
1224            uri: self._fields.1.unwrap(),
1225            extra_data: Some(extra_data),
1226        }
1227    }
1228}
1229
1230pub mod view_record_state {
1231
1232    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1233    #[allow(unused)]
1234    use ::core::marker::PhantomData;
1235    mod sealed {
1236        pub trait Sealed {}
1237    }
1238    /// State trait tracking which required fields have been set
1239    pub trait State: sealed::Sealed {
1240        type Author;
1241        type Cid;
1242        type IndexedAt;
1243        type Uri;
1244        type Value;
1245    }
1246    /// Empty state - all required fields are unset
1247    pub struct Empty(());
1248    impl sealed::Sealed for Empty {}
1249    impl State for Empty {
1250        type Author = Unset;
1251        type Cid = Unset;
1252        type IndexedAt = Unset;
1253        type Uri = Unset;
1254        type Value = Unset;
1255    }
1256    ///State transition - sets the `author` field to Set
1257    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
1258    impl<St: State> sealed::Sealed for SetAuthor<St> {}
1259    impl<St: State> State for SetAuthor<St> {
1260        type Author = Set<members::author>;
1261        type Cid = St::Cid;
1262        type IndexedAt = St::IndexedAt;
1263        type Uri = St::Uri;
1264        type Value = St::Value;
1265    }
1266    ///State transition - sets the `cid` field to Set
1267    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
1268    impl<St: State> sealed::Sealed for SetCid<St> {}
1269    impl<St: State> State for SetCid<St> {
1270        type Author = St::Author;
1271        type Cid = Set<members::cid>;
1272        type IndexedAt = St::IndexedAt;
1273        type Uri = St::Uri;
1274        type Value = St::Value;
1275    }
1276    ///State transition - sets the `indexed_at` field to Set
1277    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
1278    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
1279    impl<St: State> State for SetIndexedAt<St> {
1280        type Author = St::Author;
1281        type Cid = St::Cid;
1282        type IndexedAt = Set<members::indexed_at>;
1283        type Uri = St::Uri;
1284        type Value = St::Value;
1285    }
1286    ///State transition - sets the `uri` field to Set
1287    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1288    impl<St: State> sealed::Sealed for SetUri<St> {}
1289    impl<St: State> State for SetUri<St> {
1290        type Author = St::Author;
1291        type Cid = St::Cid;
1292        type IndexedAt = St::IndexedAt;
1293        type Uri = Set<members::uri>;
1294        type Value = St::Value;
1295    }
1296    ///State transition - sets the `value` field to Set
1297    pub struct SetValue<St: State = Empty>(PhantomData<fn() -> St>);
1298    impl<St: State> sealed::Sealed for SetValue<St> {}
1299    impl<St: State> State for SetValue<St> {
1300        type Author = St::Author;
1301        type Cid = St::Cid;
1302        type IndexedAt = St::IndexedAt;
1303        type Uri = St::Uri;
1304        type Value = Set<members::value>;
1305    }
1306    /// Marker types for field names
1307    #[allow(non_camel_case_types)]
1308    pub mod members {
1309        ///Marker type for the `author` field
1310        pub struct author(());
1311        ///Marker type for the `cid` field
1312        pub struct cid(());
1313        ///Marker type for the `indexed_at` field
1314        pub struct indexed_at(());
1315        ///Marker type for the `uri` field
1316        pub struct uri(());
1317        ///Marker type for the `value` field
1318        pub struct value(());
1319    }
1320}
1321
1322/// Builder for constructing an instance of this type.
1323pub struct ViewRecordBuilder<St: view_record_state::State, S: BosStr = DefaultStr> {
1324    _state: PhantomData<fn() -> St>,
1325    _fields: (
1326        Option<ProfileViewBasic<S>>,
1327        Option<Cid<S>>,
1328        Option<Vec<ViewRecordEmbedsItem<S>>>,
1329        Option<Datetime>,
1330        Option<Vec<Label<S>>>,
1331        Option<i64>,
1332        Option<i64>,
1333        Option<i64>,
1334        Option<i64>,
1335        Option<AtUri<S>>,
1336        Option<Data<S>>,
1337    ),
1338    _type: PhantomData<fn() -> S>,
1339}
1340
1341impl ViewRecord<DefaultStr> {
1342    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1343    pub fn new() -> ViewRecordBuilder<view_record_state::Empty, DefaultStr> {
1344        ViewRecordBuilder::new()
1345    }
1346}
1347
1348impl<S: BosStr> ViewRecord<S> {
1349    /// Create a new builder for this type
1350    pub fn builder() -> ViewRecordBuilder<view_record_state::Empty, S> {
1351        ViewRecordBuilder::builder()
1352    }
1353}
1354
1355impl ViewRecordBuilder<view_record_state::Empty, DefaultStr> {
1356    /// Create a new builder with all fields unset, using the default string type, if needed
1357    pub fn new() -> Self {
1358        ViewRecordBuilder {
1359            _state: PhantomData,
1360            _fields: (
1361                None, None, None, None, None, None, None, None, None, None, None,
1362            ),
1363            _type: PhantomData,
1364        }
1365    }
1366}
1367
1368impl<S: BosStr> ViewRecordBuilder<view_record_state::Empty, S> {
1369    /// Create a new builder with all fields unset
1370    pub fn builder() -> Self {
1371        ViewRecordBuilder {
1372            _state: PhantomData,
1373            _fields: (
1374                None, None, None, None, None, None, None, None, None, None, None,
1375            ),
1376            _type: PhantomData,
1377        }
1378    }
1379}
1380
1381impl<St, S: BosStr> ViewRecordBuilder<St, S>
1382where
1383    St: view_record_state::State,
1384    St::Author: view_record_state::IsUnset,
1385{
1386    /// Set the `author` field (required)
1387    pub fn author(
1388        mut self,
1389        value: impl Into<ProfileViewBasic<S>>,
1390    ) -> ViewRecordBuilder<view_record_state::SetAuthor<St>, S> {
1391        self._fields.0 = Option::Some(value.into());
1392        ViewRecordBuilder {
1393            _state: PhantomData,
1394            _fields: self._fields,
1395            _type: PhantomData,
1396        }
1397    }
1398}
1399
1400impl<St, S: BosStr> ViewRecordBuilder<St, S>
1401where
1402    St: view_record_state::State,
1403    St::Cid: view_record_state::IsUnset,
1404{
1405    /// Set the `cid` field (required)
1406    pub fn cid(
1407        mut self,
1408        value: impl Into<Cid<S>>,
1409    ) -> ViewRecordBuilder<view_record_state::SetCid<St>, S> {
1410        self._fields.1 = Option::Some(value.into());
1411        ViewRecordBuilder {
1412            _state: PhantomData,
1413            _fields: self._fields,
1414            _type: PhantomData,
1415        }
1416    }
1417}
1418
1419impl<St: view_record_state::State, S: BosStr> ViewRecordBuilder<St, S> {
1420    /// Set the `embeds` field (optional)
1421    pub fn embeds(mut self, value: impl Into<Option<Vec<ViewRecordEmbedsItem<S>>>>) -> Self {
1422        self._fields.2 = value.into();
1423        self
1424    }
1425    /// Set the `embeds` field to an Option value (optional)
1426    pub fn maybe_embeds(mut self, value: Option<Vec<ViewRecordEmbedsItem<S>>>) -> Self {
1427        self._fields.2 = value;
1428        self
1429    }
1430}
1431
1432impl<St, S: BosStr> ViewRecordBuilder<St, S>
1433where
1434    St: view_record_state::State,
1435    St::IndexedAt: view_record_state::IsUnset,
1436{
1437    /// Set the `indexedAt` field (required)
1438    pub fn indexed_at(
1439        mut self,
1440        value: impl Into<Datetime>,
1441    ) -> ViewRecordBuilder<view_record_state::SetIndexedAt<St>, S> {
1442        self._fields.3 = Option::Some(value.into());
1443        ViewRecordBuilder {
1444            _state: PhantomData,
1445            _fields: self._fields,
1446            _type: PhantomData,
1447        }
1448    }
1449}
1450
1451impl<St: view_record_state::State, S: BosStr> ViewRecordBuilder<St, S> {
1452    /// Set the `labels` field (optional)
1453    pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
1454        self._fields.4 = value.into();
1455        self
1456    }
1457    /// Set the `labels` field to an Option value (optional)
1458    pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
1459        self._fields.4 = value;
1460        self
1461    }
1462}
1463
1464impl<St: view_record_state::State, S: BosStr> ViewRecordBuilder<St, S> {
1465    /// Set the `likeCount` field (optional)
1466    pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
1467        self._fields.5 = value.into();
1468        self
1469    }
1470    /// Set the `likeCount` field to an Option value (optional)
1471    pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
1472        self._fields.5 = value;
1473        self
1474    }
1475}
1476
1477impl<St: view_record_state::State, S: BosStr> ViewRecordBuilder<St, S> {
1478    /// Set the `quoteCount` field (optional)
1479    pub fn quote_count(mut self, value: impl Into<Option<i64>>) -> Self {
1480        self._fields.6 = value.into();
1481        self
1482    }
1483    /// Set the `quoteCount` field to an Option value (optional)
1484    pub fn maybe_quote_count(mut self, value: Option<i64>) -> Self {
1485        self._fields.6 = value;
1486        self
1487    }
1488}
1489
1490impl<St: view_record_state::State, S: BosStr> ViewRecordBuilder<St, S> {
1491    /// Set the `replyCount` field (optional)
1492    pub fn reply_count(mut self, value: impl Into<Option<i64>>) -> Self {
1493        self._fields.7 = value.into();
1494        self
1495    }
1496    /// Set the `replyCount` field to an Option value (optional)
1497    pub fn maybe_reply_count(mut self, value: Option<i64>) -> Self {
1498        self._fields.7 = value;
1499        self
1500    }
1501}
1502
1503impl<St: view_record_state::State, S: BosStr> ViewRecordBuilder<St, S> {
1504    /// Set the `repostCount` field (optional)
1505    pub fn repost_count(mut self, value: impl Into<Option<i64>>) -> Self {
1506        self._fields.8 = value.into();
1507        self
1508    }
1509    /// Set the `repostCount` field to an Option value (optional)
1510    pub fn maybe_repost_count(mut self, value: Option<i64>) -> Self {
1511        self._fields.8 = value;
1512        self
1513    }
1514}
1515
1516impl<St, S: BosStr> ViewRecordBuilder<St, S>
1517where
1518    St: view_record_state::State,
1519    St::Uri: view_record_state::IsUnset,
1520{
1521    /// Set the `uri` field (required)
1522    pub fn uri(
1523        mut self,
1524        value: impl Into<AtUri<S>>,
1525    ) -> ViewRecordBuilder<view_record_state::SetUri<St>, S> {
1526        self._fields.9 = Option::Some(value.into());
1527        ViewRecordBuilder {
1528            _state: PhantomData,
1529            _fields: self._fields,
1530            _type: PhantomData,
1531        }
1532    }
1533}
1534
1535impl<St, S: BosStr> ViewRecordBuilder<St, S>
1536where
1537    St: view_record_state::State,
1538    St::Value: view_record_state::IsUnset,
1539{
1540    /// Set the `value` field (required)
1541    pub fn value(
1542        mut self,
1543        value: impl Into<Data<S>>,
1544    ) -> ViewRecordBuilder<view_record_state::SetValue<St>, S> {
1545        self._fields.10 = Option::Some(value.into());
1546        ViewRecordBuilder {
1547            _state: PhantomData,
1548            _fields: self._fields,
1549            _type: PhantomData,
1550        }
1551    }
1552}
1553
1554impl<St, S: BosStr> ViewRecordBuilder<St, S>
1555where
1556    St: view_record_state::State,
1557    St::Author: view_record_state::IsSet,
1558    St::Cid: view_record_state::IsSet,
1559    St::IndexedAt: view_record_state::IsSet,
1560    St::Uri: view_record_state::IsSet,
1561    St::Value: view_record_state::IsSet,
1562{
1563    /// Build the final struct.
1564    pub fn build(self) -> ViewRecord<S> {
1565        ViewRecord {
1566            author: self._fields.0.unwrap(),
1567            cid: self._fields.1.unwrap(),
1568            embeds: self._fields.2,
1569            indexed_at: self._fields.3.unwrap(),
1570            labels: self._fields.4,
1571            like_count: self._fields.5,
1572            quote_count: self._fields.6,
1573            reply_count: self._fields.7,
1574            repost_count: self._fields.8,
1575            uri: self._fields.9.unwrap(),
1576            value: self._fields.10.unwrap(),
1577            extra_data: Default::default(),
1578        }
1579    }
1580    /// Build the final struct with custom extra_data.
1581    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewRecord<S> {
1582        ViewRecord {
1583            author: self._fields.0.unwrap(),
1584            cid: self._fields.1.unwrap(),
1585            embeds: self._fields.2,
1586            indexed_at: self._fields.3.unwrap(),
1587            labels: self._fields.4,
1588            like_count: self._fields.5,
1589            quote_count: self._fields.6,
1590            reply_count: self._fields.7,
1591            repost_count: self._fields.8,
1592            uri: self._fields.9.unwrap(),
1593            value: self._fields.10.unwrap(),
1594            extra_data: Some(extra_data),
1595        }
1596    }
1597}