asoiaf_api/item/
mod.rs

1use serde::{Deserialize, Serialize};
2
3pub mod iterator;
4
5pub enum Items {
6    Book(Vec<Book>),
7    Character(Vec<Character>),
8    House(Vec<House>),
9}
10
11impl From<Vec<Book>> for Items {
12    fn from(item: Vec<Book>) -> Self {
13        Self::Book(item)
14    }
15}
16
17impl From<Vec<Character>> for Items {
18    fn from(item: Vec<Character>) -> Self {
19        Self::Character(item)
20    }
21}
22
23impl From<Vec<House>> for Items {
24    fn from(item: Vec<House>) -> Self {
25        Self::House(item)
26    }
27}
28
29#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
30pub struct House {
31    pub url: String,
32    pub name: String,
33    pub region: String,
34
35    #[serde(rename = "coatOfArms")]
36    pub coat_of_arms: String,
37
38    pub words: String,
39    pub titles: Vec<String>,
40    pub seats: Vec<String>,
41
42    #[serde(rename = "currentLord")]
43    pub current_lord: String,
44
45    pub heir: String,
46    pub overlord: String,
47    pub founded: String,
48    pub founder: String,
49
50    #[serde(rename = "diedOut")]
51    pub died_out: String,
52
53    #[serde(rename = "ancestralWeapons")]
54    pub ancestral_weapons: Vec<String>,
55
56    #[serde(rename = "cadetBranches")]
57    pub cadet_branches: Vec<String>,
58
59    #[serde(rename = "swornMembers")]
60    pub sworn_members: Vec<String>,
61}
62
63#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
64pub struct Character {
65    pub url: String,
66    pub name: String,
67    pub gender: Option<String>,
68    pub culture: Option<String>,
69    pub born: Option<String>,
70    pub died: Option<String>,
71    pub titles: Vec<String>,
72    pub aliases: Vec<String>,
73    pub father: Option<String>,
74    pub mother: Option<String>,
75    pub spouse: Option<String>,
76    pub allegiances: Vec<String>,
77    pub books: Vec<String>,
78
79    #[serde(rename = "povBooks")]
80    pub pov_books: Vec<String>,
81
82    #[serde(rename = "tvSeries")]
83    pub tv_series: Vec<String>,
84
85    #[serde(rename = "playedBy")]
86    pub played_by: Vec<String>,
87}
88
89#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
90pub struct Book {
91    pub url: String,
92    pub name: String,
93    pub isbn: String,
94    pub authors: Vec<String>,
95
96    #[serde(rename = "numberOfPages")]
97    pub number_of_pages: u32,
98
99    pub publisher: String,
100    pub country: String,
101
102    #[serde(rename = "mediaType")]
103    pub media_type: String,
104
105    pub released: String,
106    pub characters: Vec<String>,
107
108    #[serde(rename = "povCharacters")]
109    pub pov_characters: Vec<String>,
110}