1pub mod delete_account;
10pub mod disable_account_invites;
11pub mod disable_invite_codes;
12pub mod enable_account_invites;
13pub mod get_account_info;
14pub mod get_account_infos;
15pub mod get_invite_codes;
16pub mod get_subject_status;
17pub mod search_accounts;
18pub mod send_email;
19pub mod update_account_email;
20pub mod update_account_handle;
21pub mod update_account_password;
22pub mod update_account_signing_key;
23pub mod update_subject_status;
24
25
26#[allow(unused_imports)]
27use alloc::collections::BTreeMap;
28
29#[allow(unused_imports)]
30use core::marker::PhantomData;
31use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
32
33#[allow(unused_imports)]
34use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
35use jacquard_common::deps::smol_str::SmolStr;
36use jacquard_common::types::string::{Did, Handle, AtUri, Cid, Datetime};
37use jacquard_common::types::value::Data;
38use jacquard_derive::IntoStatic;
39use jacquard_lexicon::lexicon::LexiconDoc;
40use jacquard_lexicon::schema::LexiconSchema;
41
42#[allow(unused_imports)]
43use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
44use serde::{Serialize, Deserialize};
45use crate::com_atproto::server::InviteCode;
46use crate::com_atproto::admin;
47
48#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
49#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
50pub struct AccountView<S: BosStr = DefaultStr> {
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub deactivated_at: Option<Datetime>,
53 pub did: Did<S>,
54 #[serde(skip_serializing_if = "Option::is_none")]
55 pub email: Option<S>,
56 #[serde(skip_serializing_if = "Option::is_none")]
57 pub email_confirmed_at: Option<Datetime>,
58 pub handle: Handle<S>,
59 pub indexed_at: Datetime,
60 #[serde(skip_serializing_if = "Option::is_none")]
61 pub invite_note: Option<S>,
62 #[serde(skip_serializing_if = "Option::is_none")]
63 pub invited_by: Option<InviteCode<S>>,
64 #[serde(skip_serializing_if = "Option::is_none")]
65 pub invites: Option<Vec<InviteCode<S>>>,
66 #[serde(skip_serializing_if = "Option::is_none")]
67 pub invites_disabled: Option<bool>,
68 #[serde(skip_serializing_if = "Option::is_none")]
69 pub related_records: Option<Vec<Data<S>>>,
70 #[serde(skip_serializing_if = "Option::is_none")]
71 pub threat_signatures: Option<Vec<admin::ThreatSignature<S>>>,
72 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
73 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
74}
75
76
77#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
78#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
79pub struct RepoBlobRef<S: BosStr = DefaultStr> {
80 pub cid: Cid<S>,
81 pub did: Did<S>,
82 #[serde(skip_serializing_if = "Option::is_none")]
83 pub record_uri: Option<AtUri<S>>,
84 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
85 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
86}
87
88
89#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
90#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
91pub struct RepoRef<S: BosStr = DefaultStr> {
92 pub did: Did<S>,
93 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
94 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
95}
96
97
98#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
99#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
100pub struct StatusAttr<S: BosStr = DefaultStr> {
101 pub applied: bool,
102 #[serde(skip_serializing_if = "Option::is_none")]
103 pub r#ref: Option<S>,
104 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
105 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
106}
107
108
109#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
110#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
111pub struct ThreatSignature<S: BosStr = DefaultStr> {
112 pub property: S,
113 pub value: S,
114 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
115 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
116}
117
118impl<S: BosStr> LexiconSchema for AccountView<S> {
119 fn nsid() -> &'static str {
120 "com.atproto.admin.defs"
121 }
122 fn def_name() -> &'static str {
123 "accountView"
124 }
125 fn lexicon_doc() -> LexiconDoc<'static> {
126 lexicon_doc_com_atproto_admin_defs()
127 }
128 fn validate(&self) -> Result<(), ConstraintError> {
129 Ok(())
130 }
131}
132
133impl<S: BosStr> LexiconSchema for RepoBlobRef<S> {
134 fn nsid() -> &'static str {
135 "com.atproto.admin.defs"
136 }
137 fn def_name() -> &'static str {
138 "repoBlobRef"
139 }
140 fn lexicon_doc() -> LexiconDoc<'static> {
141 lexicon_doc_com_atproto_admin_defs()
142 }
143 fn validate(&self) -> Result<(), ConstraintError> {
144 Ok(())
145 }
146}
147
148impl<S: BosStr> LexiconSchema for RepoRef<S> {
149 fn nsid() -> &'static str {
150 "com.atproto.admin.defs"
151 }
152 fn def_name() -> &'static str {
153 "repoRef"
154 }
155 fn lexicon_doc() -> LexiconDoc<'static> {
156 lexicon_doc_com_atproto_admin_defs()
157 }
158 fn validate(&self) -> Result<(), ConstraintError> {
159 Ok(())
160 }
161}
162
163impl<S: BosStr> LexiconSchema for StatusAttr<S> {
164 fn nsid() -> &'static str {
165 "com.atproto.admin.defs"
166 }
167 fn def_name() -> &'static str {
168 "statusAttr"
169 }
170 fn lexicon_doc() -> LexiconDoc<'static> {
171 lexicon_doc_com_atproto_admin_defs()
172 }
173 fn validate(&self) -> Result<(), ConstraintError> {
174 Ok(())
175 }
176}
177
178impl<S: BosStr> LexiconSchema for ThreatSignature<S> {
179 fn nsid() -> &'static str {
180 "com.atproto.admin.defs"
181 }
182 fn def_name() -> &'static str {
183 "threatSignature"
184 }
185 fn lexicon_doc() -> LexiconDoc<'static> {
186 lexicon_doc_com_atproto_admin_defs()
187 }
188 fn validate(&self) -> Result<(), ConstraintError> {
189 Ok(())
190 }
191}
192
193pub mod account_view_state {
194
195 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
196 #[allow(unused)]
197 use ::core::marker::PhantomData;
198 mod sealed {
199 pub trait Sealed {}
200 }
201 pub trait State: sealed::Sealed {
203 type Did;
204 type Handle;
205 type IndexedAt;
206 }
207 pub struct Empty(());
209 impl sealed::Sealed for Empty {}
210 impl State for Empty {
211 type Did = Unset;
212 type Handle = Unset;
213 type IndexedAt = Unset;
214 }
215 pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
217 impl<St: State> sealed::Sealed for SetDid<St> {}
218 impl<St: State> State for SetDid<St> {
219 type Did = Set<members::did>;
220 type Handle = St::Handle;
221 type IndexedAt = St::IndexedAt;
222 }
223 pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
225 impl<St: State> sealed::Sealed for SetHandle<St> {}
226 impl<St: State> State for SetHandle<St> {
227 type Did = St::Did;
228 type Handle = Set<members::handle>;
229 type IndexedAt = St::IndexedAt;
230 }
231 pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
233 impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
234 impl<St: State> State for SetIndexedAt<St> {
235 type Did = St::Did;
236 type Handle = St::Handle;
237 type IndexedAt = Set<members::indexed_at>;
238 }
239 #[allow(non_camel_case_types)]
241 pub mod members {
242 pub struct did(());
244 pub struct handle(());
246 pub struct indexed_at(());
248 }
249}
250
251pub struct AccountViewBuilder<St: account_view_state::State, S: BosStr = DefaultStr> {
253 _state: PhantomData<fn() -> St>,
254 _fields: (
255 Option<Datetime>,
256 Option<Did<S>>,
257 Option<S>,
258 Option<Datetime>,
259 Option<Handle<S>>,
260 Option<Datetime>,
261 Option<S>,
262 Option<InviteCode<S>>,
263 Option<Vec<InviteCode<S>>>,
264 Option<bool>,
265 Option<Vec<Data<S>>>,
266 Option<Vec<admin::ThreatSignature<S>>>,
267 ),
268 _type: PhantomData<fn() -> S>,
269}
270
271impl AccountView<DefaultStr> {
272 pub fn new() -> AccountViewBuilder<account_view_state::Empty, DefaultStr> {
274 AccountViewBuilder::new()
275 }
276}
277
278impl<S: BosStr> AccountView<S> {
279 pub fn builder() -> AccountViewBuilder<account_view_state::Empty, S> {
281 AccountViewBuilder::builder()
282 }
283}
284
285impl AccountViewBuilder<account_view_state::Empty, DefaultStr> {
286 pub fn new() -> Self {
288 AccountViewBuilder {
289 _state: PhantomData,
290 _fields: (
291 None,
292 None,
293 None,
294 None,
295 None,
296 None,
297 None,
298 None,
299 None,
300 None,
301 None,
302 None,
303 ),
304 _type: PhantomData,
305 }
306 }
307}
308
309impl<S: BosStr> AccountViewBuilder<account_view_state::Empty, S> {
310 pub fn builder() -> Self {
312 AccountViewBuilder {
313 _state: PhantomData,
314 _fields: (
315 None,
316 None,
317 None,
318 None,
319 None,
320 None,
321 None,
322 None,
323 None,
324 None,
325 None,
326 None,
327 ),
328 _type: PhantomData,
329 }
330 }
331}
332
333impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
334 pub fn deactivated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
336 self._fields.0 = value.into();
337 self
338 }
339 pub fn maybe_deactivated_at(mut self, value: Option<Datetime>) -> Self {
341 self._fields.0 = value;
342 self
343 }
344}
345
346impl<St, S: BosStr> AccountViewBuilder<St, S>
347where
348 St: account_view_state::State,
349 St::Did: account_view_state::IsUnset,
350{
351 pub fn did(
353 mut self,
354 value: impl Into<Did<S>>,
355 ) -> AccountViewBuilder<account_view_state::SetDid<St>, S> {
356 self._fields.1 = Option::Some(value.into());
357 AccountViewBuilder {
358 _state: PhantomData,
359 _fields: self._fields,
360 _type: PhantomData,
361 }
362 }
363}
364
365impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
366 pub fn email(mut self, value: impl Into<Option<S>>) -> Self {
368 self._fields.2 = value.into();
369 self
370 }
371 pub fn maybe_email(mut self, value: Option<S>) -> Self {
373 self._fields.2 = value;
374 self
375 }
376}
377
378impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
379 pub fn email_confirmed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
381 self._fields.3 = value.into();
382 self
383 }
384 pub fn maybe_email_confirmed_at(mut self, value: Option<Datetime>) -> Self {
386 self._fields.3 = value;
387 self
388 }
389}
390
391impl<St, S: BosStr> AccountViewBuilder<St, S>
392where
393 St: account_view_state::State,
394 St::Handle: account_view_state::IsUnset,
395{
396 pub fn handle(
398 mut self,
399 value: impl Into<Handle<S>>,
400 ) -> AccountViewBuilder<account_view_state::SetHandle<St>, S> {
401 self._fields.4 = Option::Some(value.into());
402 AccountViewBuilder {
403 _state: PhantomData,
404 _fields: self._fields,
405 _type: PhantomData,
406 }
407 }
408}
409
410impl<St, S: BosStr> AccountViewBuilder<St, S>
411where
412 St: account_view_state::State,
413 St::IndexedAt: account_view_state::IsUnset,
414{
415 pub fn indexed_at(
417 mut self,
418 value: impl Into<Datetime>,
419 ) -> AccountViewBuilder<account_view_state::SetIndexedAt<St>, S> {
420 self._fields.5 = Option::Some(value.into());
421 AccountViewBuilder {
422 _state: PhantomData,
423 _fields: self._fields,
424 _type: PhantomData,
425 }
426 }
427}
428
429impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
430 pub fn invite_note(mut self, value: impl Into<Option<S>>) -> Self {
432 self._fields.6 = value.into();
433 self
434 }
435 pub fn maybe_invite_note(mut self, value: Option<S>) -> Self {
437 self._fields.6 = value;
438 self
439 }
440}
441
442impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
443 pub fn invited_by(mut self, value: impl Into<Option<InviteCode<S>>>) -> Self {
445 self._fields.7 = value.into();
446 self
447 }
448 pub fn maybe_invited_by(mut self, value: Option<InviteCode<S>>) -> Self {
450 self._fields.7 = value;
451 self
452 }
453}
454
455impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
456 pub fn invites(mut self, value: impl Into<Option<Vec<InviteCode<S>>>>) -> Self {
458 self._fields.8 = value.into();
459 self
460 }
461 pub fn maybe_invites(mut self, value: Option<Vec<InviteCode<S>>>) -> Self {
463 self._fields.8 = value;
464 self
465 }
466}
467
468impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
469 pub fn invites_disabled(mut self, value: impl Into<Option<bool>>) -> Self {
471 self._fields.9 = value.into();
472 self
473 }
474 pub fn maybe_invites_disabled(mut self, value: Option<bool>) -> Self {
476 self._fields.9 = value;
477 self
478 }
479}
480
481impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
482 pub fn related_records(mut self, value: impl Into<Option<Vec<Data<S>>>>) -> Self {
484 self._fields.10 = value.into();
485 self
486 }
487 pub fn maybe_related_records(mut self, value: Option<Vec<Data<S>>>) -> Self {
489 self._fields.10 = value;
490 self
491 }
492}
493
494impl<St: account_view_state::State, S: BosStr> AccountViewBuilder<St, S> {
495 pub fn threat_signatures(
497 mut self,
498 value: impl Into<Option<Vec<admin::ThreatSignature<S>>>>,
499 ) -> Self {
500 self._fields.11 = value.into();
501 self
502 }
503 pub fn maybe_threat_signatures(
505 mut self,
506 value: Option<Vec<admin::ThreatSignature<S>>>,
507 ) -> Self {
508 self._fields.11 = value;
509 self
510 }
511}
512
513impl<St, S: BosStr> AccountViewBuilder<St, S>
514where
515 St: account_view_state::State,
516 St::Did: account_view_state::IsSet,
517 St::Handle: account_view_state::IsSet,
518 St::IndexedAt: account_view_state::IsSet,
519{
520 pub fn build(self) -> AccountView<S> {
522 AccountView {
523 deactivated_at: self._fields.0,
524 did: self._fields.1.unwrap(),
525 email: self._fields.2,
526 email_confirmed_at: self._fields.3,
527 handle: self._fields.4.unwrap(),
528 indexed_at: self._fields.5.unwrap(),
529 invite_note: self._fields.6,
530 invited_by: self._fields.7,
531 invites: self._fields.8,
532 invites_disabled: self._fields.9,
533 related_records: self._fields.10,
534 threat_signatures: self._fields.11,
535 extra_data: Default::default(),
536 }
537 }
538 pub fn build_with_data(
540 self,
541 extra_data: BTreeMap<SmolStr, Data<S>>,
542 ) -> AccountView<S> {
543 AccountView {
544 deactivated_at: self._fields.0,
545 did: self._fields.1.unwrap(),
546 email: self._fields.2,
547 email_confirmed_at: self._fields.3,
548 handle: self._fields.4.unwrap(),
549 indexed_at: self._fields.5.unwrap(),
550 invite_note: self._fields.6,
551 invited_by: self._fields.7,
552 invites: self._fields.8,
553 invites_disabled: self._fields.9,
554 related_records: self._fields.10,
555 threat_signatures: self._fields.11,
556 extra_data: Some(extra_data),
557 }
558 }
559}
560
561fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> {
562 #[allow(unused_imports)]
563 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
564 use jacquard_lexicon::lexicon::*;
565 use alloc::collections::BTreeMap;
566 LexiconDoc {
567 lexicon: Lexicon::Lexicon1,
568 id: CowStr::new_static("com.atproto.admin.defs"),
569 defs: {
570 let mut map = BTreeMap::new();
571 map.insert(
572 SmolStr::new_static("accountView"),
573 LexUserType::Object(LexObject {
574 required: Some(
575 vec![
576 SmolStr::new_static("did"), SmolStr::new_static("handle"),
577 SmolStr::new_static("indexedAt")
578 ],
579 ),
580 properties: {
581 #[allow(unused_mut)]
582 let mut map = BTreeMap::new();
583 map.insert(
584 SmolStr::new_static("deactivatedAt"),
585 LexObjectProperty::String(LexString {
586 format: Some(LexStringFormat::Datetime),
587 ..Default::default()
588 }),
589 );
590 map.insert(
591 SmolStr::new_static("did"),
592 LexObjectProperty::String(LexString {
593 format: Some(LexStringFormat::Did),
594 ..Default::default()
595 }),
596 );
597 map.insert(
598 SmolStr::new_static("email"),
599 LexObjectProperty::String(LexString { ..Default::default() }),
600 );
601 map.insert(
602 SmolStr::new_static("emailConfirmedAt"),
603 LexObjectProperty::String(LexString {
604 format: Some(LexStringFormat::Datetime),
605 ..Default::default()
606 }),
607 );
608 map.insert(
609 SmolStr::new_static("handle"),
610 LexObjectProperty::String(LexString {
611 format: Some(LexStringFormat::Handle),
612 ..Default::default()
613 }),
614 );
615 map.insert(
616 SmolStr::new_static("indexedAt"),
617 LexObjectProperty::String(LexString {
618 format: Some(LexStringFormat::Datetime),
619 ..Default::default()
620 }),
621 );
622 map.insert(
623 SmolStr::new_static("inviteNote"),
624 LexObjectProperty::String(LexString { ..Default::default() }),
625 );
626 map.insert(
627 SmolStr::new_static("invitedBy"),
628 LexObjectProperty::Ref(LexRef {
629 r#ref: CowStr::new_static(
630 "com.atproto.server.defs#inviteCode",
631 ),
632 ..Default::default()
633 }),
634 );
635 map.insert(
636 SmolStr::new_static("invites"),
637 LexObjectProperty::Array(LexArray {
638 items: LexArrayItem::Ref(LexRef {
639 r#ref: CowStr::new_static(
640 "com.atproto.server.defs#inviteCode",
641 ),
642 ..Default::default()
643 }),
644 ..Default::default()
645 }),
646 );
647 map.insert(
648 SmolStr::new_static("invitesDisabled"),
649 LexObjectProperty::Boolean(LexBoolean {
650 ..Default::default()
651 }),
652 );
653 map.insert(
654 SmolStr::new_static("relatedRecords"),
655 LexObjectProperty::Array(LexArray {
656 items: LexArrayItem::Unknown(LexUnknown {
657 ..Default::default()
658 }),
659 ..Default::default()
660 }),
661 );
662 map.insert(
663 SmolStr::new_static("threatSignatures"),
664 LexObjectProperty::Array(LexArray {
665 items: LexArrayItem::Ref(LexRef {
666 r#ref: CowStr::new_static("#threatSignature"),
667 ..Default::default()
668 }),
669 ..Default::default()
670 }),
671 );
672 map
673 },
674 ..Default::default()
675 }),
676 );
677 map.insert(
678 SmolStr::new_static("repoBlobRef"),
679 LexUserType::Object(LexObject {
680 required: Some(
681 vec![SmolStr::new_static("did"), SmolStr::new_static("cid")],
682 ),
683 properties: {
684 #[allow(unused_mut)]
685 let mut map = BTreeMap::new();
686 map.insert(
687 SmolStr::new_static("cid"),
688 LexObjectProperty::String(LexString {
689 format: Some(LexStringFormat::Cid),
690 ..Default::default()
691 }),
692 );
693 map.insert(
694 SmolStr::new_static("did"),
695 LexObjectProperty::String(LexString {
696 format: Some(LexStringFormat::Did),
697 ..Default::default()
698 }),
699 );
700 map.insert(
701 SmolStr::new_static("recordUri"),
702 LexObjectProperty::String(LexString {
703 format: Some(LexStringFormat::AtUri),
704 ..Default::default()
705 }),
706 );
707 map
708 },
709 ..Default::default()
710 }),
711 );
712 map.insert(
713 SmolStr::new_static("repoRef"),
714 LexUserType::Object(LexObject {
715 required: Some(vec![SmolStr::new_static("did")]),
716 properties: {
717 #[allow(unused_mut)]
718 let mut map = BTreeMap::new();
719 map.insert(
720 SmolStr::new_static("did"),
721 LexObjectProperty::String(LexString {
722 format: Some(LexStringFormat::Did),
723 ..Default::default()
724 }),
725 );
726 map
727 },
728 ..Default::default()
729 }),
730 );
731 map.insert(
732 SmolStr::new_static("statusAttr"),
733 LexUserType::Object(LexObject {
734 required: Some(vec![SmolStr::new_static("applied")]),
735 properties: {
736 #[allow(unused_mut)]
737 let mut map = BTreeMap::new();
738 map.insert(
739 SmolStr::new_static("applied"),
740 LexObjectProperty::Boolean(LexBoolean {
741 ..Default::default()
742 }),
743 );
744 map.insert(
745 SmolStr::new_static("ref"),
746 LexObjectProperty::String(LexString { ..Default::default() }),
747 );
748 map
749 },
750 ..Default::default()
751 }),
752 );
753 map.insert(
754 SmolStr::new_static("threatSignature"),
755 LexUserType::Object(LexObject {
756 required: Some(
757 vec![
758 SmolStr::new_static("property"), SmolStr::new_static("value")
759 ],
760 ),
761 properties: {
762 #[allow(unused_mut)]
763 let mut map = BTreeMap::new();
764 map.insert(
765 SmolStr::new_static("property"),
766 LexObjectProperty::String(LexString { ..Default::default() }),
767 );
768 map.insert(
769 SmolStr::new_static("value"),
770 LexObjectProperty::String(LexString { ..Default::default() }),
771 );
772 map
773 },
774 ..Default::default()
775 }),
776 );
777 map
778 },
779 ..Default::default()
780 }
781}
782
783pub mod repo_blob_ref_state {
784
785 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
786 #[allow(unused)]
787 use ::core::marker::PhantomData;
788 mod sealed {
789 pub trait Sealed {}
790 }
791 pub trait State: sealed::Sealed {
793 type Cid;
794 type Did;
795 }
796 pub struct Empty(());
798 impl sealed::Sealed for Empty {}
799 impl State for Empty {
800 type Cid = Unset;
801 type Did = Unset;
802 }
803 pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
805 impl<St: State> sealed::Sealed for SetCid<St> {}
806 impl<St: State> State for SetCid<St> {
807 type Cid = Set<members::cid>;
808 type Did = St::Did;
809 }
810 pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
812 impl<St: State> sealed::Sealed for SetDid<St> {}
813 impl<St: State> State for SetDid<St> {
814 type Cid = St::Cid;
815 type Did = Set<members::did>;
816 }
817 #[allow(non_camel_case_types)]
819 pub mod members {
820 pub struct cid(());
822 pub struct did(());
824 }
825}
826
827pub struct RepoBlobRefBuilder<St: repo_blob_ref_state::State, S: BosStr = DefaultStr> {
829 _state: PhantomData<fn() -> St>,
830 _fields: (Option<Cid<S>>, Option<Did<S>>, Option<AtUri<S>>),
831 _type: PhantomData<fn() -> S>,
832}
833
834impl RepoBlobRef<DefaultStr> {
835 pub fn new() -> RepoBlobRefBuilder<repo_blob_ref_state::Empty, DefaultStr> {
837 RepoBlobRefBuilder::new()
838 }
839}
840
841impl<S: BosStr> RepoBlobRef<S> {
842 pub fn builder() -> RepoBlobRefBuilder<repo_blob_ref_state::Empty, S> {
844 RepoBlobRefBuilder::builder()
845 }
846}
847
848impl RepoBlobRefBuilder<repo_blob_ref_state::Empty, DefaultStr> {
849 pub fn new() -> Self {
851 RepoBlobRefBuilder {
852 _state: PhantomData,
853 _fields: (None, None, None),
854 _type: PhantomData,
855 }
856 }
857}
858
859impl<S: BosStr> RepoBlobRefBuilder<repo_blob_ref_state::Empty, S> {
860 pub fn builder() -> Self {
862 RepoBlobRefBuilder {
863 _state: PhantomData,
864 _fields: (None, None, None),
865 _type: PhantomData,
866 }
867 }
868}
869
870impl<St, S: BosStr> RepoBlobRefBuilder<St, S>
871where
872 St: repo_blob_ref_state::State,
873 St::Cid: repo_blob_ref_state::IsUnset,
874{
875 pub fn cid(
877 mut self,
878 value: impl Into<Cid<S>>,
879 ) -> RepoBlobRefBuilder<repo_blob_ref_state::SetCid<St>, S> {
880 self._fields.0 = Option::Some(value.into());
881 RepoBlobRefBuilder {
882 _state: PhantomData,
883 _fields: self._fields,
884 _type: PhantomData,
885 }
886 }
887}
888
889impl<St, S: BosStr> RepoBlobRefBuilder<St, S>
890where
891 St: repo_blob_ref_state::State,
892 St::Did: repo_blob_ref_state::IsUnset,
893{
894 pub fn did(
896 mut self,
897 value: impl Into<Did<S>>,
898 ) -> RepoBlobRefBuilder<repo_blob_ref_state::SetDid<St>, S> {
899 self._fields.1 = Option::Some(value.into());
900 RepoBlobRefBuilder {
901 _state: PhantomData,
902 _fields: self._fields,
903 _type: PhantomData,
904 }
905 }
906}
907
908impl<St: repo_blob_ref_state::State, S: BosStr> RepoBlobRefBuilder<St, S> {
909 pub fn record_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
911 self._fields.2 = value.into();
912 self
913 }
914 pub fn maybe_record_uri(mut self, value: Option<AtUri<S>>) -> Self {
916 self._fields.2 = value;
917 self
918 }
919}
920
921impl<St, S: BosStr> RepoBlobRefBuilder<St, S>
922where
923 St: repo_blob_ref_state::State,
924 St::Cid: repo_blob_ref_state::IsSet,
925 St::Did: repo_blob_ref_state::IsSet,
926{
927 pub fn build(self) -> RepoBlobRef<S> {
929 RepoBlobRef {
930 cid: self._fields.0.unwrap(),
931 did: self._fields.1.unwrap(),
932 record_uri: self._fields.2,
933 extra_data: Default::default(),
934 }
935 }
936 pub fn build_with_data(
938 self,
939 extra_data: BTreeMap<SmolStr, Data<S>>,
940 ) -> RepoBlobRef<S> {
941 RepoBlobRef {
942 cid: self._fields.0.unwrap(),
943 did: self._fields.1.unwrap(),
944 record_uri: self._fields.2,
945 extra_data: Some(extra_data),
946 }
947 }
948}
949
950pub mod repo_ref_state {
951
952 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
953 #[allow(unused)]
954 use ::core::marker::PhantomData;
955 mod sealed {
956 pub trait Sealed {}
957 }
958 pub trait State: sealed::Sealed {
960 type Did;
961 }
962 pub struct Empty(());
964 impl sealed::Sealed for Empty {}
965 impl State for Empty {
966 type Did = Unset;
967 }
968 pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
970 impl<St: State> sealed::Sealed for SetDid<St> {}
971 impl<St: State> State for SetDid<St> {
972 type Did = Set<members::did>;
973 }
974 #[allow(non_camel_case_types)]
976 pub mod members {
977 pub struct did(());
979 }
980}
981
982pub struct RepoRefBuilder<St: repo_ref_state::State, S: BosStr = DefaultStr> {
984 _state: PhantomData<fn() -> St>,
985 _fields: (Option<Did<S>>,),
986 _type: PhantomData<fn() -> S>,
987}
988
989impl RepoRef<DefaultStr> {
990 pub fn new() -> RepoRefBuilder<repo_ref_state::Empty, DefaultStr> {
992 RepoRefBuilder::new()
993 }
994}
995
996impl<S: BosStr> RepoRef<S> {
997 pub fn builder() -> RepoRefBuilder<repo_ref_state::Empty, S> {
999 RepoRefBuilder::builder()
1000 }
1001}
1002
1003impl RepoRefBuilder<repo_ref_state::Empty, DefaultStr> {
1004 pub fn new() -> Self {
1006 RepoRefBuilder {
1007 _state: PhantomData,
1008 _fields: (None,),
1009 _type: PhantomData,
1010 }
1011 }
1012}
1013
1014impl<S: BosStr> RepoRefBuilder<repo_ref_state::Empty, S> {
1015 pub fn builder() -> Self {
1017 RepoRefBuilder {
1018 _state: PhantomData,
1019 _fields: (None,),
1020 _type: PhantomData,
1021 }
1022 }
1023}
1024
1025impl<St, S: BosStr> RepoRefBuilder<St, S>
1026where
1027 St: repo_ref_state::State,
1028 St::Did: repo_ref_state::IsUnset,
1029{
1030 pub fn did(
1032 mut self,
1033 value: impl Into<Did<S>>,
1034 ) -> RepoRefBuilder<repo_ref_state::SetDid<St>, S> {
1035 self._fields.0 = Option::Some(value.into());
1036 RepoRefBuilder {
1037 _state: PhantomData,
1038 _fields: self._fields,
1039 _type: PhantomData,
1040 }
1041 }
1042}
1043
1044impl<St, S: BosStr> RepoRefBuilder<St, S>
1045where
1046 St: repo_ref_state::State,
1047 St::Did: repo_ref_state::IsSet,
1048{
1049 pub fn build(self) -> RepoRef<S> {
1051 RepoRef {
1052 did: self._fields.0.unwrap(),
1053 extra_data: Default::default(),
1054 }
1055 }
1056 pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> RepoRef<S> {
1058 RepoRef {
1059 did: self._fields.0.unwrap(),
1060 extra_data: Some(extra_data),
1061 }
1062 }
1063}
1064
1065pub mod status_attr_state {
1066
1067 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1068 #[allow(unused)]
1069 use ::core::marker::PhantomData;
1070 mod sealed {
1071 pub trait Sealed {}
1072 }
1073 pub trait State: sealed::Sealed {
1075 type Applied;
1076 }
1077 pub struct Empty(());
1079 impl sealed::Sealed for Empty {}
1080 impl State for Empty {
1081 type Applied = Unset;
1082 }
1083 pub struct SetApplied<St: State = Empty>(PhantomData<fn() -> St>);
1085 impl<St: State> sealed::Sealed for SetApplied<St> {}
1086 impl<St: State> State for SetApplied<St> {
1087 type Applied = Set<members::applied>;
1088 }
1089 #[allow(non_camel_case_types)]
1091 pub mod members {
1092 pub struct applied(());
1094 }
1095}
1096
1097pub struct StatusAttrBuilder<St: status_attr_state::State, S: BosStr = DefaultStr> {
1099 _state: PhantomData<fn() -> St>,
1100 _fields: (Option<bool>, Option<S>),
1101 _type: PhantomData<fn() -> S>,
1102}
1103
1104impl StatusAttr<DefaultStr> {
1105 pub fn new() -> StatusAttrBuilder<status_attr_state::Empty, DefaultStr> {
1107 StatusAttrBuilder::new()
1108 }
1109}
1110
1111impl<S: BosStr> StatusAttr<S> {
1112 pub fn builder() -> StatusAttrBuilder<status_attr_state::Empty, S> {
1114 StatusAttrBuilder::builder()
1115 }
1116}
1117
1118impl StatusAttrBuilder<status_attr_state::Empty, DefaultStr> {
1119 pub fn new() -> Self {
1121 StatusAttrBuilder {
1122 _state: PhantomData,
1123 _fields: (None, None),
1124 _type: PhantomData,
1125 }
1126 }
1127}
1128
1129impl<S: BosStr> StatusAttrBuilder<status_attr_state::Empty, S> {
1130 pub fn builder() -> Self {
1132 StatusAttrBuilder {
1133 _state: PhantomData,
1134 _fields: (None, None),
1135 _type: PhantomData,
1136 }
1137 }
1138}
1139
1140impl<St, S: BosStr> StatusAttrBuilder<St, S>
1141where
1142 St: status_attr_state::State,
1143 St::Applied: status_attr_state::IsUnset,
1144{
1145 pub fn applied(
1147 mut self,
1148 value: impl Into<bool>,
1149 ) -> StatusAttrBuilder<status_attr_state::SetApplied<St>, S> {
1150 self._fields.0 = Option::Some(value.into());
1151 StatusAttrBuilder {
1152 _state: PhantomData,
1153 _fields: self._fields,
1154 _type: PhantomData,
1155 }
1156 }
1157}
1158
1159impl<St: status_attr_state::State, S: BosStr> StatusAttrBuilder<St, S> {
1160 pub fn r#ref(mut self, value: impl Into<Option<S>>) -> Self {
1162 self._fields.1 = value.into();
1163 self
1164 }
1165 pub fn maybe_ref(mut self, value: Option<S>) -> Self {
1167 self._fields.1 = value;
1168 self
1169 }
1170}
1171
1172impl<St, S: BosStr> StatusAttrBuilder<St, S>
1173where
1174 St: status_attr_state::State,
1175 St::Applied: status_attr_state::IsSet,
1176{
1177 pub fn build(self) -> StatusAttr<S> {
1179 StatusAttr {
1180 applied: self._fields.0.unwrap(),
1181 r#ref: self._fields.1,
1182 extra_data: Default::default(),
1183 }
1184 }
1185 pub fn build_with_data(
1187 self,
1188 extra_data: BTreeMap<SmolStr, Data<S>>,
1189 ) -> StatusAttr<S> {
1190 StatusAttr {
1191 applied: self._fields.0.unwrap(),
1192 r#ref: self._fields.1,
1193 extra_data: Some(extra_data),
1194 }
1195 }
1196}