Api

This class represents an API endpoint on Homey. When registered, realtime events are fired on the instance.

Methods

delete

(async) delete(uri): Promise.<any>

Perform a DELETE request.

Parameters

Name Type Description
uri
string

The path to request, relative to the endpoint.

Returns

Promise.<any>

get

(async) get(uri): Promise.<any>

Perform a GET request.

Parameters

Name Type Description
uri
string

The path to request, relative to the endpoint.

Returns

Promise.<any>

post

(async) post(uri, body): Promise.<any>

Perform a POST request.

Parameters

Name Type Description
uri
string

The path to request, relative to the endpoint.

body
any

The body of the request.

Returns

Promise.<any>

put

(async) put(uri, body): Promise.<any>

Perform a PUT request.

Parameters

Name Type Description
uri
string

The path to request, relative to the endpoint.

body
any

The body of the request.

Returns

Promise.<any>

unregister

unregister()

Unregister the API. This is a shorthand method for ManagerApi#unregisterApi.

Events

realtime

.on('realtime')

This event is fired when a realtime event is received on this URI.

Parameters

Name Type Description
event
string

Name of the realtime event

data
any <optional>

Data of the realtime event