1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3use std::collections::HashMap;
4
5#[allow(non_upper_case_globals)]
6pub mod fields;
7pub mod options;
8
9pub use options::StatusBuilder;
10
11#[derive(Serialize, Deserialize, Debug)]
12pub struct AnimeList {
13 pub data: Vec<ListNode>,
14 paging: HashMap<String, Value>,
15 pub season: Option<HashMap<String, Value>>,
16}
17
18#[derive(Serialize, Deserialize, Debug)]
19pub struct ListNode {
20 pub node: Anime,
21 pub list_status: Option<ListStatus>,
22 pub ranking: Option<HashMap<String, u32>>,
23}
24
25#[derive(Serialize, Deserialize, Debug)]
26pub struct ListStatus {
27 pub status: Option<String>,
28 pub num_episodes_watched: Option<u32>,
29 pub score: Option<u8>,
30 pub updated_at: Option<String>,
31 pub is_rewatching: Option<bool>,
32 pub priority: Option<u32>,
33 pub rewatch_value: Option<u32>,
34 pub tags: Option<Vec<String>>,
35 pub comments: Option<String>,
36}
37
38#[derive(Serialize, Deserialize, Debug)]
39pub struct Anime {
40 pub id: u32,
41 pub title: String,
42 pub main_picture: HashMap<String, Value>,
43}
44
45#[derive(Serialize, Deserialize, Debug)]
46pub struct AnimeDetails {
47 #[serde(flatten)]
48 pub show: Anime,
49 pub alternative_titles: Option<AlternativeTitles>,
50 pub start_date: Option<String>,
51 pub end_date: Option<String>,
52 pub synopsis: Option<String>,
53 pub mean: Option<f32>,
54 pub rank: Option<u32>,
55 pub num_list_users: Option<u32>,
56 pub num_scoring_users: Option<u32>,
57 pub nsfw: Option<String>,
58 pub created_at: Option<String>,
59 pub updated_at: Option<String>,
60 pub media_type: Option<String>,
61 pub status: Option<String>,
62 pub genres: Option<Vec<HashMap<String, Value>>>,
63 pub my_list_status: Option<ListStatus>,
64 pub num_episodes: Option<u32>,
65 pub start_season: Option<HashMap<String, Value>>,
66 pub broadcast: Option<HashMap<String, String>>,
67 pub source: Option<String>,
68 pub average_episode_duration: Option<u32>,
69 pub rating: Option<String>,
70 pub pictures: Option<Vec<HashMap<String, String>>>,
71 pub background: Option<String>,
72 pub related_anime: Option<Vec<Related>>,
73 pub related_manga: Option<Vec<HashMap<String, Value>>>,
74 pub recommendations: Option<Vec<Recommnendation>>,
75 pub studios: Option<Vec<HashMap<String, Value>>>,
76 pub statistics: Option<Stats>,
77}
78
79#[derive(Serialize, Deserialize, Debug)]
80pub struct Stats {
81 pub status: HashMap<String, String>,
82 pub num_list_users: u32,
83}
84
85#[derive(Serialize, Deserialize, Debug)]
86pub struct AlternativeTitles {
87 pub synonyms: Vec<String>,
88 #[serde(flatten)]
89 pub languages: HashMap<String, String>,
90}
91
92#[derive(Serialize, Deserialize, Debug)]
93pub struct Related {
94 pub node: Anime,
95 pub relation_type: String,
96 pub relation_type_formatted: String,
97}
98
99#[derive(Serialize, Deserialize, Debug)]
100pub struct Recommnendation {
101 pub node: Anime,
102 pub num_recommendations: u32,
103}
104
105#[derive(Serialize, Deserialize, Debug)]
106pub struct User {
107 pub id: u32,
108 pub name: String,
109 pub location: String,
110 pub joined_at: String,
111 pub anime_statistics: HashMap<String, f32>,
112}
113
114#[derive(Serialize, Deserialize, Debug)]
116pub struct ForumBoards {
117 pub categories: Vec<HashMap<String, Value>>,
118}
119
120#[derive(Serialize, Deserialize, Debug)]
121pub struct TopicDetails {
122 pub data: Vec<HashMap<String, Value>>,
123 pub paging: HashMap<String, Value>,
124}
125
126#[derive(Serialize, Deserialize, Debug)]
127pub struct ForumTopics {
128 pub data: Vec<HashMap<String, Value>>,
129 pub paging: Vec<HashMap<String, Value>>,
130}