pub trait HttpRequest {
fn set_header(self, name: &str, value: &str) -> Self;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Endpoint {
Api,
Content,
Notify,
OAuth2,
}
impl Endpoint {
pub fn url(self) -> &'static str {
match self {
Endpoint::Api => "https://api.dropboxapi.com/2/",
Endpoint::Content => "https://content.dropboxapi.com/2/",
Endpoint::Notify => "https://notify.dropboxapi.com/2/",
Endpoint::OAuth2 => "https://api.dropboxapi.com/", }
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Style {
Rpc,
Upload,
Download,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum ParamsType {
Json,
Form,
}
impl ParamsType {
pub fn content_type(self) -> &'static str {
match self {
ParamsType::Json => "application/json",
ParamsType::Form => "application/x-www-form-urlencoded",
}
}
}
#[derive(Debug, Clone)]
pub enum TeamSelect {
User(String),
Admin(String),
}
impl TeamSelect {
pub fn header_name(&self) -> &'static str {
match self {
TeamSelect::User(_) => "Dropbox-API-Select-User",
TeamSelect::Admin(_) => "Dropbox-API-Select-Admin",
}
}
}