diff --git a/docs/specs/clients/notify/authentication.md b/docs/specs/clients/notify/authentication.md index d931f882..5673b72c 100644 --- a/docs/specs/clients/notify/authentication.md +++ b/docs/specs/clients/notify/authentication.md @@ -177,6 +177,136 @@ Paginated list of notifications with the most recently sent first. Unread notifi | Tag | 4015 | | Topic | notify topic | +## `wc_notifyNotificationChanged` + +Emitted by the Notify Server when a notification changed state. For example if its read status changed. + +### Request + +- act - `notify_notification_changed` +- iss - did:key of dapp authentication key +- aud - did:key of client identity key +- nfn - array of [Notify Notification](./data-structures.md#notify-notification) + +```typescript +{ + auth: string, +} +``` + +| IRN | | +| ------- | ------------ | +| TTL | 300 | +| Tag | 4018 | +| Topic | notify topic | + +### Response + +- act - `notify_notification_changed_response` +- iss - did:key of client identity key +- ksu - key server for identity key verification +- aud - did:key of dapp authentication key + +```typescript +{ + auth: string, +} +``` + +| IRN | | +| ------- | ------------ | +| TTL | 300 | +| Tag | 4019 | +| Topic | notify topic | + +## `wc_notifyReadNotification` + +Marks a notification as read. + +### Request + +- act - `notify_read_notification` +- iss - did:key of client identity key +- ksu - key server for identity key verification +- aud - did:key of dapp authentication key +- app - did:web of app domain that this request is associated with + - Example: `did:web:app.example.com` +- ids - array of notification IDs to mark as read, max 1000 items + +```typescript +{ + auth: string, +} +``` + +| IRN | | +| ------- | ------------ | +| TTL | 300 | +| Tag | 4020 | +| Topic | notify topic | + +### Response + +- act - `notify_read_notification_response` +- iss - did:key of dapp authentication key +- aud - did:key of client identity key + +```typescript +{ + auth: string, +} +``` + +| IRN | | +| ------- | ------------ | +| TTL | 300 | +| Tag | 4021 | +| Topic | notify topic | + +## `wc_notifyGetUnreadNotificationsCount` + +Returns a count of how many notifications are unread. Useful to implement unread notification counters, without needing to go through `O(n)` round trips of pages to count the total client-side. + +### Request + +- act - `notify_get_unread_notifications_count` +- iss - did:key of client identity key +- ksu - key server for identity key verification +- aud - did:key of dapp authentication key +- app - did:web of app domain that this request is associated with + - Example: `did:web:app.example.com` + +```typescript +{ + auth: string, +} +``` + +| IRN | | +| ------- | ------------ | +| TTL | 300 | +| Tag | 4022 | +| Topic | notify topic | + +### Response + +- act - `notify_get_unread_notifications_count_response` +- iss - did:key of dapp authentication key +- aud - did:key of client identity key +- cnt - number of unread notifications + +```typescript +{ + auth: string, +} +``` + +| IRN | | +| ------- | ------------ | +| TTL | 300 | +| Tag | 4023 | +| Topic | notify topic | + ## Noop Noop message sent by the Notify Server after subscription creation to mark a topic as long-lived so the relay does not destroy it. Clients should ignore this message. diff --git a/docs/specs/clients/notify/client-sdk-api.md b/docs/specs/clients/notify/client-sdk-api.md index 3ec0d020..e17e41b2 100644 --- a/docs/specs/clients/notify/client-sdk-api.md +++ b/docs/specs/clients/notify/client-sdk-api.md @@ -43,9 +43,12 @@ abstract class Client { // Default 10, max 50 limit?: number, startingAfter?: string, + // Default false + unreadFirst?: string, }): Promise<{ notifications: NotifyNotificationRecord[], hasMore: boolean, + hasMoreUnread: boolean, }> // get notification by ID diff --git a/docs/specs/clients/notify/data-structures.md b/docs/specs/clients/notify/data-structures.md index afccf24f..177c7534 100644 --- a/docs/specs/clients/notify/data-structures.md +++ b/docs/specs/clients/notify/data-structures.md @@ -34,6 +34,8 @@ icon: string, // Redirect URL for call-to-action related to notification. If empty, do not redirect url: string, + // If the notification was read or not + read: boolean, } ```