A better Rust ATProto crate
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.server.getServiceAuth 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[derive( 9 serde::Serialize, 10 serde::Deserialize, 11 Debug, 12 Clone, 13 PartialEq, 14 Eq, 15 bon::Builder, 16 jacquard_derive::IntoStatic 17)] 18#[builder(start_fn = new)] 19#[serde(rename_all = "camelCase")] 20pub struct GetServiceAuth<'a> { 21 #[serde(borrow)] 22 pub aud: jacquard_common::types::string::Did<'a>, 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 pub exp: std::option::Option<i64>, 25 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 #[serde(borrow)] 27 pub lxm: std::option::Option<jacquard_common::types::string::Nsid<'a>>, 28} 29 30#[jacquard_derive::lexicon] 31#[derive( 32 serde::Serialize, 33 serde::Deserialize, 34 Debug, 35 Clone, 36 PartialEq, 37 Eq, 38 jacquard_derive::IntoStatic, 39 Default 40)] 41#[serde(rename_all = "camelCase")] 42pub struct GetServiceAuthOutput<'a> { 43 #[serde(borrow)] 44 pub token: jacquard_common::CowStr<'a>, 45} 46 47#[jacquard_derive::open_union] 48#[derive( 49 serde::Serialize, 50 serde::Deserialize, 51 Debug, 52 Clone, 53 PartialEq, 54 Eq, 55 thiserror::Error, 56 miette::Diagnostic, 57 jacquard_derive::IntoStatic 58)] 59#[serde(tag = "error", content = "message")] 60#[serde(bound(deserialize = "'de: 'a"))] 61pub enum GetServiceAuthError<'a> { 62 /// Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes. 63 #[serde(rename = "BadExpiration")] 64 BadExpiration(std::option::Option<String>), 65} 66 67impl std::fmt::Display for GetServiceAuthError<'_> { 68 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 69 match self { 70 Self::BadExpiration(msg) => { 71 write!(f, "BadExpiration")?; 72 if let Some(msg) = msg { 73 write!(f, ": {}", msg)?; 74 } 75 Ok(()) 76 } 77 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 78 } 79 } 80} 81 82///Response type for 83///com.atproto.server.getServiceAuth 84pub struct GetServiceAuthResponse; 85impl jacquard_common::xrpc::XrpcResp for GetServiceAuthResponse { 86 const NSID: &'static str = "com.atproto.server.getServiceAuth"; 87 const ENCODING: &'static str = "application/json"; 88 type Output<'de> = GetServiceAuthOutput<'de>; 89 type Err<'de> = GetServiceAuthError<'de>; 90} 91 92impl<'a> jacquard_common::xrpc::XrpcRequest for GetServiceAuth<'a> { 93 const NSID: &'static str = "com.atproto.server.getServiceAuth"; 94 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 95 type Response = GetServiceAuthResponse; 96} 97 98///Endpoint type for 99///com.atproto.server.getServiceAuth 100pub struct GetServiceAuthRequest; 101impl jacquard_common::xrpc::XrpcEndpoint for GetServiceAuthRequest { 102 const PATH: &'static str = "/xrpc/com.atproto.server.getServiceAuth"; 103 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 104 type Request<'de> = GetServiceAuth<'de>; 105 type Response = GetServiceAuthResponse; 106}