js-bao-wss-client / NotificationsAPI
Interface: NotificationsAPI
Sub-API for the notification inbox (client.notifications.*).
Inbox reads/writes act on the signed-in user's own notifications. send() requires app admin permission. Live updates arrive as the notification client event (client.on("notification", ...)).
Methods
list()
list(
options?):Promise<NotificationListResult>
List the caller's notifications, newest first.
Parameters
options?
Returns
Promise<NotificationListResult>
listDevices()
listDevices():
Promise<{items:PushDeviceInfo[]; }>
List the calling user's registered push devices.
Returns
Promise<{ items: PushDeviceInfo[]; }>
markAllRead()
markAllRead():
Promise<{updated:number; }>
Mark all of the caller's notifications as read.
Returns
Promise<{ updated: number; }>
markRead()
markRead(
notificationId):Promise<NotificationInfo>
Mark one of the caller's notifications as read.
Parameters
notificationId
string
Returns
Promise<NotificationInfo>
registerDevice()
registerDevice(
params):Promise<PushDeviceInfo>
Register (upsert) the calling user's device push token.
Parameters
params
Returns
Promise<PushDeviceInfo>
send()
send(
params):Promise<{deduplicated?:boolean;deduplicatedChannels?:string[];results:NotificationSendResult[]; }>
Send a notification to an app user (requires app admin permission).
Parameters
params
Returns
Promise<{ deduplicated?: boolean; deduplicatedChannels?: string[]; results: NotificationSendResult[]; }>
unreadCount()
unreadCount():
Promise<{unreadCount:number; }>
Count the caller's unread notifications.
Returns
Promise<{ unreadCount: number; }>
unregisterDevice()
unregisterDevice(
token):Promise<{deleted:boolean; }>
Unregister one of the calling user's device push tokens (e.g. on logout).
Parameters
token
string
Returns
Promise<{ deleted: boolean; }>