1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Azisaba Graph API
*
* An API for connecting and sharing data across Azisaba Network.
*
* The version of the OpenAPI document: 0.0.1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Player : A player profile. The Discord user ID is hidden unless the API key has permission to read it.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Player {
/// The unique identifier of the player.
#[serde(rename = "id")]
pub id: uuid::Uuid,
/// The Discord user ID linked to the player, or `null` if no Discord account is linked or the API key lacks the `players:read-details` scope.
#[serde(rename = "discordId", deserialize_with = "Option::deserialize")]
pub discord_id: Option<String>,
/// The player's Minecraft username.
#[serde(rename = "username")]
pub username: String,
/// The player's online status.
#[serde(rename = "status")]
pub status: Status,
/// The server to which the player is currently connected, or `null` if the player is offline.
#[serde(rename = "currentServer", deserialize_with = "Option::deserialize")]
pub current_server: Option<String>,
/// The player's biography of up to 160 characters, or `null` if it is not set.
#[serde(rename = "bio", deserialize_with = "Option::deserialize")]
pub bio: Option<String>,
}
impl Player {
/// A player profile. The Discord user ID is hidden unless the API key has permission to read it.
pub fn new(id: uuid::Uuid, discord_id: Option<String>, username: String, status: Status, current_server: Option<String>, bio: Option<String>) -> Player {
Player {
id,
discord_id,
username,
status,
current_server,
bio,
}
}
}
/// The player's online status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "online")]
Online,
#[serde(rename = "offline")]
Offline,
}
impl Default for Status {
fn default() -> Status {
Self::Online
}
}