pub struct NotificationSettings { /* private fields */ }
Expand description
A high-level API to manage the client owner’s push notification settings.
Implementations§
Source§impl NotificationSettings
impl NotificationSettings
Sourcepub fn subscribe_to_changes(&self) -> Receiver<()>
pub fn subscribe_to_changes(&self) -> Receiver<()>
Subscribe to changes in the NotificationSettings
.
Changes can happen due to local changes or changes in another session.
Sourcepub async fn get_user_defined_room_notification_mode(
&self,
room_id: &RoomId,
) -> Option<RoomNotificationMode>
pub async fn get_user_defined_room_notification_mode( &self, room_id: &RoomId, ) -> Option<RoomNotificationMode>
Get the user defined notification mode for a room.
Sourcepub async fn get_default_room_notification_mode(
&self,
is_encrypted: IsEncrypted,
is_one_to_one: IsOneToOne,
) -> RoomNotificationMode
pub async fn get_default_room_notification_mode( &self, is_encrypted: IsEncrypted, is_one_to_one: IsOneToOne, ) -> RoomNotificationMode
Get the default notification mode for a room.
§Arguments
is_encrypted
-Yes
if the room is encryptedis_one_to_one
-Yes
if the room is a direct chat involving two people
Sourcepub async fn get_rooms_with_user_defined_rules(
&self,
enabled: Option<bool>,
) -> Vec<String>
pub async fn get_rooms_with_user_defined_rules( &self, enabled: Option<bool>, ) -> Vec<String>
Get all room IDs for which a user-defined rule exists.
Sourcepub async fn contains_keyword_rules(&self) -> bool
pub async fn contains_keyword_rules(&self) -> bool
Get whether the given ruleset contains some enabled keywords rules.
Sourcepub async fn is_push_rule_enabled(
&self,
kind: RuleKind,
rule_id: impl AsRef<str>,
) -> Result<bool, NotificationSettingsError>
pub async fn is_push_rule_enabled( &self, kind: RuleKind, rule_id: impl AsRef<str>, ) -> Result<bool, NotificationSettingsError>
Get whether a push rule is enabled.
Sourcepub async fn set_push_rule_enabled(
&self,
kind: RuleKind,
rule_id: impl AsRef<str>,
enabled: bool,
) -> Result<(), NotificationSettingsError>
pub async fn set_push_rule_enabled( &self, kind: RuleKind, rule_id: impl AsRef<str>, enabled: bool, ) -> Result<(), NotificationSettingsError>
Set whether a push rule is enabled.
Sourcepub async fn set_default_room_notification_mode(
&self,
is_encrypted: IsEncrypted,
is_one_to_one: IsOneToOne,
mode: RoomNotificationMode,
) -> Result<(), NotificationSettingsError>
pub async fn set_default_room_notification_mode( &self, is_encrypted: IsEncrypted, is_one_to_one: IsOneToOne, mode: RoomNotificationMode, ) -> Result<(), NotificationSettingsError>
Set the default notification mode for a type of room.
§Arguments
is_encrypted
-Yes
if the mode is for encrypted roomsis_one_to_one
-Yes
if the mode if forone-to-one
rooms (rooms with exactly two members)mode
- the new default mode
Sourcepub async fn set_underride_push_rule_actions(
&self,
rule_id: PredefinedUnderrideRuleId,
actions: Vec<Action>,
) -> Result<(), NotificationSettingsError>
pub async fn set_underride_push_rule_actions( &self, rule_id: PredefinedUnderrideRuleId, actions: Vec<Action>, ) -> Result<(), NotificationSettingsError>
Sets the push rule actions for a given underride push rule. It also enables the push rule if it is disabled. Underride rules are the lowest priority push rules
§Arguments
rule_id
- the identifier of the push ruleactions
- the actions to set for the push rule
Sourcepub async fn set_room_notification_mode(
&self,
room_id: &RoomId,
mode: RoomNotificationMode,
) -> Result<(), NotificationSettingsError>
pub async fn set_room_notification_mode( &self, room_id: &RoomId, mode: RoomNotificationMode, ) -> Result<(), NotificationSettingsError>
Set the notification mode for a room.
Sourcepub async fn delete_user_defined_room_rules(
&self,
room_id: &RoomId,
) -> Result<(), NotificationSettingsError>
pub async fn delete_user_defined_room_rules( &self, room_id: &RoomId, ) -> Result<(), NotificationSettingsError>
Delete all user defined rules for a room.
Sourcepub async fn unmute_room(
&self,
room_id: &RoomId,
is_encrypted: IsEncrypted,
is_one_to_one: IsOneToOne,
) -> Result<(), NotificationSettingsError>
pub async fn unmute_room( &self, room_id: &RoomId, is_encrypted: IsEncrypted, is_one_to_one: IsOneToOne, ) -> Result<(), NotificationSettingsError>
Unmute a room.
Sourcepub async fn enabled_keywords(&self) -> IndexSet<String>
pub async fn enabled_keywords(&self) -> IndexSet<String>
Get the keywords which have enabled rules.
Sourcepub async fn add_keyword(
&self,
keyword: String,
) -> Result<(), NotificationSettingsError>
pub async fn add_keyword( &self, keyword: String, ) -> Result<(), NotificationSettingsError>
Sourcepub async fn remove_keyword(
&self,
keyword: &str,
) -> Result<(), NotificationSettingsError>
pub async fn remove_keyword( &self, keyword: &str, ) -> Result<(), NotificationSettingsError>
Trait Implementations§
Source§impl Clone for NotificationSettings
impl Clone for NotificationSettings
Source§fn clone(&self) -> NotificationSettings
fn clone(&self) -> NotificationSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for NotificationSettings
impl !RefUnwindSafe for NotificationSettings
impl Send for NotificationSettings
impl Sync for NotificationSettings
impl Unpin for NotificationSettings
impl !UnwindSafe for NotificationSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more