pub struct NotificationClient { /* private fields */ }Expand description
A client specialized for handling push notifications received over the network, for an app.
In particular, it takes care of running a full decryption sync, in case the event in the notification was impossible to decrypt beforehand.
Implementations§
Source§impl NotificationClient
impl NotificationClient
Sourcepub async fn new(
parent_client: Client,
process_setup: NotificationProcessSetup,
) -> Result<Self, Error>
pub async fn new( parent_client: Client, process_setup: NotificationProcessSetup, ) -> Result<Self, Error>
Create a new notification client.
Sourcepub async fn get_notification(
&self,
room_id: &RoomId,
event_id: &EventId,
) -> Result<Option<NotificationItem>, Error>
pub async fn get_notification( &self, room_id: &RoomId, event_id: &EventId, ) -> Result<Option<NotificationItem>, Error>
Fetches the content of a notification.
This will first try to get the notification using a short-lived sliding
sync, and if the sliding-sync can’t find the event, then it’ll use a
/context query to find the event with associated member information.
An error result means that we couldn’t resolve the notification; in that
case, a dummy notification may be displayed instead. A None result
means the notification has been filtered out by the user’s push
rules.
Sourcepub async fn get_notification_with_sliding_sync(
&self,
room_id: &RoomId,
event_id: &EventId,
) -> Result<NotificationStatus, Error>
pub async fn get_notification_with_sliding_sync( &self, room_id: &RoomId, event_id: &EventId, ) -> Result<NotificationStatus, Error>
Get a full notification, given a room id and event id.
This will run a small sliding sync to retrieve the content of the event, along with extra data to form a rich notification context.
Sourcepub async fn get_notification_with_context(
&self,
room_id: &RoomId,
event_id: &EventId,
) -> Result<Option<NotificationItem>, Error>
pub async fn get_notification_with_context( &self, room_id: &RoomId, event_id: &EventId, ) -> Result<Option<NotificationItem>, Error>
Retrieve a notification using a /context query.
This is for clients that are already running other sliding syncs in the same process, so that most of the contextual information for the notification should already be there. In particular, the room containing the event MUST be known (via a sliding sync for invites, or another sliding sync).
An error result means that we couldn’t resolve the notification; in that
case, a dummy notification may be displayed instead. A None result
means the notification has been filtered out by the user’s push
rules.
Auto Trait Implementations§
impl !Freeze for NotificationClient
impl !RefUnwindSafe for NotificationClient
impl Send for NotificationClient
impl Sync for NotificationClient
impl Unpin for NotificationClient
impl !UnwindSafe for NotificationClient
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, 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