UNPKG

@autocodingsystems/gateway-client

Version:

Library and commandline utility to control the acs gateway - device drivers for the most common industrial production line devices

21 lines (17 loc) 1.17 kB
const getJson = require('./getjson'); function raw(host) { return { getDevices: () => getJson(host, {path: `/api/v1/devices`}), getDevice: (id) => getJson(host, {path: `/api/v1/devices/${id}`}), getDeviceStatus: (id) => getJson(host, {path: `/api/v1/devices/${id}/status`}), addDevice: (details) => getJson(host, {path: `/api/v1/devices`, method: 'POST', data: details}), applyDeviceJob: (id, job) => getJson(host, {path: `/api/v1/devices/${id}/job`, method: 'PUT', data: job}), removeDeviceJob: (id) => getJson(host, {path: `/api/v1/devices/${id}/job`, method: 'DELETE'}), getDeviceJobStatus: (id) => getJson(host, {path: `/api/v1/devices/${id}/job/status`}), deleteDevice: (id) => getJson(host, {path: `/api/v1/devices/${id}`, method: 'DELETE'}), setActive: (id, active) => getJson(host, {path: `/api/v1/devices/${id}/active?active=${active}`, method: 'PATCH'}), getSupportedDevice: (id) => getJson(host, {path: `/api/v1/supporteddevices/${id}`}), getSupportedDevices: () => getJson(host, {path: `/api/v1/supporteddevices`}) } } module.exports = raw;