pub mod declaration;
pub mod get_preferences;
pub mod get_unread_count;
pub mod list_activity_subscriptions;
pub mod list_notifications;
pub mod put_activity_subscription;
pub mod put_preferences;
pub mod put_preferences_v2;
pub mod register_push;
pub mod unregister_push;
pub mod update_seen;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Did;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::app_bsky::notification;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ActivitySubscription<S: BosStr = DefaultStr> {
pub post: bool,
pub reply: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ChatPreference<S: BosStr = DefaultStr> {
pub include: ChatPreferenceInclude<S>,
pub push: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ChatPreferenceInclude<S: BosStr = DefaultStr> {
All,
Accepted,
Other(S),
}
impl<S: BosStr> ChatPreferenceInclude<S> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Accepted => "accepted",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"all" => Self::All,
"accepted" => Self::Accepted,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ChatPreferenceInclude<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ChatPreferenceInclude<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ChatPreferenceInclude<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ChatPreferenceInclude<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for ChatPreferenceInclude<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ChatPreferenceInclude<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ChatPreferenceInclude<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ChatPreferenceInclude::All => ChatPreferenceInclude::All,
ChatPreferenceInclude::Accepted => ChatPreferenceInclude::Accepted,
ChatPreferenceInclude::Other(v) => ChatPreferenceInclude::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct FilterablePreference<S: BosStr = DefaultStr> {
pub include: FilterablePreferenceInclude<S>,
pub list: bool,
pub push: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FilterablePreferenceInclude<S: BosStr = DefaultStr> {
All,
Follows,
Other(S),
}
impl<S: BosStr> FilterablePreferenceInclude<S> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Follows => "follows",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"all" => Self::All,
"follows" => Self::Follows,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for FilterablePreferenceInclude<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for FilterablePreferenceInclude<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for FilterablePreferenceInclude<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for FilterablePreferenceInclude<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for FilterablePreferenceInclude<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for FilterablePreferenceInclude<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = FilterablePreferenceInclude<S::Output>;
fn into_static(self) -> Self::Output {
match self {
FilterablePreferenceInclude::All => FilterablePreferenceInclude::All,
FilterablePreferenceInclude::Follows => FilterablePreferenceInclude::Follows,
FilterablePreferenceInclude::Other(v) => {
FilterablePreferenceInclude::Other(v.into_static())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Preference<S: BosStr = DefaultStr> {
pub list: bool,
pub push: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Preferences<S: BosStr = DefaultStr> {
pub chat: notification::ChatPreference<S>,
pub follow: notification::FilterablePreference<S>,
pub like: notification::FilterablePreference<S>,
pub like_via_repost: notification::FilterablePreference<S>,
pub mention: notification::FilterablePreference<S>,
pub quote: notification::FilterablePreference<S>,
pub reply: notification::FilterablePreference<S>,
pub repost: notification::FilterablePreference<S>,
pub repost_via_repost: notification::FilterablePreference<S>,
pub starterpack_joined: notification::Preference<S>,
pub subscribed_post: notification::Preference<S>,
pub unverified: notification::Preference<S>,
pub verified: notification::Preference<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct RecordDeleted<S: BosStr = DefaultStr> {
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct SubjectActivitySubscription<S: BosStr = DefaultStr> {
pub activity_subscription: notification::ActivitySubscription<S>,
pub subject: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for ActivitySubscription<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"activitySubscription"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ChatPreference<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"chatPreference"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for FilterablePreference<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"filterablePreference"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Preference<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"preference"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Preferences<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"preferences"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for RecordDeleted<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"recordDeleted"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SubjectActivitySubscription<S> {
fn nsid() -> &'static str {
"app.bsky.notification.defs"
}
fn def_name() -> &'static str {
"subjectActivitySubscription"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_notification_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod activity_subscription_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Post;
type Reply;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Post = Unset;
type Reply = Unset;
}
pub struct SetPost<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPost<St> {}
impl<St: State> State for SetPost<St> {
type Post = Set<members::post>;
type Reply = St::Reply;
}
pub struct SetReply<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReply<St> {}
impl<St: State> State for SetReply<St> {
type Post = St::Post;
type Reply = Set<members::reply>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct post(());
pub struct reply(());
}
}
pub struct ActivitySubscriptionBuilder<S: BosStr, St: activity_subscription_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<bool>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ActivitySubscription<S> {
pub fn new() -> ActivitySubscriptionBuilder<S, activity_subscription_state::Empty> {
ActivitySubscriptionBuilder::new()
}
}
impl<S: BosStr> ActivitySubscriptionBuilder<S, activity_subscription_state::Empty> {
pub fn new() -> Self {
ActivitySubscriptionBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySubscriptionBuilder<S, St>
where
St: activity_subscription_state::State,
St::Post: activity_subscription_state::IsUnset,
{
pub fn post(
mut self,
value: impl Into<bool>,
) -> ActivitySubscriptionBuilder<S, activity_subscription_state::SetPost<St>> {
self._fields.0 = Option::Some(value.into());
ActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySubscriptionBuilder<S, St>
where
St: activity_subscription_state::State,
St::Reply: activity_subscription_state::IsUnset,
{
pub fn reply(
mut self,
value: impl Into<bool>,
) -> ActivitySubscriptionBuilder<S, activity_subscription_state::SetReply<St>> {
self._fields.1 = Option::Some(value.into());
ActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySubscriptionBuilder<S, St>
where
St: activity_subscription_state::State,
St::Post: activity_subscription_state::IsSet,
St::Reply: activity_subscription_state::IsSet,
{
pub fn build(self) -> ActivitySubscription<S> {
ActivitySubscription {
post: self._fields.0.unwrap(),
reply: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ActivitySubscription<S> {
ActivitySubscription {
post: self._fields.0.unwrap(),
reply: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_notification_defs() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("app.bsky.notification.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("activitySubscription"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("post"),
SmolStr::new_static("reply"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("post"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reply"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("chatPreference"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("include"),
SmolStr::new_static("push"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("include"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("push"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("filterablePreference"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("include"),
SmolStr::new_static("list"),
SmolStr::new_static("push"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("include"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("list"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("push"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("preference"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("list"),
SmolStr::new_static("push"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("list"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("push"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("preferences"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("chat"),
SmolStr::new_static("follow"),
SmolStr::new_static("like"),
SmolStr::new_static("likeViaRepost"),
SmolStr::new_static("mention"),
SmolStr::new_static("quote"),
SmolStr::new_static("reply"),
SmolStr::new_static("repost"),
SmolStr::new_static("repostViaRepost"),
SmolStr::new_static("starterpackJoined"),
SmolStr::new_static("subscribedPost"),
SmolStr::new_static("unverified"),
SmolStr::new_static("verified"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("chat"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#chatPreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("follow"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("like"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeViaRepost"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mention"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("quote"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reply"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repost"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repostViaRepost"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#filterablePreference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("starterpackJoined"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#preference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subscribedPost"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#preference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("unverified"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#preference"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("verified"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#preference"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("recordDeleted"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subjectActivitySubscription"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Object used to store activity subscription data in stash.",
)),
required: Some(vec![
SmolStr::new_static("subject"),
SmolStr::new_static("activitySubscription"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("activitySubscription"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#activitySubscription"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subject"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod chat_preference_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Include;
type Push;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Include = Unset;
type Push = Unset;
}
pub struct SetInclude<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetInclude<St> {}
impl<St: State> State for SetInclude<St> {
type Include = Set<members::include>;
type Push = St::Push;
}
pub struct SetPush<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPush<St> {}
impl<St: State> State for SetPush<St> {
type Include = St::Include;
type Push = Set<members::push>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct include(());
pub struct push(());
}
}
pub struct ChatPreferenceBuilder<S: BosStr, St: chat_preference_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ChatPreferenceInclude<S>>, Option<bool>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ChatPreference<S> {
pub fn new() -> ChatPreferenceBuilder<S, chat_preference_state::Empty> {
ChatPreferenceBuilder::new()
}
}
impl<S: BosStr> ChatPreferenceBuilder<S, chat_preference_state::Empty> {
pub fn new() -> Self {
ChatPreferenceBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChatPreferenceBuilder<S, St>
where
St: chat_preference_state::State,
St::Include: chat_preference_state::IsUnset,
{
pub fn include(
mut self,
value: impl Into<ChatPreferenceInclude<S>>,
) -> ChatPreferenceBuilder<S, chat_preference_state::SetInclude<St>> {
self._fields.0 = Option::Some(value.into());
ChatPreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChatPreferenceBuilder<S, St>
where
St: chat_preference_state::State,
St::Push: chat_preference_state::IsUnset,
{
pub fn push(
mut self,
value: impl Into<bool>,
) -> ChatPreferenceBuilder<S, chat_preference_state::SetPush<St>> {
self._fields.1 = Option::Some(value.into());
ChatPreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChatPreferenceBuilder<S, St>
where
St: chat_preference_state::State,
St::Include: chat_preference_state::IsSet,
St::Push: chat_preference_state::IsSet,
{
pub fn build(self) -> ChatPreference<S> {
ChatPreference {
include: self._fields.0.unwrap(),
push: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ChatPreference<S> {
ChatPreference {
include: self._fields.0.unwrap(),
push: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod filterable_preference_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Push;
type List;
type Include;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Push = Unset;
type List = Unset;
type Include = Unset;
}
pub struct SetPush<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPush<St> {}
impl<St: State> State for SetPush<St> {
type Push = Set<members::push>;
type List = St::List;
type Include = St::Include;
}
pub struct SetList<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetList<St> {}
impl<St: State> State for SetList<St> {
type Push = St::Push;
type List = Set<members::list>;
type Include = St::Include;
}
pub struct SetInclude<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetInclude<St> {}
impl<St: State> State for SetInclude<St> {
type Push = St::Push;
type List = St::List;
type Include = Set<members::include>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct push(());
pub struct list(());
pub struct include(());
}
}
pub struct FilterablePreferenceBuilder<S: BosStr, St: filterable_preference_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<FilterablePreferenceInclude<S>>,
Option<bool>,
Option<bool>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> FilterablePreference<S> {
pub fn new() -> FilterablePreferenceBuilder<S, filterable_preference_state::Empty> {
FilterablePreferenceBuilder::new()
}
}
impl<S: BosStr> FilterablePreferenceBuilder<S, filterable_preference_state::Empty> {
pub fn new() -> Self {
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FilterablePreferenceBuilder<S, St>
where
St: filterable_preference_state::State,
St::Include: filterable_preference_state::IsUnset,
{
pub fn include(
mut self,
value: impl Into<FilterablePreferenceInclude<S>>,
) -> FilterablePreferenceBuilder<S, filterable_preference_state::SetInclude<St>> {
self._fields.0 = Option::Some(value.into());
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FilterablePreferenceBuilder<S, St>
where
St: filterable_preference_state::State,
St::List: filterable_preference_state::IsUnset,
{
pub fn list(
mut self,
value: impl Into<bool>,
) -> FilterablePreferenceBuilder<S, filterable_preference_state::SetList<St>> {
self._fields.1 = Option::Some(value.into());
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FilterablePreferenceBuilder<S, St>
where
St: filterable_preference_state::State,
St::Push: filterable_preference_state::IsUnset,
{
pub fn push(
mut self,
value: impl Into<bool>,
) -> FilterablePreferenceBuilder<S, filterable_preference_state::SetPush<St>> {
self._fields.2 = Option::Some(value.into());
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FilterablePreferenceBuilder<S, St>
where
St: filterable_preference_state::State,
St::Push: filterable_preference_state::IsSet,
St::List: filterable_preference_state::IsSet,
St::Include: filterable_preference_state::IsSet,
{
pub fn build(self) -> FilterablePreference<S> {
FilterablePreference {
include: self._fields.0.unwrap(),
list: self._fields.1.unwrap(),
push: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> FilterablePreference<S> {
FilterablePreference {
include: self._fields.0.unwrap(),
list: self._fields.1.unwrap(),
push: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod preference_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type List;
type Push;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type List = Unset;
type Push = Unset;
}
pub struct SetList<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetList<St> {}
impl<St: State> State for SetList<St> {
type List = Set<members::list>;
type Push = St::Push;
}
pub struct SetPush<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPush<St> {}
impl<St: State> State for SetPush<St> {
type List = St::List;
type Push = Set<members::push>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct list(());
pub struct push(());
}
}
pub struct PreferenceBuilder<S: BosStr, St: preference_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<bool>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Preference<S> {
pub fn new() -> PreferenceBuilder<S, preference_state::Empty> {
PreferenceBuilder::new()
}
}
impl<S: BosStr> PreferenceBuilder<S, preference_state::Empty> {
pub fn new() -> Self {
PreferenceBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferenceBuilder<S, St>
where
St: preference_state::State,
St::List: preference_state::IsUnset,
{
pub fn list(
mut self,
value: impl Into<bool>,
) -> PreferenceBuilder<S, preference_state::SetList<St>> {
self._fields.0 = Option::Some(value.into());
PreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferenceBuilder<S, St>
where
St: preference_state::State,
St::Push: preference_state::IsUnset,
{
pub fn push(
mut self,
value: impl Into<bool>,
) -> PreferenceBuilder<S, preference_state::SetPush<St>> {
self._fields.1 = Option::Some(value.into());
PreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferenceBuilder<S, St>
where
St: preference_state::State,
St::List: preference_state::IsSet,
St::Push: preference_state::IsSet,
{
pub fn build(self) -> Preference<S> {
Preference {
list: self._fields.0.unwrap(),
push: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Preference<S> {
Preference {
list: self._fields.0.unwrap(),
push: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod preferences_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Chat;
type Like;
type Quote;
type Reply;
type LikeViaRepost;
type SubscribedPost;
type Repost;
type Follow;
type StarterpackJoined;
type RepostViaRepost;
type Unverified;
type Mention;
type Verified;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Chat = Unset;
type Like = Unset;
type Quote = Unset;
type Reply = Unset;
type LikeViaRepost = Unset;
type SubscribedPost = Unset;
type Repost = Unset;
type Follow = Unset;
type StarterpackJoined = Unset;
type RepostViaRepost = Unset;
type Unverified = Unset;
type Mention = Unset;
type Verified = Unset;
}
pub struct SetChat<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetChat<St> {}
impl<St: State> State for SetChat<St> {
type Chat = Set<members::chat>;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetLike<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLike<St> {}
impl<St: State> State for SetLike<St> {
type Chat = St::Chat;
type Like = Set<members::like>;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetQuote<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetQuote<St> {}
impl<St: State> State for SetQuote<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = Set<members::quote>;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetReply<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReply<St> {}
impl<St: State> State for SetReply<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = Set<members::reply>;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetLikeViaRepost<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLikeViaRepost<St> {}
impl<St: State> State for SetLikeViaRepost<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = Set<members::like_via_repost>;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetSubscribedPost<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubscribedPost<St> {}
impl<St: State> State for SetSubscribedPost<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = Set<members::subscribed_post>;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetRepost<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRepost<St> {}
impl<St: State> State for SetRepost<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = Set<members::repost>;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetFollow<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFollow<St> {}
impl<St: State> State for SetFollow<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = Set<members::follow>;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetStarterpackJoined<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStarterpackJoined<St> {}
impl<St: State> State for SetStarterpackJoined<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = Set<members::starterpack_joined>;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetRepostViaRepost<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRepostViaRepost<St> {}
impl<St: State> State for SetRepostViaRepost<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = Set<members::repost_via_repost>;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetUnverified<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUnverified<St> {}
impl<St: State> State for SetUnverified<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = Set<members::unverified>;
type Mention = St::Mention;
type Verified = St::Verified;
}
pub struct SetMention<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMention<St> {}
impl<St: State> State for SetMention<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = Set<members::mention>;
type Verified = St::Verified;
}
pub struct SetVerified<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetVerified<St> {}
impl<St: State> State for SetVerified<St> {
type Chat = St::Chat;
type Like = St::Like;
type Quote = St::Quote;
type Reply = St::Reply;
type LikeViaRepost = St::LikeViaRepost;
type SubscribedPost = St::SubscribedPost;
type Repost = St::Repost;
type Follow = St::Follow;
type StarterpackJoined = St::StarterpackJoined;
type RepostViaRepost = St::RepostViaRepost;
type Unverified = St::Unverified;
type Mention = St::Mention;
type Verified = Set<members::verified>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct chat(());
pub struct like(());
pub struct quote(());
pub struct reply(());
pub struct like_via_repost(());
pub struct subscribed_post(());
pub struct repost(());
pub struct follow(());
pub struct starterpack_joined(());
pub struct repost_via_repost(());
pub struct unverified(());
pub struct mention(());
pub struct verified(());
}
}
pub struct PreferencesBuilder<S: BosStr, St: preferences_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<notification::ChatPreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::FilterablePreference<S>>,
Option<notification::Preference<S>>,
Option<notification::Preference<S>>,
Option<notification::Preference<S>>,
Option<notification::Preference<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Preferences<S> {
pub fn new() -> PreferencesBuilder<S, preferences_state::Empty> {
PreferencesBuilder::new()
}
}
impl<S: BosStr> PreferencesBuilder<S, preferences_state::Empty> {
pub fn new() -> Self {
PreferencesBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Chat: preferences_state::IsUnset,
{
pub fn chat(
mut self,
value: impl Into<notification::ChatPreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetChat<St>> {
self._fields.0 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Follow: preferences_state::IsUnset,
{
pub fn follow(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetFollow<St>> {
self._fields.1 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Like: preferences_state::IsUnset,
{
pub fn like(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetLike<St>> {
self._fields.2 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::LikeViaRepost: preferences_state::IsUnset,
{
pub fn like_via_repost(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetLikeViaRepost<St>> {
self._fields.3 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Mention: preferences_state::IsUnset,
{
pub fn mention(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetMention<St>> {
self._fields.4 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Quote: preferences_state::IsUnset,
{
pub fn quote(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetQuote<St>> {
self._fields.5 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Reply: preferences_state::IsUnset,
{
pub fn reply(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetReply<St>> {
self._fields.6 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Repost: preferences_state::IsUnset,
{
pub fn repost(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetRepost<St>> {
self._fields.7 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::RepostViaRepost: preferences_state::IsUnset,
{
pub fn repost_via_repost(
mut self,
value: impl Into<notification::FilterablePreference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetRepostViaRepost<St>> {
self._fields.8 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::StarterpackJoined: preferences_state::IsUnset,
{
pub fn starterpack_joined(
mut self,
value: impl Into<notification::Preference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetStarterpackJoined<St>> {
self._fields.9 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::SubscribedPost: preferences_state::IsUnset,
{
pub fn subscribed_post(
mut self,
value: impl Into<notification::Preference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetSubscribedPost<St>> {
self._fields.10 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Unverified: preferences_state::IsUnset,
{
pub fn unverified(
mut self,
value: impl Into<notification::Preference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetUnverified<St>> {
self._fields.11 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Verified: preferences_state::IsUnset,
{
pub fn verified(
mut self,
value: impl Into<notification::Preference<S>>,
) -> PreferencesBuilder<S, preferences_state::SetVerified<St>> {
self._fields.12 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PreferencesBuilder<S, St>
where
St: preferences_state::State,
St::Chat: preferences_state::IsSet,
St::Like: preferences_state::IsSet,
St::Quote: preferences_state::IsSet,
St::Reply: preferences_state::IsSet,
St::LikeViaRepost: preferences_state::IsSet,
St::SubscribedPost: preferences_state::IsSet,
St::Repost: preferences_state::IsSet,
St::Follow: preferences_state::IsSet,
St::StarterpackJoined: preferences_state::IsSet,
St::RepostViaRepost: preferences_state::IsSet,
St::Unverified: preferences_state::IsSet,
St::Mention: preferences_state::IsSet,
St::Verified: preferences_state::IsSet,
{
pub fn build(self) -> Preferences<S> {
Preferences {
chat: self._fields.0.unwrap(),
follow: self._fields.1.unwrap(),
like: self._fields.2.unwrap(),
like_via_repost: self._fields.3.unwrap(),
mention: self._fields.4.unwrap(),
quote: self._fields.5.unwrap(),
reply: self._fields.6.unwrap(),
repost: self._fields.7.unwrap(),
repost_via_repost: self._fields.8.unwrap(),
starterpack_joined: self._fields.9.unwrap(),
subscribed_post: self._fields.10.unwrap(),
unverified: self._fields.11.unwrap(),
verified: self._fields.12.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Preferences<S> {
Preferences {
chat: self._fields.0.unwrap(),
follow: self._fields.1.unwrap(),
like: self._fields.2.unwrap(),
like_via_repost: self._fields.3.unwrap(),
mention: self._fields.4.unwrap(),
quote: self._fields.5.unwrap(),
reply: self._fields.6.unwrap(),
repost: self._fields.7.unwrap(),
repost_via_repost: self._fields.8.unwrap(),
starterpack_joined: self._fields.9.unwrap(),
subscribed_post: self._fields.10.unwrap(),
unverified: self._fields.11.unwrap(),
verified: self._fields.12.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod subject_activity_subscription_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type ActivitySubscription;
type Subject;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ActivitySubscription = Unset;
type Subject = Unset;
}
pub struct SetActivitySubscription<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetActivitySubscription<St> {}
impl<St: State> State for SetActivitySubscription<St> {
type ActivitySubscription = Set<members::activity_subscription>;
type Subject = St::Subject;
}
pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubject<St> {}
impl<St: State> State for SetSubject<St> {
type ActivitySubscription = St::ActivitySubscription;
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct activity_subscription(());
pub struct subject(());
}
}
pub struct SubjectActivitySubscriptionBuilder<
S: BosStr,
St: subject_activity_subscription_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<notification::ActivitySubscription<S>>,
Option<Did<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SubjectActivitySubscription<S> {
pub fn new() -> SubjectActivitySubscriptionBuilder<S, subject_activity_subscription_state::Empty>
{
SubjectActivitySubscriptionBuilder::new()
}
}
impl<S: BosStr> SubjectActivitySubscriptionBuilder<S, subject_activity_subscription_state::Empty> {
pub fn new() -> Self {
SubjectActivitySubscriptionBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SubjectActivitySubscriptionBuilder<S, St>
where
St: subject_activity_subscription_state::State,
St::ActivitySubscription: subject_activity_subscription_state::IsUnset,
{
pub fn activity_subscription(
mut self,
value: impl Into<notification::ActivitySubscription<S>>,
) -> SubjectActivitySubscriptionBuilder<
S,
subject_activity_subscription_state::SetActivitySubscription<St>,
> {
self._fields.0 = Option::Some(value.into());
SubjectActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SubjectActivitySubscriptionBuilder<S, St>
where
St: subject_activity_subscription_state::State,
St::Subject: subject_activity_subscription_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<Did<S>>,
) -> SubjectActivitySubscriptionBuilder<S, subject_activity_subscription_state::SetSubject<St>>
{
self._fields.1 = Option::Some(value.into());
SubjectActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SubjectActivitySubscriptionBuilder<S, St>
where
St: subject_activity_subscription_state::State,
St::ActivitySubscription: subject_activity_subscription_state::IsSet,
St::Subject: subject_activity_subscription_state::IsSet,
{
pub fn build(self) -> SubjectActivitySubscription<S> {
SubjectActivitySubscription {
activity_subscription: self._fields.0.unwrap(),
subject: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> SubjectActivitySubscription<S> {
SubjectActivitySubscription {
activity_subscription: self._fields.0.unwrap(),
subject: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}