// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.identity.resolveDid // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder )] #[builder(start_fn = new)] #[serde(rename_all = "camelCase")] pub struct ResolveDid<'a> { #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, } impl jacquard_common::IntoStatic for ResolveDid<'_> { type Output = ResolveDid<'static>; fn into_static(self) -> Self::Output { ResolveDid { did: self.did.into_static(), } } } #[jacquard_derive::lexicon] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct ResolveDidOutput<'a> { ///The complete DID document for the identity. #[serde(borrow)] pub did_doc: jacquard_common::types::value::Data<'a>, } impl jacquard_common::IntoStatic for ResolveDidOutput<'_> { type Output = ResolveDidOutput<'static>; fn into_static(self) -> Self::Output { ResolveDidOutput { did_doc: self.did_doc.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum ResolveDidError<'a> { ///The DID resolution process confirmed that there is no current DID. #[serde(rename = "DidNotFound")] DidNotFound(std::option::Option), ///The DID previously existed, but has been deactivated. #[serde(rename = "DidDeactivated")] DidDeactivated(std::option::Option), } impl std::fmt::Display for ResolveDidError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::DidNotFound(msg) => { write!(f, "DidNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::DidDeactivated(msg) => { write!(f, "DidDeactivated")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for ResolveDidError<'_> { type Output = ResolveDidError<'static>; fn into_static(self) -> Self::Output { match self { ResolveDidError::DidNotFound(v) => { ResolveDidError::DidNotFound(v.into_static()) } ResolveDidError::DidDeactivated(v) => { ResolveDidError::DidDeactivated(v.into_static()) } ResolveDidError::Unknown(v) => ResolveDidError::Unknown(v.into_static()), } } } impl jacquard_common::types::xrpc::XrpcRequest for ResolveDid<'_> { const NSID: &'static str = "com.atproto.identity.resolveDid"; const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; const OUTPUT_ENCODING: &'static str = "application/json"; type Output<'de> = ResolveDidOutput<'de>; type Err<'de> = ResolveDidError<'de>; }