azisaba-graph 0.1.0-rc.3

An API for connecting and sharing data across Azisaba Network.
Documentation
/*
 * 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
    }
}