atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.notebook.getReadingHistory
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct GetReadingHistory<'a> {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 #[serde(borrow)]
21 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
22 ///(default: 50, min: 1, max: 100)
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 pub limit: std::option::Option<i64>,
25 ///(default: "all")
26 #[serde(skip_serializing_if = "std::option::Option::is_none")]
27 #[serde(borrow)]
28 pub status: std::option::Option<jacquard_common::CowStr<'a>>,
29}
30
31pub mod get_reading_history_state {
32
33 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
34 #[allow(unused)]
35 use ::core::marker::PhantomData;
36 mod sealed {
37 pub trait Sealed {}
38 }
39 /// State trait tracking which required fields have been set
40 pub trait State: sealed::Sealed {}
41 /// Empty state - all required fields are unset
42 pub struct Empty(());
43 impl sealed::Sealed for Empty {}
44 impl State for Empty {}
45 /// Marker types for field names
46 #[allow(non_camel_case_types)]
47 pub mod members {}
48}
49
50/// Builder for constructing an instance of this type
51pub struct GetReadingHistoryBuilder<'a, S: get_reading_history_state::State> {
52 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
53 __unsafe_private_named: (
54 ::core::option::Option<jacquard_common::CowStr<'a>>,
55 ::core::option::Option<i64>,
56 ::core::option::Option<jacquard_common::CowStr<'a>>,
57 ),
58 _phantom: ::core::marker::PhantomData<&'a ()>,
59}
60
61impl<'a> GetReadingHistory<'a> {
62 /// Create a new builder for this type
63 pub fn new() -> GetReadingHistoryBuilder<'a, get_reading_history_state::Empty> {
64 GetReadingHistoryBuilder::new()
65 }
66}
67
68impl<'a> GetReadingHistoryBuilder<'a, get_reading_history_state::Empty> {
69 /// Create a new builder with all fields unset
70 pub fn new() -> Self {
71 GetReadingHistoryBuilder {
72 _phantom_state: ::core::marker::PhantomData,
73 __unsafe_private_named: (None, None, None),
74 _phantom: ::core::marker::PhantomData,
75 }
76 }
77}
78
79impl<'a, S: get_reading_history_state::State> GetReadingHistoryBuilder<'a, S> {
80 /// Set the `cursor` field (optional)
81 pub fn cursor(
82 mut self,
83 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
84 ) -> Self {
85 self.__unsafe_private_named.0 = value.into();
86 self
87 }
88 /// Set the `cursor` field to an Option value (optional)
89 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
90 self.__unsafe_private_named.0 = value;
91 self
92 }
93}
94
95impl<'a, S: get_reading_history_state::State> GetReadingHistoryBuilder<'a, S> {
96 /// Set the `limit` field (optional)
97 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
98 self.__unsafe_private_named.1 = value.into();
99 self
100 }
101 /// Set the `limit` field to an Option value (optional)
102 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
103 self.__unsafe_private_named.1 = value;
104 self
105 }
106}
107
108impl<'a, S: get_reading_history_state::State> GetReadingHistoryBuilder<'a, S> {
109 /// Set the `status` field (optional)
110 pub fn status(
111 mut self,
112 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
113 ) -> Self {
114 self.__unsafe_private_named.2 = value.into();
115 self
116 }
117 /// Set the `status` field to an Option value (optional)
118 pub fn maybe_status(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
119 self.__unsafe_private_named.2 = value;
120 self
121 }
122}
123
124impl<'a, S> GetReadingHistoryBuilder<'a, S>
125where
126 S: get_reading_history_state::State,
127{
128 /// Build the final struct
129 pub fn build(self) -> GetReadingHistory<'a> {
130 GetReadingHistory {
131 cursor: self.__unsafe_private_named.0,
132 limit: self.__unsafe_private_named.1,
133 status: self.__unsafe_private_named.2,
134 }
135 }
136}
137
138#[jacquard_derive::lexicon]
139#[derive(
140 serde::Serialize,
141 serde::Deserialize,
142 Debug,
143 Clone,
144 PartialEq,
145 Eq,
146 jacquard_derive::IntoStatic
147)]
148#[serde(rename_all = "camelCase")]
149pub struct GetReadingHistoryOutput<'a> {
150 #[serde(skip_serializing_if = "std::option::Option::is_none")]
151 #[serde(borrow)]
152 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
153 #[serde(borrow)]
154 pub history: Vec<
155 crate::sh_weaver::notebook::get_reading_history::ReadingHistoryItem<'a>,
156 >,
157}
158
159/// Response type for
160///sh.weaver.notebook.getReadingHistory
161pub struct GetReadingHistoryResponse;
162impl jacquard_common::xrpc::XrpcResp for GetReadingHistoryResponse {
163 const NSID: &'static str = "sh.weaver.notebook.getReadingHistory";
164 const ENCODING: &'static str = "application/json";
165 type Output<'de> = GetReadingHistoryOutput<'de>;
166 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
167}
168
169impl<'a> jacquard_common::xrpc::XrpcRequest for GetReadingHistory<'a> {
170 const NSID: &'static str = "sh.weaver.notebook.getReadingHistory";
171 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
172 type Response = GetReadingHistoryResponse;
173}
174
175/// Endpoint type for
176///sh.weaver.notebook.getReadingHistory
177pub struct GetReadingHistoryRequest;
178impl jacquard_common::xrpc::XrpcEndpoint for GetReadingHistoryRequest {
179 const PATH: &'static str = "/xrpc/sh.weaver.notebook.getReadingHistory";
180 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
181 type Request<'de> = GetReadingHistory<'de>;
182 type Response = GetReadingHistoryResponse;
183}
184
185#[jacquard_derive::lexicon]
186#[derive(
187 serde::Serialize,
188 serde::Deserialize,
189 Debug,
190 Clone,
191 PartialEq,
192 Eq,
193 jacquard_derive::IntoStatic
194)]
195#[serde(rename_all = "camelCase")]
196pub struct ReadingHistoryItem<'a> {
197 /// The entry the user was last reading.
198 #[serde(skip_serializing_if = "std::option::Option::is_none")]
199 #[serde(borrow)]
200 pub current_entry: std::option::Option<crate::sh_weaver::notebook::EntryView<'a>>,
201 #[serde(borrow)]
202 pub notebook: crate::sh_weaver::notebook::NotebookView<'a>,
203 #[serde(borrow)]
204 pub progress: crate::sh_weaver::notebook::ReadingProgress<'a>,
205}
206
207pub mod reading_history_item_state {
208
209 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
210 #[allow(unused)]
211 use ::core::marker::PhantomData;
212 mod sealed {
213 pub trait Sealed {}
214 }
215 /// State trait tracking which required fields have been set
216 pub trait State: sealed::Sealed {
217 type Notebook;
218 type Progress;
219 }
220 /// Empty state - all required fields are unset
221 pub struct Empty(());
222 impl sealed::Sealed for Empty {}
223 impl State for Empty {
224 type Notebook = Unset;
225 type Progress = Unset;
226 }
227 ///State transition - sets the `notebook` field to Set
228 pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>);
229 impl<S: State> sealed::Sealed for SetNotebook<S> {}
230 impl<S: State> State for SetNotebook<S> {
231 type Notebook = Set<members::notebook>;
232 type Progress = S::Progress;
233 }
234 ///State transition - sets the `progress` field to Set
235 pub struct SetProgress<S: State = Empty>(PhantomData<fn() -> S>);
236 impl<S: State> sealed::Sealed for SetProgress<S> {}
237 impl<S: State> State for SetProgress<S> {
238 type Notebook = S::Notebook;
239 type Progress = Set<members::progress>;
240 }
241 /// Marker types for field names
242 #[allow(non_camel_case_types)]
243 pub mod members {
244 ///Marker type for the `notebook` field
245 pub struct notebook(());
246 ///Marker type for the `progress` field
247 pub struct progress(());
248 }
249}
250
251/// Builder for constructing an instance of this type
252pub struct ReadingHistoryItemBuilder<'a, S: reading_history_item_state::State> {
253 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
254 __unsafe_private_named: (
255 ::core::option::Option<crate::sh_weaver::notebook::EntryView<'a>>,
256 ::core::option::Option<crate::sh_weaver::notebook::NotebookView<'a>>,
257 ::core::option::Option<crate::sh_weaver::notebook::ReadingProgress<'a>>,
258 ),
259 _phantom: ::core::marker::PhantomData<&'a ()>,
260}
261
262impl<'a> ReadingHistoryItem<'a> {
263 /// Create a new builder for this type
264 pub fn new() -> ReadingHistoryItemBuilder<'a, reading_history_item_state::Empty> {
265 ReadingHistoryItemBuilder::new()
266 }
267}
268
269impl<'a> ReadingHistoryItemBuilder<'a, reading_history_item_state::Empty> {
270 /// Create a new builder with all fields unset
271 pub fn new() -> Self {
272 ReadingHistoryItemBuilder {
273 _phantom_state: ::core::marker::PhantomData,
274 __unsafe_private_named: (None, None, None),
275 _phantom: ::core::marker::PhantomData,
276 }
277 }
278}
279
280impl<'a, S: reading_history_item_state::State> ReadingHistoryItemBuilder<'a, S> {
281 /// Set the `currentEntry` field (optional)
282 pub fn current_entry(
283 mut self,
284 value: impl Into<Option<crate::sh_weaver::notebook::EntryView<'a>>>,
285 ) -> Self {
286 self.__unsafe_private_named.0 = value.into();
287 self
288 }
289 /// Set the `currentEntry` field to an Option value (optional)
290 pub fn maybe_current_entry(
291 mut self,
292 value: Option<crate::sh_weaver::notebook::EntryView<'a>>,
293 ) -> Self {
294 self.__unsafe_private_named.0 = value;
295 self
296 }
297}
298
299impl<'a, S> ReadingHistoryItemBuilder<'a, S>
300where
301 S: reading_history_item_state::State,
302 S::Notebook: reading_history_item_state::IsUnset,
303{
304 /// Set the `notebook` field (required)
305 pub fn notebook(
306 mut self,
307 value: impl Into<crate::sh_weaver::notebook::NotebookView<'a>>,
308 ) -> ReadingHistoryItemBuilder<'a, reading_history_item_state::SetNotebook<S>> {
309 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
310 ReadingHistoryItemBuilder {
311 _phantom_state: ::core::marker::PhantomData,
312 __unsafe_private_named: self.__unsafe_private_named,
313 _phantom: ::core::marker::PhantomData,
314 }
315 }
316}
317
318impl<'a, S> ReadingHistoryItemBuilder<'a, S>
319where
320 S: reading_history_item_state::State,
321 S::Progress: reading_history_item_state::IsUnset,
322{
323 /// Set the `progress` field (required)
324 pub fn progress(
325 mut self,
326 value: impl Into<crate::sh_weaver::notebook::ReadingProgress<'a>>,
327 ) -> ReadingHistoryItemBuilder<'a, reading_history_item_state::SetProgress<S>> {
328 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
329 ReadingHistoryItemBuilder {
330 _phantom_state: ::core::marker::PhantomData,
331 __unsafe_private_named: self.__unsafe_private_named,
332 _phantom: ::core::marker::PhantomData,
333 }
334 }
335}
336
337impl<'a, S> ReadingHistoryItemBuilder<'a, S>
338where
339 S: reading_history_item_state::State,
340 S::Notebook: reading_history_item_state::IsSet,
341 S::Progress: reading_history_item_state::IsSet,
342{
343 /// Build the final struct
344 pub fn build(self) -> ReadingHistoryItem<'a> {
345 ReadingHistoryItem {
346 current_entry: self.__unsafe_private_named.0,
347 notebook: self.__unsafe_private_named.1.unwrap(),
348 progress: self.__unsafe_private_named.2.unwrap(),
349 extra_data: Default::default(),
350 }
351 }
352 /// Build the final struct with custom extra_data
353 pub fn build_with_data(
354 self,
355 extra_data: std::collections::BTreeMap<
356 jacquard_common::smol_str::SmolStr,
357 jacquard_common::types::value::Data<'a>,
358 >,
359 ) -> ReadingHistoryItem<'a> {
360 ReadingHistoryItem {
361 current_entry: self.__unsafe_private_named.0,
362 notebook: self.__unsafe_private_named.1.unwrap(),
363 progress: self.__unsafe_private_named.2.unwrap(),
364 extra_data: Some(extra_data),
365 }
366 }
367}
368
369fn lexicon_doc_sh_weaver_notebook_getReadingHistory() -> ::jacquard_lexicon::lexicon::LexiconDoc<
370 'static,
371> {
372 ::jacquard_lexicon::lexicon::LexiconDoc {
373 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
374 id: ::jacquard_common::CowStr::new_static(
375 "sh.weaver.notebook.getReadingHistory",
376 ),
377 revision: None,
378 description: None,
379 defs: {
380 let mut map = ::alloc::collections::BTreeMap::new();
381 map.insert(
382 ::jacquard_common::smol_str::SmolStr::new_static("main"),
383 ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
384 description: None,
385 parameters: Some(
386 ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
387 description: None,
388 required: None,
389 properties: {
390 #[allow(unused_mut)]
391 let mut map = ::alloc::collections::BTreeMap::new();
392 map.insert(
393 ::jacquard_common::smol_str::SmolStr::new_static("cursor"),
394 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
395 description: None,
396 format: None,
397 default: None,
398 min_length: None,
399 max_length: None,
400 min_graphemes: None,
401 max_graphemes: None,
402 r#enum: None,
403 r#const: None,
404 known_values: None,
405 }),
406 );
407 map.insert(
408 ::jacquard_common::smol_str::SmolStr::new_static("limit"),
409 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
410 description: None,
411 default: None,
412 minimum: None,
413 maximum: None,
414 r#enum: None,
415 r#const: None,
416 }),
417 );
418 map.insert(
419 ::jacquard_common::smol_str::SmolStr::new_static("status"),
420 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
421 description: Some(
422 ::jacquard_common::CowStr::new_static(
423 "Filter by reading status.",
424 ),
425 ),
426 format: None,
427 default: None,
428 min_length: None,
429 max_length: None,
430 min_graphemes: None,
431 max_graphemes: None,
432 r#enum: None,
433 r#const: None,
434 known_values: None,
435 }),
436 );
437 map
438 },
439 }),
440 ),
441 output: None,
442 errors: None,
443 }),
444 );
445 map.insert(
446 ::jacquard_common::smol_str::SmolStr::new_static("readingHistoryItem"),
447 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
448 description: None,
449 required: Some(
450 vec![
451 ::jacquard_common::smol_str::SmolStr::new_static("notebook"),
452 ::jacquard_common::smol_str::SmolStr::new_static("progress")
453 ],
454 ),
455 nullable: None,
456 properties: {
457 #[allow(unused_mut)]
458 let mut map = ::alloc::collections::BTreeMap::new();
459 map.insert(
460 ::jacquard_common::smol_str::SmolStr::new_static(
461 "currentEntry",
462 ),
463 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
464 description: None,
465 r#ref: ::jacquard_common::CowStr::new_static(
466 "sh.weaver.notebook.defs#entryView",
467 ),
468 }),
469 );
470 map.insert(
471 ::jacquard_common::smol_str::SmolStr::new_static("notebook"),
472 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
473 description: None,
474 r#ref: ::jacquard_common::CowStr::new_static(
475 "sh.weaver.notebook.defs#notebookView",
476 ),
477 }),
478 );
479 map.insert(
480 ::jacquard_common::smol_str::SmolStr::new_static("progress"),
481 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
482 description: None,
483 r#ref: ::jacquard_common::CowStr::new_static(
484 "sh.weaver.notebook.defs#readingProgress",
485 ),
486 }),
487 );
488 map
489 },
490 }),
491 );
492 map
493 },
494 }
495}
496
497impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReadingHistoryItem<'a> {
498 fn nsid() -> &'static str {
499 "sh.weaver.notebook.getReadingHistory"
500 }
501 fn def_name() -> &'static str {
502 "readingHistoryItem"
503 }
504 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
505 lexicon_doc_sh_weaver_notebook_getReadingHistory()
506 }
507 fn validate(
508 &self,
509 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
510 Ok(())
511 }
512}