Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support for specifying a username in databases.list #315

Merged
merged 1 commit into from

2 participants

@fb55

Consistent with apps.list. Requires nodejitsu/nodejitsu-api#14.

@jfhbrook

lgtm, will merge.

@jfhbrook jfhbrook merged commit cc7ca32 into nodejitsu:master

1 check passed

Details default The Travis build passed
@jfhbrook

Merged! Thanks @fb55!

@fb55
@blakmatrix blakmatrix referenced this pull request in nodejitsu/nodejitsu-api
Closed

Added username argument to Databases#list #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 16, 2012
  1. @fb55

    added support for a username in databases.list

    fb55 authored
    consistent with apps.list
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 4 deletions.
  1. +18 −4 lib/jitsu/commands/databases.js
View
22 lib/jitsu/commands/databases.js
@@ -175,10 +175,13 @@ databases.get.usage = [
'jitsu databases get <database name>'
];
-databases.list = function (callback) {
- jitsu.databases.list(function (err, results) {
+databases.list = function (username, callback) {
+ function responseHandler (err, results) {
if (err) {
- jitsu.log.error('Unexpected Error: ' + err);
+ if (err.statusCode === 403) {
+ jitsu.log.error('Not authorised.');
+ }
+ else jitsu.log.error('Unexpected Error: ' + err);
}
else {
results.forEach(function (database) {
@@ -191,7 +194,18 @@ databases.list = function (callback) {
}
}
callback();
- });
+ }
+
+ if (arguments.length === 1) {
+ callback = username;
+ username = null;
+ }
+
+ if (!username) {
+ jitsu.databases.list(responseHandler);
+ } else {
+ jitsu.databases.list(username, responseHandler);
+ }
};
databases.list.usage = [
Something went wrong with that request. Please try again.