mangadex_api_schema_rust/v5/
ratings.rs

1//! Manga statistics from a response body.
2
3use std::collections::HashMap;
4
5use mangadex_api_types::{MangaDexDateTime, ResultType};
6use serde::Deserialize;
7use uuid::Uuid;
8
9#[derive(Clone, Debug, Deserialize)]
10#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
11#[serde(rename_all = "camelCase")]
12#[non_exhaustive]
13#[cfg_attr(feature = "specta", derive(specta::Type))]
14pub struct RatingsList {
15    #[serde(default)]
16    pub result: ResultType,
17    pub ratings: HashMap<Uuid, Rating>,
18}
19
20#[derive(Clone, Debug, Deserialize)]
21#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
22#[serde(rename_all = "camelCase")]
23#[cfg_attr(feature = "specta", derive(specta::Type))]
24#[non_exhaustive]
25pub struct Rating {
26    /// `[ 1 .. 10 ]`.
27    pub rating: u8,
28    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
29    #[cfg_attr(feature = "specta", specta(type = String))]
30    #[cfg_attr(
31        feature = "serialize",
32        serde(serialize_with = "crate::v5::mangadex_datetime_serialize")
33    )]
34    pub created_at: MangaDexDateTime,
35}