1use super::*;
6
7#[derive(Deserialize, Serialize, Debug, Clone)]
8pub struct Project {
9 pub slug: String,
12 pub title: String,
13 pub description: String,
15 pub categories: Vec<String>,
16 pub client_side: SideType,
17 pub server_side: SideType,
18 pub body: String,
20 pub status: ProjectStatus,
21 pub requested_status: Option<RequestedStatus>,
23 pub additional_categories: Vec<String>,
25 #[serde(deserialize_with = "deserialise_optional_url")]
27 pub issues_url: Option<Url>,
28 #[serde(deserialize_with = "deserialise_optional_url")]
30 pub source_url: Option<Url>,
31 #[serde(deserialize_with = "deserialise_optional_url")]
33 pub wiki_url: Option<Url>,
34 #[serde(deserialize_with = "deserialise_optional_url")]
36 pub discord_url: Option<Url>,
37 pub donation_urls: Vec<DonationLink>,
38 pub project_type: ProjectType,
39 pub downloads: Int,
40 #[serde(deserialize_with = "deserialise_optional_url")]
41 pub icon_url: Option<Url>,
42 pub color: Option<Int>,
44 pub thread_id: ID,
46 pub monetization_status: MonetizationStatus,
47 pub id: ID,
48 pub team: ID,
50 pub published: UtcTime,
51 pub updated: UtcTime,
52 pub approved: Option<UtcTime>,
54 pub queued: Option<UtcTime>,
55 pub followers: Int,
56 pub license: License,
57 pub versions: Vec<ID>,
60 pub game_versions: Vec<String>,
62 pub loaders: Vec<String>,
64 pub gallery: Vec<GalleryItem>,
66 pub organization: Option<ID>,
68}
69
70#[derive(Deserialize, Serialize, Debug, Clone)]
71pub struct License {
72 pub id: String,
74 pub name: String,
75 #[serde(deserialize_with = "deserialise_optional_url")]
77 pub url: Option<Url>,
78}
79
80#[derive(Deserialize, Serialize, Debug, Clone)]
81pub struct DonationLink {
82 pub id: String,
84 pub platform: String,
85 pub url: Url,
87}
88
89#[derive(Serialize, Deserialize, Debug, Clone)]
91pub struct GalleryItem {
92 pub url: Url,
93 pub raw_url: Url,
94 pub featured: bool,
95 pub title: Option<String>,
96 pub description: Option<String>,
97 pub created: UtcTime,
98 pub ordering: isize,
101}
102
103#[derive(Serialize, Deserialize, Debug, Clone)]
104pub struct ProjectDependencies {
105 pub projects: Vec<Project>,
106 pub versions: Vec<version::Version>,
107}
108
109#[derive(Serialize, Deserialize, Debug, Clone)]
111pub struct EditMultipleProjectsBody {
112 pub categories: Vec<String>,
114 pub add_categories: Vec<String>,
116 pub remove_categories: Vec<String>,
118 pub additional_categories: Vec<String>,
120 pub add_additional_categories: Vec<String>,
122 pub remove_additional_categories: Vec<String>,
124 pub donation_urls: Vec<DonationLink>,
126 pub add_donation_urls: Vec<DonationLink>,
128 pub remove_donation_urls: Vec<DonationLink>,
130 pub issues_url: Option<String>,
132 pub source_url: Option<String>,
134 pub wiki_url: Option<String>,
136 pub discord_url: Option<String>,
138}
139
140#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
141#[serde(rename_all = "lowercase")]
142pub enum ProjectStatus {
143 Approved,
144 Archived,
145 Rejected,
147 Draft,
148 Unlisted,
150 Processing,
152 Withheld,
153 Scheduled,
156 Private,
157 #[serde(other)]
158 Unknown,
159}
160
161#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
162#[serde(rename_all = "lowercase")]
163pub enum RequestedStatus {
164 Approved,
165 Archived,
166 Unlisted,
167 Private,
168 Draft,
169 #[serde(other)]
170 Other,
171}
172
173#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
174#[serde(rename_all = "kebab-case")]
175pub enum MonetizationStatus {
176 Monetized,
177 Demonetized,
178 ForceDemonetized,
179 #[serde(other)]
180 Other,
181}
182
183pub type ProjectSupportRange = SideType;
184#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
185#[serde(rename_all = "lowercase")]
186pub enum SideType {
187 Required,
189 Optional,
192 Unsupported,
194 Unknown,
196}
197
198#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
199#[serde(rename_all = "snake_case")]
200pub enum ProjectType {
201 Mod,
202 Modpack,
203 Resourcepack,
204 Shader,
205 Plugin,
206 Datapack,
207 MinecraftJavaServer,
208 #[serde(other)]
209 Other,
210}
211
212#[derive(Debug, Clone, Copy, PartialEq, Eq)]
214pub enum ImageFileExt {
215 PNG,
217 JPG,
219 JPEG,
221 BMP,
223 GIF,
225 WebP,
227 SVG,
229 SVGZ,
231 RGB,
233}
234
235impl std::fmt::Display for ImageFileExt {
236 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
237 write!(f, "{}", format!("{:?}", self).to_lowercase())
238 }
239}