// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.server.createAccount // // 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, bon::Builder )] #[serde(rename_all = "camelCase")] #[builder(start_fn = new)] pub struct CreateAccount<'a> { ///Pre-existing atproto DID, being imported to a new account. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub did: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub email: std::option::Option>, ///Requested handle for the account. #[serde(borrow)] pub handle: jacquard_common::types::string::Handle<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub invite_code: std::option::Option>, ///Initial account password. May need to meet instance-specific password strength requirements. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub password: std::option::Option>, ///A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub plc_op: std::option::Option>, ///DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub recovery_key: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub verification_code: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub verification_phone: std::option::Option>, #[serde(flatten)] #[serde(borrow)] #[builder(default)] pub extra_data: ::std::collections::BTreeMap< ::jacquard_common::smol_str::SmolStr, ::jacquard_common::types::value::Data<'a>, >, } impl jacquard_common::IntoStatic for CreateAccount<'_> { type Output = CreateAccount<'static>; fn into_static(self) -> Self::Output { CreateAccount { did: self.did.into_static(), email: self.email.into_static(), handle: self.handle.into_static(), invite_code: self.invite_code.into_static(), password: self.password.into_static(), plc_op: self.plc_op.into_static(), recovery_key: self.recovery_key.into_static(), verification_code: self.verification_code.into_static(), verification_phone: self.verification_phone.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::lexicon] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct CreateAccountOutput<'a> { #[serde(borrow)] pub access_jwt: jacquard_common::CowStr<'a>, ///The DID of the new account. #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, ///Complete DID document. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub did_doc: std::option::Option>, #[serde(borrow)] pub handle: jacquard_common::types::string::Handle<'a>, #[serde(borrow)] pub refresh_jwt: jacquard_common::CowStr<'a>, } impl jacquard_common::IntoStatic for CreateAccountOutput<'_> { type Output = CreateAccountOutput<'static>; fn into_static(self) -> Self::Output { CreateAccountOutput { access_jwt: self.access_jwt.into_static(), did: self.did.into_static(), did_doc: self.did_doc.into_static(), handle: self.handle.into_static(), refresh_jwt: self.refresh_jwt.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum CreateAccountError<'a> { #[serde(rename = "InvalidHandle")] InvalidHandle(std::option::Option), #[serde(rename = "InvalidPassword")] InvalidPassword(std::option::Option), #[serde(rename = "InvalidInviteCode")] InvalidInviteCode(std::option::Option), #[serde(rename = "HandleNotAvailable")] HandleNotAvailable(std::option::Option), #[serde(rename = "UnsupportedDomain")] UnsupportedDomain(std::option::Option), #[serde(rename = "UnresolvableDid")] UnresolvableDid(std::option::Option), #[serde(rename = "IncompatibleDidDoc")] IncompatibleDidDoc(std::option::Option), } impl std::fmt::Display for CreateAccountError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::InvalidHandle(msg) => { write!(f, "InvalidHandle")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::InvalidPassword(msg) => { write!(f, "InvalidPassword")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::InvalidInviteCode(msg) => { write!(f, "InvalidInviteCode")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::HandleNotAvailable(msg) => { write!(f, "HandleNotAvailable")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::UnsupportedDomain(msg) => { write!(f, "UnsupportedDomain")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::UnresolvableDid(msg) => { write!(f, "UnresolvableDid")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::IncompatibleDidDoc(msg) => { write!(f, "IncompatibleDidDoc")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for CreateAccountError<'_> { type Output = CreateAccountError<'static>; fn into_static(self) -> Self::Output { match self { CreateAccountError::InvalidHandle(v) => { CreateAccountError::InvalidHandle(v.into_static()) } CreateAccountError::InvalidPassword(v) => { CreateAccountError::InvalidPassword(v.into_static()) } CreateAccountError::InvalidInviteCode(v) => { CreateAccountError::InvalidInviteCode(v.into_static()) } CreateAccountError::HandleNotAvailable(v) => { CreateAccountError::HandleNotAvailable(v.into_static()) } CreateAccountError::UnsupportedDomain(v) => { CreateAccountError::UnsupportedDomain(v.into_static()) } CreateAccountError::UnresolvableDid(v) => { CreateAccountError::UnresolvableDid(v.into_static()) } CreateAccountError::IncompatibleDidDoc(v) => { CreateAccountError::IncompatibleDidDoc(v.into_static()) } CreateAccountError::Unknown(v) => { CreateAccountError::Unknown(v.into_static()) } } } } impl jacquard_common::types::xrpc::XrpcRequest for CreateAccount<'_> { const NSID: &'static str = "com.atproto.server.createAccount"; const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure( "application/json", ); const OUTPUT_ENCODING: &'static str = "application/json"; type Output<'de> = CreateAccountOutput<'de>; type Err<'de> = CreateAccountError<'de>; }