use wrapper functions
This commit is contained in:
parent
d2ce855a69
commit
ffb0a935a3
@ -298,19 +298,9 @@ CloudAPI.prototype.listKeys = function listKeys(opts, cb) {
|
||||
* XXX document this, see the api doc above :)
|
||||
* @param {Function} callback of the form `function (err, images, res)`
|
||||
*/
|
||||
CloudAPI.prototype.listImages = function listImages(options, callback) {
|
||||
var self = this;
|
||||
if (callback === undefined) {
|
||||
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);
|
||||
});
|
||||
CloudAPI.prototype.listImages = function listImages(opts, cb) {
|
||||
var endpoint = sprintf('/%s/images', this.user);
|
||||
this._passThrough(endpoint, opts, cb);
|
||||
};
|
||||
|
||||
|
||||
@ -339,17 +329,9 @@ CloudAPI.prototype.getImage = function getImage(options, callback) {
|
||||
|
||||
// ---- packages
|
||||
|
||||
CloudAPI.prototype.listPackages = function listPackages(options, callback) {
|
||||
var self = this;
|
||||
if (typeof (options) === 'function') {
|
||||
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.listPackages = function listPackages(opts, cb) {
|
||||
var endpoint = sprintf('/%s/packages', this.user);
|
||||
this._passThrough(endpoint, opts, cb);
|
||||
};
|
||||
|
||||
CloudAPI.prototype.getPackage = function getPackage(options, callback) {
|
||||
|
Reference in New Issue
Block a user