imp-build-api-v4
v1.0.1
Published
Electric Imp Build API v4 Client
Downloads
19
Readme
Electric Imp Build API v4 Client
Node.js client for Build API v4.
This package deprecates https://www.npmjs.com/package/imp-api.
Installation
npm i -g imp-build-api-v4
Node.js 4.0+ is required.
Reference
BuildAPIClient:
.apiKey
(property)
string
Gets/sets Build API key.
.debug
(property)
boolean
Enables/disables debug output.
.listDevices()
.listDevices([name], [deviceId], [modelId])
{Promise}
.getDevice()
.getDevice(deviceId)
.updateDevice()
.updateDevice(deviceId, [name], [modelId])
.restartDevice()
.restartDevice(deviceId)
.listModels()
.listModels([name])
.createModel()
.createModel(name)
.deleteModel()
.deleteModel(modelId)
.getModel()
.getModel(modelId)
.updateModel()
.updateModel(modelId, [name])
.restartModel()
.restartModel(modelId)
.listRevisions()
.listRevisions(modelId, [since], [until], [buildMin], [buildMax])
.createRevision()
.createRevision(modelId, [deviceCode], [agentCode], [releaseNotes])
.getRevision()
.getRevision(modelId, buildNumber)
.getDeviceLogs()
.getDeviceLogs(deviceId, [since])
.streamDeviceLogs()
.streamDeviceLogs(deviceId, callback)
Example
const BuildAPIClient = require('imp-build-api-v4');
let client = new BuildAPIClient();
client.apiKey = '<your Build API key>';
// print list of devices
client.listDevices()
.then((res) => {
console.log('Devices:', res.devices);
})
.catch(console.error);