1.0.10 • Published 5 years ago

restclientwrapper v1.0.10

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

ApiClientWrapper

A service wrappers that can be used to send rest api request (get and post handled for now...)

Usage:

1.Download and install the package. 2.To send the request we can pass all the details in the form of option object as a request parameter.

Creating option object:

var client = require('restclientwrapper')

var option = client.options()

adding endpoint url:

option.setEndpointUrl(url)

adding httpMethod/http verb:

option.setHttpMethod(option.httpMethods().GET)

note:- right nnow only GET and POST methods are handled

adding body:

var body = client.requestParameters() body.setKeyValue("name","morpheous")

same way other information can be added to body on basis of key/value pair

same way headers and queryString can be created

setting body/header/querystring to option:

option.setBody(body)

sameway we can create header and querystring and add them using their respective methods

making request to rest service:

client.serviceResponse(option.getOptionValue())

use .then() to resolve the promise

getting oauth2 token of granttype client credential

option.getToken(url,clientId,clientSecret)

setting proxy:

proxy can be set using option.setProxy() method or it can be passed as a flag from command prompt (--proxy="proxy url")

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago