4 releases

Uses old Rust 2015

0.1.3 Feb 11, 2016
0.1.2 Feb 11, 2016
0.1.1 Feb 11, 2016
0.1.0 Feb 10, 2016

#12 in #dropbox

MIT/Apache

43KB
1K SLoC

Unofficial Dropbox SDK for Rust

"Build Status", link="https://travis-ci.org/pwoolcoc/dropbox-rs"

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

Examples

[source,rust] .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();
}

[source,rust] .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();
}

Dependencies

~2.2–3.5MB
~61K SLoC