// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.identity.resolveHandle // // 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, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ResolveHandle<'a> { #[serde(borrow)] pub handle: jacquard_common::types::string::Handle<'a>, } pub mod resolve_handle_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Handle = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type Handle = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `handle` field pub struct handle(()); } } /// Builder for constructing an instance of this type pub struct ResolveHandleBuilder<'a, S: resolve_handle_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ResolveHandle<'a> { /// Create a new builder for this type pub fn new() -> ResolveHandleBuilder<'a, resolve_handle_state::Empty> { ResolveHandleBuilder::new() } } impl<'a> ResolveHandleBuilder<'a, resolve_handle_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ResolveHandleBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ResolveHandleBuilder<'a, S> where S: resolve_handle_state::State, S::Handle: resolve_handle_state::IsUnset, { /// Set the `handle` field (required) pub fn handle( mut self, value: impl Into>, ) -> ResolveHandleBuilder<'a, resolve_handle_state::SetHandle> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ResolveHandleBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ResolveHandleBuilder<'a, S> where S: resolve_handle_state::State, S::Handle: resolve_handle_state::IsSet, { /// Build the final struct pub fn build(self) -> ResolveHandle<'a> { ResolveHandle { handle: self.__unsafe_private_named.0.unwrap(), } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ResolveHandleOutput<'a> { #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, jacquard_derive::IntoStatic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum ResolveHandleError<'a> { /// The resolution process confirmed that the handle does not resolve to any DID. #[serde(rename = "HandleNotFound")] HandleNotFound(std::option::Option>), } impl core::fmt::Display for ResolveHandleError<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HandleNotFound(msg) => { write!(f, "HandleNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } /// Response type for ///com.atproto.identity.resolveHandle pub struct ResolveHandleResponse; impl jacquard_common::xrpc::XrpcResp for ResolveHandleResponse { const NSID: &'static str = "com.atproto.identity.resolveHandle"; const ENCODING: &'static str = "application/json"; type Output<'de> = ResolveHandleOutput<'de>; type Err<'de> = ResolveHandleError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for ResolveHandle<'a> { const NSID: &'static str = "com.atproto.identity.resolveHandle"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = ResolveHandleResponse; } /// Endpoint type for ///com.atproto.identity.resolveHandle pub struct ResolveHandleRequest; impl jacquard_common::xrpc::XrpcEndpoint for ResolveHandleRequest { const PATH: &'static str = "/xrpc/com.atproto.identity.resolveHandle"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = ResolveHandle<'de>; type Response = ResolveHandleResponse; }