// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.server.getServiceAuth // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder )] #[builder(start_fn = new)] #[serde(rename_all = "camelCase")] pub struct GetServiceAuth<'a> { #[serde(borrow)] pub aud: jacquard_common::types::string::Did<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub exp: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub lxm: std::option::Option>, } impl jacquard_common::IntoStatic for GetServiceAuth<'_> { type Output = GetServiceAuth<'static>; fn into_static(self) -> Self::Output { GetServiceAuth { aud: self.aud.into_static(), exp: self.exp.into_static(), lxm: self.lxm.into_static(), } } } #[jacquard_derive::lexicon] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct GetServiceAuthOutput<'a> { #[serde(borrow)] pub token: jacquard_common::CowStr<'a>, } impl jacquard_common::IntoStatic for GetServiceAuthOutput<'_> { type Output = GetServiceAuthOutput<'static>; fn into_static(self) -> Self::Output { GetServiceAuthOutput { token: self.token.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 GetServiceAuthError<'a> { ///Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes. #[serde(rename = "BadExpiration")] BadExpiration(std::option::Option), } impl std::fmt::Display for GetServiceAuthError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::BadExpiration(msg) => { write!(f, "BadExpiration")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for GetServiceAuthError<'_> { type Output = GetServiceAuthError<'static>; fn into_static(self) -> Self::Output { match self { GetServiceAuthError::BadExpiration(v) => { GetServiceAuthError::BadExpiration(v.into_static()) } GetServiceAuthError::Unknown(v) => { GetServiceAuthError::Unknown(v.into_static()) } } } } impl jacquard_common::types::xrpc::XrpcRequest for GetServiceAuth<'_> { const NSID: &'static str = "com.atproto.server.getServiceAuth"; const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; const OUTPUT_ENCODING: &'static str = "application/json"; type Output<'de> = GetServiceAuthOutput<'de>; type Err<'de> = GetServiceAuthError<'de>; }