1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#![deny(rust_2018_idioms)]
use thiserror::Error;
#[macro_use] extern crate log;
#[derive(Error, Debug)]
pub enum Error {
#[error("error from HTTP client: {0}")]
HttpClient(Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("JSON serialization error: {0}")]
Json(#[from] serde_json::Error),
#[error("Dropbox API returned something unexpected: {0}")]
UnexpectedResponse(&'static str),
#[error("Dropbox API indicated that the request was malformed: {0}")]
BadRequest(String),
#[error("Dropbox API indicated that the access token is bad: {0}")]
InvalidToken(String),
#[error("Dropbox API declined the request due to rate-limiting ({reason}), \
retry after {retry_after_seconds}s")]
RateLimited { reason: String, retry_after_seconds: u32 },
#[error("Dropbox API had an internal server error: {0}")]
ServerError(String),
#[error("Dropbox API returned HTTP {code} {status} - {json}")]
UnexpectedHttpError {
code: u16,
status: String,
json: String,
},
}
pub type Result<T> = std::result::Result<T, Error>;
#[cfg(feature = "default_client")] pub mod default_client;
pub mod client_trait;
pub use client_trait::{AppAuthClient, NoauthClient, UserAuthClient, TeamAuthClient};
pub(crate) mod client_helpers;
pub mod oauth2;
mod generated;
pub use generated::*;