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