pub mod auth;
pub mod client;
pub mod endpoint;
pub mod response;
use serde::Serialize;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Reqwest returned an error when connecting to the Cloudflare API: {0}")]
ReqwestError(#[from] reqwest::Error),
}
#[derive(Serialize, Clone, Debug)]
pub enum OrderDirection {
#[serde(rename = "asc")]
Ascending,
#[serde(rename = "desc")]
Descending,
}
#[derive(Serialize, Clone, Debug)]
#[serde(rename_all = "lowercase")]
pub enum SearchMatch {
All,
Any,
}
#[derive(Debug)]
pub enum Environment {
Production,
Custom(String),
}
impl<'a> From<&'a Environment> for url::Url {
fn from(environment: &Environment) -> Self {
match environment {
Environment::Production => {
url::Url::parse("https://api.cloudflare.com/client/v4/").unwrap()
}
Environment::Custom(url) => url::Url::parse(url.as_str()).unwrap(),
}
}
}