APISession

APISession

Class representing an active Belvo API session

Constructor

new APISession(url)

Create a session.

Source:
Parameters:
Name Type Description
url string

Belvo API host URL.

Methods

(async) delete(url, id) → {boolean}

Do a DELETE request to the API.

Source:
Parameters:
Name Type Description
url stroing

API endpoint.

id string

UUID4 representing the resource Id.

Throws:
Returns:
Type:
boolean

(async) get(url, id) → {object}

Get details of a specific resource.

Source:
Parameters:
Name Type Description
url str

API endpoint

id string

UUID4 representing the resource id.

Returns:
Type:
object

(async, generator) getAll(url, params)

Get all results from a paginated response

Source:
Parameters:
Name Type Description
url string

API endpoint

params object

Params to filter results in get.

(async) list(url, limit, params) → {array}

Get a list of resources.

Source:
Parameters:
Name Type Default Description
url string

API endpoint

limit number 100

Maximum number of results to get.

params object

Params to filter results in get.

Returns:
Type:
array

List of resources.

(async) login(secretKeyId, secretKeyPassword) → {boolean}

Login to Belvo API using secret key credentials.

Source:
Parameters:
Name Type Description
secretKeyId string

The Id of the key.

secretKeyPassword string

The password of the key.

Returns:
Type:
boolean

true when login is sucessful else false.

(async) patch(url, payload) → {object}

Do a PATCH request to the API.

Source:
Parameters:
Name Type Description
url string

API endpoint.

payload object

Response

Throws:
Returns:
Type:
object

Response

(async) post(url, payload) → {object}

Do a POST request to the API.

Source:
Parameters:
Name Type Description
url string

API endpoint.

payload object

JSON request payload.

Throws:
Returns:
Type:
object

Response

(async) put(url, id, payload)

Do a PUT request to the API.

Source:
Parameters:
Name Type Description
url string

API endpoint.

id string

UUID4 representing the resource Id.

payload object

JSON request payload.

Throws: