Skip to main content

azisaba_graph/models/
create_crawl_request.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CreateCrawlRequest {
16    /// The hostname or IP address of the crawled Minecraft server.
17    #[serde(rename = "address")]
18    pub address: String,
19    /// The port of the crawled Minecraft server.
20    #[serde(rename = "port")]
21    pub port: u16,
22    /// The server ping in milliseconds.
23    #[serde(rename = "ping")]
24    pub ping: u32,
25    /// The Minecraft version name reported by the server.
26    #[serde(rename = "version")]
27    pub version: String,
28    /// The Minecraft protocol version reported by the server.
29    #[serde(rename = "protocolVersion")]
30    pub protocol_version: i32,
31    /// The maximum number of players reported by the server.
32    #[serde(rename = "maxPlayers")]
33    pub max_players: u32,
34    /// The number of players currently connected to the server.
35    #[serde(rename = "onlinePlayers")]
36    pub online_players: u32,
37    /// The server description reported by the server.
38    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
39    pub description: Option<String>,
40    /// The server favicon as a Base64-encoded PNG data URL, or `null` if no favicon was provided.
41    #[serde(rename = "favicon", deserialize_with = "Option::deserialize")]
42    pub favicon: Option<String>,
43    /// The date and time at which the server was crawled.
44    #[serde(rename = "crawledAt")]
45    pub crawled_at: chrono::DateTime<chrono::FixedOffset>,
46}
47
48impl CreateCrawlRequest {
49    pub fn new(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>) -> CreateCrawlRequest {
50        CreateCrawlRequest {
51            address,
52            port,
53            ping,
54            version,
55            protocol_version,
56            max_players,
57            online_players,
58            description: None,
59            favicon,
60            crawled_at,
61        }
62    }
63}
64