node-webservice
Webservice helper for api requests
Installation
Install via npm:
$ npm install node-webservice
Documentation
SOAP
Usage
const Webservice = require('node-webservice').SOAP;
const webservice = new Webservice(options<Object>);
webservice.execute(Service<Class>, params<Object>) => Promise;
Constructor
options
object will be pass as argument for Service
constructor
execute
Service
: see below for explainationparams
: object will be pass as argument for Service
method buildRequest
(require service
key containing client path in soap object)
HTTP
Usage
const Webservice = require('node-webservice').HTTP;
const webservice = new Webservice(options<Object>);
webservice.execute(Service<Class>, params<Object>) => Promise;
Constructor
options
object will be pass as argument for Service
constructor
execute
Service
: see below for explainationparams
: object will be pass as argument for Service
method buildRequest
Service Class
First argument for webservice execute
function
Skeleton
class MyService {
constructor(options) {
}
buildRequest(params) {
}
getRequest() {
}
getResponse(response, headers) {
}
getError(error) {
}
getURL() {
return 'https://google.com';
}
}
Examples
See examples
Contributing
This project is a work in progress and subject to API changes, please feel free to contribute