0.0.1 • Published 4 years ago

bold360-client v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Bold360 client

Fetch data from Bold360 API easily

Install

$ yarn install bold360-client

Usage

  • You can authenticate by providing a credentials object
  • You can set the region to either eu or us, default to eu
  • Path must be a string pointing to a valid endpoint
  • Params should be defined as an object where applicable
const { bold360Client } = require('bold360-client');

const credentials = {
	accountId: 11111111, //required
	apiSettingId: 2222222, //required
	apiKey: 'xxxxxx+zzzzzzzz', //required
	region: 'eu' //optional, default `eu`
};

const path = 'getChat';
const params = {
	ChatID: '107984128488260560'
};

const result = await bold360Client(credentials, path, params).then(res => res.json());

Headers

4th argument is the options object for node-fetch. Defaults

const { bold360Client } = require('bold360-client');
const fetch = require('your-module-to-fetch-things');

await bold360Client(credentials, path, params, { method: 'POST' })

Http Client

You can also specify the http client as the 5th argument. That's optional however (if none is passed the default is node-fetch).

const { bold360Client } = require('bold360-client');
const fetch = require('your-module-to-fetch-things');

await bold360Client(credentials, path, params, { method: 'POST' }, fetch)