### @plasma-platform/tm-service-api

`2.0.15`
Need help reading this?

### ErrorBadRequest

Custom error message for Bad Request server response

new ErrorBadRequest(message: (string | null))

Extends Error

Parameters
message `((string | null) = `null`)` error details
Static Members
▸ new constructor(message)

Constructor generates errorinstance

new constructor(message: (string | null)): ErrorBadRequest
Parameters
message `((string | null) = `null`)` error details
Returns
`ErrorBadRequest`: current instance

### ErrorCache

Custom error message for cache fail

new ErrorCache(message: (string | null))

Extends Error

Parameters
message `((string | null) = `null`)` error details
Static Members
▸ new constructor(message)

Constructor generates error instance

new constructor(message: (string | null)): ErrorCache
Parameters
message `((string | null) = `null`)` error details
Returns
`ErrorCache`: current instance

### ErrorNotFound

Custom error message for Not Found server response

new ErrorNotFound(message: (string | null))

Extends Error

Parameters
message `((string | null) = `null`)` error details
Static Members
▸ new constructor(message)

Constructor generates error instance

new constructor(message: (string | null)): ErrorNotFound
Parameters
message `((string | null) = `null`)` error details
Returns
`ErrorNotFound`: current instance

### ErrorServerResponse

Custom error message for abstract server response

new ErrorServerResponse(statusCode: number, statusText: string, message: (string | null))

Extends Error

Parameters
statusCode `(number)` http status code
statusText `(string)` http status code text
message `((string | null) = `null`)` error details
Static Members
▸ new constructor(statusCode, statusText, message)

Constructor generates error instance

new constructor(statusCode: number, statusText: string, message: (string | null)): ErrorServerResponse
Parameters
statusCode `(number)` http status code
statusText `(string)` http status code text
message `((string | null) = `null`)` error details
Returns
`ErrorServerResponse`: current instance

### TMMicroServiceAPI

TM Micro Service Proto API

new TMMicroServiceAPI(url: string, token: (string | null))
Parameters
url `(string)` service url
token `((string | null) = `null`)` user access tocken if available
Static Members
▸ new constructor(url, token, version)

Constructor saves service url

new constructor(url: string, token: (string | null), version: string): TMMicroServiceAPI
Parameters
url `(string)` service url
token `((string | null) = `null`)` user access tocken if available
version `(string = `'v1'`)` service version
Returns
`TMMicroServiceAPI`: current instance
▸ messages

Object with class service messages

messages
▸ setToken(token)

Set access token

setToken(token: string)
Parameters
token `(string)` access token
▸ setVersion(version)

Set service version

setVersion(version: string)
Parameters
version `(string)` service version
▸ checkVersion(version)

Validate service version

checkVersion(version: string): string
Parameters
version `(string)` service version
Returns
`string`: version - service version
Throws

- Error: if URL do not match format Error will be thrown

▸ request(url, userOptions)

Fetch remote resource

request(url: string, userOptions: Object): Promise
Parameters
url `(string)` resource url
userOptions `(Object)` user defined options
Returns
`Promise`: Promise with server Response
Instance Members
▸ url

Service URL

url
Properties
service `(string)` : url
▸ token

User access token

token
Properties
token `((string | null)?)` : user access tocken if available

### tmpVersion

Service version

tmpVersion
Properties
version `(string?)` : service version