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