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