mangadex_api_schema_rust/v5/statistics/
manga.rsuse std::collections::HashMap;
use mangadex_api_types::ResultType;
use serde::Deserialize;
use uuid::Uuid;
use crate::FromResponse;
use super::Comments;
#[derive(Clone, Debug, Deserialize)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "non_exhaustive", non_exhaustive)]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct MangaStatisticsObject {
#[serde(default)]
pub result: ResultType,
pub statistics: HashMap<Uuid, MangaStatistics>,
}
#[derive(Clone, Debug, Deserialize, Copy)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct MangaStatistics {
pub rating: MangaRating,
pub follows: u32,
pub comments: Option<Comments>,
}
#[derive(Clone, Debug, Deserialize, Copy)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct MangaRating {
#[serde(default)]
pub average: Option<f32>,
#[serde(default)]
pub bayesian: Option<f32>,
#[serde(default)]
#[cfg_attr(feature = "specta", specta(type = HashMap<String, u32>))]
pub distribution: RatingsDistribution,
}
#[derive(Clone, Debug, Deserialize, Default, Copy)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
pub struct RatingsDistribution {
#[serde(rename = "1")]
pub r1: u32,
#[serde(rename = "2")]
pub r2: u32,
#[serde(rename = "3")]
pub r3: u32,
#[serde(rename = "4")]
pub r4: u32,
#[serde(rename = "5")]
pub r5: u32,
#[serde(rename = "6")]
pub r6: u32,
#[serde(rename = "7")]
pub r7: u32,
#[serde(rename = "8")]
pub r8: u32,
#[serde(rename = "9")]
pub r9: u32,
#[serde(rename = "10")]
pub r10: u32,
}
impl FromResponse for MangaStatisticsObject {
type Response = Self;
fn from_response(value: Self::Response) -> Self {
value
}
}