tba_openapi_rust/apis/
match_api.rs

1/*
2 * The Blue Alliance API v3
3 *
4 * # 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).
5 *
6 * The version of the OpenAPI document: 3.8.2
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`get_event_match_timeseries`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetEventMatchTimeseriesError {
22    Status401(),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`get_event_matches`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum GetEventMatchesError {
30    Status401(),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`get_event_matches_keys`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum GetEventMatchesKeysError {
38    Status401(),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`get_event_matches_simple`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum GetEventMatchesSimpleError {
46    Status401(),
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`get_match`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum GetMatchError {
54    Status401(),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`get_match_simple`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetMatchSimpleError {
62    Status401(),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`get_match_timeseries`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetMatchTimeseriesError {
70    Status401(),
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_match_zebra`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetMatchZebraError {
78    Status401(),
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`get_team_event_matches`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetTeamEventMatchesError {
86    Status401(),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`get_team_event_matches_keys`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum GetTeamEventMatchesKeysError {
94    Status401(),
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`get_team_event_matches_simple`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum GetTeamEventMatchesSimpleError {
102    Status401(),
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`get_team_matches_by_year`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetTeamMatchesByYearError {
110    Status401(),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`get_team_matches_by_year_keys`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetTeamMatchesByYearKeysError {
118    Status401(),
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`get_team_matches_by_year_simple`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum GetTeamMatchesByYearSimpleError {
126    Status401(),
127    UnknownValue(serde_json::Value),
128}
129
130
131/// Gets an array of Match Keys for the given event key that have timeseries data. Returns an empty array if no matches have timeseries data. *WARNING:* This is *not* official data, and is subject to a significant possibility of error, or missing data. Do not rely on this data for any purpose. In fact, pretend we made it up. *WARNING:* This endpoint and corresponding data models are under *active development* and may change at any time, including in breaking ways.
132pub async fn get_event_match_timeseries(configuration: &configuration::Configuration, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<String>, Error<GetEventMatchTimeseriesError>> {
133    let local_var_configuration = configuration;
134
135    let local_var_client = &local_var_configuration.client;
136
137    let local_var_uri_str = format!("{}/event/{event_key}/matches/timeseries", local_var_configuration.base_path, event_key=crate::apis::urlencode(event_key));
138    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
139
140    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
141        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
142    }
143    if let Some(local_var_param_value) = if_none_match {
144        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
145    }
146    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
147        let local_var_key = local_var_apikey.key.clone();
148        let local_var_value = match local_var_apikey.prefix {
149            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
150            None => local_var_key,
151        };
152        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
153    };
154
155    let local_var_req = local_var_req_builder.build()?;
156    let local_var_resp = local_var_client.execute(local_var_req).await?;
157
158    let local_var_status = local_var_resp.status();
159    let local_var_content = local_var_resp.text().await?;
160
161    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
162        serde_json::from_str(&local_var_content).map_err(Error::from)
163    } else {
164        let local_var_entity: Option<GetEventMatchTimeseriesError> = serde_json::from_str(&local_var_content).ok();
165        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
166        Err(Error::ResponseError(local_var_error))
167    }
168}
169
170/// Gets a list of matches for the given event.
171pub async fn get_event_matches(configuration: &configuration::Configuration, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<crate::models::Match>, Error<GetEventMatchesError>> {
172    let local_var_configuration = configuration;
173
174    let local_var_client = &local_var_configuration.client;
175
176    let local_var_uri_str = format!("{}/event/{event_key}/matches", local_var_configuration.base_path, event_key=crate::apis::urlencode(event_key));
177    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
178
179    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
180        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
181    }
182    if let Some(local_var_param_value) = if_none_match {
183        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
184    }
185    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
186        let local_var_key = local_var_apikey.key.clone();
187        let local_var_value = match local_var_apikey.prefix {
188            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
189            None => local_var_key,
190        };
191        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
192    };
193
194    let local_var_req = local_var_req_builder.build()?;
195    let local_var_resp = local_var_client.execute(local_var_req).await?;
196
197    let local_var_status = local_var_resp.status();
198    let local_var_content = local_var_resp.text().await?;
199
200    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
201        serde_json::from_str(&local_var_content).map_err(Error::from)
202    } else {
203        let local_var_entity: Option<GetEventMatchesError> = serde_json::from_str(&local_var_content).ok();
204        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
205        Err(Error::ResponseError(local_var_error))
206    }
207}
208
209/// Gets a list of match keys for the given event.
210pub async fn get_event_matches_keys(configuration: &configuration::Configuration, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<String>, Error<GetEventMatchesKeysError>> {
211    let local_var_configuration = configuration;
212
213    let local_var_client = &local_var_configuration.client;
214
215    let local_var_uri_str = format!("{}/event/{event_key}/matches/keys", local_var_configuration.base_path, event_key=crate::apis::urlencode(event_key));
216    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
217
218    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
219        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
220    }
221    if let Some(local_var_param_value) = if_none_match {
222        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
223    }
224    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
225        let local_var_key = local_var_apikey.key.clone();
226        let local_var_value = match local_var_apikey.prefix {
227            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
228            None => local_var_key,
229        };
230        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
231    };
232
233    let local_var_req = local_var_req_builder.build()?;
234    let local_var_resp = local_var_client.execute(local_var_req).await?;
235
236    let local_var_status = local_var_resp.status();
237    let local_var_content = local_var_resp.text().await?;
238
239    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
240        serde_json::from_str(&local_var_content).map_err(Error::from)
241    } else {
242        let local_var_entity: Option<GetEventMatchesKeysError> = serde_json::from_str(&local_var_content).ok();
243        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
244        Err(Error::ResponseError(local_var_error))
245    }
246}
247
248/// Gets a short-form list of matches for the given event.
249pub async fn get_event_matches_simple(configuration: &configuration::Configuration, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<crate::models::MatchSimple>, Error<GetEventMatchesSimpleError>> {
250    let local_var_configuration = configuration;
251
252    let local_var_client = &local_var_configuration.client;
253
254    let local_var_uri_str = format!("{}/event/{event_key}/matches/simple", local_var_configuration.base_path, event_key=crate::apis::urlencode(event_key));
255    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
256
257    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
258        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
259    }
260    if let Some(local_var_param_value) = if_none_match {
261        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
262    }
263    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
264        let local_var_key = local_var_apikey.key.clone();
265        let local_var_value = match local_var_apikey.prefix {
266            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
267            None => local_var_key,
268        };
269        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
270    };
271
272    let local_var_req = local_var_req_builder.build()?;
273    let local_var_resp = local_var_client.execute(local_var_req).await?;
274
275    let local_var_status = local_var_resp.status();
276    let local_var_content = local_var_resp.text().await?;
277
278    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
279        serde_json::from_str(&local_var_content).map_err(Error::from)
280    } else {
281        let local_var_entity: Option<GetEventMatchesSimpleError> = serde_json::from_str(&local_var_content).ok();
282        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
283        Err(Error::ResponseError(local_var_error))
284    }
285}
286
287/// Gets a `Match` object for the given match key.
288pub async fn get_match(configuration: &configuration::Configuration, match_key: &str, if_none_match: Option<&str>) -> Result<crate::models::Match, Error<GetMatchError>> {
289    let local_var_configuration = configuration;
290
291    let local_var_client = &local_var_configuration.client;
292
293    let local_var_uri_str = format!("{}/match/{match_key}", local_var_configuration.base_path, match_key=crate::apis::urlencode(match_key));
294    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
295
296    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
297        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
298    }
299    if let Some(local_var_param_value) = if_none_match {
300        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
301    }
302    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
303        let local_var_key = local_var_apikey.key.clone();
304        let local_var_value = match local_var_apikey.prefix {
305            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
306            None => local_var_key,
307        };
308        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
309    };
310
311    let local_var_req = local_var_req_builder.build()?;
312    let local_var_resp = local_var_client.execute(local_var_req).await?;
313
314    let local_var_status = local_var_resp.status();
315    let local_var_content = local_var_resp.text().await?;
316
317    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
318        serde_json::from_str(&local_var_content).map_err(Error::from)
319    } else {
320        let local_var_entity: Option<GetMatchError> = serde_json::from_str(&local_var_content).ok();
321        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
322        Err(Error::ResponseError(local_var_error))
323    }
324}
325
326/// Gets a short-form `Match` object for the given match key.
327pub async fn get_match_simple(configuration: &configuration::Configuration, match_key: &str, if_none_match: Option<&str>) -> Result<crate::models::MatchSimple, Error<GetMatchSimpleError>> {
328    let local_var_configuration = configuration;
329
330    let local_var_client = &local_var_configuration.client;
331
332    let local_var_uri_str = format!("{}/match/{match_key}/simple", local_var_configuration.base_path, match_key=crate::apis::urlencode(match_key));
333    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
334
335    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
336        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
337    }
338    if let Some(local_var_param_value) = if_none_match {
339        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
340    }
341    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
342        let local_var_key = local_var_apikey.key.clone();
343        let local_var_value = match local_var_apikey.prefix {
344            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
345            None => local_var_key,
346        };
347        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
348    };
349
350    let local_var_req = local_var_req_builder.build()?;
351    let local_var_resp = local_var_client.execute(local_var_req).await?;
352
353    let local_var_status = local_var_resp.status();
354    let local_var_content = local_var_resp.text().await?;
355
356    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
357        serde_json::from_str(&local_var_content).map_err(Error::from)
358    } else {
359        let local_var_entity: Option<GetMatchSimpleError> = serde_json::from_str(&local_var_content).ok();
360        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
361        Err(Error::ResponseError(local_var_error))
362    }
363}
364
365/// Gets an array of game-specific Match Timeseries objects for the given match key or an empty array if not available. *WARNING:* This is *not* official data, and is subject to a significant possibility of error, or missing data. Do not rely on this data for any purpose. In fact, pretend we made it up. *WARNING:* This endpoint and corresponding data models are under *active development* and may change at any time, including in breaking ways.
366pub async fn get_match_timeseries(configuration: &configuration::Configuration, match_key: &str, if_none_match: Option<&str>) -> Result<Vec<serde_json::Value>, Error<GetMatchTimeseriesError>> {
367    let local_var_configuration = configuration;
368
369    let local_var_client = &local_var_configuration.client;
370
371    let local_var_uri_str = format!("{}/match/{match_key}/timeseries", local_var_configuration.base_path, match_key=crate::apis::urlencode(match_key));
372    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
373
374    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
375        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
376    }
377    if let Some(local_var_param_value) = if_none_match {
378        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
379    }
380    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
381        let local_var_key = local_var_apikey.key.clone();
382        let local_var_value = match local_var_apikey.prefix {
383            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
384            None => local_var_key,
385        };
386        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
387    };
388
389    let local_var_req = local_var_req_builder.build()?;
390    let local_var_resp = local_var_client.execute(local_var_req).await?;
391
392    let local_var_status = local_var_resp.status();
393    let local_var_content = local_var_resp.text().await?;
394
395    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
396        serde_json::from_str(&local_var_content).map_err(Error::from)
397    } else {
398        let local_var_entity: Option<GetMatchTimeseriesError> = serde_json::from_str(&local_var_content).ok();
399        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
400        Err(Error::ResponseError(local_var_error))
401    }
402}
403
404/// Gets Zebra MotionWorks data for a Match for the given match key.
405pub async fn get_match_zebra(configuration: &configuration::Configuration, match_key: &str, if_none_match: Option<&str>) -> Result<crate::models::Zebra, Error<GetMatchZebraError>> {
406    let local_var_configuration = configuration;
407
408    let local_var_client = &local_var_configuration.client;
409
410    let local_var_uri_str = format!("{}/match/{match_key}/zebra_motionworks", local_var_configuration.base_path, match_key=crate::apis::urlencode(match_key));
411    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
412
413    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
414        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
415    }
416    if let Some(local_var_param_value) = if_none_match {
417        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
418    }
419    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
420        let local_var_key = local_var_apikey.key.clone();
421        let local_var_value = match local_var_apikey.prefix {
422            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
423            None => local_var_key,
424        };
425        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
426    };
427
428    let local_var_req = local_var_req_builder.build()?;
429    let local_var_resp = local_var_client.execute(local_var_req).await?;
430
431    let local_var_status = local_var_resp.status();
432    let local_var_content = local_var_resp.text().await?;
433
434    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
435        serde_json::from_str(&local_var_content).map_err(Error::from)
436    } else {
437        let local_var_entity: Option<GetMatchZebraError> = serde_json::from_str(&local_var_content).ok();
438        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
439        Err(Error::ResponseError(local_var_error))
440    }
441}
442
443/// Gets a list of matches for the given team and event.
444pub async fn get_team_event_matches(configuration: &configuration::Configuration, team_key: &str, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<crate::models::Match>, Error<GetTeamEventMatchesError>> {
445    let local_var_configuration = configuration;
446
447    let local_var_client = &local_var_configuration.client;
448
449    let local_var_uri_str = format!("{}/team/{team_key}/event/{event_key}/matches", local_var_configuration.base_path, team_key=crate::apis::urlencode(team_key), event_key=crate::apis::urlencode(event_key));
450    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
451
452    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
453        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
454    }
455    if let Some(local_var_param_value) = if_none_match {
456        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
457    }
458    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
459        let local_var_key = local_var_apikey.key.clone();
460        let local_var_value = match local_var_apikey.prefix {
461            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
462            None => local_var_key,
463        };
464        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
465    };
466
467    let local_var_req = local_var_req_builder.build()?;
468    let local_var_resp = local_var_client.execute(local_var_req).await?;
469
470    let local_var_status = local_var_resp.status();
471    let local_var_content = local_var_resp.text().await?;
472
473    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
474        serde_json::from_str(&local_var_content).map_err(Error::from)
475    } else {
476        let local_var_entity: Option<GetTeamEventMatchesError> = serde_json::from_str(&local_var_content).ok();
477        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
478        Err(Error::ResponseError(local_var_error))
479    }
480}
481
482/// Gets a list of match keys for matches for the given team and event.
483pub async fn get_team_event_matches_keys(configuration: &configuration::Configuration, team_key: &str, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<String>, Error<GetTeamEventMatchesKeysError>> {
484    let local_var_configuration = configuration;
485
486    let local_var_client = &local_var_configuration.client;
487
488    let local_var_uri_str = format!("{}/team/{team_key}/event/{event_key}/matches/keys", local_var_configuration.base_path, team_key=crate::apis::urlencode(team_key), event_key=crate::apis::urlencode(event_key));
489    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
490
491    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
492        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
493    }
494    if let Some(local_var_param_value) = if_none_match {
495        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
496    }
497    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
498        let local_var_key = local_var_apikey.key.clone();
499        let local_var_value = match local_var_apikey.prefix {
500            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
501            None => local_var_key,
502        };
503        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
504    };
505
506    let local_var_req = local_var_req_builder.build()?;
507    let local_var_resp = local_var_client.execute(local_var_req).await?;
508
509    let local_var_status = local_var_resp.status();
510    let local_var_content = local_var_resp.text().await?;
511
512    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
513        serde_json::from_str(&local_var_content).map_err(Error::from)
514    } else {
515        let local_var_entity: Option<GetTeamEventMatchesKeysError> = serde_json::from_str(&local_var_content).ok();
516        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
517        Err(Error::ResponseError(local_var_error))
518    }
519}
520
521/// Gets a short-form list of matches for the given team and event.
522pub async fn get_team_event_matches_simple(configuration: &configuration::Configuration, team_key: &str, event_key: &str, if_none_match: Option<&str>) -> Result<Vec<crate::models::Match>, Error<GetTeamEventMatchesSimpleError>> {
523    let local_var_configuration = configuration;
524
525    let local_var_client = &local_var_configuration.client;
526
527    let local_var_uri_str = format!("{}/team/{team_key}/event/{event_key}/matches/simple", local_var_configuration.base_path, team_key=crate::apis::urlencode(team_key), event_key=crate::apis::urlencode(event_key));
528    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
529
530    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
531        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
532    }
533    if let Some(local_var_param_value) = if_none_match {
534        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
535    }
536    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
537        let local_var_key = local_var_apikey.key.clone();
538        let local_var_value = match local_var_apikey.prefix {
539            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
540            None => local_var_key,
541        };
542        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
543    };
544
545    let local_var_req = local_var_req_builder.build()?;
546    let local_var_resp = local_var_client.execute(local_var_req).await?;
547
548    let local_var_status = local_var_resp.status();
549    let local_var_content = local_var_resp.text().await?;
550
551    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
552        serde_json::from_str(&local_var_content).map_err(Error::from)
553    } else {
554        let local_var_entity: Option<GetTeamEventMatchesSimpleError> = serde_json::from_str(&local_var_content).ok();
555        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
556        Err(Error::ResponseError(local_var_error))
557    }
558}
559
560/// Gets a list of matches for the given team and year.
561pub async fn get_team_matches_by_year(configuration: &configuration::Configuration, team_key: &str, year: i32, if_none_match: Option<&str>) -> Result<Vec<crate::models::Match>, Error<GetTeamMatchesByYearError>> {
562    let local_var_configuration = configuration;
563
564    let local_var_client = &local_var_configuration.client;
565
566    let local_var_uri_str = format!("{}/team/{team_key}/matches/{year}", local_var_configuration.base_path, team_key=crate::apis::urlencode(team_key), year=year);
567    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
568
569    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
570        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
571    }
572    if let Some(local_var_param_value) = if_none_match {
573        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
574    }
575    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
576        let local_var_key = local_var_apikey.key.clone();
577        let local_var_value = match local_var_apikey.prefix {
578            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
579            None => local_var_key,
580        };
581        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
582    };
583
584    let local_var_req = local_var_req_builder.build()?;
585    let local_var_resp = local_var_client.execute(local_var_req).await?;
586
587    let local_var_status = local_var_resp.status();
588    let local_var_content = local_var_resp.text().await?;
589
590    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
591        serde_json::from_str(&local_var_content).map_err(Error::from)
592    } else {
593        let local_var_entity: Option<GetTeamMatchesByYearError> = serde_json::from_str(&local_var_content).ok();
594        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
595        Err(Error::ResponseError(local_var_error))
596    }
597}
598
599/// Gets a list of match keys for matches for the given team and year.
600pub async fn get_team_matches_by_year_keys(configuration: &configuration::Configuration, team_key: &str, year: i32, if_none_match: Option<&str>) -> Result<Vec<String>, Error<GetTeamMatchesByYearKeysError>> {
601    let local_var_configuration = configuration;
602
603    let local_var_client = &local_var_configuration.client;
604
605    let local_var_uri_str = format!("{}/team/{team_key}/matches/{year}/keys", local_var_configuration.base_path, team_key=crate::apis::urlencode(team_key), year=year);
606    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
607
608    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
609        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
610    }
611    if let Some(local_var_param_value) = if_none_match {
612        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
613    }
614    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
615        let local_var_key = local_var_apikey.key.clone();
616        let local_var_value = match local_var_apikey.prefix {
617            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
618            None => local_var_key,
619        };
620        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
621    };
622
623    let local_var_req = local_var_req_builder.build()?;
624    let local_var_resp = local_var_client.execute(local_var_req).await?;
625
626    let local_var_status = local_var_resp.status();
627    let local_var_content = local_var_resp.text().await?;
628
629    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
630        serde_json::from_str(&local_var_content).map_err(Error::from)
631    } else {
632        let local_var_entity: Option<GetTeamMatchesByYearKeysError> = serde_json::from_str(&local_var_content).ok();
633        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
634        Err(Error::ResponseError(local_var_error))
635    }
636}
637
638/// Gets a short-form list of matches for the given team and year.
639pub async fn get_team_matches_by_year_simple(configuration: &configuration::Configuration, team_key: &str, year: i32, if_none_match: Option<&str>) -> Result<Vec<crate::models::MatchSimple>, Error<GetTeamMatchesByYearSimpleError>> {
640    let local_var_configuration = configuration;
641
642    let local_var_client = &local_var_configuration.client;
643
644    let local_var_uri_str = format!("{}/team/{team_key}/matches/{year}/simple", local_var_configuration.base_path, team_key=crate::apis::urlencode(team_key), year=year);
645    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
646
647    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
648        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
649    }
650    if let Some(local_var_param_value) = if_none_match {
651        local_var_req_builder = local_var_req_builder.header("If-None-Match", local_var_param_value.to_string());
652    }
653    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
654        let local_var_key = local_var_apikey.key.clone();
655        let local_var_value = match local_var_apikey.prefix {
656            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
657            None => local_var_key,
658        };
659        local_var_req_builder = local_var_req_builder.header("X-TBA-Auth-Key", local_var_value);
660    };
661
662    let local_var_req = local_var_req_builder.build()?;
663    let local_var_resp = local_var_client.execute(local_var_req).await?;
664
665    let local_var_status = local_var_resp.status();
666    let local_var_content = local_var_resp.text().await?;
667
668    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
669        serde_json::from_str(&local_var_content).map_err(Error::from)
670    } else {
671        let local_var_entity: Option<GetTeamMatchesByYearSimpleError> = serde_json::from_str(&local_var_content).ok();
672        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
673        Err(Error::ResponseError(local_var_error))
674    }
675}
676