Example
let otherApp = this.homey.api.getApiApp('com.athom.otherApp');
otherApp
.on('realtime', (result) => console.log('otherApp.onRealtime', result))
.on('install', (result) => console.log('otherApp.onInstall', result))
.on('uninstall', (result) => console.log('otherApp.onUninstall', result));
otherApp.get('/')
.then((result) => console.log('otherApp.get', result))
.catch((error) => this.error('otherApp.get', error));
otherApp.getInstalled()
.then((result) => console.log('otherApp.getInstalled', result))
.catch((error) => this.error('otherApp.getInstalled', error));
otherApp.getVersion()
.then((result) => console.log('otherApp.getVersion', result))
.catch((error) => this.error('otherApp.getVersion', error));
Extends
Methods
delete(uri) → {Promise.<any>}
Perform a DELETE request.
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to the endpoint. |
Returns:
- Type:
-
Promise.<any>
get(uri) → {Promise.<any>}
Perform a GET request.
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to the endpoint. |
Returns:
- Type:
-
Promise.<any>
getInstalled() → {Promise.<boolean>}
This is a short-hand method to ManagerApps#getInstalled.
Returns:
- Type:
-
Promise.<boolean>
getVersion() → {Promise.<string>}
This is a short-hand method to ManagerApps#getVersion.
Returns:
- Type:
-
Promise.<string>
post(uri, body) → {Promise.<any>}
Perform a POST request.
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to the endpoint. |
body |
any
|
The body of the request. |
Returns:
- Type:
-
Promise.<any>
put(uri, body) → {Promise.<any>}
Perform a PUT request.
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
uri |
string
|
The path to request, relative to the endpoint. |
body |
any
|
The body of the request. |
Returns:
- Type:
-
Promise.<any>
unregister()
Unregister the API. This is a shorthand method for ManagerApi#unregisterApi.
- Overrides: