@dtone/dvs

    1.1.0 • Public • Published

    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

    Keywords

    Install

    npm i @dtone/dvs

    DownloadsWeekly Downloads

    7

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    25.8 kB

    Total Files

    21

    Last publish

    Collaborators

    • josnidhin
    • mohdhallal
    • dtone-open-source
    • afmsayem