UNPKG

projectmanager-sdk

Version:

Software development kit for the ProjectManager.com API. for TypeScript

136 lines 6.61 kB
/** * ProjectManager API for TypeScript * * (c) ProjectManager.com, Inc. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @author ProjectManager.com <support@projectmanager.com> * @copyright ProjectManager.com, Inc. * @link https://github.com/projectmgr/projectmanager-sdk-typescript */ export class NotificationClient { client; /** * Internal constructor for this client library */ constructor(client) { this.client = client; } /** * Retrieve the most recent notifications for the current user, along with the amount of notifications. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * * This API retrieves 500 notifications at a time. To fetch more than 500 notifications, repeat this API call * using the parameter `lastId` of the oldest notification from each batch to fetch the next 500 notifications. * * @param lastId To continue loading more notifications in a series of requests, provide the ID of the oldest notification from the currently loaded batch as the `lastId` parameter * @param senderId Filter the notifications to only those sent by the user with the specified ID * @param notificationTypes Specifies the types of notifications to return. If not provided, all notifications will be returned. * @param asFlatList If set to true all notifications will be returned as a flat list, otherwise they will be grouped by parent in the same manner as displayed in the UI. */ retrieveNotifications(lastId, senderId, notificationTypes, asFlatList) { const url = `/api/data/notifications`; const options = { params: { 'lastId': lastId, 'senderId': senderId, 'notificationTypes': notificationTypes, 'asFlatList': asFlatList, }, }; return this.client.request("get", url, options, null); } /** * Retrieve the total count of pending notifications for the current user. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * */ notificationCount() { const url = `/api/data/notifications/count`; return this.client.request("get", url, null, null); } /** * Retrieve the count of unread notifications for the current user. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * */ unreadNotificationCount() { const url = `/api/data/notifications/unreadcount`; return this.client.request("get", url, null, null); } /** * Delete all pending notifications for the current user. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * */ deleteAllNotifications() { const url = `/api/data/notifications/deleteall`; return this.client.request("delete", url, null, null); } /** * Marks a pending notification as read. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * * @param id The unique identifier of the notification to mark read */ markNotificationRead(id) { const url = `/api/data/notifications/${id}/markread`; return this.client.request("post", url, null, null); } /** * Marks all pending notification for the current user as read. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * */ readAllNotifications() { const url = `/api/data/notifications/markallread`; return this.client.request("post", url, null, null); } /** * Deletes a pending notification that is no longer wanted. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * * @param id The unique identifier of the notification to mark read */ deleteNotification(id) { const url = `/api/data/notifications/delete/${id}`; return this.client.request("delete", url, null, null); } /** * Marks a pending notification as unread. * * A notification represents a message sent to a user to inform them of relevant actions or events within their * workspace. Notifications are ephemeral and may be deleted when they are no longer needed. When a user has more * than 1,000 pending notifications some old notifications will be deleted automatically. * * @param id The unique identifier of the notification to mark read */ markNotificationUnread(id) { const url = `/api/data/notifications/${id}/markunread`; return this.client.request("post", url, null, null); } } //# sourceMappingURL=NotificationClient.js.map