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::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::Did;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::notification;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ActivitySubscription<'a> {
pub post: bool,
pub reply: bool,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ChatPreference<'a> {
#[serde(borrow)]
pub include: ChatPreferenceInclude<'a>,
pub push: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ChatPreferenceInclude<'a> {
All,
Accepted,
Other(CowStr<'a>),
}
impl<'a> ChatPreferenceInclude<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Accepted => "accepted",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ChatPreferenceInclude<'a> {
fn from(s: &'a str) -> Self {
match s {
"all" => Self::All,
"accepted" => Self::Accepted,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for ChatPreferenceInclude<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"all" => Self::All,
"accepted" => Self::Accepted,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ChatPreferenceInclude<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ChatPreferenceInclude<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ChatPreferenceInclude<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for ChatPreferenceInclude<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for ChatPreferenceInclude<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ChatPreferenceInclude<'_> {
type Output = ChatPreferenceInclude<'static>;
fn into_static(self) -> Self::Output {
match self {
ChatPreferenceInclude::All => ChatPreferenceInclude::All,
ChatPreferenceInclude::Accepted => ChatPreferenceInclude::Accepted,
ChatPreferenceInclude::Other(v) => {
ChatPreferenceInclude::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct FilterablePreference<'a> {
#[serde(borrow)]
pub include: FilterablePreferenceInclude<'a>,
pub list: bool,
pub push: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FilterablePreferenceInclude<'a> {
All,
Follows,
Other(CowStr<'a>),
}
impl<'a> FilterablePreferenceInclude<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Follows => "follows",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for FilterablePreferenceInclude<'a> {
fn from(s: &'a str) -> Self {
match s {
"all" => Self::All,
"follows" => Self::Follows,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for FilterablePreferenceInclude<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"all" => Self::All,
"follows" => Self::Follows,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for FilterablePreferenceInclude<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for FilterablePreferenceInclude<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for FilterablePreferenceInclude<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for FilterablePreferenceInclude<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for FilterablePreferenceInclude<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for FilterablePreferenceInclude<'_> {
type Output = FilterablePreferenceInclude<'static>;
fn into_static(self) -> Self::Output {
match self {
FilterablePreferenceInclude::All => FilterablePreferenceInclude::All,
FilterablePreferenceInclude::Follows => FilterablePreferenceInclude::Follows,
FilterablePreferenceInclude::Other(v) => {
FilterablePreferenceInclude::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Preference<'a> {
pub list: bool,
pub push: bool,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Preferences<'a> {
#[serde(borrow)]
pub chat: notification::ChatPreference<'a>,
#[serde(borrow)]
pub follow: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub like: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub like_via_repost: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub mention: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub quote: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub reply: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub repost: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub repost_via_repost: notification::FilterablePreference<'a>,
#[serde(borrow)]
pub starterpack_joined: notification::Preference<'a>,
#[serde(borrow)]
pub subscribed_post: notification::Preference<'a>,
#[serde(borrow)]
pub unverified: notification::Preference<'a>,
#[serde(borrow)]
pub verified: notification::Preference<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct RecordDeleted<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SubjectActivitySubscription<'a> {
#[serde(borrow)]
pub activity_subscription: notification::ActivitySubscription<'a>,
#[serde(borrow)]
pub subject: Did<'a>,
}
impl<'a> LexiconSchema for ActivitySubscription<'a> {
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<'a> LexiconSchema for ChatPreference<'a> {
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<'a> LexiconSchema for FilterablePreference<'a> {
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<'a> LexiconSchema for Preference<'a> {
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<'a> LexiconSchema for Preferences<'a> {
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<'a> LexiconSchema for RecordDeleted<'a> {
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<'a> LexiconSchema for SubjectActivitySubscription<'a> {
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::{Set, Unset, IsSet, IsUnset};
#[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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPost<S> {}
impl<S: State> State for SetPost<S> {
type Post = Set<members::post>;
type Reply = S::Reply;
}
pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetReply<S> {}
impl<S: State> State for SetReply<S> {
type Post = S::Post;
type Reply = Set<members::reply>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct post(());
pub struct reply(());
}
}
pub struct ActivitySubscriptionBuilder<'a, S: activity_subscription_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ActivitySubscription<'a> {
pub fn new() -> ActivitySubscriptionBuilder<'a, activity_subscription_state::Empty> {
ActivitySubscriptionBuilder::new()
}
}
impl<'a> ActivitySubscriptionBuilder<'a, activity_subscription_state::Empty> {
pub fn new() -> Self {
ActivitySubscriptionBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySubscriptionBuilder<'a, S>
where
S: activity_subscription_state::State,
S::Post: activity_subscription_state::IsUnset,
{
pub fn post(
mut self,
value: impl Into<bool>,
) -> ActivitySubscriptionBuilder<'a, activity_subscription_state::SetPost<S>> {
self._fields.0 = Option::Some(value.into());
ActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySubscriptionBuilder<'a, S>
where
S: activity_subscription_state::State,
S::Reply: activity_subscription_state::IsUnset,
{
pub fn reply(
mut self,
value: impl Into<bool>,
) -> ActivitySubscriptionBuilder<'a, activity_subscription_state::SetReply<S>> {
self._fields.1 = Option::Some(value.into());
ActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySubscriptionBuilder<'a, S>
where
S: activity_subscription_state::State,
S::Post: activity_subscription_state::IsSet,
S::Reply: activity_subscription_state::IsSet,
{
pub fn build(self) -> ActivitySubscription<'a> {
ActivitySubscription {
post: self._fields.0.unwrap(),
reply: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ActivitySubscription<'a> {
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> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
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::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Push;
type Include;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Push = Unset;
type Include = Unset;
}
pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPush<S> {}
impl<S: State> State for SetPush<S> {
type Push = Set<members::push>;
type Include = S::Include;
}
pub struct SetInclude<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetInclude<S> {}
impl<S: State> State for SetInclude<S> {
type Push = S::Push;
type Include = Set<members::include>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct push(());
pub struct include(());
}
}
pub struct ChatPreferenceBuilder<'a, S: chat_preference_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ChatPreferenceInclude<'a>>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ChatPreference<'a> {
pub fn new() -> ChatPreferenceBuilder<'a, chat_preference_state::Empty> {
ChatPreferenceBuilder::new()
}
}
impl<'a> ChatPreferenceBuilder<'a, chat_preference_state::Empty> {
pub fn new() -> Self {
ChatPreferenceBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChatPreferenceBuilder<'a, S>
where
S: chat_preference_state::State,
S::Include: chat_preference_state::IsUnset,
{
pub fn include(
mut self,
value: impl Into<ChatPreferenceInclude<'a>>,
) -> ChatPreferenceBuilder<'a, chat_preference_state::SetInclude<S>> {
self._fields.0 = Option::Some(value.into());
ChatPreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChatPreferenceBuilder<'a, S>
where
S: chat_preference_state::State,
S::Push: chat_preference_state::IsUnset,
{
pub fn push(
mut self,
value: impl Into<bool>,
) -> ChatPreferenceBuilder<'a, chat_preference_state::SetPush<S>> {
self._fields.1 = Option::Some(value.into());
ChatPreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChatPreferenceBuilder<'a, S>
where
S: chat_preference_state::State,
S::Push: chat_preference_state::IsSet,
S::Include: chat_preference_state::IsSet,
{
pub fn build(self) -> ChatPreference<'a> {
ChatPreference {
include: self._fields.0.unwrap(),
push: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ChatPreference<'a> {
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::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type List;
type Push;
type Include;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type List = Unset;
type Push = Unset;
type Include = Unset;
}
pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetList<S> {}
impl<S: State> State for SetList<S> {
type List = Set<members::list>;
type Push = S::Push;
type Include = S::Include;
}
pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPush<S> {}
impl<S: State> State for SetPush<S> {
type List = S::List;
type Push = Set<members::push>;
type Include = S::Include;
}
pub struct SetInclude<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetInclude<S> {}
impl<S: State> State for SetInclude<S> {
type List = S::List;
type Push = S::Push;
type Include = Set<members::include>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct list(());
pub struct push(());
pub struct include(());
}
}
pub struct FilterablePreferenceBuilder<'a, S: filterable_preference_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<FilterablePreferenceInclude<'a>>, Option<bool>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> FilterablePreference<'a> {
pub fn new() -> FilterablePreferenceBuilder<'a, filterable_preference_state::Empty> {
FilterablePreferenceBuilder::new()
}
}
impl<'a> FilterablePreferenceBuilder<'a, filterable_preference_state::Empty> {
pub fn new() -> Self {
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
S: filterable_preference_state::State,
S::Include: filterable_preference_state::IsUnset,
{
pub fn include(
mut self,
value: impl Into<FilterablePreferenceInclude<'a>>,
) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetInclude<S>> {
self._fields.0 = Option::Some(value.into());
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
S: filterable_preference_state::State,
S::List: filterable_preference_state::IsUnset,
{
pub fn list(
mut self,
value: impl Into<bool>,
) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetList<S>> {
self._fields.1 = Option::Some(value.into());
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
S: filterable_preference_state::State,
S::Push: filterable_preference_state::IsUnset,
{
pub fn push(
mut self,
value: impl Into<bool>,
) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetPush<S>> {
self._fields.2 = Option::Some(value.into());
FilterablePreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
S: filterable_preference_state::State,
S::List: filterable_preference_state::IsSet,
S::Push: filterable_preference_state::IsSet,
S::Include: filterable_preference_state::IsSet,
{
pub fn build(self) -> FilterablePreference<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> FilterablePreference<'a> {
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::{Set, Unset, IsSet, IsUnset};
#[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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetList<S> {}
impl<S: State> State for SetList<S> {
type List = Set<members::list>;
type Push = S::Push;
}
pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPush<S> {}
impl<S: State> State for SetPush<S> {
type List = S::List;
type Push = Set<members::push>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct list(());
pub struct push(());
}
}
pub struct PreferenceBuilder<'a, S: preference_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Preference<'a> {
pub fn new() -> PreferenceBuilder<'a, preference_state::Empty> {
PreferenceBuilder::new()
}
}
impl<'a> PreferenceBuilder<'a, preference_state::Empty> {
pub fn new() -> Self {
PreferenceBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferenceBuilder<'a, S>
where
S: preference_state::State,
S::List: preference_state::IsUnset,
{
pub fn list(
mut self,
value: impl Into<bool>,
) -> PreferenceBuilder<'a, preference_state::SetList<S>> {
self._fields.0 = Option::Some(value.into());
PreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferenceBuilder<'a, S>
where
S: preference_state::State,
S::Push: preference_state::IsUnset,
{
pub fn push(
mut self,
value: impl Into<bool>,
) -> PreferenceBuilder<'a, preference_state::SetPush<S>> {
self._fields.1 = Option::Some(value.into());
PreferenceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferenceBuilder<'a, S>
where
S: preference_state::State,
S::List: preference_state::IsSet,
S::Push: preference_state::IsSet,
{
pub fn build(self) -> Preference<'a> {
Preference {
list: self._fields.0.unwrap(),
push: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Preference<'a> {
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::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Chat;
type Repost;
type Reply;
type SubscribedPost;
type Like;
type LikeViaRepost;
type Mention;
type StarterpackJoined;
type RepostViaRepost;
type Quote;
type Unverified;
type Follow;
type Verified;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Chat = Unset;
type Repost = Unset;
type Reply = Unset;
type SubscribedPost = Unset;
type Like = Unset;
type LikeViaRepost = Unset;
type Mention = Unset;
type StarterpackJoined = Unset;
type RepostViaRepost = Unset;
type Quote = Unset;
type Unverified = Unset;
type Follow = Unset;
type Verified = Unset;
}
pub struct SetChat<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetChat<S> {}
impl<S: State> State for SetChat<S> {
type Chat = Set<members::chat>;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetRepost<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRepost<S> {}
impl<S: State> State for SetRepost<S> {
type Chat = S::Chat;
type Repost = Set<members::repost>;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetReply<S> {}
impl<S: State> State for SetReply<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = Set<members::reply>;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetSubscribedPost<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSubscribedPost<S> {}
impl<S: State> State for SetSubscribedPost<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = Set<members::subscribed_post>;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetLike<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLike<S> {}
impl<S: State> State for SetLike<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = Set<members::like>;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetLikeViaRepost<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLikeViaRepost<S> {}
impl<S: State> State for SetLikeViaRepost<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = Set<members::like_via_repost>;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetMention<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMention<S> {}
impl<S: State> State for SetMention<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = Set<members::mention>;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetStarterpackJoined<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetStarterpackJoined<S> {}
impl<S: State> State for SetStarterpackJoined<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = Set<members::starterpack_joined>;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetRepostViaRepost<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRepostViaRepost<S> {}
impl<S: State> State for SetRepostViaRepost<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = Set<members::repost_via_repost>;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetQuote<S> {}
impl<S: State> State for SetQuote<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = Set<members::quote>;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetUnverified<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUnverified<S> {}
impl<S: State> State for SetUnverified<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = Set<members::unverified>;
type Follow = S::Follow;
type Verified = S::Verified;
}
pub struct SetFollow<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFollow<S> {}
impl<S: State> State for SetFollow<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = Set<members::follow>;
type Verified = S::Verified;
}
pub struct SetVerified<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetVerified<S> {}
impl<S: State> State for SetVerified<S> {
type Chat = S::Chat;
type Repost = S::Repost;
type Reply = S::Reply;
type SubscribedPost = S::SubscribedPost;
type Like = S::Like;
type LikeViaRepost = S::LikeViaRepost;
type Mention = S::Mention;
type StarterpackJoined = S::StarterpackJoined;
type RepostViaRepost = S::RepostViaRepost;
type Quote = S::Quote;
type Unverified = S::Unverified;
type Follow = S::Follow;
type Verified = Set<members::verified>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct chat(());
pub struct repost(());
pub struct reply(());
pub struct subscribed_post(());
pub struct like(());
pub struct like_via_repost(());
pub struct mention(());
pub struct starterpack_joined(());
pub struct repost_via_repost(());
pub struct quote(());
pub struct unverified(());
pub struct follow(());
pub struct verified(());
}
}
pub struct PreferencesBuilder<'a, S: preferences_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<notification::ChatPreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::FilterablePreference<'a>>,
Option<notification::Preference<'a>>,
Option<notification::Preference<'a>>,
Option<notification::Preference<'a>>,
Option<notification::Preference<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Preferences<'a> {
pub fn new() -> PreferencesBuilder<'a, preferences_state::Empty> {
PreferencesBuilder::new()
}
}
impl<'a> PreferencesBuilder<'a, preferences_state::Empty> {
pub fn new() -> Self {
PreferencesBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Chat: preferences_state::IsUnset,
{
pub fn chat(
mut self,
value: impl Into<notification::ChatPreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetChat<S>> {
self._fields.0 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Follow: preferences_state::IsUnset,
{
pub fn follow(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetFollow<S>> {
self._fields.1 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Like: preferences_state::IsUnset,
{
pub fn like(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetLike<S>> {
self._fields.2 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::LikeViaRepost: preferences_state::IsUnset,
{
pub fn like_via_repost(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetLikeViaRepost<S>> {
self._fields.3 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Mention: preferences_state::IsUnset,
{
pub fn mention(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetMention<S>> {
self._fields.4 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Quote: preferences_state::IsUnset,
{
pub fn quote(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetQuote<S>> {
self._fields.5 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Reply: preferences_state::IsUnset,
{
pub fn reply(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetReply<S>> {
self._fields.6 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Repost: preferences_state::IsUnset,
{
pub fn repost(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetRepost<S>> {
self._fields.7 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::RepostViaRepost: preferences_state::IsUnset,
{
pub fn repost_via_repost(
mut self,
value: impl Into<notification::FilterablePreference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetRepostViaRepost<S>> {
self._fields.8 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::StarterpackJoined: preferences_state::IsUnset,
{
pub fn starterpack_joined(
mut self,
value: impl Into<notification::Preference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetStarterpackJoined<S>> {
self._fields.9 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::SubscribedPost: preferences_state::IsUnset,
{
pub fn subscribed_post(
mut self,
value: impl Into<notification::Preference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetSubscribedPost<S>> {
self._fields.10 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Unverified: preferences_state::IsUnset,
{
pub fn unverified(
mut self,
value: impl Into<notification::Preference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetUnverified<S>> {
self._fields.11 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Verified: preferences_state::IsUnset,
{
pub fn verified(
mut self,
value: impl Into<notification::Preference<'a>>,
) -> PreferencesBuilder<'a, preferences_state::SetVerified<S>> {
self._fields.12 = Option::Some(value.into());
PreferencesBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PreferencesBuilder<'a, S>
where
S: preferences_state::State,
S::Chat: preferences_state::IsSet,
S::Repost: preferences_state::IsSet,
S::Reply: preferences_state::IsSet,
S::SubscribedPost: preferences_state::IsSet,
S::Like: preferences_state::IsSet,
S::LikeViaRepost: preferences_state::IsSet,
S::Mention: preferences_state::IsSet,
S::StarterpackJoined: preferences_state::IsSet,
S::RepostViaRepost: preferences_state::IsSet,
S::Quote: preferences_state::IsSet,
S::Unverified: preferences_state::IsSet,
S::Follow: preferences_state::IsSet,
S::Verified: preferences_state::IsSet,
{
pub fn build(self) -> Preferences<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Preferences<'a> {
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::{Set, Unset, IsSet, IsUnset};
#[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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetActivitySubscription<S> {}
impl<S: State> State for SetActivitySubscription<S> {
type ActivitySubscription = Set<members::activity_subscription>;
type Subject = S::Subject;
}
pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSubject<S> {}
impl<S: State> State for SetSubject<S> {
type ActivitySubscription = S::ActivitySubscription;
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct activity_subscription(());
pub struct subject(());
}
}
pub struct SubjectActivitySubscriptionBuilder<
'a,
S: subject_activity_subscription_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<notification::ActivitySubscription<'a>>, Option<Did<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> SubjectActivitySubscription<'a> {
pub fn new() -> SubjectActivitySubscriptionBuilder<
'a,
subject_activity_subscription_state::Empty,
> {
SubjectActivitySubscriptionBuilder::new()
}
}
impl<
'a,
> SubjectActivitySubscriptionBuilder<'a, subject_activity_subscription_state::Empty> {
pub fn new() -> Self {
SubjectActivitySubscriptionBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
where
S: subject_activity_subscription_state::State,
S::ActivitySubscription: subject_activity_subscription_state::IsUnset,
{
pub fn activity_subscription(
mut self,
value: impl Into<notification::ActivitySubscription<'a>>,
) -> SubjectActivitySubscriptionBuilder<
'a,
subject_activity_subscription_state::SetActivitySubscription<S>,
> {
self._fields.0 = Option::Some(value.into());
SubjectActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
where
S: subject_activity_subscription_state::State,
S::Subject: subject_activity_subscription_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<Did<'a>>,
) -> SubjectActivitySubscriptionBuilder<
'a,
subject_activity_subscription_state::SetSubject<S>,
> {
self._fields.1 = Option::Some(value.into());
SubjectActivitySubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
where
S: subject_activity_subscription_state::State,
S::ActivitySubscription: subject_activity_subscription_state::IsSet,
S::Subject: subject_activity_subscription_state::IsSet,
{
pub fn build(self) -> SubjectActivitySubscription<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> SubjectActivitySubscription<'a> {
SubjectActivitySubscription {
activity_subscription: self._fields.0.unwrap(),
subject: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}