diff options
Diffstat (limited to 'controller/zt1-controller-client/index.js')
-rw-r--r-- | controller/zt1-controller-client/index.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/controller/zt1-controller-client/index.js b/controller/zt1-controller-client/index.js new file mode 100644 index 00000000..b1e07e81 --- /dev/null +++ b/controller/zt1-controller-client/index.js @@ -0,0 +1,26 @@ +'use strict' + +var request = require('request'); + +function ZT1ControllerClient(url,authToken) +{ + this.url = url; + this.authToken = authToken; +} + +ZT1ControllerClient.prototype.status = function(callback) +{ + request({ + url: this.url + 'controller', + method: 'GET', + headers: { + 'X-ZT1-Auth': this.authToken + } + },function(error,response,body) { + if ((error)||(response.statusCode !== 200)) + return callback(error,{}); + return callback(null,JSON.parse(body)); + }); +}; + +exports.ZT1ControllerClient = ZT1ControllerClient; |