use wrapper functions

This commit is contained in:
Dave Eddy 2015-08-26 16:44:11 -04:00
parent d2ce855a69
commit ffb0a935a3

View File

@ -298,19 +298,9 @@ CloudAPI.prototype.listKeys = function listKeys(opts, cb) {
* XXX document this, see the api doc above :) * XXX document this, see the api doc above :)
* @param {Function} callback of the form `function (err, images, res)` * @param {Function} callback of the form `function (err, images, res)`
*/ */
CloudAPI.prototype.listImages = function listImages(options, callback) { CloudAPI.prototype.listImages = function listImages(opts, cb) {
var self = this; var endpoint = sprintf('/%s/images', this.user);
if (callback === undefined) { this._passThrough(endpoint, opts, cb);
callback = options;
options = {};
}
assert.object(options, 'options');
assert.func(callback, 'callback');
var endpoint = self._path(format('/%s/images', self.user), options);
self._request(endpoint, function (err, req, res, body) {
callback(err, body, res);
});
}; };
@ -339,17 +329,9 @@ CloudAPI.prototype.getImage = function getImage(options, callback) {
// ---- packages // ---- packages
CloudAPI.prototype.listPackages = function listPackages(options, callback) { CloudAPI.prototype.listPackages = function listPackages(opts, cb) {
var self = this; var endpoint = sprintf('/%s/packages', this.user);
if (typeof (options) === 'function') { this._passThrough(endpoint, opts, cb);
callback = options;
options = {};
}
var endpoint = self._path(format('/%s/packages', self.user), options);
self._request(endpoint, function (err, req, res, body) {
callback(err, body, res);
});
}; };
CloudAPI.prototype.getPackage = function getPackage(options, callback) { CloudAPI.prototype.getPackage = function getPackage(options, callback) {