paper_mc/
model.rs

1use serde::{Serialize, Deserialize};
2#[derive(Debug, Serialize, Deserialize, Default)]
3pub struct BuildResponse {
4    pub project_id: Option<String>,
5    pub project_name: Option<String>,
6    pub version: Option<String>,
7    pub build: Option<i64>,
8    pub time: Option<String>,
9    pub channel: Option<String>,
10    pub promoted: Option<bool>,
11    pub changes: Option<Vec<Change>>,
12    pub downloads: Option<serde_json::Value>,
13}
14impl std::fmt::Display for BuildResponse {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
16        write!(f, "{}", serde_json::to_string(self).unwrap())
17    }
18}
19#[derive(Debug, Serialize, Deserialize, Default)]
20pub struct BuildsResponse {
21    pub project_id: Option<String>,
22    pub project_name: Option<String>,
23    pub version: Option<String>,
24    pub builds: Option<Vec<VersionBuild>>,
25}
26impl std::fmt::Display for BuildsResponse {
27    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
28        write!(f, "{}", serde_json::to_string(self).unwrap())
29    }
30}
31#[derive(Debug, Serialize, Deserialize, Default)]
32pub struct Change {
33    pub commit: Option<String>,
34    pub summary: Option<String>,
35    pub message: Option<String>,
36}
37impl std::fmt::Display for Change {
38    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
39        write!(f, "{}", serde_json::to_string(self).unwrap())
40    }
41}
42#[derive(Debug, Serialize, Deserialize, Default)]
43pub struct Download {
44    pub name: Option<String>,
45    pub sha256: Option<String>,
46}
47impl std::fmt::Display for Download {
48    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
49        write!(f, "{}", serde_json::to_string(self).unwrap())
50    }
51}
52#[derive(Debug, Serialize, Deserialize, Default)]
53pub struct ProjectResponse {
54    pub project_id: Option<String>,
55    pub project_name: Option<String>,
56    pub version_groups: Option<Vec<String>>,
57    pub versions: Option<Vec<String>>,
58}
59impl std::fmt::Display for ProjectResponse {
60    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
61        write!(f, "{}", serde_json::to_string(self).unwrap())
62    }
63}
64#[derive(Debug, Serialize, Deserialize, Default)]
65pub struct ProjectsResponse {
66    pub projects: Option<Vec<String>>,
67}
68impl std::fmt::Display for ProjectsResponse {
69    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
70        write!(f, "{}", serde_json::to_string(self).unwrap())
71    }
72}
73#[derive(Debug, Serialize, Deserialize, Default)]
74pub struct VersionBuild {
75    pub build: Option<i64>,
76    pub time: Option<String>,
77    pub channel: Option<String>,
78    pub promoted: Option<bool>,
79    pub changes: Option<Vec<Change>>,
80    pub downloads: Option<serde_json::Value>,
81}
82impl std::fmt::Display for VersionBuild {
83    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
84        write!(f, "{}", serde_json::to_string(self).unwrap())
85    }
86}
87#[derive(Debug, Serialize, Deserialize, Default)]
88pub struct VersionFamilyBuild {
89    pub version: Option<String>,
90    pub build: Option<i64>,
91    pub time: Option<String>,
92    pub channel: Option<String>,
93    pub promoted: Option<bool>,
94    pub changes: Option<Vec<Change>>,
95    pub downloads: Option<serde_json::Value>,
96}
97impl std::fmt::Display for VersionFamilyBuild {
98    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
99        write!(f, "{}", serde_json::to_string(self).unwrap())
100    }
101}
102#[derive(Debug, Serialize, Deserialize, Default)]
103pub struct VersionFamilyBuildsResponse {
104    pub project_id: Option<String>,
105    pub project_name: Option<String>,
106    pub version_group: Option<String>,
107    pub versions: Option<Vec<String>>,
108    pub builds: Option<Vec<VersionFamilyBuild>>,
109}
110impl std::fmt::Display for VersionFamilyBuildsResponse {
111    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
112        write!(f, "{}", serde_json::to_string(self).unwrap())
113    }
114}
115#[derive(Debug, Serialize, Deserialize, Default)]
116pub struct VersionFamilyResponse {
117    pub project_id: Option<String>,
118    pub project_name: Option<String>,
119    pub version_group: Option<String>,
120    pub versions: Option<Vec<String>>,
121}
122impl std::fmt::Display for VersionFamilyResponse {
123    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
124        write!(f, "{}", serde_json::to_string(self).unwrap())
125    }
126}
127#[derive(Debug, Serialize, Deserialize, Default)]
128pub struct VersionResponse {
129    pub project_id: Option<String>,
130    pub project_name: Option<String>,
131    pub version: Option<String>,
132    pub builds: Option<Vec<i64>>,
133}
134impl std::fmt::Display for VersionResponse {
135    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
136        write!(f, "{}", serde_json::to_string(self).unwrap())
137    }
138}