Skip to content

pwoolcoc/dbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unofficial Dropbox SDK for Rust

Build Status

This is an (unofficial, as in not endorsed by) Dropbox SDK for Rust. At present it is not complete, though the API is mostly fleshed out.

Currently it uses Hyper to communicate with the Dropbox API, but this is swappable, to allow a user to use their preferred HTTP library, or use more advanced features.

It is also very much lacking in tests and documentation.

What’s working

Right now the following API calls are available:

  • /files/copy

  • /files/create_folder

  • /files/delete

  • /files/download

  • /files/list_folder

  • /files/upload

  • /files/get_metadata

  • /files/move

Examples

Basic example
extern crate dbox;

use dbox::client::Client;
use dbox::files;

const ACCESS_TOKEN: &'static str = "MY_ACCESS_TOKEN";

fn main() {
    let client = Client::new(ACCESS_TOKEN);
    let (metadata, response) = files::download(&client, "/path/to/file").unwrap();
}
With non-Hyper client
// compile with `cargo build --no-default-features`
extern crate dbox;
extern crate rustc_serialize;

use dbox::{DropboxClient, Result, Response};
use dbox::files;

struct MyClient;

impl DropboxClient for MyClient {
    fn access_token() -> &str {
        // return access token
    }

    fn request<T>(&self, url: &str, headers: &mut BTreeMap<String, String>, body: &T) -> Result<Response>
        where T: rustc_serialize::Encodable + Clone
    {
        // implement http request here
    }
}

fn main() {
    let client = MyClient;
    let (metadata, response) = files::download(&client, "/path/to/file").unwrap();
}

About

(READ ONLY) Unofficial Dropbox SDK for Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published