Skip to content

This is the github repo for npm module dropbox-paper which is developed by me to make it easy to integrate and use dropbox paper service.

License

Notifications You must be signed in to change notification settings

singhnsatya/dropbox-paper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dropbox-paper sdk

The Dropbox paper JavaScript SDK is a lightweight, promise based interface to the Dropbox Paper api.

Why Dropbox Paper sdk

  • Easy and simple to use.
  • Returns Doc Name along when used doc list sdk method where dropbox api only returns array of doc ids.

Quickstart

$ npm install --save dropbox-paper
var dropboxpaper = require("dropbox-paper");

// pass your access token
var paper = new dropboxpaper({accessToken: "Your dropbox paper access token"});

New Version Updates and Notes

This new version 1.1.0 contains two new method paper.docPolicySet() and paper.archiveDoc().
New update has been made in paper.listDocs() method, now you can also pass cursor in this method.
For more information have a go through.

To update the package run

$ npm update --save dropbox-paper

Available Methods

List Docs

Since update of 1.1.0 this methods also accepts cursor value.
You can either pass limit with or with optional parameters see docs
Or a cursor value to retrieve docs from that cursor.

// Example
paper.listDocs({limit: 10})
.then(function(result){
console.log(result);
})
.catch(function(error){
console.log(error);
});

Delete Doc

Pass doc id to delete any particular doc.
This method will permanently delete the doc. see docs

// Example
paper.deleteDoc({doc_id: "atdn2KdIIiPYTPbBEjk5a"})
.then(function(result){
console.log(result);
})
.catch(function(error){
console.log(error);
});

Download Doc

Pass doc id and export format. Export format must be "makrdown" or "html".
Downloads doc in current folder.
For more information see docs

// Example
// Recommends to specify "filename" to download doc. If filename is not pass default downloads it with name "download".
paper.downloadDoc({doc_id: "y5JzeuQrJBJlNHTfjlk2L", export_format: "markdown", filename: "my doc"})
.then(function(result){
console.log(result);
})
.catch(function(error){
console.log(error);
});

Doc Users List

Pass doc id to see users of that doc.
For optional parameters see docs

// Example
paper.docUsersList({doc_id: "y5JuezQrJBJNhlTfjlk2L"})
.then(function(result){
console.log(result);
})
.catch(function(error){
console.log(error);
});

Doc Users Add

Pass doc id and members to add any user to the doc.
For more information see docs

// Example
paper.docUsersAdd({"doc_id":"zYsQe7JGywV77Onbt2UJO","members":[{"member":{".tag":"email","email":"user email"},"permission_level":{".tag":"edit"}}]})
.then(function(result){
console.log(result);
})
.catch(function(error){
console.log(error);
});

Doc Policy Set

Currently only supports public_sharing_policy.
Pass doc id on which you want to set policy.
For more information see docs

// Example
paper.docPolicySet({"doc_id":"P6evXjsBzf0l0ZZrbYVlf","sharing_policy":{"public_sharing_policy":{".tag":"people_with_link_can_view_and_comment"}}})
.then(function(result) {
console.log(result);
}).catch(function(error) {
console.log(error);
})

Archive Doc

Pass doc id of doc you want to archive.

// Example
paper.archiveDoc({doc_id: "y5JzeuLkuBJNhlTfjXr2L"})
.then(function(result) {
console.log(result);
}).catch(function(error) {
console.log(error);
})

About

This is the github repo for npm module dropbox-paper which is developed by me to make it easy to integrate and use dropbox paper service.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published