NotificationServer

NotificationServer

Facilitates interaction with the Notifications server.

Constructor

new NotificationServer(sdk, serverUrl, opts)

Create a new Notifications server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

Notifications URL.

opts Object
Name Type Attributes Default Description
allowHttp boolean <optional>

Allow connecting to http servers, default: false. This must be set to false in production deployments!

proxy Object <optional>

Proxy configuration. Look axios docs for more info

httpBasicAuth Object <optional>

HTTP basic auth credentials. Look axios docs for more info.

customHeaders Object <optional>

Custom headers for request.

withCredentials boolean <optional>

Indicates whether or not cross-site Access-Control requests should be made using credentials.

responseType string <optional>
'json'

Indicates the type of data that the server will respond with options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'.

Members

types :NotificationTypes

Available notification types.

Source:
Type:

Methods

(async) getAll(optsopt) → {Promise.<JsonApiResponse>}

Get all notifications.

Source:
Parameters:
Name Type Attributes Description
opts object <optional>

Request options.

Name Type Attributes Description
sort string <optional>

Sort mode.

Returns:
Type:
Promise.<JsonApiResponse>

(async) getCounters() → {Promise.<JsonApiResponse>}

Get notification counters.

Source:
Returns:
Type:
Promise.<JsonApiResponse>

(async) markAsSeen(id) → {Promise.<JsonApiResponse>}

Mark some type of notifications as seen.

Source:
Parameters:
Name Type Description
id string

ID of the notification to mark as seen.

Returns:
Type:
Promise.<JsonApiResponse>

(async) markAsSeenBulk(ids) → {Promise.<JsonApiResponse>}

Mark an array of notifications as seen.

Source:
Parameters:
Name Type Description
ids Array.<string>

IDs of the notifications to mark as seen.

Returns:
Type:
Promise.<JsonApiResponse>