Interface: INotificationClient
notification.types.INotificationClient
Methods
deleteNotifications
▸ deleteNotifications(notifications
): Promise
<void
>
Tells the service to perform the delete actions on the notification(s)
throws
Error If no error is thrown the service has received the notifications successfully
Parameters
Name | Type | Description |
---|---|---|
notifications | INotification [] | Array of notifications |
Returns
Promise
<void
>
fetchHistory
▸ fetchHistory(options?
, filter?
): Promise
<INotification
[]>
Used by UI components that need to display a list of historical notifications.
throws
Error
Parameters
Name | Type | Description |
---|---|---|
options? | string | INotificationHistoryOptions | ISO8601 formatted string to fetch notifications from. |
filter? | IFilter | to match to notifications. |
Returns
Promise
<INotification
[]>
array of notifications.
getLastIssuedAt
▸ getLastIssuedAt(source?
): Promise
<string
>
Return an ISO8601 formatted date a notification matching the specified source was issued.
throws
Error
Parameters
Name | Type | Description |
---|---|---|
source? | string | identify which notification to save lastUpdated time for. |
Returns
Promise
<string
>
last issued at date string in the ISO8601 date format.
getMuteFilters
▸ getMuteFilters(): Promise
<IMuteFilter
[]>
Gets the current mute filters for Notification sources in Finsemble.
Returns
Promise
<IMuteFilter
[]>
an arrray with all the mute filters.
getPreferences
▸ getPreferences(): Promise
<Object
>
Gets the current notifications preferences object. It tries to load the configs saved in the user preferences and will fallback to config/schema defaults if none are present.
Returns
Promise
<Object
>
The notification preferences object.
getSources
▸ getSources(): Promise
<string
[]>
Gets the available notification sources in Finsemble.
Returns
Promise
<string
[]>
A string array with all the configured sources in Finsemble.
mute
▸ mute(filter
): Promise
<void
>
Sets the user preference on which notifications to mute. All future notifications that match the filter will have the mute flag set to true
throws
Error If no error is thrown the service has performed the mute successfully.
Parameters
Name | Type | Description |
---|---|---|
filter | IMuteFilter | IMuteFilter [] | Notifications to apply action to. |
Returns
Promise
<void
>
notify
▸ notify(notifications
): Promise
<void
>
Creates or updates notifications in Finsemble.
throws
Error If no error is thrown the service has received the notifications successfully
Parameters
Name | Type | Description |
---|---|---|
notifications | INotification | INotification [] | Array of INotification |
Returns
Promise
<void
>
performAction
▸ performAction(notifications
, action
): Promise
<void
>
Tells the service to perform the action on the notification(s)
throws
Error If no error is thrown the service has received the request to perform the action successfully. Note a successful resolution of the promise does not mean successful completion of the action.
Parameters
Name | Type | Description |
---|---|---|
notifications | INotification [] | Notifications to apply action to. |
action | IAction | which has been triggered by user. |
Returns
Promise
<void
>
subscribe
▸ subscribe(subscription
, onSubscriptionSuccess
, onSubscriptionFault
): Promise
<string
>
Subscribe to a notification stream given a set of name/value pair filters. Returns subscriptionId
throws
Error
Parameters
Name | Type | Description |
---|---|---|
subscription | ISubscription | with name value pair used to match on. |
onSubscriptionSuccess | Function | called when subscription is successfully created. |
onSubscriptionFault | Function | if there is an error creating the subscription. |
Returns
Promise
<string
>
unmute
▸ unmute(filter
): Promise
<void
>
Sets the filter preference on which muted notifications to unmute. All future notifications that match the filter will have the mute flag set to false
throws
Error If no error is thrown the service has performed the unmute successfully.
Parameters
Name | Type | Description |
---|---|---|
filter | IMuteFilter | IMuteFilter [] | Notifications to apply action to. |
Returns
Promise
<void
>
unsubscribe
▸ unsubscribe(subscriptionId
): Promise
<void
>
Used to unsubscribe to a notification stream.
throws
Error
Parameters
Name | Type | Description |
---|---|---|
subscriptionId | string | which was returned when subscription was created. |
Returns
Promise
<void
>