RequestHandler

RequestHandler

Handles API requests

Constructor

new RequestHandler()

Source:

Methods

request(method, url, authopt, bodyopt, fileopt) → {Promise.<Object>}

Make an API request

Source:
Parameters:
Name Type Attributes Description
method String

Uppercase HTTP method

url String

URL of the endpoint

auth Boolean <optional>

Whether to add the Authorization header and token or not

body Object <optional>

Request payload

file Object <optional>

File object

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise.<Object>

Resolves with the returned JSON data