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)] 40#[serde(rename_all = "camelCase")] 41pub struct GetServiceAuthOutput<'a> { 42 #[serde(borrow)] 43 pub token: jacquard_common::CowStr<'a>, 44} 45 46#[jacquard_derive::open_union] 47#[derive( 48 serde::Serialize, 49 serde::Deserialize, 50 Debug, 51 Clone, 52 PartialEq, 53 Eq, 54 thiserror::Error, 55 miette::Diagnostic, 56 jacquard_derive::IntoStatic 57)] 58#[serde(tag = "error", content = "message")] 59#[serde(bound(deserialize = "'de: 'a"))] 60pub enum GetServiceAuthError<'a> { 61 ///Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes. 62 #[serde(rename = "BadExpiration")] 63 BadExpiration(std::option::Option<String>), 64} 65 66impl std::fmt::Display for GetServiceAuthError<'_> { 67 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 68 match self { 69 Self::BadExpiration(msg) => { 70 write!(f, "BadExpiration")?; 71 if let Some(msg) = msg { 72 write!(f, ": {}", msg)?; 73 } 74 Ok(()) 75 } 76 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 77 } 78 } 79} 80 81///Response type for 82///com.atproto.server.getServiceAuth 83pub struct GetServiceAuthResponse; 84impl jacquard_common::xrpc::XrpcResp for GetServiceAuthResponse { 85 const NSID: &'static str = "com.atproto.server.getServiceAuth"; 86 const ENCODING: &'static str = "application/json"; 87 type Output<'de> = GetServiceAuthOutput<'de>; 88 type Err<'de> = GetServiceAuthError<'de>; 89} 90 91impl<'a> jacquard_common::xrpc::XrpcRequest for GetServiceAuth<'a> { 92 const NSID: &'static str = "com.atproto.server.getServiceAuth"; 93 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 94 type Response = GetServiceAuthResponse; 95} 96 97///Endpoint type for 98///com.atproto.server.getServiceAuth 99pub struct GetServiceAuthRequest; 100impl jacquard_common::xrpc::XrpcEndpoint for GetServiceAuthRequest { 101 const PATH: &'static str = "/xrpc/com.atproto.server.getServiceAuth"; 102 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 103 type Request<'de> = GetServiceAuth<'de>; 104 type Response = GetServiceAuthResponse; 105}