mangadex_api_schema_rust/v5/
scanlation_group.rs

1use mangadex_api_types::{Language, MangaDexDateTime, MangaDexDuration, RelationshipType};
2use serde::Deserialize;
3use url::Url;
4
5use crate::{TypedAttributes, v5::LocalizedString};
6
7/// General scanlation group information.
8#[derive(Clone, Debug, Deserialize, Default)]
9#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
10#[serde(rename_all = "camelCase")]
11#[non_exhaustive]
12#[cfg_attr(feature = "specta", derive(specta::Type))]
13pub struct ScanlationGroupAttributes {
14    pub name: String,
15    pub alt_names: Vec<LocalizedString>,
16    pub website: Option<String>,
17    pub irc_server: Option<String>,
18    pub irc_channel: Option<String>,
19    pub discord: Option<String>,
20    pub contact_email: Option<String>,
21    pub description: Option<String>,
22    /// <https://twitter.com>
23    ///
24    /// Nullable.
25    pub twitter: Option<Url>,
26    /// Regex: [^https:/\/www\.mangaupdates\.com\/(?:groups|publishers)\.html\?id=\d+](https://www.mangaupdates.com)
27    ///
28    /// Nullable.
29    ///
30    pub manga_updates: Option<Url>,
31    /// Languages the scanlation primarily translates or uploads works into.
32    pub focused_languages: Option<Vec<Language>>,
33    pub locked: bool,
34    pub official: bool,
35    // Known issue: This field is unlisted on the MangaDex documentation but is present in the response.
36    pub verified: bool,
37    pub inactive: bool,
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub ex_licensed: Option<bool>,
40    /// Should respected ISO 8601 duration specification: <https://en.wikipedia.org/wiki/ISO_8601#Durations>
41    ///
42    /// Pattern: `^(P([1-9]|[1-9][0-9])D)?(P?([1-9])W)?(P?T(([1-9]|1[0-9]|2[0-4])H)?(([1-9]|[1-5][0-9]|60)M)?(([1-9]|[1-5][0-9]|60)S)?)?$`
43    ///
44    /// # Examples
45    ///
46    /// - Two days is `P2D`.
47    /// - Two seconds is `PT2S`.
48    /// - Six weeks and five minutes is `P6WT5M`.
49    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
50    pub publish_delay: Option<MangaDexDuration>,
51    pub version: u32,
52    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
53    #[cfg_attr(
54        feature = "serialize",
55        serde(serialize_with = "crate::v5::mangadex_datetime_serialize")
56    )]
57    pub created_at: MangaDexDateTime,
58    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
59    #[cfg_attr(
60        feature = "serialize",
61        serde(serialize_with = "crate::v5::mangadex_datetime_serialize")
62    )]
63    pub updated_at: MangaDexDateTime,
64}
65
66impl TypedAttributes for ScanlationGroupAttributes {
67    const TYPE_: mangadex_api_types::RelationshipType = RelationshipType::ScanlationGroup;
68}