1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use super::GetFlag;
use super::{Gender, GetFlag::*, Results};
use serde::Deserialize;

/// All valid flags for get staff method
pub const STAFF_FLAGS: [GetFlag; 5] = [Basic, Details, Aliases, Vns, Voiced];

/// Results returned from get staff method
#[derive(Deserialize, Debug, PartialEq)]
pub struct GetStaffResults {
    #[serde(flatten)]
    pub results: Results,
    pub items: Vec<GetStaffResponse>,
}

/// All fields returned by get staff method
/// fields are either Some or None depending on GetFlag param passed to get function
#[derive(Deserialize, Debug, PartialEq)]
pub struct GetStaffResponse {
    pub id: usize,
    pub name: Option<String>,
    #[serde(rename = "original")]
    pub original_name: Option<String>,
    pub gender: Option<Gender>,
    pub language: Option<String>,
    pub links: Option<Links>,
    pub description: Option<String>,
    // TODO Deserialize to struct
    pub aliases: Option<Vec<(usize, String, String)>>,
    pub main_alias: Option<usize>,
    pub vns: Option<Vec<Vn>>,
    pub voiced: Option<Vec<CV>>,
}

/// External site links
#[derive(Deserialize, Debug, PartialEq)]
pub struct Links {
    pub homepage: Option<String>,
    pub wikipedia: Option<String>,
    pub twitter: Option<String>,
    #[serde(rename = "anidb")]
    pub anidb_id: Option<usize>,
    pub pixiv: Option<String>,
    pub wikidata: Option<String>,
}

/// Visual novels that this staff entry has been credited in (excluding character voicing).
#[derive(Deserialize, Debug, PartialEq)]
pub struct Vn {
    pub id: usize,
    #[serde(rename = "aid")]
    pub alias_id: usize,
    pub role: String,
    pub note: Option<String>,
}

/// Characters that this staff entry has voiced.
#[derive(Deserialize, Debug, PartialEq)]
pub struct CV {
    #[serde(rename = "id")]
    pub vn_id: usize,
    #[serde(rename = "aid")]
    pub alias_id: usize,
    #[serde(rename = "cid")]
    pub character_id: usize,
    pub note: Option<String>,
}