new Client(token, hostopt)
Client provides a simple interface for using the Reflect API from Node.
Provides a way to authenticate, make requests, and robustly handle errors.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
token |
string | The API token to authenticate with. You can find this at https://app.reflect.io. Can be either read-only or read-write, depending on the usage. | ||
host |
string |
<optional> |
https://api.reflect.io | Host to use when querying |
- Source:
Methods
delete(path, opts) → {Promise}
Makes a DELETE request to the Reflect API.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to query |
opts |
Object | Options to make the request with |
- Source:
Returns:
Promise that represents the HTTP request
- Type
- Promise
get(path, opts) → {Promise}
Makes a GET request to the Reflect API.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to query |
opts |
Object | Options to make the request with |
- Source:
Returns:
Promise that represents the HTTP request
- Type
- Promise
post(path, opts) → {Promise}
Makes a POST request to the Reflect API.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to query |
opts |
Object | Options to make the request with |
- Source:
Returns:
Promise that represents the HTTP request
- Type
- Promise
put(path, opts) → {Promise}
Makes a PUT request to the Reflect API.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to query |
opts |
Object | Options to make the request with |
- Source:
Returns:
Promise that represents the HTTP request
- Type
- Promise
request(method, path, optsopt) → {Promise}
Given a method, path, and some options, makes a request to the Reflect API using the configured
host.
Parameters:
Name | Type | Attributes | Default | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|
method |
string | The HTTP method to use | ||||||||
path |
string | The path to query | ||||||||
opts |
Object |
<optional> |
{} | Options
Properties
|
- Source:
Returns:
Promise that represents the HTTP request
- Type
- Promise