jacquard_api/com_atproto/server/
refresh_session.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.server.refreshSession
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10    serde::Serialize,
11    serde::Deserialize,
12    Debug,
13    Clone,
14    PartialEq,
15    Eq,
16    jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct RefreshSessionOutput<'a> {
20    #[serde(borrow)]
21    pub access_jwt: jacquard_common::CowStr<'a>,
22    #[serde(skip_serializing_if = "std::option::Option::is_none")]
23    pub active: std::option::Option<bool>,
24    #[serde(borrow)]
25    pub did: jacquard_common::types::string::Did<'a>,
26    #[serde(skip_serializing_if = "std::option::Option::is_none")]
27    #[serde(borrow)]
28    pub did_doc: std::option::Option<jacquard_common::types::value::Data<'a>>,
29    #[serde(borrow)]
30    pub handle: jacquard_common::types::string::Handle<'a>,
31    #[serde(borrow)]
32    pub refresh_jwt: jacquard_common::CowStr<'a>,
33    ///Hosting status of the account. If not specified, then assume 'active'.
34    #[serde(skip_serializing_if = "std::option::Option::is_none")]
35    #[serde(borrow)]
36    pub status: std::option::Option<jacquard_common::CowStr<'a>>,
37}
38
39#[jacquard_derive::open_union]
40#[derive(
41    serde::Serialize,
42    serde::Deserialize,
43    Debug,
44    Clone,
45    PartialEq,
46    Eq,
47    thiserror::Error,
48    miette::Diagnostic
49)]
50#[serde(tag = "error", content = "message")]
51#[serde(bound(deserialize = "'de: 'a"))]
52pub enum RefreshSessionError<'a> {
53    #[serde(rename = "AccountTakedown")]
54    AccountTakedown(std::option::Option<String>),
55}
56
57impl std::fmt::Display for RefreshSessionError<'_> {
58    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59        match self {
60            Self::AccountTakedown(msg) => {
61                write!(f, "AccountTakedown")?;
62                if let Some(msg) = msg {
63                    write!(f, ": {}", msg)?;
64                }
65                Ok(())
66            }
67            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
68        }
69    }
70}
71
72impl jacquard_common::IntoStatic for RefreshSessionError<'_> {
73    type Output = RefreshSessionError<'static>;
74    fn into_static(self) -> Self::Output {
75        match self {
76            RefreshSessionError::AccountTakedown(v) => {
77                RefreshSessionError::AccountTakedown(v.into_static())
78            }
79            RefreshSessionError::Unknown(v) => {
80                RefreshSessionError::Unknown(v.into_static())
81            }
82        }
83    }
84}
85
86/// XRPC request marker type
87#[derive(
88    Debug,
89    Clone,
90    Copy,
91    PartialEq,
92    Eq,
93    serde::Serialize,
94    serde::Deserialize,
95    jacquard_derive::IntoStatic
96)]
97pub struct RefreshSession;
98///Response type for
99///com.atproto.server.refreshSession
100pub struct RefreshSessionResponse;
101impl jacquard_common::xrpc::XrpcResp for RefreshSessionResponse {
102    const NSID: &'static str = "com.atproto.server.refreshSession";
103    const ENCODING: &'static str = "application/json";
104    type Output<'de> = RefreshSessionOutput<'de>;
105    type Err<'de> = RefreshSessionError<'de>;
106}
107
108impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for RefreshSession {
109    const NSID: &'static str = "com.atproto.server.refreshSession";
110    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
111        "application/json",
112    );
113    type Response = RefreshSessionResponse;
114}
115
116///Endpoint type for
117///com.atproto.server.refreshSession
118pub struct RefreshSessionRequest;
119impl jacquard_common::xrpc::XrpcEndpoint for RefreshSessionRequest {
120    const PATH: &'static str = "/xrpc/com.atproto.server.refreshSession";
121    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
122        "application/json",
123    );
124    type Request<'de> = RefreshSession;
125    type Response = RefreshSessionResponse;
126}