Skip to main content

azisaba_graph/models/
crawl.rs

1/*
2 * Azisaba Graph API
3 *
4 * An API for connecting and sharing data across the Azisaba Network.
5 *
6 * The version of the OpenAPI document: 0.0.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Crawl : Represents a Minecraft server crawl.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Crawl {
17    /// The unique identifier of the crawl.
18    #[serde(rename = "id")]
19    pub id: uuid::Uuid,
20    /// The hostname or IP address of the crawled Minecraft server.
21    #[serde(rename = "address")]
22    pub address: String,
23    /// The port of the crawled Minecraft server.
24    #[serde(rename = "port")]
25    pub port: u16,
26    /// The server ping in milliseconds.
27    #[serde(rename = "ping")]
28    pub ping: u32,
29    /// The Minecraft version name reported by the server.
30    #[serde(rename = "version")]
31    pub version: String,
32    /// The Minecraft protocol version reported by the server.
33    #[serde(rename = "protocolVersion")]
34    pub protocol_version: i32,
35    /// The maximum number of players reported by the server.
36    #[serde(rename = "maxPlayers")]
37    pub max_players: u32,
38    /// The number of players currently connected to the server.
39    #[serde(rename = "onlinePlayers")]
40    pub online_players: u32,
41    /// The server description reported by the server.
42    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
43    pub description: Option<String>,
44    /// The server favicon as a Base64-encoded PNG data URL, or `null` if no favicon was provided.
45    #[serde(rename = "favicon", deserialize_with = "Option::deserialize")]
46    pub favicon: Option<String>,
47    /// The date and time at which the server was crawled.
48    #[serde(rename = "crawledAt")]
49    pub crawled_at: chrono::DateTime<chrono::FixedOffset>,
50}
51
52impl Crawl {
53    /// Represents a Minecraft server crawl.
54    pub fn new(id: uuid::Uuid, address: String, port: u16, ping: u32, version: String, protocol_version: i32, max_players: u32, online_players: u32, favicon: Option<String>, crawled_at: chrono::DateTime<chrono::FixedOffset>) -> Crawl {
55        Crawl {
56            id,
57            address,
58            port,
59            ping,
60            version,
61            protocol_version,
62            max_players,
63            online_players,
64            description: None,
65            favicon,
66            crawled_at,
67        }
68    }
69}
70