|
|
|
@ -1,5 +1,4 @@ |
|
|
|
var util = require('util'); |
|
|
|
var v8type = require('v8type'); |
|
|
|
|
|
|
|
var tag_api = function(){}; |
|
|
|
|
|
|
|
@ -14,9 +13,9 @@ tag_api.prototype.all_tags = function(source, callback){ |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 2 && v8type.is(arguments[0], v8type.FUNCTION)){ |
|
|
|
callback = arguments[0]; |
|
|
|
source = undefined; |
|
|
|
if(arguments.length < 2 && typeof arguments[0] == 'function'){ |
|
|
|
callback = arguments[0]; |
|
|
|
source = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
params = { |
|
|
|
@ -38,9 +37,9 @@ tag_api.prototype.host_tags = function(host, source, callback){ |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
if(arguments.length < 3 && typeof arguments[1] == 'function'){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
params = { |
|
|
|
@ -62,9 +61,9 @@ tag_api.prototype.host_tags_by_source = function(host, source, callback){ |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
if(arguments.length < 3 && typeof arguments[1] == 'function'){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
params = { |
|
|
|
@ -88,13 +87,13 @@ tag_api.prototype.add_tags = function(host, tags, source, callback){ |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(!v8type.is(tags, v8type.ARRAY)){ |
|
|
|
throw new Error('`tags` parameter must be an array'); |
|
|
|
if(typeof tags != 'object'){ |
|
|
|
throw new Error('`tags` parameter must be an array'); |
|
|
|
} |
|
|
|
|
|
|
|
if(arguments.length < 4 && v8type.is(arguments[2], v8type.FUNCTION)){ |
|
|
|
callback = arguments[2]; |
|
|
|
source = undefined; |
|
|
|
if(arguments.length < 4 && typeof arguments[2] == 'function'){ |
|
|
|
callback = arguments[2]; |
|
|
|
source = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
params = { |
|
|
|
@ -121,13 +120,13 @@ tag_api.prototype.update_tags = function(host, tags, source, callback){ |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(!v8type.is(tags, v8type.ARRAY)){ |
|
|
|
throw new Error('`tags` parameter must be an array'); |
|
|
|
if(typeof tags != 'object'){ |
|
|
|
throw new Error('`tags` parameter must be an array'); |
|
|
|
} |
|
|
|
|
|
|
|
if(arguments.length < 4 && v8type.is(arguments[2], v8type.FUNCTION)){ |
|
|
|
callback = arguments[2]; |
|
|
|
source = undefined; |
|
|
|
if(arguments.length < 4 && typeof arguments[2] == 'function'){ |
|
|
|
callback = arguments[2]; |
|
|
|
source = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
params = { |
|
|
|
@ -153,9 +152,9 @@ tag_api.prototype.detach_tags = function(host, source, callback){ |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
if(arguments.length < 3 && typeof arguments[1] == 'function'){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
params = { |
|
|
|
|