@plasma-platform/service-api

Common tm microservice api methods

Usage no npm install needed!

<script type="module">
  import plasmaPlatformServiceApi from 'https://cdn.skypack.dev/@plasma-platform/service-api';
</script>

README

version nextVersion downloads license dependency


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

Short documentation

Table of Contents

TMMicroServiceAPI

TM Micro Service Proto API

Parameters

  • url string service url
  • token (string | null) user access token if available (optional, default null)

url

Service URL

Properties

token

User access token

Properties

  • token (string | null)? user access token if available

timeOut

timeOut for request

Properties

timeOutObjects

timeOutObjects container for timeouts

Properties

  • timeOut object? container for timeouts

messages

Object with class service messages

Type: Object

setUrl

Set url

Parameters

setToken

Set access token

Parameters

setTimeOut

Set timeOut

Parameters

  • milliseconds integer milliseconds time

setVersion

Set service version

Parameters

  • version string service version

checkVersion

Validate service version

Parameters

  • version string service version

  • Throws Error if URL do not match format Error will be thrown

Returns string version - service version

request

Fetch remote resource

Parameters

  • url string resource url
  • userOptions Object user defined options

Returns Promise Promise with server Response

tmpVersion

Service version

Properties

  • version string? service version

ErrorNotFound

Custom error message for Not Found server response

Parameters

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

ErrorServerResponse

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)

ErrorBadRequest

Custom error message for Bad Request server response

Parameters

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