A better Rust ATProto crate
at lifetimes 4.5 kB view raw
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)] 53#[serde(tag = "error", content = "message")] 54#[serde(bound(deserialize = "'de: 'a"))] 55pub enum ResolveIdentityError<'a> { 56 ///The resolution process confirmed that the handle does not resolve to any DID. 57 #[serde(rename = "HandleNotFound")] 58 HandleNotFound(std::option::Option<String>), 59 ///The DID resolution process confirmed that there is no current DID. 60 #[serde(rename = "DidNotFound")] 61 DidNotFound(std::option::Option<String>), 62 ///The DID previously existed, but has been deactivated. 63 #[serde(rename = "DidDeactivated")] 64 DidDeactivated(std::option::Option<String>), 65} 66 67impl std::fmt::Display for ResolveIdentityError<'_> { 68 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 69 match self { 70 Self::HandleNotFound(msg) => { 71 write!(f, "HandleNotFound")?; 72 if let Some(msg) = msg { 73 write!(f, ": {}", msg)?; 74 } 75 Ok(()) 76 } 77 Self::DidNotFound(msg) => { 78 write!(f, "DidNotFound")?; 79 if let Some(msg) = msg { 80 write!(f, ": {}", msg)?; 81 } 82 Ok(()) 83 } 84 Self::DidDeactivated(msg) => { 85 write!(f, "DidDeactivated")?; 86 if let Some(msg) = msg { 87 write!(f, ": {}", msg)?; 88 } 89 Ok(()) 90 } 91 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 92 } 93 } 94} 95 96impl jacquard_common::IntoStatic for ResolveIdentityError<'_> { 97 type Output = ResolveIdentityError<'static>; 98 fn into_static(self) -> Self::Output { 99 match self { 100 ResolveIdentityError::HandleNotFound(v) => { 101 ResolveIdentityError::HandleNotFound(v.into_static()) 102 } 103 ResolveIdentityError::DidNotFound(v) => { 104 ResolveIdentityError::DidNotFound(v.into_static()) 105 } 106 ResolveIdentityError::DidDeactivated(v) => { 107 ResolveIdentityError::DidDeactivated(v.into_static()) 108 } 109 ResolveIdentityError::Unknown(v) => { 110 ResolveIdentityError::Unknown(v.into_static()) 111 } 112 } 113 } 114} 115 116///Response type for 117///com.atproto.identity.resolveIdentity 118pub struct ResolveIdentityResponse; 119impl jacquard_common::xrpc::XrpcResp for ResolveIdentityResponse { 120 const NSID: &'static str = "com.atproto.identity.resolveIdentity"; 121 const ENCODING: &'static str = "application/json"; 122 type Output<'de> = ResolveIdentityOutput<'de>; 123 type Err<'de> = ResolveIdentityError<'de>; 124} 125 126impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for ResolveIdentity<'de> { 127 const NSID: &'static str = "com.atproto.identity.resolveIdentity"; 128 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 129 type Response = ResolveIdentityResponse; 130} 131 132///Endpoint type for 133///com.atproto.identity.resolveIdentity 134pub struct ResolveIdentityRequest; 135impl jacquard_common::xrpc::XrpcEndpoint for ResolveIdentityRequest { 136 const PATH: &'static str = "/xrpc/com.atproto.identity.resolveIdentity"; 137 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 138 type Request<'de> = ResolveIdentity<'de>; 139 type Response = ResolveIdentityResponse; 140}