robloxapi_s/games/
models.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4pub struct Game {
5    #[serde(skip)]
6    pub client: crate::Https,
7    #[serde(skip)]
8    pub servers: Option<Vec<Server>>,
9
10    #[serde(rename = "id")]
11    pub universe_id: u64,
12    #[serde(rename = "rootPlaceId")]
13    pub place_id: u64,
14    pub name: String,
15    pub description: String,
16    pub price: Option<u64>,
17    #[serde(rename = "allowedGearGenres")]
18    pub allowed_gear_genres: Vec<String>,
19    #[serde(rename = "allowedGearCategories")]
20    pub allowed_gear_categories: Vec<String>,
21    pub playing: u32,
22    pub visits: u64,
23    #[serde(rename = "maxPlayers")]
24    pub max_players: u8,
25    pub created: String,
26    pub updated: String,
27    #[serde(rename = "studioAccessToApisAllowed")]
28    pub studio_access_to_apis_allowed: bool,
29    #[serde(rename = "createVipServersAllowed")]
30    pub create_vip_servers_allowed: bool,
31    #[serde(rename = "universeAvatarType")]
32    pub universe_avatar_type: String,
33    pub genre: String,
34}
35
36#[derive(Serialize, Deserialize, Debug, Clone)]
37pub struct Server {
38    pub id: String,
39    #[serde(rename = "maxPlayers")]
40    pub max_players: u8,
41    pub playing: u32,
42    pub fps: f32,
43    pub ping: u32,
44}
45
46#[derive(Serialize, Deserialize, Debug, Clone)]
47pub struct DevProduct {
48    #[serde(skip)]
49    pub name: String,
50    #[serde(skip)]
51    pub price: u32,
52    // #[serde(skip)]
53    pub id: u64,
54    #[serde(rename = "Description")]
55    pub description: String,
56    #[serde(rename = "iconImageAssetId")]
57    pub image_asset_id: Option<u64>,
58    #[serde(rename = "shopId")]
59    pub shop_id: u64,
60}
61
62impl std::fmt::Display for Game {
63    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
64        write!(f, "Game(placeid={}, name={})", self.place_id, self.name)
65    }
66}
67
68impl std::fmt::Display for Server {
69    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
70        write!(
71            f,
72            "Game(id={}, playing={}, max_players={})",
73            self.id, self.playing, self.max_players
74        )
75    }
76}
77
78impl std::fmt::Display for DevProduct {
79    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
80        write!(
81            f,
82            "DevProduct(name={}, price={}, product_id={})",
83            self.name, self.price, self.id
84        )
85    }
86}