Skip to main content

jacquard_api/network_slices/
waitlist.rs

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