1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13
14#[allow(unused_imports)]
15use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
16use jacquard_common::types::string::{AtUri, Cid, Datetime};
17use jacquard_common::types::value::Data;
18use jacquard_derive::{IntoStatic, lexicon, open_union};
19use jacquard_lexicon::lexicon::LexiconDoc;
20use jacquard_lexicon::schema::LexiconSchema;
21
22#[allow(unused_imports)]
23use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
24use serde::{Serialize, Deserialize};
25use crate::app_bsky::actor::ProfileViewBasic;
26use crate::app_bsky::feed::BlockedAuthor;
27use crate::app_bsky::feed::GeneratorView;
28use crate::app_bsky::graph::ListView;
29use crate::app_bsky::graph::StarterPackViewBasic;
30use crate::app_bsky::labeler::LabelerView;
31use crate::com_atproto::label::Label;
32use crate::com_atproto::repo::strong_ref::StrongRef;
33use crate::app_bsky::embed::external;
34use crate::app_bsky::embed::images;
35use crate::app_bsky::embed::record;
36use crate::app_bsky::embed::record_with_media;
37use crate::app_bsky::embed::video;
38
39#[lexicon]
40#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
41#[serde(rename_all = "camelCase")]
42pub struct Record<'a> {
43 #[serde(borrow)]
44 pub record: StrongRef<'a>,
45}
46
47
48#[lexicon]
49#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
50#[serde(rename_all = "camelCase")]
51pub struct View<'a> {
52 #[serde(borrow)]
53 pub record: ViewUnionRecord<'a>,
54}
55
56
57#[open_union]
58#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
59#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
60pub enum ViewUnionRecord<'a> {
61 #[serde(rename = "app.bsky.embed.record#viewRecord")]
62 ViewRecord(Box<record::ViewRecord<'a>>),
63 #[serde(rename = "app.bsky.embed.record#viewNotFound")]
64 ViewNotFound(Box<record::ViewNotFound<'a>>),
65 #[serde(rename = "app.bsky.embed.record#viewBlocked")]
66 ViewBlocked(Box<record::ViewBlocked<'a>>),
67 #[serde(rename = "app.bsky.embed.record#viewDetached")]
68 ViewDetached(Box<record::ViewDetached<'a>>),
69 #[serde(rename = "app.bsky.feed.defs#generatorView")]
70 GeneratorView(Box<GeneratorView<'a>>),
71 #[serde(rename = "app.bsky.graph.defs#listView")]
72 ListView(Box<ListView<'a>>),
73 #[serde(rename = "app.bsky.labeler.defs#labelerView")]
74 LabelerView(Box<LabelerView<'a>>),
75 #[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")]
76 StarterPackViewBasic(Box<StarterPackViewBasic<'a>>),
77}
78
79
80#[lexicon]
81#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
82#[serde(rename_all = "camelCase")]
83pub struct ViewBlocked<'a> {
84 #[serde(borrow)]
85 pub author: BlockedAuthor<'a>,
86 pub blocked: bool,
87 #[serde(borrow)]
88 pub uri: AtUri<'a>,
89}
90
91
92#[lexicon]
93#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
94#[serde(rename_all = "camelCase")]
95pub struct ViewDetached<'a> {
96 pub detached: bool,
97 #[serde(borrow)]
98 pub uri: AtUri<'a>,
99}
100
101
102#[lexicon]
103#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
104#[serde(rename_all = "camelCase")]
105pub struct ViewNotFound<'a> {
106 pub not_found: bool,
107 #[serde(borrow)]
108 pub uri: AtUri<'a>,
109}
110
111
112#[lexicon]
113#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
114#[serde(rename_all = "camelCase")]
115pub struct ViewRecord<'a> {
116 #[serde(borrow)]
117 pub author: ProfileViewBasic<'a>,
118 #[serde(borrow)]
119 pub cid: Cid<'a>,
120 #[serde(skip_serializing_if = "Option::is_none")]
121 #[serde(borrow)]
122 pub embeds: Option<Vec<ViewRecordEmbedsItem<'a>>>,
123 pub indexed_at: Datetime,
124 #[serde(skip_serializing_if = "Option::is_none")]
125 #[serde(borrow)]
126 pub labels: Option<Vec<Label<'a>>>,
127 #[serde(skip_serializing_if = "Option::is_none")]
128 pub like_count: Option<i64>,
129 #[serde(skip_serializing_if = "Option::is_none")]
130 pub quote_count: Option<i64>,
131 #[serde(skip_serializing_if = "Option::is_none")]
132 pub reply_count: Option<i64>,
133 #[serde(skip_serializing_if = "Option::is_none")]
134 pub repost_count: Option<i64>,
135 #[serde(borrow)]
136 pub uri: AtUri<'a>,
137 #[serde(borrow)]
139 pub value: Data<'a>,
140}
141
142
143#[open_union]
144#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
145#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
146pub enum ViewRecordEmbedsItem<'a> {
147 #[serde(rename = "app.bsky.embed.images#view")]
148 ImagesView(Box<images::View<'a>>),
149 #[serde(rename = "app.bsky.embed.video#view")]
150 VideoView(Box<video::View<'a>>),
151 #[serde(rename = "app.bsky.embed.external#view")]
152 ExternalView(Box<external::View<'a>>),
153 #[serde(rename = "app.bsky.embed.record#view")]
154 View(Box<record::View<'a>>),
155 #[serde(rename = "app.bsky.embed.recordWithMedia#view")]
156 RecordWithMediaView(Box<record_with_media::View<'a>>),
157}
158
159impl<'a> LexiconSchema for Record<'a> {
160 fn nsid() -> &'static str {
161 "app.bsky.embed.record"
162 }
163 fn def_name() -> &'static str {
164 "main"
165 }
166 fn lexicon_doc() -> LexiconDoc<'static> {
167 lexicon_doc_app_bsky_embed_record()
168 }
169 fn validate(&self) -> Result<(), ConstraintError> {
170 Ok(())
171 }
172}
173
174impl<'a> LexiconSchema for View<'a> {
175 fn nsid() -> &'static str {
176 "app.bsky.embed.record"
177 }
178 fn def_name() -> &'static str {
179 "view"
180 }
181 fn lexicon_doc() -> LexiconDoc<'static> {
182 lexicon_doc_app_bsky_embed_record()
183 }
184 fn validate(&self) -> Result<(), ConstraintError> {
185 Ok(())
186 }
187}
188
189impl<'a> LexiconSchema for ViewBlocked<'a> {
190 fn nsid() -> &'static str {
191 "app.bsky.embed.record"
192 }
193 fn def_name() -> &'static str {
194 "viewBlocked"
195 }
196 fn lexicon_doc() -> LexiconDoc<'static> {
197 lexicon_doc_app_bsky_embed_record()
198 }
199 fn validate(&self) -> Result<(), ConstraintError> {
200 Ok(())
201 }
202}
203
204impl<'a> LexiconSchema for ViewDetached<'a> {
205 fn nsid() -> &'static str {
206 "app.bsky.embed.record"
207 }
208 fn def_name() -> &'static str {
209 "viewDetached"
210 }
211 fn lexicon_doc() -> LexiconDoc<'static> {
212 lexicon_doc_app_bsky_embed_record()
213 }
214 fn validate(&self) -> Result<(), ConstraintError> {
215 Ok(())
216 }
217}
218
219impl<'a> LexiconSchema for ViewNotFound<'a> {
220 fn nsid() -> &'static str {
221 "app.bsky.embed.record"
222 }
223 fn def_name() -> &'static str {
224 "viewNotFound"
225 }
226 fn lexicon_doc() -> LexiconDoc<'static> {
227 lexicon_doc_app_bsky_embed_record()
228 }
229 fn validate(&self) -> Result<(), ConstraintError> {
230 Ok(())
231 }
232}
233
234impl<'a> LexiconSchema for ViewRecord<'a> {
235 fn nsid() -> &'static str {
236 "app.bsky.embed.record"
237 }
238 fn def_name() -> &'static str {
239 "viewRecord"
240 }
241 fn lexicon_doc() -> LexiconDoc<'static> {
242 lexicon_doc_app_bsky_embed_record()
243 }
244 fn validate(&self) -> Result<(), ConstraintError> {
245 Ok(())
246 }
247}
248
249pub mod record_state {
250
251 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
252 #[allow(unused)]
253 use ::core::marker::PhantomData;
254 mod sealed {
255 pub trait Sealed {}
256 }
257 pub trait State: sealed::Sealed {
259 type Record;
260 }
261 pub struct Empty(());
263 impl sealed::Sealed for Empty {}
264 impl State for Empty {
265 type Record = Unset;
266 }
267 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
269 impl<S: State> sealed::Sealed for SetRecord<S> {}
270 impl<S: State> State for SetRecord<S> {
271 type Record = Set<members::record>;
272 }
273 #[allow(non_camel_case_types)]
275 pub mod members {
276 pub struct record(());
278 }
279}
280
281pub struct RecordBuilder<'a, S: record_state::State> {
283 _state: PhantomData<fn() -> S>,
284 _fields: (Option<StrongRef<'a>>,),
285 _lifetime: PhantomData<&'a ()>,
286}
287
288impl<'a> Record<'a> {
289 pub fn new() -> RecordBuilder<'a, record_state::Empty> {
291 RecordBuilder::new()
292 }
293}
294
295impl<'a> RecordBuilder<'a, record_state::Empty> {
296 pub fn new() -> Self {
298 RecordBuilder {
299 _state: PhantomData,
300 _fields: (None,),
301 _lifetime: PhantomData,
302 }
303 }
304}
305
306impl<'a, S> RecordBuilder<'a, S>
307where
308 S: record_state::State,
309 S::Record: record_state::IsUnset,
310{
311 pub fn record(
313 mut self,
314 value: impl Into<StrongRef<'a>>,
315 ) -> RecordBuilder<'a, record_state::SetRecord<S>> {
316 self._fields.0 = Option::Some(value.into());
317 RecordBuilder {
318 _state: PhantomData,
319 _fields: self._fields,
320 _lifetime: PhantomData,
321 }
322 }
323}
324
325impl<'a, S> RecordBuilder<'a, S>
326where
327 S: record_state::State,
328 S::Record: record_state::IsSet,
329{
330 pub fn build(self) -> Record<'a> {
332 Record {
333 record: self._fields.0.unwrap(),
334 extra_data: Default::default(),
335 }
336 }
337 pub fn build_with_data(
339 self,
340 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
341 ) -> Record<'a> {
342 Record {
343 record: self._fields.0.unwrap(),
344 extra_data: Some(extra_data),
345 }
346 }
347}
348
349fn lexicon_doc_app_bsky_embed_record() -> LexiconDoc<'static> {
350 #[allow(unused_imports)]
351 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
352 use jacquard_lexicon::lexicon::*;
353 use alloc::collections::BTreeMap;
354 LexiconDoc {
355 lexicon: Lexicon::Lexicon1,
356 id: CowStr::new_static("app.bsky.embed.record"),
357 defs: {
358 let mut map = BTreeMap::new();
359 map.insert(
360 SmolStr::new_static("main"),
361 LexUserType::Object(LexObject {
362 required: Some(vec![SmolStr::new_static("record")]),
363 properties: {
364 #[allow(unused_mut)]
365 let mut map = BTreeMap::new();
366 map.insert(
367 SmolStr::new_static("record"),
368 LexObjectProperty::Ref(LexRef {
369 r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
370 ..Default::default()
371 }),
372 );
373 map
374 },
375 ..Default::default()
376 }),
377 );
378 map.insert(
379 SmolStr::new_static("view"),
380 LexUserType::Object(LexObject {
381 required: Some(vec![SmolStr::new_static("record")]),
382 properties: {
383 #[allow(unused_mut)]
384 let mut map = BTreeMap::new();
385 map.insert(
386 SmolStr::new_static("record"),
387 LexObjectProperty::Union(LexRefUnion {
388 refs: vec![
389 CowStr::new_static("#viewRecord"),
390 CowStr::new_static("#viewNotFound"),
391 CowStr::new_static("#viewBlocked"),
392 CowStr::new_static("#viewDetached"),
393 CowStr::new_static("app.bsky.feed.defs#generatorView"),
394 CowStr::new_static("app.bsky.graph.defs#listView"),
395 CowStr::new_static("app.bsky.labeler.defs#labelerView"),
396 CowStr::new_static("app.bsky.graph.defs#starterPackViewBasic")
397 ],
398 ..Default::default()
399 }),
400 );
401 map
402 },
403 ..Default::default()
404 }),
405 );
406 map.insert(
407 SmolStr::new_static("viewBlocked"),
408 LexUserType::Object(LexObject {
409 required: Some(
410 vec![
411 SmolStr::new_static("uri"), SmolStr::new_static("blocked"),
412 SmolStr::new_static("author")
413 ],
414 ),
415 properties: {
416 #[allow(unused_mut)]
417 let mut map = BTreeMap::new();
418 map.insert(
419 SmolStr::new_static("author"),
420 LexObjectProperty::Ref(LexRef {
421 r#ref: CowStr::new_static(
422 "app.bsky.feed.defs#blockedAuthor",
423 ),
424 ..Default::default()
425 }),
426 );
427 map.insert(
428 SmolStr::new_static("blocked"),
429 LexObjectProperty::Boolean(LexBoolean {
430 ..Default::default()
431 }),
432 );
433 map.insert(
434 SmolStr::new_static("uri"),
435 LexObjectProperty::String(LexString {
436 format: Some(LexStringFormat::AtUri),
437 ..Default::default()
438 }),
439 );
440 map
441 },
442 ..Default::default()
443 }),
444 );
445 map.insert(
446 SmolStr::new_static("viewDetached"),
447 LexUserType::Object(LexObject {
448 required: Some(
449 vec![SmolStr::new_static("uri"), SmolStr::new_static("detached")],
450 ),
451 properties: {
452 #[allow(unused_mut)]
453 let mut map = BTreeMap::new();
454 map.insert(
455 SmolStr::new_static("detached"),
456 LexObjectProperty::Boolean(LexBoolean {
457 ..Default::default()
458 }),
459 );
460 map.insert(
461 SmolStr::new_static("uri"),
462 LexObjectProperty::String(LexString {
463 format: Some(LexStringFormat::AtUri),
464 ..Default::default()
465 }),
466 );
467 map
468 },
469 ..Default::default()
470 }),
471 );
472 map.insert(
473 SmolStr::new_static("viewNotFound"),
474 LexUserType::Object(LexObject {
475 required: Some(
476 vec![SmolStr::new_static("uri"), SmolStr::new_static("notFound")],
477 ),
478 properties: {
479 #[allow(unused_mut)]
480 let mut map = BTreeMap::new();
481 map.insert(
482 SmolStr::new_static("notFound"),
483 LexObjectProperty::Boolean(LexBoolean {
484 ..Default::default()
485 }),
486 );
487 map.insert(
488 SmolStr::new_static("uri"),
489 LexObjectProperty::String(LexString {
490 format: Some(LexStringFormat::AtUri),
491 ..Default::default()
492 }),
493 );
494 map
495 },
496 ..Default::default()
497 }),
498 );
499 map.insert(
500 SmolStr::new_static("viewRecord"),
501 LexUserType::Object(LexObject {
502 required: Some(
503 vec![
504 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
505 SmolStr::new_static("author"), SmolStr::new_static("value"),
506 SmolStr::new_static("indexedAt")
507 ],
508 ),
509 properties: {
510 #[allow(unused_mut)]
511 let mut map = BTreeMap::new();
512 map.insert(
513 SmolStr::new_static("author"),
514 LexObjectProperty::Ref(LexRef {
515 r#ref: CowStr::new_static(
516 "app.bsky.actor.defs#profileViewBasic",
517 ),
518 ..Default::default()
519 }),
520 );
521 map.insert(
522 SmolStr::new_static("cid"),
523 LexObjectProperty::String(LexString {
524 format: Some(LexStringFormat::Cid),
525 ..Default::default()
526 }),
527 );
528 map.insert(
529 SmolStr::new_static("embeds"),
530 LexObjectProperty::Array(LexArray {
531 items: LexArrayItem::Union(LexRefUnion {
532 refs: vec![
533 CowStr::new_static("app.bsky.embed.images#view"),
534 CowStr::new_static("app.bsky.embed.video#view"),
535 CowStr::new_static("app.bsky.embed.external#view"),
536 CowStr::new_static("app.bsky.embed.record#view"),
537 CowStr::new_static("app.bsky.embed.recordWithMedia#view")
538 ],
539 ..Default::default()
540 }),
541 ..Default::default()
542 }),
543 );
544 map.insert(
545 SmolStr::new_static("indexedAt"),
546 LexObjectProperty::String(LexString {
547 format: Some(LexStringFormat::Datetime),
548 ..Default::default()
549 }),
550 );
551 map.insert(
552 SmolStr::new_static("labels"),
553 LexObjectProperty::Array(LexArray {
554 items: LexArrayItem::Ref(LexRef {
555 r#ref: CowStr::new_static("com.atproto.label.defs#label"),
556 ..Default::default()
557 }),
558 ..Default::default()
559 }),
560 );
561 map.insert(
562 SmolStr::new_static("likeCount"),
563 LexObjectProperty::Integer(LexInteger {
564 ..Default::default()
565 }),
566 );
567 map.insert(
568 SmolStr::new_static("quoteCount"),
569 LexObjectProperty::Integer(LexInteger {
570 ..Default::default()
571 }),
572 );
573 map.insert(
574 SmolStr::new_static("replyCount"),
575 LexObjectProperty::Integer(LexInteger {
576 ..Default::default()
577 }),
578 );
579 map.insert(
580 SmolStr::new_static("repostCount"),
581 LexObjectProperty::Integer(LexInteger {
582 ..Default::default()
583 }),
584 );
585 map.insert(
586 SmolStr::new_static("uri"),
587 LexObjectProperty::String(LexString {
588 format: Some(LexStringFormat::AtUri),
589 ..Default::default()
590 }),
591 );
592 map.insert(
593 SmolStr::new_static("value"),
594 LexObjectProperty::Unknown(LexUnknown {
595 ..Default::default()
596 }),
597 );
598 map
599 },
600 ..Default::default()
601 }),
602 );
603 map
604 },
605 ..Default::default()
606 }
607}
608
609pub mod view_state {
610
611 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
612 #[allow(unused)]
613 use ::core::marker::PhantomData;
614 mod sealed {
615 pub trait Sealed {}
616 }
617 pub trait State: sealed::Sealed {
619 type Record;
620 }
621 pub struct Empty(());
623 impl sealed::Sealed for Empty {}
624 impl State for Empty {
625 type Record = Unset;
626 }
627 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
629 impl<S: State> sealed::Sealed for SetRecord<S> {}
630 impl<S: State> State for SetRecord<S> {
631 type Record = Set<members::record>;
632 }
633 #[allow(non_camel_case_types)]
635 pub mod members {
636 pub struct record(());
638 }
639}
640
641pub struct ViewBuilder<'a, S: view_state::State> {
643 _state: PhantomData<fn() -> S>,
644 _fields: (Option<ViewUnionRecord<'a>>,),
645 _lifetime: PhantomData<&'a ()>,
646}
647
648impl<'a> View<'a> {
649 pub fn new() -> ViewBuilder<'a, view_state::Empty> {
651 ViewBuilder::new()
652 }
653}
654
655impl<'a> ViewBuilder<'a, view_state::Empty> {
656 pub fn new() -> Self {
658 ViewBuilder {
659 _state: PhantomData,
660 _fields: (None,),
661 _lifetime: PhantomData,
662 }
663 }
664}
665
666impl<'a, S> ViewBuilder<'a, S>
667where
668 S: view_state::State,
669 S::Record: view_state::IsUnset,
670{
671 pub fn record(
673 mut self,
674 value: impl Into<ViewUnionRecord<'a>>,
675 ) -> ViewBuilder<'a, view_state::SetRecord<S>> {
676 self._fields.0 = Option::Some(value.into());
677 ViewBuilder {
678 _state: PhantomData,
679 _fields: self._fields,
680 _lifetime: PhantomData,
681 }
682 }
683}
684
685impl<'a, S> ViewBuilder<'a, S>
686where
687 S: view_state::State,
688 S::Record: view_state::IsSet,
689{
690 pub fn build(self) -> View<'a> {
692 View {
693 record: self._fields.0.unwrap(),
694 extra_data: Default::default(),
695 }
696 }
697 pub fn build_with_data(
699 self,
700 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
701 ) -> View<'a> {
702 View {
703 record: self._fields.0.unwrap(),
704 extra_data: Some(extra_data),
705 }
706 }
707}
708
709pub mod view_blocked_state {
710
711 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
712 #[allow(unused)]
713 use ::core::marker::PhantomData;
714 mod sealed {
715 pub trait Sealed {}
716 }
717 pub trait State: sealed::Sealed {
719 type Blocked;
720 type Author;
721 type Uri;
722 }
723 pub struct Empty(());
725 impl sealed::Sealed for Empty {}
726 impl State for Empty {
727 type Blocked = Unset;
728 type Author = Unset;
729 type Uri = Unset;
730 }
731 pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>);
733 impl<S: State> sealed::Sealed for SetBlocked<S> {}
734 impl<S: State> State for SetBlocked<S> {
735 type Blocked = Set<members::blocked>;
736 type Author = S::Author;
737 type Uri = S::Uri;
738 }
739 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
741 impl<S: State> sealed::Sealed for SetAuthor<S> {}
742 impl<S: State> State for SetAuthor<S> {
743 type Blocked = S::Blocked;
744 type Author = Set<members::author>;
745 type Uri = S::Uri;
746 }
747 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
749 impl<S: State> sealed::Sealed for SetUri<S> {}
750 impl<S: State> State for SetUri<S> {
751 type Blocked = S::Blocked;
752 type Author = S::Author;
753 type Uri = Set<members::uri>;
754 }
755 #[allow(non_camel_case_types)]
757 pub mod members {
758 pub struct blocked(());
760 pub struct author(());
762 pub struct uri(());
764 }
765}
766
767pub struct ViewBlockedBuilder<'a, S: view_blocked_state::State> {
769 _state: PhantomData<fn() -> S>,
770 _fields: (Option<BlockedAuthor<'a>>, Option<bool>, Option<AtUri<'a>>),
771 _lifetime: PhantomData<&'a ()>,
772}
773
774impl<'a> ViewBlocked<'a> {
775 pub fn new() -> ViewBlockedBuilder<'a, view_blocked_state::Empty> {
777 ViewBlockedBuilder::new()
778 }
779}
780
781impl<'a> ViewBlockedBuilder<'a, view_blocked_state::Empty> {
782 pub fn new() -> Self {
784 ViewBlockedBuilder {
785 _state: PhantomData,
786 _fields: (None, None, None),
787 _lifetime: PhantomData,
788 }
789 }
790}
791
792impl<'a, S> ViewBlockedBuilder<'a, S>
793where
794 S: view_blocked_state::State,
795 S::Author: view_blocked_state::IsUnset,
796{
797 pub fn author(
799 mut self,
800 value: impl Into<BlockedAuthor<'a>>,
801 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetAuthor<S>> {
802 self._fields.0 = Option::Some(value.into());
803 ViewBlockedBuilder {
804 _state: PhantomData,
805 _fields: self._fields,
806 _lifetime: PhantomData,
807 }
808 }
809}
810
811impl<'a, S> ViewBlockedBuilder<'a, S>
812where
813 S: view_blocked_state::State,
814 S::Blocked: view_blocked_state::IsUnset,
815{
816 pub fn blocked(
818 mut self,
819 value: impl Into<bool>,
820 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetBlocked<S>> {
821 self._fields.1 = Option::Some(value.into());
822 ViewBlockedBuilder {
823 _state: PhantomData,
824 _fields: self._fields,
825 _lifetime: PhantomData,
826 }
827 }
828}
829
830impl<'a, S> ViewBlockedBuilder<'a, S>
831where
832 S: view_blocked_state::State,
833 S::Uri: view_blocked_state::IsUnset,
834{
835 pub fn uri(
837 mut self,
838 value: impl Into<AtUri<'a>>,
839 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetUri<S>> {
840 self._fields.2 = Option::Some(value.into());
841 ViewBlockedBuilder {
842 _state: PhantomData,
843 _fields: self._fields,
844 _lifetime: PhantomData,
845 }
846 }
847}
848
849impl<'a, S> ViewBlockedBuilder<'a, S>
850where
851 S: view_blocked_state::State,
852 S::Blocked: view_blocked_state::IsSet,
853 S::Author: view_blocked_state::IsSet,
854 S::Uri: view_blocked_state::IsSet,
855{
856 pub fn build(self) -> ViewBlocked<'a> {
858 ViewBlocked {
859 author: self._fields.0.unwrap(),
860 blocked: self._fields.1.unwrap(),
861 uri: self._fields.2.unwrap(),
862 extra_data: Default::default(),
863 }
864 }
865 pub fn build_with_data(
867 self,
868 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
869 ) -> ViewBlocked<'a> {
870 ViewBlocked {
871 author: self._fields.0.unwrap(),
872 blocked: self._fields.1.unwrap(),
873 uri: self._fields.2.unwrap(),
874 extra_data: Some(extra_data),
875 }
876 }
877}
878
879pub mod view_detached_state {
880
881 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
882 #[allow(unused)]
883 use ::core::marker::PhantomData;
884 mod sealed {
885 pub trait Sealed {}
886 }
887 pub trait State: sealed::Sealed {
889 type Detached;
890 type Uri;
891 }
892 pub struct Empty(());
894 impl sealed::Sealed for Empty {}
895 impl State for Empty {
896 type Detached = Unset;
897 type Uri = Unset;
898 }
899 pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>);
901 impl<S: State> sealed::Sealed for SetDetached<S> {}
902 impl<S: State> State for SetDetached<S> {
903 type Detached = Set<members::detached>;
904 type Uri = S::Uri;
905 }
906 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
908 impl<S: State> sealed::Sealed for SetUri<S> {}
909 impl<S: State> State for SetUri<S> {
910 type Detached = S::Detached;
911 type Uri = Set<members::uri>;
912 }
913 #[allow(non_camel_case_types)]
915 pub mod members {
916 pub struct detached(());
918 pub struct uri(());
920 }
921}
922
923pub struct ViewDetachedBuilder<'a, S: view_detached_state::State> {
925 _state: PhantomData<fn() -> S>,
926 _fields: (Option<bool>, Option<AtUri<'a>>),
927 _lifetime: PhantomData<&'a ()>,
928}
929
930impl<'a> ViewDetached<'a> {
931 pub fn new() -> ViewDetachedBuilder<'a, view_detached_state::Empty> {
933 ViewDetachedBuilder::new()
934 }
935}
936
937impl<'a> ViewDetachedBuilder<'a, view_detached_state::Empty> {
938 pub fn new() -> Self {
940 ViewDetachedBuilder {
941 _state: PhantomData,
942 _fields: (None, None),
943 _lifetime: PhantomData,
944 }
945 }
946}
947
948impl<'a, S> ViewDetachedBuilder<'a, S>
949where
950 S: view_detached_state::State,
951 S::Detached: view_detached_state::IsUnset,
952{
953 pub fn detached(
955 mut self,
956 value: impl Into<bool>,
957 ) -> ViewDetachedBuilder<'a, view_detached_state::SetDetached<S>> {
958 self._fields.0 = Option::Some(value.into());
959 ViewDetachedBuilder {
960 _state: PhantomData,
961 _fields: self._fields,
962 _lifetime: PhantomData,
963 }
964 }
965}
966
967impl<'a, S> ViewDetachedBuilder<'a, S>
968where
969 S: view_detached_state::State,
970 S::Uri: view_detached_state::IsUnset,
971{
972 pub fn uri(
974 mut self,
975 value: impl Into<AtUri<'a>>,
976 ) -> ViewDetachedBuilder<'a, view_detached_state::SetUri<S>> {
977 self._fields.1 = Option::Some(value.into());
978 ViewDetachedBuilder {
979 _state: PhantomData,
980 _fields: self._fields,
981 _lifetime: PhantomData,
982 }
983 }
984}
985
986impl<'a, S> ViewDetachedBuilder<'a, S>
987where
988 S: view_detached_state::State,
989 S::Detached: view_detached_state::IsSet,
990 S::Uri: view_detached_state::IsSet,
991{
992 pub fn build(self) -> ViewDetached<'a> {
994 ViewDetached {
995 detached: self._fields.0.unwrap(),
996 uri: self._fields.1.unwrap(),
997 extra_data: Default::default(),
998 }
999 }
1000 pub fn build_with_data(
1002 self,
1003 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1004 ) -> ViewDetached<'a> {
1005 ViewDetached {
1006 detached: self._fields.0.unwrap(),
1007 uri: self._fields.1.unwrap(),
1008 extra_data: Some(extra_data),
1009 }
1010 }
1011}
1012
1013pub mod view_not_found_state {
1014
1015 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1016 #[allow(unused)]
1017 use ::core::marker::PhantomData;
1018 mod sealed {
1019 pub trait Sealed {}
1020 }
1021 pub trait State: sealed::Sealed {
1023 type Uri;
1024 type NotFound;
1025 }
1026 pub struct Empty(());
1028 impl sealed::Sealed for Empty {}
1029 impl State for Empty {
1030 type Uri = Unset;
1031 type NotFound = Unset;
1032 }
1033 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1035 impl<S: State> sealed::Sealed for SetUri<S> {}
1036 impl<S: State> State for SetUri<S> {
1037 type Uri = Set<members::uri>;
1038 type NotFound = S::NotFound;
1039 }
1040 pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>);
1042 impl<S: State> sealed::Sealed for SetNotFound<S> {}
1043 impl<S: State> State for SetNotFound<S> {
1044 type Uri = S::Uri;
1045 type NotFound = Set<members::not_found>;
1046 }
1047 #[allow(non_camel_case_types)]
1049 pub mod members {
1050 pub struct uri(());
1052 pub struct not_found(());
1054 }
1055}
1056
1057pub struct ViewNotFoundBuilder<'a, S: view_not_found_state::State> {
1059 _state: PhantomData<fn() -> S>,
1060 _fields: (Option<bool>, Option<AtUri<'a>>),
1061 _lifetime: PhantomData<&'a ()>,
1062}
1063
1064impl<'a> ViewNotFound<'a> {
1065 pub fn new() -> ViewNotFoundBuilder<'a, view_not_found_state::Empty> {
1067 ViewNotFoundBuilder::new()
1068 }
1069}
1070
1071impl<'a> ViewNotFoundBuilder<'a, view_not_found_state::Empty> {
1072 pub fn new() -> Self {
1074 ViewNotFoundBuilder {
1075 _state: PhantomData,
1076 _fields: (None, None),
1077 _lifetime: PhantomData,
1078 }
1079 }
1080}
1081
1082impl<'a, S> ViewNotFoundBuilder<'a, S>
1083where
1084 S: view_not_found_state::State,
1085 S::NotFound: view_not_found_state::IsUnset,
1086{
1087 pub fn not_found(
1089 mut self,
1090 value: impl Into<bool>,
1091 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetNotFound<S>> {
1092 self._fields.0 = Option::Some(value.into());
1093 ViewNotFoundBuilder {
1094 _state: PhantomData,
1095 _fields: self._fields,
1096 _lifetime: PhantomData,
1097 }
1098 }
1099}
1100
1101impl<'a, S> ViewNotFoundBuilder<'a, S>
1102where
1103 S: view_not_found_state::State,
1104 S::Uri: view_not_found_state::IsUnset,
1105{
1106 pub fn uri(
1108 mut self,
1109 value: impl Into<AtUri<'a>>,
1110 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetUri<S>> {
1111 self._fields.1 = Option::Some(value.into());
1112 ViewNotFoundBuilder {
1113 _state: PhantomData,
1114 _fields: self._fields,
1115 _lifetime: PhantomData,
1116 }
1117 }
1118}
1119
1120impl<'a, S> ViewNotFoundBuilder<'a, S>
1121where
1122 S: view_not_found_state::State,
1123 S::Uri: view_not_found_state::IsSet,
1124 S::NotFound: view_not_found_state::IsSet,
1125{
1126 pub fn build(self) -> ViewNotFound<'a> {
1128 ViewNotFound {
1129 not_found: self._fields.0.unwrap(),
1130 uri: self._fields.1.unwrap(),
1131 extra_data: Default::default(),
1132 }
1133 }
1134 pub fn build_with_data(
1136 self,
1137 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1138 ) -> ViewNotFound<'a> {
1139 ViewNotFound {
1140 not_found: self._fields.0.unwrap(),
1141 uri: self._fields.1.unwrap(),
1142 extra_data: Some(extra_data),
1143 }
1144 }
1145}
1146
1147pub mod view_record_state {
1148
1149 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1150 #[allow(unused)]
1151 use ::core::marker::PhantomData;
1152 mod sealed {
1153 pub trait Sealed {}
1154 }
1155 pub trait State: sealed::Sealed {
1157 type Cid;
1158 type IndexedAt;
1159 type Uri;
1160 type Author;
1161 type Value;
1162 }
1163 pub struct Empty(());
1165 impl sealed::Sealed for Empty {}
1166 impl State for Empty {
1167 type Cid = Unset;
1168 type IndexedAt = Unset;
1169 type Uri = Unset;
1170 type Author = Unset;
1171 type Value = Unset;
1172 }
1173 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
1175 impl<S: State> sealed::Sealed for SetCid<S> {}
1176 impl<S: State> State for SetCid<S> {
1177 type Cid = Set<members::cid>;
1178 type IndexedAt = S::IndexedAt;
1179 type Uri = S::Uri;
1180 type Author = S::Author;
1181 type Value = S::Value;
1182 }
1183 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
1185 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
1186 impl<S: State> State for SetIndexedAt<S> {
1187 type Cid = S::Cid;
1188 type IndexedAt = Set<members::indexed_at>;
1189 type Uri = S::Uri;
1190 type Author = S::Author;
1191 type Value = S::Value;
1192 }
1193 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1195 impl<S: State> sealed::Sealed for SetUri<S> {}
1196 impl<S: State> State for SetUri<S> {
1197 type Cid = S::Cid;
1198 type IndexedAt = S::IndexedAt;
1199 type Uri = Set<members::uri>;
1200 type Author = S::Author;
1201 type Value = S::Value;
1202 }
1203 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
1205 impl<S: State> sealed::Sealed for SetAuthor<S> {}
1206 impl<S: State> State for SetAuthor<S> {
1207 type Cid = S::Cid;
1208 type IndexedAt = S::IndexedAt;
1209 type Uri = S::Uri;
1210 type Author = Set<members::author>;
1211 type Value = S::Value;
1212 }
1213 pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
1215 impl<S: State> sealed::Sealed for SetValue<S> {}
1216 impl<S: State> State for SetValue<S> {
1217 type Cid = S::Cid;
1218 type IndexedAt = S::IndexedAt;
1219 type Uri = S::Uri;
1220 type Author = S::Author;
1221 type Value = Set<members::value>;
1222 }
1223 #[allow(non_camel_case_types)]
1225 pub mod members {
1226 pub struct cid(());
1228 pub struct indexed_at(());
1230 pub struct uri(());
1232 pub struct author(());
1234 pub struct value(());
1236 }
1237}
1238
1239pub struct ViewRecordBuilder<'a, S: view_record_state::State> {
1241 _state: PhantomData<fn() -> S>,
1242 _fields: (
1243 Option<ProfileViewBasic<'a>>,
1244 Option<Cid<'a>>,
1245 Option<Vec<ViewRecordEmbedsItem<'a>>>,
1246 Option<Datetime>,
1247 Option<Vec<Label<'a>>>,
1248 Option<i64>,
1249 Option<i64>,
1250 Option<i64>,
1251 Option<i64>,
1252 Option<AtUri<'a>>,
1253 Option<Data<'a>>,
1254 ),
1255 _lifetime: PhantomData<&'a ()>,
1256}
1257
1258impl<'a> ViewRecord<'a> {
1259 pub fn new() -> ViewRecordBuilder<'a, view_record_state::Empty> {
1261 ViewRecordBuilder::new()
1262 }
1263}
1264
1265impl<'a> ViewRecordBuilder<'a, view_record_state::Empty> {
1266 pub fn new() -> Self {
1268 ViewRecordBuilder {
1269 _state: PhantomData,
1270 _fields: (None, None, None, None, None, None, None, None, None, None, None),
1271 _lifetime: PhantomData,
1272 }
1273 }
1274}
1275
1276impl<'a, S> ViewRecordBuilder<'a, S>
1277where
1278 S: view_record_state::State,
1279 S::Author: view_record_state::IsUnset,
1280{
1281 pub fn author(
1283 mut self,
1284 value: impl Into<ProfileViewBasic<'a>>,
1285 ) -> ViewRecordBuilder<'a, view_record_state::SetAuthor<S>> {
1286 self._fields.0 = Option::Some(value.into());
1287 ViewRecordBuilder {
1288 _state: PhantomData,
1289 _fields: self._fields,
1290 _lifetime: PhantomData,
1291 }
1292 }
1293}
1294
1295impl<'a, S> ViewRecordBuilder<'a, S>
1296where
1297 S: view_record_state::State,
1298 S::Cid: view_record_state::IsUnset,
1299{
1300 pub fn cid(
1302 mut self,
1303 value: impl Into<Cid<'a>>,
1304 ) -> ViewRecordBuilder<'a, view_record_state::SetCid<S>> {
1305 self._fields.1 = Option::Some(value.into());
1306 ViewRecordBuilder {
1307 _state: PhantomData,
1308 _fields: self._fields,
1309 _lifetime: PhantomData,
1310 }
1311 }
1312}
1313
1314impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1315 pub fn embeds(
1317 mut self,
1318 value: impl Into<Option<Vec<ViewRecordEmbedsItem<'a>>>>,
1319 ) -> Self {
1320 self._fields.2 = value.into();
1321 self
1322 }
1323 pub fn maybe_embeds(mut self, value: Option<Vec<ViewRecordEmbedsItem<'a>>>) -> Self {
1325 self._fields.2 = value;
1326 self
1327 }
1328}
1329
1330impl<'a, S> ViewRecordBuilder<'a, S>
1331where
1332 S: view_record_state::State,
1333 S::IndexedAt: view_record_state::IsUnset,
1334{
1335 pub fn indexed_at(
1337 mut self,
1338 value: impl Into<Datetime>,
1339 ) -> ViewRecordBuilder<'a, view_record_state::SetIndexedAt<S>> {
1340 self._fields.3 = Option::Some(value.into());
1341 ViewRecordBuilder {
1342 _state: PhantomData,
1343 _fields: self._fields,
1344 _lifetime: PhantomData,
1345 }
1346 }
1347}
1348
1349impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1350 pub fn labels(mut self, value: impl Into<Option<Vec<Label<'a>>>>) -> Self {
1352 self._fields.4 = value.into();
1353 self
1354 }
1355 pub fn maybe_labels(mut self, value: Option<Vec<Label<'a>>>) -> Self {
1357 self._fields.4 = value;
1358 self
1359 }
1360}
1361
1362impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1363 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
1365 self._fields.5 = value.into();
1366 self
1367 }
1368 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
1370 self._fields.5 = value;
1371 self
1372 }
1373}
1374
1375impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1376 pub fn quote_count(mut self, value: impl Into<Option<i64>>) -> Self {
1378 self._fields.6 = value.into();
1379 self
1380 }
1381 pub fn maybe_quote_count(mut self, value: Option<i64>) -> Self {
1383 self._fields.6 = value;
1384 self
1385 }
1386}
1387
1388impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1389 pub fn reply_count(mut self, value: impl Into<Option<i64>>) -> Self {
1391 self._fields.7 = value.into();
1392 self
1393 }
1394 pub fn maybe_reply_count(mut self, value: Option<i64>) -> Self {
1396 self._fields.7 = value;
1397 self
1398 }
1399}
1400
1401impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1402 pub fn repost_count(mut self, value: impl Into<Option<i64>>) -> Self {
1404 self._fields.8 = value.into();
1405 self
1406 }
1407 pub fn maybe_repost_count(mut self, value: Option<i64>) -> Self {
1409 self._fields.8 = value;
1410 self
1411 }
1412}
1413
1414impl<'a, S> ViewRecordBuilder<'a, S>
1415where
1416 S: view_record_state::State,
1417 S::Uri: view_record_state::IsUnset,
1418{
1419 pub fn uri(
1421 mut self,
1422 value: impl Into<AtUri<'a>>,
1423 ) -> ViewRecordBuilder<'a, view_record_state::SetUri<S>> {
1424 self._fields.9 = Option::Some(value.into());
1425 ViewRecordBuilder {
1426 _state: PhantomData,
1427 _fields: self._fields,
1428 _lifetime: PhantomData,
1429 }
1430 }
1431}
1432
1433impl<'a, S> ViewRecordBuilder<'a, S>
1434where
1435 S: view_record_state::State,
1436 S::Value: view_record_state::IsUnset,
1437{
1438 pub fn value(
1440 mut self,
1441 value: impl Into<Data<'a>>,
1442 ) -> ViewRecordBuilder<'a, view_record_state::SetValue<S>> {
1443 self._fields.10 = Option::Some(value.into());
1444 ViewRecordBuilder {
1445 _state: PhantomData,
1446 _fields: self._fields,
1447 _lifetime: PhantomData,
1448 }
1449 }
1450}
1451
1452impl<'a, S> ViewRecordBuilder<'a, S>
1453where
1454 S: view_record_state::State,
1455 S::Cid: view_record_state::IsSet,
1456 S::IndexedAt: view_record_state::IsSet,
1457 S::Uri: view_record_state::IsSet,
1458 S::Author: view_record_state::IsSet,
1459 S::Value: view_record_state::IsSet,
1460{
1461 pub fn build(self) -> ViewRecord<'a> {
1463 ViewRecord {
1464 author: self._fields.0.unwrap(),
1465 cid: self._fields.1.unwrap(),
1466 embeds: self._fields.2,
1467 indexed_at: self._fields.3.unwrap(),
1468 labels: self._fields.4,
1469 like_count: self._fields.5,
1470 quote_count: self._fields.6,
1471 reply_count: self._fields.7,
1472 repost_count: self._fields.8,
1473 uri: self._fields.9.unwrap(),
1474 value: self._fields.10.unwrap(),
1475 extra_data: Default::default(),
1476 }
1477 }
1478 pub fn build_with_data(
1480 self,
1481 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1482 ) -> ViewRecord<'a> {
1483 ViewRecord {
1484 author: self._fields.0.unwrap(),
1485 cid: self._fields.1.unwrap(),
1486 embeds: self._fields.2,
1487 indexed_at: self._fields.3.unwrap(),
1488 labels: self._fields.4,
1489 like_count: self._fields.5,
1490 quote_count: self._fields.6,
1491 reply_count: self._fields.7,
1492 repost_count: self._fields.8,
1493 uri: self._fields.9.unwrap(),
1494 value: self._fields.10.unwrap(),
1495 extra_data: Some(extra_data),
1496 }
1497 }
1498}