pub struct NotificationClient<'a, T: Transport, A: AuthProvider> { /* private fields */ }Expand description
Client for interacting with Nextcloud’s Notifications API (v2).
Executes calls through any Transport and applies credentials via an AuthProvider.
Both are held by reference, allowing the client to be freely cloned or borrowed across
tasks without runtime dispatch or connection pooling overhead.
All endpoints interact with /ocs/v2.php/apps/notifications/api/v2/notifications.
See the Nextcloud Notifications API v2 documentation and Nextcloud Developer Manual OCS Overview.
Implementations§
Source§impl<'a, T: Transport, A: AuthProvider> NotificationClient<'a, T, A>
impl<'a, T: Transport, A: AuthProvider> NotificationClient<'a, T, A>
Sourcepub const fn new(transport: &'a T, auth: &'a A) -> Self
pub const fn new(transport: &'a T, auth: &'a A) -> Self
Binds a notification client to a transport and credential provider.
Sourcepub async fn list(&self) -> Result<Vec<Notification>, Error>
pub async fn list(&self) -> Result<Vec<Notification>, Error>
Lists all notifications for the authenticated user.
Sends GET /ocs/v2.php/apps/notifications/api/v2/notifications.
Returns an empty list when no notifications exist, or when the server responds
with 204 No Content indicating polling should be reduced.
Sourcepub async fn get(&self, notification_id: u64) -> Result<Notification, Error>
pub async fn get(&self, notification_id: u64) -> Result<Notification, Error>
Retrieves a single notification by its notification_id.
Sends GET /ocs/v2.php/apps/notifications/api/v2/notifications/{id}.
Sourcepub async fn delete(&self, notification_id: u64) -> Result<(), Error>
pub async fn delete(&self, notification_id: u64) -> Result<(), Error>
Deletes/dismisses a single notification by its notification_id.
Sends DELETE /ocs/v2.php/apps/notifications/api/v2/notifications/{id}.
Sourcepub async fn delete_all(&self) -> Result<(), Error>
pub async fn delete_all(&self) -> Result<(), Error>
Deletes/dismisses all notifications for the authenticated user.
Sends DELETE /ocs/v2.php/apps/notifications/api/v2/notifications.