README
httpsnippet-client-api
An HTTP Snippet client for generating snippets for the api module.
Installation
npm install --save httpsnippet-client-api
Usage
const httpsnippet = require('httpsnippet');
const client = require('httpsnippet-client-api');
HTTPSnippet.addTargetClient('node', client);
const snippet = new HTTPSnippet(harObject);
console.log(
snippet.convert('node', 'api', {
apiDefinitionUri: 'https://example.com/openapi.json'
apiDefinition: {
/* an OpenAPI definition object */
}
})
);
Results in the following:
const sdk = require('api')('https://example.com/openapi.json');
sdk.get('/har')
.then(res => console.log(res))
.catch(err => console.error(err));