1pub mod authors;
9pub mod book;
10pub mod chapter;
11pub mod colour_scheme;
12pub mod entry;
13pub mod get_book_entry;
14pub mod get_chapter;
15pub mod get_continue_reading;
16pub mod get_entry;
17pub mod get_entry_by_title;
18pub mod get_entry_detail;
19pub mod get_entry_feed;
20pub mod get_entry_notebooks;
21pub mod get_notebook;
22pub mod get_notebook_by_title;
23pub mod get_notebook_chapters;
24pub mod get_notebook_detail;
25pub mod get_notebook_feed;
26pub mod get_page;
27pub mod get_published_versions;
28pub mod get_reading_history;
29pub mod get_similar_notebooks;
30pub mod get_suggested_notebooks;
31pub mod page;
32pub mod resolve_entry;
33pub mod resolve_notebook;
34pub mod resolve_version_conflict;
35pub mod search_entries;
36pub mod search_notebooks;
37pub mod theme;
38pub mod update_reading_progress;
39
40
41#[allow(unused_imports)]
42use alloc::collections::BTreeMap;
43
44#[allow(unused_imports)]
45use core::marker::PhantomData;
46use jacquard_common::CowStr;
47
48#[allow(unused_imports)]
49use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
50use jacquard_common::types::blob::BlobRef;
51use jacquard_common::types::string::{Did, AtUri, Cid, Datetime};
52use jacquard_common::types::value::Data;
53use jacquard_derive::{IntoStatic, lexicon, open_union};
54use jacquard_lexicon::lexicon::LexiconDoc;
55use jacquard_lexicon::schema::LexiconSchema;
56
57#[allow(unused_imports)]
58use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
59use serde::{Serialize, Deserialize};
60use crate::com_atproto::repo::strong_ref::StrongRef;
61use crate::sh_weaver::actor::ProfileDataView;
62use crate::sh_weaver::actor::ProfileViewBasic;
63use crate::sh_weaver::notebook;
64
65#[lexicon]
66#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
67#[serde(rename_all = "camelCase")]
68pub struct AuthorListView<'a> {
69 pub index: i64,
70 #[serde(borrow)]
71 pub record: ProfileDataView<'a>,
72 #[serde(skip_serializing_if = "Option::is_none")]
73 #[serde(borrow)]
74 pub uri: Option<AtUri<'a>>,
75}
76
77
78#[lexicon]
79#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
80#[serde(rename_all = "camelCase")]
81pub struct BookEntryRef<'a> {
82 #[serde(borrow)]
83 pub entry: notebook::EntryView<'a>,
84}
85
86#[lexicon]
89#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
90#[serde(rename_all = "camelCase")]
91pub struct BookEntryView<'a> {
92 #[serde(borrow)]
93 pub entry: notebook::EntryView<'a>,
94 pub index: i64,
95 #[serde(skip_serializing_if = "Option::is_none")]
96 #[serde(borrow)]
97 pub next: Option<notebook::BookEntryRef<'a>>,
98 #[serde(skip_serializing_if = "Option::is_none")]
99 #[serde(borrow)]
100 pub prev: Option<notebook::BookEntryRef<'a>>,
101}
102
103#[lexicon]
106#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
107#[serde(rename_all = "camelCase")]
108pub struct ChapterEntryView<'a> {
109 #[serde(borrow)]
110 pub entry: notebook::EntryView<'a>,
111 pub index: i64,
112 #[serde(skip_serializing_if = "Option::is_none")]
113 #[serde(borrow)]
114 pub next: Option<notebook::BookEntryRef<'a>>,
115 #[serde(skip_serializing_if = "Option::is_none")]
116 #[serde(borrow)]
117 pub prev: Option<notebook::BookEntryRef<'a>>,
118}
119
120#[lexicon]
123#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
124#[serde(rename_all = "camelCase")]
125pub struct ChapterView<'a> {
126 #[serde(borrow)]
127 pub authors: Vec<notebook::AuthorListView<'a>>,
128 #[serde(borrow)]
129 pub cid: Cid<'a>,
130 #[serde(skip_serializing_if = "Option::is_none")]
131 pub entry_count: Option<i64>,
132 pub indexed_at: Datetime,
133 #[serde(borrow)]
134 pub notebook: notebook::NotebookView<'a>,
135 #[serde(borrow)]
136 pub record: Data<'a>,
137 #[serde(skip_serializing_if = "Option::is_none")]
138 #[serde(borrow)]
139 pub tags: Option<notebook::Tags<'a>>,
140 #[serde(skip_serializing_if = "Option::is_none")]
141 #[serde(borrow)]
142 pub title: Option<notebook::Title<'a>>,
143 #[serde(borrow)]
144 pub uri: AtUri<'a>,
145}
146
147#[lexicon]
150#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
151#[serde(rename_all = "camelCase")]
152pub struct ContentFormat<'a> {
153 #[serde(skip_serializing_if = "Option::is_none")]
155 #[serde(default = "_default_content_format_markdown")]
156 #[serde(borrow)]
157 pub markdown: Option<CowStr<'a>>,
158}
159
160#[derive(Debug, Clone, PartialEq, Eq, Hash)]
163pub enum ContentRating<'a> {
164 General,
165 Teen,
166 Mature,
167 Explicit,
168 Other(CowStr<'a>),
169}
170
171impl<'a> ContentRating<'a> {
172 pub fn as_str(&self) -> &str {
173 match self {
174 Self::General => "general",
175 Self::Teen => "teen",
176 Self::Mature => "mature",
177 Self::Explicit => "explicit",
178 Self::Other(s) => s.as_ref(),
179 }
180 }
181}
182
183impl<'a> From<&'a str> for ContentRating<'a> {
184 fn from(s: &'a str) -> Self {
185 match s {
186 "general" => Self::General,
187 "teen" => Self::Teen,
188 "mature" => Self::Mature,
189 "explicit" => Self::Explicit,
190 _ => Self::Other(CowStr::from(s)),
191 }
192 }
193}
194
195impl<'a> From<String> for ContentRating<'a> {
196 fn from(s: String) -> Self {
197 match s.as_str() {
198 "general" => Self::General,
199 "teen" => Self::Teen,
200 "mature" => Self::Mature,
201 "explicit" => Self::Explicit,
202 _ => Self::Other(CowStr::from(s)),
203 }
204 }
205}
206
207impl<'a> AsRef<str> for ContentRating<'a> {
208 fn as_ref(&self) -> &str {
209 self.as_str()
210 }
211}
212
213impl<'a> core::fmt::Display for ContentRating<'a> {
214 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
215 write!(f, "{}", self.as_str())
216 }
217}
218
219impl<'a> serde::Serialize for ContentRating<'a> {
220 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
221 where
222 S: serde::Serializer,
223 {
224 serializer.serialize_str(self.as_str())
225 }
226}
227
228impl<'de, 'a> serde::Deserialize<'de> for ContentRating<'a>
229where
230 'de: 'a,
231{
232 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
233 where
234 D: serde::Deserializer<'de>,
235 {
236 let s = <&'de str>::deserialize(deserializer)?;
237 Ok(Self::from(s))
238 }
239}
240
241impl jacquard_common::IntoStatic for ContentRating<'_> {
242 type Output = ContentRating<'static>;
243 fn into_static(self) -> Self::Output {
244 match self {
245 ContentRating::General => ContentRating::General,
246 ContentRating::Teen => ContentRating::Teen,
247 ContentRating::Mature => ContentRating::Mature,
248 ContentRating::Explicit => ContentRating::Explicit,
249 ContentRating::Other(v) => ContentRating::Other(v.into_static()),
250 }
251 }
252}
253
254#[derive(Debug, Clone, PartialEq, Eq, Hash)]
257pub enum ContentWarning<'a> {
258 Violence,
259 GraphicViolence,
260 Death,
261 MajorCharacterDeath,
262 SexualContent,
263 ExplicitSexualContent,
264 Language,
265 SubstanceUse,
266 SelfHarm,
267 Abuse,
268 DisturbingImagery,
269 Other(CowStr<'a>),
270}
271
272impl<'a> ContentWarning<'a> {
273 pub fn as_str(&self) -> &str {
274 match self {
275 Self::Violence => "violence",
276 Self::GraphicViolence => "graphic-violence",
277 Self::Death => "death",
278 Self::MajorCharacterDeath => "major-character-death",
279 Self::SexualContent => "sexual-content",
280 Self::ExplicitSexualContent => "explicit-sexual-content",
281 Self::Language => "language",
282 Self::SubstanceUse => "substance-use",
283 Self::SelfHarm => "self-harm",
284 Self::Abuse => "abuse",
285 Self::DisturbingImagery => "disturbing-imagery",
286 Self::Other(s) => s.as_ref(),
287 }
288 }
289}
290
291impl<'a> From<&'a str> for ContentWarning<'a> {
292 fn from(s: &'a str) -> Self {
293 match s {
294 "violence" => Self::Violence,
295 "graphic-violence" => Self::GraphicViolence,
296 "death" => Self::Death,
297 "major-character-death" => Self::MajorCharacterDeath,
298 "sexual-content" => Self::SexualContent,
299 "explicit-sexual-content" => Self::ExplicitSexualContent,
300 "language" => Self::Language,
301 "substance-use" => Self::SubstanceUse,
302 "self-harm" => Self::SelfHarm,
303 "abuse" => Self::Abuse,
304 "disturbing-imagery" => Self::DisturbingImagery,
305 _ => Self::Other(CowStr::from(s)),
306 }
307 }
308}
309
310impl<'a> From<String> for ContentWarning<'a> {
311 fn from(s: String) -> Self {
312 match s.as_str() {
313 "violence" => Self::Violence,
314 "graphic-violence" => Self::GraphicViolence,
315 "death" => Self::Death,
316 "major-character-death" => Self::MajorCharacterDeath,
317 "sexual-content" => Self::SexualContent,
318 "explicit-sexual-content" => Self::ExplicitSexualContent,
319 "language" => Self::Language,
320 "substance-use" => Self::SubstanceUse,
321 "self-harm" => Self::SelfHarm,
322 "abuse" => Self::Abuse,
323 "disturbing-imagery" => Self::DisturbingImagery,
324 _ => Self::Other(CowStr::from(s)),
325 }
326 }
327}
328
329impl<'a> AsRef<str> for ContentWarning<'a> {
330 fn as_ref(&self) -> &str {
331 self.as_str()
332 }
333}
334
335impl<'a> core::fmt::Display for ContentWarning<'a> {
336 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
337 write!(f, "{}", self.as_str())
338 }
339}
340
341impl<'a> serde::Serialize for ContentWarning<'a> {
342 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
343 where
344 S: serde::Serializer,
345 {
346 serializer.serialize_str(self.as_str())
347 }
348}
349
350impl<'de, 'a> serde::Deserialize<'de> for ContentWarning<'a>
351where
352 'de: 'a,
353{
354 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
355 where
356 D: serde::Deserializer<'de>,
357 {
358 let s = <&'de str>::deserialize(deserializer)?;
359 Ok(Self::from(s))
360 }
361}
362
363impl jacquard_common::IntoStatic for ContentWarning<'_> {
364 type Output = ContentWarning<'static>;
365 fn into_static(self) -> Self::Output {
366 match self {
367 ContentWarning::Violence => ContentWarning::Violence,
368 ContentWarning::GraphicViolence => ContentWarning::GraphicViolence,
369 ContentWarning::Death => ContentWarning::Death,
370 ContentWarning::MajorCharacterDeath => ContentWarning::MajorCharacterDeath,
371 ContentWarning::SexualContent => ContentWarning::SexualContent,
372 ContentWarning::ExplicitSexualContent => {
373 ContentWarning::ExplicitSexualContent
374 }
375 ContentWarning::Language => ContentWarning::Language,
376 ContentWarning::SubstanceUse => ContentWarning::SubstanceUse,
377 ContentWarning::SelfHarm => ContentWarning::SelfHarm,
378 ContentWarning::Abuse => ContentWarning::Abuse,
379 ContentWarning::DisturbingImagery => ContentWarning::DisturbingImagery,
380 ContentWarning::Other(v) => ContentWarning::Other(v.into_static()),
381 }
382 }
383}
384
385pub type ContentWarnings<'a> = Vec<notebook::ContentWarning<'a>>;
387
388#[lexicon]
389#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
390#[serde(rename_all = "camelCase")]
391pub struct EntryView<'a> {
392 #[serde(borrow)]
393 pub authors: Vec<notebook::AuthorListView<'a>>,
394 #[serde(skip_serializing_if = "Option::is_none")]
395 pub bookmark_count: Option<i64>,
396 #[serde(borrow)]
397 pub cid: Cid<'a>,
398 pub indexed_at: Datetime,
399 #[serde(skip_serializing_if = "Option::is_none")]
400 pub like_count: Option<i64>,
401 #[serde(skip_serializing_if = "Option::is_none")]
402 #[serde(borrow)]
403 pub path: Option<notebook::Path<'a>>,
404 #[serde(skip_serializing_if = "Option::is_none")]
405 #[serde(borrow)]
406 pub permissions: Option<notebook::PermissionsState<'a>>,
407 #[serde(borrow)]
408 pub record: Data<'a>,
409 #[serde(skip_serializing_if = "Option::is_none")]
410 #[serde(borrow)]
411 pub rendered_view: Option<notebook::RenderedView<'a>>,
412 #[serde(skip_serializing_if = "Option::is_none")]
413 #[serde(borrow)]
414 pub tags: Option<notebook::Tags<'a>>,
415 #[serde(skip_serializing_if = "Option::is_none")]
416 #[serde(borrow)]
417 pub title: Option<notebook::Title<'a>>,
418 #[serde(borrow)]
419 pub uri: AtUri<'a>,
420 #[serde(skip_serializing_if = "Option::is_none")]
421 #[serde(borrow)]
422 pub viewer_bookmark: Option<AtUri<'a>>,
423 #[serde(skip_serializing_if = "Option::is_none")]
424 #[serde(borrow)]
425 pub viewer_like: Option<AtUri<'a>>,
426 #[serde(skip_serializing_if = "Option::is_none")]
427 #[serde(borrow)]
428 pub viewer_reading_progress: Option<notebook::ReadingProgress<'a>>,
429}
430
431#[lexicon]
434#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
435#[serde(rename_all = "camelCase")]
436pub struct FeedEntryView<'a> {
437 #[serde(borrow)]
438 pub entry: notebook::EntryView<'a>,
439 #[serde(skip_serializing_if = "Option::is_none")]
440 #[serde(borrow)]
441 pub notebook_context: Option<notebook::FeedNotebookContext<'a>>,
442 #[serde(skip_serializing_if = "Option::is_none")]
443 #[serde(borrow)]
444 pub reason: Option<notebook::FeedReason<'a>>,
445}
446
447#[lexicon]
450#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
451#[serde(rename_all = "camelCase")]
452pub struct FeedNotebookContext<'a> {
453 #[serde(skip_serializing_if = "Option::is_none")]
454 #[serde(borrow)]
455 pub path: Option<CowStr<'a>>,
456 #[serde(borrow)]
457 pub title: CowStr<'a>,
458 #[serde(borrow)]
459 pub uri: AtUri<'a>,
460}
461
462#[open_union]
465#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
466#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
467pub enum FeedReason<'a> {
468 #[serde(rename = "sh.weaver.notebook.defs#reasonLike")]
469 ReasonLike(Box<notebook::ReasonLike<'a>>),
470 #[serde(rename = "sh.weaver.notebook.defs#reasonBookmark")]
471 ReasonBookmark(Box<notebook::ReasonBookmark<'a>>),
472 #[serde(rename = "sh.weaver.notebook.defs#reasonSubscription")]
473 ReasonSubscription(Box<notebook::ReasonSubscription<'a>>),
474}
475
476
477#[lexicon]
478#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
479#[serde(rename_all = "camelCase")]
480pub struct NotebookView<'a> {
481 #[serde(borrow)]
482 pub authors: Vec<notebook::AuthorListView<'a>>,
483 #[serde(skip_serializing_if = "Option::is_none")]
484 pub bookmark_count: Option<i64>,
485 #[serde(borrow)]
486 pub cid: Cid<'a>,
487 #[serde(skip_serializing_if = "Option::is_none")]
488 pub entry_count: Option<i64>,
489 pub indexed_at: Datetime,
490 #[serde(skip_serializing_if = "Option::is_none")]
491 pub like_count: Option<i64>,
492 #[serde(skip_serializing_if = "Option::is_none")]
493 #[serde(borrow)]
494 pub path: Option<notebook::Path<'a>>,
495 #[serde(skip_serializing_if = "Option::is_none")]
496 #[serde(borrow)]
497 pub permissions: Option<notebook::PermissionsState<'a>>,
498 #[serde(borrow)]
499 pub record: Data<'a>,
500 #[serde(skip_serializing_if = "Option::is_none")]
501 pub subscriber_count: Option<i64>,
502 #[serde(skip_serializing_if = "Option::is_none")]
503 #[serde(borrow)]
504 pub tags: Option<notebook::Tags<'a>>,
505 #[serde(skip_serializing_if = "Option::is_none")]
506 #[serde(borrow)]
507 pub title: Option<notebook::Title<'a>>,
508 #[serde(borrow)]
509 pub uri: AtUri<'a>,
510 #[serde(skip_serializing_if = "Option::is_none")]
511 #[serde(borrow)]
512 pub viewer_bookmark: Option<AtUri<'a>>,
513 #[serde(skip_serializing_if = "Option::is_none")]
514 #[serde(borrow)]
515 pub viewer_like: Option<AtUri<'a>>,
516 #[serde(skip_serializing_if = "Option::is_none")]
517 #[serde(borrow)]
518 pub viewer_reading_progress: Option<notebook::ReadingProgress<'a>>,
519 #[serde(skip_serializing_if = "Option::is_none")]
520 #[serde(borrow)]
521 pub viewer_subscription: Option<AtUri<'a>>,
522}
523
524#[lexicon]
527#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
528#[serde(rename_all = "camelCase")]
529pub struct PageView<'a> {
530 #[serde(borrow)]
531 pub cid: Cid<'a>,
532 #[serde(skip_serializing_if = "Option::is_none")]
533 pub entry_count: Option<i64>,
534 pub indexed_at: Datetime,
535 #[serde(borrow)]
536 pub notebook: notebook::NotebookView<'a>,
537 #[serde(borrow)]
538 pub record: Data<'a>,
539 #[serde(skip_serializing_if = "Option::is_none")]
540 #[serde(borrow)]
541 pub tags: Option<notebook::Tags<'a>>,
542 #[serde(skip_serializing_if = "Option::is_none")]
543 #[serde(borrow)]
544 pub title: Option<notebook::Title<'a>>,
545 #[serde(borrow)]
546 pub uri: AtUri<'a>,
547}
548
549pub type Path<'a> = CowStr<'a>;
551#[lexicon]
554#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
555#[serde(rename_all = "camelCase")]
556pub struct PermissionGrant<'a> {
557 #[serde(borrow)]
558 pub did: Did<'a>,
559 pub granted_at: Datetime,
561 #[serde(borrow)]
563 pub scope: PermissionGrantScope<'a>,
564 #[serde(borrow)]
566 pub source: AtUri<'a>,
567}
568
569#[derive(Debug, Clone, PartialEq, Eq, Hash)]
572pub enum PermissionGrantScope<'a> {
573 Direct,
574 Inherited,
575 Other(CowStr<'a>),
576}
577
578impl<'a> PermissionGrantScope<'a> {
579 pub fn as_str(&self) -> &str {
580 match self {
581 Self::Direct => "direct",
582 Self::Inherited => "inherited",
583 Self::Other(s) => s.as_ref(),
584 }
585 }
586}
587
588impl<'a> From<&'a str> for PermissionGrantScope<'a> {
589 fn from(s: &'a str) -> Self {
590 match s {
591 "direct" => Self::Direct,
592 "inherited" => Self::Inherited,
593 _ => Self::Other(CowStr::from(s)),
594 }
595 }
596}
597
598impl<'a> From<String> for PermissionGrantScope<'a> {
599 fn from(s: String) -> Self {
600 match s.as_str() {
601 "direct" => Self::Direct,
602 "inherited" => Self::Inherited,
603 _ => Self::Other(CowStr::from(s)),
604 }
605 }
606}
607
608impl<'a> core::fmt::Display for PermissionGrantScope<'a> {
609 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
610 write!(f, "{}", self.as_str())
611 }
612}
613
614impl<'a> AsRef<str> for PermissionGrantScope<'a> {
615 fn as_ref(&self) -> &str {
616 self.as_str()
617 }
618}
619
620impl<'a> serde::Serialize for PermissionGrantScope<'a> {
621 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
622 where
623 S: serde::Serializer,
624 {
625 serializer.serialize_str(self.as_str())
626 }
627}
628
629impl<'de, 'a> serde::Deserialize<'de> for PermissionGrantScope<'a>
630where
631 'de: 'a,
632{
633 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
634 where
635 D: serde::Deserializer<'de>,
636 {
637 let s = <&'de str>::deserialize(deserializer)?;
638 Ok(Self::from(s))
639 }
640}
641
642impl<'a> Default for PermissionGrantScope<'a> {
643 fn default() -> Self {
644 Self::Other(Default::default())
645 }
646}
647
648impl jacquard_common::IntoStatic for PermissionGrantScope<'_> {
649 type Output = PermissionGrantScope<'static>;
650 fn into_static(self) -> Self::Output {
651 match self {
652 PermissionGrantScope::Direct => PermissionGrantScope::Direct,
653 PermissionGrantScope::Inherited => PermissionGrantScope::Inherited,
654 PermissionGrantScope::Other(v) => {
655 PermissionGrantScope::Other(v.into_static())
656 }
657 }
658 }
659}
660
661#[lexicon]
664#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
665#[serde(rename_all = "camelCase")]
666pub struct PermissionsState<'a> {
667 #[serde(borrow)]
669 pub editors: Vec<notebook::PermissionGrant<'a>>,
670 #[serde(skip_serializing_if = "Option::is_none")]
672 #[serde(borrow)]
673 pub viewers: Option<Vec<notebook::PermissionGrant<'a>>>,
674}
675
676#[lexicon]
679#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
680#[serde(rename_all = "camelCase")]
681pub struct PublishedVersionView<'a> {
682 #[serde(borrow)]
683 pub cid: Cid<'a>,
684 #[serde(skip_serializing_if = "Option::is_none")]
686 #[serde(borrow)]
687 pub diverged_from: Option<StrongRef<'a>>,
688 #[serde(skip_serializing_if = "Option::is_none")]
690 pub is_canonical: Option<bool>,
691 pub published_at: Datetime,
692 #[serde(borrow)]
693 pub publisher: ProfileViewBasic<'a>,
694 #[serde(skip_serializing_if = "Option::is_none")]
695 pub updated_at: Option<Datetime>,
696 #[serde(borrow)]
697 pub uri: AtUri<'a>,
698}
699
700#[lexicon]
703#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
704#[serde(rename_all = "camelCase")]
705pub struct ReadingProgress<'a> {
706 #[serde(skip_serializing_if = "Option::is_none")]
708 #[serde(borrow)]
709 pub current_entry: Option<AtUri<'a>>,
710 #[serde(skip_serializing_if = "Option::is_none")]
711 pub finished_at: Option<Datetime>,
712 #[serde(skip_serializing_if = "Option::is_none")]
713 pub last_read_at: Option<Datetime>,
714 #[serde(skip_serializing_if = "Option::is_none")]
715 pub percent_complete: Option<i64>,
716 #[serde(skip_serializing_if = "Option::is_none")]
717 pub started_at: Option<Datetime>,
718 #[serde(skip_serializing_if = "Option::is_none")]
719 #[serde(borrow)]
720 pub status: Option<ReadingProgressStatus<'a>>,
721}
722
723
724#[derive(Debug, Clone, PartialEq, Eq, Hash)]
725pub enum ReadingProgressStatus<'a> {
726 Reading,
727 Finished,
728 Abandoned,
729 WantToRead,
730 Other(CowStr<'a>),
731}
732
733impl<'a> ReadingProgressStatus<'a> {
734 pub fn as_str(&self) -> &str {
735 match self {
736 Self::Reading => "reading",
737 Self::Finished => "finished",
738 Self::Abandoned => "abandoned",
739 Self::WantToRead => "want-to-read",
740 Self::Other(s) => s.as_ref(),
741 }
742 }
743}
744
745impl<'a> From<&'a str> for ReadingProgressStatus<'a> {
746 fn from(s: &'a str) -> Self {
747 match s {
748 "reading" => Self::Reading,
749 "finished" => Self::Finished,
750 "abandoned" => Self::Abandoned,
751 "want-to-read" => Self::WantToRead,
752 _ => Self::Other(CowStr::from(s)),
753 }
754 }
755}
756
757impl<'a> From<String> for ReadingProgressStatus<'a> {
758 fn from(s: String) -> Self {
759 match s.as_str() {
760 "reading" => Self::Reading,
761 "finished" => Self::Finished,
762 "abandoned" => Self::Abandoned,
763 "want-to-read" => Self::WantToRead,
764 _ => Self::Other(CowStr::from(s)),
765 }
766 }
767}
768
769impl<'a> core::fmt::Display for ReadingProgressStatus<'a> {
770 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
771 write!(f, "{}", self.as_str())
772 }
773}
774
775impl<'a> AsRef<str> for ReadingProgressStatus<'a> {
776 fn as_ref(&self) -> &str {
777 self.as_str()
778 }
779}
780
781impl<'a> serde::Serialize for ReadingProgressStatus<'a> {
782 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
783 where
784 S: serde::Serializer,
785 {
786 serializer.serialize_str(self.as_str())
787 }
788}
789
790impl<'de, 'a> serde::Deserialize<'de> for ReadingProgressStatus<'a>
791where
792 'de: 'a,
793{
794 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
795 where
796 D: serde::Deserializer<'de>,
797 {
798 let s = <&'de str>::deserialize(deserializer)?;
799 Ok(Self::from(s))
800 }
801}
802
803impl<'a> Default for ReadingProgressStatus<'a> {
804 fn default() -> Self {
805 Self::Other(Default::default())
806 }
807}
808
809impl jacquard_common::IntoStatic for ReadingProgressStatus<'_> {
810 type Output = ReadingProgressStatus<'static>;
811 fn into_static(self) -> Self::Output {
812 match self {
813 ReadingProgressStatus::Reading => ReadingProgressStatus::Reading,
814 ReadingProgressStatus::Finished => ReadingProgressStatus::Finished,
815 ReadingProgressStatus::Abandoned => ReadingProgressStatus::Abandoned,
816 ReadingProgressStatus::WantToRead => ReadingProgressStatus::WantToRead,
817 ReadingProgressStatus::Other(v) => {
818 ReadingProgressStatus::Other(v.into_static())
819 }
820 }
821 }
822}
823
824
825#[lexicon]
826#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
827#[serde(rename_all = "camelCase")]
828pub struct ReasonBookmark<'a> {
829 #[serde(borrow)]
830 pub by: ProfileViewBasic<'a>,
831 pub indexed_at: Datetime,
832}
833
834
835#[lexicon]
836#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
837#[serde(rename_all = "camelCase")]
838pub struct ReasonLike<'a> {
839 #[serde(borrow)]
840 pub by: ProfileViewBasic<'a>,
841 pub indexed_at: Datetime,
842}
843
844
845#[lexicon]
846#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
847#[serde(rename_all = "camelCase")]
848pub struct ReasonSubscription<'a> {
849 pub indexed_at: Datetime,
850}
851
852#[lexicon]
855#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
856#[serde(rename_all = "camelCase")]
857pub struct RenderedView<'a> {
858 #[serde(skip_serializing_if = "Option::is_none")]
859 #[serde(borrow)]
860 pub css: Option<BlobRef<'a>>,
861 #[serde(borrow)]
862 pub html: BlobRef<'a>,
863}
864
865pub type Tags<'a> = Vec<CowStr<'a>>;
867pub type Title<'a> = CowStr<'a>;
869impl<'a> LexiconSchema for AuthorListView<'a> {
870 fn nsid() -> &'static str {
871 "sh.weaver.notebook.defs"
872 }
873 fn def_name() -> &'static str {
874 "authorListView"
875 }
876 fn lexicon_doc() -> LexiconDoc<'static> {
877 lexicon_doc_sh_weaver_notebook_defs()
878 }
879 fn validate(&self) -> Result<(), ConstraintError> {
880 Ok(())
881 }
882}
883
884impl<'a> LexiconSchema for BookEntryRef<'a> {
885 fn nsid() -> &'static str {
886 "sh.weaver.notebook.defs"
887 }
888 fn def_name() -> &'static str {
889 "bookEntryRef"
890 }
891 fn lexicon_doc() -> LexiconDoc<'static> {
892 lexicon_doc_sh_weaver_notebook_defs()
893 }
894 fn validate(&self) -> Result<(), ConstraintError> {
895 Ok(())
896 }
897}
898
899impl<'a> LexiconSchema for BookEntryView<'a> {
900 fn nsid() -> &'static str {
901 "sh.weaver.notebook.defs"
902 }
903 fn def_name() -> &'static str {
904 "bookEntryView"
905 }
906 fn lexicon_doc() -> LexiconDoc<'static> {
907 lexicon_doc_sh_weaver_notebook_defs()
908 }
909 fn validate(&self) -> Result<(), ConstraintError> {
910 Ok(())
911 }
912}
913
914impl<'a> LexiconSchema for ChapterEntryView<'a> {
915 fn nsid() -> &'static str {
916 "sh.weaver.notebook.defs"
917 }
918 fn def_name() -> &'static str {
919 "chapterEntryView"
920 }
921 fn lexicon_doc() -> LexiconDoc<'static> {
922 lexicon_doc_sh_weaver_notebook_defs()
923 }
924 fn validate(&self) -> Result<(), ConstraintError> {
925 Ok(())
926 }
927}
928
929impl<'a> LexiconSchema for ChapterView<'a> {
930 fn nsid() -> &'static str {
931 "sh.weaver.notebook.defs"
932 }
933 fn def_name() -> &'static str {
934 "chapterView"
935 }
936 fn lexicon_doc() -> LexiconDoc<'static> {
937 lexicon_doc_sh_weaver_notebook_defs()
938 }
939 fn validate(&self) -> Result<(), ConstraintError> {
940 Ok(())
941 }
942}
943
944impl<'a> LexiconSchema for ContentFormat<'a> {
945 fn nsid() -> &'static str {
946 "sh.weaver.notebook.defs"
947 }
948 fn def_name() -> &'static str {
949 "contentFormat"
950 }
951 fn lexicon_doc() -> LexiconDoc<'static> {
952 lexicon_doc_sh_weaver_notebook_defs()
953 }
954 fn validate(&self) -> Result<(), ConstraintError> {
955 Ok(())
956 }
957}
958
959impl<'a> LexiconSchema for EntryView<'a> {
960 fn nsid() -> &'static str {
961 "sh.weaver.notebook.defs"
962 }
963 fn def_name() -> &'static str {
964 "entryView"
965 }
966 fn lexicon_doc() -> LexiconDoc<'static> {
967 lexicon_doc_sh_weaver_notebook_defs()
968 }
969 fn validate(&self) -> Result<(), ConstraintError> {
970 Ok(())
971 }
972}
973
974impl<'a> LexiconSchema for FeedEntryView<'a> {
975 fn nsid() -> &'static str {
976 "sh.weaver.notebook.defs"
977 }
978 fn def_name() -> &'static str {
979 "feedEntryView"
980 }
981 fn lexicon_doc() -> LexiconDoc<'static> {
982 lexicon_doc_sh_weaver_notebook_defs()
983 }
984 fn validate(&self) -> Result<(), ConstraintError> {
985 Ok(())
986 }
987}
988
989impl<'a> LexiconSchema for FeedNotebookContext<'a> {
990 fn nsid() -> &'static str {
991 "sh.weaver.notebook.defs"
992 }
993 fn def_name() -> &'static str {
994 "feedNotebookContext"
995 }
996 fn lexicon_doc() -> LexiconDoc<'static> {
997 lexicon_doc_sh_weaver_notebook_defs()
998 }
999 fn validate(&self) -> Result<(), ConstraintError> {
1000 Ok(())
1001 }
1002}
1003
1004impl<'a> LexiconSchema for NotebookView<'a> {
1005 fn nsid() -> &'static str {
1006 "sh.weaver.notebook.defs"
1007 }
1008 fn def_name() -> &'static str {
1009 "notebookView"
1010 }
1011 fn lexicon_doc() -> LexiconDoc<'static> {
1012 lexicon_doc_sh_weaver_notebook_defs()
1013 }
1014 fn validate(&self) -> Result<(), ConstraintError> {
1015 Ok(())
1016 }
1017}
1018
1019impl<'a> LexiconSchema for PageView<'a> {
1020 fn nsid() -> &'static str {
1021 "sh.weaver.notebook.defs"
1022 }
1023 fn def_name() -> &'static str {
1024 "pageView"
1025 }
1026 fn lexicon_doc() -> LexiconDoc<'static> {
1027 lexicon_doc_sh_weaver_notebook_defs()
1028 }
1029 fn validate(&self) -> Result<(), ConstraintError> {
1030 Ok(())
1031 }
1032}
1033
1034impl<'a> LexiconSchema for PermissionGrant<'a> {
1035 fn nsid() -> &'static str {
1036 "sh.weaver.notebook.defs"
1037 }
1038 fn def_name() -> &'static str {
1039 "permissionGrant"
1040 }
1041 fn lexicon_doc() -> LexiconDoc<'static> {
1042 lexicon_doc_sh_weaver_notebook_defs()
1043 }
1044 fn validate(&self) -> Result<(), ConstraintError> {
1045 Ok(())
1046 }
1047}
1048
1049impl<'a> LexiconSchema for PermissionsState<'a> {
1050 fn nsid() -> &'static str {
1051 "sh.weaver.notebook.defs"
1052 }
1053 fn def_name() -> &'static str {
1054 "permissionsState"
1055 }
1056 fn lexicon_doc() -> LexiconDoc<'static> {
1057 lexicon_doc_sh_weaver_notebook_defs()
1058 }
1059 fn validate(&self) -> Result<(), ConstraintError> {
1060 Ok(())
1061 }
1062}
1063
1064impl<'a> LexiconSchema for PublishedVersionView<'a> {
1065 fn nsid() -> &'static str {
1066 "sh.weaver.notebook.defs"
1067 }
1068 fn def_name() -> &'static str {
1069 "publishedVersionView"
1070 }
1071 fn lexicon_doc() -> LexiconDoc<'static> {
1072 lexicon_doc_sh_weaver_notebook_defs()
1073 }
1074 fn validate(&self) -> Result<(), ConstraintError> {
1075 Ok(())
1076 }
1077}
1078
1079impl<'a> LexiconSchema for ReadingProgress<'a> {
1080 fn nsid() -> &'static str {
1081 "sh.weaver.notebook.defs"
1082 }
1083 fn def_name() -> &'static str {
1084 "readingProgress"
1085 }
1086 fn lexicon_doc() -> LexiconDoc<'static> {
1087 lexicon_doc_sh_weaver_notebook_defs()
1088 }
1089 fn validate(&self) -> Result<(), ConstraintError> {
1090 if let Some(ref value) = self.percent_complete {
1091 if *value > 100i64 {
1092 return Err(ConstraintError::Maximum {
1093 path: ValidationPath::from_field("percent_complete"),
1094 max: 100i64,
1095 actual: *value,
1096 });
1097 }
1098 }
1099 if let Some(ref value) = self.percent_complete {
1100 if *value < 0i64 {
1101 return Err(ConstraintError::Minimum {
1102 path: ValidationPath::from_field("percent_complete"),
1103 min: 0i64,
1104 actual: *value,
1105 });
1106 }
1107 }
1108 Ok(())
1109 }
1110}
1111
1112impl<'a> LexiconSchema for ReasonBookmark<'a> {
1113 fn nsid() -> &'static str {
1114 "sh.weaver.notebook.defs"
1115 }
1116 fn def_name() -> &'static str {
1117 "reasonBookmark"
1118 }
1119 fn lexicon_doc() -> LexiconDoc<'static> {
1120 lexicon_doc_sh_weaver_notebook_defs()
1121 }
1122 fn validate(&self) -> Result<(), ConstraintError> {
1123 Ok(())
1124 }
1125}
1126
1127impl<'a> LexiconSchema for ReasonLike<'a> {
1128 fn nsid() -> &'static str {
1129 "sh.weaver.notebook.defs"
1130 }
1131 fn def_name() -> &'static str {
1132 "reasonLike"
1133 }
1134 fn lexicon_doc() -> LexiconDoc<'static> {
1135 lexicon_doc_sh_weaver_notebook_defs()
1136 }
1137 fn validate(&self) -> Result<(), ConstraintError> {
1138 Ok(())
1139 }
1140}
1141
1142impl<'a> LexiconSchema for ReasonSubscription<'a> {
1143 fn nsid() -> &'static str {
1144 "sh.weaver.notebook.defs"
1145 }
1146 fn def_name() -> &'static str {
1147 "reasonSubscription"
1148 }
1149 fn lexicon_doc() -> LexiconDoc<'static> {
1150 lexicon_doc_sh_weaver_notebook_defs()
1151 }
1152 fn validate(&self) -> Result<(), ConstraintError> {
1153 Ok(())
1154 }
1155}
1156
1157impl<'a> LexiconSchema for RenderedView<'a> {
1158 fn nsid() -> &'static str {
1159 "sh.weaver.notebook.defs"
1160 }
1161 fn def_name() -> &'static str {
1162 "renderedView"
1163 }
1164 fn lexicon_doc() -> LexiconDoc<'static> {
1165 lexicon_doc_sh_weaver_notebook_defs()
1166 }
1167 fn validate(&self) -> Result<(), ConstraintError> {
1168 if let Some(ref value) = self.css {
1169 {
1170 let size = value.blob().size;
1171 if size > 1000000usize {
1172 return Err(ConstraintError::BlobTooLarge {
1173 path: ValidationPath::from_field("css"),
1174 max: 1000000usize,
1175 actual: size,
1176 });
1177 }
1178 }
1179 }
1180 if let Some(ref value) = self.css {
1181 {
1182 let mime = value.blob().mime_type.as_str();
1183 let accepted: &[&str] = &["text/css"];
1184 let matched = accepted
1185 .iter()
1186 .any(|pattern| {
1187 if *pattern == "*/*" {
1188 true
1189 } else if pattern.ends_with("/*") {
1190 let prefix = &pattern[..pattern.len() - 2];
1191 mime.starts_with(prefix)
1192 && mime.as_bytes().get(prefix.len()) == Some(&b'/')
1193 } else {
1194 mime == *pattern
1195 }
1196 });
1197 if !matched {
1198 return Err(ConstraintError::BlobMimeTypeNotAccepted {
1199 path: ValidationPath::from_field("css"),
1200 accepted: vec!["text/css".to_string()],
1201 actual: mime.to_string(),
1202 });
1203 }
1204 }
1205 }
1206 {
1207 let value = &self.html;
1208 {
1209 let size = value.blob().size;
1210 if size > 1000000usize {
1211 return Err(ConstraintError::BlobTooLarge {
1212 path: ValidationPath::from_field("html"),
1213 max: 1000000usize,
1214 actual: size,
1215 });
1216 }
1217 }
1218 }
1219 {
1220 let value = &self.html;
1221 {
1222 let mime = value.blob().mime_type.as_str();
1223 let accepted: &[&str] = &["text/html"];
1224 let matched = accepted
1225 .iter()
1226 .any(|pattern| {
1227 if *pattern == "*/*" {
1228 true
1229 } else if pattern.ends_with("/*") {
1230 let prefix = &pattern[..pattern.len() - 2];
1231 mime.starts_with(prefix)
1232 && mime.as_bytes().get(prefix.len()) == Some(&b'/')
1233 } else {
1234 mime == *pattern
1235 }
1236 });
1237 if !matched {
1238 return Err(ConstraintError::BlobMimeTypeNotAccepted {
1239 path: ValidationPath::from_field("html"),
1240 accepted: vec!["text/html".to_string()],
1241 actual: mime.to_string(),
1242 });
1243 }
1244 }
1245 }
1246 Ok(())
1247 }
1248}
1249
1250pub mod author_list_view_state {
1251
1252 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1253 #[allow(unused)]
1254 use ::core::marker::PhantomData;
1255 mod sealed {
1256 pub trait Sealed {}
1257 }
1258 pub trait State: sealed::Sealed {
1260 type Index;
1261 type Record;
1262 }
1263 pub struct Empty(());
1265 impl sealed::Sealed for Empty {}
1266 impl State for Empty {
1267 type Index = Unset;
1268 type Record = Unset;
1269 }
1270 pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
1272 impl<S: State> sealed::Sealed for SetIndex<S> {}
1273 impl<S: State> State for SetIndex<S> {
1274 type Index = Set<members::index>;
1275 type Record = S::Record;
1276 }
1277 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
1279 impl<S: State> sealed::Sealed for SetRecord<S> {}
1280 impl<S: State> State for SetRecord<S> {
1281 type Index = S::Index;
1282 type Record = Set<members::record>;
1283 }
1284 #[allow(non_camel_case_types)]
1286 pub mod members {
1287 pub struct index(());
1289 pub struct record(());
1291 }
1292}
1293
1294pub struct AuthorListViewBuilder<'a, S: author_list_view_state::State> {
1296 _state: PhantomData<fn() -> S>,
1297 _fields: (Option<i64>, Option<ProfileDataView<'a>>, Option<AtUri<'a>>),
1298 _lifetime: PhantomData<&'a ()>,
1299}
1300
1301impl<'a> AuthorListView<'a> {
1302 pub fn new() -> AuthorListViewBuilder<'a, author_list_view_state::Empty> {
1304 AuthorListViewBuilder::new()
1305 }
1306}
1307
1308impl<'a> AuthorListViewBuilder<'a, author_list_view_state::Empty> {
1309 pub fn new() -> Self {
1311 AuthorListViewBuilder {
1312 _state: PhantomData,
1313 _fields: (None, None, None),
1314 _lifetime: PhantomData,
1315 }
1316 }
1317}
1318
1319impl<'a, S> AuthorListViewBuilder<'a, S>
1320where
1321 S: author_list_view_state::State,
1322 S::Index: author_list_view_state::IsUnset,
1323{
1324 pub fn index(
1326 mut self,
1327 value: impl Into<i64>,
1328 ) -> AuthorListViewBuilder<'a, author_list_view_state::SetIndex<S>> {
1329 self._fields.0 = Option::Some(value.into());
1330 AuthorListViewBuilder {
1331 _state: PhantomData,
1332 _fields: self._fields,
1333 _lifetime: PhantomData,
1334 }
1335 }
1336}
1337
1338impl<'a, S> AuthorListViewBuilder<'a, S>
1339where
1340 S: author_list_view_state::State,
1341 S::Record: author_list_view_state::IsUnset,
1342{
1343 pub fn record(
1345 mut self,
1346 value: impl Into<ProfileDataView<'a>>,
1347 ) -> AuthorListViewBuilder<'a, author_list_view_state::SetRecord<S>> {
1348 self._fields.1 = Option::Some(value.into());
1349 AuthorListViewBuilder {
1350 _state: PhantomData,
1351 _fields: self._fields,
1352 _lifetime: PhantomData,
1353 }
1354 }
1355}
1356
1357impl<'a, S: author_list_view_state::State> AuthorListViewBuilder<'a, S> {
1358 pub fn uri(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
1360 self._fields.2 = value.into();
1361 self
1362 }
1363 pub fn maybe_uri(mut self, value: Option<AtUri<'a>>) -> Self {
1365 self._fields.2 = value;
1366 self
1367 }
1368}
1369
1370impl<'a, S> AuthorListViewBuilder<'a, S>
1371where
1372 S: author_list_view_state::State,
1373 S::Index: author_list_view_state::IsSet,
1374 S::Record: author_list_view_state::IsSet,
1375{
1376 pub fn build(self) -> AuthorListView<'a> {
1378 AuthorListView {
1379 index: self._fields.0.unwrap(),
1380 record: self._fields.1.unwrap(),
1381 uri: self._fields.2,
1382 extra_data: Default::default(),
1383 }
1384 }
1385 pub fn build_with_data(
1387 self,
1388 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1389 ) -> AuthorListView<'a> {
1390 AuthorListView {
1391 index: self._fields.0.unwrap(),
1392 record: self._fields.1.unwrap(),
1393 uri: self._fields.2,
1394 extra_data: Some(extra_data),
1395 }
1396 }
1397}
1398
1399fn lexicon_doc_sh_weaver_notebook_defs() -> LexiconDoc<'static> {
1400 #[allow(unused_imports)]
1401 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
1402 use jacquard_lexicon::lexicon::*;
1403 use alloc::collections::BTreeMap;
1404 LexiconDoc {
1405 lexicon: Lexicon::Lexicon1,
1406 id: CowStr::new_static("sh.weaver.notebook.defs"),
1407 defs: {
1408 let mut map = BTreeMap::new();
1409 map.insert(
1410 SmolStr::new_static("authorListView"),
1411 LexUserType::Object(LexObject {
1412 required: Some(
1413 vec![SmolStr::new_static("record"), SmolStr::new_static("index")],
1414 ),
1415 properties: {
1416 #[allow(unused_mut)]
1417 let mut map = BTreeMap::new();
1418 map.insert(
1419 SmolStr::new_static("index"),
1420 LexObjectProperty::Integer(LexInteger {
1421 ..Default::default()
1422 }),
1423 );
1424 map.insert(
1425 SmolStr::new_static("record"),
1426 LexObjectProperty::Ref(LexRef {
1427 r#ref: CowStr::new_static(
1428 "sh.weaver.actor.defs#profileDataView",
1429 ),
1430 ..Default::default()
1431 }),
1432 );
1433 map.insert(
1434 SmolStr::new_static("uri"),
1435 LexObjectProperty::String(LexString {
1436 format: Some(LexStringFormat::AtUri),
1437 ..Default::default()
1438 }),
1439 );
1440 map
1441 },
1442 ..Default::default()
1443 }),
1444 );
1445 map.insert(
1446 SmolStr::new_static("bookEntryRef"),
1447 LexUserType::Object(LexObject {
1448 required: Some(vec![SmolStr::new_static("entry")]),
1449 properties: {
1450 #[allow(unused_mut)]
1451 let mut map = BTreeMap::new();
1452 map.insert(
1453 SmolStr::new_static("entry"),
1454 LexObjectProperty::Ref(LexRef {
1455 r#ref: CowStr::new_static("#entryView"),
1456 ..Default::default()
1457 }),
1458 );
1459 map
1460 },
1461 ..Default::default()
1462 }),
1463 );
1464 map.insert(
1465 SmolStr::new_static("bookEntryView"),
1466 LexUserType::Object(LexObject {
1467 description: Some(
1468 CowStr::new_static("An ordered entry in a Weaver notebook."),
1469 ),
1470 required: Some(
1471 vec![SmolStr::new_static("entry"), SmolStr::new_static("index")],
1472 ),
1473 properties: {
1474 #[allow(unused_mut)]
1475 let mut map = BTreeMap::new();
1476 map.insert(
1477 SmolStr::new_static("entry"),
1478 LexObjectProperty::Ref(LexRef {
1479 r#ref: CowStr::new_static("#entryView"),
1480 ..Default::default()
1481 }),
1482 );
1483 map.insert(
1484 SmolStr::new_static("index"),
1485 LexObjectProperty::Integer(LexInteger {
1486 ..Default::default()
1487 }),
1488 );
1489 map.insert(
1490 SmolStr::new_static("next"),
1491 LexObjectProperty::Ref(LexRef {
1492 r#ref: CowStr::new_static("#bookEntryRef"),
1493 ..Default::default()
1494 }),
1495 );
1496 map.insert(
1497 SmolStr::new_static("prev"),
1498 LexObjectProperty::Ref(LexRef {
1499 r#ref: CowStr::new_static("#bookEntryRef"),
1500 ..Default::default()
1501 }),
1502 );
1503 map
1504 },
1505 ..Default::default()
1506 }),
1507 );
1508 map.insert(
1509 SmolStr::new_static("chapterEntryView"),
1510 LexUserType::Object(LexObject {
1511 description: Some(
1512 CowStr::new_static("An entry within a chapter context."),
1513 ),
1514 required: Some(
1515 vec![SmolStr::new_static("entry"), SmolStr::new_static("index")],
1516 ),
1517 properties: {
1518 #[allow(unused_mut)]
1519 let mut map = BTreeMap::new();
1520 map.insert(
1521 SmolStr::new_static("entry"),
1522 LexObjectProperty::Ref(LexRef {
1523 r#ref: CowStr::new_static("#entryView"),
1524 ..Default::default()
1525 }),
1526 );
1527 map.insert(
1528 SmolStr::new_static("index"),
1529 LexObjectProperty::Integer(LexInteger {
1530 ..Default::default()
1531 }),
1532 );
1533 map.insert(
1534 SmolStr::new_static("next"),
1535 LexObjectProperty::Ref(LexRef {
1536 r#ref: CowStr::new_static("#bookEntryRef"),
1537 ..Default::default()
1538 }),
1539 );
1540 map.insert(
1541 SmolStr::new_static("prev"),
1542 LexObjectProperty::Ref(LexRef {
1543 r#ref: CowStr::new_static("#bookEntryRef"),
1544 ..Default::default()
1545 }),
1546 );
1547 map
1548 },
1549 ..Default::default()
1550 }),
1551 );
1552 map.insert(
1553 SmolStr::new_static("chapterView"),
1554 LexUserType::Object(LexObject {
1555 description: Some(CowStr::new_static("Hydrated view of a chapter.")),
1556 required: Some(
1557 vec![
1558 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
1559 SmolStr::new_static("notebook"),
1560 SmolStr::new_static("authors"),
1561 SmolStr::new_static("record"),
1562 SmolStr::new_static("indexedAt")
1563 ],
1564 ),
1565 properties: {
1566 #[allow(unused_mut)]
1567 let mut map = BTreeMap::new();
1568 map.insert(
1569 SmolStr::new_static("authors"),
1570 LexObjectProperty::Array(LexArray {
1571 items: LexArrayItem::Ref(LexRef {
1572 r#ref: CowStr::new_static("#authorListView"),
1573 ..Default::default()
1574 }),
1575 ..Default::default()
1576 }),
1577 );
1578 map.insert(
1579 SmolStr::new_static("cid"),
1580 LexObjectProperty::String(LexString {
1581 format: Some(LexStringFormat::Cid),
1582 ..Default::default()
1583 }),
1584 );
1585 map.insert(
1586 SmolStr::new_static("entryCount"),
1587 LexObjectProperty::Integer(LexInteger {
1588 ..Default::default()
1589 }),
1590 );
1591 map.insert(
1592 SmolStr::new_static("indexedAt"),
1593 LexObjectProperty::String(LexString {
1594 format: Some(LexStringFormat::Datetime),
1595 ..Default::default()
1596 }),
1597 );
1598 map.insert(
1599 SmolStr::new_static("notebook"),
1600 LexObjectProperty::Ref(LexRef {
1601 r#ref: CowStr::new_static("#notebookView"),
1602 ..Default::default()
1603 }),
1604 );
1605 map.insert(
1606 SmolStr::new_static("record"),
1607 LexObjectProperty::Unknown(LexUnknown {
1608 ..Default::default()
1609 }),
1610 );
1611 map.insert(
1612 SmolStr::new_static("tags"),
1613 LexObjectProperty::Ref(LexRef {
1614 r#ref: CowStr::new_static("#tags"),
1615 ..Default::default()
1616 }),
1617 );
1618 map.insert(
1619 SmolStr::new_static("title"),
1620 LexObjectProperty::Ref(LexRef {
1621 r#ref: CowStr::new_static("#title"),
1622 ..Default::default()
1623 }),
1624 );
1625 map.insert(
1626 SmolStr::new_static("uri"),
1627 LexObjectProperty::String(LexString {
1628 format: Some(LexStringFormat::AtUri),
1629 ..Default::default()
1630 }),
1631 );
1632 map
1633 },
1634 ..Default::default()
1635 }),
1636 );
1637 map.insert(
1638 SmolStr::new_static("contentFormat"),
1639 LexUserType::Object(LexObject {
1640 description: Some(
1641 CowStr::new_static(
1642 "The format of the content. This is used to determine how to render the content.",
1643 ),
1644 ),
1645 properties: {
1646 #[allow(unused_mut)]
1647 let mut map = BTreeMap::new();
1648 map.insert(
1649 SmolStr::new_static("markdown"),
1650 LexObjectProperty::String(LexString {
1651 description: Some(
1652 CowStr::new_static(
1653 "The format of the content. This is used to determine how to render the content.",
1654 ),
1655 ),
1656 ..Default::default()
1657 }),
1658 );
1659 map
1660 },
1661 ..Default::default()
1662 }),
1663 );
1664 map.insert(
1665 SmolStr::new_static("contentRating"),
1666 LexUserType::String(LexString {
1667 description: Some(
1668 CowStr::new_static("Author-applied content rating."),
1669 ),
1670 ..Default::default()
1671 }),
1672 );
1673 map.insert(
1674 SmolStr::new_static("contentWarning"),
1675 LexUserType::String(LexString {
1676 description: Some(
1677 CowStr::new_static("Author-applied content warning."),
1678 ),
1679 ..Default::default()
1680 }),
1681 );
1682 map.insert(
1683 SmolStr::new_static("contentWarnings"),
1684 LexUserType::Array(LexArray {
1685 items: LexArrayItem::Ref(LexRef {
1686 r#ref: CowStr::new_static("#contentWarning"),
1687 ..Default::default()
1688 }),
1689 max_length: Some(10usize),
1690 ..Default::default()
1691 }),
1692 );
1693 map.insert(
1694 SmolStr::new_static("entryView"),
1695 LexUserType::Object(LexObject {
1696 required: Some(
1697 vec![
1698 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
1699 SmolStr::new_static("authors"),
1700 SmolStr::new_static("record"),
1701 SmolStr::new_static("indexedAt")
1702 ],
1703 ),
1704 properties: {
1705 #[allow(unused_mut)]
1706 let mut map = BTreeMap::new();
1707 map.insert(
1708 SmolStr::new_static("authors"),
1709 LexObjectProperty::Array(LexArray {
1710 items: LexArrayItem::Ref(LexRef {
1711 r#ref: CowStr::new_static("#authorListView"),
1712 ..Default::default()
1713 }),
1714 ..Default::default()
1715 }),
1716 );
1717 map.insert(
1718 SmolStr::new_static("bookmarkCount"),
1719 LexObjectProperty::Integer(LexInteger {
1720 ..Default::default()
1721 }),
1722 );
1723 map.insert(
1724 SmolStr::new_static("cid"),
1725 LexObjectProperty::String(LexString {
1726 format: Some(LexStringFormat::Cid),
1727 ..Default::default()
1728 }),
1729 );
1730 map.insert(
1731 SmolStr::new_static("indexedAt"),
1732 LexObjectProperty::String(LexString {
1733 format: Some(LexStringFormat::Datetime),
1734 ..Default::default()
1735 }),
1736 );
1737 map.insert(
1738 SmolStr::new_static("likeCount"),
1739 LexObjectProperty::Integer(LexInteger {
1740 ..Default::default()
1741 }),
1742 );
1743 map.insert(
1744 SmolStr::new_static("path"),
1745 LexObjectProperty::Ref(LexRef {
1746 r#ref: CowStr::new_static("#path"),
1747 ..Default::default()
1748 }),
1749 );
1750 map.insert(
1751 SmolStr::new_static("permissions"),
1752 LexObjectProperty::Ref(LexRef {
1753 r#ref: CowStr::new_static("#permissionsState"),
1754 ..Default::default()
1755 }),
1756 );
1757 map.insert(
1758 SmolStr::new_static("record"),
1759 LexObjectProperty::Unknown(LexUnknown {
1760 ..Default::default()
1761 }),
1762 );
1763 map.insert(
1764 SmolStr::new_static("renderedView"),
1765 LexObjectProperty::Ref(LexRef {
1766 r#ref: CowStr::new_static("#renderedView"),
1767 ..Default::default()
1768 }),
1769 );
1770 map.insert(
1771 SmolStr::new_static("tags"),
1772 LexObjectProperty::Ref(LexRef {
1773 r#ref: CowStr::new_static("#tags"),
1774 ..Default::default()
1775 }),
1776 );
1777 map.insert(
1778 SmolStr::new_static("title"),
1779 LexObjectProperty::Ref(LexRef {
1780 r#ref: CowStr::new_static("#title"),
1781 ..Default::default()
1782 }),
1783 );
1784 map.insert(
1785 SmolStr::new_static("uri"),
1786 LexObjectProperty::String(LexString {
1787 format: Some(LexStringFormat::AtUri),
1788 ..Default::default()
1789 }),
1790 );
1791 map.insert(
1792 SmolStr::new_static("viewerBookmark"),
1793 LexObjectProperty::String(LexString {
1794 format: Some(LexStringFormat::AtUri),
1795 ..Default::default()
1796 }),
1797 );
1798 map.insert(
1799 SmolStr::new_static("viewerLike"),
1800 LexObjectProperty::String(LexString {
1801 format: Some(LexStringFormat::AtUri),
1802 ..Default::default()
1803 }),
1804 );
1805 map.insert(
1806 SmolStr::new_static("viewerReadingProgress"),
1807 LexObjectProperty::Ref(LexRef {
1808 r#ref: CowStr::new_static("#readingProgress"),
1809 ..Default::default()
1810 }),
1811 );
1812 map
1813 },
1814 ..Default::default()
1815 }),
1816 );
1817 map.insert(
1818 SmolStr::new_static("feedEntryView"),
1819 LexUserType::Object(LexObject {
1820 description: Some(
1821 CowStr::new_static(
1822 "Entry with feed-specific context (discovery reason, notebook context).",
1823 ),
1824 ),
1825 required: Some(vec![SmolStr::new_static("entry")]),
1826 properties: {
1827 #[allow(unused_mut)]
1828 let mut map = BTreeMap::new();
1829 map.insert(
1830 SmolStr::new_static("entry"),
1831 LexObjectProperty::Ref(LexRef {
1832 r#ref: CowStr::new_static("#entryView"),
1833 ..Default::default()
1834 }),
1835 );
1836 map.insert(
1837 SmolStr::new_static("notebookContext"),
1838 LexObjectProperty::Ref(LexRef {
1839 r#ref: CowStr::new_static("#feedNotebookContext"),
1840 ..Default::default()
1841 }),
1842 );
1843 map.insert(
1844 SmolStr::new_static("reason"),
1845 LexObjectProperty::Ref(LexRef {
1846 r#ref: CowStr::new_static("#feedReason"),
1847 ..Default::default()
1848 }),
1849 );
1850 map
1851 },
1852 ..Default::default()
1853 }),
1854 );
1855 map.insert(
1856 SmolStr::new_static("feedNotebookContext"),
1857 LexUserType::Object(LexObject {
1858 description: Some(
1859 CowStr::new_static("Minimal notebook context for feed display."),
1860 ),
1861 required: Some(
1862 vec![SmolStr::new_static("uri"), SmolStr::new_static("title")],
1863 ),
1864 properties: {
1865 #[allow(unused_mut)]
1866 let mut map = BTreeMap::new();
1867 map.insert(
1868 SmolStr::new_static("path"),
1869 LexObjectProperty::String(LexString { ..Default::default() }),
1870 );
1871 map.insert(
1872 SmolStr::new_static("title"),
1873 LexObjectProperty::String(LexString { ..Default::default() }),
1874 );
1875 map.insert(
1876 SmolStr::new_static("uri"),
1877 LexObjectProperty::String(LexString {
1878 format: Some(LexStringFormat::AtUri),
1879 ..Default::default()
1880 }),
1881 );
1882 map
1883 },
1884 ..Default::default()
1885 }),
1886 );
1887 map.insert(
1888 SmolStr::new_static("feedReason"),
1889 LexUserType::Union(LexRefUnion {
1890 refs: vec![
1891 CowStr::new_static("#reasonLike"),
1892 CowStr::new_static("#reasonBookmark"),
1893 CowStr::new_static("#reasonSubscription")
1894 ],
1895 ..Default::default()
1896 }),
1897 );
1898 map.insert(
1899 SmolStr::new_static("notebookView"),
1900 LexUserType::Object(LexObject {
1901 required: Some(
1902 vec![
1903 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
1904 SmolStr::new_static("authors"),
1905 SmolStr::new_static("record"),
1906 SmolStr::new_static("indexedAt")
1907 ],
1908 ),
1909 properties: {
1910 #[allow(unused_mut)]
1911 let mut map = BTreeMap::new();
1912 map.insert(
1913 SmolStr::new_static("authors"),
1914 LexObjectProperty::Array(LexArray {
1915 items: LexArrayItem::Ref(LexRef {
1916 r#ref: CowStr::new_static("#authorListView"),
1917 ..Default::default()
1918 }),
1919 ..Default::default()
1920 }),
1921 );
1922 map.insert(
1923 SmolStr::new_static("bookmarkCount"),
1924 LexObjectProperty::Integer(LexInteger {
1925 ..Default::default()
1926 }),
1927 );
1928 map.insert(
1929 SmolStr::new_static("cid"),
1930 LexObjectProperty::String(LexString {
1931 format: Some(LexStringFormat::Cid),
1932 ..Default::default()
1933 }),
1934 );
1935 map.insert(
1936 SmolStr::new_static("entryCount"),
1937 LexObjectProperty::Integer(LexInteger {
1938 ..Default::default()
1939 }),
1940 );
1941 map.insert(
1942 SmolStr::new_static("indexedAt"),
1943 LexObjectProperty::String(LexString {
1944 format: Some(LexStringFormat::Datetime),
1945 ..Default::default()
1946 }),
1947 );
1948 map.insert(
1949 SmolStr::new_static("likeCount"),
1950 LexObjectProperty::Integer(LexInteger {
1951 ..Default::default()
1952 }),
1953 );
1954 map.insert(
1955 SmolStr::new_static("path"),
1956 LexObjectProperty::Ref(LexRef {
1957 r#ref: CowStr::new_static("#path"),
1958 ..Default::default()
1959 }),
1960 );
1961 map.insert(
1962 SmolStr::new_static("permissions"),
1963 LexObjectProperty::Ref(LexRef {
1964 r#ref: CowStr::new_static("#permissionsState"),
1965 ..Default::default()
1966 }),
1967 );
1968 map.insert(
1969 SmolStr::new_static("record"),
1970 LexObjectProperty::Unknown(LexUnknown {
1971 ..Default::default()
1972 }),
1973 );
1974 map.insert(
1975 SmolStr::new_static("subscriberCount"),
1976 LexObjectProperty::Integer(LexInteger {
1977 ..Default::default()
1978 }),
1979 );
1980 map.insert(
1981 SmolStr::new_static("tags"),
1982 LexObjectProperty::Ref(LexRef {
1983 r#ref: CowStr::new_static("#tags"),
1984 ..Default::default()
1985 }),
1986 );
1987 map.insert(
1988 SmolStr::new_static("title"),
1989 LexObjectProperty::Ref(LexRef {
1990 r#ref: CowStr::new_static("#title"),
1991 ..Default::default()
1992 }),
1993 );
1994 map.insert(
1995 SmolStr::new_static("uri"),
1996 LexObjectProperty::String(LexString {
1997 format: Some(LexStringFormat::AtUri),
1998 ..Default::default()
1999 }),
2000 );
2001 map.insert(
2002 SmolStr::new_static("viewerBookmark"),
2003 LexObjectProperty::String(LexString {
2004 format: Some(LexStringFormat::AtUri),
2005 ..Default::default()
2006 }),
2007 );
2008 map.insert(
2009 SmolStr::new_static("viewerLike"),
2010 LexObjectProperty::String(LexString {
2011 format: Some(LexStringFormat::AtUri),
2012 ..Default::default()
2013 }),
2014 );
2015 map.insert(
2016 SmolStr::new_static("viewerReadingProgress"),
2017 LexObjectProperty::Ref(LexRef {
2018 r#ref: CowStr::new_static("#readingProgress"),
2019 ..Default::default()
2020 }),
2021 );
2022 map.insert(
2023 SmolStr::new_static("viewerSubscription"),
2024 LexObjectProperty::String(LexString {
2025 format: Some(LexStringFormat::AtUri),
2026 ..Default::default()
2027 }),
2028 );
2029 map
2030 },
2031 ..Default::default()
2032 }),
2033 );
2034 map.insert(
2035 SmolStr::new_static("pageView"),
2036 LexUserType::Object(LexObject {
2037 description: Some(
2038 CowStr::new_static(
2039 "Hydrated view of a page (entries displayed together).",
2040 ),
2041 ),
2042 required: Some(
2043 vec![
2044 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
2045 SmolStr::new_static("notebook"),
2046 SmolStr::new_static("record"),
2047 SmolStr::new_static("indexedAt")
2048 ],
2049 ),
2050 properties: {
2051 #[allow(unused_mut)]
2052 let mut map = BTreeMap::new();
2053 map.insert(
2054 SmolStr::new_static("cid"),
2055 LexObjectProperty::String(LexString {
2056 format: Some(LexStringFormat::Cid),
2057 ..Default::default()
2058 }),
2059 );
2060 map.insert(
2061 SmolStr::new_static("entryCount"),
2062 LexObjectProperty::Integer(LexInteger {
2063 ..Default::default()
2064 }),
2065 );
2066 map.insert(
2067 SmolStr::new_static("indexedAt"),
2068 LexObjectProperty::String(LexString {
2069 format: Some(LexStringFormat::Datetime),
2070 ..Default::default()
2071 }),
2072 );
2073 map.insert(
2074 SmolStr::new_static("notebook"),
2075 LexObjectProperty::Ref(LexRef {
2076 r#ref: CowStr::new_static("#notebookView"),
2077 ..Default::default()
2078 }),
2079 );
2080 map.insert(
2081 SmolStr::new_static("record"),
2082 LexObjectProperty::Unknown(LexUnknown {
2083 ..Default::default()
2084 }),
2085 );
2086 map.insert(
2087 SmolStr::new_static("tags"),
2088 LexObjectProperty::Ref(LexRef {
2089 r#ref: CowStr::new_static("#tags"),
2090 ..Default::default()
2091 }),
2092 );
2093 map.insert(
2094 SmolStr::new_static("title"),
2095 LexObjectProperty::Ref(LexRef {
2096 r#ref: CowStr::new_static("#title"),
2097 ..Default::default()
2098 }),
2099 );
2100 map.insert(
2101 SmolStr::new_static("uri"),
2102 LexObjectProperty::String(LexString {
2103 format: Some(LexStringFormat::AtUri),
2104 ..Default::default()
2105 }),
2106 );
2107 map
2108 },
2109 ..Default::default()
2110 }),
2111 );
2112 map.insert(
2113 SmolStr::new_static("path"),
2114 LexUserType::String(LexString {
2115 description: Some(CowStr::new_static("The path of the notebook.")),
2116 max_length: Some(100usize),
2117 ..Default::default()
2118 }),
2119 );
2120 map.insert(
2121 SmolStr::new_static("permissionGrant"),
2122 LexUserType::Object(LexObject {
2123 description: Some(
2124 CowStr::new_static(
2125 "A single permission grant. For resource authority: source=resource URI, grantedAt=createdAt. For invitees: source=invite URI, grantedAt=accept createdAt.",
2126 ),
2127 ),
2128 required: Some(
2129 vec![
2130 SmolStr::new_static("did"), SmolStr::new_static("scope"),
2131 SmolStr::new_static("source"),
2132 SmolStr::new_static("grantedAt")
2133 ],
2134 ),
2135 properties: {
2136 #[allow(unused_mut)]
2137 let mut map = BTreeMap::new();
2138 map.insert(
2139 SmolStr::new_static("did"),
2140 LexObjectProperty::String(LexString {
2141 format: Some(LexStringFormat::Did),
2142 ..Default::default()
2143 }),
2144 );
2145 map.insert(
2146 SmolStr::new_static("grantedAt"),
2147 LexObjectProperty::String(LexString {
2148 description: Some(
2149 CowStr::new_static(
2150 "For authority: record createdAt. For invitees: accept createdAt",
2151 ),
2152 ),
2153 format: Some(LexStringFormat::Datetime),
2154 ..Default::default()
2155 }),
2156 );
2157 map.insert(
2158 SmolStr::new_static("scope"),
2159 LexObjectProperty::String(LexString {
2160 description: Some(
2161 CowStr::new_static(
2162 "direct = this resource (includes authority), inherited = via notebook invite",
2163 ),
2164 ),
2165 ..Default::default()
2166 }),
2167 );
2168 map.insert(
2169 SmolStr::new_static("source"),
2170 LexObjectProperty::String(LexString {
2171 description: Some(
2172 CowStr::new_static(
2173 "For authority: resource URI. For invitees: invite URI",
2174 ),
2175 ),
2176 format: Some(LexStringFormat::AtUri),
2177 ..Default::default()
2178 }),
2179 );
2180 map
2181 },
2182 ..Default::default()
2183 }),
2184 );
2185 map.insert(
2186 SmolStr::new_static("permissionsState"),
2187 LexUserType::Object(LexObject {
2188 description: Some(
2189 CowStr::new_static(
2190 "ACL-style permissions for a resource. Separate from authors (who contributed).",
2191 ),
2192 ),
2193 required: Some(vec![SmolStr::new_static("editors")]),
2194 properties: {
2195 #[allow(unused_mut)]
2196 let mut map = BTreeMap::new();
2197 map.insert(
2198 SmolStr::new_static("editors"),
2199 LexObjectProperty::Array(LexArray {
2200 description: Some(
2201 CowStr::new_static("DIDs that can edit this resource"),
2202 ),
2203 items: LexArrayItem::Ref(LexRef {
2204 r#ref: CowStr::new_static("#permissionGrant"),
2205 ..Default::default()
2206 }),
2207 ..Default::default()
2208 }),
2209 );
2210 map.insert(
2211 SmolStr::new_static("viewers"),
2212 LexObjectProperty::Array(LexArray {
2213 description: Some(
2214 CowStr::new_static("DIDs that can view (future use)"),
2215 ),
2216 items: LexArrayItem::Ref(LexRef {
2217 r#ref: CowStr::new_static("#permissionGrant"),
2218 ..Default::default()
2219 }),
2220 ..Default::default()
2221 }),
2222 );
2223 map
2224 },
2225 ..Default::default()
2226 }),
2227 );
2228 map.insert(
2229 SmolStr::new_static("publishedVersionView"),
2230 LexUserType::Object(LexObject {
2231 description: Some(
2232 CowStr::new_static(
2233 "A published version of an entry in a collaborator's repo.",
2234 ),
2235 ),
2236 required: Some(
2237 vec![
2238 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
2239 SmolStr::new_static("publisher"),
2240 SmolStr::new_static("publishedAt")
2241 ],
2242 ),
2243 properties: {
2244 #[allow(unused_mut)]
2245 let mut map = BTreeMap::new();
2246 map.insert(
2247 SmolStr::new_static("cid"),
2248 LexObjectProperty::String(LexString {
2249 format: Some(LexStringFormat::Cid),
2250 ..Default::default()
2251 }),
2252 );
2253 map.insert(
2254 SmolStr::new_static("divergedFrom"),
2255 LexObjectProperty::Ref(LexRef {
2256 r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
2257 ..Default::default()
2258 }),
2259 );
2260 map.insert(
2261 SmolStr::new_static("isCanonical"),
2262 LexObjectProperty::Boolean(LexBoolean {
2263 ..Default::default()
2264 }),
2265 );
2266 map.insert(
2267 SmolStr::new_static("publishedAt"),
2268 LexObjectProperty::String(LexString {
2269 format: Some(LexStringFormat::Datetime),
2270 ..Default::default()
2271 }),
2272 );
2273 map.insert(
2274 SmolStr::new_static("publisher"),
2275 LexObjectProperty::Ref(LexRef {
2276 r#ref: CowStr::new_static(
2277 "sh.weaver.actor.defs#profileViewBasic",
2278 ),
2279 ..Default::default()
2280 }),
2281 );
2282 map.insert(
2283 SmolStr::new_static("updatedAt"),
2284 LexObjectProperty::String(LexString {
2285 format: Some(LexStringFormat::Datetime),
2286 ..Default::default()
2287 }),
2288 );
2289 map.insert(
2290 SmolStr::new_static("uri"),
2291 LexObjectProperty::String(LexString {
2292 format: Some(LexStringFormat::AtUri),
2293 ..Default::default()
2294 }),
2295 );
2296 map
2297 },
2298 ..Default::default()
2299 }),
2300 );
2301 map.insert(
2302 SmolStr::new_static("readingProgress"),
2303 LexUserType::Object(LexObject {
2304 description: Some(
2305 CowStr::new_static(
2306 "Viewer's reading progress (appview-side state, not a record).",
2307 ),
2308 ),
2309 properties: {
2310 #[allow(unused_mut)]
2311 let mut map = BTreeMap::new();
2312 map.insert(
2313 SmolStr::new_static("currentEntry"),
2314 LexObjectProperty::String(LexString {
2315 description: Some(
2316 CowStr::new_static("Last entry the viewer was reading."),
2317 ),
2318 format: Some(LexStringFormat::AtUri),
2319 ..Default::default()
2320 }),
2321 );
2322 map.insert(
2323 SmolStr::new_static("finishedAt"),
2324 LexObjectProperty::String(LexString {
2325 format: Some(LexStringFormat::Datetime),
2326 ..Default::default()
2327 }),
2328 );
2329 map.insert(
2330 SmolStr::new_static("lastReadAt"),
2331 LexObjectProperty::String(LexString {
2332 format: Some(LexStringFormat::Datetime),
2333 ..Default::default()
2334 }),
2335 );
2336 map.insert(
2337 SmolStr::new_static("percentComplete"),
2338 LexObjectProperty::Integer(LexInteger {
2339 minimum: Some(0i64),
2340 maximum: Some(100i64),
2341 ..Default::default()
2342 }),
2343 );
2344 map.insert(
2345 SmolStr::new_static("startedAt"),
2346 LexObjectProperty::String(LexString {
2347 format: Some(LexStringFormat::Datetime),
2348 ..Default::default()
2349 }),
2350 );
2351 map.insert(
2352 SmolStr::new_static("status"),
2353 LexObjectProperty::String(LexString { ..Default::default() }),
2354 );
2355 map
2356 },
2357 ..Default::default()
2358 }),
2359 );
2360 map.insert(
2361 SmolStr::new_static("reasonBookmark"),
2362 LexUserType::Object(LexObject {
2363 required: Some(
2364 vec![SmolStr::new_static("by"), SmolStr::new_static("indexedAt")],
2365 ),
2366 properties: {
2367 #[allow(unused_mut)]
2368 let mut map = BTreeMap::new();
2369 map.insert(
2370 SmolStr::new_static("by"),
2371 LexObjectProperty::Ref(LexRef {
2372 r#ref: CowStr::new_static(
2373 "sh.weaver.actor.defs#profileViewBasic",
2374 ),
2375 ..Default::default()
2376 }),
2377 );
2378 map.insert(
2379 SmolStr::new_static("indexedAt"),
2380 LexObjectProperty::String(LexString {
2381 format: Some(LexStringFormat::Datetime),
2382 ..Default::default()
2383 }),
2384 );
2385 map
2386 },
2387 ..Default::default()
2388 }),
2389 );
2390 map.insert(
2391 SmolStr::new_static("reasonLike"),
2392 LexUserType::Object(LexObject {
2393 required: Some(
2394 vec![SmolStr::new_static("by"), SmolStr::new_static("indexedAt")],
2395 ),
2396 properties: {
2397 #[allow(unused_mut)]
2398 let mut map = BTreeMap::new();
2399 map.insert(
2400 SmolStr::new_static("by"),
2401 LexObjectProperty::Ref(LexRef {
2402 r#ref: CowStr::new_static(
2403 "sh.weaver.actor.defs#profileViewBasic",
2404 ),
2405 ..Default::default()
2406 }),
2407 );
2408 map.insert(
2409 SmolStr::new_static("indexedAt"),
2410 LexObjectProperty::String(LexString {
2411 format: Some(LexStringFormat::Datetime),
2412 ..Default::default()
2413 }),
2414 );
2415 map
2416 },
2417 ..Default::default()
2418 }),
2419 );
2420 map.insert(
2421 SmolStr::new_static("reasonSubscription"),
2422 LexUserType::Object(LexObject {
2423 required: Some(vec![SmolStr::new_static("indexedAt")]),
2424 properties: {
2425 #[allow(unused_mut)]
2426 let mut map = BTreeMap::new();
2427 map.insert(
2428 SmolStr::new_static("indexedAt"),
2429 LexObjectProperty::String(LexString {
2430 format: Some(LexStringFormat::Datetime),
2431 ..Default::default()
2432 }),
2433 );
2434 map
2435 },
2436 ..Default::default()
2437 }),
2438 );
2439 map.insert(
2440 SmolStr::new_static("renderedView"),
2441 LexUserType::Object(LexObject {
2442 description: Some(
2443 CowStr::new_static(
2444 "View of a rendered and cached notebook entry",
2445 ),
2446 ),
2447 required: Some(vec![SmolStr::new_static("html")]),
2448 properties: {
2449 #[allow(unused_mut)]
2450 let mut map = BTreeMap::new();
2451 map.insert(
2452 SmolStr::new_static("css"),
2453 LexObjectProperty::Blob(LexBlob { ..Default::default() }),
2454 );
2455 map.insert(
2456 SmolStr::new_static("html"),
2457 LexObjectProperty::Blob(LexBlob { ..Default::default() }),
2458 );
2459 map
2460 },
2461 ..Default::default()
2462 }),
2463 );
2464 map.insert(
2465 SmolStr::new_static("tags"),
2466 LexUserType::Array(LexArray {
2467 items: LexArrayItem::String(LexString {
2468 max_length: Some(64usize),
2469 ..Default::default()
2470 }),
2471 max_length: Some(10usize),
2472 ..Default::default()
2473 }),
2474 );
2475 map.insert(
2476 SmolStr::new_static("title"),
2477 LexUserType::String(LexString {
2478 description: Some(
2479 CowStr::new_static("The title of the notebook entry."),
2480 ),
2481 max_length: Some(300usize),
2482 ..Default::default()
2483 }),
2484 );
2485 map
2486 },
2487 ..Default::default()
2488 }
2489}
2490
2491pub mod book_entry_ref_state {
2492
2493 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2494 #[allow(unused)]
2495 use ::core::marker::PhantomData;
2496 mod sealed {
2497 pub trait Sealed {}
2498 }
2499 pub trait State: sealed::Sealed {
2501 type Entry;
2502 }
2503 pub struct Empty(());
2505 impl sealed::Sealed for Empty {}
2506 impl State for Empty {
2507 type Entry = Unset;
2508 }
2509 pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
2511 impl<S: State> sealed::Sealed for SetEntry<S> {}
2512 impl<S: State> State for SetEntry<S> {
2513 type Entry = Set<members::entry>;
2514 }
2515 #[allow(non_camel_case_types)]
2517 pub mod members {
2518 pub struct entry(());
2520 }
2521}
2522
2523pub struct BookEntryRefBuilder<'a, S: book_entry_ref_state::State> {
2525 _state: PhantomData<fn() -> S>,
2526 _fields: (Option<notebook::EntryView<'a>>,),
2527 _lifetime: PhantomData<&'a ()>,
2528}
2529
2530impl<'a> BookEntryRef<'a> {
2531 pub fn new() -> BookEntryRefBuilder<'a, book_entry_ref_state::Empty> {
2533 BookEntryRefBuilder::new()
2534 }
2535}
2536
2537impl<'a> BookEntryRefBuilder<'a, book_entry_ref_state::Empty> {
2538 pub fn new() -> Self {
2540 BookEntryRefBuilder {
2541 _state: PhantomData,
2542 _fields: (None,),
2543 _lifetime: PhantomData,
2544 }
2545 }
2546}
2547
2548impl<'a, S> BookEntryRefBuilder<'a, S>
2549where
2550 S: book_entry_ref_state::State,
2551 S::Entry: book_entry_ref_state::IsUnset,
2552{
2553 pub fn entry(
2555 mut self,
2556 value: impl Into<notebook::EntryView<'a>>,
2557 ) -> BookEntryRefBuilder<'a, book_entry_ref_state::SetEntry<S>> {
2558 self._fields.0 = Option::Some(value.into());
2559 BookEntryRefBuilder {
2560 _state: PhantomData,
2561 _fields: self._fields,
2562 _lifetime: PhantomData,
2563 }
2564 }
2565}
2566
2567impl<'a, S> BookEntryRefBuilder<'a, S>
2568where
2569 S: book_entry_ref_state::State,
2570 S::Entry: book_entry_ref_state::IsSet,
2571{
2572 pub fn build(self) -> BookEntryRef<'a> {
2574 BookEntryRef {
2575 entry: self._fields.0.unwrap(),
2576 extra_data: Default::default(),
2577 }
2578 }
2579 pub fn build_with_data(
2581 self,
2582 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
2583 ) -> BookEntryRef<'a> {
2584 BookEntryRef {
2585 entry: self._fields.0.unwrap(),
2586 extra_data: Some(extra_data),
2587 }
2588 }
2589}
2590
2591pub mod book_entry_view_state {
2592
2593 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2594 #[allow(unused)]
2595 use ::core::marker::PhantomData;
2596 mod sealed {
2597 pub trait Sealed {}
2598 }
2599 pub trait State: sealed::Sealed {
2601 type Entry;
2602 type Index;
2603 }
2604 pub struct Empty(());
2606 impl sealed::Sealed for Empty {}
2607 impl State for Empty {
2608 type Entry = Unset;
2609 type Index = Unset;
2610 }
2611 pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
2613 impl<S: State> sealed::Sealed for SetEntry<S> {}
2614 impl<S: State> State for SetEntry<S> {
2615 type Entry = Set<members::entry>;
2616 type Index = S::Index;
2617 }
2618 pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
2620 impl<S: State> sealed::Sealed for SetIndex<S> {}
2621 impl<S: State> State for SetIndex<S> {
2622 type Entry = S::Entry;
2623 type Index = Set<members::index>;
2624 }
2625 #[allow(non_camel_case_types)]
2627 pub mod members {
2628 pub struct entry(());
2630 pub struct index(());
2632 }
2633}
2634
2635pub struct BookEntryViewBuilder<'a, S: book_entry_view_state::State> {
2637 _state: PhantomData<fn() -> S>,
2638 _fields: (
2639 Option<notebook::EntryView<'a>>,
2640 Option<i64>,
2641 Option<notebook::BookEntryRef<'a>>,
2642 Option<notebook::BookEntryRef<'a>>,
2643 ),
2644 _lifetime: PhantomData<&'a ()>,
2645}
2646
2647impl<'a> BookEntryView<'a> {
2648 pub fn new() -> BookEntryViewBuilder<'a, book_entry_view_state::Empty> {
2650 BookEntryViewBuilder::new()
2651 }
2652}
2653
2654impl<'a> BookEntryViewBuilder<'a, book_entry_view_state::Empty> {
2655 pub fn new() -> Self {
2657 BookEntryViewBuilder {
2658 _state: PhantomData,
2659 _fields: (None, None, None, None),
2660 _lifetime: PhantomData,
2661 }
2662 }
2663}
2664
2665impl<'a, S> BookEntryViewBuilder<'a, S>
2666where
2667 S: book_entry_view_state::State,
2668 S::Entry: book_entry_view_state::IsUnset,
2669{
2670 pub fn entry(
2672 mut self,
2673 value: impl Into<notebook::EntryView<'a>>,
2674 ) -> BookEntryViewBuilder<'a, book_entry_view_state::SetEntry<S>> {
2675 self._fields.0 = Option::Some(value.into());
2676 BookEntryViewBuilder {
2677 _state: PhantomData,
2678 _fields: self._fields,
2679 _lifetime: PhantomData,
2680 }
2681 }
2682}
2683
2684impl<'a, S> BookEntryViewBuilder<'a, S>
2685where
2686 S: book_entry_view_state::State,
2687 S::Index: book_entry_view_state::IsUnset,
2688{
2689 pub fn index(
2691 mut self,
2692 value: impl Into<i64>,
2693 ) -> BookEntryViewBuilder<'a, book_entry_view_state::SetIndex<S>> {
2694 self._fields.1 = Option::Some(value.into());
2695 BookEntryViewBuilder {
2696 _state: PhantomData,
2697 _fields: self._fields,
2698 _lifetime: PhantomData,
2699 }
2700 }
2701}
2702
2703impl<'a, S: book_entry_view_state::State> BookEntryViewBuilder<'a, S> {
2704 pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
2706 self._fields.2 = value.into();
2707 self
2708 }
2709 pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
2711 self._fields.2 = value;
2712 self
2713 }
2714}
2715
2716impl<'a, S: book_entry_view_state::State> BookEntryViewBuilder<'a, S> {
2717 pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
2719 self._fields.3 = value.into();
2720 self
2721 }
2722 pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
2724 self._fields.3 = value;
2725 self
2726 }
2727}
2728
2729impl<'a, S> BookEntryViewBuilder<'a, S>
2730where
2731 S: book_entry_view_state::State,
2732 S::Entry: book_entry_view_state::IsSet,
2733 S::Index: book_entry_view_state::IsSet,
2734{
2735 pub fn build(self) -> BookEntryView<'a> {
2737 BookEntryView {
2738 entry: self._fields.0.unwrap(),
2739 index: self._fields.1.unwrap(),
2740 next: self._fields.2,
2741 prev: self._fields.3,
2742 extra_data: Default::default(),
2743 }
2744 }
2745 pub fn build_with_data(
2747 self,
2748 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
2749 ) -> BookEntryView<'a> {
2750 BookEntryView {
2751 entry: self._fields.0.unwrap(),
2752 index: self._fields.1.unwrap(),
2753 next: self._fields.2,
2754 prev: self._fields.3,
2755 extra_data: Some(extra_data),
2756 }
2757 }
2758}
2759
2760pub mod chapter_entry_view_state {
2761
2762 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2763 #[allow(unused)]
2764 use ::core::marker::PhantomData;
2765 mod sealed {
2766 pub trait Sealed {}
2767 }
2768 pub trait State: sealed::Sealed {
2770 type Entry;
2771 type Index;
2772 }
2773 pub struct Empty(());
2775 impl sealed::Sealed for Empty {}
2776 impl State for Empty {
2777 type Entry = Unset;
2778 type Index = Unset;
2779 }
2780 pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
2782 impl<S: State> sealed::Sealed for SetEntry<S> {}
2783 impl<S: State> State for SetEntry<S> {
2784 type Entry = Set<members::entry>;
2785 type Index = S::Index;
2786 }
2787 pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
2789 impl<S: State> sealed::Sealed for SetIndex<S> {}
2790 impl<S: State> State for SetIndex<S> {
2791 type Entry = S::Entry;
2792 type Index = Set<members::index>;
2793 }
2794 #[allow(non_camel_case_types)]
2796 pub mod members {
2797 pub struct entry(());
2799 pub struct index(());
2801 }
2802}
2803
2804pub struct ChapterEntryViewBuilder<'a, S: chapter_entry_view_state::State> {
2806 _state: PhantomData<fn() -> S>,
2807 _fields: (
2808 Option<notebook::EntryView<'a>>,
2809 Option<i64>,
2810 Option<notebook::BookEntryRef<'a>>,
2811 Option<notebook::BookEntryRef<'a>>,
2812 ),
2813 _lifetime: PhantomData<&'a ()>,
2814}
2815
2816impl<'a> ChapterEntryView<'a> {
2817 pub fn new() -> ChapterEntryViewBuilder<'a, chapter_entry_view_state::Empty> {
2819 ChapterEntryViewBuilder::new()
2820 }
2821}
2822
2823impl<'a> ChapterEntryViewBuilder<'a, chapter_entry_view_state::Empty> {
2824 pub fn new() -> Self {
2826 ChapterEntryViewBuilder {
2827 _state: PhantomData,
2828 _fields: (None, None, None, None),
2829 _lifetime: PhantomData,
2830 }
2831 }
2832}
2833
2834impl<'a, S> ChapterEntryViewBuilder<'a, S>
2835where
2836 S: chapter_entry_view_state::State,
2837 S::Entry: chapter_entry_view_state::IsUnset,
2838{
2839 pub fn entry(
2841 mut self,
2842 value: impl Into<notebook::EntryView<'a>>,
2843 ) -> ChapterEntryViewBuilder<'a, chapter_entry_view_state::SetEntry<S>> {
2844 self._fields.0 = Option::Some(value.into());
2845 ChapterEntryViewBuilder {
2846 _state: PhantomData,
2847 _fields: self._fields,
2848 _lifetime: PhantomData,
2849 }
2850 }
2851}
2852
2853impl<'a, S> ChapterEntryViewBuilder<'a, S>
2854where
2855 S: chapter_entry_view_state::State,
2856 S::Index: chapter_entry_view_state::IsUnset,
2857{
2858 pub fn index(
2860 mut self,
2861 value: impl Into<i64>,
2862 ) -> ChapterEntryViewBuilder<'a, chapter_entry_view_state::SetIndex<S>> {
2863 self._fields.1 = Option::Some(value.into());
2864 ChapterEntryViewBuilder {
2865 _state: PhantomData,
2866 _fields: self._fields,
2867 _lifetime: PhantomData,
2868 }
2869 }
2870}
2871
2872impl<'a, S: chapter_entry_view_state::State> ChapterEntryViewBuilder<'a, S> {
2873 pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
2875 self._fields.2 = value.into();
2876 self
2877 }
2878 pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
2880 self._fields.2 = value;
2881 self
2882 }
2883}
2884
2885impl<'a, S: chapter_entry_view_state::State> ChapterEntryViewBuilder<'a, S> {
2886 pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
2888 self._fields.3 = value.into();
2889 self
2890 }
2891 pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
2893 self._fields.3 = value;
2894 self
2895 }
2896}
2897
2898impl<'a, S> ChapterEntryViewBuilder<'a, S>
2899where
2900 S: chapter_entry_view_state::State,
2901 S::Entry: chapter_entry_view_state::IsSet,
2902 S::Index: chapter_entry_view_state::IsSet,
2903{
2904 pub fn build(self) -> ChapterEntryView<'a> {
2906 ChapterEntryView {
2907 entry: self._fields.0.unwrap(),
2908 index: self._fields.1.unwrap(),
2909 next: self._fields.2,
2910 prev: self._fields.3,
2911 extra_data: Default::default(),
2912 }
2913 }
2914 pub fn build_with_data(
2916 self,
2917 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
2918 ) -> ChapterEntryView<'a> {
2919 ChapterEntryView {
2920 entry: self._fields.0.unwrap(),
2921 index: self._fields.1.unwrap(),
2922 next: self._fields.2,
2923 prev: self._fields.3,
2924 extra_data: Some(extra_data),
2925 }
2926 }
2927}
2928
2929pub mod chapter_view_state {
2930
2931 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2932 #[allow(unused)]
2933 use ::core::marker::PhantomData;
2934 mod sealed {
2935 pub trait Sealed {}
2936 }
2937 pub trait State: sealed::Sealed {
2939 type Authors;
2940 type Uri;
2941 type Cid;
2942 type IndexedAt;
2943 type Record;
2944 type Notebook;
2945 }
2946 pub struct Empty(());
2948 impl sealed::Sealed for Empty {}
2949 impl State for Empty {
2950 type Authors = Unset;
2951 type Uri = Unset;
2952 type Cid = Unset;
2953 type IndexedAt = Unset;
2954 type Record = Unset;
2955 type Notebook = Unset;
2956 }
2957 pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
2959 impl<S: State> sealed::Sealed for SetAuthors<S> {}
2960 impl<S: State> State for SetAuthors<S> {
2961 type Authors = Set<members::authors>;
2962 type Uri = S::Uri;
2963 type Cid = S::Cid;
2964 type IndexedAt = S::IndexedAt;
2965 type Record = S::Record;
2966 type Notebook = S::Notebook;
2967 }
2968 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
2970 impl<S: State> sealed::Sealed for SetUri<S> {}
2971 impl<S: State> State for SetUri<S> {
2972 type Authors = S::Authors;
2973 type Uri = Set<members::uri>;
2974 type Cid = S::Cid;
2975 type IndexedAt = S::IndexedAt;
2976 type Record = S::Record;
2977 type Notebook = S::Notebook;
2978 }
2979 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
2981 impl<S: State> sealed::Sealed for SetCid<S> {}
2982 impl<S: State> State for SetCid<S> {
2983 type Authors = S::Authors;
2984 type Uri = S::Uri;
2985 type Cid = Set<members::cid>;
2986 type IndexedAt = S::IndexedAt;
2987 type Record = S::Record;
2988 type Notebook = S::Notebook;
2989 }
2990 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
2992 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
2993 impl<S: State> State for SetIndexedAt<S> {
2994 type Authors = S::Authors;
2995 type Uri = S::Uri;
2996 type Cid = S::Cid;
2997 type IndexedAt = Set<members::indexed_at>;
2998 type Record = S::Record;
2999 type Notebook = S::Notebook;
3000 }
3001 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
3003 impl<S: State> sealed::Sealed for SetRecord<S> {}
3004 impl<S: State> State for SetRecord<S> {
3005 type Authors = S::Authors;
3006 type Uri = S::Uri;
3007 type Cid = S::Cid;
3008 type IndexedAt = S::IndexedAt;
3009 type Record = Set<members::record>;
3010 type Notebook = S::Notebook;
3011 }
3012 pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>);
3014 impl<S: State> sealed::Sealed for SetNotebook<S> {}
3015 impl<S: State> State for SetNotebook<S> {
3016 type Authors = S::Authors;
3017 type Uri = S::Uri;
3018 type Cid = S::Cid;
3019 type IndexedAt = S::IndexedAt;
3020 type Record = S::Record;
3021 type Notebook = Set<members::notebook>;
3022 }
3023 #[allow(non_camel_case_types)]
3025 pub mod members {
3026 pub struct authors(());
3028 pub struct uri(());
3030 pub struct cid(());
3032 pub struct indexed_at(());
3034 pub struct record(());
3036 pub struct notebook(());
3038 }
3039}
3040
3041pub struct ChapterViewBuilder<'a, S: chapter_view_state::State> {
3043 _state: PhantomData<fn() -> S>,
3044 _fields: (
3045 Option<Vec<notebook::AuthorListView<'a>>>,
3046 Option<Cid<'a>>,
3047 Option<i64>,
3048 Option<Datetime>,
3049 Option<notebook::NotebookView<'a>>,
3050 Option<Data<'a>>,
3051 Option<notebook::Tags<'a>>,
3052 Option<notebook::Title<'a>>,
3053 Option<AtUri<'a>>,
3054 ),
3055 _lifetime: PhantomData<&'a ()>,
3056}
3057
3058impl<'a> ChapterView<'a> {
3059 pub fn new() -> ChapterViewBuilder<'a, chapter_view_state::Empty> {
3061 ChapterViewBuilder::new()
3062 }
3063}
3064
3065impl<'a> ChapterViewBuilder<'a, chapter_view_state::Empty> {
3066 pub fn new() -> Self {
3068 ChapterViewBuilder {
3069 _state: PhantomData,
3070 _fields: (None, None, None, None, None, None, None, None, None),
3071 _lifetime: PhantomData,
3072 }
3073 }
3074}
3075
3076impl<'a, S> ChapterViewBuilder<'a, S>
3077where
3078 S: chapter_view_state::State,
3079 S::Authors: chapter_view_state::IsUnset,
3080{
3081 pub fn authors(
3083 mut self,
3084 value: impl Into<Vec<notebook::AuthorListView<'a>>>,
3085 ) -> ChapterViewBuilder<'a, chapter_view_state::SetAuthors<S>> {
3086 self._fields.0 = Option::Some(value.into());
3087 ChapterViewBuilder {
3088 _state: PhantomData,
3089 _fields: self._fields,
3090 _lifetime: PhantomData,
3091 }
3092 }
3093}
3094
3095impl<'a, S> ChapterViewBuilder<'a, S>
3096where
3097 S: chapter_view_state::State,
3098 S::Cid: chapter_view_state::IsUnset,
3099{
3100 pub fn cid(
3102 mut self,
3103 value: impl Into<Cid<'a>>,
3104 ) -> ChapterViewBuilder<'a, chapter_view_state::SetCid<S>> {
3105 self._fields.1 = Option::Some(value.into());
3106 ChapterViewBuilder {
3107 _state: PhantomData,
3108 _fields: self._fields,
3109 _lifetime: PhantomData,
3110 }
3111 }
3112}
3113
3114impl<'a, S: chapter_view_state::State> ChapterViewBuilder<'a, S> {
3115 pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
3117 self._fields.2 = value.into();
3118 self
3119 }
3120 pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
3122 self._fields.2 = value;
3123 self
3124 }
3125}
3126
3127impl<'a, S> ChapterViewBuilder<'a, S>
3128where
3129 S: chapter_view_state::State,
3130 S::IndexedAt: chapter_view_state::IsUnset,
3131{
3132 pub fn indexed_at(
3134 mut self,
3135 value: impl Into<Datetime>,
3136 ) -> ChapterViewBuilder<'a, chapter_view_state::SetIndexedAt<S>> {
3137 self._fields.3 = Option::Some(value.into());
3138 ChapterViewBuilder {
3139 _state: PhantomData,
3140 _fields: self._fields,
3141 _lifetime: PhantomData,
3142 }
3143 }
3144}
3145
3146impl<'a, S> ChapterViewBuilder<'a, S>
3147where
3148 S: chapter_view_state::State,
3149 S::Notebook: chapter_view_state::IsUnset,
3150{
3151 pub fn notebook(
3153 mut self,
3154 value: impl Into<notebook::NotebookView<'a>>,
3155 ) -> ChapterViewBuilder<'a, chapter_view_state::SetNotebook<S>> {
3156 self._fields.4 = Option::Some(value.into());
3157 ChapterViewBuilder {
3158 _state: PhantomData,
3159 _fields: self._fields,
3160 _lifetime: PhantomData,
3161 }
3162 }
3163}
3164
3165impl<'a, S> ChapterViewBuilder<'a, S>
3166where
3167 S: chapter_view_state::State,
3168 S::Record: chapter_view_state::IsUnset,
3169{
3170 pub fn record(
3172 mut self,
3173 value: impl Into<Data<'a>>,
3174 ) -> ChapterViewBuilder<'a, chapter_view_state::SetRecord<S>> {
3175 self._fields.5 = Option::Some(value.into());
3176 ChapterViewBuilder {
3177 _state: PhantomData,
3178 _fields: self._fields,
3179 _lifetime: PhantomData,
3180 }
3181 }
3182}
3183
3184impl<'a, S: chapter_view_state::State> ChapterViewBuilder<'a, S> {
3185 pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
3187 self._fields.6 = value.into();
3188 self
3189 }
3190 pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
3192 self._fields.6 = value;
3193 self
3194 }
3195}
3196
3197impl<'a, S: chapter_view_state::State> ChapterViewBuilder<'a, S> {
3198 pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
3200 self._fields.7 = value.into();
3201 self
3202 }
3203 pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
3205 self._fields.7 = value;
3206 self
3207 }
3208}
3209
3210impl<'a, S> ChapterViewBuilder<'a, S>
3211where
3212 S: chapter_view_state::State,
3213 S::Uri: chapter_view_state::IsUnset,
3214{
3215 pub fn uri(
3217 mut self,
3218 value: impl Into<AtUri<'a>>,
3219 ) -> ChapterViewBuilder<'a, chapter_view_state::SetUri<S>> {
3220 self._fields.8 = Option::Some(value.into());
3221 ChapterViewBuilder {
3222 _state: PhantomData,
3223 _fields: self._fields,
3224 _lifetime: PhantomData,
3225 }
3226 }
3227}
3228
3229impl<'a, S> ChapterViewBuilder<'a, S>
3230where
3231 S: chapter_view_state::State,
3232 S::Authors: chapter_view_state::IsSet,
3233 S::Uri: chapter_view_state::IsSet,
3234 S::Cid: chapter_view_state::IsSet,
3235 S::IndexedAt: chapter_view_state::IsSet,
3236 S::Record: chapter_view_state::IsSet,
3237 S::Notebook: chapter_view_state::IsSet,
3238{
3239 pub fn build(self) -> ChapterView<'a> {
3241 ChapterView {
3242 authors: self._fields.0.unwrap(),
3243 cid: self._fields.1.unwrap(),
3244 entry_count: self._fields.2,
3245 indexed_at: self._fields.3.unwrap(),
3246 notebook: self._fields.4.unwrap(),
3247 record: self._fields.5.unwrap(),
3248 tags: self._fields.6,
3249 title: self._fields.7,
3250 uri: self._fields.8.unwrap(),
3251 extra_data: Default::default(),
3252 }
3253 }
3254 pub fn build_with_data(
3256 self,
3257 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
3258 ) -> ChapterView<'a> {
3259 ChapterView {
3260 authors: self._fields.0.unwrap(),
3261 cid: self._fields.1.unwrap(),
3262 entry_count: self._fields.2,
3263 indexed_at: self._fields.3.unwrap(),
3264 notebook: self._fields.4.unwrap(),
3265 record: self._fields.5.unwrap(),
3266 tags: self._fields.6,
3267 title: self._fields.7,
3268 uri: self._fields.8.unwrap(),
3269 extra_data: Some(extra_data),
3270 }
3271 }
3272}
3273
3274fn _default_content_format_markdown() -> Option<CowStr<'static>> {
3275 Some(CowStr::from("weaver"))
3276}
3277
3278impl Default for ContentFormat<'_> {
3279 fn default() -> Self {
3280 Self {
3281 markdown: Some(CowStr::from("weaver")),
3282 extra_data: Default::default(),
3283 }
3284 }
3285}
3286
3287pub mod entry_view_state {
3288
3289 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
3290 #[allow(unused)]
3291 use ::core::marker::PhantomData;
3292 mod sealed {
3293 pub trait Sealed {}
3294 }
3295 pub trait State: sealed::Sealed {
3297 type Uri;
3298 type Cid;
3299 type Authors;
3300 type IndexedAt;
3301 type Record;
3302 }
3303 pub struct Empty(());
3305 impl sealed::Sealed for Empty {}
3306 impl State for Empty {
3307 type Uri = Unset;
3308 type Cid = Unset;
3309 type Authors = Unset;
3310 type IndexedAt = Unset;
3311 type Record = Unset;
3312 }
3313 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
3315 impl<S: State> sealed::Sealed for SetUri<S> {}
3316 impl<S: State> State for SetUri<S> {
3317 type Uri = Set<members::uri>;
3318 type Cid = S::Cid;
3319 type Authors = S::Authors;
3320 type IndexedAt = S::IndexedAt;
3321 type Record = S::Record;
3322 }
3323 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
3325 impl<S: State> sealed::Sealed for SetCid<S> {}
3326 impl<S: State> State for SetCid<S> {
3327 type Uri = S::Uri;
3328 type Cid = Set<members::cid>;
3329 type Authors = S::Authors;
3330 type IndexedAt = S::IndexedAt;
3331 type Record = S::Record;
3332 }
3333 pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
3335 impl<S: State> sealed::Sealed for SetAuthors<S> {}
3336 impl<S: State> State for SetAuthors<S> {
3337 type Uri = S::Uri;
3338 type Cid = S::Cid;
3339 type Authors = Set<members::authors>;
3340 type IndexedAt = S::IndexedAt;
3341 type Record = S::Record;
3342 }
3343 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
3345 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
3346 impl<S: State> State for SetIndexedAt<S> {
3347 type Uri = S::Uri;
3348 type Cid = S::Cid;
3349 type Authors = S::Authors;
3350 type IndexedAt = Set<members::indexed_at>;
3351 type Record = S::Record;
3352 }
3353 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
3355 impl<S: State> sealed::Sealed for SetRecord<S> {}
3356 impl<S: State> State for SetRecord<S> {
3357 type Uri = S::Uri;
3358 type Cid = S::Cid;
3359 type Authors = S::Authors;
3360 type IndexedAt = S::IndexedAt;
3361 type Record = Set<members::record>;
3362 }
3363 #[allow(non_camel_case_types)]
3365 pub mod members {
3366 pub struct uri(());
3368 pub struct cid(());
3370 pub struct authors(());
3372 pub struct indexed_at(());
3374 pub struct record(());
3376 }
3377}
3378
3379pub struct EntryViewBuilder<'a, S: entry_view_state::State> {
3381 _state: PhantomData<fn() -> S>,
3382 _fields: (
3383 Option<Vec<notebook::AuthorListView<'a>>>,
3384 Option<i64>,
3385 Option<Cid<'a>>,
3386 Option<Datetime>,
3387 Option<i64>,
3388 Option<notebook::Path<'a>>,
3389 Option<notebook::PermissionsState<'a>>,
3390 Option<Data<'a>>,
3391 Option<notebook::RenderedView<'a>>,
3392 Option<notebook::Tags<'a>>,
3393 Option<notebook::Title<'a>>,
3394 Option<AtUri<'a>>,
3395 Option<AtUri<'a>>,
3396 Option<AtUri<'a>>,
3397 Option<notebook::ReadingProgress<'a>>,
3398 ),
3399 _lifetime: PhantomData<&'a ()>,
3400}
3401
3402impl<'a> EntryView<'a> {
3403 pub fn new() -> EntryViewBuilder<'a, entry_view_state::Empty> {
3405 EntryViewBuilder::new()
3406 }
3407}
3408
3409impl<'a> EntryViewBuilder<'a, entry_view_state::Empty> {
3410 pub fn new() -> Self {
3412 EntryViewBuilder {
3413 _state: PhantomData,
3414 _fields: (
3415 None,
3416 None,
3417 None,
3418 None,
3419 None,
3420 None,
3421 None,
3422 None,
3423 None,
3424 None,
3425 None,
3426 None,
3427 None,
3428 None,
3429 None,
3430 ),
3431 _lifetime: PhantomData,
3432 }
3433 }
3434}
3435
3436impl<'a, S> EntryViewBuilder<'a, S>
3437where
3438 S: entry_view_state::State,
3439 S::Authors: entry_view_state::IsUnset,
3440{
3441 pub fn authors(
3443 mut self,
3444 value: impl Into<Vec<notebook::AuthorListView<'a>>>,
3445 ) -> EntryViewBuilder<'a, entry_view_state::SetAuthors<S>> {
3446 self._fields.0 = Option::Some(value.into());
3447 EntryViewBuilder {
3448 _state: PhantomData,
3449 _fields: self._fields,
3450 _lifetime: PhantomData,
3451 }
3452 }
3453}
3454
3455impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3456 pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
3458 self._fields.1 = value.into();
3459 self
3460 }
3461 pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
3463 self._fields.1 = value;
3464 self
3465 }
3466}
3467
3468impl<'a, S> EntryViewBuilder<'a, S>
3469where
3470 S: entry_view_state::State,
3471 S::Cid: entry_view_state::IsUnset,
3472{
3473 pub fn cid(
3475 mut self,
3476 value: impl Into<Cid<'a>>,
3477 ) -> EntryViewBuilder<'a, entry_view_state::SetCid<S>> {
3478 self._fields.2 = Option::Some(value.into());
3479 EntryViewBuilder {
3480 _state: PhantomData,
3481 _fields: self._fields,
3482 _lifetime: PhantomData,
3483 }
3484 }
3485}
3486
3487impl<'a, S> EntryViewBuilder<'a, S>
3488where
3489 S: entry_view_state::State,
3490 S::IndexedAt: entry_view_state::IsUnset,
3491{
3492 pub fn indexed_at(
3494 mut self,
3495 value: impl Into<Datetime>,
3496 ) -> EntryViewBuilder<'a, entry_view_state::SetIndexedAt<S>> {
3497 self._fields.3 = Option::Some(value.into());
3498 EntryViewBuilder {
3499 _state: PhantomData,
3500 _fields: self._fields,
3501 _lifetime: PhantomData,
3502 }
3503 }
3504}
3505
3506impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3507 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
3509 self._fields.4 = value.into();
3510 self
3511 }
3512 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
3514 self._fields.4 = value;
3515 self
3516 }
3517}
3518
3519impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3520 pub fn path(mut self, value: impl Into<Option<notebook::Path<'a>>>) -> Self {
3522 self._fields.5 = value.into();
3523 self
3524 }
3525 pub fn maybe_path(mut self, value: Option<notebook::Path<'a>>) -> Self {
3527 self._fields.5 = value;
3528 self
3529 }
3530}
3531
3532impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3533 pub fn permissions(
3535 mut self,
3536 value: impl Into<Option<notebook::PermissionsState<'a>>>,
3537 ) -> Self {
3538 self._fields.6 = value.into();
3539 self
3540 }
3541 pub fn maybe_permissions(
3543 mut self,
3544 value: Option<notebook::PermissionsState<'a>>,
3545 ) -> Self {
3546 self._fields.6 = value;
3547 self
3548 }
3549}
3550
3551impl<'a, S> EntryViewBuilder<'a, S>
3552where
3553 S: entry_view_state::State,
3554 S::Record: entry_view_state::IsUnset,
3555{
3556 pub fn record(
3558 mut self,
3559 value: impl Into<Data<'a>>,
3560 ) -> EntryViewBuilder<'a, entry_view_state::SetRecord<S>> {
3561 self._fields.7 = Option::Some(value.into());
3562 EntryViewBuilder {
3563 _state: PhantomData,
3564 _fields: self._fields,
3565 _lifetime: PhantomData,
3566 }
3567 }
3568}
3569
3570impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3571 pub fn rendered_view(
3573 mut self,
3574 value: impl Into<Option<notebook::RenderedView<'a>>>,
3575 ) -> Self {
3576 self._fields.8 = value.into();
3577 self
3578 }
3579 pub fn maybe_rendered_view(
3581 mut self,
3582 value: Option<notebook::RenderedView<'a>>,
3583 ) -> Self {
3584 self._fields.8 = value;
3585 self
3586 }
3587}
3588
3589impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3590 pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
3592 self._fields.9 = value.into();
3593 self
3594 }
3595 pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
3597 self._fields.9 = value;
3598 self
3599 }
3600}
3601
3602impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3603 pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
3605 self._fields.10 = value.into();
3606 self
3607 }
3608 pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
3610 self._fields.10 = value;
3611 self
3612 }
3613}
3614
3615impl<'a, S> EntryViewBuilder<'a, S>
3616where
3617 S: entry_view_state::State,
3618 S::Uri: entry_view_state::IsUnset,
3619{
3620 pub fn uri(
3622 mut self,
3623 value: impl Into<AtUri<'a>>,
3624 ) -> EntryViewBuilder<'a, entry_view_state::SetUri<S>> {
3625 self._fields.11 = Option::Some(value.into());
3626 EntryViewBuilder {
3627 _state: PhantomData,
3628 _fields: self._fields,
3629 _lifetime: PhantomData,
3630 }
3631 }
3632}
3633
3634impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3635 pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
3637 self._fields.12 = value.into();
3638 self
3639 }
3640 pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<'a>>) -> Self {
3642 self._fields.12 = value;
3643 self
3644 }
3645}
3646
3647impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3648 pub fn viewer_like(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
3650 self._fields.13 = value.into();
3651 self
3652 }
3653 pub fn maybe_viewer_like(mut self, value: Option<AtUri<'a>>) -> Self {
3655 self._fields.13 = value;
3656 self
3657 }
3658}
3659
3660impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
3661 pub fn viewer_reading_progress(
3663 mut self,
3664 value: impl Into<Option<notebook::ReadingProgress<'a>>>,
3665 ) -> Self {
3666 self._fields.14 = value.into();
3667 self
3668 }
3669 pub fn maybe_viewer_reading_progress(
3671 mut self,
3672 value: Option<notebook::ReadingProgress<'a>>,
3673 ) -> Self {
3674 self._fields.14 = value;
3675 self
3676 }
3677}
3678
3679impl<'a, S> EntryViewBuilder<'a, S>
3680where
3681 S: entry_view_state::State,
3682 S::Uri: entry_view_state::IsSet,
3683 S::Cid: entry_view_state::IsSet,
3684 S::Authors: entry_view_state::IsSet,
3685 S::IndexedAt: entry_view_state::IsSet,
3686 S::Record: entry_view_state::IsSet,
3687{
3688 pub fn build(self) -> EntryView<'a> {
3690 EntryView {
3691 authors: self._fields.0.unwrap(),
3692 bookmark_count: self._fields.1,
3693 cid: self._fields.2.unwrap(),
3694 indexed_at: self._fields.3.unwrap(),
3695 like_count: self._fields.4,
3696 path: self._fields.5,
3697 permissions: self._fields.6,
3698 record: self._fields.7.unwrap(),
3699 rendered_view: self._fields.8,
3700 tags: self._fields.9,
3701 title: self._fields.10,
3702 uri: self._fields.11.unwrap(),
3703 viewer_bookmark: self._fields.12,
3704 viewer_like: self._fields.13,
3705 viewer_reading_progress: self._fields.14,
3706 extra_data: Default::default(),
3707 }
3708 }
3709 pub fn build_with_data(
3711 self,
3712 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
3713 ) -> EntryView<'a> {
3714 EntryView {
3715 authors: self._fields.0.unwrap(),
3716 bookmark_count: self._fields.1,
3717 cid: self._fields.2.unwrap(),
3718 indexed_at: self._fields.3.unwrap(),
3719 like_count: self._fields.4,
3720 path: self._fields.5,
3721 permissions: self._fields.6,
3722 record: self._fields.7.unwrap(),
3723 rendered_view: self._fields.8,
3724 tags: self._fields.9,
3725 title: self._fields.10,
3726 uri: self._fields.11.unwrap(),
3727 viewer_bookmark: self._fields.12,
3728 viewer_like: self._fields.13,
3729 viewer_reading_progress: self._fields.14,
3730 extra_data: Some(extra_data),
3731 }
3732 }
3733}
3734
3735pub mod feed_entry_view_state {
3736
3737 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
3738 #[allow(unused)]
3739 use ::core::marker::PhantomData;
3740 mod sealed {
3741 pub trait Sealed {}
3742 }
3743 pub trait State: sealed::Sealed {
3745 type Entry;
3746 }
3747 pub struct Empty(());
3749 impl sealed::Sealed for Empty {}
3750 impl State for Empty {
3751 type Entry = Unset;
3752 }
3753 pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
3755 impl<S: State> sealed::Sealed for SetEntry<S> {}
3756 impl<S: State> State for SetEntry<S> {
3757 type Entry = Set<members::entry>;
3758 }
3759 #[allow(non_camel_case_types)]
3761 pub mod members {
3762 pub struct entry(());
3764 }
3765}
3766
3767pub struct FeedEntryViewBuilder<'a, S: feed_entry_view_state::State> {
3769 _state: PhantomData<fn() -> S>,
3770 _fields: (
3771 Option<notebook::EntryView<'a>>,
3772 Option<notebook::FeedNotebookContext<'a>>,
3773 Option<notebook::FeedReason<'a>>,
3774 ),
3775 _lifetime: PhantomData<&'a ()>,
3776}
3777
3778impl<'a> FeedEntryView<'a> {
3779 pub fn new() -> FeedEntryViewBuilder<'a, feed_entry_view_state::Empty> {
3781 FeedEntryViewBuilder::new()
3782 }
3783}
3784
3785impl<'a> FeedEntryViewBuilder<'a, feed_entry_view_state::Empty> {
3786 pub fn new() -> Self {
3788 FeedEntryViewBuilder {
3789 _state: PhantomData,
3790 _fields: (None, None, None),
3791 _lifetime: PhantomData,
3792 }
3793 }
3794}
3795
3796impl<'a, S> FeedEntryViewBuilder<'a, S>
3797where
3798 S: feed_entry_view_state::State,
3799 S::Entry: feed_entry_view_state::IsUnset,
3800{
3801 pub fn entry(
3803 mut self,
3804 value: impl Into<notebook::EntryView<'a>>,
3805 ) -> FeedEntryViewBuilder<'a, feed_entry_view_state::SetEntry<S>> {
3806 self._fields.0 = Option::Some(value.into());
3807 FeedEntryViewBuilder {
3808 _state: PhantomData,
3809 _fields: self._fields,
3810 _lifetime: PhantomData,
3811 }
3812 }
3813}
3814
3815impl<'a, S: feed_entry_view_state::State> FeedEntryViewBuilder<'a, S> {
3816 pub fn notebook_context(
3818 mut self,
3819 value: impl Into<Option<notebook::FeedNotebookContext<'a>>>,
3820 ) -> Self {
3821 self._fields.1 = value.into();
3822 self
3823 }
3824 pub fn maybe_notebook_context(
3826 mut self,
3827 value: Option<notebook::FeedNotebookContext<'a>>,
3828 ) -> Self {
3829 self._fields.1 = value;
3830 self
3831 }
3832}
3833
3834impl<'a, S: feed_entry_view_state::State> FeedEntryViewBuilder<'a, S> {
3835 pub fn reason(mut self, value: impl Into<Option<notebook::FeedReason<'a>>>) -> Self {
3837 self._fields.2 = value.into();
3838 self
3839 }
3840 pub fn maybe_reason(mut self, value: Option<notebook::FeedReason<'a>>) -> Self {
3842 self._fields.2 = value;
3843 self
3844 }
3845}
3846
3847impl<'a, S> FeedEntryViewBuilder<'a, S>
3848where
3849 S: feed_entry_view_state::State,
3850 S::Entry: feed_entry_view_state::IsSet,
3851{
3852 pub fn build(self) -> FeedEntryView<'a> {
3854 FeedEntryView {
3855 entry: self._fields.0.unwrap(),
3856 notebook_context: self._fields.1,
3857 reason: self._fields.2,
3858 extra_data: Default::default(),
3859 }
3860 }
3861 pub fn build_with_data(
3863 self,
3864 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
3865 ) -> FeedEntryView<'a> {
3866 FeedEntryView {
3867 entry: self._fields.0.unwrap(),
3868 notebook_context: self._fields.1,
3869 reason: self._fields.2,
3870 extra_data: Some(extra_data),
3871 }
3872 }
3873}
3874
3875pub mod feed_notebook_context_state {
3876
3877 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
3878 #[allow(unused)]
3879 use ::core::marker::PhantomData;
3880 mod sealed {
3881 pub trait Sealed {}
3882 }
3883 pub trait State: sealed::Sealed {
3885 type Title;
3886 type Uri;
3887 }
3888 pub struct Empty(());
3890 impl sealed::Sealed for Empty {}
3891 impl State for Empty {
3892 type Title = Unset;
3893 type Uri = Unset;
3894 }
3895 pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
3897 impl<S: State> sealed::Sealed for SetTitle<S> {}
3898 impl<S: State> State for SetTitle<S> {
3899 type Title = Set<members::title>;
3900 type Uri = S::Uri;
3901 }
3902 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
3904 impl<S: State> sealed::Sealed for SetUri<S> {}
3905 impl<S: State> State for SetUri<S> {
3906 type Title = S::Title;
3907 type Uri = Set<members::uri>;
3908 }
3909 #[allow(non_camel_case_types)]
3911 pub mod members {
3912 pub struct title(());
3914 pub struct uri(());
3916 }
3917}
3918
3919pub struct FeedNotebookContextBuilder<'a, S: feed_notebook_context_state::State> {
3921 _state: PhantomData<fn() -> S>,
3922 _fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<AtUri<'a>>),
3923 _lifetime: PhantomData<&'a ()>,
3924}
3925
3926impl<'a> FeedNotebookContext<'a> {
3927 pub fn new() -> FeedNotebookContextBuilder<'a, feed_notebook_context_state::Empty> {
3929 FeedNotebookContextBuilder::new()
3930 }
3931}
3932
3933impl<'a> FeedNotebookContextBuilder<'a, feed_notebook_context_state::Empty> {
3934 pub fn new() -> Self {
3936 FeedNotebookContextBuilder {
3937 _state: PhantomData,
3938 _fields: (None, None, None),
3939 _lifetime: PhantomData,
3940 }
3941 }
3942}
3943
3944impl<'a, S: feed_notebook_context_state::State> FeedNotebookContextBuilder<'a, S> {
3945 pub fn path(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
3947 self._fields.0 = value.into();
3948 self
3949 }
3950 pub fn maybe_path(mut self, value: Option<CowStr<'a>>) -> Self {
3952 self._fields.0 = value;
3953 self
3954 }
3955}
3956
3957impl<'a, S> FeedNotebookContextBuilder<'a, S>
3958where
3959 S: feed_notebook_context_state::State,
3960 S::Title: feed_notebook_context_state::IsUnset,
3961{
3962 pub fn title(
3964 mut self,
3965 value: impl Into<CowStr<'a>>,
3966 ) -> FeedNotebookContextBuilder<'a, feed_notebook_context_state::SetTitle<S>> {
3967 self._fields.1 = Option::Some(value.into());
3968 FeedNotebookContextBuilder {
3969 _state: PhantomData,
3970 _fields: self._fields,
3971 _lifetime: PhantomData,
3972 }
3973 }
3974}
3975
3976impl<'a, S> FeedNotebookContextBuilder<'a, S>
3977where
3978 S: feed_notebook_context_state::State,
3979 S::Uri: feed_notebook_context_state::IsUnset,
3980{
3981 pub fn uri(
3983 mut self,
3984 value: impl Into<AtUri<'a>>,
3985 ) -> FeedNotebookContextBuilder<'a, feed_notebook_context_state::SetUri<S>> {
3986 self._fields.2 = Option::Some(value.into());
3987 FeedNotebookContextBuilder {
3988 _state: PhantomData,
3989 _fields: self._fields,
3990 _lifetime: PhantomData,
3991 }
3992 }
3993}
3994
3995impl<'a, S> FeedNotebookContextBuilder<'a, S>
3996where
3997 S: feed_notebook_context_state::State,
3998 S::Title: feed_notebook_context_state::IsSet,
3999 S::Uri: feed_notebook_context_state::IsSet,
4000{
4001 pub fn build(self) -> FeedNotebookContext<'a> {
4003 FeedNotebookContext {
4004 path: self._fields.0,
4005 title: self._fields.1.unwrap(),
4006 uri: self._fields.2.unwrap(),
4007 extra_data: Default::default(),
4008 }
4009 }
4010 pub fn build_with_data(
4012 self,
4013 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
4014 ) -> FeedNotebookContext<'a> {
4015 FeedNotebookContext {
4016 path: self._fields.0,
4017 title: self._fields.1.unwrap(),
4018 uri: self._fields.2.unwrap(),
4019 extra_data: Some(extra_data),
4020 }
4021 }
4022}
4023
4024pub mod notebook_view_state {
4025
4026 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
4027 #[allow(unused)]
4028 use ::core::marker::PhantomData;
4029 mod sealed {
4030 pub trait Sealed {}
4031 }
4032 pub trait State: sealed::Sealed {
4034 type Uri;
4035 type Authors;
4036 type Record;
4037 type Cid;
4038 type IndexedAt;
4039 }
4040 pub struct Empty(());
4042 impl sealed::Sealed for Empty {}
4043 impl State for Empty {
4044 type Uri = Unset;
4045 type Authors = Unset;
4046 type Record = Unset;
4047 type Cid = Unset;
4048 type IndexedAt = Unset;
4049 }
4050 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
4052 impl<S: State> sealed::Sealed for SetUri<S> {}
4053 impl<S: State> State for SetUri<S> {
4054 type Uri = Set<members::uri>;
4055 type Authors = S::Authors;
4056 type Record = S::Record;
4057 type Cid = S::Cid;
4058 type IndexedAt = S::IndexedAt;
4059 }
4060 pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
4062 impl<S: State> sealed::Sealed for SetAuthors<S> {}
4063 impl<S: State> State for SetAuthors<S> {
4064 type Uri = S::Uri;
4065 type Authors = Set<members::authors>;
4066 type Record = S::Record;
4067 type Cid = S::Cid;
4068 type IndexedAt = S::IndexedAt;
4069 }
4070 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
4072 impl<S: State> sealed::Sealed for SetRecord<S> {}
4073 impl<S: State> State for SetRecord<S> {
4074 type Uri = S::Uri;
4075 type Authors = S::Authors;
4076 type Record = Set<members::record>;
4077 type Cid = S::Cid;
4078 type IndexedAt = S::IndexedAt;
4079 }
4080 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
4082 impl<S: State> sealed::Sealed for SetCid<S> {}
4083 impl<S: State> State for SetCid<S> {
4084 type Uri = S::Uri;
4085 type Authors = S::Authors;
4086 type Record = S::Record;
4087 type Cid = Set<members::cid>;
4088 type IndexedAt = S::IndexedAt;
4089 }
4090 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
4092 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
4093 impl<S: State> State for SetIndexedAt<S> {
4094 type Uri = S::Uri;
4095 type Authors = S::Authors;
4096 type Record = S::Record;
4097 type Cid = S::Cid;
4098 type IndexedAt = Set<members::indexed_at>;
4099 }
4100 #[allow(non_camel_case_types)]
4102 pub mod members {
4103 pub struct uri(());
4105 pub struct authors(());
4107 pub struct record(());
4109 pub struct cid(());
4111 pub struct indexed_at(());
4113 }
4114}
4115
4116pub struct NotebookViewBuilder<'a, S: notebook_view_state::State> {
4118 _state: PhantomData<fn() -> S>,
4119 _fields: (
4120 Option<Vec<notebook::AuthorListView<'a>>>,
4121 Option<i64>,
4122 Option<Cid<'a>>,
4123 Option<i64>,
4124 Option<Datetime>,
4125 Option<i64>,
4126 Option<notebook::Path<'a>>,
4127 Option<notebook::PermissionsState<'a>>,
4128 Option<Data<'a>>,
4129 Option<i64>,
4130 Option<notebook::Tags<'a>>,
4131 Option<notebook::Title<'a>>,
4132 Option<AtUri<'a>>,
4133 Option<AtUri<'a>>,
4134 Option<AtUri<'a>>,
4135 Option<notebook::ReadingProgress<'a>>,
4136 Option<AtUri<'a>>,
4137 ),
4138 _lifetime: PhantomData<&'a ()>,
4139}
4140
4141impl<'a> NotebookView<'a> {
4142 pub fn new() -> NotebookViewBuilder<'a, notebook_view_state::Empty> {
4144 NotebookViewBuilder::new()
4145 }
4146}
4147
4148impl<'a> NotebookViewBuilder<'a, notebook_view_state::Empty> {
4149 pub fn new() -> Self {
4151 NotebookViewBuilder {
4152 _state: PhantomData,
4153 _fields: (
4154 None,
4155 None,
4156 None,
4157 None,
4158 None,
4159 None,
4160 None,
4161 None,
4162 None,
4163 None,
4164 None,
4165 None,
4166 None,
4167 None,
4168 None,
4169 None,
4170 None,
4171 ),
4172 _lifetime: PhantomData,
4173 }
4174 }
4175}
4176
4177impl<'a, S> NotebookViewBuilder<'a, S>
4178where
4179 S: notebook_view_state::State,
4180 S::Authors: notebook_view_state::IsUnset,
4181{
4182 pub fn authors(
4184 mut self,
4185 value: impl Into<Vec<notebook::AuthorListView<'a>>>,
4186 ) -> NotebookViewBuilder<'a, notebook_view_state::SetAuthors<S>> {
4187 self._fields.0 = Option::Some(value.into());
4188 NotebookViewBuilder {
4189 _state: PhantomData,
4190 _fields: self._fields,
4191 _lifetime: PhantomData,
4192 }
4193 }
4194}
4195
4196impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4197 pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
4199 self._fields.1 = value.into();
4200 self
4201 }
4202 pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
4204 self._fields.1 = value;
4205 self
4206 }
4207}
4208
4209impl<'a, S> NotebookViewBuilder<'a, S>
4210where
4211 S: notebook_view_state::State,
4212 S::Cid: notebook_view_state::IsUnset,
4213{
4214 pub fn cid(
4216 mut self,
4217 value: impl Into<Cid<'a>>,
4218 ) -> NotebookViewBuilder<'a, notebook_view_state::SetCid<S>> {
4219 self._fields.2 = Option::Some(value.into());
4220 NotebookViewBuilder {
4221 _state: PhantomData,
4222 _fields: self._fields,
4223 _lifetime: PhantomData,
4224 }
4225 }
4226}
4227
4228impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4229 pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
4231 self._fields.3 = value.into();
4232 self
4233 }
4234 pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
4236 self._fields.3 = value;
4237 self
4238 }
4239}
4240
4241impl<'a, S> NotebookViewBuilder<'a, S>
4242where
4243 S: notebook_view_state::State,
4244 S::IndexedAt: notebook_view_state::IsUnset,
4245{
4246 pub fn indexed_at(
4248 mut self,
4249 value: impl Into<Datetime>,
4250 ) -> NotebookViewBuilder<'a, notebook_view_state::SetIndexedAt<S>> {
4251 self._fields.4 = Option::Some(value.into());
4252 NotebookViewBuilder {
4253 _state: PhantomData,
4254 _fields: self._fields,
4255 _lifetime: PhantomData,
4256 }
4257 }
4258}
4259
4260impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4261 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
4263 self._fields.5 = value.into();
4264 self
4265 }
4266 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
4268 self._fields.5 = value;
4269 self
4270 }
4271}
4272
4273impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4274 pub fn path(mut self, value: impl Into<Option<notebook::Path<'a>>>) -> Self {
4276 self._fields.6 = value.into();
4277 self
4278 }
4279 pub fn maybe_path(mut self, value: Option<notebook::Path<'a>>) -> Self {
4281 self._fields.6 = value;
4282 self
4283 }
4284}
4285
4286impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4287 pub fn permissions(
4289 mut self,
4290 value: impl Into<Option<notebook::PermissionsState<'a>>>,
4291 ) -> Self {
4292 self._fields.7 = value.into();
4293 self
4294 }
4295 pub fn maybe_permissions(
4297 mut self,
4298 value: Option<notebook::PermissionsState<'a>>,
4299 ) -> Self {
4300 self._fields.7 = value;
4301 self
4302 }
4303}
4304
4305impl<'a, S> NotebookViewBuilder<'a, S>
4306where
4307 S: notebook_view_state::State,
4308 S::Record: notebook_view_state::IsUnset,
4309{
4310 pub fn record(
4312 mut self,
4313 value: impl Into<Data<'a>>,
4314 ) -> NotebookViewBuilder<'a, notebook_view_state::SetRecord<S>> {
4315 self._fields.8 = Option::Some(value.into());
4316 NotebookViewBuilder {
4317 _state: PhantomData,
4318 _fields: self._fields,
4319 _lifetime: PhantomData,
4320 }
4321 }
4322}
4323
4324impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4325 pub fn subscriber_count(mut self, value: impl Into<Option<i64>>) -> Self {
4327 self._fields.9 = value.into();
4328 self
4329 }
4330 pub fn maybe_subscriber_count(mut self, value: Option<i64>) -> Self {
4332 self._fields.9 = value;
4333 self
4334 }
4335}
4336
4337impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4338 pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
4340 self._fields.10 = value.into();
4341 self
4342 }
4343 pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
4345 self._fields.10 = value;
4346 self
4347 }
4348}
4349
4350impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4351 pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
4353 self._fields.11 = value.into();
4354 self
4355 }
4356 pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
4358 self._fields.11 = value;
4359 self
4360 }
4361}
4362
4363impl<'a, S> NotebookViewBuilder<'a, S>
4364where
4365 S: notebook_view_state::State,
4366 S::Uri: notebook_view_state::IsUnset,
4367{
4368 pub fn uri(
4370 mut self,
4371 value: impl Into<AtUri<'a>>,
4372 ) -> NotebookViewBuilder<'a, notebook_view_state::SetUri<S>> {
4373 self._fields.12 = Option::Some(value.into());
4374 NotebookViewBuilder {
4375 _state: PhantomData,
4376 _fields: self._fields,
4377 _lifetime: PhantomData,
4378 }
4379 }
4380}
4381
4382impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4383 pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
4385 self._fields.13 = value.into();
4386 self
4387 }
4388 pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<'a>>) -> Self {
4390 self._fields.13 = value;
4391 self
4392 }
4393}
4394
4395impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4396 pub fn viewer_like(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
4398 self._fields.14 = value.into();
4399 self
4400 }
4401 pub fn maybe_viewer_like(mut self, value: Option<AtUri<'a>>) -> Self {
4403 self._fields.14 = value;
4404 self
4405 }
4406}
4407
4408impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4409 pub fn viewer_reading_progress(
4411 mut self,
4412 value: impl Into<Option<notebook::ReadingProgress<'a>>>,
4413 ) -> Self {
4414 self._fields.15 = value.into();
4415 self
4416 }
4417 pub fn maybe_viewer_reading_progress(
4419 mut self,
4420 value: Option<notebook::ReadingProgress<'a>>,
4421 ) -> Self {
4422 self._fields.15 = value;
4423 self
4424 }
4425}
4426
4427impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
4428 pub fn viewer_subscription(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
4430 self._fields.16 = value.into();
4431 self
4432 }
4433 pub fn maybe_viewer_subscription(mut self, value: Option<AtUri<'a>>) -> Self {
4435 self._fields.16 = value;
4436 self
4437 }
4438}
4439
4440impl<'a, S> NotebookViewBuilder<'a, S>
4441where
4442 S: notebook_view_state::State,
4443 S::Uri: notebook_view_state::IsSet,
4444 S::Authors: notebook_view_state::IsSet,
4445 S::Record: notebook_view_state::IsSet,
4446 S::Cid: notebook_view_state::IsSet,
4447 S::IndexedAt: notebook_view_state::IsSet,
4448{
4449 pub fn build(self) -> NotebookView<'a> {
4451 NotebookView {
4452 authors: self._fields.0.unwrap(),
4453 bookmark_count: self._fields.1,
4454 cid: self._fields.2.unwrap(),
4455 entry_count: self._fields.3,
4456 indexed_at: self._fields.4.unwrap(),
4457 like_count: self._fields.5,
4458 path: self._fields.6,
4459 permissions: self._fields.7,
4460 record: self._fields.8.unwrap(),
4461 subscriber_count: self._fields.9,
4462 tags: self._fields.10,
4463 title: self._fields.11,
4464 uri: self._fields.12.unwrap(),
4465 viewer_bookmark: self._fields.13,
4466 viewer_like: self._fields.14,
4467 viewer_reading_progress: self._fields.15,
4468 viewer_subscription: self._fields.16,
4469 extra_data: Default::default(),
4470 }
4471 }
4472 pub fn build_with_data(
4474 self,
4475 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
4476 ) -> NotebookView<'a> {
4477 NotebookView {
4478 authors: self._fields.0.unwrap(),
4479 bookmark_count: self._fields.1,
4480 cid: self._fields.2.unwrap(),
4481 entry_count: self._fields.3,
4482 indexed_at: self._fields.4.unwrap(),
4483 like_count: self._fields.5,
4484 path: self._fields.6,
4485 permissions: self._fields.7,
4486 record: self._fields.8.unwrap(),
4487 subscriber_count: self._fields.9,
4488 tags: self._fields.10,
4489 title: self._fields.11,
4490 uri: self._fields.12.unwrap(),
4491 viewer_bookmark: self._fields.13,
4492 viewer_like: self._fields.14,
4493 viewer_reading_progress: self._fields.15,
4494 viewer_subscription: self._fields.16,
4495 extra_data: Some(extra_data),
4496 }
4497 }
4498}
4499
4500pub mod page_view_state {
4501
4502 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
4503 #[allow(unused)]
4504 use ::core::marker::PhantomData;
4505 mod sealed {
4506 pub trait Sealed {}
4507 }
4508 pub trait State: sealed::Sealed {
4510 type Cid;
4511 type Uri;
4512 type Record;
4513 type IndexedAt;
4514 type Notebook;
4515 }
4516 pub struct Empty(());
4518 impl sealed::Sealed for Empty {}
4519 impl State for Empty {
4520 type Cid = Unset;
4521 type Uri = Unset;
4522 type Record = Unset;
4523 type IndexedAt = Unset;
4524 type Notebook = Unset;
4525 }
4526 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
4528 impl<S: State> sealed::Sealed for SetCid<S> {}
4529 impl<S: State> State for SetCid<S> {
4530 type Cid = Set<members::cid>;
4531 type Uri = S::Uri;
4532 type Record = S::Record;
4533 type IndexedAt = S::IndexedAt;
4534 type Notebook = S::Notebook;
4535 }
4536 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
4538 impl<S: State> sealed::Sealed for SetUri<S> {}
4539 impl<S: State> State for SetUri<S> {
4540 type Cid = S::Cid;
4541 type Uri = Set<members::uri>;
4542 type Record = S::Record;
4543 type IndexedAt = S::IndexedAt;
4544 type Notebook = S::Notebook;
4545 }
4546 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
4548 impl<S: State> sealed::Sealed for SetRecord<S> {}
4549 impl<S: State> State for SetRecord<S> {
4550 type Cid = S::Cid;
4551 type Uri = S::Uri;
4552 type Record = Set<members::record>;
4553 type IndexedAt = S::IndexedAt;
4554 type Notebook = S::Notebook;
4555 }
4556 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
4558 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
4559 impl<S: State> State for SetIndexedAt<S> {
4560 type Cid = S::Cid;
4561 type Uri = S::Uri;
4562 type Record = S::Record;
4563 type IndexedAt = Set<members::indexed_at>;
4564 type Notebook = S::Notebook;
4565 }
4566 pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>);
4568 impl<S: State> sealed::Sealed for SetNotebook<S> {}
4569 impl<S: State> State for SetNotebook<S> {
4570 type Cid = S::Cid;
4571 type Uri = S::Uri;
4572 type Record = S::Record;
4573 type IndexedAt = S::IndexedAt;
4574 type Notebook = Set<members::notebook>;
4575 }
4576 #[allow(non_camel_case_types)]
4578 pub mod members {
4579 pub struct cid(());
4581 pub struct uri(());
4583 pub struct record(());
4585 pub struct indexed_at(());
4587 pub struct notebook(());
4589 }
4590}
4591
4592pub struct PageViewBuilder<'a, S: page_view_state::State> {
4594 _state: PhantomData<fn() -> S>,
4595 _fields: (
4596 Option<Cid<'a>>,
4597 Option<i64>,
4598 Option<Datetime>,
4599 Option<notebook::NotebookView<'a>>,
4600 Option<Data<'a>>,
4601 Option<notebook::Tags<'a>>,
4602 Option<notebook::Title<'a>>,
4603 Option<AtUri<'a>>,
4604 ),
4605 _lifetime: PhantomData<&'a ()>,
4606}
4607
4608impl<'a> PageView<'a> {
4609 pub fn new() -> PageViewBuilder<'a, page_view_state::Empty> {
4611 PageViewBuilder::new()
4612 }
4613}
4614
4615impl<'a> PageViewBuilder<'a, page_view_state::Empty> {
4616 pub fn new() -> Self {
4618 PageViewBuilder {
4619 _state: PhantomData,
4620 _fields: (None, None, None, None, None, None, None, None),
4621 _lifetime: PhantomData,
4622 }
4623 }
4624}
4625
4626impl<'a, S> PageViewBuilder<'a, S>
4627where
4628 S: page_view_state::State,
4629 S::Cid: page_view_state::IsUnset,
4630{
4631 pub fn cid(
4633 mut self,
4634 value: impl Into<Cid<'a>>,
4635 ) -> PageViewBuilder<'a, page_view_state::SetCid<S>> {
4636 self._fields.0 = Option::Some(value.into());
4637 PageViewBuilder {
4638 _state: PhantomData,
4639 _fields: self._fields,
4640 _lifetime: PhantomData,
4641 }
4642 }
4643}
4644
4645impl<'a, S: page_view_state::State> PageViewBuilder<'a, S> {
4646 pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
4648 self._fields.1 = value.into();
4649 self
4650 }
4651 pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
4653 self._fields.1 = value;
4654 self
4655 }
4656}
4657
4658impl<'a, S> PageViewBuilder<'a, S>
4659where
4660 S: page_view_state::State,
4661 S::IndexedAt: page_view_state::IsUnset,
4662{
4663 pub fn indexed_at(
4665 mut self,
4666 value: impl Into<Datetime>,
4667 ) -> PageViewBuilder<'a, page_view_state::SetIndexedAt<S>> {
4668 self._fields.2 = Option::Some(value.into());
4669 PageViewBuilder {
4670 _state: PhantomData,
4671 _fields: self._fields,
4672 _lifetime: PhantomData,
4673 }
4674 }
4675}
4676
4677impl<'a, S> PageViewBuilder<'a, S>
4678where
4679 S: page_view_state::State,
4680 S::Notebook: page_view_state::IsUnset,
4681{
4682 pub fn notebook(
4684 mut self,
4685 value: impl Into<notebook::NotebookView<'a>>,
4686 ) -> PageViewBuilder<'a, page_view_state::SetNotebook<S>> {
4687 self._fields.3 = Option::Some(value.into());
4688 PageViewBuilder {
4689 _state: PhantomData,
4690 _fields: self._fields,
4691 _lifetime: PhantomData,
4692 }
4693 }
4694}
4695
4696impl<'a, S> PageViewBuilder<'a, S>
4697where
4698 S: page_view_state::State,
4699 S::Record: page_view_state::IsUnset,
4700{
4701 pub fn record(
4703 mut self,
4704 value: impl Into<Data<'a>>,
4705 ) -> PageViewBuilder<'a, page_view_state::SetRecord<S>> {
4706 self._fields.4 = Option::Some(value.into());
4707 PageViewBuilder {
4708 _state: PhantomData,
4709 _fields: self._fields,
4710 _lifetime: PhantomData,
4711 }
4712 }
4713}
4714
4715impl<'a, S: page_view_state::State> PageViewBuilder<'a, S> {
4716 pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
4718 self._fields.5 = value.into();
4719 self
4720 }
4721 pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
4723 self._fields.5 = value;
4724 self
4725 }
4726}
4727
4728impl<'a, S: page_view_state::State> PageViewBuilder<'a, S> {
4729 pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
4731 self._fields.6 = value.into();
4732 self
4733 }
4734 pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
4736 self._fields.6 = value;
4737 self
4738 }
4739}
4740
4741impl<'a, S> PageViewBuilder<'a, S>
4742where
4743 S: page_view_state::State,
4744 S::Uri: page_view_state::IsUnset,
4745{
4746 pub fn uri(
4748 mut self,
4749 value: impl Into<AtUri<'a>>,
4750 ) -> PageViewBuilder<'a, page_view_state::SetUri<S>> {
4751 self._fields.7 = Option::Some(value.into());
4752 PageViewBuilder {
4753 _state: PhantomData,
4754 _fields: self._fields,
4755 _lifetime: PhantomData,
4756 }
4757 }
4758}
4759
4760impl<'a, S> PageViewBuilder<'a, S>
4761where
4762 S: page_view_state::State,
4763 S::Cid: page_view_state::IsSet,
4764 S::Uri: page_view_state::IsSet,
4765 S::Record: page_view_state::IsSet,
4766 S::IndexedAt: page_view_state::IsSet,
4767 S::Notebook: page_view_state::IsSet,
4768{
4769 pub fn build(self) -> PageView<'a> {
4771 PageView {
4772 cid: self._fields.0.unwrap(),
4773 entry_count: self._fields.1,
4774 indexed_at: self._fields.2.unwrap(),
4775 notebook: self._fields.3.unwrap(),
4776 record: self._fields.4.unwrap(),
4777 tags: self._fields.5,
4778 title: self._fields.6,
4779 uri: self._fields.7.unwrap(),
4780 extra_data: Default::default(),
4781 }
4782 }
4783 pub fn build_with_data(
4785 self,
4786 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
4787 ) -> PageView<'a> {
4788 PageView {
4789 cid: self._fields.0.unwrap(),
4790 entry_count: self._fields.1,
4791 indexed_at: self._fields.2.unwrap(),
4792 notebook: self._fields.3.unwrap(),
4793 record: self._fields.4.unwrap(),
4794 tags: self._fields.5,
4795 title: self._fields.6,
4796 uri: self._fields.7.unwrap(),
4797 extra_data: Some(extra_data),
4798 }
4799 }
4800}
4801
4802pub mod permission_grant_state {
4803
4804 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
4805 #[allow(unused)]
4806 use ::core::marker::PhantomData;
4807 mod sealed {
4808 pub trait Sealed {}
4809 }
4810 pub trait State: sealed::Sealed {
4812 type GrantedAt;
4813 type Did;
4814 type Scope;
4815 type Source;
4816 }
4817 pub struct Empty(());
4819 impl sealed::Sealed for Empty {}
4820 impl State for Empty {
4821 type GrantedAt = Unset;
4822 type Did = Unset;
4823 type Scope = Unset;
4824 type Source = Unset;
4825 }
4826 pub struct SetGrantedAt<S: State = Empty>(PhantomData<fn() -> S>);
4828 impl<S: State> sealed::Sealed for SetGrantedAt<S> {}
4829 impl<S: State> State for SetGrantedAt<S> {
4830 type GrantedAt = Set<members::granted_at>;
4831 type Did = S::Did;
4832 type Scope = S::Scope;
4833 type Source = S::Source;
4834 }
4835 pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
4837 impl<S: State> sealed::Sealed for SetDid<S> {}
4838 impl<S: State> State for SetDid<S> {
4839 type GrantedAt = S::GrantedAt;
4840 type Did = Set<members::did>;
4841 type Scope = S::Scope;
4842 type Source = S::Source;
4843 }
4844 pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>);
4846 impl<S: State> sealed::Sealed for SetScope<S> {}
4847 impl<S: State> State for SetScope<S> {
4848 type GrantedAt = S::GrantedAt;
4849 type Did = S::Did;
4850 type Scope = Set<members::scope>;
4851 type Source = S::Source;
4852 }
4853 pub struct SetSource<S: State = Empty>(PhantomData<fn() -> S>);
4855 impl<S: State> sealed::Sealed for SetSource<S> {}
4856 impl<S: State> State for SetSource<S> {
4857 type GrantedAt = S::GrantedAt;
4858 type Did = S::Did;
4859 type Scope = S::Scope;
4860 type Source = Set<members::source>;
4861 }
4862 #[allow(non_camel_case_types)]
4864 pub mod members {
4865 pub struct granted_at(());
4867 pub struct did(());
4869 pub struct scope(());
4871 pub struct source(());
4873 }
4874}
4875
4876pub struct PermissionGrantBuilder<'a, S: permission_grant_state::State> {
4878 _state: PhantomData<fn() -> S>,
4879 _fields: (
4880 Option<Did<'a>>,
4881 Option<Datetime>,
4882 Option<PermissionGrantScope<'a>>,
4883 Option<AtUri<'a>>,
4884 ),
4885 _lifetime: PhantomData<&'a ()>,
4886}
4887
4888impl<'a> PermissionGrant<'a> {
4889 pub fn new() -> PermissionGrantBuilder<'a, permission_grant_state::Empty> {
4891 PermissionGrantBuilder::new()
4892 }
4893}
4894
4895impl<'a> PermissionGrantBuilder<'a, permission_grant_state::Empty> {
4896 pub fn new() -> Self {
4898 PermissionGrantBuilder {
4899 _state: PhantomData,
4900 _fields: (None, None, None, None),
4901 _lifetime: PhantomData,
4902 }
4903 }
4904}
4905
4906impl<'a, S> PermissionGrantBuilder<'a, S>
4907where
4908 S: permission_grant_state::State,
4909 S::Did: permission_grant_state::IsUnset,
4910{
4911 pub fn did(
4913 mut self,
4914 value: impl Into<Did<'a>>,
4915 ) -> PermissionGrantBuilder<'a, permission_grant_state::SetDid<S>> {
4916 self._fields.0 = Option::Some(value.into());
4917 PermissionGrantBuilder {
4918 _state: PhantomData,
4919 _fields: self._fields,
4920 _lifetime: PhantomData,
4921 }
4922 }
4923}
4924
4925impl<'a, S> PermissionGrantBuilder<'a, S>
4926where
4927 S: permission_grant_state::State,
4928 S::GrantedAt: permission_grant_state::IsUnset,
4929{
4930 pub fn granted_at(
4932 mut self,
4933 value: impl Into<Datetime>,
4934 ) -> PermissionGrantBuilder<'a, permission_grant_state::SetGrantedAt<S>> {
4935 self._fields.1 = Option::Some(value.into());
4936 PermissionGrantBuilder {
4937 _state: PhantomData,
4938 _fields: self._fields,
4939 _lifetime: PhantomData,
4940 }
4941 }
4942}
4943
4944impl<'a, S> PermissionGrantBuilder<'a, S>
4945where
4946 S: permission_grant_state::State,
4947 S::Scope: permission_grant_state::IsUnset,
4948{
4949 pub fn scope(
4951 mut self,
4952 value: impl Into<PermissionGrantScope<'a>>,
4953 ) -> PermissionGrantBuilder<'a, permission_grant_state::SetScope<S>> {
4954 self._fields.2 = Option::Some(value.into());
4955 PermissionGrantBuilder {
4956 _state: PhantomData,
4957 _fields: self._fields,
4958 _lifetime: PhantomData,
4959 }
4960 }
4961}
4962
4963impl<'a, S> PermissionGrantBuilder<'a, S>
4964where
4965 S: permission_grant_state::State,
4966 S::Source: permission_grant_state::IsUnset,
4967{
4968 pub fn source(
4970 mut self,
4971 value: impl Into<AtUri<'a>>,
4972 ) -> PermissionGrantBuilder<'a, permission_grant_state::SetSource<S>> {
4973 self._fields.3 = Option::Some(value.into());
4974 PermissionGrantBuilder {
4975 _state: PhantomData,
4976 _fields: self._fields,
4977 _lifetime: PhantomData,
4978 }
4979 }
4980}
4981
4982impl<'a, S> PermissionGrantBuilder<'a, S>
4983where
4984 S: permission_grant_state::State,
4985 S::GrantedAt: permission_grant_state::IsSet,
4986 S::Did: permission_grant_state::IsSet,
4987 S::Scope: permission_grant_state::IsSet,
4988 S::Source: permission_grant_state::IsSet,
4989{
4990 pub fn build(self) -> PermissionGrant<'a> {
4992 PermissionGrant {
4993 did: self._fields.0.unwrap(),
4994 granted_at: self._fields.1.unwrap(),
4995 scope: self._fields.2.unwrap(),
4996 source: self._fields.3.unwrap(),
4997 extra_data: Default::default(),
4998 }
4999 }
5000 pub fn build_with_data(
5002 self,
5003 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5004 ) -> PermissionGrant<'a> {
5005 PermissionGrant {
5006 did: self._fields.0.unwrap(),
5007 granted_at: self._fields.1.unwrap(),
5008 scope: self._fields.2.unwrap(),
5009 source: self._fields.3.unwrap(),
5010 extra_data: Some(extra_data),
5011 }
5012 }
5013}
5014
5015pub mod permissions_state_state {
5016
5017 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
5018 #[allow(unused)]
5019 use ::core::marker::PhantomData;
5020 mod sealed {
5021 pub trait Sealed {}
5022 }
5023 pub trait State: sealed::Sealed {
5025 type Editors;
5026 }
5027 pub struct Empty(());
5029 impl sealed::Sealed for Empty {}
5030 impl State for Empty {
5031 type Editors = Unset;
5032 }
5033 pub struct SetEditors<S: State = Empty>(PhantomData<fn() -> S>);
5035 impl<S: State> sealed::Sealed for SetEditors<S> {}
5036 impl<S: State> State for SetEditors<S> {
5037 type Editors = Set<members::editors>;
5038 }
5039 #[allow(non_camel_case_types)]
5041 pub mod members {
5042 pub struct editors(());
5044 }
5045}
5046
5047pub struct PermissionsStateBuilder<'a, S: permissions_state_state::State> {
5049 _state: PhantomData<fn() -> S>,
5050 _fields: (
5051 Option<Vec<notebook::PermissionGrant<'a>>>,
5052 Option<Vec<notebook::PermissionGrant<'a>>>,
5053 ),
5054 _lifetime: PhantomData<&'a ()>,
5055}
5056
5057impl<'a> PermissionsState<'a> {
5058 pub fn new() -> PermissionsStateBuilder<'a, permissions_state_state::Empty> {
5060 PermissionsStateBuilder::new()
5061 }
5062}
5063
5064impl<'a> PermissionsStateBuilder<'a, permissions_state_state::Empty> {
5065 pub fn new() -> Self {
5067 PermissionsStateBuilder {
5068 _state: PhantomData,
5069 _fields: (None, None),
5070 _lifetime: PhantomData,
5071 }
5072 }
5073}
5074
5075impl<'a, S> PermissionsStateBuilder<'a, S>
5076where
5077 S: permissions_state_state::State,
5078 S::Editors: permissions_state_state::IsUnset,
5079{
5080 pub fn editors(
5082 mut self,
5083 value: impl Into<Vec<notebook::PermissionGrant<'a>>>,
5084 ) -> PermissionsStateBuilder<'a, permissions_state_state::SetEditors<S>> {
5085 self._fields.0 = Option::Some(value.into());
5086 PermissionsStateBuilder {
5087 _state: PhantomData,
5088 _fields: self._fields,
5089 _lifetime: PhantomData,
5090 }
5091 }
5092}
5093
5094impl<'a, S: permissions_state_state::State> PermissionsStateBuilder<'a, S> {
5095 pub fn viewers(
5097 mut self,
5098 value: impl Into<Option<Vec<notebook::PermissionGrant<'a>>>>,
5099 ) -> Self {
5100 self._fields.1 = value.into();
5101 self
5102 }
5103 pub fn maybe_viewers(
5105 mut self,
5106 value: Option<Vec<notebook::PermissionGrant<'a>>>,
5107 ) -> Self {
5108 self._fields.1 = value;
5109 self
5110 }
5111}
5112
5113impl<'a, S> PermissionsStateBuilder<'a, S>
5114where
5115 S: permissions_state_state::State,
5116 S::Editors: permissions_state_state::IsSet,
5117{
5118 pub fn build(self) -> PermissionsState<'a> {
5120 PermissionsState {
5121 editors: self._fields.0.unwrap(),
5122 viewers: self._fields.1,
5123 extra_data: Default::default(),
5124 }
5125 }
5126 pub fn build_with_data(
5128 self,
5129 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5130 ) -> PermissionsState<'a> {
5131 PermissionsState {
5132 editors: self._fields.0.unwrap(),
5133 viewers: self._fields.1,
5134 extra_data: Some(extra_data),
5135 }
5136 }
5137}
5138
5139pub mod published_version_view_state {
5140
5141 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
5142 #[allow(unused)]
5143 use ::core::marker::PhantomData;
5144 mod sealed {
5145 pub trait Sealed {}
5146 }
5147 pub trait State: sealed::Sealed {
5149 type Uri;
5150 type PublishedAt;
5151 type Cid;
5152 type Publisher;
5153 }
5154 pub struct Empty(());
5156 impl sealed::Sealed for Empty {}
5157 impl State for Empty {
5158 type Uri = Unset;
5159 type PublishedAt = Unset;
5160 type Cid = Unset;
5161 type Publisher = Unset;
5162 }
5163 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
5165 impl<S: State> sealed::Sealed for SetUri<S> {}
5166 impl<S: State> State for SetUri<S> {
5167 type Uri = Set<members::uri>;
5168 type PublishedAt = S::PublishedAt;
5169 type Cid = S::Cid;
5170 type Publisher = S::Publisher;
5171 }
5172 pub struct SetPublishedAt<S: State = Empty>(PhantomData<fn() -> S>);
5174 impl<S: State> sealed::Sealed for SetPublishedAt<S> {}
5175 impl<S: State> State for SetPublishedAt<S> {
5176 type Uri = S::Uri;
5177 type PublishedAt = Set<members::published_at>;
5178 type Cid = S::Cid;
5179 type Publisher = S::Publisher;
5180 }
5181 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
5183 impl<S: State> sealed::Sealed for SetCid<S> {}
5184 impl<S: State> State for SetCid<S> {
5185 type Uri = S::Uri;
5186 type PublishedAt = S::PublishedAt;
5187 type Cid = Set<members::cid>;
5188 type Publisher = S::Publisher;
5189 }
5190 pub struct SetPublisher<S: State = Empty>(PhantomData<fn() -> S>);
5192 impl<S: State> sealed::Sealed for SetPublisher<S> {}
5193 impl<S: State> State for SetPublisher<S> {
5194 type Uri = S::Uri;
5195 type PublishedAt = S::PublishedAt;
5196 type Cid = S::Cid;
5197 type Publisher = Set<members::publisher>;
5198 }
5199 #[allow(non_camel_case_types)]
5201 pub mod members {
5202 pub struct uri(());
5204 pub struct published_at(());
5206 pub struct cid(());
5208 pub struct publisher(());
5210 }
5211}
5212
5213pub struct PublishedVersionViewBuilder<'a, S: published_version_view_state::State> {
5215 _state: PhantomData<fn() -> S>,
5216 _fields: (
5217 Option<Cid<'a>>,
5218 Option<StrongRef<'a>>,
5219 Option<bool>,
5220 Option<Datetime>,
5221 Option<ProfileViewBasic<'a>>,
5222 Option<Datetime>,
5223 Option<AtUri<'a>>,
5224 ),
5225 _lifetime: PhantomData<&'a ()>,
5226}
5227
5228impl<'a> PublishedVersionView<'a> {
5229 pub fn new() -> PublishedVersionViewBuilder<
5231 'a,
5232 published_version_view_state::Empty,
5233 > {
5234 PublishedVersionViewBuilder::new()
5235 }
5236}
5237
5238impl<'a> PublishedVersionViewBuilder<'a, published_version_view_state::Empty> {
5239 pub fn new() -> Self {
5241 PublishedVersionViewBuilder {
5242 _state: PhantomData,
5243 _fields: (None, None, None, None, None, None, None),
5244 _lifetime: PhantomData,
5245 }
5246 }
5247}
5248
5249impl<'a, S> PublishedVersionViewBuilder<'a, S>
5250where
5251 S: published_version_view_state::State,
5252 S::Cid: published_version_view_state::IsUnset,
5253{
5254 pub fn cid(
5256 mut self,
5257 value: impl Into<Cid<'a>>,
5258 ) -> PublishedVersionViewBuilder<'a, published_version_view_state::SetCid<S>> {
5259 self._fields.0 = Option::Some(value.into());
5260 PublishedVersionViewBuilder {
5261 _state: PhantomData,
5262 _fields: self._fields,
5263 _lifetime: PhantomData,
5264 }
5265 }
5266}
5267
5268impl<'a, S: published_version_view_state::State> PublishedVersionViewBuilder<'a, S> {
5269 pub fn diverged_from(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
5271 self._fields.1 = value.into();
5272 self
5273 }
5274 pub fn maybe_diverged_from(mut self, value: Option<StrongRef<'a>>) -> Self {
5276 self._fields.1 = value;
5277 self
5278 }
5279}
5280
5281impl<'a, S: published_version_view_state::State> PublishedVersionViewBuilder<'a, S> {
5282 pub fn is_canonical(mut self, value: impl Into<Option<bool>>) -> Self {
5284 self._fields.2 = value.into();
5285 self
5286 }
5287 pub fn maybe_is_canonical(mut self, value: Option<bool>) -> Self {
5289 self._fields.2 = value;
5290 self
5291 }
5292}
5293
5294impl<'a, S> PublishedVersionViewBuilder<'a, S>
5295where
5296 S: published_version_view_state::State,
5297 S::PublishedAt: published_version_view_state::IsUnset,
5298{
5299 pub fn published_at(
5301 mut self,
5302 value: impl Into<Datetime>,
5303 ) -> PublishedVersionViewBuilder<
5304 'a,
5305 published_version_view_state::SetPublishedAt<S>,
5306 > {
5307 self._fields.3 = Option::Some(value.into());
5308 PublishedVersionViewBuilder {
5309 _state: PhantomData,
5310 _fields: self._fields,
5311 _lifetime: PhantomData,
5312 }
5313 }
5314}
5315
5316impl<'a, S> PublishedVersionViewBuilder<'a, S>
5317where
5318 S: published_version_view_state::State,
5319 S::Publisher: published_version_view_state::IsUnset,
5320{
5321 pub fn publisher(
5323 mut self,
5324 value: impl Into<ProfileViewBasic<'a>>,
5325 ) -> PublishedVersionViewBuilder<'a, published_version_view_state::SetPublisher<S>> {
5326 self._fields.4 = Option::Some(value.into());
5327 PublishedVersionViewBuilder {
5328 _state: PhantomData,
5329 _fields: self._fields,
5330 _lifetime: PhantomData,
5331 }
5332 }
5333}
5334
5335impl<'a, S: published_version_view_state::State> PublishedVersionViewBuilder<'a, S> {
5336 pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
5338 self._fields.5 = value.into();
5339 self
5340 }
5341 pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
5343 self._fields.5 = value;
5344 self
5345 }
5346}
5347
5348impl<'a, S> PublishedVersionViewBuilder<'a, S>
5349where
5350 S: published_version_view_state::State,
5351 S::Uri: published_version_view_state::IsUnset,
5352{
5353 pub fn uri(
5355 mut self,
5356 value: impl Into<AtUri<'a>>,
5357 ) -> PublishedVersionViewBuilder<'a, published_version_view_state::SetUri<S>> {
5358 self._fields.6 = Option::Some(value.into());
5359 PublishedVersionViewBuilder {
5360 _state: PhantomData,
5361 _fields: self._fields,
5362 _lifetime: PhantomData,
5363 }
5364 }
5365}
5366
5367impl<'a, S> PublishedVersionViewBuilder<'a, S>
5368where
5369 S: published_version_view_state::State,
5370 S::Uri: published_version_view_state::IsSet,
5371 S::PublishedAt: published_version_view_state::IsSet,
5372 S::Cid: published_version_view_state::IsSet,
5373 S::Publisher: published_version_view_state::IsSet,
5374{
5375 pub fn build(self) -> PublishedVersionView<'a> {
5377 PublishedVersionView {
5378 cid: self._fields.0.unwrap(),
5379 diverged_from: self._fields.1,
5380 is_canonical: self._fields.2,
5381 published_at: self._fields.3.unwrap(),
5382 publisher: self._fields.4.unwrap(),
5383 updated_at: self._fields.5,
5384 uri: self._fields.6.unwrap(),
5385 extra_data: Default::default(),
5386 }
5387 }
5388 pub fn build_with_data(
5390 self,
5391 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5392 ) -> PublishedVersionView<'a> {
5393 PublishedVersionView {
5394 cid: self._fields.0.unwrap(),
5395 diverged_from: self._fields.1,
5396 is_canonical: self._fields.2,
5397 published_at: self._fields.3.unwrap(),
5398 publisher: self._fields.4.unwrap(),
5399 updated_at: self._fields.5,
5400 uri: self._fields.6.unwrap(),
5401 extra_data: Some(extra_data),
5402 }
5403 }
5404}
5405
5406pub mod reason_bookmark_state {
5407
5408 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
5409 #[allow(unused)]
5410 use ::core::marker::PhantomData;
5411 mod sealed {
5412 pub trait Sealed {}
5413 }
5414 pub trait State: sealed::Sealed {
5416 type IndexedAt;
5417 type By;
5418 }
5419 pub struct Empty(());
5421 impl sealed::Sealed for Empty {}
5422 impl State for Empty {
5423 type IndexedAt = Unset;
5424 type By = Unset;
5425 }
5426 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
5428 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
5429 impl<S: State> State for SetIndexedAt<S> {
5430 type IndexedAt = Set<members::indexed_at>;
5431 type By = S::By;
5432 }
5433 pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>);
5435 impl<S: State> sealed::Sealed for SetBy<S> {}
5436 impl<S: State> State for SetBy<S> {
5437 type IndexedAt = S::IndexedAt;
5438 type By = Set<members::by>;
5439 }
5440 #[allow(non_camel_case_types)]
5442 pub mod members {
5443 pub struct indexed_at(());
5445 pub struct by(());
5447 }
5448}
5449
5450pub struct ReasonBookmarkBuilder<'a, S: reason_bookmark_state::State> {
5452 _state: PhantomData<fn() -> S>,
5453 _fields: (Option<ProfileViewBasic<'a>>, Option<Datetime>),
5454 _lifetime: PhantomData<&'a ()>,
5455}
5456
5457impl<'a> ReasonBookmark<'a> {
5458 pub fn new() -> ReasonBookmarkBuilder<'a, reason_bookmark_state::Empty> {
5460 ReasonBookmarkBuilder::new()
5461 }
5462}
5463
5464impl<'a> ReasonBookmarkBuilder<'a, reason_bookmark_state::Empty> {
5465 pub fn new() -> Self {
5467 ReasonBookmarkBuilder {
5468 _state: PhantomData,
5469 _fields: (None, None),
5470 _lifetime: PhantomData,
5471 }
5472 }
5473}
5474
5475impl<'a, S> ReasonBookmarkBuilder<'a, S>
5476where
5477 S: reason_bookmark_state::State,
5478 S::By: reason_bookmark_state::IsUnset,
5479{
5480 pub fn by(
5482 mut self,
5483 value: impl Into<ProfileViewBasic<'a>>,
5484 ) -> ReasonBookmarkBuilder<'a, reason_bookmark_state::SetBy<S>> {
5485 self._fields.0 = Option::Some(value.into());
5486 ReasonBookmarkBuilder {
5487 _state: PhantomData,
5488 _fields: self._fields,
5489 _lifetime: PhantomData,
5490 }
5491 }
5492}
5493
5494impl<'a, S> ReasonBookmarkBuilder<'a, S>
5495where
5496 S: reason_bookmark_state::State,
5497 S::IndexedAt: reason_bookmark_state::IsUnset,
5498{
5499 pub fn indexed_at(
5501 mut self,
5502 value: impl Into<Datetime>,
5503 ) -> ReasonBookmarkBuilder<'a, reason_bookmark_state::SetIndexedAt<S>> {
5504 self._fields.1 = Option::Some(value.into());
5505 ReasonBookmarkBuilder {
5506 _state: PhantomData,
5507 _fields: self._fields,
5508 _lifetime: PhantomData,
5509 }
5510 }
5511}
5512
5513impl<'a, S> ReasonBookmarkBuilder<'a, S>
5514where
5515 S: reason_bookmark_state::State,
5516 S::IndexedAt: reason_bookmark_state::IsSet,
5517 S::By: reason_bookmark_state::IsSet,
5518{
5519 pub fn build(self) -> ReasonBookmark<'a> {
5521 ReasonBookmark {
5522 by: self._fields.0.unwrap(),
5523 indexed_at: self._fields.1.unwrap(),
5524 extra_data: Default::default(),
5525 }
5526 }
5527 pub fn build_with_data(
5529 self,
5530 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5531 ) -> ReasonBookmark<'a> {
5532 ReasonBookmark {
5533 by: self._fields.0.unwrap(),
5534 indexed_at: self._fields.1.unwrap(),
5535 extra_data: Some(extra_data),
5536 }
5537 }
5538}
5539
5540pub mod reason_like_state {
5541
5542 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
5543 #[allow(unused)]
5544 use ::core::marker::PhantomData;
5545 mod sealed {
5546 pub trait Sealed {}
5547 }
5548 pub trait State: sealed::Sealed {
5550 type IndexedAt;
5551 type By;
5552 }
5553 pub struct Empty(());
5555 impl sealed::Sealed for Empty {}
5556 impl State for Empty {
5557 type IndexedAt = Unset;
5558 type By = Unset;
5559 }
5560 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
5562 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
5563 impl<S: State> State for SetIndexedAt<S> {
5564 type IndexedAt = Set<members::indexed_at>;
5565 type By = S::By;
5566 }
5567 pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>);
5569 impl<S: State> sealed::Sealed for SetBy<S> {}
5570 impl<S: State> State for SetBy<S> {
5571 type IndexedAt = S::IndexedAt;
5572 type By = Set<members::by>;
5573 }
5574 #[allow(non_camel_case_types)]
5576 pub mod members {
5577 pub struct indexed_at(());
5579 pub struct by(());
5581 }
5582}
5583
5584pub struct ReasonLikeBuilder<'a, S: reason_like_state::State> {
5586 _state: PhantomData<fn() -> S>,
5587 _fields: (Option<ProfileViewBasic<'a>>, Option<Datetime>),
5588 _lifetime: PhantomData<&'a ()>,
5589}
5590
5591impl<'a> ReasonLike<'a> {
5592 pub fn new() -> ReasonLikeBuilder<'a, reason_like_state::Empty> {
5594 ReasonLikeBuilder::new()
5595 }
5596}
5597
5598impl<'a> ReasonLikeBuilder<'a, reason_like_state::Empty> {
5599 pub fn new() -> Self {
5601 ReasonLikeBuilder {
5602 _state: PhantomData,
5603 _fields: (None, None),
5604 _lifetime: PhantomData,
5605 }
5606 }
5607}
5608
5609impl<'a, S> ReasonLikeBuilder<'a, S>
5610where
5611 S: reason_like_state::State,
5612 S::By: reason_like_state::IsUnset,
5613{
5614 pub fn by(
5616 mut self,
5617 value: impl Into<ProfileViewBasic<'a>>,
5618 ) -> ReasonLikeBuilder<'a, reason_like_state::SetBy<S>> {
5619 self._fields.0 = Option::Some(value.into());
5620 ReasonLikeBuilder {
5621 _state: PhantomData,
5622 _fields: self._fields,
5623 _lifetime: PhantomData,
5624 }
5625 }
5626}
5627
5628impl<'a, S> ReasonLikeBuilder<'a, S>
5629where
5630 S: reason_like_state::State,
5631 S::IndexedAt: reason_like_state::IsUnset,
5632{
5633 pub fn indexed_at(
5635 mut self,
5636 value: impl Into<Datetime>,
5637 ) -> ReasonLikeBuilder<'a, reason_like_state::SetIndexedAt<S>> {
5638 self._fields.1 = Option::Some(value.into());
5639 ReasonLikeBuilder {
5640 _state: PhantomData,
5641 _fields: self._fields,
5642 _lifetime: PhantomData,
5643 }
5644 }
5645}
5646
5647impl<'a, S> ReasonLikeBuilder<'a, S>
5648where
5649 S: reason_like_state::State,
5650 S::IndexedAt: reason_like_state::IsSet,
5651 S::By: reason_like_state::IsSet,
5652{
5653 pub fn build(self) -> ReasonLike<'a> {
5655 ReasonLike {
5656 by: self._fields.0.unwrap(),
5657 indexed_at: self._fields.1.unwrap(),
5658 extra_data: Default::default(),
5659 }
5660 }
5661 pub fn build_with_data(
5663 self,
5664 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5665 ) -> ReasonLike<'a> {
5666 ReasonLike {
5667 by: self._fields.0.unwrap(),
5668 indexed_at: self._fields.1.unwrap(),
5669 extra_data: Some(extra_data),
5670 }
5671 }
5672}
5673
5674pub mod reason_subscription_state {
5675
5676 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
5677 #[allow(unused)]
5678 use ::core::marker::PhantomData;
5679 mod sealed {
5680 pub trait Sealed {}
5681 }
5682 pub trait State: sealed::Sealed {
5684 type IndexedAt;
5685 }
5686 pub struct Empty(());
5688 impl sealed::Sealed for Empty {}
5689 impl State for Empty {
5690 type IndexedAt = Unset;
5691 }
5692 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
5694 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
5695 impl<S: State> State for SetIndexedAt<S> {
5696 type IndexedAt = Set<members::indexed_at>;
5697 }
5698 #[allow(non_camel_case_types)]
5700 pub mod members {
5701 pub struct indexed_at(());
5703 }
5704}
5705
5706pub struct ReasonSubscriptionBuilder<'a, S: reason_subscription_state::State> {
5708 _state: PhantomData<fn() -> S>,
5709 _fields: (Option<Datetime>,),
5710 _lifetime: PhantomData<&'a ()>,
5711}
5712
5713impl<'a> ReasonSubscription<'a> {
5714 pub fn new() -> ReasonSubscriptionBuilder<'a, reason_subscription_state::Empty> {
5716 ReasonSubscriptionBuilder::new()
5717 }
5718}
5719
5720impl<'a> ReasonSubscriptionBuilder<'a, reason_subscription_state::Empty> {
5721 pub fn new() -> Self {
5723 ReasonSubscriptionBuilder {
5724 _state: PhantomData,
5725 _fields: (None,),
5726 _lifetime: PhantomData,
5727 }
5728 }
5729}
5730
5731impl<'a, S> ReasonSubscriptionBuilder<'a, S>
5732where
5733 S: reason_subscription_state::State,
5734 S::IndexedAt: reason_subscription_state::IsUnset,
5735{
5736 pub fn indexed_at(
5738 mut self,
5739 value: impl Into<Datetime>,
5740 ) -> ReasonSubscriptionBuilder<'a, reason_subscription_state::SetIndexedAt<S>> {
5741 self._fields.0 = Option::Some(value.into());
5742 ReasonSubscriptionBuilder {
5743 _state: PhantomData,
5744 _fields: self._fields,
5745 _lifetime: PhantomData,
5746 }
5747 }
5748}
5749
5750impl<'a, S> ReasonSubscriptionBuilder<'a, S>
5751where
5752 S: reason_subscription_state::State,
5753 S::IndexedAt: reason_subscription_state::IsSet,
5754{
5755 pub fn build(self) -> ReasonSubscription<'a> {
5757 ReasonSubscription {
5758 indexed_at: self._fields.0.unwrap(),
5759 extra_data: Default::default(),
5760 }
5761 }
5762 pub fn build_with_data(
5764 self,
5765 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5766 ) -> ReasonSubscription<'a> {
5767 ReasonSubscription {
5768 indexed_at: self._fields.0.unwrap(),
5769 extra_data: Some(extra_data),
5770 }
5771 }
5772}
5773
5774pub mod rendered_view_state {
5775
5776 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
5777 #[allow(unused)]
5778 use ::core::marker::PhantomData;
5779 mod sealed {
5780 pub trait Sealed {}
5781 }
5782 pub trait State: sealed::Sealed {
5784 type Html;
5785 }
5786 pub struct Empty(());
5788 impl sealed::Sealed for Empty {}
5789 impl State for Empty {
5790 type Html = Unset;
5791 }
5792 pub struct SetHtml<S: State = Empty>(PhantomData<fn() -> S>);
5794 impl<S: State> sealed::Sealed for SetHtml<S> {}
5795 impl<S: State> State for SetHtml<S> {
5796 type Html = Set<members::html>;
5797 }
5798 #[allow(non_camel_case_types)]
5800 pub mod members {
5801 pub struct html(());
5803 }
5804}
5805
5806pub struct RenderedViewBuilder<'a, S: rendered_view_state::State> {
5808 _state: PhantomData<fn() -> S>,
5809 _fields: (Option<BlobRef<'a>>, Option<BlobRef<'a>>),
5810 _lifetime: PhantomData<&'a ()>,
5811}
5812
5813impl<'a> RenderedView<'a> {
5814 pub fn new() -> RenderedViewBuilder<'a, rendered_view_state::Empty> {
5816 RenderedViewBuilder::new()
5817 }
5818}
5819
5820impl<'a> RenderedViewBuilder<'a, rendered_view_state::Empty> {
5821 pub fn new() -> Self {
5823 RenderedViewBuilder {
5824 _state: PhantomData,
5825 _fields: (None, None),
5826 _lifetime: PhantomData,
5827 }
5828 }
5829}
5830
5831impl<'a, S: rendered_view_state::State> RenderedViewBuilder<'a, S> {
5832 pub fn css(mut self, value: impl Into<Option<BlobRef<'a>>>) -> Self {
5834 self._fields.0 = value.into();
5835 self
5836 }
5837 pub fn maybe_css(mut self, value: Option<BlobRef<'a>>) -> Self {
5839 self._fields.0 = value;
5840 self
5841 }
5842}
5843
5844impl<'a, S> RenderedViewBuilder<'a, S>
5845where
5846 S: rendered_view_state::State,
5847 S::Html: rendered_view_state::IsUnset,
5848{
5849 pub fn html(
5851 mut self,
5852 value: impl Into<BlobRef<'a>>,
5853 ) -> RenderedViewBuilder<'a, rendered_view_state::SetHtml<S>> {
5854 self._fields.1 = Option::Some(value.into());
5855 RenderedViewBuilder {
5856 _state: PhantomData,
5857 _fields: self._fields,
5858 _lifetime: PhantomData,
5859 }
5860 }
5861}
5862
5863impl<'a, S> RenderedViewBuilder<'a, S>
5864where
5865 S: rendered_view_state::State,
5866 S::Html: rendered_view_state::IsSet,
5867{
5868 pub fn build(self) -> RenderedView<'a> {
5870 RenderedView {
5871 css: self._fields.0,
5872 html: self._fields.1.unwrap(),
5873 extra_data: Default::default(),
5874 }
5875 }
5876 pub fn build_with_data(
5878 self,
5879 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
5880 ) -> RenderedView<'a> {
5881 RenderedView {
5882 css: self._fields.0,
5883 html: self._fields.1.unwrap(),
5884 extra_data: Some(extra_data),
5885 }
5886 }
5887}