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
8pub mod broadcast;
9pub mod chat;
10pub mod graph;
11pub mod key;
12pub mod live;
13pub mod livestream;
14pub mod metadata;
15pub mod richtext;
16pub mod segment;
17pub mod server;
18
19#[jacquard_derive::lexicon]
20#[derive(
21    serde::Serialize,
22    serde::Deserialize,
23    Debug,
24    Clone,
25    PartialEq,
26    Eq,
27    jacquard_derive::IntoStatic
28)]
29#[serde(rename_all = "camelCase")]
30pub struct BlockView<'a> {
31    #[serde(borrow)]
32    pub blocker: crate::app_bsky::actor::ProfileViewBasic<'a>,
33    #[serde(borrow)]
34    pub cid: jacquard_common::types::string::Cid<'a>,
35    pub indexed_at: jacquard_common::types::string::Datetime,
36    #[serde(borrow)]
37    pub record: crate::app_bsky::graph::block::Block<'a>,
38    #[serde(borrow)]
39    pub uri: jacquard_common::types::string::AtUri<'a>,
40}
41
42pub mod block_view_state {
43
44    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
45    #[allow(unused)]
46    use ::core::marker::PhantomData;
47    mod sealed {
48        pub trait Sealed {}
49    }
50    /// State trait tracking which required fields have been set
51    pub trait State: sealed::Sealed {
52        type Cid;
53        type IndexedAt;
54        type Record;
55        type Blocker;
56        type Uri;
57    }
58    /// Empty state - all required fields are unset
59    pub struct Empty(());
60    impl sealed::Sealed for Empty {}
61    impl State for Empty {
62        type Cid = Unset;
63        type IndexedAt = Unset;
64        type Record = Unset;
65        type Blocker = Unset;
66        type Uri = Unset;
67    }
68    ///State transition - sets the `cid` field to Set
69    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
70    impl<S: State> sealed::Sealed for SetCid<S> {}
71    impl<S: State> State for SetCid<S> {
72        type Cid = Set<members::cid>;
73        type IndexedAt = S::IndexedAt;
74        type Record = S::Record;
75        type Blocker = S::Blocker;
76        type Uri = S::Uri;
77    }
78    ///State transition - sets the `indexed_at` field to Set
79    pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
80    impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
81    impl<S: State> State for SetIndexedAt<S> {
82        type Cid = S::Cid;
83        type IndexedAt = Set<members::indexed_at>;
84        type Record = S::Record;
85        type Blocker = S::Blocker;
86        type Uri = S::Uri;
87    }
88    ///State transition - sets the `record` field to Set
89    pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
90    impl<S: State> sealed::Sealed for SetRecord<S> {}
91    impl<S: State> State for SetRecord<S> {
92        type Cid = S::Cid;
93        type IndexedAt = S::IndexedAt;
94        type Record = Set<members::record>;
95        type Blocker = S::Blocker;
96        type Uri = S::Uri;
97    }
98    ///State transition - sets the `blocker` field to Set
99    pub struct SetBlocker<S: State = Empty>(PhantomData<fn() -> S>);
100    impl<S: State> sealed::Sealed for SetBlocker<S> {}
101    impl<S: State> State for SetBlocker<S> {
102        type Cid = S::Cid;
103        type IndexedAt = S::IndexedAt;
104        type Record = S::Record;
105        type Blocker = Set<members::blocker>;
106        type Uri = S::Uri;
107    }
108    ///State transition - sets the `uri` field to Set
109    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
110    impl<S: State> sealed::Sealed for SetUri<S> {}
111    impl<S: State> State for SetUri<S> {
112        type Cid = S::Cid;
113        type IndexedAt = S::IndexedAt;
114        type Record = S::Record;
115        type Blocker = S::Blocker;
116        type Uri = Set<members::uri>;
117    }
118    /// Marker types for field names
119    #[allow(non_camel_case_types)]
120    pub mod members {
121        ///Marker type for the `cid` field
122        pub struct cid(());
123        ///Marker type for the `indexed_at` field
124        pub struct indexed_at(());
125        ///Marker type for the `record` field
126        pub struct record(());
127        ///Marker type for the `blocker` field
128        pub struct blocker(());
129        ///Marker type for the `uri` field
130        pub struct uri(());
131    }
132}
133
134/// Builder for constructing an instance of this type
135pub struct BlockViewBuilder<'a, S: block_view_state::State> {
136    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
137    __unsafe_private_named: (
138        ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>,
139        ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
140        ::core::option::Option<jacquard_common::types::string::Datetime>,
141        ::core::option::Option<crate::app_bsky::graph::block::Block<'a>>,
142        ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
143    ),
144    _phantom: ::core::marker::PhantomData<&'a ()>,
145}
146
147impl<'a> BlockView<'a> {
148    /// Create a new builder for this type
149    pub fn new() -> BlockViewBuilder<'a, block_view_state::Empty> {
150        BlockViewBuilder::new()
151    }
152}
153
154impl<'a> BlockViewBuilder<'a, block_view_state::Empty> {
155    /// Create a new builder with all fields unset
156    pub fn new() -> Self {
157        BlockViewBuilder {
158            _phantom_state: ::core::marker::PhantomData,
159            __unsafe_private_named: (None, None, None, None, None),
160            _phantom: ::core::marker::PhantomData,
161        }
162    }
163}
164
165impl<'a, S> BlockViewBuilder<'a, S>
166where
167    S: block_view_state::State,
168    S::Blocker: block_view_state::IsUnset,
169{
170    /// Set the `blocker` field (required)
171    pub fn blocker(
172        mut self,
173        value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>,
174    ) -> BlockViewBuilder<'a, block_view_state::SetBlocker<S>> {
175        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
176        BlockViewBuilder {
177            _phantom_state: ::core::marker::PhantomData,
178            __unsafe_private_named: self.__unsafe_private_named,
179            _phantom: ::core::marker::PhantomData,
180        }
181    }
182}
183
184impl<'a, S> BlockViewBuilder<'a, S>
185where
186    S: block_view_state::State,
187    S::Cid: block_view_state::IsUnset,
188{
189    /// Set the `cid` field (required)
190    pub fn cid(
191        mut self,
192        value: impl Into<jacquard_common::types::string::Cid<'a>>,
193    ) -> BlockViewBuilder<'a, block_view_state::SetCid<S>> {
194        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
195        BlockViewBuilder {
196            _phantom_state: ::core::marker::PhantomData,
197            __unsafe_private_named: self.__unsafe_private_named,
198            _phantom: ::core::marker::PhantomData,
199        }
200    }
201}
202
203impl<'a, S> BlockViewBuilder<'a, S>
204where
205    S: block_view_state::State,
206    S::IndexedAt: block_view_state::IsUnset,
207{
208    /// Set the `indexedAt` field (required)
209    pub fn indexed_at(
210        mut self,
211        value: impl Into<jacquard_common::types::string::Datetime>,
212    ) -> BlockViewBuilder<'a, block_view_state::SetIndexedAt<S>> {
213        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
214        BlockViewBuilder {
215            _phantom_state: ::core::marker::PhantomData,
216            __unsafe_private_named: self.__unsafe_private_named,
217            _phantom: ::core::marker::PhantomData,
218        }
219    }
220}
221
222impl<'a, S> BlockViewBuilder<'a, S>
223where
224    S: block_view_state::State,
225    S::Record: block_view_state::IsUnset,
226{
227    /// Set the `record` field (required)
228    pub fn record(
229        mut self,
230        value: impl Into<crate::app_bsky::graph::block::Block<'a>>,
231    ) -> BlockViewBuilder<'a, block_view_state::SetRecord<S>> {
232        self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
233        BlockViewBuilder {
234            _phantom_state: ::core::marker::PhantomData,
235            __unsafe_private_named: self.__unsafe_private_named,
236            _phantom: ::core::marker::PhantomData,
237        }
238    }
239}
240
241impl<'a, S> BlockViewBuilder<'a, S>
242where
243    S: block_view_state::State,
244    S::Uri: block_view_state::IsUnset,
245{
246    /// Set the `uri` field (required)
247    pub fn uri(
248        mut self,
249        value: impl Into<jacquard_common::types::string::AtUri<'a>>,
250    ) -> BlockViewBuilder<'a, block_view_state::SetUri<S>> {
251        self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
252        BlockViewBuilder {
253            _phantom_state: ::core::marker::PhantomData,
254            __unsafe_private_named: self.__unsafe_private_named,
255            _phantom: ::core::marker::PhantomData,
256        }
257    }
258}
259
260impl<'a, S> BlockViewBuilder<'a, S>
261where
262    S: block_view_state::State,
263    S::Cid: block_view_state::IsSet,
264    S::IndexedAt: block_view_state::IsSet,
265    S::Record: block_view_state::IsSet,
266    S::Blocker: block_view_state::IsSet,
267    S::Uri: block_view_state::IsSet,
268{
269    /// Build the final struct
270    pub fn build(self) -> BlockView<'a> {
271        BlockView {
272            blocker: self.__unsafe_private_named.0.unwrap(),
273            cid: self.__unsafe_private_named.1.unwrap(),
274            indexed_at: self.__unsafe_private_named.2.unwrap(),
275            record: self.__unsafe_private_named.3.unwrap(),
276            uri: self.__unsafe_private_named.4.unwrap(),
277            extra_data: Default::default(),
278        }
279    }
280    /// Build the final struct with custom extra_data
281    pub fn build_with_data(
282        self,
283        extra_data: std::collections::BTreeMap<
284            jacquard_common::smol_str::SmolStr,
285            jacquard_common::types::value::Data<'a>,
286        >,
287    ) -> BlockView<'a> {
288        BlockView {
289            blocker: self.__unsafe_private_named.0.unwrap(),
290            cid: self.__unsafe_private_named.1.unwrap(),
291            indexed_at: self.__unsafe_private_named.2.unwrap(),
292            record: self.__unsafe_private_named.3.unwrap(),
293            uri: self.__unsafe_private_named.4.unwrap(),
294            extra_data: Some(extra_data),
295        }
296    }
297}
298
299fn lexicon_doc_place_stream_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
300    ::jacquard_lexicon::lexicon::LexiconDoc {
301        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
302        id: ::jacquard_common::CowStr::new_static("place.stream.defs"),
303        revision: None,
304        description: None,
305        defs: {
306            let mut map = ::std::collections::BTreeMap::new();
307            map.insert(
308                ::jacquard_common::smol_str::SmolStr::new_static("blockView"),
309                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
310                    description: None,
311                    required: Some(
312                        vec![
313                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
314                            ::jacquard_common::smol_str::SmolStr::new_static("cid"),
315                            ::jacquard_common::smol_str::SmolStr::new_static("blocker"),
316                            ::jacquard_common::smol_str::SmolStr::new_static("record"),
317                            ::jacquard_common::smol_str::SmolStr::new_static("indexedAt")
318                        ],
319                    ),
320                    nullable: None,
321                    properties: {
322                        #[allow(unused_mut)]
323                        let mut map = ::std::collections::BTreeMap::new();
324                        map.insert(
325                            ::jacquard_common::smol_str::SmolStr::new_static("blocker"),
326                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
327                                description: None,
328                                r#ref: ::jacquard_common::CowStr::new_static(
329                                    "app.bsky.actor.defs#profileViewBasic",
330                                ),
331                            }),
332                        );
333                        map.insert(
334                            ::jacquard_common::smol_str::SmolStr::new_static("cid"),
335                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
336                                description: None,
337                                format: Some(
338                                    ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
339                                ),
340                                default: None,
341                                min_length: None,
342                                max_length: None,
343                                min_graphemes: None,
344                                max_graphemes: None,
345                                r#enum: None,
346                                r#const: None,
347                                known_values: None,
348                            }),
349                        );
350                        map.insert(
351                            ::jacquard_common::smol_str::SmolStr::new_static(
352                                "indexedAt",
353                            ),
354                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
355                                description: None,
356                                format: Some(
357                                    ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
358                                ),
359                                default: None,
360                                min_length: None,
361                                max_length: None,
362                                min_graphemes: None,
363                                max_graphemes: None,
364                                r#enum: None,
365                                r#const: None,
366                                known_values: None,
367                            }),
368                        );
369                        map.insert(
370                            ::jacquard_common::smol_str::SmolStr::new_static("record"),
371                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
372                                description: None,
373                                r#ref: ::jacquard_common::CowStr::new_static(
374                                    "app.bsky.graph.block",
375                                ),
376                            }),
377                        );
378                        map.insert(
379                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
380                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
381                                description: None,
382                                format: Some(
383                                    ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
384                                ),
385                                default: None,
386                                min_length: None,
387                                max_length: None,
388                                min_graphemes: None,
389                                max_graphemes: None,
390                                r#enum: None,
391                                r#const: None,
392                                known_values: None,
393                            }),
394                        );
395                        map
396                    },
397                }),
398            );
399            map.insert(
400                ::jacquard_common::smol_str::SmolStr::new_static("rendition"),
401                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
402                    description: None,
403                    required: Some(
404                        vec![::jacquard_common::smol_str::SmolStr::new_static("name")],
405                    ),
406                    nullable: None,
407                    properties: {
408                        #[allow(unused_mut)]
409                        let mut map = ::std::collections::BTreeMap::new();
410                        map.insert(
411                            ::jacquard_common::smol_str::SmolStr::new_static("name"),
412                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
413                                description: None,
414                                format: None,
415                                default: None,
416                                min_length: None,
417                                max_length: None,
418                                min_graphemes: None,
419                                max_graphemes: None,
420                                r#enum: None,
421                                r#const: None,
422                                known_values: None,
423                            }),
424                        );
425                        map
426                    },
427                }),
428            );
429            map.insert(
430                ::jacquard_common::smol_str::SmolStr::new_static("renditions"),
431                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
432                    description: None,
433                    required: Some(
434                        vec![
435                            ::jacquard_common::smol_str::SmolStr::new_static("renditions")
436                        ],
437                    ),
438                    nullable: None,
439                    properties: {
440                        #[allow(unused_mut)]
441                        let mut map = ::std::collections::BTreeMap::new();
442                        map.insert(
443                            ::jacquard_common::smol_str::SmolStr::new_static(
444                                "renditions",
445                            ),
446                            ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
447                                description: None,
448                                items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
449                                    description: None,
450                                    r#ref: ::jacquard_common::CowStr::new_static("#rendition"),
451                                }),
452                                min_length: None,
453                                max_length: None,
454                            }),
455                        );
456                        map
457                    },
458                }),
459            );
460            map
461        },
462    }
463}
464
465impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlockView<'a> {
466    fn nsid() -> &'static str {
467        "place.stream.defs"
468    }
469    fn def_name() -> &'static str {
470        "blockView"
471    }
472    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
473        lexicon_doc_place_stream_defs()
474    }
475    fn validate(
476        &self,
477    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
478        Ok(())
479    }
480}
481
482#[jacquard_derive::lexicon]
483#[derive(
484    serde::Serialize,
485    serde::Deserialize,
486    Debug,
487    Clone,
488    PartialEq,
489    Eq,
490    jacquard_derive::IntoStatic,
491    Default
492)]
493#[serde(rename_all = "camelCase")]
494pub struct Rendition<'a> {
495    #[serde(borrow)]
496    pub name: jacquard_common::CowStr<'a>,
497}
498
499impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Rendition<'a> {
500    fn nsid() -> &'static str {
501        "place.stream.defs"
502    }
503    fn def_name() -> &'static str {
504        "rendition"
505    }
506    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
507        lexicon_doc_place_stream_defs()
508    }
509    fn validate(
510        &self,
511    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
512        Ok(())
513    }
514}
515
516#[jacquard_derive::lexicon]
517#[derive(
518    serde::Serialize,
519    serde::Deserialize,
520    Debug,
521    Clone,
522    PartialEq,
523    Eq,
524    jacquard_derive::IntoStatic
525)]
526#[serde(rename_all = "camelCase")]
527pub struct Renditions<'a> {
528    #[serde(borrow)]
529    pub renditions: Vec<crate::place_stream::Rendition<'a>>,
530}
531
532pub mod renditions_state {
533
534    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
535    #[allow(unused)]
536    use ::core::marker::PhantomData;
537    mod sealed {
538        pub trait Sealed {}
539    }
540    /// State trait tracking which required fields have been set
541    pub trait State: sealed::Sealed {
542        type Renditions;
543    }
544    /// Empty state - all required fields are unset
545    pub struct Empty(());
546    impl sealed::Sealed for Empty {}
547    impl State for Empty {
548        type Renditions = Unset;
549    }
550    ///State transition - sets the `renditions` field to Set
551    pub struct SetRenditions<S: State = Empty>(PhantomData<fn() -> S>);
552    impl<S: State> sealed::Sealed for SetRenditions<S> {}
553    impl<S: State> State for SetRenditions<S> {
554        type Renditions = Set<members::renditions>;
555    }
556    /// Marker types for field names
557    #[allow(non_camel_case_types)]
558    pub mod members {
559        ///Marker type for the `renditions` field
560        pub struct renditions(());
561    }
562}
563
564/// Builder for constructing an instance of this type
565pub struct RenditionsBuilder<'a, S: renditions_state::State> {
566    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
567    __unsafe_private_named: (
568        ::core::option::Option<Vec<crate::place_stream::Rendition<'a>>>,
569    ),
570    _phantom: ::core::marker::PhantomData<&'a ()>,
571}
572
573impl<'a> Renditions<'a> {
574    /// Create a new builder for this type
575    pub fn new() -> RenditionsBuilder<'a, renditions_state::Empty> {
576        RenditionsBuilder::new()
577    }
578}
579
580impl<'a> RenditionsBuilder<'a, renditions_state::Empty> {
581    /// Create a new builder with all fields unset
582    pub fn new() -> Self {
583        RenditionsBuilder {
584            _phantom_state: ::core::marker::PhantomData,
585            __unsafe_private_named: (None,),
586            _phantom: ::core::marker::PhantomData,
587        }
588    }
589}
590
591impl<'a, S> RenditionsBuilder<'a, S>
592where
593    S: renditions_state::State,
594    S::Renditions: renditions_state::IsUnset,
595{
596    /// Set the `renditions` field (required)
597    pub fn renditions(
598        mut self,
599        value: impl Into<Vec<crate::place_stream::Rendition<'a>>>,
600    ) -> RenditionsBuilder<'a, renditions_state::SetRenditions<S>> {
601        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
602        RenditionsBuilder {
603            _phantom_state: ::core::marker::PhantomData,
604            __unsafe_private_named: self.__unsafe_private_named,
605            _phantom: ::core::marker::PhantomData,
606        }
607    }
608}
609
610impl<'a, S> RenditionsBuilder<'a, S>
611where
612    S: renditions_state::State,
613    S::Renditions: renditions_state::IsSet,
614{
615    /// Build the final struct
616    pub fn build(self) -> Renditions<'a> {
617        Renditions {
618            renditions: self.__unsafe_private_named.0.unwrap(),
619            extra_data: Default::default(),
620        }
621    }
622    /// Build the final struct with custom extra_data
623    pub fn build_with_data(
624        self,
625        extra_data: std::collections::BTreeMap<
626            jacquard_common::smol_str::SmolStr,
627            jacquard_common::types::value::Data<'a>,
628        >,
629    ) -> Renditions<'a> {
630        Renditions {
631            renditions: self.__unsafe_private_named.0.unwrap(),
632            extra_data: Some(extra_data),
633        }
634    }
635}
636
637impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Renditions<'a> {
638    fn nsid() -> &'static str {
639        "place.stream.defs"
640    }
641    fn def_name() -> &'static str {
642        "renditions"
643    }
644    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
645        lexicon_doc_place_stream_defs()
646    }
647    fn validate(
648        &self,
649    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
650        Ok(())
651    }
652}