Class

RESTClient

RESTClient(options)

This is an example REST Client. It could use axios to connect with the backend API.

Constructor

# new RESTClient(options)

Parameters:
Name Type Attributes Default Description
options Object
apiVersion Number <optional>
2

version of the API

token String

authentication token

See:

View Source services/rest-client.js, line 20

Examples

Using the client library

const client = new RESTClient({ token: 'myToken' })
const records = await client.getSomeRecords(resourceId)

Hitting a different API version

const client = new RESTClient({ token: 'myToken', apiVersion: 1 })

Methods

# async getSomeRecords(mainKey) → {Promise.<Array.<RESTClient~Record>>}

This could be a function returning data from the REST API. It returns a newly created type: RESTClient~Record

Parameters:
Name Type Description
mainKey String

Example property which serves as a key in the records lookup process

View Source services/rest-client.js, line 42

Promise.<Array.<RESTClient~Record>>

Type Definitions

Object

# Record

You can even define your own types in JSDoc

Properties:
Name Type Description
first String

Some example property

another String

Another property

View Source services/rest-client.js, line 24