// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.server.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. //! Generated bindings for the `com.atproto.server` Lexicon namespace/module. pub mod activate_account; pub mod check_account_status; pub mod confirm_email; pub mod create_account; pub mod create_app_password; pub mod create_invite_code; pub mod create_invite_codes; pub mod create_session; pub mod deactivate_account; pub mod delete_account; pub mod delete_session; pub mod describe_server; pub mod get_account_invite_codes; pub mod get_service_auth; pub mod get_session; pub mod list_app_passwords; pub mod refresh_session; pub mod request_account_delete; pub mod request_email_confirmation; pub mod request_email_update; pub mod request_password_reset; pub mod reserve_signing_key; pub mod reset_password; pub mod revoke_app_password; pub mod update_email; #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; use jacquard_common::{CowStr, BosStr, 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::{Did, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; use serde::{Serialize, Deserialize}; use crate::com_atproto::server; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct InviteCode { pub available: i64, pub code: S, pub created_at: Datetime, pub created_by: S, pub disabled: bool, pub for_account: S, pub uses: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct InviteCodeUse { pub used_at: Datetime, pub used_by: Did, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } impl LexiconSchema for InviteCode { fn nsid() -> &'static str { "com.atproto.server.defs" } fn def_name() -> &'static str { "inviteCode" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_server_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for InviteCodeUse { fn nsid() -> &'static str { "com.atproto.server.defs" } fn def_name() -> &'static str { "inviteCodeUse" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_server_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } pub mod invite_code_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Available; type Code; type CreatedAt; type CreatedBy; type Disabled; type ForAccount; type Uses; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Available = Unset; type Code = Unset; type CreatedAt = Unset; type CreatedBy = Unset; type Disabled = Unset; type ForAccount = Unset; type Uses = Unset; } ///State transition - sets the `available` field to Set pub struct SetAvailable(PhantomData St>); impl sealed::Sealed for SetAvailable {} impl State for SetAvailable { type Available = Set; type Code = St::Code; type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Disabled = St::Disabled; type ForAccount = St::ForAccount; type Uses = St::Uses; } ///State transition - sets the `code` field to Set pub struct SetCode(PhantomData St>); impl sealed::Sealed for SetCode {} impl State for SetCode { type Available = St::Available; type Code = Set; type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Disabled = St::Disabled; type ForAccount = St::ForAccount; type Uses = St::Uses; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData St>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Available = St::Available; type Code = St::Code; type CreatedAt = Set; type CreatedBy = St::CreatedBy; type Disabled = St::Disabled; type ForAccount = St::ForAccount; type Uses = St::Uses; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData St>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { type Available = St::Available; type Code = St::Code; type CreatedAt = St::CreatedAt; type CreatedBy = Set; type Disabled = St::Disabled; type ForAccount = St::ForAccount; type Uses = St::Uses; } ///State transition - sets the `disabled` field to Set pub struct SetDisabled(PhantomData St>); impl sealed::Sealed for SetDisabled {} impl State for SetDisabled { type Available = St::Available; type Code = St::Code; type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Disabled = Set; type ForAccount = St::ForAccount; type Uses = St::Uses; } ///State transition - sets the `for_account` field to Set pub struct SetForAccount(PhantomData St>); impl sealed::Sealed for SetForAccount {} impl State for SetForAccount { type Available = St::Available; type Code = St::Code; type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Disabled = St::Disabled; type ForAccount = Set; type Uses = St::Uses; } ///State transition - sets the `uses` field to Set pub struct SetUses(PhantomData St>); impl sealed::Sealed for SetUses {} impl State for SetUses { type Available = St::Available; type Code = St::Code; type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Disabled = St::Disabled; type ForAccount = St::ForAccount; type Uses = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `available` field pub struct available(()); ///Marker type for the `code` field pub struct code(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `disabled` field pub struct disabled(()); ///Marker type for the `for_account` field pub struct for_account(()); ///Marker type for the `uses` field pub struct uses(()); } } /// Builder for constructing an instance of this type. pub struct InviteCodeBuilder { _state: PhantomData St>, _fields: ( Option, Option, Option, Option, Option, Option, Option>>, ), _type: PhantomData S>, } impl InviteCode { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> InviteCodeBuilder { InviteCodeBuilder::new() } } impl InviteCode { /// Create a new builder for this type pub fn builder() -> InviteCodeBuilder { InviteCodeBuilder::builder() } } impl InviteCodeBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { InviteCodeBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None), _type: PhantomData, } } } impl InviteCodeBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { InviteCodeBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None), _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::Available: invite_code_state::IsUnset, { /// Set the `available` field (required) pub fn available( mut self, value: impl Into, ) -> InviteCodeBuilder, S> { self._fields.0 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::Code: invite_code_state::IsUnset, { /// Set the `code` field (required) pub fn code( mut self, value: impl Into, ) -> InviteCodeBuilder, S> { self._fields.1 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::CreatedAt: invite_code_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> InviteCodeBuilder, S> { self._fields.2 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::CreatedBy: invite_code_state::IsUnset, { /// Set the `createdBy` field (required) pub fn created_by( mut self, value: impl Into, ) -> InviteCodeBuilder, S> { self._fields.3 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::Disabled: invite_code_state::IsUnset, { /// Set the `disabled` field (required) pub fn disabled( mut self, value: impl Into, ) -> InviteCodeBuilder, S> { self._fields.4 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::ForAccount: invite_code_state::IsUnset, { /// Set the `forAccount` field (required) pub fn for_account( mut self, value: impl Into, ) -> InviteCodeBuilder, S> { self._fields.5 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::Uses: invite_code_state::IsUnset, { /// Set the `uses` field (required) pub fn uses( mut self, value: impl Into>>, ) -> InviteCodeBuilder, S> { self._fields.6 = Option::Some(value.into()); InviteCodeBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeBuilder where St: invite_code_state::State, St::Available: invite_code_state::IsSet, St::Code: invite_code_state::IsSet, St::CreatedAt: invite_code_state::IsSet, St::CreatedBy: invite_code_state::IsSet, St::Disabled: invite_code_state::IsSet, St::ForAccount: invite_code_state::IsSet, St::Uses: invite_code_state::IsSet, { /// Build the final struct. pub fn build(self) -> InviteCode { InviteCode { available: self._fields.0.unwrap(), code: self._fields.1.unwrap(), created_at: self._fields.2.unwrap(), created_by: self._fields.3.unwrap(), disabled: self._fields.4.unwrap(), for_account: self._fields.5.unwrap(), uses: self._fields.6.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data( self, extra_data: BTreeMap>, ) -> InviteCode { InviteCode { available: self._fields.0.unwrap(), code: self._fields.1.unwrap(), created_at: self._fields.2.unwrap(), created_by: self._fields.3.unwrap(), disabled: self._fields.4.unwrap(), for_account: self._fields.5.unwrap(), uses: self._fields.6.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.server.defs"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("inviteCode"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("code"), SmolStr::new_static("available"), SmolStr::new_static("disabled"), SmolStr::new_static("forAccount"), SmolStr::new_static("createdBy"), SmolStr::new_static("createdAt"), SmolStr::new_static("uses") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("available"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("code"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("createdBy"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("disabled"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map.insert( SmolStr::new_static("forAccount"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("uses"), LexObjectProperty::Array(LexArray { items: LexArrayItem::Ref(LexRef { r#ref: CowStr::new_static("#inviteCodeUse"), ..Default::default() }), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("inviteCodeUse"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("usedBy"), SmolStr::new_static("usedAt") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("usedAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("usedBy"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Did), ..Default::default() }), ); map }, ..Default::default() }), ); map }, ..Default::default() } } pub mod invite_code_use_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type UsedAt; type UsedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type UsedAt = Unset; type UsedBy = Unset; } ///State transition - sets the `used_at` field to Set pub struct SetUsedAt(PhantomData St>); impl sealed::Sealed for SetUsedAt {} impl State for SetUsedAt { type UsedAt = Set; type UsedBy = St::UsedBy; } ///State transition - sets the `used_by` field to Set pub struct SetUsedBy(PhantomData St>); impl sealed::Sealed for SetUsedBy {} impl State for SetUsedBy { type UsedAt = St::UsedAt; type UsedBy = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `used_at` field pub struct used_at(()); ///Marker type for the `used_by` field pub struct used_by(()); } } /// Builder for constructing an instance of this type. pub struct InviteCodeUseBuilder< St: invite_code_use_state::State, S: BosStr = DefaultStr, > { _state: PhantomData St>, _fields: (Option, Option>), _type: PhantomData S>, } impl InviteCodeUse { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> InviteCodeUseBuilder { InviteCodeUseBuilder::new() } } impl InviteCodeUse { /// Create a new builder for this type pub fn builder() -> InviteCodeUseBuilder { InviteCodeUseBuilder::builder() } } impl InviteCodeUseBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { InviteCodeUseBuilder { _state: PhantomData, _fields: (None, None), _type: PhantomData, } } } impl InviteCodeUseBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { InviteCodeUseBuilder { _state: PhantomData, _fields: (None, None), _type: PhantomData, } } } impl InviteCodeUseBuilder where St: invite_code_use_state::State, St::UsedAt: invite_code_use_state::IsUnset, { /// Set the `usedAt` field (required) pub fn used_at( mut self, value: impl Into, ) -> InviteCodeUseBuilder, S> { self._fields.0 = Option::Some(value.into()); InviteCodeUseBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeUseBuilder where St: invite_code_use_state::State, St::UsedBy: invite_code_use_state::IsUnset, { /// Set the `usedBy` field (required) pub fn used_by( mut self, value: impl Into>, ) -> InviteCodeUseBuilder, S> { self._fields.1 = Option::Some(value.into()); InviteCodeUseBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl InviteCodeUseBuilder where St: invite_code_use_state::State, St::UsedAt: invite_code_use_state::IsSet, St::UsedBy: invite_code_use_state::IsSet, { /// Build the final struct. pub fn build(self) -> InviteCodeUse { InviteCodeUse { used_at: self._fields.0.unwrap(), used_by: self._fields.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data( self, extra_data: BTreeMap>, ) -> InviteCodeUse { InviteCodeUse { used_at: self._fields.0.unwrap(), used_by: self._fields.1.unwrap(), extra_data: Some(extra_data), } } }