diff --git a/build/actions/device.js b/build/actions/device.js index a5f6187f..f68b7faf 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -135,6 +135,58 @@ limitations under the License. } }; + exports.enableDeviceUrl = { + signature: 'device enableDeviceUrl ', + description: 'enable device URL for a device', + help: 'Use this command to enable device URL for a device\n\nExamples:\n\n $ resin device enableDeviceUrl 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.enableDeviceUrl(params.uuid).nodeify(done); + } + }; + + exports.disableDeviceUrl = { + signature: 'device disableDeviceUrl ', + description: 'disable device URL for a device', + help: 'Use this command to disable device URL for a device\n\nExamples:\n\n $ resin device disableDeviceUrl 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.disableDeviceUrl(params.uuid).nodeify(done); + } + }; + + exports.getDeviceUrl = { + signature: 'device getDeviceUrl ', + description: 'gets the device URL of a device', + help: 'Use this command to get the device URL of a device\n\nExamples:\n\n $ resin device getDeviceUrl 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.getDeviceUrl(params.uuid).then(function(url) { + return console.log(url); + }).nodeify(done); + } + }; + + exports.hasDeviceUrl = { + signature: 'device hasDeviceUrl ', + description: 'Returns true if device URL is enabled for a device', + help: 'Use this command to determine if device URL is enabled for a device\n\nExamples:\n\n $ resin device hasDeviceUrl 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.hasDeviceUrl(params.uuid).then(function(hasDeviceUrl) { + return console.log(hasDeviceUrl); + }).nodeify(done); + } + }; + exports.rename = { signature: 'device rename [newName]', description: 'rename a resin device', diff --git a/build/app.js b/build/app.js index cb58bf90..aca40f7b 100644 --- a/build/app.js +++ b/build/app.js @@ -95,6 +95,14 @@ limitations under the License. capitano.command(actions.device.reboot); + capitano.command(actions.device.enableDeviceUrl); + + capitano.command(actions.device.disableDeviceUrl); + + capitano.command(actions.device.getDeviceUrl); + + capitano.command(actions.device.hasDeviceUrl); + capitano.command(actions.device.register); capitano.command(actions.device.move); diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index d11032f5..b81bc02a 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -186,6 +186,70 @@ exports.reboot = resin = require('resin-sdk') resin.models.device.reboot(params.uuid).nodeify(done) +exports.enableDeviceUrl = + signature: 'device enableDeviceUrl ' + description: 'enable device URL for a device' + help: ''' + Use this command to enable device URL for a device + + Examples: + + $ resin device enableDeviceUrl 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.enableDeviceUrl(params.uuid).nodeify(done) + +exports.disableDeviceUrl = + signature: 'device disableDeviceUrl ' + description: 'disable device URL for a device' + help: ''' + Use this command to disable device URL for a device + + Examples: + + $ resin device disableDeviceUrl 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.disableDeviceUrl(params.uuid).nodeify(done) + +exports.getDeviceUrl = + signature: 'device getDeviceUrl ' + description: 'gets the device URL of a device' + help: ''' + Use this command to get the device URL of a device + + Examples: + + $ resin device getDeviceUrl 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.getDeviceUrl(params.uuid).then (url) -> + console.log(url) + .nodeify(done) + +exports.hasDeviceUrl = + signature: 'device hasDeviceUrl ' + description: 'Returns true if device URL is enabled for a device' + help: ''' + Use this command to determine if device URL is enabled for a device + + Examples: + + $ resin device hasDeviceUrl 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) -> + console.log(hasDeviceUrl) + .nodeify(done) + exports.rename = signature: 'device rename [newName]' description: 'rename a resin device' diff --git a/lib/app.coffee b/lib/app.coffee index a31c9870..fec89988 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -75,6 +75,10 @@ capitano.command(actions.device.init) capitano.command(actions.device.remove) capitano.command(actions.device.identify) capitano.command(actions.device.reboot) +capitano.command(actions.device.enableDeviceUrl) +capitano.command(actions.device.disableDeviceUrl) +capitano.command(actions.device.getDeviceUrl) +capitano.command(actions.device.hasDeviceUrl) capitano.command(actions.device.register) capitano.command(actions.device.move) capitano.command(actions.device.info)