Skip to main content

jacquard_api/
place_stream.rs

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