@dtone/dvs

DT One DVS SDK for Node.js


Keywords
dtone, dvs
License
MIT
Install
npm install @dtone/dvs@1.0.0

Documentation

dvs-api

Documentation

The documentation for DVS API can be found here

Install

> npm i @dtone/dvs

Sample usage

Initialization

const { DVS } = require('@dtone/dvs');

const dvs = new DVS({
  apiKey: 'your-api-key-here',
  apiSecret: 'your-api-secret-here'
});

Fetching all the pages of an API

(async function () {
  // initial pageing params
  const params = { page: 1, perPage: 10 },

    // initialize the async iterable object
    it = dvs.discovery.countries.get({ params });

  try {
    for await (let data of it) {
      console.log(JSON.stringify(data));
    }
  } catch (err) {
    console.log(JSON.stringify(err));
  }
})();

Error handling

const { DVSAPIError } = require(@dtone/dvs');

try {
  const result = await dvs.discovery.countries.getByCountryIsoCode({ countryIsoCode: 'SGP' });
} catch (err) {
  if (err instanceof DVSAPIError) {
    console.log(err.status, err.statusText, err.data);
  }

  // other error like timeouts, network issues, wrong params etc
}

API Documentation

See here