Skip to main content

jacquard_api/com_atproto/
server.rs

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