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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* 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 Event {
/// TBA event key with the format yyyy[EVENT_CODE], where yyyy is the year, and EVENT_CODE is the event code of the event.
#[serde(rename = "key")]
pub key: String,
/// Official name of event on record either provided by FIRST or organizers of offseason event.
#[serde(rename = "name")]
pub name: String,
/// Event short code, as provided by FIRST.
#[serde(rename = "event_code")]
pub event_code: String,
/// Event Type, as defined here: https://github.com/the-blue-alliance/the-blue-alliance/blob/master/consts/event_type.py#L2
#[serde(rename = "event_type")]
pub event_type: i32,
#[serde(rename = "district", skip_serializing_if = "Option::is_none")]
pub district: Option<Box<crate::models::DistrictList>>,
/// City, town, village, etc. the event is located in.
#[serde(rename = "city", skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// State or Province the event is located in.
#[serde(rename = "state_prov", skip_serializing_if = "Option::is_none")]
pub state_prov: Option<String>,
/// Country the event is located in.
#[serde(rename = "country", skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Event start date in `yyyy-mm-dd` format.
#[serde(rename = "start_date")]
pub start_date: String,
/// Event end date in `yyyy-mm-dd` format.
#[serde(rename = "end_date")]
pub end_date: String,
/// Year the event data is for.
#[serde(rename = "year")]
pub year: i32,
/// Same as `name` but doesn't include event specifiers, such as 'Regional' or 'District'. May be null.
#[serde(rename = "short_name", skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
/// Event Type, eg Regional, District, or Offseason.
#[serde(rename = "event_type_string")]
pub event_type_string: String,
/// Week of the event relative to the first official season event, zero-indexed. Only valid for Regionals, Districts, and District Championships. Null otherwise. (Eg. A season with a week 0 'preseason' event does not count, and week 1 events will show 0 here. Seasons with a week 0.5 regional event will show week 0 for those event(s) and week 1 for week 1 events and so on.)
#[serde(rename = "week", skip_serializing_if = "Option::is_none")]
pub week: Option<i32>,
/// Address of the event's venue, if available.
#[serde(rename = "address", skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
/// Postal code from the event address.
#[serde(rename = "postal_code", skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// Google Maps Place ID for the event address.
#[serde(rename = "gmaps_place_id", skip_serializing_if = "Option::is_none")]
pub gmaps_place_id: Option<String>,
/// Link to address location on Google Maps.
#[serde(rename = "gmaps_url", skip_serializing_if = "Option::is_none")]
pub gmaps_url: Option<String>,
/// Latitude for the event address.
#[serde(rename = "lat", skip_serializing_if = "Option::is_none")]
pub lat: Option<f64>,
/// Longitude for the event address.
#[serde(rename = "lng", skip_serializing_if = "Option::is_none")]
pub lng: Option<f64>,
/// Name of the location at the address for the event, eg. Blue Alliance High School.
#[serde(rename = "location_name", skip_serializing_if = "Option::is_none")]
pub location_name: Option<String>,
/// Timezone name.
#[serde(rename = "timezone", skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
/// The event's website, if any.
#[serde(rename = "website", skip_serializing_if = "Option::is_none")]
pub website: Option<String>,
/// The FIRST internal Event ID, used to link to the event on the FRC webpage.
#[serde(rename = "first_event_id", skip_serializing_if = "Option::is_none")]
pub first_event_id: Option<String>,
/// Public facing event code used by FIRST (on frc-events.firstinspires.org, for example)
#[serde(rename = "first_event_code", skip_serializing_if = "Option::is_none")]
pub first_event_code: Option<String>,
#[serde(rename = "webcasts", skip_serializing_if = "Option::is_none")]
pub webcasts: Option<Vec<crate::models::Webcast>>,
/// An array of event keys for the divisions at this event.
#[serde(rename = "division_keys", skip_serializing_if = "Option::is_none")]
pub division_keys: Option<Vec<String>>,
/// The TBA Event key that represents the event's parent. Used to link back to the event from a division event. It is also the inverse relation of `divison_keys`.
#[serde(rename = "parent_event_key", skip_serializing_if = "Option::is_none")]
pub parent_event_key: Option<String>,
/// Playoff Type, as defined here: https://github.com/the-blue-alliance/the-blue-alliance/blob/master/consts/playoff_type.py#L4, or null.
#[serde(rename = "playoff_type", skip_serializing_if = "Option::is_none")]
pub playoff_type: Option<i32>,
/// String representation of the `playoff_type`, or null.
#[serde(rename = "playoff_type_string", skip_serializing_if = "Option::is_none")]
pub playoff_type_string: Option<String>,
}
impl Event {
pub fn new(key: String, name: String, event_code: String, event_type: i32, start_date: String, end_date: String, year: i32, event_type_string: String) -> Event {
Event {
key,
name,
event_code,
event_type,
district: None,
city: None,
state_prov: None,
country: None,
start_date,
end_date,
year,
short_name: None,
event_type_string,
week: None,
address: None,
postal_code: None,
gmaps_place_id: None,
gmaps_url: None,
lat: None,
lng: None,
location_name: None,
timezone: None,
website: None,
first_event_id: None,
first_event_code: None,
webcasts: None,
division_keys: None,
parent_event_key: None,
playoff_type: None,
playoff_type_string: None,
}
}
}