@plasma-platform/tm-centrifuge

0.5.0 • Public • Published

TM Micro Service API Prototype class

This class provide fetch wrapper, token and Service URL setter mainly. Just to avoid code duplication.

Requirements

Possibly you will need babel-polyfill to use it.

Documentation

ErrorBadRequest

Extends Error

Custom error message for Bad Request server response

Parameters

  • message (string | null) error details (optional, default null)

constructor

Constructor generates errorinstance

Parameters

  • message (string | null) error details (optional, default null)

Returns ErrorBadRequest current instance

ErrorCentrifuge

Extends Error

Custom error message for abstract server response

Parameters

  • statusCode number http status code
  • statusText string http status code text
  • message (string | null) error details (optional, default null)

constructor

Constructor generates error instance

Parameters

  • statusCode number http status code
  • statusText string http status code text
  • message (string | null) error details (optional, default null)

Returns ErrorCentrifuge current instance

ErrorServerResponse

Extends Error

Custom error message for abstract server response

Parameters

  • statusCode number http status code
  • statusText string http status code text
  • message (string | null) error details (optional, default null)

constructor

Constructor generates error instance

Parameters

  • statusCode number http status code
  • statusText string http status code text
  • message (string | null) error details (optional, default null)

Returns ErrorServerResponse current instance

TMCentrifuge

TM Interface to Centrifuge

Parameters

  • options
  • url string service url

constructor

Constructor saves service url

Parameters

  • options string centrifuge options
    • options.url string centrifuge url
    • options.timestamp string timestamp to sync instances in seconds, you set it up before get centrifuge token
    • options.token string centrifuge token from backend
    • options.user string may contain different values — user or card id, for example

Returns TMCentrifuge centrifuge instance

Package Sidebar

Install

npm i @plasma-platform/tm-centrifuge

Weekly Downloads

1

Version

0.5.0

License

CC-BY-4.0

Unpacked Size

1.59 MB

Total Files

42

Last publish

Collaborators

  • alienmonster
  • ch-tm
  • viram