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::deps::smol_str::SmolStr;
14use jacquard_common::types::ident::AtIdentifier;
15use jacquard_common::types::string::{Did, Handle, UriValue};
16use jacquard_common::types::value::Data;
17use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
18use jacquard_derive::IntoStatic;
19use serde::{Deserialize, Serialize};
20
21#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
22#[serde(
23    rename_all = "camelCase",
24    bound(deserialize = "S: Deserialize<'de> + BosStr")
25)]
26pub struct ResolveMiniDoc<S: BosStr = DefaultStr> {
27    pub identifier: AtIdentifier<S>,
28}
29
30#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
31#[serde(
32    rename_all = "camelCase",
33    bound(deserialize = "S: Deserialize<'de> + BosStr")
34)]
35pub struct ResolveMiniDocOutput<S: BosStr = DefaultStr> {
36    ///DID, bi-directionally verified if a handle was provided in the query.
37    pub did: Did<S>,
38    /**The validated handle of the account or `handle.invalid` if the handle
39    did not bi-directionally match the DID document.*/
40    pub handle: Handle<S>,
41    ///The identity's PDS URL
42    pub pds: UriValue<S>,
43    /**The atproto signing key publicKeyMultibase
44
45    Legacy key encoding not supported. the key is returned directly; `id`,
46    `type`, and `controller` are omitted.*/
47    pub signing_key: S,
48    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
49    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
50}
51
52/** Response marker for the `com.bad-example.identity.resolveMiniDoc` query.
53
54Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `ResolveMiniDocOutput<S>` for this endpoint.*/
55pub struct ResolveMiniDocResponse;
56impl jacquard_common::xrpc::XrpcResp for ResolveMiniDocResponse {
57    const NSID: &'static str = "com.bad-example.identity.resolveMiniDoc";
58    const ENCODING: &'static str = "application/json";
59    type Output<S: BosStr> = ResolveMiniDocOutput<S>;
60    type Err = jacquard_common::xrpc::GenericError;
61}
62
63impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for ResolveMiniDoc<S> {
64    const NSID: &'static str = "com.bad-example.identity.resolveMiniDoc";
65    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
66    type Response = ResolveMiniDocResponse;
67}
68
69/** Endpoint marker for the `com.bad-example.identity.resolveMiniDoc` query.
70
71Path: `/xrpc/com.bad-example.identity.resolveMiniDoc`. The request payload type is `ResolveMiniDoc<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
72pub struct ResolveMiniDocRequest;
73impl jacquard_common::xrpc::XrpcEndpoint for ResolveMiniDocRequest {
74    const PATH: &'static str = "/xrpc/com.bad-example.identity.resolveMiniDoc";
75    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
76    type Request<S: BosStr> = ResolveMiniDoc<S>;
77    type Response = ResolveMiniDocResponse;
78}
79
80pub mod resolve_mini_doc_state {
81
82    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
83    #[allow(unused)]
84    use ::core::marker::PhantomData;
85    mod sealed {
86        pub trait Sealed {}
87    }
88    /// State trait tracking which required fields have been set
89    pub trait State: sealed::Sealed {
90        type Identifier;
91    }
92    /// Empty state - all required fields are unset
93    pub struct Empty(());
94    impl sealed::Sealed for Empty {}
95    impl State for Empty {
96        type Identifier = Unset;
97    }
98    ///State transition - sets the `identifier` field to Set
99    pub struct SetIdentifier<St: State = Empty>(PhantomData<fn() -> St>);
100    impl<St: State> sealed::Sealed for SetIdentifier<St> {}
101    impl<St: State> State for SetIdentifier<St> {
102        type Identifier = Set<members::identifier>;
103    }
104    /// Marker types for field names
105    #[allow(non_camel_case_types)]
106    pub mod members {
107        ///Marker type for the `identifier` field
108        pub struct identifier(());
109    }
110}
111
112/// Builder for constructing an instance of this type.
113pub struct ResolveMiniDocBuilder<St: resolve_mini_doc_state::State, S: BosStr = DefaultStr> {
114    _state: PhantomData<fn() -> St>,
115    _fields: (Option<AtIdentifier<S>>,),
116    _type: PhantomData<fn() -> S>,
117}
118
119impl ResolveMiniDoc<DefaultStr> {
120    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
121    pub fn new() -> ResolveMiniDocBuilder<resolve_mini_doc_state::Empty, DefaultStr> {
122        ResolveMiniDocBuilder::new()
123    }
124}
125
126impl<S: BosStr> ResolveMiniDoc<S> {
127    /// Create a new builder for this type
128    pub fn builder() -> ResolveMiniDocBuilder<resolve_mini_doc_state::Empty, S> {
129        ResolveMiniDocBuilder::builder()
130    }
131}
132
133impl ResolveMiniDocBuilder<resolve_mini_doc_state::Empty, DefaultStr> {
134    /// Create a new builder with all fields unset, using the default string type, if needed
135    pub fn new() -> Self {
136        ResolveMiniDocBuilder {
137            _state: PhantomData,
138            _fields: (None,),
139            _type: PhantomData,
140        }
141    }
142}
143
144impl<S: BosStr> ResolveMiniDocBuilder<resolve_mini_doc_state::Empty, S> {
145    /// Create a new builder with all fields unset
146    pub fn builder() -> Self {
147        ResolveMiniDocBuilder {
148            _state: PhantomData,
149            _fields: (None,),
150            _type: PhantomData,
151        }
152    }
153}
154
155impl<St, S: BosStr> ResolveMiniDocBuilder<St, S>
156where
157    St: resolve_mini_doc_state::State,
158    St::Identifier: resolve_mini_doc_state::IsUnset,
159{
160    /// Set the `identifier` field (required)
161    pub fn identifier(
162        mut self,
163        value: impl Into<AtIdentifier<S>>,
164    ) -> ResolveMiniDocBuilder<resolve_mini_doc_state::SetIdentifier<St>, S> {
165        self._fields.0 = Option::Some(value.into());
166        ResolveMiniDocBuilder {
167            _state: PhantomData,
168            _fields: self._fields,
169            _type: PhantomData,
170        }
171    }
172}
173
174impl<St, S: BosStr> ResolveMiniDocBuilder<St, S>
175where
176    St: resolve_mini_doc_state::State,
177    St::Identifier: resolve_mini_doc_state::IsSet,
178{
179    /// Build the final struct.
180    pub fn build(self) -> ResolveMiniDoc<S> {
181        ResolveMiniDoc {
182            identifier: self._fields.0.unwrap(),
183        }
184    }
185}