sdk-generator

1.0.1 • Public • Published

sdk-generator

Automated Universal SDK Generation for REST API by JSON config

Install

$ npm install sdk-generator

Usage

import sdkGenerator from 'sdk-generator';
const SDK = sdkGenerator({
  getArticles: {
    path: '/articles/:category',
    method: 'GET'
  }
});
 
const sdk = new SDK('Server URL');
 
sdk.getArticles({
  body: {}, // Only for POST and PUT request
  params: {
    category: 'Auto'
  },
  query: {
    page: 1
  }
})
  .then(articles => console.log('articles'))
  .catch(err => console.log(err));

Test

To execute tests for the library, install the project dependencies once:

npm install

Then, the tests can be executed:

npm test

Package Sidebar

Install

npm i sdk-generator

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • abukurov