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