Permalink
Browse files

[api] added `search`

  • Loading branch information...
1 parent 5f65bd3 commit a1dda267891235ba15c59e36b7519f8044fca3aa @fent fent committed Mar 27, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/dropbox-node.js
View
@@ -262,3 +262,18 @@ DropboxClient.prototype.move = function(from_path, to_path, optargs, cb) {
cb(null, JSON.parse(data));
});
}
+
+
+// Searches a folder
+// See https://www.dropbox.com/developers/reference/api#search
+DropboxClient.prototype.search = function(path, query, optargs, cb) {
+ if (typeof optargs == 'function') cb = optargs, optargs = {};
+ this.oauth.get(API_URI + '/search/dropbox/' + path + '?' +
+ querystring.stringify({query: query})
+ , optargs.token || this.access_token
+ , optargs.secret || this.access_token_secret
+ , function(err, data, res) {
+ if (err) return cb(err);
+ cb(null, JSON.parse(data));
+ });
+}

0 comments on commit a1dda26

Please sign in to comment.