// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.server.createInviteCodes // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct AccountCodes<'a> { #[serde(borrow)] pub account: jacquard_common::CowStr<'a>, #[serde(borrow)] pub codes: Vec>, } pub mod account_codes_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 Codes; type Account; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Codes = Unset; type Account = Unset; } ///State transition - sets the `codes` field to Set pub struct SetCodes(PhantomData S>); impl sealed::Sealed for SetCodes {} impl State for SetCodes { type Codes = Set; type Account = S::Account; } ///State transition - sets the `account` field to Set pub struct SetAccount(PhantomData S>); impl sealed::Sealed for SetAccount {} impl State for SetAccount { type Codes = S::Codes; type Account = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `codes` field pub struct codes(()); ///Marker type for the `account` field pub struct account(()); } } /// Builder for constructing an instance of this type pub struct AccountCodesBuilder<'a, S: account_codes_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> AccountCodes<'a> { /// Create a new builder for this type pub fn new() -> AccountCodesBuilder<'a, account_codes_state::Empty> { AccountCodesBuilder::new() } } impl<'a> AccountCodesBuilder<'a, account_codes_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { AccountCodesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AccountCodesBuilder<'a, S> where S: account_codes_state::State, S::Account: account_codes_state::IsUnset, { /// Set the `account` field (required) pub fn account( mut self, value: impl Into>, ) -> AccountCodesBuilder<'a, account_codes_state::SetAccount> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); AccountCodesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AccountCodesBuilder<'a, S> where S: account_codes_state::State, S::Codes: account_codes_state::IsUnset, { /// Set the `codes` field (required) pub fn codes( mut self, value: impl Into>>, ) -> AccountCodesBuilder<'a, account_codes_state::SetCodes> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); AccountCodesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AccountCodesBuilder<'a, S> where S: account_codes_state::State, S::Codes: account_codes_state::IsSet, S::Account: account_codes_state::IsSet, { /// Build the final struct pub fn build(self) -> AccountCodes<'a> { AccountCodes { account: self.__unsafe_private_named.0.unwrap(), codes: self.__unsafe_private_named.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> AccountCodes<'a> { AccountCodes { account: self.__unsafe_private_named.0.unwrap(), codes: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_com_atproto_server_createInviteCodes() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static( "com.atproto.server.createInviteCodes", ), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accountCodes"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("account"), ::jacquard_common::smol_str::SmolStr::new_static("codes") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("account"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("codes"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), min_length: None, max_length: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcProcedure(::jacquard_lexicon::lexicon::LexXrpcProcedure { description: None, parameters: None, input: Some(::jacquard_lexicon::lexicon::LexXrpcBody { description: None, encoding: ::jacquard_common::CowStr::new_static( "application/json", ), schema: Some( ::jacquard_lexicon::lexicon::LexXrpcBodySchema::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("codeCount"), ::jacquard_common::smol_str::SmolStr::new_static("useCount") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "codeCount", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "forAccounts", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "useCount", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ), }), output: None, errors: None, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountCodes<'a> { fn nsid() -> &'static str { "com.atproto.server.createInviteCodes" } fn def_name() -> &'static str { "accountCodes" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_com_atproto_server_createInviteCodes() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CreateInviteCodes<'a> { pub code_count: i64, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub for_accounts: std::option::Option>>, pub use_count: i64, } pub mod create_invite_codes_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 UseCount; type CodeCount; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type UseCount = Unset; type CodeCount = Unset; } ///State transition - sets the `use_count` field to Set pub struct SetUseCount(PhantomData S>); impl sealed::Sealed for SetUseCount {} impl State for SetUseCount { type UseCount = Set; type CodeCount = S::CodeCount; } ///State transition - sets the `code_count` field to Set pub struct SetCodeCount(PhantomData S>); impl sealed::Sealed for SetCodeCount {} impl State for SetCodeCount { type UseCount = S::UseCount; type CodeCount = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `use_count` field pub struct use_count(()); ///Marker type for the `code_count` field pub struct code_count(()); } } /// Builder for constructing an instance of this type pub struct CreateInviteCodesBuilder<'a, S: create_invite_codes_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> CreateInviteCodes<'a> { /// Create a new builder for this type pub fn new() -> CreateInviteCodesBuilder<'a, create_invite_codes_state::Empty> { CreateInviteCodesBuilder::new() } } impl<'a> CreateInviteCodesBuilder<'a, create_invite_codes_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CreateInviteCodesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CreateInviteCodesBuilder<'a, S> where S: create_invite_codes_state::State, S::CodeCount: create_invite_codes_state::IsUnset, { /// Set the `codeCount` field (required) pub fn code_count( mut self, value: impl Into, ) -> CreateInviteCodesBuilder<'a, create_invite_codes_state::SetCodeCount> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); CreateInviteCodesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: create_invite_codes_state::State> CreateInviteCodesBuilder<'a, S> { /// Set the `forAccounts` field (optional) pub fn for_accounts( mut self, value: impl Into>>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `forAccounts` field to an Option value (optional) pub fn maybe_for_accounts( mut self, value: Option>>, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> CreateInviteCodesBuilder<'a, S> where S: create_invite_codes_state::State, S::UseCount: create_invite_codes_state::IsUnset, { /// Set the `useCount` field (required) pub fn use_count( mut self, value: impl Into, ) -> CreateInviteCodesBuilder<'a, create_invite_codes_state::SetUseCount> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); CreateInviteCodesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CreateInviteCodesBuilder<'a, S> where S: create_invite_codes_state::State, S::UseCount: create_invite_codes_state::IsSet, S::CodeCount: create_invite_codes_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateInviteCodes<'a> { CreateInviteCodes { code_count: self.__unsafe_private_named.0.unwrap(), for_accounts: self.__unsafe_private_named.1, use_count: self.__unsafe_private_named.2.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> CreateInviteCodes<'a> { CreateInviteCodes { code_count: self.__unsafe_private_named.0.unwrap(), for_accounts: self.__unsafe_private_named.1, use_count: self.__unsafe_private_named.2.unwrap(), extra_data: Some(extra_data), } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CreateInviteCodesOutput<'a> { #[serde(borrow)] pub codes: Vec>, } /// Response type for ///com.atproto.server.createInviteCodes pub struct CreateInviteCodesResponse; impl jacquard_common::xrpc::XrpcResp for CreateInviteCodesResponse { const NSID: &'static str = "com.atproto.server.createInviteCodes"; const ENCODING: &'static str = "application/json"; type Output<'de> = CreateInviteCodesOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for CreateInviteCodes<'a> { const NSID: &'static str = "com.atproto.server.createInviteCodes"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = CreateInviteCodesResponse; } /// Endpoint type for ///com.atproto.server.createInviteCodes pub struct CreateInviteCodesRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateInviteCodesRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createInviteCodes"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = CreateInviteCodes<'de>; type Response = CreateInviteCodesResponse; }