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