bangumi_api/module/character/
model.rs1use serde::{Deserialize, Serialize};
2use serde_repr::{Deserialize_repr, Serialize_repr};
3
4use crate::module::{
5 model::{BloodType, InfoBox, SimpleImage, Stat},
6 subject::model::SubjectType,
7};
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct CharacterSearch {
14 pub keyword: String,
16 pub filter: Option<CharacterFilter>,
18}
19
20#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct CharacterFilter {
25 pub nsfw: Option<bool>,
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct Character {
34 pub id: u32,
36 pub name: String,
38 pub r#type: CharacterType,
40 pub images: SimpleImage,
42 pub summary: String,
44 pub locked: bool,
46 pub infobox: InfoBox,
48 pub gender: String,
50 pub blood_type: Option<BloodType>,
52 pub birth_year: Option<u32>,
54 pub birth_mon: Option<u32>,
56 pub birth_day: Option<u32>,
58 pub stat: Stat,
60 pub nsfw: bool,
62}
63
64#[derive(Debug, Clone, Serialize_repr, Deserialize_repr)]
68#[repr(u8)]
69pub enum CharacterType {
70 Character = 1,
72 Mechanic = 2,
74 Ship = 3,
76 Organization = 4,
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
84pub struct CharacterPerson {
85 pub id: u32,
87 pub name: String,
89 pub r#type: CharacterType,
91 pub images: SimpleImage,
93 pub subject_id: u32,
95 pub subject_type: SubjectType,
97 pub subject_name: String,
99 pub subject_name_cn: String,
101 pub staff: String,
103}
104
105#[derive(Debug, Clone, Serialize, Deserialize)]
109pub struct CharacterSubject {
110 pub id: u32,
112 pub r#type: SubjectType,
114 pub staff: String,
116 pub name: String,
118 pub name_cn: String,
120 pub image: String,
122}