1pub mod declaration;
9pub mod get_preferences;
10pub mod get_unread_count;
11pub mod list_activity_subscriptions;
12pub mod list_notifications;
13pub mod put_activity_subscription;
14pub mod put_preferences;
15pub mod put_preferences_v2;
16pub mod register_push;
17pub mod unregister_push;
18pub mod update_seen;
19
20
21#[allow(unused_imports)]
22use alloc::collections::BTreeMap;
23
24#[allow(unused_imports)]
25use core::marker::PhantomData;
26use jacquard_common::CowStr;
27
28#[allow(unused_imports)]
29use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
30use jacquard_common::types::string::Did;
31use jacquard_derive::{IntoStatic, lexicon};
32use jacquard_lexicon::lexicon::LexiconDoc;
33use jacquard_lexicon::schema::LexiconSchema;
34
35#[allow(unused_imports)]
36use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
37use serde::{Serialize, Deserialize};
38use crate::app_bsky::notification;
39
40#[lexicon]
41#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
42#[serde(rename_all = "camelCase")]
43pub struct ActivitySubscription<'a> {
44 pub post: bool,
45 pub reply: bool,
46}
47
48
49#[lexicon]
50#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
51#[serde(rename_all = "camelCase")]
52pub struct ChatPreference<'a> {
53 #[serde(borrow)]
54 pub include: ChatPreferenceInclude<'a>,
55 pub push: bool,
56}
57
58
59#[derive(Debug, Clone, PartialEq, Eq, Hash)]
60pub enum ChatPreferenceInclude<'a> {
61 All,
62 Accepted,
63 Other(CowStr<'a>),
64}
65
66impl<'a> ChatPreferenceInclude<'a> {
67 pub fn as_str(&self) -> &str {
68 match self {
69 Self::All => "all",
70 Self::Accepted => "accepted",
71 Self::Other(s) => s.as_ref(),
72 }
73 }
74}
75
76impl<'a> From<&'a str> for ChatPreferenceInclude<'a> {
77 fn from(s: &'a str) -> Self {
78 match s {
79 "all" => Self::All,
80 "accepted" => Self::Accepted,
81 _ => Self::Other(CowStr::from(s)),
82 }
83 }
84}
85
86impl<'a> From<String> for ChatPreferenceInclude<'a> {
87 fn from(s: String) -> Self {
88 match s.as_str() {
89 "all" => Self::All,
90 "accepted" => Self::Accepted,
91 _ => Self::Other(CowStr::from(s)),
92 }
93 }
94}
95
96impl<'a> core::fmt::Display for ChatPreferenceInclude<'a> {
97 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
98 write!(f, "{}", self.as_str())
99 }
100}
101
102impl<'a> AsRef<str> for ChatPreferenceInclude<'a> {
103 fn as_ref(&self) -> &str {
104 self.as_str()
105 }
106}
107
108impl<'a> serde::Serialize for ChatPreferenceInclude<'a> {
109 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
110 where
111 S: serde::Serializer,
112 {
113 serializer.serialize_str(self.as_str())
114 }
115}
116
117impl<'de, 'a> serde::Deserialize<'de> for ChatPreferenceInclude<'a>
118where
119 'de: 'a,
120{
121 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
122 where
123 D: serde::Deserializer<'de>,
124 {
125 let s = <&'de str>::deserialize(deserializer)?;
126 Ok(Self::from(s))
127 }
128}
129
130impl<'a> Default for ChatPreferenceInclude<'a> {
131 fn default() -> Self {
132 Self::Other(Default::default())
133 }
134}
135
136impl jacquard_common::IntoStatic for ChatPreferenceInclude<'_> {
137 type Output = ChatPreferenceInclude<'static>;
138 fn into_static(self) -> Self::Output {
139 match self {
140 ChatPreferenceInclude::All => ChatPreferenceInclude::All,
141 ChatPreferenceInclude::Accepted => ChatPreferenceInclude::Accepted,
142 ChatPreferenceInclude::Other(v) => {
143 ChatPreferenceInclude::Other(v.into_static())
144 }
145 }
146 }
147}
148
149
150#[lexicon]
151#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
152#[serde(rename_all = "camelCase")]
153pub struct FilterablePreference<'a> {
154 #[serde(borrow)]
155 pub include: FilterablePreferenceInclude<'a>,
156 pub list: bool,
157 pub push: bool,
158}
159
160
161#[derive(Debug, Clone, PartialEq, Eq, Hash)]
162pub enum FilterablePreferenceInclude<'a> {
163 All,
164 Follows,
165 Other(CowStr<'a>),
166}
167
168impl<'a> FilterablePreferenceInclude<'a> {
169 pub fn as_str(&self) -> &str {
170 match self {
171 Self::All => "all",
172 Self::Follows => "follows",
173 Self::Other(s) => s.as_ref(),
174 }
175 }
176}
177
178impl<'a> From<&'a str> for FilterablePreferenceInclude<'a> {
179 fn from(s: &'a str) -> Self {
180 match s {
181 "all" => Self::All,
182 "follows" => Self::Follows,
183 _ => Self::Other(CowStr::from(s)),
184 }
185 }
186}
187
188impl<'a> From<String> for FilterablePreferenceInclude<'a> {
189 fn from(s: String) -> Self {
190 match s.as_str() {
191 "all" => Self::All,
192 "follows" => Self::Follows,
193 _ => Self::Other(CowStr::from(s)),
194 }
195 }
196}
197
198impl<'a> core::fmt::Display for FilterablePreferenceInclude<'a> {
199 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
200 write!(f, "{}", self.as_str())
201 }
202}
203
204impl<'a> AsRef<str> for FilterablePreferenceInclude<'a> {
205 fn as_ref(&self) -> &str {
206 self.as_str()
207 }
208}
209
210impl<'a> serde::Serialize for FilterablePreferenceInclude<'a> {
211 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
212 where
213 S: serde::Serializer,
214 {
215 serializer.serialize_str(self.as_str())
216 }
217}
218
219impl<'de, 'a> serde::Deserialize<'de> for FilterablePreferenceInclude<'a>
220where
221 'de: 'a,
222{
223 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
224 where
225 D: serde::Deserializer<'de>,
226 {
227 let s = <&'de str>::deserialize(deserializer)?;
228 Ok(Self::from(s))
229 }
230}
231
232impl<'a> Default for FilterablePreferenceInclude<'a> {
233 fn default() -> Self {
234 Self::Other(Default::default())
235 }
236}
237
238impl jacquard_common::IntoStatic for FilterablePreferenceInclude<'_> {
239 type Output = FilterablePreferenceInclude<'static>;
240 fn into_static(self) -> Self::Output {
241 match self {
242 FilterablePreferenceInclude::All => FilterablePreferenceInclude::All,
243 FilterablePreferenceInclude::Follows => FilterablePreferenceInclude::Follows,
244 FilterablePreferenceInclude::Other(v) => {
245 FilterablePreferenceInclude::Other(v.into_static())
246 }
247 }
248 }
249}
250
251
252#[lexicon]
253#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
254#[serde(rename_all = "camelCase")]
255pub struct Preference<'a> {
256 pub list: bool,
257 pub push: bool,
258}
259
260
261#[lexicon]
262#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
263#[serde(rename_all = "camelCase")]
264pub struct Preferences<'a> {
265 #[serde(borrow)]
266 pub chat: notification::ChatPreference<'a>,
267 #[serde(borrow)]
268 pub follow: notification::FilterablePreference<'a>,
269 #[serde(borrow)]
270 pub like: notification::FilterablePreference<'a>,
271 #[serde(borrow)]
272 pub like_via_repost: notification::FilterablePreference<'a>,
273 #[serde(borrow)]
274 pub mention: notification::FilterablePreference<'a>,
275 #[serde(borrow)]
276 pub quote: notification::FilterablePreference<'a>,
277 #[serde(borrow)]
278 pub reply: notification::FilterablePreference<'a>,
279 #[serde(borrow)]
280 pub repost: notification::FilterablePreference<'a>,
281 #[serde(borrow)]
282 pub repost_via_repost: notification::FilterablePreference<'a>,
283 #[serde(borrow)]
284 pub starterpack_joined: notification::Preference<'a>,
285 #[serde(borrow)]
286 pub subscribed_post: notification::Preference<'a>,
287 #[serde(borrow)]
288 pub unverified: notification::Preference<'a>,
289 #[serde(borrow)]
290 pub verified: notification::Preference<'a>,
291}
292
293
294#[lexicon]
295#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
296#[serde(rename_all = "camelCase")]
297pub struct RecordDeleted<'a> {}
298#[lexicon]
301#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
302#[serde(rename_all = "camelCase")]
303pub struct SubjectActivitySubscription<'a> {
304 #[serde(borrow)]
305 pub activity_subscription: notification::ActivitySubscription<'a>,
306 #[serde(borrow)]
307 pub subject: Did<'a>,
308}
309
310impl<'a> LexiconSchema for ActivitySubscription<'a> {
311 fn nsid() -> &'static str {
312 "app.bsky.notification.defs"
313 }
314 fn def_name() -> &'static str {
315 "activitySubscription"
316 }
317 fn lexicon_doc() -> LexiconDoc<'static> {
318 lexicon_doc_app_bsky_notification_defs()
319 }
320 fn validate(&self) -> Result<(), ConstraintError> {
321 Ok(())
322 }
323}
324
325impl<'a> LexiconSchema for ChatPreference<'a> {
326 fn nsid() -> &'static str {
327 "app.bsky.notification.defs"
328 }
329 fn def_name() -> &'static str {
330 "chatPreference"
331 }
332 fn lexicon_doc() -> LexiconDoc<'static> {
333 lexicon_doc_app_bsky_notification_defs()
334 }
335 fn validate(&self) -> Result<(), ConstraintError> {
336 Ok(())
337 }
338}
339
340impl<'a> LexiconSchema for FilterablePreference<'a> {
341 fn nsid() -> &'static str {
342 "app.bsky.notification.defs"
343 }
344 fn def_name() -> &'static str {
345 "filterablePreference"
346 }
347 fn lexicon_doc() -> LexiconDoc<'static> {
348 lexicon_doc_app_bsky_notification_defs()
349 }
350 fn validate(&self) -> Result<(), ConstraintError> {
351 Ok(())
352 }
353}
354
355impl<'a> LexiconSchema for Preference<'a> {
356 fn nsid() -> &'static str {
357 "app.bsky.notification.defs"
358 }
359 fn def_name() -> &'static str {
360 "preference"
361 }
362 fn lexicon_doc() -> LexiconDoc<'static> {
363 lexicon_doc_app_bsky_notification_defs()
364 }
365 fn validate(&self) -> Result<(), ConstraintError> {
366 Ok(())
367 }
368}
369
370impl<'a> LexiconSchema for Preferences<'a> {
371 fn nsid() -> &'static str {
372 "app.bsky.notification.defs"
373 }
374 fn def_name() -> &'static str {
375 "preferences"
376 }
377 fn lexicon_doc() -> LexiconDoc<'static> {
378 lexicon_doc_app_bsky_notification_defs()
379 }
380 fn validate(&self) -> Result<(), ConstraintError> {
381 Ok(())
382 }
383}
384
385impl<'a> LexiconSchema for RecordDeleted<'a> {
386 fn nsid() -> &'static str {
387 "app.bsky.notification.defs"
388 }
389 fn def_name() -> &'static str {
390 "recordDeleted"
391 }
392 fn lexicon_doc() -> LexiconDoc<'static> {
393 lexicon_doc_app_bsky_notification_defs()
394 }
395 fn validate(&self) -> Result<(), ConstraintError> {
396 Ok(())
397 }
398}
399
400impl<'a> LexiconSchema for SubjectActivitySubscription<'a> {
401 fn nsid() -> &'static str {
402 "app.bsky.notification.defs"
403 }
404 fn def_name() -> &'static str {
405 "subjectActivitySubscription"
406 }
407 fn lexicon_doc() -> LexiconDoc<'static> {
408 lexicon_doc_app_bsky_notification_defs()
409 }
410 fn validate(&self) -> Result<(), ConstraintError> {
411 Ok(())
412 }
413}
414
415pub mod activity_subscription_state {
416
417 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
418 #[allow(unused)]
419 use ::core::marker::PhantomData;
420 mod sealed {
421 pub trait Sealed {}
422 }
423 pub trait State: sealed::Sealed {
425 type Post;
426 type Reply;
427 }
428 pub struct Empty(());
430 impl sealed::Sealed for Empty {}
431 impl State for Empty {
432 type Post = Unset;
433 type Reply = Unset;
434 }
435 pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>);
437 impl<S: State> sealed::Sealed for SetPost<S> {}
438 impl<S: State> State for SetPost<S> {
439 type Post = Set<members::post>;
440 type Reply = S::Reply;
441 }
442 pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>);
444 impl<S: State> sealed::Sealed for SetReply<S> {}
445 impl<S: State> State for SetReply<S> {
446 type Post = S::Post;
447 type Reply = Set<members::reply>;
448 }
449 #[allow(non_camel_case_types)]
451 pub mod members {
452 pub struct post(());
454 pub struct reply(());
456 }
457}
458
459pub struct ActivitySubscriptionBuilder<'a, S: activity_subscription_state::State> {
461 _state: PhantomData<fn() -> S>,
462 _fields: (Option<bool>, Option<bool>),
463 _lifetime: PhantomData<&'a ()>,
464}
465
466impl<'a> ActivitySubscription<'a> {
467 pub fn new() -> ActivitySubscriptionBuilder<'a, activity_subscription_state::Empty> {
469 ActivitySubscriptionBuilder::new()
470 }
471}
472
473impl<'a> ActivitySubscriptionBuilder<'a, activity_subscription_state::Empty> {
474 pub fn new() -> Self {
476 ActivitySubscriptionBuilder {
477 _state: PhantomData,
478 _fields: (None, None),
479 _lifetime: PhantomData,
480 }
481 }
482}
483
484impl<'a, S> ActivitySubscriptionBuilder<'a, S>
485where
486 S: activity_subscription_state::State,
487 S::Post: activity_subscription_state::IsUnset,
488{
489 pub fn post(
491 mut self,
492 value: impl Into<bool>,
493 ) -> ActivitySubscriptionBuilder<'a, activity_subscription_state::SetPost<S>> {
494 self._fields.0 = Option::Some(value.into());
495 ActivitySubscriptionBuilder {
496 _state: PhantomData,
497 _fields: self._fields,
498 _lifetime: PhantomData,
499 }
500 }
501}
502
503impl<'a, S> ActivitySubscriptionBuilder<'a, S>
504where
505 S: activity_subscription_state::State,
506 S::Reply: activity_subscription_state::IsUnset,
507{
508 pub fn reply(
510 mut self,
511 value: impl Into<bool>,
512 ) -> ActivitySubscriptionBuilder<'a, activity_subscription_state::SetReply<S>> {
513 self._fields.1 = Option::Some(value.into());
514 ActivitySubscriptionBuilder {
515 _state: PhantomData,
516 _fields: self._fields,
517 _lifetime: PhantomData,
518 }
519 }
520}
521
522impl<'a, S> ActivitySubscriptionBuilder<'a, S>
523where
524 S: activity_subscription_state::State,
525 S::Post: activity_subscription_state::IsSet,
526 S::Reply: activity_subscription_state::IsSet,
527{
528 pub fn build(self) -> ActivitySubscription<'a> {
530 ActivitySubscription {
531 post: self._fields.0.unwrap(),
532 reply: self._fields.1.unwrap(),
533 extra_data: Default::default(),
534 }
535 }
536 pub fn build_with_data(
538 self,
539 extra_data: BTreeMap<
540 jacquard_common::deps::smol_str::SmolStr,
541 jacquard_common::types::value::Data<'a>,
542 >,
543 ) -> ActivitySubscription<'a> {
544 ActivitySubscription {
545 post: self._fields.0.unwrap(),
546 reply: self._fields.1.unwrap(),
547 extra_data: Some(extra_data),
548 }
549 }
550}
551
552fn lexicon_doc_app_bsky_notification_defs() -> LexiconDoc<'static> {
553 #[allow(unused_imports)]
554 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
555 use jacquard_lexicon::lexicon::*;
556 use alloc::collections::BTreeMap;
557 LexiconDoc {
558 lexicon: Lexicon::Lexicon1,
559 id: CowStr::new_static("app.bsky.notification.defs"),
560 defs: {
561 let mut map = BTreeMap::new();
562 map.insert(
563 SmolStr::new_static("activitySubscription"),
564 LexUserType::Object(LexObject {
565 required: Some(
566 vec![SmolStr::new_static("post"), SmolStr::new_static("reply")],
567 ),
568 properties: {
569 #[allow(unused_mut)]
570 let mut map = BTreeMap::new();
571 map.insert(
572 SmolStr::new_static("post"),
573 LexObjectProperty::Boolean(LexBoolean {
574 ..Default::default()
575 }),
576 );
577 map.insert(
578 SmolStr::new_static("reply"),
579 LexObjectProperty::Boolean(LexBoolean {
580 ..Default::default()
581 }),
582 );
583 map
584 },
585 ..Default::default()
586 }),
587 );
588 map.insert(
589 SmolStr::new_static("chatPreference"),
590 LexUserType::Object(LexObject {
591 required: Some(
592 vec![SmolStr::new_static("include"), SmolStr::new_static("push")],
593 ),
594 properties: {
595 #[allow(unused_mut)]
596 let mut map = BTreeMap::new();
597 map.insert(
598 SmolStr::new_static("include"),
599 LexObjectProperty::String(LexString { ..Default::default() }),
600 );
601 map.insert(
602 SmolStr::new_static("push"),
603 LexObjectProperty::Boolean(LexBoolean {
604 ..Default::default()
605 }),
606 );
607 map
608 },
609 ..Default::default()
610 }),
611 );
612 map.insert(
613 SmolStr::new_static("filterablePreference"),
614 LexUserType::Object(LexObject {
615 required: Some(
616 vec![
617 SmolStr::new_static("include"), SmolStr::new_static("list"),
618 SmolStr::new_static("push")
619 ],
620 ),
621 properties: {
622 #[allow(unused_mut)]
623 let mut map = BTreeMap::new();
624 map.insert(
625 SmolStr::new_static("include"),
626 LexObjectProperty::String(LexString { ..Default::default() }),
627 );
628 map.insert(
629 SmolStr::new_static("list"),
630 LexObjectProperty::Boolean(LexBoolean {
631 ..Default::default()
632 }),
633 );
634 map.insert(
635 SmolStr::new_static("push"),
636 LexObjectProperty::Boolean(LexBoolean {
637 ..Default::default()
638 }),
639 );
640 map
641 },
642 ..Default::default()
643 }),
644 );
645 map.insert(
646 SmolStr::new_static("preference"),
647 LexUserType::Object(LexObject {
648 required: Some(
649 vec![SmolStr::new_static("list"), SmolStr::new_static("push")],
650 ),
651 properties: {
652 #[allow(unused_mut)]
653 let mut map = BTreeMap::new();
654 map.insert(
655 SmolStr::new_static("list"),
656 LexObjectProperty::Boolean(LexBoolean {
657 ..Default::default()
658 }),
659 );
660 map.insert(
661 SmolStr::new_static("push"),
662 LexObjectProperty::Boolean(LexBoolean {
663 ..Default::default()
664 }),
665 );
666 map
667 },
668 ..Default::default()
669 }),
670 );
671 map.insert(
672 SmolStr::new_static("preferences"),
673 LexUserType::Object(LexObject {
674 required: Some(
675 vec![
676 SmolStr::new_static("chat"), SmolStr::new_static("follow"),
677 SmolStr::new_static("like"),
678 SmolStr::new_static("likeViaRepost"),
679 SmolStr::new_static("mention"), SmolStr::new_static("quote"),
680 SmolStr::new_static("reply"), SmolStr::new_static("repost"),
681 SmolStr::new_static("repostViaRepost"),
682 SmolStr::new_static("starterpackJoined"),
683 SmolStr::new_static("subscribedPost"),
684 SmolStr::new_static("unverified"),
685 SmolStr::new_static("verified")
686 ],
687 ),
688 properties: {
689 #[allow(unused_mut)]
690 let mut map = BTreeMap::new();
691 map.insert(
692 SmolStr::new_static("chat"),
693 LexObjectProperty::Ref(LexRef {
694 r#ref: CowStr::new_static("#chatPreference"),
695 ..Default::default()
696 }),
697 );
698 map.insert(
699 SmolStr::new_static("follow"),
700 LexObjectProperty::Ref(LexRef {
701 r#ref: CowStr::new_static("#filterablePreference"),
702 ..Default::default()
703 }),
704 );
705 map.insert(
706 SmolStr::new_static("like"),
707 LexObjectProperty::Ref(LexRef {
708 r#ref: CowStr::new_static("#filterablePreference"),
709 ..Default::default()
710 }),
711 );
712 map.insert(
713 SmolStr::new_static("likeViaRepost"),
714 LexObjectProperty::Ref(LexRef {
715 r#ref: CowStr::new_static("#filterablePreference"),
716 ..Default::default()
717 }),
718 );
719 map.insert(
720 SmolStr::new_static("mention"),
721 LexObjectProperty::Ref(LexRef {
722 r#ref: CowStr::new_static("#filterablePreference"),
723 ..Default::default()
724 }),
725 );
726 map.insert(
727 SmolStr::new_static("quote"),
728 LexObjectProperty::Ref(LexRef {
729 r#ref: CowStr::new_static("#filterablePreference"),
730 ..Default::default()
731 }),
732 );
733 map.insert(
734 SmolStr::new_static("reply"),
735 LexObjectProperty::Ref(LexRef {
736 r#ref: CowStr::new_static("#filterablePreference"),
737 ..Default::default()
738 }),
739 );
740 map.insert(
741 SmolStr::new_static("repost"),
742 LexObjectProperty::Ref(LexRef {
743 r#ref: CowStr::new_static("#filterablePreference"),
744 ..Default::default()
745 }),
746 );
747 map.insert(
748 SmolStr::new_static("repostViaRepost"),
749 LexObjectProperty::Ref(LexRef {
750 r#ref: CowStr::new_static("#filterablePreference"),
751 ..Default::default()
752 }),
753 );
754 map.insert(
755 SmolStr::new_static("starterpackJoined"),
756 LexObjectProperty::Ref(LexRef {
757 r#ref: CowStr::new_static("#preference"),
758 ..Default::default()
759 }),
760 );
761 map.insert(
762 SmolStr::new_static("subscribedPost"),
763 LexObjectProperty::Ref(LexRef {
764 r#ref: CowStr::new_static("#preference"),
765 ..Default::default()
766 }),
767 );
768 map.insert(
769 SmolStr::new_static("unverified"),
770 LexObjectProperty::Ref(LexRef {
771 r#ref: CowStr::new_static("#preference"),
772 ..Default::default()
773 }),
774 );
775 map.insert(
776 SmolStr::new_static("verified"),
777 LexObjectProperty::Ref(LexRef {
778 r#ref: CowStr::new_static("#preference"),
779 ..Default::default()
780 }),
781 );
782 map
783 },
784 ..Default::default()
785 }),
786 );
787 map.insert(
788 SmolStr::new_static("recordDeleted"),
789 LexUserType::Object(LexObject {
790 properties: {
791 #[allow(unused_mut)]
792 let mut map = BTreeMap::new();
793 map
794 },
795 ..Default::default()
796 }),
797 );
798 map.insert(
799 SmolStr::new_static("subjectActivitySubscription"),
800 LexUserType::Object(LexObject {
801 description: Some(
802 CowStr::new_static(
803 "Object used to store activity subscription data in stash.",
804 ),
805 ),
806 required: Some(
807 vec![
808 SmolStr::new_static("subject"),
809 SmolStr::new_static("activitySubscription")
810 ],
811 ),
812 properties: {
813 #[allow(unused_mut)]
814 let mut map = BTreeMap::new();
815 map.insert(
816 SmolStr::new_static("activitySubscription"),
817 LexObjectProperty::Ref(LexRef {
818 r#ref: CowStr::new_static("#activitySubscription"),
819 ..Default::default()
820 }),
821 );
822 map.insert(
823 SmolStr::new_static("subject"),
824 LexObjectProperty::String(LexString {
825 format: Some(LexStringFormat::Did),
826 ..Default::default()
827 }),
828 );
829 map
830 },
831 ..Default::default()
832 }),
833 );
834 map
835 },
836 ..Default::default()
837 }
838}
839
840pub mod chat_preference_state {
841
842 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
843 #[allow(unused)]
844 use ::core::marker::PhantomData;
845 mod sealed {
846 pub trait Sealed {}
847 }
848 pub trait State: sealed::Sealed {
850 type Push;
851 type Include;
852 }
853 pub struct Empty(());
855 impl sealed::Sealed for Empty {}
856 impl State for Empty {
857 type Push = Unset;
858 type Include = Unset;
859 }
860 pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
862 impl<S: State> sealed::Sealed for SetPush<S> {}
863 impl<S: State> State for SetPush<S> {
864 type Push = Set<members::push>;
865 type Include = S::Include;
866 }
867 pub struct SetInclude<S: State = Empty>(PhantomData<fn() -> S>);
869 impl<S: State> sealed::Sealed for SetInclude<S> {}
870 impl<S: State> State for SetInclude<S> {
871 type Push = S::Push;
872 type Include = Set<members::include>;
873 }
874 #[allow(non_camel_case_types)]
876 pub mod members {
877 pub struct push(());
879 pub struct include(());
881 }
882}
883
884pub struct ChatPreferenceBuilder<'a, S: chat_preference_state::State> {
886 _state: PhantomData<fn() -> S>,
887 _fields: (Option<ChatPreferenceInclude<'a>>, Option<bool>),
888 _lifetime: PhantomData<&'a ()>,
889}
890
891impl<'a> ChatPreference<'a> {
892 pub fn new() -> ChatPreferenceBuilder<'a, chat_preference_state::Empty> {
894 ChatPreferenceBuilder::new()
895 }
896}
897
898impl<'a> ChatPreferenceBuilder<'a, chat_preference_state::Empty> {
899 pub fn new() -> Self {
901 ChatPreferenceBuilder {
902 _state: PhantomData,
903 _fields: (None, None),
904 _lifetime: PhantomData,
905 }
906 }
907}
908
909impl<'a, S> ChatPreferenceBuilder<'a, S>
910where
911 S: chat_preference_state::State,
912 S::Include: chat_preference_state::IsUnset,
913{
914 pub fn include(
916 mut self,
917 value: impl Into<ChatPreferenceInclude<'a>>,
918 ) -> ChatPreferenceBuilder<'a, chat_preference_state::SetInclude<S>> {
919 self._fields.0 = Option::Some(value.into());
920 ChatPreferenceBuilder {
921 _state: PhantomData,
922 _fields: self._fields,
923 _lifetime: PhantomData,
924 }
925 }
926}
927
928impl<'a, S> ChatPreferenceBuilder<'a, S>
929where
930 S: chat_preference_state::State,
931 S::Push: chat_preference_state::IsUnset,
932{
933 pub fn push(
935 mut self,
936 value: impl Into<bool>,
937 ) -> ChatPreferenceBuilder<'a, chat_preference_state::SetPush<S>> {
938 self._fields.1 = Option::Some(value.into());
939 ChatPreferenceBuilder {
940 _state: PhantomData,
941 _fields: self._fields,
942 _lifetime: PhantomData,
943 }
944 }
945}
946
947impl<'a, S> ChatPreferenceBuilder<'a, S>
948where
949 S: chat_preference_state::State,
950 S::Push: chat_preference_state::IsSet,
951 S::Include: chat_preference_state::IsSet,
952{
953 pub fn build(self) -> ChatPreference<'a> {
955 ChatPreference {
956 include: self._fields.0.unwrap(),
957 push: self._fields.1.unwrap(),
958 extra_data: Default::default(),
959 }
960 }
961 pub fn build_with_data(
963 self,
964 extra_data: BTreeMap<
965 jacquard_common::deps::smol_str::SmolStr,
966 jacquard_common::types::value::Data<'a>,
967 >,
968 ) -> ChatPreference<'a> {
969 ChatPreference {
970 include: self._fields.0.unwrap(),
971 push: self._fields.1.unwrap(),
972 extra_data: Some(extra_data),
973 }
974 }
975}
976
977pub mod filterable_preference_state {
978
979 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
980 #[allow(unused)]
981 use ::core::marker::PhantomData;
982 mod sealed {
983 pub trait Sealed {}
984 }
985 pub trait State: sealed::Sealed {
987 type List;
988 type Push;
989 type Include;
990 }
991 pub struct Empty(());
993 impl sealed::Sealed for Empty {}
994 impl State for Empty {
995 type List = Unset;
996 type Push = Unset;
997 type Include = Unset;
998 }
999 pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
1001 impl<S: State> sealed::Sealed for SetList<S> {}
1002 impl<S: State> State for SetList<S> {
1003 type List = Set<members::list>;
1004 type Push = S::Push;
1005 type Include = S::Include;
1006 }
1007 pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
1009 impl<S: State> sealed::Sealed for SetPush<S> {}
1010 impl<S: State> State for SetPush<S> {
1011 type List = S::List;
1012 type Push = Set<members::push>;
1013 type Include = S::Include;
1014 }
1015 pub struct SetInclude<S: State = Empty>(PhantomData<fn() -> S>);
1017 impl<S: State> sealed::Sealed for SetInclude<S> {}
1018 impl<S: State> State for SetInclude<S> {
1019 type List = S::List;
1020 type Push = S::Push;
1021 type Include = Set<members::include>;
1022 }
1023 #[allow(non_camel_case_types)]
1025 pub mod members {
1026 pub struct list(());
1028 pub struct push(());
1030 pub struct include(());
1032 }
1033}
1034
1035pub struct FilterablePreferenceBuilder<'a, S: filterable_preference_state::State> {
1037 _state: PhantomData<fn() -> S>,
1038 _fields: (Option<FilterablePreferenceInclude<'a>>, Option<bool>, Option<bool>),
1039 _lifetime: PhantomData<&'a ()>,
1040}
1041
1042impl<'a> FilterablePreference<'a> {
1043 pub fn new() -> FilterablePreferenceBuilder<'a, filterable_preference_state::Empty> {
1045 FilterablePreferenceBuilder::new()
1046 }
1047}
1048
1049impl<'a> FilterablePreferenceBuilder<'a, filterable_preference_state::Empty> {
1050 pub fn new() -> Self {
1052 FilterablePreferenceBuilder {
1053 _state: PhantomData,
1054 _fields: (None, None, None),
1055 _lifetime: PhantomData,
1056 }
1057 }
1058}
1059
1060impl<'a, S> FilterablePreferenceBuilder<'a, S>
1061where
1062 S: filterable_preference_state::State,
1063 S::Include: filterable_preference_state::IsUnset,
1064{
1065 pub fn include(
1067 mut self,
1068 value: impl Into<FilterablePreferenceInclude<'a>>,
1069 ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetInclude<S>> {
1070 self._fields.0 = Option::Some(value.into());
1071 FilterablePreferenceBuilder {
1072 _state: PhantomData,
1073 _fields: self._fields,
1074 _lifetime: PhantomData,
1075 }
1076 }
1077}
1078
1079impl<'a, S> FilterablePreferenceBuilder<'a, S>
1080where
1081 S: filterable_preference_state::State,
1082 S::List: filterable_preference_state::IsUnset,
1083{
1084 pub fn list(
1086 mut self,
1087 value: impl Into<bool>,
1088 ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetList<S>> {
1089 self._fields.1 = Option::Some(value.into());
1090 FilterablePreferenceBuilder {
1091 _state: PhantomData,
1092 _fields: self._fields,
1093 _lifetime: PhantomData,
1094 }
1095 }
1096}
1097
1098impl<'a, S> FilterablePreferenceBuilder<'a, S>
1099where
1100 S: filterable_preference_state::State,
1101 S::Push: filterable_preference_state::IsUnset,
1102{
1103 pub fn push(
1105 mut self,
1106 value: impl Into<bool>,
1107 ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetPush<S>> {
1108 self._fields.2 = Option::Some(value.into());
1109 FilterablePreferenceBuilder {
1110 _state: PhantomData,
1111 _fields: self._fields,
1112 _lifetime: PhantomData,
1113 }
1114 }
1115}
1116
1117impl<'a, S> FilterablePreferenceBuilder<'a, S>
1118where
1119 S: filterable_preference_state::State,
1120 S::List: filterable_preference_state::IsSet,
1121 S::Push: filterable_preference_state::IsSet,
1122 S::Include: filterable_preference_state::IsSet,
1123{
1124 pub fn build(self) -> FilterablePreference<'a> {
1126 FilterablePreference {
1127 include: self._fields.0.unwrap(),
1128 list: self._fields.1.unwrap(),
1129 push: self._fields.2.unwrap(),
1130 extra_data: Default::default(),
1131 }
1132 }
1133 pub fn build_with_data(
1135 self,
1136 extra_data: BTreeMap<
1137 jacquard_common::deps::smol_str::SmolStr,
1138 jacquard_common::types::value::Data<'a>,
1139 >,
1140 ) -> FilterablePreference<'a> {
1141 FilterablePreference {
1142 include: self._fields.0.unwrap(),
1143 list: self._fields.1.unwrap(),
1144 push: self._fields.2.unwrap(),
1145 extra_data: Some(extra_data),
1146 }
1147 }
1148}
1149
1150pub mod preference_state {
1151
1152 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1153 #[allow(unused)]
1154 use ::core::marker::PhantomData;
1155 mod sealed {
1156 pub trait Sealed {}
1157 }
1158 pub trait State: sealed::Sealed {
1160 type List;
1161 type Push;
1162 }
1163 pub struct Empty(());
1165 impl sealed::Sealed for Empty {}
1166 impl State for Empty {
1167 type List = Unset;
1168 type Push = Unset;
1169 }
1170 pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
1172 impl<S: State> sealed::Sealed for SetList<S> {}
1173 impl<S: State> State for SetList<S> {
1174 type List = Set<members::list>;
1175 type Push = S::Push;
1176 }
1177 pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
1179 impl<S: State> sealed::Sealed for SetPush<S> {}
1180 impl<S: State> State for SetPush<S> {
1181 type List = S::List;
1182 type Push = Set<members::push>;
1183 }
1184 #[allow(non_camel_case_types)]
1186 pub mod members {
1187 pub struct list(());
1189 pub struct push(());
1191 }
1192}
1193
1194pub struct PreferenceBuilder<'a, S: preference_state::State> {
1196 _state: PhantomData<fn() -> S>,
1197 _fields: (Option<bool>, Option<bool>),
1198 _lifetime: PhantomData<&'a ()>,
1199}
1200
1201impl<'a> Preference<'a> {
1202 pub fn new() -> PreferenceBuilder<'a, preference_state::Empty> {
1204 PreferenceBuilder::new()
1205 }
1206}
1207
1208impl<'a> PreferenceBuilder<'a, preference_state::Empty> {
1209 pub fn new() -> Self {
1211 PreferenceBuilder {
1212 _state: PhantomData,
1213 _fields: (None, None),
1214 _lifetime: PhantomData,
1215 }
1216 }
1217}
1218
1219impl<'a, S> PreferenceBuilder<'a, S>
1220where
1221 S: preference_state::State,
1222 S::List: preference_state::IsUnset,
1223{
1224 pub fn list(
1226 mut self,
1227 value: impl Into<bool>,
1228 ) -> PreferenceBuilder<'a, preference_state::SetList<S>> {
1229 self._fields.0 = Option::Some(value.into());
1230 PreferenceBuilder {
1231 _state: PhantomData,
1232 _fields: self._fields,
1233 _lifetime: PhantomData,
1234 }
1235 }
1236}
1237
1238impl<'a, S> PreferenceBuilder<'a, S>
1239where
1240 S: preference_state::State,
1241 S::Push: preference_state::IsUnset,
1242{
1243 pub fn push(
1245 mut self,
1246 value: impl Into<bool>,
1247 ) -> PreferenceBuilder<'a, preference_state::SetPush<S>> {
1248 self._fields.1 = Option::Some(value.into());
1249 PreferenceBuilder {
1250 _state: PhantomData,
1251 _fields: self._fields,
1252 _lifetime: PhantomData,
1253 }
1254 }
1255}
1256
1257impl<'a, S> PreferenceBuilder<'a, S>
1258where
1259 S: preference_state::State,
1260 S::List: preference_state::IsSet,
1261 S::Push: preference_state::IsSet,
1262{
1263 pub fn build(self) -> Preference<'a> {
1265 Preference {
1266 list: self._fields.0.unwrap(),
1267 push: self._fields.1.unwrap(),
1268 extra_data: Default::default(),
1269 }
1270 }
1271 pub fn build_with_data(
1273 self,
1274 extra_data: BTreeMap<
1275 jacquard_common::deps::smol_str::SmolStr,
1276 jacquard_common::types::value::Data<'a>,
1277 >,
1278 ) -> Preference<'a> {
1279 Preference {
1280 list: self._fields.0.unwrap(),
1281 push: self._fields.1.unwrap(),
1282 extra_data: Some(extra_data),
1283 }
1284 }
1285}
1286
1287pub mod preferences_state {
1288
1289 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1290 #[allow(unused)]
1291 use ::core::marker::PhantomData;
1292 mod sealed {
1293 pub trait Sealed {}
1294 }
1295 pub trait State: sealed::Sealed {
1297 type Chat;
1298 type Repost;
1299 type Reply;
1300 type SubscribedPost;
1301 type Like;
1302 type LikeViaRepost;
1303 type Mention;
1304 type StarterpackJoined;
1305 type RepostViaRepost;
1306 type Quote;
1307 type Unverified;
1308 type Follow;
1309 type Verified;
1310 }
1311 pub struct Empty(());
1313 impl sealed::Sealed for Empty {}
1314 impl State for Empty {
1315 type Chat = Unset;
1316 type Repost = Unset;
1317 type Reply = Unset;
1318 type SubscribedPost = Unset;
1319 type Like = Unset;
1320 type LikeViaRepost = Unset;
1321 type Mention = Unset;
1322 type StarterpackJoined = Unset;
1323 type RepostViaRepost = Unset;
1324 type Quote = Unset;
1325 type Unverified = Unset;
1326 type Follow = Unset;
1327 type Verified = Unset;
1328 }
1329 pub struct SetChat<S: State = Empty>(PhantomData<fn() -> S>);
1331 impl<S: State> sealed::Sealed for SetChat<S> {}
1332 impl<S: State> State for SetChat<S> {
1333 type Chat = Set<members::chat>;
1334 type Repost = S::Repost;
1335 type Reply = S::Reply;
1336 type SubscribedPost = S::SubscribedPost;
1337 type Like = S::Like;
1338 type LikeViaRepost = S::LikeViaRepost;
1339 type Mention = S::Mention;
1340 type StarterpackJoined = S::StarterpackJoined;
1341 type RepostViaRepost = S::RepostViaRepost;
1342 type Quote = S::Quote;
1343 type Unverified = S::Unverified;
1344 type Follow = S::Follow;
1345 type Verified = S::Verified;
1346 }
1347 pub struct SetRepost<S: State = Empty>(PhantomData<fn() -> S>);
1349 impl<S: State> sealed::Sealed for SetRepost<S> {}
1350 impl<S: State> State for SetRepost<S> {
1351 type Chat = S::Chat;
1352 type Repost = Set<members::repost>;
1353 type Reply = S::Reply;
1354 type SubscribedPost = S::SubscribedPost;
1355 type Like = S::Like;
1356 type LikeViaRepost = S::LikeViaRepost;
1357 type Mention = S::Mention;
1358 type StarterpackJoined = S::StarterpackJoined;
1359 type RepostViaRepost = S::RepostViaRepost;
1360 type Quote = S::Quote;
1361 type Unverified = S::Unverified;
1362 type Follow = S::Follow;
1363 type Verified = S::Verified;
1364 }
1365 pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>);
1367 impl<S: State> sealed::Sealed for SetReply<S> {}
1368 impl<S: State> State for SetReply<S> {
1369 type Chat = S::Chat;
1370 type Repost = S::Repost;
1371 type Reply = Set<members::reply>;
1372 type SubscribedPost = S::SubscribedPost;
1373 type Like = S::Like;
1374 type LikeViaRepost = S::LikeViaRepost;
1375 type Mention = S::Mention;
1376 type StarterpackJoined = S::StarterpackJoined;
1377 type RepostViaRepost = S::RepostViaRepost;
1378 type Quote = S::Quote;
1379 type Unverified = S::Unverified;
1380 type Follow = S::Follow;
1381 type Verified = S::Verified;
1382 }
1383 pub struct SetSubscribedPost<S: State = Empty>(PhantomData<fn() -> S>);
1385 impl<S: State> sealed::Sealed for SetSubscribedPost<S> {}
1386 impl<S: State> State for SetSubscribedPost<S> {
1387 type Chat = S::Chat;
1388 type Repost = S::Repost;
1389 type Reply = S::Reply;
1390 type SubscribedPost = Set<members::subscribed_post>;
1391 type Like = S::Like;
1392 type LikeViaRepost = S::LikeViaRepost;
1393 type Mention = S::Mention;
1394 type StarterpackJoined = S::StarterpackJoined;
1395 type RepostViaRepost = S::RepostViaRepost;
1396 type Quote = S::Quote;
1397 type Unverified = S::Unverified;
1398 type Follow = S::Follow;
1399 type Verified = S::Verified;
1400 }
1401 pub struct SetLike<S: State = Empty>(PhantomData<fn() -> S>);
1403 impl<S: State> sealed::Sealed for SetLike<S> {}
1404 impl<S: State> State for SetLike<S> {
1405 type Chat = S::Chat;
1406 type Repost = S::Repost;
1407 type Reply = S::Reply;
1408 type SubscribedPost = S::SubscribedPost;
1409 type Like = Set<members::like>;
1410 type LikeViaRepost = S::LikeViaRepost;
1411 type Mention = S::Mention;
1412 type StarterpackJoined = S::StarterpackJoined;
1413 type RepostViaRepost = S::RepostViaRepost;
1414 type Quote = S::Quote;
1415 type Unverified = S::Unverified;
1416 type Follow = S::Follow;
1417 type Verified = S::Verified;
1418 }
1419 pub struct SetLikeViaRepost<S: State = Empty>(PhantomData<fn() -> S>);
1421 impl<S: State> sealed::Sealed for SetLikeViaRepost<S> {}
1422 impl<S: State> State for SetLikeViaRepost<S> {
1423 type Chat = S::Chat;
1424 type Repost = S::Repost;
1425 type Reply = S::Reply;
1426 type SubscribedPost = S::SubscribedPost;
1427 type Like = S::Like;
1428 type LikeViaRepost = Set<members::like_via_repost>;
1429 type Mention = S::Mention;
1430 type StarterpackJoined = S::StarterpackJoined;
1431 type RepostViaRepost = S::RepostViaRepost;
1432 type Quote = S::Quote;
1433 type Unverified = S::Unverified;
1434 type Follow = S::Follow;
1435 type Verified = S::Verified;
1436 }
1437 pub struct SetMention<S: State = Empty>(PhantomData<fn() -> S>);
1439 impl<S: State> sealed::Sealed for SetMention<S> {}
1440 impl<S: State> State for SetMention<S> {
1441 type Chat = S::Chat;
1442 type Repost = S::Repost;
1443 type Reply = S::Reply;
1444 type SubscribedPost = S::SubscribedPost;
1445 type Like = S::Like;
1446 type LikeViaRepost = S::LikeViaRepost;
1447 type Mention = Set<members::mention>;
1448 type StarterpackJoined = S::StarterpackJoined;
1449 type RepostViaRepost = S::RepostViaRepost;
1450 type Quote = S::Quote;
1451 type Unverified = S::Unverified;
1452 type Follow = S::Follow;
1453 type Verified = S::Verified;
1454 }
1455 pub struct SetStarterpackJoined<S: State = Empty>(PhantomData<fn() -> S>);
1457 impl<S: State> sealed::Sealed for SetStarterpackJoined<S> {}
1458 impl<S: State> State for SetStarterpackJoined<S> {
1459 type Chat = S::Chat;
1460 type Repost = S::Repost;
1461 type Reply = S::Reply;
1462 type SubscribedPost = S::SubscribedPost;
1463 type Like = S::Like;
1464 type LikeViaRepost = S::LikeViaRepost;
1465 type Mention = S::Mention;
1466 type StarterpackJoined = Set<members::starterpack_joined>;
1467 type RepostViaRepost = S::RepostViaRepost;
1468 type Quote = S::Quote;
1469 type Unverified = S::Unverified;
1470 type Follow = S::Follow;
1471 type Verified = S::Verified;
1472 }
1473 pub struct SetRepostViaRepost<S: State = Empty>(PhantomData<fn() -> S>);
1475 impl<S: State> sealed::Sealed for SetRepostViaRepost<S> {}
1476 impl<S: State> State for SetRepostViaRepost<S> {
1477 type Chat = S::Chat;
1478 type Repost = S::Repost;
1479 type Reply = S::Reply;
1480 type SubscribedPost = S::SubscribedPost;
1481 type Like = S::Like;
1482 type LikeViaRepost = S::LikeViaRepost;
1483 type Mention = S::Mention;
1484 type StarterpackJoined = S::StarterpackJoined;
1485 type RepostViaRepost = Set<members::repost_via_repost>;
1486 type Quote = S::Quote;
1487 type Unverified = S::Unverified;
1488 type Follow = S::Follow;
1489 type Verified = S::Verified;
1490 }
1491 pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>);
1493 impl<S: State> sealed::Sealed for SetQuote<S> {}
1494 impl<S: State> State for SetQuote<S> {
1495 type Chat = S::Chat;
1496 type Repost = S::Repost;
1497 type Reply = S::Reply;
1498 type SubscribedPost = S::SubscribedPost;
1499 type Like = S::Like;
1500 type LikeViaRepost = S::LikeViaRepost;
1501 type Mention = S::Mention;
1502 type StarterpackJoined = S::StarterpackJoined;
1503 type RepostViaRepost = S::RepostViaRepost;
1504 type Quote = Set<members::quote>;
1505 type Unverified = S::Unverified;
1506 type Follow = S::Follow;
1507 type Verified = S::Verified;
1508 }
1509 pub struct SetUnverified<S: State = Empty>(PhantomData<fn() -> S>);
1511 impl<S: State> sealed::Sealed for SetUnverified<S> {}
1512 impl<S: State> State for SetUnverified<S> {
1513 type Chat = S::Chat;
1514 type Repost = S::Repost;
1515 type Reply = S::Reply;
1516 type SubscribedPost = S::SubscribedPost;
1517 type Like = S::Like;
1518 type LikeViaRepost = S::LikeViaRepost;
1519 type Mention = S::Mention;
1520 type StarterpackJoined = S::StarterpackJoined;
1521 type RepostViaRepost = S::RepostViaRepost;
1522 type Quote = S::Quote;
1523 type Unverified = Set<members::unverified>;
1524 type Follow = S::Follow;
1525 type Verified = S::Verified;
1526 }
1527 pub struct SetFollow<S: State = Empty>(PhantomData<fn() -> S>);
1529 impl<S: State> sealed::Sealed for SetFollow<S> {}
1530 impl<S: State> State for SetFollow<S> {
1531 type Chat = S::Chat;
1532 type Repost = S::Repost;
1533 type Reply = S::Reply;
1534 type SubscribedPost = S::SubscribedPost;
1535 type Like = S::Like;
1536 type LikeViaRepost = S::LikeViaRepost;
1537 type Mention = S::Mention;
1538 type StarterpackJoined = S::StarterpackJoined;
1539 type RepostViaRepost = S::RepostViaRepost;
1540 type Quote = S::Quote;
1541 type Unverified = S::Unverified;
1542 type Follow = Set<members::follow>;
1543 type Verified = S::Verified;
1544 }
1545 pub struct SetVerified<S: State = Empty>(PhantomData<fn() -> S>);
1547 impl<S: State> sealed::Sealed for SetVerified<S> {}
1548 impl<S: State> State for SetVerified<S> {
1549 type Chat = S::Chat;
1550 type Repost = S::Repost;
1551 type Reply = S::Reply;
1552 type SubscribedPost = S::SubscribedPost;
1553 type Like = S::Like;
1554 type LikeViaRepost = S::LikeViaRepost;
1555 type Mention = S::Mention;
1556 type StarterpackJoined = S::StarterpackJoined;
1557 type RepostViaRepost = S::RepostViaRepost;
1558 type Quote = S::Quote;
1559 type Unverified = S::Unverified;
1560 type Follow = S::Follow;
1561 type Verified = Set<members::verified>;
1562 }
1563 #[allow(non_camel_case_types)]
1565 pub mod members {
1566 pub struct chat(());
1568 pub struct repost(());
1570 pub struct reply(());
1572 pub struct subscribed_post(());
1574 pub struct like(());
1576 pub struct like_via_repost(());
1578 pub struct mention(());
1580 pub struct starterpack_joined(());
1582 pub struct repost_via_repost(());
1584 pub struct quote(());
1586 pub struct unverified(());
1588 pub struct follow(());
1590 pub struct verified(());
1592 }
1593}
1594
1595pub struct PreferencesBuilder<'a, S: preferences_state::State> {
1597 _state: PhantomData<fn() -> S>,
1598 _fields: (
1599 Option<notification::ChatPreference<'a>>,
1600 Option<notification::FilterablePreference<'a>>,
1601 Option<notification::FilterablePreference<'a>>,
1602 Option<notification::FilterablePreference<'a>>,
1603 Option<notification::FilterablePreference<'a>>,
1604 Option<notification::FilterablePreference<'a>>,
1605 Option<notification::FilterablePreference<'a>>,
1606 Option<notification::FilterablePreference<'a>>,
1607 Option<notification::FilterablePreference<'a>>,
1608 Option<notification::Preference<'a>>,
1609 Option<notification::Preference<'a>>,
1610 Option<notification::Preference<'a>>,
1611 Option<notification::Preference<'a>>,
1612 ),
1613 _lifetime: PhantomData<&'a ()>,
1614}
1615
1616impl<'a> Preferences<'a> {
1617 pub fn new() -> PreferencesBuilder<'a, preferences_state::Empty> {
1619 PreferencesBuilder::new()
1620 }
1621}
1622
1623impl<'a> PreferencesBuilder<'a, preferences_state::Empty> {
1624 pub fn new() -> Self {
1626 PreferencesBuilder {
1627 _state: PhantomData,
1628 _fields: (
1629 None,
1630 None,
1631 None,
1632 None,
1633 None,
1634 None,
1635 None,
1636 None,
1637 None,
1638 None,
1639 None,
1640 None,
1641 None,
1642 ),
1643 _lifetime: PhantomData,
1644 }
1645 }
1646}
1647
1648impl<'a, S> PreferencesBuilder<'a, S>
1649where
1650 S: preferences_state::State,
1651 S::Chat: preferences_state::IsUnset,
1652{
1653 pub fn chat(
1655 mut self,
1656 value: impl Into<notification::ChatPreference<'a>>,
1657 ) -> PreferencesBuilder<'a, preferences_state::SetChat<S>> {
1658 self._fields.0 = Option::Some(value.into());
1659 PreferencesBuilder {
1660 _state: PhantomData,
1661 _fields: self._fields,
1662 _lifetime: PhantomData,
1663 }
1664 }
1665}
1666
1667impl<'a, S> PreferencesBuilder<'a, S>
1668where
1669 S: preferences_state::State,
1670 S::Follow: preferences_state::IsUnset,
1671{
1672 pub fn follow(
1674 mut self,
1675 value: impl Into<notification::FilterablePreference<'a>>,
1676 ) -> PreferencesBuilder<'a, preferences_state::SetFollow<S>> {
1677 self._fields.1 = Option::Some(value.into());
1678 PreferencesBuilder {
1679 _state: PhantomData,
1680 _fields: self._fields,
1681 _lifetime: PhantomData,
1682 }
1683 }
1684}
1685
1686impl<'a, S> PreferencesBuilder<'a, S>
1687where
1688 S: preferences_state::State,
1689 S::Like: preferences_state::IsUnset,
1690{
1691 pub fn like(
1693 mut self,
1694 value: impl Into<notification::FilterablePreference<'a>>,
1695 ) -> PreferencesBuilder<'a, preferences_state::SetLike<S>> {
1696 self._fields.2 = Option::Some(value.into());
1697 PreferencesBuilder {
1698 _state: PhantomData,
1699 _fields: self._fields,
1700 _lifetime: PhantomData,
1701 }
1702 }
1703}
1704
1705impl<'a, S> PreferencesBuilder<'a, S>
1706where
1707 S: preferences_state::State,
1708 S::LikeViaRepost: preferences_state::IsUnset,
1709{
1710 pub fn like_via_repost(
1712 mut self,
1713 value: impl Into<notification::FilterablePreference<'a>>,
1714 ) -> PreferencesBuilder<'a, preferences_state::SetLikeViaRepost<S>> {
1715 self._fields.3 = Option::Some(value.into());
1716 PreferencesBuilder {
1717 _state: PhantomData,
1718 _fields: self._fields,
1719 _lifetime: PhantomData,
1720 }
1721 }
1722}
1723
1724impl<'a, S> PreferencesBuilder<'a, S>
1725where
1726 S: preferences_state::State,
1727 S::Mention: preferences_state::IsUnset,
1728{
1729 pub fn mention(
1731 mut self,
1732 value: impl Into<notification::FilterablePreference<'a>>,
1733 ) -> PreferencesBuilder<'a, preferences_state::SetMention<S>> {
1734 self._fields.4 = Option::Some(value.into());
1735 PreferencesBuilder {
1736 _state: PhantomData,
1737 _fields: self._fields,
1738 _lifetime: PhantomData,
1739 }
1740 }
1741}
1742
1743impl<'a, S> PreferencesBuilder<'a, S>
1744where
1745 S: preferences_state::State,
1746 S::Quote: preferences_state::IsUnset,
1747{
1748 pub fn quote(
1750 mut self,
1751 value: impl Into<notification::FilterablePreference<'a>>,
1752 ) -> PreferencesBuilder<'a, preferences_state::SetQuote<S>> {
1753 self._fields.5 = Option::Some(value.into());
1754 PreferencesBuilder {
1755 _state: PhantomData,
1756 _fields: self._fields,
1757 _lifetime: PhantomData,
1758 }
1759 }
1760}
1761
1762impl<'a, S> PreferencesBuilder<'a, S>
1763where
1764 S: preferences_state::State,
1765 S::Reply: preferences_state::IsUnset,
1766{
1767 pub fn reply(
1769 mut self,
1770 value: impl Into<notification::FilterablePreference<'a>>,
1771 ) -> PreferencesBuilder<'a, preferences_state::SetReply<S>> {
1772 self._fields.6 = Option::Some(value.into());
1773 PreferencesBuilder {
1774 _state: PhantomData,
1775 _fields: self._fields,
1776 _lifetime: PhantomData,
1777 }
1778 }
1779}
1780
1781impl<'a, S> PreferencesBuilder<'a, S>
1782where
1783 S: preferences_state::State,
1784 S::Repost: preferences_state::IsUnset,
1785{
1786 pub fn repost(
1788 mut self,
1789 value: impl Into<notification::FilterablePreference<'a>>,
1790 ) -> PreferencesBuilder<'a, preferences_state::SetRepost<S>> {
1791 self._fields.7 = Option::Some(value.into());
1792 PreferencesBuilder {
1793 _state: PhantomData,
1794 _fields: self._fields,
1795 _lifetime: PhantomData,
1796 }
1797 }
1798}
1799
1800impl<'a, S> PreferencesBuilder<'a, S>
1801where
1802 S: preferences_state::State,
1803 S::RepostViaRepost: preferences_state::IsUnset,
1804{
1805 pub fn repost_via_repost(
1807 mut self,
1808 value: impl Into<notification::FilterablePreference<'a>>,
1809 ) -> PreferencesBuilder<'a, preferences_state::SetRepostViaRepost<S>> {
1810 self._fields.8 = Option::Some(value.into());
1811 PreferencesBuilder {
1812 _state: PhantomData,
1813 _fields: self._fields,
1814 _lifetime: PhantomData,
1815 }
1816 }
1817}
1818
1819impl<'a, S> PreferencesBuilder<'a, S>
1820where
1821 S: preferences_state::State,
1822 S::StarterpackJoined: preferences_state::IsUnset,
1823{
1824 pub fn starterpack_joined(
1826 mut self,
1827 value: impl Into<notification::Preference<'a>>,
1828 ) -> PreferencesBuilder<'a, preferences_state::SetStarterpackJoined<S>> {
1829 self._fields.9 = Option::Some(value.into());
1830 PreferencesBuilder {
1831 _state: PhantomData,
1832 _fields: self._fields,
1833 _lifetime: PhantomData,
1834 }
1835 }
1836}
1837
1838impl<'a, S> PreferencesBuilder<'a, S>
1839where
1840 S: preferences_state::State,
1841 S::SubscribedPost: preferences_state::IsUnset,
1842{
1843 pub fn subscribed_post(
1845 mut self,
1846 value: impl Into<notification::Preference<'a>>,
1847 ) -> PreferencesBuilder<'a, preferences_state::SetSubscribedPost<S>> {
1848 self._fields.10 = Option::Some(value.into());
1849 PreferencesBuilder {
1850 _state: PhantomData,
1851 _fields: self._fields,
1852 _lifetime: PhantomData,
1853 }
1854 }
1855}
1856
1857impl<'a, S> PreferencesBuilder<'a, S>
1858where
1859 S: preferences_state::State,
1860 S::Unverified: preferences_state::IsUnset,
1861{
1862 pub fn unverified(
1864 mut self,
1865 value: impl Into<notification::Preference<'a>>,
1866 ) -> PreferencesBuilder<'a, preferences_state::SetUnverified<S>> {
1867 self._fields.11 = Option::Some(value.into());
1868 PreferencesBuilder {
1869 _state: PhantomData,
1870 _fields: self._fields,
1871 _lifetime: PhantomData,
1872 }
1873 }
1874}
1875
1876impl<'a, S> PreferencesBuilder<'a, S>
1877where
1878 S: preferences_state::State,
1879 S::Verified: preferences_state::IsUnset,
1880{
1881 pub fn verified(
1883 mut self,
1884 value: impl Into<notification::Preference<'a>>,
1885 ) -> PreferencesBuilder<'a, preferences_state::SetVerified<S>> {
1886 self._fields.12 = Option::Some(value.into());
1887 PreferencesBuilder {
1888 _state: PhantomData,
1889 _fields: self._fields,
1890 _lifetime: PhantomData,
1891 }
1892 }
1893}
1894
1895impl<'a, S> PreferencesBuilder<'a, S>
1896where
1897 S: preferences_state::State,
1898 S::Chat: preferences_state::IsSet,
1899 S::Repost: preferences_state::IsSet,
1900 S::Reply: preferences_state::IsSet,
1901 S::SubscribedPost: preferences_state::IsSet,
1902 S::Like: preferences_state::IsSet,
1903 S::LikeViaRepost: preferences_state::IsSet,
1904 S::Mention: preferences_state::IsSet,
1905 S::StarterpackJoined: preferences_state::IsSet,
1906 S::RepostViaRepost: preferences_state::IsSet,
1907 S::Quote: preferences_state::IsSet,
1908 S::Unverified: preferences_state::IsSet,
1909 S::Follow: preferences_state::IsSet,
1910 S::Verified: preferences_state::IsSet,
1911{
1912 pub fn build(self) -> Preferences<'a> {
1914 Preferences {
1915 chat: self._fields.0.unwrap(),
1916 follow: self._fields.1.unwrap(),
1917 like: self._fields.2.unwrap(),
1918 like_via_repost: self._fields.3.unwrap(),
1919 mention: self._fields.4.unwrap(),
1920 quote: self._fields.5.unwrap(),
1921 reply: self._fields.6.unwrap(),
1922 repost: self._fields.7.unwrap(),
1923 repost_via_repost: self._fields.8.unwrap(),
1924 starterpack_joined: self._fields.9.unwrap(),
1925 subscribed_post: self._fields.10.unwrap(),
1926 unverified: self._fields.11.unwrap(),
1927 verified: self._fields.12.unwrap(),
1928 extra_data: Default::default(),
1929 }
1930 }
1931 pub fn build_with_data(
1933 self,
1934 extra_data: BTreeMap<
1935 jacquard_common::deps::smol_str::SmolStr,
1936 jacquard_common::types::value::Data<'a>,
1937 >,
1938 ) -> Preferences<'a> {
1939 Preferences {
1940 chat: self._fields.0.unwrap(),
1941 follow: self._fields.1.unwrap(),
1942 like: self._fields.2.unwrap(),
1943 like_via_repost: self._fields.3.unwrap(),
1944 mention: self._fields.4.unwrap(),
1945 quote: self._fields.5.unwrap(),
1946 reply: self._fields.6.unwrap(),
1947 repost: self._fields.7.unwrap(),
1948 repost_via_repost: self._fields.8.unwrap(),
1949 starterpack_joined: self._fields.9.unwrap(),
1950 subscribed_post: self._fields.10.unwrap(),
1951 unverified: self._fields.11.unwrap(),
1952 verified: self._fields.12.unwrap(),
1953 extra_data: Some(extra_data),
1954 }
1955 }
1956}
1957
1958pub mod subject_activity_subscription_state {
1959
1960 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1961 #[allow(unused)]
1962 use ::core::marker::PhantomData;
1963 mod sealed {
1964 pub trait Sealed {}
1965 }
1966 pub trait State: sealed::Sealed {
1968 type ActivitySubscription;
1969 type Subject;
1970 }
1971 pub struct Empty(());
1973 impl sealed::Sealed for Empty {}
1974 impl State for Empty {
1975 type ActivitySubscription = Unset;
1976 type Subject = Unset;
1977 }
1978 pub struct SetActivitySubscription<S: State = Empty>(PhantomData<fn() -> S>);
1980 impl<S: State> sealed::Sealed for SetActivitySubscription<S> {}
1981 impl<S: State> State for SetActivitySubscription<S> {
1982 type ActivitySubscription = Set<members::activity_subscription>;
1983 type Subject = S::Subject;
1984 }
1985 pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
1987 impl<S: State> sealed::Sealed for SetSubject<S> {}
1988 impl<S: State> State for SetSubject<S> {
1989 type ActivitySubscription = S::ActivitySubscription;
1990 type Subject = Set<members::subject>;
1991 }
1992 #[allow(non_camel_case_types)]
1994 pub mod members {
1995 pub struct activity_subscription(());
1997 pub struct subject(());
1999 }
2000}
2001
2002pub struct SubjectActivitySubscriptionBuilder<
2004 'a,
2005 S: subject_activity_subscription_state::State,
2006> {
2007 _state: PhantomData<fn() -> S>,
2008 _fields: (Option<notification::ActivitySubscription<'a>>, Option<Did<'a>>),
2009 _lifetime: PhantomData<&'a ()>,
2010}
2011
2012impl<'a> SubjectActivitySubscription<'a> {
2013 pub fn new() -> SubjectActivitySubscriptionBuilder<
2015 'a,
2016 subject_activity_subscription_state::Empty,
2017 > {
2018 SubjectActivitySubscriptionBuilder::new()
2019 }
2020}
2021
2022impl<
2023 'a,
2024> SubjectActivitySubscriptionBuilder<'a, subject_activity_subscription_state::Empty> {
2025 pub fn new() -> Self {
2027 SubjectActivitySubscriptionBuilder {
2028 _state: PhantomData,
2029 _fields: (None, None),
2030 _lifetime: PhantomData,
2031 }
2032 }
2033}
2034
2035impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
2036where
2037 S: subject_activity_subscription_state::State,
2038 S::ActivitySubscription: subject_activity_subscription_state::IsUnset,
2039{
2040 pub fn activity_subscription(
2042 mut self,
2043 value: impl Into<notification::ActivitySubscription<'a>>,
2044 ) -> SubjectActivitySubscriptionBuilder<
2045 'a,
2046 subject_activity_subscription_state::SetActivitySubscription<S>,
2047 > {
2048 self._fields.0 = Option::Some(value.into());
2049 SubjectActivitySubscriptionBuilder {
2050 _state: PhantomData,
2051 _fields: self._fields,
2052 _lifetime: PhantomData,
2053 }
2054 }
2055}
2056
2057impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
2058where
2059 S: subject_activity_subscription_state::State,
2060 S::Subject: subject_activity_subscription_state::IsUnset,
2061{
2062 pub fn subject(
2064 mut self,
2065 value: impl Into<Did<'a>>,
2066 ) -> SubjectActivitySubscriptionBuilder<
2067 'a,
2068 subject_activity_subscription_state::SetSubject<S>,
2069 > {
2070 self._fields.1 = Option::Some(value.into());
2071 SubjectActivitySubscriptionBuilder {
2072 _state: PhantomData,
2073 _fields: self._fields,
2074 _lifetime: PhantomData,
2075 }
2076 }
2077}
2078
2079impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
2080where
2081 S: subject_activity_subscription_state::State,
2082 S::ActivitySubscription: subject_activity_subscription_state::IsSet,
2083 S::Subject: subject_activity_subscription_state::IsSet,
2084{
2085 pub fn build(self) -> SubjectActivitySubscription<'a> {
2087 SubjectActivitySubscription {
2088 activity_subscription: self._fields.0.unwrap(),
2089 subject: self._fields.1.unwrap(),
2090 extra_data: Default::default(),
2091 }
2092 }
2093 pub fn build_with_data(
2095 self,
2096 extra_data: BTreeMap<
2097 jacquard_common::deps::smol_str::SmolStr,
2098 jacquard_common::types::value::Data<'a>,
2099 >,
2100 ) -> SubjectActivitySubscription<'a> {
2101 SubjectActivitySubscription {
2102 activity_subscription: self._fields.0.unwrap(),
2103 subject: self._fields.1.unwrap(),
2104 extra_data: Some(extra_data),
2105 }
2106 }
2107}