jacquard_api/com_atproto/server/
get_service_auth.rs

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)]
57#[serde(tag = "error", content = "message")]
58#[serde(bound(deserialize = "'de: 'a"))]
59pub enum GetServiceAuthError<'a> {
60    ///Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes.
61    #[serde(rename = "BadExpiration")]
62    BadExpiration(std::option::Option<String>),
63}
64
65impl std::fmt::Display for GetServiceAuthError<'_> {
66    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
67        match self {
68            Self::BadExpiration(msg) => {
69                write!(f, "BadExpiration")?;
70                if let Some(msg) = msg {
71                    write!(f, ": {}", msg)?;
72                }
73                Ok(())
74            }
75            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
76        }
77    }
78}
79
80impl jacquard_common::IntoStatic for GetServiceAuthError<'_> {
81    type Output = GetServiceAuthError<'static>;
82    fn into_static(self) -> Self::Output {
83        match self {
84            GetServiceAuthError::BadExpiration(v) => {
85                GetServiceAuthError::BadExpiration(v.into_static())
86            }
87            GetServiceAuthError::Unknown(v) => {
88                GetServiceAuthError::Unknown(v.into_static())
89            }
90        }
91    }
92}
93
94///Response type for
95///com.atproto.server.getServiceAuth
96pub struct GetServiceAuthResponse;
97impl jacquard_common::xrpc::XrpcResp for GetServiceAuthResponse {
98    const NSID: &'static str = "com.atproto.server.getServiceAuth";
99    const ENCODING: &'static str = "application/json";
100    type Output<'de> = GetServiceAuthOutput<'de>;
101    type Err<'de> = GetServiceAuthError<'de>;
102}
103
104impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetServiceAuth<'de> {
105    const NSID: &'static str = "com.atproto.server.getServiceAuth";
106    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
107    type Response = GetServiceAuthResponse;
108}
109
110///Endpoint type for
111///com.atproto.server.getServiceAuth
112pub struct GetServiceAuthRequest;
113impl jacquard_common::xrpc::XrpcEndpoint for GetServiceAuthRequest {
114    const PATH: &'static str = "/xrpc/com.atproto.server.getServiceAuth";
115    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
116    type Request<'de> = GetServiceAuth<'de>;
117    type Response = GetServiceAuthResponse;
118}