A better Rust ATProto crate
at main 3.3 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.identity.resolveDid 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 ResolveDid<'a> { 21 #[serde(borrow)] 22 pub did: jacquard_common::types::string::Did<'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 ResolveDidOutput<'a> { 37 /// The complete DID document for the identity. 38 #[serde(borrow)] 39 pub did_doc: jacquard_common::types::value::Data<'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 ResolveDidError<'a> { 57 /// The DID resolution process confirmed that there is no current DID. 58 #[serde(rename = "DidNotFound")] 59 DidNotFound(std::option::Option<String>), 60 /// The DID previously existed, but has been deactivated. 61 #[serde(rename = "DidDeactivated")] 62 DidDeactivated(std::option::Option<String>), 63} 64 65impl std::fmt::Display for ResolveDidError<'_> { 66 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 67 match self { 68 Self::DidNotFound(msg) => { 69 write!(f, "DidNotFound")?; 70 if let Some(msg) = msg { 71 write!(f, ": {}", msg)?; 72 } 73 Ok(()) 74 } 75 Self::DidDeactivated(msg) => { 76 write!(f, "DidDeactivated")?; 77 if let Some(msg) = msg { 78 write!(f, ": {}", msg)?; 79 } 80 Ok(()) 81 } 82 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 83 } 84 } 85} 86 87///Response type for 88///com.atproto.identity.resolveDid 89pub struct ResolveDidResponse; 90impl jacquard_common::xrpc::XrpcResp for ResolveDidResponse { 91 const NSID: &'static str = "com.atproto.identity.resolveDid"; 92 const ENCODING: &'static str = "application/json"; 93 type Output<'de> = ResolveDidOutput<'de>; 94 type Err<'de> = ResolveDidError<'de>; 95} 96 97impl<'a> jacquard_common::xrpc::XrpcRequest for ResolveDid<'a> { 98 const NSID: &'static str = "com.atproto.identity.resolveDid"; 99 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 100 type Response = ResolveDidResponse; 101} 102 103///Endpoint type for 104///com.atproto.identity.resolveDid 105pub struct ResolveDidRequest; 106impl jacquard_common::xrpc::XrpcEndpoint for ResolveDidRequest { 107 const PATH: &'static str = "/xrpc/com.atproto.identity.resolveDid"; 108 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 109 type Request<'de> = ResolveDid<'de>; 110 type Response = ResolveDidResponse; 111}