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