Skip to main content

esi_openapi/groups/
status.rs

1use crate::prelude::*;
2
3/// Endpoints for Status
4pub struct StatusGroup<'a> {
5    pub(crate) esi: &'a Esi,
6}
7
8/// Current state of the game server.
9#[derive(Debug, Clone, PartialEq, Deserialize)]
10#[allow(missing_docs)]
11pub struct ServerStatus {
12    pub players: i64,
13    pub server_version: String,
14    pub start_time: String,
15    pub vip: bool,
16}
17
18impl StatusGroup<'_> {
19    api_get!(
20        /// Retrieve the uptime and player counts of the game server.
21        get_status,
22        "GetStatus",
23        RequestType::Public,
24        ServerStatus,
25    );
26}
27
28#[cfg(test)]
29mod tests {
30    use super::ServerStatus;
31
32    #[test]
33    fn test_parse_server_status() {
34        let json = r#"{"players":12345,"server_version":"2951234","start_time":"2026-10-07T11:00:00Z","vip":false}"#;
35        let status: ServerStatus = serde_json::from_str(json).unwrap();
36        assert_eq!(status.players, 12345);
37        assert!(!status.vip);
38    }
39}