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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* The Blue Alliance API v3
*
* # Overview Information and statistics about FIRST Robotics Competition teams and events. # Authentication All endpoints require an Auth Key to be passed in the header `X-TBA-Auth-Key`. If you do not have an auth key yet, you can obtain one from your [Account Page](/account).
*
* The version of the OpenAPI document: 3.8.2
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Match {
/// TBA match key with the format `yyyy[EVENT_CODE]_[COMP_LEVEL]m[MATCH_NUMBER]`, where `yyyy` is the year, and `EVENT_CODE` is the event code of the event, `COMP_LEVEL` is (qm, ef, qf, sf, f), and `MATCH_NUMBER` is the match number in the competition level. A set number may be appended to the competition level if more than one match in required per set.
#[serde(rename = "key")]
pub key: String,
/// The competition level the match was played at.
#[serde(rename = "comp_level")]
pub comp_level: CompLevel,
/// The set number in a series of matches where more than one match is required in the match series.
#[serde(rename = "set_number")]
pub set_number: i32,
/// The match number of the match in the competition level.
#[serde(rename = "match_number")]
pub match_number: i32,
#[serde(rename = "alliances", skip_serializing_if = "Option::is_none")]
pub alliances: Option<Box<crate::models::MatchSimpleAlliances>>,
/// The color (red/blue) of the winning alliance. Will contain an empty string in the event of no winner, or a tie.
#[serde(rename = "winning_alliance", skip_serializing_if = "Option::is_none")]
pub winning_alliance: Option<WinningAlliance>,
/// Event key of the event the match was played at.
#[serde(rename = "event_key")]
pub event_key: String,
/// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of the scheduled match time, as taken from the published schedule.
#[serde(rename = "time", skip_serializing_if = "Option::is_none")]
pub time: Option<i64>,
/// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of actual match start time.
#[serde(rename = "actual_time", skip_serializing_if = "Option::is_none")]
pub actual_time: Option<i64>,
/// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of the TBA predicted match start time.
#[serde(rename = "predicted_time", skip_serializing_if = "Option::is_none")]
pub predicted_time: Option<i64>,
/// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) when the match result was posted.
#[serde(rename = "post_result_time", skip_serializing_if = "Option::is_none")]
pub post_result_time: Option<i64>,
/// Score breakdown for auto, teleop, etc. points. Varies from year to year. May be null.
#[serde(rename = "score_breakdown", skip_serializing_if = "Option::is_none")]
pub score_breakdown: Option<serde_json::Value>,
/// Array of video objects associated with this match.
#[serde(rename = "videos", skip_serializing_if = "Option::is_none")]
pub videos: Option<Vec<crate::models::MatchVideosInner>>,
}
impl Match {
pub fn new(key: String, comp_level: CompLevel, set_number: i32, match_number: i32, event_key: String) -> Match {
Match {
key,
comp_level,
set_number,
match_number,
alliances: None,
winning_alliance: None,
event_key,
time: None,
actual_time: None,
predicted_time: None,
post_result_time: None,
score_breakdown: None,
videos: None,
}
}
}
/// The competition level the match was played at.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CompLevel {
#[serde(rename = "qm")]
Qm,
#[serde(rename = "ef")]
Ef,
#[serde(rename = "qf")]
Qf,
#[serde(rename = "sf")]
Sf,
#[serde(rename = "f")]
F,
}
impl Default for CompLevel {
fn default() -> CompLevel {
Self::Qm
}
}
/// The color (red/blue) of the winning alliance. Will contain an empty string in the event of no winner, or a tie.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum WinningAlliance {
#[serde(rename = "red")]
Red,
#[serde(rename = "blue")]
Blue,
#[serde(rename = "")]
Empty,
}
impl Default for WinningAlliance {
fn default() -> WinningAlliance {
Self::Red
}
}