1use std::fmt;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize, Default)]
6pub struct Asset {
7 pub id: i32,
8 pub name: String,
9 pub path: String,
10 pub thumbnail_path: String,
11 pub mime_type: String,
12 pub author: String,
13 #[serde(alias = "type")]
14 pub asset_type: String,
15 pub md5_checksum: String,
16 #[serde(alias = "isPublic")]
17 pub is_public: i32,
18 pub created_at: String,
19 pub updated_at: String
20}
21
22pub type Assets = Vec<Asset>;
23
24#[derive(Debug)]
25pub enum AssetType {
26 SKIN,
27 MAPRES,
28 GAMESKIN,
29 EMOTICON,
30 ENTITY,
31 CURSOR,
32 PARTICLE,
33 FONT,
34 GRIDTEMPLATE
35}
36
37impl fmt::Display for AssetType {
38 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
39 match self {
40 AssetType::SKIN => write!(f, "skin"),
41 AssetType::MAPRES => write!(f, "mapres"),
42 AssetType::GAMESKIN => write!(f, "gameskin"),
43 AssetType::EMOTICON => write!(f, "emoticon"),
44 AssetType::ENTITY => write!(f, "entity"),
45 AssetType::CURSOR => write!(f, "cursor"),
46 AssetType::PARTICLE => write!(f, "particle"),
47 AssetType::FONT => write!(f, "font"),
48 AssetType::GRIDTEMPLATE => write!(f, "gridtemplate")
49 }
50 }
51}
52
53#[derive(Debug, Serialize, Deserialize, Default)]
54pub struct Uploader {
55 pub id: i32,
56 pub name: String,
57 pub profile_photo_path: Option<String>,
58 pub is_admin: bool,
59 pub created_at: String,
60 pub updated_at: String,
61 pub profile_photo_url: Option<String>
62}
63
64#[derive(Debug, Serialize, Deserialize, Default)]
65pub struct User {
66 pub name: String,
67 pub profile_photo_url: String,
68 pub member_since: String
69}
70
71#[derive(Debug, Serialize, Deserialize, Default)]
72pub struct AssetsCount {
73 pub skins: i32,
74 pub mapres: i32,
75 pub gameskins: i32,
76 pub emoticons: i32,
77 pub cursors: i32,
78 pub particles: i32,
79 pub entities: i32,
80 pub fonts: i32,
81 #[serde(alias = "gridTemplates")]
82 pub grid_template: i32
83}
84
85#[derive(Debug, Serialize, Deserialize, Default)]
86pub struct UserData {
87 pub rank: i32,
88 #[serde(alias = "totalCount")]
89 pub total_count: i32,
90 #[serde(alias = "assetsCount")]
91 pub assets_count: AssetsCount
92}
93
94#[derive(Debug, Serialize, Deserialize, Default)]
95pub struct Profile {
96 pub user: User,
97 #[serde(alias = "uploadData")]
98 pub upload_data: UserData,
99 #[serde(alias = "downloadData")]
100 pub download_data: UserData
101}
102
103#[derive(Debug, Serialize, Deserialize, Default)]
104pub struct ForDiscord {
105 pub name: String,
106 pub count_uploads: i32
107}