Skip to main content

ddapi_rs/scheme/ddnet/
releases_maps.rs

1use crate::scheme::DDNET_BASE_URL;
2use serde::{Deserialize, Serialize};
3
4#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
5pub struct ReleasesMaps {
6    pub name: String,
7    pub website: String,
8    pub thumbnail: String,
9    pub web_preview: String,
10    pub r#type: String,
11    pub points: u8,
12    pub difficulty: u8,
13    pub mapper: String,
14    pub release: String,
15    pub width: Option<u64>,
16    pub height: Option<u64>,
17    #[serde(default)]
18    pub tiles: Vec<String>,
19}
20
21impl ReleasesMaps {
22    #[must_use]
23    pub fn url() -> String {
24        format!("https://{DDNET_BASE_URL}/releases")
25    }
26
27    #[must_use]
28    pub fn api() -> String {
29        format!("https://{DDNET_BASE_URL}/releases/maps.json")
30    }
31}