mangadex_api_schema_rust/v5/
manga.rs1use mangadex_api_types::{
2 ContentRating, Demographic, Language, MangaDexDateTime, MangaState, MangaStatus,
3 RelationshipType,
4};
5use serde::Deserialize;
6use uuid::Uuid;
7
8use crate::{
9 TypedAttributes,
10 v5::{
11 ApiObject, LocalizedString, MangaLinks, TagAttributes, language_array_or_skip_null,
12 localizedstring_array_or_map, manga_links_array_or_struct,
13 },
14};
15
16#[derive(Debug, Deserialize, Clone, Default)]
18#[serde(rename_all = "camelCase")]
19#[non_exhaustive]
20#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
21#[cfg_attr(feature = "specta", derive(specta::Type))]
22pub struct MangaAttributes {
23 pub title: LocalizedString,
24 pub alt_titles: Vec<LocalizedString>,
25 #[serde(with = "localizedstring_array_or_map")]
26 pub description: LocalizedString,
27 #[serde(default)]
31 pub is_locked: bool,
32 #[serde(with = "manga_links_array_or_struct")]
33 pub links: Option<MangaLinks>,
34 pub original_language: Language,
35 pub last_volume: Option<String>,
36 pub last_chapter: Option<String>,
37 pub publication_demographic: Option<Demographic>,
38 pub status: MangaStatus,
39 pub year: Option<u16>,
40 pub content_rating: Option<ContentRating>,
41 #[serde(default)]
44 pub chapter_numbers_reset_on_new_volume: bool,
45 pub latest_uploaded_chapter: Option<Uuid>,
46 #[serde(with = "language_array_or_skip_null")]
48 pub available_translated_languages: Vec<Language>,
49 pub tags: Vec<ApiObject<TagAttributes>>,
50 pub state: MangaState,
58 #[cfg_attr(feature = "specta", specta(type = String))]
60 #[cfg_attr(
61 feature = "serialize",
62 serde(serialize_with = "crate::v5::mangadex_datetime_serialize")
63 )]
64 pub created_at: MangaDexDateTime,
65 #[cfg_attr(feature = "specta", specta(type = Option<String>))]
67 #[cfg_attr(
68 feature = "serialize",
69 serde(serialize_with = "crate::v5::mangadex_datetime_serialize_option")
70 )]
71 pub updated_at: Option<MangaDexDateTime>,
72 pub version: u32,
73}
74
75impl TypedAttributes for MangaAttributes {
76 const TYPE_: mangadex_api_types::RelationshipType = RelationshipType::Manga;
77}