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
§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