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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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