magicbell
Version:
MagicBell API wrapper
127 lines • 4.45 kB
JavaScript
// This file is generated. Do not update manually!
import { Resource } from '../client/resource.js';
export class Notifications extends Resource {
path = 'notifications';
entity = 'notification';
/**
* Mark a user notification as archived.
*
* @param notificationId - ID of the user notification.
* The ID of a user notification can be obtained from the "Fetch user
* notifications" API endpoint or from push events sent to the MagicBell React
* library.
*
* @param options - override client request options.
**/
archive(notificationId, options) {
return this.request({
method: 'POST',
path: '{notification_id}/archive',
}, notificationId, options);
}
markAllRead(dataOrOptions, options) {
return this.request({
method: 'POST',
path: 'read',
}, dataOrOptions, options);
}
markAllSeen(dataOrOptions, options) {
return this.request({
method: 'POST',
path: 'seen',
}, dataOrOptions, options);
}
/**
* Mark a user notification as read. The notification will be automatically marked
* as seen, too.
*
* The new state will be reflected in the user's notification inbox in real-time.
*
* @param notificationId - ID of the user notification.
* The ID of a user notification can be obtained from the "Fetch user
* notifications" API endpoint or from push events sent to the MagicBell React
* library.
*
* @param options - override client request options.
**/
markAsRead(notificationId, options) {
return this.request({
method: 'POST',
path: '{notification_id}/read',
}, notificationId, options);
}
/**
* Mark a user notification as unread. The new state will be reflected in the
* user's notification inbox in real-time.
*
* @param notificationId - ID of the user notification.
* The ID of a user notification can be obtained from the "Fetch user
* notifications" API endpoint or from push events sent to the MagicBell React
* library.
*
* @param options - override client request options.
**/
markAsUnread(notificationId, options) {
return this.request({
method: 'POST',
path: '{notification_id}/unread',
}, notificationId, options);
}
list(dataOrOptions, options) {
return this.request({
method: 'GET',
paged: true,
}, dataOrOptions, options);
}
/**
* Fetch a user's notification by its ID.
*
* @param notificationId - ID of the user notification.
* The ID of a user notification can be obtained from the "Fetch user
* notifications" API endpoint or from push events sent to the MagicBell React
* library.
*
* @param options - override client request options.
* @returns
**/
get(notificationId, options) {
return this.request({
method: 'GET',
path: '{notification_id}',
}, notificationId, options);
}
/**
* Delete a user's notification by its ID. The notification is deleted immediately
* and removed from the user's notification inbox in real-time.
*
* @param notificationId - ID of the user notification.
* The ID of a user notification can be obtained from the "Fetch user
* notifications" API endpoint or from push events sent to the MagicBell React
* library.
*
* @param options - override client request options.
**/
delete(notificationId, options) {
return this.request({
method: 'DELETE',
path: '{notification_id}',
}, notificationId, options);
}
/**
* Mark a user notification as unarchived.
*
* @param notificationId - ID of the user notification.
* The ID of a user notification can be obtained from the "Fetch user
* notifications" API endpoint or from push events sent to the MagicBell React
* library.
*
* @param options - override client request options.
**/
unarchive(notificationId, options) {
return this.request({
method: 'DELETE',
path: '{notification_id}/archive',
}, notificationId, options);
}
}
//# sourceMappingURL=notifications.js.map