Something went wrong. Try again.
Something went wrong. Try again.
8.1 kB · 241 lines
Rust
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241// @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, jacquard_derive::IntoStatic, Default)]#[serde(rename_all = "camelCase")]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<bool>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub auth_factor_token: std::option::Option<jacquard_common::CowStr<'a>>, /// Handle or other identifier supported by the server for the authenticating user. #[serde(borrow)] pub identifier: jacquard_common::CowStr<'a>, #[serde(borrow)] pub password: jacquard_common::CowStr<'a>,}
#[jacquard_derive::lexicon]#[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic)]#[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<bool>, #[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<jacquard_common::types::value::Data<'a>>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub email: std::option::Option<jacquard_common::CowStr<'a>>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub email_auth_factor: std::option::Option<bool>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub email_confirmed: std::option::Option<bool>, #[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<CreateSessionOutputStatus<'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.#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum CreateSessionOutputStatus<'a> { Takendown, Suspended, Deactivated, Other(jacquard_common::CowStr<'a>),}
impl<'a> CreateSessionOutputStatus<'a> { pub fn as_str(&self) -> &str { match self { Self::Takendown => "takendown", Self::Suspended => "suspended", Self::Deactivated => "deactivated", Self::Other(s) => s.as_ref(), } }}
impl<'a> From<&'a str> for CreateSessionOutputStatus<'a> { fn from(s: &'a str) -> Self { match s { "takendown" => Self::Takendown, "suspended" => Self::Suspended, "deactivated" => Self::Deactivated, _ => Self::Other(jacquard_common::CowStr::from(s)), } }}
impl<'a> From<String> for CreateSessionOutputStatus<'a> { fn from(s: String) -> Self { match s.as_str() { "takendown" => Self::Takendown, "suspended" => Self::Suspended, "deactivated" => Self::Deactivated, _ => Self::Other(jacquard_common::CowStr::from(s)), } }}
impl<'a> core::fmt::Display for CreateSessionOutputStatus<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<'a> AsRef<str> for CreateSessionOutputStatus<'a> { fn as_ref(&self) -> &str { self.as_str() }}
impl<'a> serde::Serialize for CreateSessionOutputStatus<'a> { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, 'a> serde::Deserialize<'de> for CreateSessionOutputStatus<'a>where 'de: 'a,{ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) }}
impl<'a> Default for CreateSessionOutputStatus<'a> { fn default() -> Self { Self::Other(Default::default()) }}
impl jacquard_common::IntoStatic for CreateSessionOutputStatus<'_> { type Output = CreateSessionOutputStatus<'static>; fn into_static(self) -> Self::Output { match self { CreateSessionOutputStatus::Takendown => CreateSessionOutputStatus::Takendown, CreateSessionOutputStatus::Suspended => CreateSessionOutputStatus::Suspended, CreateSessionOutputStatus::Deactivated => { CreateSessionOutputStatus::Deactivated } CreateSessionOutputStatus::Other(v) => { CreateSessionOutputStatus::Other(v.into_static()) } } }}
#[jacquard_derive::open_union]#[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, jacquard_derive::IntoStatic)]#[serde(tag = "error", content = "message")]#[serde(bound(deserialize = "'de: 'a"))]pub enum CreateSessionError<'a> { #[serde(rename = "AccountTakedown")] AccountTakedown(std::option::Option<jacquard_common::CowStr<'a>>), #[serde(rename = "AuthFactorTokenRequired")] AuthFactorTokenRequired(std::option::Option<jacquard_common::CowStr<'a>>),}
impl core::fmt::Display for CreateSessionError<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::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), } }}
/// Response type for///com.atproto.server.createSessionpub struct CreateSessionResponse;impl jacquard_common::xrpc::XrpcResp for CreateSessionResponse { const NSID: &'static str = "com.atproto.server.createSession"; const ENCODING: &'static str = "application/json"; type Output<'de> = CreateSessionOutput<'de>; type Err<'de> = CreateSessionError<'de>;}
impl<'a> jacquard_common::xrpc::XrpcRequest for CreateSession<'a> { const NSID: &'static str = "com.atproto.server.createSession"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = CreateSessionResponse;}
/// Endpoint type for///com.atproto.server.createSessionpub struct CreateSessionRequest;impl jacquard_common::xrpc::XrpcEndpoint for CreateSessionRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createSession"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = CreateSession<'de>; type Response = CreateSessionResponse;}