earthmc 2.0.1

Async client for interacting with the EarthMC API
Documentation
use serde::{Deserialize, Serialize};

use crate::model::timestamp::Timestamp;

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct Server {
    pub version: String,
    pub moon_phase: MoonPhase,
    pub timestamps: ServerTimestamps,
    pub status: ServerStatus,
    pub stats: ServerStats,
    pub vote_party: VoteParty,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ServerTimestamps {
    /// New day rollover time.
    #[cfg_attr(
        feature = "chrono",
        serde(with = "crate::model::timestamp::seconds")
    )]
    pub new_day_time: Timestamp,
    /// Seconds since midnight in the server's current timezone.
    pub server_time_of_day: i32,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ServerStatus {
    pub has_storm: bool,
    pub is_thundering: bool,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ServerStats {
    /// Ticks elapsed in the current day.
    pub time: i64,
    /// Total elapsed ticks.
    pub full_time: i64,
    pub max_players: i32,
    pub num_online_players: i32,
    pub num_online_nomads: i32,
    pub num_residents: i32,
    pub num_nomads: i32,
    pub num_towns: i32,
    pub num_town_blocks: i32,
    pub num_nations: i32,
    pub num_quarters: i32,
    pub num_cuboids: i32,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct VoteParty {
    /// The total votes required to trigger a vote party.
    pub target: i32,
    /// The votes remaining before a vote party is triggered.
    pub num_remaining: i32,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum MoonPhase {
    FirstQuarter,
    FullMoon,
    LastQuarter,
    NewMoon,
    WaningCrescent,
    WaningGibbous,
    WaxingCrescent,
    WaxingGibbous,
}