mangadex_api_schema_rust/v5/
at_home_server.rs

1use mangadex_api_types::ResultType;
2use serde::Deserialize;
3use url::Url;
4
5#[derive(Clone, Debug, Deserialize, PartialEq)]
6#[serde(rename_all = "camelCase")]
7#[non_exhaustive]
8#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
9#[cfg_attr(feature = "specta", derive(specta::Type))]
10pub struct AtHomeServer {
11    #[serde(default)]
12    pub result: ResultType,
13    /// The base URL to construct final image URLs from.
14    /// The URL returned is valid for the requested chapter only, and for a duration of 15 minutes
15    /// from the time of the response.
16    pub base_url: Url,
17    pub chapter: ChapterData,
18}
19
20impl Default for AtHomeServer {
21    fn default() -> Self {
22        Self {
23            result: ResultType::Ok,
24            // Not the default url btw
25            base_url: Url::parse("https://upload.mangadex.org/").unwrap(),
26            chapter: Default::default(),
27        }
28    }
29}
30
31#[derive(Clone, Debug, Deserialize, PartialEq, Default)]
32#[serde(rename_all = "camelCase")]
33#[non_exhaustive]
34#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
35#[cfg_attr(feature = "specta", derive(specta::Type))]
36pub struct ChapterData {
37    pub hash: String,
38    /// Original upload quality filenames.
39    pub data: Vec<String>,
40    /// Compressed quality filenames.
41    pub data_saver: Vec<String>,
42}