npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@plasma-platform/service-notifications

v2.0.0

Published

Service Notifications Api

Downloads

75

Readme

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