pub mod delete_account;
pub mod disable_account_invites;
pub mod disable_invite_codes;
pub mod enable_account_invites;
pub mod get_account_info;
pub mod get_account_infos;
pub mod get_invite_codes;
pub mod get_subject_status;
pub mod search_accounts;
pub mod send_email;
pub mod update_account_email;
pub mod update_account_handle;
pub mod update_account_password;
pub mod update_account_signing_key;
pub mod update_subject_status;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{AtUri, Cid, Datetime, Did, Handle};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::com_atproto::admin;
use crate::com_atproto::server::InviteCode;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct AccountView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub deactivated_at: Option<Datetime>,
pub did: Did<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub email_confirmed_at: Option<Datetime>,
pub handle: Handle<S>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub invite_note: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invited_by: Option<InviteCode<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invites: Option<Vec<InviteCode<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invites_disabled: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub related_records: Option<Vec<Data<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub threat_signatures: Option<Vec<admin::ThreatSignature<S>>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct RepoBlobRef<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
pub did: Did<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub record_uri: Option<AtUri<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct RepoRef<S: BosStr = DefaultStr> {
pub did: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct StatusAttr<S: BosStr = DefaultStr> {
pub applied: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub r#ref: Option<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ThreatSignature<S: BosStr = DefaultStr> {
pub property: S,
pub value: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for AccountView<S> {
fn nsid() -> &'static str {
"com.atproto.admin.defs"
}
fn def_name() -> &'static str {
"accountView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_com_atproto_admin_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for RepoBlobRef<S> {
fn nsid() -> &'static str {
"com.atproto.admin.defs"
}
fn def_name() -> &'static str {
"repoBlobRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_com_atproto_admin_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for RepoRef<S> {
fn nsid() -> &'static str {
"com.atproto.admin.defs"
}
fn def_name() -> &'static str {
"repoRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_com_atproto_admin_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for StatusAttr<S> {
fn nsid() -> &'static str {
"com.atproto.admin.defs"
}
fn def_name() -> &'static str {
"statusAttr"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_com_atproto_admin_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ThreatSignature<S> {
fn nsid() -> &'static str {
"com.atproto.admin.defs"
}
fn def_name() -> &'static str {
"threatSignature"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_com_atproto_admin_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod account_view_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Handle;
type IndexedAt;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Handle = Unset;
type IndexedAt = Unset;
type Did = Unset;
}
pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetHandle<St> {}
impl<St: State> State for SetHandle<St> {
type Handle = Set<members::handle>;
type IndexedAt = St::IndexedAt;
type Did = St::Did;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Handle = St::Handle;
type IndexedAt = Set<members::indexed_at>;
type Did = St::Did;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Handle = St::Handle;
type IndexedAt = St::IndexedAt;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct handle(());
pub struct indexed_at(());
pub struct did(());
}
}
pub struct AccountViewBuilder<S: BosStr, St: account_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Datetime>,
Option<Did<S>>,
Option<S>,
Option<Datetime>,
Option<Handle<S>>,
Option<Datetime>,
Option<S>,
Option<InviteCode<S>>,
Option<Vec<InviteCode<S>>>,
Option<bool>,
Option<Vec<Data<S>>>,
Option<Vec<admin::ThreatSignature<S>>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> AccountView<S> {
pub fn new() -> AccountViewBuilder<S, account_view_state::Empty> {
AccountViewBuilder::new()
}
}
impl<S: BosStr> AccountViewBuilder<S, account_view_state::Empty> {
pub fn new() -> Self {
AccountViewBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn deactivated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_deactivated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> AccountViewBuilder<S, St>
where
St: account_view_state::State,
St::Did: account_view_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> AccountViewBuilder<S, account_view_state::SetDid<St>> {
self._fields.1 = Option::Some(value.into());
AccountViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn email(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_email(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn email_confirmed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_email_confirmed_at(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> AccountViewBuilder<S, St>
where
St: account_view_state::State,
St::Handle: account_view_state::IsUnset,
{
pub fn handle(
mut self,
value: impl Into<Handle<S>>,
) -> AccountViewBuilder<S, account_view_state::SetHandle<St>> {
self._fields.4 = Option::Some(value.into());
AccountViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AccountViewBuilder<S, St>
where
St: account_view_state::State,
St::IndexedAt: account_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> AccountViewBuilder<S, account_view_state::SetIndexedAt<St>> {
self._fields.5 = Option::Some(value.into());
AccountViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn invite_note(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_invite_note(mut self, value: Option<S>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn invited_by(mut self, value: impl Into<Option<InviteCode<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_invited_by(mut self, value: Option<InviteCode<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn invites(mut self, value: impl Into<Option<Vec<InviteCode<S>>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_invites(mut self, value: Option<Vec<InviteCode<S>>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn invites_disabled(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_invites_disabled(mut self, value: Option<bool>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn related_records(mut self, value: impl Into<Option<Vec<Data<S>>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_related_records(mut self, value: Option<Vec<Data<S>>>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St: account_view_state::State> AccountViewBuilder<S, St> {
pub fn threat_signatures(
mut self,
value: impl Into<Option<Vec<admin::ThreatSignature<S>>>>,
) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_threat_signatures(
mut self,
value: Option<Vec<admin::ThreatSignature<S>>>,
) -> Self {
self._fields.11 = value;
self
}
}
impl<S: BosStr, St> AccountViewBuilder<S, St>
where
St: account_view_state::State,
St::Handle: account_view_state::IsSet,
St::IndexedAt: account_view_state::IsSet,
St::Did: account_view_state::IsSet,
{
pub fn build(self) -> AccountView<S> {
AccountView {
deactivated_at: self._fields.0,
did: self._fields.1.unwrap(),
email: self._fields.2,
email_confirmed_at: self._fields.3,
handle: self._fields.4.unwrap(),
indexed_at: self._fields.5.unwrap(),
invite_note: self._fields.6,
invited_by: self._fields.7,
invites: self._fields.8,
invites_disabled: self._fields.9,
related_records: self._fields.10,
threat_signatures: self._fields.11,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> AccountView<S> {
AccountView {
deactivated_at: self._fields.0,
did: self._fields.1.unwrap(),
email: self._fields.2,
email_confirmed_at: self._fields.3,
handle: self._fields.4.unwrap(),
indexed_at: self._fields.5.unwrap(),
invite_note: self._fields.6,
invited_by: self._fields.7,
invites: self._fields.8,
invites_disabled: self._fields.9,
related_records: self._fields.10,
threat_signatures: self._fields.11,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("com.atproto.admin.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("accountView"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("did"),
SmolStr::new_static("handle"),
SmolStr::new_static("indexedAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("deactivatedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("email"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("emailConfirmedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("handle"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Handle),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("inviteNote"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("invitedBy"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.server.defs#inviteCode"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("invites"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.server.defs#inviteCode"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("invitesDisabled"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("relatedRecords"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Unknown(LexUnknown {
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("threatSignatures"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#threatSignature"),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repoBlobRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("did"), SmolStr::new_static("cid")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("recordUri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repoRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("did")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("statusAttr"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("applied")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("applied"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("ref"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("threatSignature"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("property"),
SmolStr::new_static("value"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("property"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod repo_blob_ref_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Did;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
type Cid = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
type Cid = St::Cid;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Did = St::Did;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
pub struct cid(());
}
}
pub struct RepoBlobRefBuilder<S: BosStr, St: repo_blob_ref_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Cid<S>>, Option<Did<S>>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> RepoBlobRef<S> {
pub fn new() -> RepoBlobRefBuilder<S, repo_blob_ref_state::Empty> {
RepoBlobRefBuilder::new()
}
}
impl<S: BosStr> RepoBlobRefBuilder<S, repo_blob_ref_state::Empty> {
pub fn new() -> Self {
RepoBlobRefBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RepoBlobRefBuilder<S, St>
where
St: repo_blob_ref_state::State,
St::Cid: repo_blob_ref_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> RepoBlobRefBuilder<S, repo_blob_ref_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
RepoBlobRefBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RepoBlobRefBuilder<S, St>
where
St: repo_blob_ref_state::State,
St::Did: repo_blob_ref_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> RepoBlobRefBuilder<S, repo_blob_ref_state::SetDid<St>> {
self._fields.1 = Option::Some(value.into());
RepoBlobRefBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: repo_blob_ref_state::State> RepoBlobRefBuilder<S, St> {
pub fn record_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_record_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> RepoBlobRefBuilder<S, St>
where
St: repo_blob_ref_state::State,
St::Did: repo_blob_ref_state::IsSet,
St::Cid: repo_blob_ref_state::IsSet,
{
pub fn build(self) -> RepoBlobRef<S> {
RepoBlobRef {
cid: self._fields.0.unwrap(),
did: self._fields.1.unwrap(),
record_uri: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> RepoBlobRef<S> {
RepoBlobRef {
cid: self._fields.0.unwrap(),
did: self._fields.1.unwrap(),
record_uri: self._fields.2,
extra_data: Some(extra_data),
}
}
}
pub mod repo_ref_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
}
}
pub struct RepoRefBuilder<S: BosStr, St: repo_ref_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> RepoRef<S> {
pub fn new() -> RepoRefBuilder<S, repo_ref_state::Empty> {
RepoRefBuilder::new()
}
}
impl<S: BosStr> RepoRefBuilder<S, repo_ref_state::Empty> {
pub fn new() -> Self {
RepoRefBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RepoRefBuilder<S, St>
where
St: repo_ref_state::State,
St::Did: repo_ref_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> RepoRefBuilder<S, repo_ref_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
RepoRefBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RepoRefBuilder<S, St>
where
St: repo_ref_state::State,
St::Did: repo_ref_state::IsSet,
{
pub fn build(self) -> RepoRef<S> {
RepoRef {
did: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> RepoRef<S> {
RepoRef {
did: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod status_attr_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Applied;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Applied = Unset;
}
pub struct SetApplied<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetApplied<St> {}
impl<St: State> State for SetApplied<St> {
type Applied = Set<members::applied>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct applied(());
}
}
pub struct StatusAttrBuilder<S: BosStr, St: status_attr_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> StatusAttr<S> {
pub fn new() -> StatusAttrBuilder<S, status_attr_state::Empty> {
StatusAttrBuilder::new()
}
}
impl<S: BosStr> StatusAttrBuilder<S, status_attr_state::Empty> {
pub fn new() -> Self {
StatusAttrBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> StatusAttrBuilder<S, St>
where
St: status_attr_state::State,
St::Applied: status_attr_state::IsUnset,
{
pub fn applied(
mut self,
value: impl Into<bool>,
) -> StatusAttrBuilder<S, status_attr_state::SetApplied<St>> {
self._fields.0 = Option::Some(value.into());
StatusAttrBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: status_attr_state::State> StatusAttrBuilder<S, St> {
pub fn r#ref(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_ref(mut self, value: Option<S>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> StatusAttrBuilder<S, St>
where
St: status_attr_state::State,
St::Applied: status_attr_state::IsSet,
{
pub fn build(self) -> StatusAttr<S> {
StatusAttr {
applied: self._fields.0.unwrap(),
r#ref: self._fields.1,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> StatusAttr<S> {
StatusAttr {
applied: self._fields.0.unwrap(),
r#ref: self._fields.1,
extra_data: Some(extra_data),
}
}
}