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(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
10#[serde(rename_all = "camelCase")]
11pub struct RefreshSessionOutput<'a> {
12    #[serde(borrow)]
13    pub access_jwt: jacquard_common::CowStr<'a>,
14    #[serde(skip_serializing_if = "std::option::Option::is_none")]
15    pub active: std::option::Option<bool>,
16    #[serde(borrow)]
17    pub did: jacquard_common::types::string::Did<'a>,
18    #[serde(skip_serializing_if = "std::option::Option::is_none")]
19    #[serde(borrow)]
20    pub did_doc: std::option::Option<jacquard_common::types::value::Data<'a>>,
21    #[serde(borrow)]
22    pub handle: jacquard_common::types::string::Handle<'a>,
23    #[serde(borrow)]
24    pub refresh_jwt: jacquard_common::CowStr<'a>,
25    ///Hosting status of the account. If not specified, then assume 'active'.
26    #[serde(skip_serializing_if = "std::option::Option::is_none")]
27    #[serde(borrow)]
28    pub status: std::option::Option<jacquard_common::CowStr<'a>>,
29}
30
31impl jacquard_common::IntoStatic for RefreshSessionOutput<'_> {
32    type Output = RefreshSessionOutput<'static>;
33    fn into_static(self) -> Self::Output {
34        RefreshSessionOutput {
35            access_jwt: self.access_jwt.into_static(),
36            active: self.active.into_static(),
37            did: self.did.into_static(),
38            did_doc: self.did_doc.into_static(),
39            handle: self.handle.into_static(),
40            refresh_jwt: self.refresh_jwt.into_static(),
41            status: self.status.into_static(),
42            extra_data: self.extra_data.into_static(),
43        }
44    }
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)]
58#[serde(tag = "error", content = "message")]
59#[serde(bound(deserialize = "'de: 'a"))]
60pub enum RefreshSessionError<'a> {
61    #[serde(rename = "AccountTakedown")]
62    AccountTakedown(std::option::Option<String>),
63}
64
65impl std::fmt::Display for RefreshSessionError<'_> {
66    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
67        match self {
68            Self::AccountTakedown(msg) => {
69                write!(f, "AccountTakedown")?;
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 RefreshSessionError<'_> {
81    type Output = RefreshSessionError<'static>;
82    fn into_static(self) -> Self::Output {
83        match self {
84            RefreshSessionError::AccountTakedown(v) => {
85                RefreshSessionError::AccountTakedown(v.into_static())
86            }
87            RefreshSessionError::Unknown(v) => {
88                RefreshSessionError::Unknown(v.into_static())
89            }
90        }
91    }
92}
93
94/// XRPC request marker type
95#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
96pub struct RefreshSession;
97impl jacquard_common::types::xrpc::XrpcRequest for RefreshSession {
98    const NSID: &'static str = "com.atproto.server.refreshSession";
99    const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure(
100        "application/json",
101    );
102    const OUTPUT_ENCODING: &'static str = "application/json";
103    type Output<'de> = RefreshSessionOutput<'de>;
104    type Err<'de> = RefreshSessionError<'de>;
105}