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