Expand description
Unofficial Dropbox HTTP API v2 SDK for Rust.
§Quick start
use rusty_dropbox_sdk::api;
use rusty_dropbox_sdk::api::Service;
let token = std::env::var("DROPBOX_TOKEN")?;
let client = rusty_dropbox_sdk::Client::new(token);
let bearer = client.token();
let req = api::files::list_folder::ListFolderRequest {
access_token: &bearer,
payload: Some(api::files::ListFolderArgs {
path: String::new(),
recursive: Some(false),
include_media_info: None,
include_deleted: None,
include_has_explicit_shared_members: None,
include_mounted_folders: None,
limit: Some(50),
shared_link: None,
include_property_groups: None,
include_non_downloadable_files: None,
}),
};
let result = req.call().await?;
println!("{:?}", result);§Organisation
api— request/response types grouped by Dropbox namespace (account,auth,check,contacts,file_properties,file_requests,files). Each endpoint has its own submodule with a*Requeststruct you build and call.- Every request implements the
Servicetrait which exposes bothcall()(async) andcall_sync()(blocking) methods.
§Reference
Dropbox HTTP API docs: https://www.dropbox.com/developers/documentation/http/documentation
Modules§
- api
- auth
- OAuth2 helpers for Dropbox.
- helpers
- High-level helpers built on top of the raw endpoint types.
- prelude
- Ergonomic re-exports.
use rusty_dropbox_sdk::prelude::*;brings in theServicetrait (sorequest.call().await?resolves), theClienttoken holder, and thefilesnamespace.
Macros§
- implement_
content_ upload_ utils - Variant of
implement_utils!for upload-side content endpoints. The Request struct must have apub data: Option<Vec<u8>>field carrying the binary body; the generated impl forwards it throughUtils::content_body()so the service macro can attach it as the HTTP body whenHeaders::ContentTypeAppOctetStreamis set. - implement_
download_ service - Variant of
implement_service!for download-class endpoints. - implement_
service - Macro to implement the
Servicetrait for a given request type ($req) and response structure ($resp). This macro supports both synchronous and asynchronous API calls. - implement_
tests - Every request type targeted by
implement_tests!needs adefault_test_extras()function that returns aSelfwith dummy values for all fields that aren’taccess_tokenorpayload. Most Request structs only have those two fields;default_test_extras()is generated byimplement_utils!as an empty struct literal using struct-update syntax. Content-upload Request structs override it to setdata: None. - implement_
utils
Structs§
- Client
- Refresh
Config - Typed
Error - Decode a Dropbox error response body into a human-readable
anyhow::Error.
Constants§
- USER_
AGENT - User-Agent advertised on every request. Lets Dropbox support trace traffic from this SDK and lets you bump the version when filing issues against them.