Methods
(static) deleteNotification(notificationId) → {Promise.<any>}
Description:
Deletes a specific notification.
Source:
Example
deleteNotification(123)
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
Name
Type
Description
notificationId
number
The ID of the notification to delete.
Throws:
- Throws an error if notificationId is not provided.
Type
Error
Returns:
- A promise that resolves when the notification is successfully deleted.
Type
Promise.<any>
(static) fetchLiveEventPollingState()
Description:
Fetches the current live event polling state.
+ @returns {Promise} - Promise resolving to the polling state
Source:
(static) fetchNotificationSettings() → {Promise.<Object>}
Description:
Fetches the notification settings for the current user grouped by brand.
Source:
Example
fetchNotificationSetting()
.then(settings => {
console.log(settings);
})
.catch(error => {
console.error(error);
});
Returns:
A promise that resolves to an object where keys are brands and values are arrays of settings objects.
Type
Promise.<Object>
(static) fetchNotifications(optionsopt ) → {Promise.<Array.<Object>>}
Description:
Fetches notifications for a given brand with optional filters for unread status and limit.
Source:
Example
fetchNotifications({ limit: 5, onlyUnread: true, page: 2 })
.then(notifications => console.log(notifications))
.catch(error => console.error(error));
Parameters:
Name
Type
Attributes
Default
Description
options
Object
<optional>
{}
Options for fetching notifications.
Properties
Name
Type
Attributes
Default
Description
limit
number
<optional>
10
The maximum number of notifications to fetch.
page
number
<optional>
1
The page number for pagination.
onlyUnread
boolean
<optional>
false
Whether to fetch only unread notifications. If true, adds `unread=1` to the query.
Throws:
- Throws an error if the brand is not provided.
Type
Error
Returns:
- A promise that resolves to an array of notifications.
Type
Promise.<Array.<Object>>
(static) fetchUnreadCount(optionsopt ) → {Promise.<Object>}
Description:
Fetches the count of unread notifications for the current user in a given brand context.
This function first checks for standard unread notifications. If none are found,
it checks if live event polling is active. If so, it will query for any ongoing live events.
If a live event is active, it counts as an unread item.
Source:
Example
fetchUnreadCount({ brand: 'drumeo' })
.then(data => console.log(data.data)) // 0 or 1
.catch(error => console.error(error));
Parameters:
Name
Type
Attributes
Default
Description
options
Object
<optional>
{}
Options for fetching unread count.
Properties
Name
Type
Description
brand
string
The brand to filter unread notifications by. Defaults to 'drumeo'.
Throws:
If the brand is not provided or if network requests fail.
Type
Error
Returns:
- A promise that resolves to an object with a `data` property indicating the unread count (0 or 1).
Type
Promise.<Object>
(static) markAllNotificationsAsRead(brandopt ) → {Promise.<Object>}
Description:
Marks all notifications as read for the current user.
This also pauses live event polling if there is an active event, to prevent immediate re-polling.
Source:
Parameters:
Name
Type
Attributes
Default
Description
brand
string
<optional>
'drumeo'
The brand context for live event handling before marking notifications.
Returns:
- A promise resolving to the API response from the notifications read endpoint.
Type
Promise.<Object>
(static) markNotificationAsRead(notificationId) → {Promise.<any>}
Description:
Marks a specific notification as read.
Source:
Example
markNotificationAsRead(123)
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
Name
Type
Description
notificationId
number
The ID of the notification to mark as read.
Throws:
- Throws an error if notificationId is not provided.
Type
Error
Returns:
- A promise that resolves when the notification is successfully marked as read.
Type
Promise.<any>
(static) markNotificationAsUnread(notificationId) → {Promise.<any>}
Description:
Marks a specific notification as unread.
Source:
Example
markNotificationAsUnread(123)
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
Name
Type
Description
notificationId
number
The ID of the notification to mark as unread.
Throws:
- Throws an error if notificationId is not provided.
Type
Error
Returns:
- A promise that resolves when the notification is successfully marked as unread.
Type
Promise.<any>
(static) pauseLiveEventPolling(brandopt ) → {Promise.<Object>}
Description:
Pauses live event polling for the current user based on the live event end time.
If a live event is active, polling will be paused until its end time. If no live event is found,
polling is not paused.
Source:
Parameters:
Name
Type
Attributes
Default
Description
brand
string
<optional>
'drumeo'
The brand context to fetch live event data for.
Returns:
- A promise resolving to the API response from the pause polling endpoint.
Type
Promise.<Object>
(static) restoreNotification(notificationId) → {Promise.<any>}
Description:
Restores a specific notification.
Source:
Example
restoreNotification(123)
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
Name
Type
Description
notificationId
number
The ID of the notification to restore.
Throws:
- Throws an error if notificationId is not provided.
Type
Error
Returns:
- A promise that resolves when the notification is successfully restored.
Type
Promise.<any>
(static) startLiveEventPolling() → {Promise.<Object>}
Description:
Start live event polling.
Source:
Returns:
- Promise resolving to the API response
Type
Promise.<Object>
(static) updateNotificationSetting(options) → {Promise.<Object>}
Description:
Updates notification settings for specified channels within a given brand.
Source:
Example
updateNotificationSetting({
brand: 'drumeo',
settingName: 'new_lesson',
email: true,
push: false,
bell: true
})
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
Name
Type
Description
options
Object
Options to update notification settings.
Properties
Name
Type
Attributes
Description
brand
string
The brand context for the notification settings.
settingName
string
The name of the notification setting to update (required).
email
boolean
<optional>
Whether email notifications are enabled or disabled.
push
boolean
<optional>
Whether push notifications are enabled or disabled.
bell
boolean
<optional>
Whether bell notifications are enabled or disabled.
Throws:
Throws an error if `settingName` is not provided or if no channels are specified.
Type
Error
Returns:
- A promise that resolves to the server response after updating settings.
Type
Promise.<Object>