-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathplayer.rs
More file actions
54 lines (51 loc) · 1.66 KB
/
Copy pathplayer.rs
File metadata and controls
54 lines (51 loc) · 1.66 KB
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
use crate::live::{PrimaryPosition, Side};
use crate::schedule::IdNameLink;
use crate::stats::Stat;
use chrono::NaiveDate;
use serde::Deserialize;
#[derive(Default, Debug, Deserialize)]
pub struct PeopleResponse {
pub people: Vec<PersonFull>,
}
/// Full player info with hydrated currentTeam and inline stats.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PersonFull {
pub id: u64,
pub full_name: String,
pub primary_number: Option<String>,
#[serde(default, with = "crate::serde_dates::optional_date")]
pub birth_date: Option<NaiveDate>,
pub current_age: Option<u8>,
pub birth_city: Option<String>,
pub birth_state_province: Option<String>,
pub birth_country: Option<String>,
pub height: Option<String>,
pub weight: Option<u16>,
pub primary_position: Option<PrimaryPosition>,
pub bat_side: Option<Side>,
pub pitch_hand: Option<Side>,
#[serde(default, with = "crate::serde_dates::optional_date")]
pub mlb_debut_date: Option<NaiveDate>,
pub active: Option<bool>,
pub draft_year: Option<u16>,
pub current_team: Option<IdNameLink>,
pub nick_name: Option<String>,
pub pronunciation: Option<String>,
/// Inline stats from hydration. Contains one entry per requested stat type
/// (season, yearByYear, career, gameLog).
#[serde(default)]
pub stats: Vec<Stat>,
pub drafts: Option<Vec<DraftInfo>>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftInfo {
pub pick_round: String,
pub pick_number: u16,
pub round_pick_number: u8,
pub team: IdNameLink,
pub is_drafted: bool,
pub is_pass: bool,
pub year: String,
}