Permalink
Browse files

Merge pull request #33 from snakamura/share

Added supports of /shares and /media
  • Loading branch information...
2 parents d1a6865 + cea354f commit a6682c817e51300f3df4b75f53e74e0ede030b91 @evnm committed Mar 31, 2014
Showing with 36 additions and 0 deletions.
  1. +10 −0 README.md
  2. +26 −0 lib/dropbox-node.js
View
@@ -153,6 +153,16 @@ https://www.dropbox.com/developers/reference/api#thumbnails
Downloads a thumbnail image located at `filepath`. Like `getFile()`, the `callback` can get buffered data or the returned readable stream can be piped. `optargs` can take `format` and `size` fields.
+### DropboxClient#shares(path, [optargs], [callback(err, link)])
+https://www.dropbox.com/developers/reference/api#shares
+
+Creates and gets a link to file/folder specified by `path`.
+
+### DropboxClient#media(filepath, [optargs], [callback(err, link)])
+https://www.dropbox.com/developers/reference/api#media
+
+Creates and gets a direct link to file specified by `filepath`.
+
### DropboxClient#copy(from_path, to_path, [optargs], callback)
https://www.dropbox.com/developers/reference/api#fileops-copy
View
@@ -190,6 +190,32 @@ DropboxClient.prototype.getThumbnail = function(path, optargs, cb) {
}
+// Creates and gets a link to the specified file or folder.
+// See https://www.dropbox.com/developers/docs/api#shares for explanation
+// of arguments.
+DropboxClient.prototype.share = function(path, optargs, cb) {
+ if (typeof optargs == 'function') cb = optargs, optargs = {};
+ optargs = optargs || {};
+ var uri = API_URI + '/shares/' + this.root + '/' + escapePath(path) +
+ '?' + stringifyParams(optargs);
+
+ return this._post(uri, optargs, cb);
+}
+
+
+// Creates and gets a direct link to the specified file.
+// See https://www.dropbox.com/developers/docs/api#media for explanation
+// of arguments.
+DropboxClient.prototype.media = function(path, optargs, cb) {
+ if (typeof optargs == 'function') cb = optargs, optargs = {};
+ optargs = optargs || {};
+ var uri = API_URI + '/media/' + this.root + '/' + escapePath(path) +
+ '?' + stringifyParams(optargs);
+
+ return this._post(uri, optargs, cb);
+}
+
+
// Copies a file or folder to a new location.
// See https://www.dropbox.com/developers/docs#fileops-copy for explanation
// of arguments.

0 comments on commit a6682c8

Please sign in to comment.