Skip to main content

NotificationsApi

Struct NotificationsApi 

Source
pub struct NotificationsApi { /* private fields */ }
Expand description

User notifications

Implementations§

Source§

impl NotificationsApi

Source

pub async fn bulk_delete_notifications( &self, params: &BulkDeleteNotificationsParams, ) -> Result<BulkDeleteNotificationsResponse>

Bulk-purge notifications

Bulk delete. Optional ?scope=read keeps unread items so the operator can’t accidentally wipe pending approvals; default wipes everything.

DELETE /api/v1/notifications

Required scopes: notifications:write.

Source

pub async fn delete(&self, notif_id: &str) -> Result<DeleteNotificationResponse>

Purge a single notification

DELETE /api/v1/notifications/{notifId}

Required scopes: notifications:write.

Source

pub async fn delete_notification_target( &self, target_id: &str, ) -> Result<DeleteNotificationTargetResponse>

Remove a target

DELETE /api/v1/notifications/targets/{targetId}

Required scopes: notifications:write.

Source

pub async fn get_notification_preferences( &self, ) -> Result<NotificationPreferences>

Read the tenant’s notification routing preferences

Returns the stored preferences, or the server defaults (critical → in_app+email, everything else → in_app) when none are stored. Note: email in a channel list only delivers when the tenant also has an email target configured (see POST /notifications/targets).

GET /api/v1/notifications/prefs

Required scopes: notifications:read.

Source

pub async fn get_unread_count(&self) -> Result<GetUnreadCountResponse>

Get unread notification count

GET /api/v1/notifications/unread

Required scopes: notifications:read.

Source

pub async fn list( &self, params: &ListNotificationsParams, ) -> Result<ListNotificationsResponse>

List notifications

GET /api/v1/notifications

Required scopes: notifications:read.

Source

pub async fn list_notification_targets( &self, ) -> Result<ListNotificationTargetsResponse>

List notification targets

Every configured destination, with secrets redacted — see NotificationTarget.

GET /api/v1/notifications/targets

Required scopes: notifications:read.

Source

pub async fn mark_all_notifications_read( &self, ) -> Result<MarkAllNotificationsReadResponse>

Mark all notifications as read

PUT /api/v1/notifications/read-all

Required scopes: notifications:write.

Source

pub async fn mark_notification_read( &self, notif_id: &str, ) -> Result<MarkNotificationReadResponse>

Mark notification as read

PUT /api/v1/notifications/{notifId}/read

Required scopes: notifications:write.

Source

pub async fn replace_notification_preferences( &self, body: &NotificationPreferencesInput, ) -> Result<NotificationPreferences>

Replace the tenant’s notification routing preferences

WRITE SEMANTICS: replaces. An omitted field is stored as omitted (the only way to clear muted_types or drop quiet_hours). tenant_id and updated_at are ignored — the server derives them.

PUT /api/v1/notifications/prefs

Required scopes: notifications:write.

Source

pub fn stream(&self, params: &StreamNotificationsParams) -> EventStream

Open SSE stream of notifications for the tenant

Server-Sent Events push channel. Replaces the 15-second polling loop: every new notification created in the store for the calling tenant is fanned out to all open streams within milliseconds. The first event is event: ready so the client knows the stream is live; comment lines every 20 s keep proxies from killing idle connections.

GET /api/v1/notifications/stream

Required scopes: notifications:read.

Returns a server-sent event stream.

Source

pub async fn test_notification_target( &self, target_id: &str, ) -> Result<TestNotificationTargetResponse>

Send a test notification

Queues one notification through the real fan-out, so it proves the whole path rather than the stored configuration. 200 means queued, not delivered — read last_delivered_at and last_error on the target afterwards for the outcome.

POST /api/v1/notifications/targets/{targetId}/test

Required scopes: notifications:write.

Source

pub async fn upsert_notification_target( &self, body: &UpsertNotificationTargetRequest, ) -> Result<NotificationTarget>

Create or update a target

Upsert, not insert: sending an id rewrites that target. A device target (push or web push) additionally reuses the id of an existing entry for the same device, so a client that re-registers on every launch does not accumulate duplicates.

The answer is the REDACTED target — the signing secret or device token you just sent is not echoed back.

POST /api/v1/notifications/targets

Required scopes: notifications:write.

Trait Implementations§

Source§

impl Clone for NotificationsApi

Source§

fn clone(&self) -> NotificationsApi

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NotificationsApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more