cloudflare/framework/
mod.rs1pub mod auth;
5pub mod client;
6pub mod endpoint;
7pub mod response;
8
9use serde::Serialize;
10
11#[derive(thiserror::Error, Debug)]
12pub enum Error {
14 #[error("Reqwest returned an error when connecting to the Cloudflare API: {0}")]
16 ReqwestError(#[from] reqwest::Error),
17}
18
19#[derive(Serialize, Clone, Debug)]
20pub enum OrderDirection {
21 #[serde(rename = "asc")]
22 Ascending,
23 #[serde(rename = "desc")]
24 Descending,
25}
26
27#[derive(Serialize, Clone, Debug)]
30#[serde(rename_all = "lowercase")]
31pub enum SearchMatch {
32 All,
34 Any,
36}
37
38#[derive(Debug)]
40pub enum Environment {
41 Production,
43 Custom(String),
45}
46
47impl<'a> From<&'a Environment> for url::Url {
48 fn from(environment: &Environment) -> Self {
49 match environment {
50 Environment::Production => {
51 url::Url::parse("https://api.cloudflare.com/client/v4/").unwrap()
52 }
53 Environment::Custom(url) => url::Url::parse(url.as_str()).unwrap(),
54 }
55 }
56}