You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/21 22:20:48 UTC

[5/8] git commit: accept options for query

accept options for query


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/293cbc5d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/293cbc5d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/293cbc5d

Branch: refs/heads/node-sdk-enhancements
Commit: 293cbc5da18f97dca2614434f590b140efe639c8
Parents: 18944ce
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 14:01:57 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 14:01:57 2014 -0700

----------------------------------------------------------------------
 sdks/nodejs/lib/usergrid.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/293cbc5d/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index 144eb5b..b9e31fe 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -1171,12 +1171,14 @@ var AUTH_NONE = 'NONE';
   *  @method getConnections
   *  @public
   *  @param {string} connection
-  *  @param {object} entity
+  *  @param {opts} options (actually, just options.qs for now)
   *  @param {function} callback
   *  @return {callback} callback(err, data, connections)
   *
   */
-  Usergrid.Entity.prototype.getConnections = function (connection, callback) {
+  Usergrid.Entity.prototype.getConnections = function (connection, opts, callback) {
+
+    if (_.isFunction(opts)) { callback = opts; opts = undefined; }
 
     var self = this;
 
@@ -1199,9 +1201,10 @@ var AUTH_NONE = 'NONE';
       method:'GET',
       endpoint:endpoint
     };
+    if (opts && opts.qs) { options.qs = opts.qs; }
     this._client.request(options, function (err, data) {
       if (err && self._client.logging) {
-        console.log('entity could not be connected');
+        console.log('entity connections could not be retrieved');
       }
 
       self[connection] = {};
@@ -1212,7 +1215,7 @@ var AUTH_NONE = 'NONE';
         if (data.entities[i].type === 'user'){
           self[connection][data.entities[i].username] = data.entities[i];
         } else {
-          self[connection][data.entities[i].name] = data.entities[i]
+          self[connection][data.entities[i].name] = data.entities[i];
         }
       }