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