technitium 0.4.0

Typed async Rust client for the Technitium DNS Server API
Documentation
use serde::Deserialize;

/// A Technitium DNS server user.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct User {
    /// The username.
    pub username: Option<String>,
    /// The display name.
    pub display_name: Option<String>,
    /// Whether the user is disabled.
    #[serde(default)]
    pub disabled: bool,
    /// All other fields.
    #[serde(flatten)]
    pub extra: serde_json::Value,
}

/// Parameters for creating a new user.
#[derive(Debug, Clone)]
pub struct CreateUser {
    /// The username.
    pub username: String,
    /// The display name.
    pub display_name: String,
    /// The password.
    pub password: String,
}

/// A Technitium DNS server group.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Group {
    /// The group name.
    pub name: Option<String>,
    /// The group description.
    pub description: Option<String>,
    /// All other fields.
    #[serde(flatten)]
    pub extra: serde_json::Value,
}

/// Parameters for creating a new group.
#[derive(Debug, Clone)]
pub struct CreateGroup {
    /// The group name.
    pub name: String,
    /// The group description.
    pub description: String,
}

/// Response wrapper for user listing.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct UserListResponse {
    pub users: Vec<User>,
}

/// Response wrapper for group listing.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct GroupListResponse {
    pub groups: Vec<Group>,
}