1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.identity.refreshIdentity
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 bon::Builder,
17 jacquard_derive::IntoStatic
18)]
19#[serde(rename_all = "camelCase")]
20#[builder(start_fn = new)]
21pub struct RefreshIdentity<'a> {
22 #[serde(borrow)]
23 pub identifier: jacquard_common::types::ident::AtIdentifier<'a>,
24 #[serde(flatten)]
25 #[serde(borrow)]
26 #[builder(default)]
27 pub extra_data: ::std::collections::BTreeMap<
28 ::jacquard_common::smol_str::SmolStr,
29 ::jacquard_common::types::value::Data<'a>,
30 >,
31}
32
33#[jacquard_derive::lexicon]
34#[derive(
35 serde::Serialize,
36 serde::Deserialize,
37 Debug,
38 Clone,
39 PartialEq,
40 Eq,
41 jacquard_derive::IntoStatic
42)]
43#[serde(rename_all = "camelCase")]
44pub struct RefreshIdentityOutput<'a> {
45 #[serde(flatten)]
46 #[serde(borrow)]
47 pub value: crate::com_atproto::identity::IdentityInfo<'a>,
48}
49
50#[jacquard_derive::open_union]
51#[derive(
52 serde::Serialize,
53 serde::Deserialize,
54 Debug,
55 Clone,
56 PartialEq,
57 Eq,
58 thiserror::Error,
59 miette::Diagnostic
60)]
61#[serde(tag = "error", content = "message")]
62#[serde(bound(deserialize = "'de: 'a"))]
63pub enum RefreshIdentityError<'a> {
64 ///The resolution process confirmed that the handle does not resolve to any DID.
65 #[serde(rename = "HandleNotFound")]
66 HandleNotFound(std::option::Option<String>),
67 ///The DID resolution process confirmed that there is no current DID.
68 #[serde(rename = "DidNotFound")]
69 DidNotFound(std::option::Option<String>),
70 ///The DID previously existed, but has been deactivated.
71 #[serde(rename = "DidDeactivated")]
72 DidDeactivated(std::option::Option<String>),
73}
74
75impl std::fmt::Display for RefreshIdentityError<'_> {
76 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77 match self {
78 Self::HandleNotFound(msg) => {
79 write!(f, "HandleNotFound")?;
80 if let Some(msg) = msg {
81 write!(f, ": {}", msg)?;
82 }
83 Ok(())
84 }
85 Self::DidNotFound(msg) => {
86 write!(f, "DidNotFound")?;
87 if let Some(msg) = msg {
88 write!(f, ": {}", msg)?;
89 }
90 Ok(())
91 }
92 Self::DidDeactivated(msg) => {
93 write!(f, "DidDeactivated")?;
94 if let Some(msg) = msg {
95 write!(f, ": {}", msg)?;
96 }
97 Ok(())
98 }
99 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
100 }
101 }
102}
103
104impl jacquard_common::IntoStatic for RefreshIdentityError<'_> {
105 type Output = RefreshIdentityError<'static>;
106 fn into_static(self) -> Self::Output {
107 match self {
108 RefreshIdentityError::HandleNotFound(v) => {
109 RefreshIdentityError::HandleNotFound(v.into_static())
110 }
111 RefreshIdentityError::DidNotFound(v) => {
112 RefreshIdentityError::DidNotFound(v.into_static())
113 }
114 RefreshIdentityError::DidDeactivated(v) => {
115 RefreshIdentityError::DidDeactivated(v.into_static())
116 }
117 RefreshIdentityError::Unknown(v) => {
118 RefreshIdentityError::Unknown(v.into_static())
119 }
120 }
121 }
122}
123
124///Response type for
125///com.atproto.identity.refreshIdentity
126pub struct RefreshIdentityResponse;
127impl jacquard_common::xrpc::XrpcResp for RefreshIdentityResponse {
128 const NSID: &'static str = "com.atproto.identity.refreshIdentity";
129 const ENCODING: &'static str = "application/json";
130 type Output<'de> = RefreshIdentityOutput<'de>;
131 type Err<'de> = RefreshIdentityError<'de>;
132}
133
134impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for RefreshIdentity<'de> {
135 const NSID: &'static str = "com.atproto.identity.refreshIdentity";
136 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
137 "application/json",
138 );
139 type Response = RefreshIdentityResponse;
140}
141
142///Endpoint type for
143///com.atproto.identity.refreshIdentity
144pub struct RefreshIdentityRequest;
145impl jacquard_common::xrpc::XrpcEndpoint for RefreshIdentityRequest {
146 const PATH: &'static str = "/xrpc/com.atproto.identity.refreshIdentity";
147 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
148 "application/json",
149 );
150 type Request<'de> = RefreshIdentity<'de>;
151 type Response = RefreshIdentityResponse;
152}