cloudflare-rs 0.6.5

Rust library bindings for Cloudflares v4 API
Documentation
use crate::framework::response::ApiResult;
use chrono::{DateTime, Utc};
use serde::Deserialize;

pub mod list_accounts;
pub use list_accounts::ListAccounts;

/// Cloudflare Accounts
/// An Account is the root object which owns other resources such as zones, load balancers and billing details.
/// https://api.cloudflare.com/#accounts-properties
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Account {
    /// Account identifier tag.
    pub id: String,
    /// Account name
    pub name: String,
    /// Account Settings
    #[serde(default)]
    pub settings: Settings,
    /// describes when the account was created
    #[serde(default = "default_time")]
    pub created_on: DateTime<Utc>,
}

/// Cloudflare Accounts Settings
/// An object containing the enforce two factor auth property.
#[derive(Deserialize, Serialize, Default, Debug, Clone, PartialEq, Eq)]
pub struct Settings {
    /// Indicates whether or not membership in this account requires that Two-Factor Authentication is enabled
    enforce_twofactor: bool,
}

fn default_time() -> DateTime<Utc> {
    Utc::now()
}

impl ApiResult for Account {}
impl ApiResult for Vec<Account> {}