// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.server.createSession // // 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 CreateSession<'a> { ///When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned #[serde(skip_serializing_if = "std::option::Option::is_none")] pub allow_takendown: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub auth_factor_token: std::option::Option>, ///Handle or other identifier supported by the server for the authenticating user. #[serde(borrow)] #[builder(into)] pub identifier: jacquard_common::CowStr<'a>, #[serde(borrow)] #[builder(into)] pub password: jacquard_common::CowStr<'a>, #[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 CreateSession<'_> { type Output = CreateSession<'static>; fn into_static(self) -> Self::Output { CreateSession { allow_takendown: self.allow_takendown.into_static(), auth_factor_token: self.auth_factor_token.into_static(), identifier: self.identifier.into_static(), password: self.password.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 CreateSessionOutput<'a> { #[serde(borrow)] pub access_jwt: jacquard_common::CowStr<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub active: std::option::Option, #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub did_doc: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub email: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub email_auth_factor: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub email_confirmed: std::option::Option, #[serde(borrow)] pub handle: jacquard_common::types::string::Handle<'a>, #[serde(borrow)] pub refresh_jwt: jacquard_common::CowStr<'a>, ///If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub status: std::option::Option>, } impl jacquard_common::IntoStatic for CreateSessionOutput<'_> { type Output = CreateSessionOutput<'static>; fn into_static(self) -> Self::Output { CreateSessionOutput { access_jwt: self.access_jwt.into_static(), active: self.active.into_static(), did: self.did.into_static(), did_doc: self.did_doc.into_static(), email: self.email.into_static(), email_auth_factor: self.email_auth_factor.into_static(), email_confirmed: self.email_confirmed.into_static(), handle: self.handle.into_static(), refresh_jwt: self.refresh_jwt.into_static(), status: self.status.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 CreateSessionError<'a> { #[serde(rename = "AccountTakedown")] AccountTakedown(std::option::Option), #[serde(rename = "AuthFactorTokenRequired")] AuthFactorTokenRequired(std::option::Option), } impl std::fmt::Display for CreateSessionError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::AccountTakedown(msg) => { write!(f, "AccountTakedown")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::AuthFactorTokenRequired(msg) => { write!(f, "AuthFactorTokenRequired")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for CreateSessionError<'_> { type Output = CreateSessionError<'static>; fn into_static(self) -> Self::Output { match self { CreateSessionError::AccountTakedown(v) => { CreateSessionError::AccountTakedown(v.into_static()) } CreateSessionError::AuthFactorTokenRequired(v) => { CreateSessionError::AuthFactorTokenRequired(v.into_static()) } CreateSessionError::Unknown(v) => { CreateSessionError::Unknown(v.into_static()) } } } } impl jacquard_common::types::xrpc::XrpcRequest for CreateSession<'_> { const NSID: &'static str = "com.atproto.server.createSession"; 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> = CreateSessionOutput<'de>; type Err<'de> = CreateSessionError<'de>; }