mangadex_api_schema_rust/v5/
cover.rs

1use mangadex_api_types::{Language, MangaDexDateTime, RelationshipType};
2use serde::Deserialize;
3
4use crate::TypedAttributes;
5
6/// General cover information.
7#[derive(Clone, Debug, Deserialize, PartialEq, Default)]
8#[serde(rename_all = "camelCase")]
9#[non_exhaustive]
10#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
11#[cfg_attr(feature = "specta", derive(specta::Type))]
12pub struct CoverAttributes {
13    pub description: String,
14    pub locale: Option<Language>,
15    /// Volume number in the manga.
16    pub volume: Option<String>,
17    /// Cover art filename as it's stored on the MangaDex servers.
18    pub file_name: String,
19    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
20    #[cfg_attr(feature = "specta", specta(type = String))]
21    #[cfg_attr(
22        feature = "serialize",
23        serde(serialize_with = "crate::v5::mangadex_datetime_serialize")
24    )]
25    pub created_at: MangaDexDateTime,
26    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
27    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
28    #[cfg_attr(
29        feature = "serialize",
30        serde(serialize_with = "crate::v5::mangadex_datetime_serialize_option")
31    )]
32    pub updated_at: Option<MangaDexDateTime>,
33    pub version: u32,
34}
35
36impl TypedAttributes for CoverAttributes {
37    const TYPE_: mangadex_api_types::RelationshipType = RelationshipType::CoverArt;
38}