pub struct NotificationsApi { /* private fields */ }Expand description
User notifications
Implementations§
Source§impl NotificationsApi
impl NotificationsApi
Sourcepub async fn bulk_delete_notifications(
&self,
params: &BulkDeleteNotificationsParams,
) -> Result<BulkDeleteNotificationsResponse>
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.
Sourcepub async fn delete(&self, notif_id: &str) -> Result<DeleteNotificationResponse>
pub async fn delete(&self, notif_id: &str) -> Result<DeleteNotificationResponse>
Purge a single notification
DELETE /api/v1/notifications/{notifId}
Required scopes: notifications:write.
Sourcepub async fn delete_notification_target(
&self,
target_id: &str,
) -> Result<DeleteNotificationTargetResponse>
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.
Sourcepub async fn get_notification_preferences(
&self,
) -> Result<NotificationPreferences>
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.
Sourcepub async fn get_unread_count(&self) -> Result<GetUnreadCountResponse>
pub async fn get_unread_count(&self) -> Result<GetUnreadCountResponse>
Get unread notification count
GET /api/v1/notifications/unread
Required scopes: notifications:read.
Sourcepub async fn list(
&self,
params: &ListNotificationsParams,
) -> Result<ListNotificationsResponse>
pub async fn list( &self, params: &ListNotificationsParams, ) -> Result<ListNotificationsResponse>
List notifications
GET /api/v1/notifications
Required scopes: notifications:read.
Sourcepub async fn list_notification_targets(
&self,
) -> Result<ListNotificationTargetsResponse>
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.
Sourcepub async fn mark_all_notifications_read(
&self,
) -> Result<MarkAllNotificationsReadResponse>
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.
Sourcepub async fn mark_notification_read(
&self,
notif_id: &str,
) -> Result<MarkNotificationReadResponse>
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.
Sourcepub async fn replace_notification_preferences(
&self,
body: &NotificationPreferencesInput,
) -> Result<NotificationPreferences>
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.
Sourcepub fn stream(&self, params: &StreamNotificationsParams) -> EventStream
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.
Sourcepub async fn test_notification_target(
&self,
target_id: &str,
) -> Result<TestNotificationTargetResponse>
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.
Sourcepub async fn upsert_notification_target(
&self,
body: &UpsertNotificationTargetRequest,
) -> Result<NotificationTarget>
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
impl Clone for NotificationsApi
Source§fn clone(&self) -> NotificationsApi
fn clone(&self) -> NotificationsApi
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more