Skip to main content

jacquard_api/com_bad_example/identity/
resolve_mini_doc.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.bad-example.identity.resolveMiniDoc
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14use jacquard_common::types::ident::AtIdentifier;
15use jacquard_common::types::string::{Did, Handle, UriValue};
16use jacquard_derive::{IntoStatic, lexicon};
17use serde::{Serialize, Deserialize};
18
19#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
20#[serde(rename_all = "camelCase")]
21pub struct ResolveMiniDoc<'a> {
22    #[serde(borrow)]
23    pub identifier: AtIdentifier<'a>,
24}
25
26
27#[lexicon]
28#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
29#[serde(rename_all = "camelCase")]
30pub struct ResolveMiniDocOutput<'a> {
31    ///DID, bi-directionally verified if a handle was provided in the query.
32    #[serde(borrow)]
33    pub did: Did<'a>,
34    /**The validated handle of the account or `handle.invalid` if the handle
35did not bi-directionally match the DID document.*/
36    #[serde(borrow)]
37    pub handle: Handle<'a>,
38    ///The identity's PDS URL
39    #[serde(borrow)]
40    pub pds: UriValue<'a>,
41    /**The atproto signing key publicKeyMultibase
42
43Legacy key encoding not supported. the key is returned directly; `id`,
44`type`, and `controller` are omitted.*/
45    #[serde(borrow)]
46    pub signing_key: CowStr<'a>,
47}
48
49/// Response type for com.bad-example.identity.resolveMiniDoc
50pub struct ResolveMiniDocResponse;
51impl jacquard_common::xrpc::XrpcResp for ResolveMiniDocResponse {
52    const NSID: &'static str = "com.bad-example.identity.resolveMiniDoc";
53    const ENCODING: &'static str = "application/json";
54    type Output<'de> = ResolveMiniDocOutput<'de>;
55    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
56}
57
58impl<'a> jacquard_common::xrpc::XrpcRequest for ResolveMiniDoc<'a> {
59    const NSID: &'static str = "com.bad-example.identity.resolveMiniDoc";
60    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
61    type Response = ResolveMiniDocResponse;
62}
63
64/// Endpoint type for com.bad-example.identity.resolveMiniDoc
65pub struct ResolveMiniDocRequest;
66impl jacquard_common::xrpc::XrpcEndpoint for ResolveMiniDocRequest {
67    const PATH: &'static str = "/xrpc/com.bad-example.identity.resolveMiniDoc";
68    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
69    type Request<'de> = ResolveMiniDoc<'de>;
70    type Response = ResolveMiniDocResponse;
71}
72
73pub mod resolve_mini_doc_state {
74
75    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
76    #[allow(unused)]
77    use ::core::marker::PhantomData;
78    mod sealed {
79        pub trait Sealed {}
80    }
81    /// State trait tracking which required fields have been set
82    pub trait State: sealed::Sealed {
83        type Identifier;
84    }
85    /// Empty state - all required fields are unset
86    pub struct Empty(());
87    impl sealed::Sealed for Empty {}
88    impl State for Empty {
89        type Identifier = Unset;
90    }
91    ///State transition - sets the `identifier` field to Set
92    pub struct SetIdentifier<S: State = Empty>(PhantomData<fn() -> S>);
93    impl<S: State> sealed::Sealed for SetIdentifier<S> {}
94    impl<S: State> State for SetIdentifier<S> {
95        type Identifier = Set<members::identifier>;
96    }
97    /// Marker types for field names
98    #[allow(non_camel_case_types)]
99    pub mod members {
100        ///Marker type for the `identifier` field
101        pub struct identifier(());
102    }
103}
104
105/// Builder for constructing an instance of this type
106pub struct ResolveMiniDocBuilder<'a, S: resolve_mini_doc_state::State> {
107    _state: PhantomData<fn() -> S>,
108    _fields: (Option<AtIdentifier<'a>>,),
109    _lifetime: PhantomData<&'a ()>,
110}
111
112impl<'a> ResolveMiniDoc<'a> {
113    /// Create a new builder for this type
114    pub fn new() -> ResolveMiniDocBuilder<'a, resolve_mini_doc_state::Empty> {
115        ResolveMiniDocBuilder::new()
116    }
117}
118
119impl<'a> ResolveMiniDocBuilder<'a, resolve_mini_doc_state::Empty> {
120    /// Create a new builder with all fields unset
121    pub fn new() -> Self {
122        ResolveMiniDocBuilder {
123            _state: PhantomData,
124            _fields: (None,),
125            _lifetime: PhantomData,
126        }
127    }
128}
129
130impl<'a, S> ResolveMiniDocBuilder<'a, S>
131where
132    S: resolve_mini_doc_state::State,
133    S::Identifier: resolve_mini_doc_state::IsUnset,
134{
135    /// Set the `identifier` field (required)
136    pub fn identifier(
137        mut self,
138        value: impl Into<AtIdentifier<'a>>,
139    ) -> ResolveMiniDocBuilder<'a, resolve_mini_doc_state::SetIdentifier<S>> {
140        self._fields.0 = Option::Some(value.into());
141        ResolveMiniDocBuilder {
142            _state: PhantomData,
143            _fields: self._fields,
144            _lifetime: PhantomData,
145        }
146    }
147}
148
149impl<'a, S> ResolveMiniDocBuilder<'a, S>
150where
151    S: resolve_mini_doc_state::State,
152    S::Identifier: resolve_mini_doc_state::IsSet,
153{
154    /// Build the final struct
155    pub fn build(self) -> ResolveMiniDoc<'a> {
156        ResolveMiniDoc {
157            identifier: self._fields.0.unwrap(),
158        }
159    }
160}