atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.unspecced.getConfig
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct LiveNowConfig<'a> {
20 #[serde(borrow)]
21 pub did: jacquard_common::types::string::Did<'a>,
22 #[serde(borrow)]
23 pub domains: Vec<jacquard_common::CowStr<'a>>,
24}
25
26pub mod live_now_config_state {
27
28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
29 #[allow(unused)]
30 use ::core::marker::PhantomData;
31 mod sealed {
32 pub trait Sealed {}
33 }
34 /// State trait tracking which required fields have been set
35 pub trait State: sealed::Sealed {
36 type Domains;
37 type Did;
38 }
39 /// Empty state - all required fields are unset
40 pub struct Empty(());
41 impl sealed::Sealed for Empty {}
42 impl State for Empty {
43 type Domains = Unset;
44 type Did = Unset;
45 }
46 ///State transition - sets the `domains` field to Set
47 pub struct SetDomains<S: State = Empty>(PhantomData<fn() -> S>);
48 impl<S: State> sealed::Sealed for SetDomains<S> {}
49 impl<S: State> State for SetDomains<S> {
50 type Domains = Set<members::domains>;
51 type Did = S::Did;
52 }
53 ///State transition - sets the `did` field to Set
54 pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
55 impl<S: State> sealed::Sealed for SetDid<S> {}
56 impl<S: State> State for SetDid<S> {
57 type Domains = S::Domains;
58 type Did = Set<members::did>;
59 }
60 /// Marker types for field names
61 #[allow(non_camel_case_types)]
62 pub mod members {
63 ///Marker type for the `domains` field
64 pub struct domains(());
65 ///Marker type for the `did` field
66 pub struct did(());
67 }
68}
69
70/// Builder for constructing an instance of this type
71pub struct LiveNowConfigBuilder<'a, S: live_now_config_state::State> {
72 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
73 __unsafe_private_named: (
74 ::core::option::Option<jacquard_common::types::string::Did<'a>>,
75 ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>,
76 ),
77 _phantom: ::core::marker::PhantomData<&'a ()>,
78}
79
80impl<'a> LiveNowConfig<'a> {
81 /// Create a new builder for this type
82 pub fn new() -> LiveNowConfigBuilder<'a, live_now_config_state::Empty> {
83 LiveNowConfigBuilder::new()
84 }
85}
86
87impl<'a> LiveNowConfigBuilder<'a, live_now_config_state::Empty> {
88 /// Create a new builder with all fields unset
89 pub fn new() -> Self {
90 LiveNowConfigBuilder {
91 _phantom_state: ::core::marker::PhantomData,
92 __unsafe_private_named: (None, None),
93 _phantom: ::core::marker::PhantomData,
94 }
95 }
96}
97
98impl<'a, S> LiveNowConfigBuilder<'a, S>
99where
100 S: live_now_config_state::State,
101 S::Did: live_now_config_state::IsUnset,
102{
103 /// Set the `did` field (required)
104 pub fn did(
105 mut self,
106 value: impl Into<jacquard_common::types::string::Did<'a>>,
107 ) -> LiveNowConfigBuilder<'a, live_now_config_state::SetDid<S>> {
108 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
109 LiveNowConfigBuilder {
110 _phantom_state: ::core::marker::PhantomData,
111 __unsafe_private_named: self.__unsafe_private_named,
112 _phantom: ::core::marker::PhantomData,
113 }
114 }
115}
116
117impl<'a, S> LiveNowConfigBuilder<'a, S>
118where
119 S: live_now_config_state::State,
120 S::Domains: live_now_config_state::IsUnset,
121{
122 /// Set the `domains` field (required)
123 pub fn domains(
124 mut self,
125 value: impl Into<Vec<jacquard_common::CowStr<'a>>>,
126 ) -> LiveNowConfigBuilder<'a, live_now_config_state::SetDomains<S>> {
127 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
128 LiveNowConfigBuilder {
129 _phantom_state: ::core::marker::PhantomData,
130 __unsafe_private_named: self.__unsafe_private_named,
131 _phantom: ::core::marker::PhantomData,
132 }
133 }
134}
135
136impl<'a, S> LiveNowConfigBuilder<'a, S>
137where
138 S: live_now_config_state::State,
139 S::Domains: live_now_config_state::IsSet,
140 S::Did: live_now_config_state::IsSet,
141{
142 /// Build the final struct
143 pub fn build(self) -> LiveNowConfig<'a> {
144 LiveNowConfig {
145 did: self.__unsafe_private_named.0.unwrap(),
146 domains: self.__unsafe_private_named.1.unwrap(),
147 extra_data: Default::default(),
148 }
149 }
150 /// Build the final struct with custom extra_data
151 pub fn build_with_data(
152 self,
153 extra_data: std::collections::BTreeMap<
154 jacquard_common::smol_str::SmolStr,
155 jacquard_common::types::value::Data<'a>,
156 >,
157 ) -> LiveNowConfig<'a> {
158 LiveNowConfig {
159 did: self.__unsafe_private_named.0.unwrap(),
160 domains: self.__unsafe_private_named.1.unwrap(),
161 extra_data: Some(extra_data),
162 }
163 }
164}
165
166fn lexicon_doc_app_bsky_unspecced_getConfig() -> ::jacquard_lexicon::lexicon::LexiconDoc<
167 'static,
168> {
169 ::jacquard_lexicon::lexicon::LexiconDoc {
170 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
171 id: ::jacquard_common::CowStr::new_static("app.bsky.unspecced.getConfig"),
172 revision: None,
173 description: None,
174 defs: {
175 let mut map = ::alloc::collections::BTreeMap::new();
176 map.insert(
177 ::jacquard_common::smol_str::SmolStr::new_static("liveNowConfig"),
178 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
179 description: None,
180 required: Some(
181 vec![
182 ::jacquard_common::smol_str::SmolStr::new_static("did"),
183 ::jacquard_common::smol_str::SmolStr::new_static("domains")
184 ],
185 ),
186 nullable: None,
187 properties: {
188 #[allow(unused_mut)]
189 let mut map = ::alloc::collections::BTreeMap::new();
190 map.insert(
191 ::jacquard_common::smol_str::SmolStr::new_static("did"),
192 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
193 description: None,
194 format: Some(
195 ::jacquard_lexicon::lexicon::LexStringFormat::Did,
196 ),
197 default: None,
198 min_length: None,
199 max_length: None,
200 min_graphemes: None,
201 max_graphemes: None,
202 r#enum: None,
203 r#const: None,
204 known_values: None,
205 }),
206 );
207 map.insert(
208 ::jacquard_common::smol_str::SmolStr::new_static("domains"),
209 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
210 description: None,
211 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
212 description: None,
213 format: None,
214 default: None,
215 min_length: None,
216 max_length: None,
217 min_graphemes: None,
218 max_graphemes: None,
219 r#enum: None,
220 r#const: None,
221 known_values: None,
222 }),
223 min_length: None,
224 max_length: None,
225 }),
226 );
227 map
228 },
229 }),
230 );
231 map.insert(
232 ::jacquard_common::smol_str::SmolStr::new_static("main"),
233 ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
234 description: None,
235 parameters: None,
236 output: None,
237 errors: None,
238 }),
239 );
240 map
241 },
242 }
243}
244
245impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LiveNowConfig<'a> {
246 fn nsid() -> &'static str {
247 "app.bsky.unspecced.getConfig"
248 }
249 fn def_name() -> &'static str {
250 "liveNowConfig"
251 }
252 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
253 lexicon_doc_app_bsky_unspecced_getConfig()
254 }
255 fn validate(
256 &self,
257 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
258 Ok(())
259 }
260}
261
262#[jacquard_derive::lexicon]
263#[derive(
264 serde::Serialize,
265 serde::Deserialize,
266 Debug,
267 Clone,
268 PartialEq,
269 Eq,
270 jacquard_derive::IntoStatic,
271 Default
272)]
273#[serde(rename_all = "camelCase")]
274pub struct GetConfigOutput<'a> {
275 #[serde(skip_serializing_if = "std::option::Option::is_none")]
276 pub check_email_confirmed: std::option::Option<bool>,
277 #[serde(skip_serializing_if = "std::option::Option::is_none")]
278 #[serde(borrow)]
279 pub live_now: std::option::Option<
280 Vec<crate::app_bsky::unspecced::get_config::LiveNowConfig<'a>>,
281 >,
282}
283
284/// XRPC request marker type
285#[derive(
286 Debug,
287 Clone,
288 Copy,
289 PartialEq,
290 Eq,
291 serde::Serialize,
292 serde::Deserialize,
293 jacquard_derive::IntoStatic
294)]
295pub struct GetConfig;
296/// Response type for
297///app.bsky.unspecced.getConfig
298pub struct GetConfigResponse;
299impl jacquard_common::xrpc::XrpcResp for GetConfigResponse {
300 const NSID: &'static str = "app.bsky.unspecced.getConfig";
301 const ENCODING: &'static str = "application/json";
302 type Output<'de> = GetConfigOutput<'de>;
303 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
304}
305
306impl jacquard_common::xrpc::XrpcRequest for GetConfig {
307 const NSID: &'static str = "app.bsky.unspecced.getConfig";
308 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
309 type Response = GetConfigResponse;
310}
311
312/// Endpoint type for
313///app.bsky.unspecced.getConfig
314pub struct GetConfigRequest;
315impl jacquard_common::xrpc::XrpcEndpoint for GetConfigRequest {
316 const PATH: &'static str = "/xrpc/app.bsky.unspecced.getConfig";
317 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
318 type Request<'de> = GetConfig;
319 type Response = GetConfigResponse;
320}