@plasma-platform/service-notifications

2.0.0 • Public • Published

version nextVersion downloads license dependency


Full documentation
install:
npm i @plasma-platform/service-notifications -S

Short documentation

Table of Contents

NotificationsService

messages

object with class service messages

Type: object

getResourceToken

Subscription - Get system centrifugo token based on resource id

Parameters

  • params Object
    • params.resourceId string Resource ID (orderId for example) (required)
    • params.timestamp number UNIX Timestamp (required)
    • params.prefix string prefix for centrifuge

Examples

Get membership plan info by ID

(async () => {
  const service = new NotificationsService(url);
  const response = await service.getResourceToken(params);
})();

Returns Promise<Object> Promise object represents info

getUserToken

Subscription - Get user token

Parameters

  • timestamp number UNIX Timestamp (required)

Examples

Get membership plan info by ID

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.getUserToken(timestamp);
})();

Returns Promise<Object> Promise object represents info

addNewNotification

Notification - Add new notification

Parameters

  • params Object
    • params.user_id string ID of the user for whom notification have been created (required)
    • params.content string Notification html code (required)
    • params.subject string Notification subject (required)
    • params.params string JSON object with parameters of notification (type, etc.) (required)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.addNewNotification(params);
})();

Returns Promise<Object> Promise object

deleteNotificationByProperty

Notification - Delete notification by property

Parameters

  • params Object
    • params.propertyName string Notification param property name (required)
    • params.propertyValue string Notification param property value (required)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.deleteNotificationByProperty(params);
})();

Returns Promise<Object> Promise object

deleteNotification

Notification - Delete notification

Parameters

  • id string Notification unique ID (required)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.deleteNotification(params);
})();

Returns Promise<Object> Promise object

eventsListenerEndpoint

Notification - Events listener endpoint

Parameters

  • params Object
    • params.user_id string ID of the user for whom notification have been created (required)
    • params.event string Event name (required)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.eventsListenerEndpoint(params);
})();

Returns Promise<Object> Promise object

getAllowedMethodsForNotification

Notification - Get Allowed methods for Notification API

Examples

(async () => {
  const service = new NotificationsService(url);
  const response = await service.getAllowedMethodsForNotification();
})();

Returns Promise<Object> Promise object

getListOfNotifications

Notification - Get list of notifications

Parameters

  • params Object
    • params.perPage string Number of notifications per one page (optional)
    • params.page string Page number (optional)
    • params.is_viewed string 0: find not viewed notifications, 1: find viewed notifications. Allowed values: 0, 1 (optional)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.getListOfNotifications(params);
})();

Returns Promise<Object> Promise object

getPaginationHeaders

Notification - Get pagination headers

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.getPaginationHeaders(params);
})();

Returns Promise<Object> Promise object

modifyNotification

Notification - Modify notification

Parameters

  • params Object
    • params.id string Notification unique ID (required)
    • params.viewed_at string Time when notification was viewed (required)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.modifyNotification(params);
})();

Returns Promise<Object> Promise object

viewSingleNotification

Notification - View single notification

Parameters

  • id string Notification unique ID (required)

Examples

(async () => {
  const service = new NotificationsService(url, token);
  const response = await service.viewSingleNotification(id);
})();

Returns Promise<Object> Promise object

Package Sidebar

Install

npm i @plasma-platform/service-notifications

Weekly Downloads

3

Version

2.0.0

License

CC-BY-4.0

Unpacked Size

67.5 kB

Total Files

6

Last publish

Collaborators

  • alienmonster
  • ch-tm
  • viram