bangumi_api/module/person/
model.rs1use serde::{Deserialize, Serialize};
2use serde_repr::{Deserialize_repr, Serialize_repr};
3
4use crate::module::{
5 character::model::CharacterType,
6 model::{BloodType, Image, SimpleImage, Stat},
7 subject::model::SubjectType,
8};
9
10#[derive(Debug, Clone, Serialize_repr, Deserialize_repr)]
14#[repr(u8)]
15pub enum PersonType {
16 Individual = 1,
18 Corporation = 2,
20 Association = 3,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct Person {
29 pub id: u32,
31 pub name: String,
33 pub r#type: PersonType,
35 pub career: Vec<PersonCareer>,
37 pub images: SimpleImage,
39 pub short_summary: String,
41 pub locked: bool,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(rename_all = "lowercase")]
50pub enum PersonCareer {
51 Producer,
53 Mangaka,
55 Artist,
57 Seiyu,
59 Writer,
61 Illustrator,
63 Actor,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct PersonSearch {
72 pub keyword: String,
74 pub filter: Option<PersonFilter>,
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
82pub struct PersonFilter {
83 pub career: Option<Vec<String>>,
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
91pub struct PersonDetail {
92 pub id: u32,
94 pub name: String,
96 pub r#type: PersonType,
98 pub career: Vec<PersonCareer>,
100 pub images: SimpleImage,
102 pub summary: String,
104 pub locked: bool,
106 pub last_modified: String,
108 pub infobox: Vec<serde_json::Value>,
110 pub gender: Option<String>,
112 pub blood_type: Option<BloodType>,
114 pub birth_year: Option<u32>,
116 pub birth_mon: Option<u32>,
118 pub birth_day: Option<u32>,
120 pub stat: Box<Stat>,
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
128pub struct PersonCharacter {
129 pub id: u32,
131 pub name: String,
133 pub r#type: CharacterType,
135 pub images: SimpleImage,
137 pub subject_id: u32,
139 pub subject_type: SubjectType,
141 pub subject_name: String,
143 pub subject_name_cn: String,
145 pub staff: String,
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
153pub struct PersonSubject {
154 pub id: u32,
156 pub r#type: SubjectType,
158 pub staff: String,
160 pub name: String,
162 pub name_cn: String,
164 pub images: Option<Image>,
166}