Skip to main content

puddle_farm_api_client_openapi_client/apis/
default_api.rs

1/*
2 * puddle.farm API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`alias_player_id_get`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AliasPlayerIdGetError {
22    Status404(),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`avatar_player_id_get`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum AvatarPlayerIdGetError {
30    Status404(),
31    Status503(),
32    UnknownValue(serde_json::Value),
33}
34
35/// struct for typed errors of method [`calc_rating_get`]
36#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum CalcRatingGetError {
39    Status400(),
40    UnknownValue(serde_json::Value),
41}
42
43/// struct for typed errors of method [`characters_get`]
44#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum CharactersGetError {
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`claim_player_id_get`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum ClaimPlayerIdGetError {
54    Status404(),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`claim_poll_player_id_get`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum ClaimPollPlayerIdGetError {
62    Status404(),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`distribution_get`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum DistributionGetError {
70    Status404(),
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`health_get`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum HealthGetError {
78    Status500(String),
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`matchups_get`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum MatchupsGetError {
86    Status404(),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`matchups_player_id_char_id_duration_get`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum MatchupsPlayerIdCharIdDurationGetError {
94    Status404(),
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`player_id_get`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum PlayerIdGetError {
102    Status404(),
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`player_player_id_char_id_history_get`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum PlayerPlayerIdCharIdHistoryGetError {
110    Status404(),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`player_search_get`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum PlayerSearchGetError {
118    UnknownValue(serde_json::Value),
119}
120
121/// struct for typed errors of method [`popularity_get`]
122#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum PopularityGetError {
125    Status404(),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`ratings_player_id_char_id_duration_get`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum RatingsPlayerIdCharIdDurationGetError {
133    Status404(),
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`settings_key_get`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum SettingsKeyGetError {
141    Status404(),
142    UnknownValue(serde_json::Value),
143}
144
145/// struct for typed errors of method [`stats_get`]
146#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum StatsGetError {
149    Status404(),
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`supporters_get`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum SupportersGetError {
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`toggle_private_key_get`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum TogglePrivateKeyGetError {
164    UnknownValue(serde_json::Value),
165}
166
167/// struct for typed errors of method [`top_char_char_id_get`]
168#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum TopCharCharIdGetError {
171    Status404(),
172    UnknownValue(serde_json::Value),
173}
174
175/// struct for typed errors of method [`top_get`]
176#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum TopGetError {
179    UnknownValue(serde_json::Value),
180}
181
182
183pub async fn alias_player_id_get(configuration: &configuration::Configuration, player_id: i64) -> Result<Vec<String>, Error<AliasPlayerIdGetError>> {
184    // add a prefix to parameters to efficiently prevent name collisions
185    let p_player_id = player_id;
186
187    let uri_str = format!("{}/alias/{player_id}", configuration.base_path, player_id=p_player_id);
188    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
189
190    if let Some(ref user_agent) = configuration.user_agent {
191        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
192    }
193
194    let req = req_builder.build()?;
195    let resp = configuration.client.execute(req).await?;
196
197    let status = resp.status();
198    let content_type = resp
199        .headers()
200        .get("content-type")
201        .and_then(|v| v.to_str().ok())
202        .unwrap_or("application/octet-stream");
203    let content_type = super::ContentType::from(content_type);
204
205    if !status.is_client_error() && !status.is_server_error() {
206        let content = resp.text().await?;
207        match content_type {
208            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
209            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;String&gt;`"))),
210            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;String&gt;`")))),
211        }
212    } else {
213        let content = resp.text().await?;
214        let entity: Option<AliasPlayerIdGetError> = serde_json::from_str(&content).ok();
215        Err(Error::ResponseError(ResponseContent { status, content, entity }))
216    }
217}
218
219pub async fn avatar_player_id_get(configuration: &configuration::Configuration, player_id: i64) -> Result<reqwest::Response, Error<AvatarPlayerIdGetError>> {
220    // add a prefix to parameters to efficiently prevent name collisions
221    let p_player_id = player_id;
222
223    let uri_str = format!("{}/avatar/{player_id}", configuration.base_path, player_id=p_player_id);
224    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226    if let Some(ref user_agent) = configuration.user_agent {
227        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228    }
229
230    let req = req_builder.build()?;
231    let resp = configuration.client.execute(req).await?;
232
233    let status = resp.status();
234
235    if !status.is_client_error() && !status.is_server_error() {
236        Ok(resp)
237    } else {
238        let content = resp.text().await?;
239        let entity: Option<AvatarPlayerIdGetError> = serde_json::from_str(&content).ok();
240        Err(Error::ResponseError(ResponseContent { status, content, entity }))
241    }
242}
243
244pub async fn calc_rating_get(configuration: &configuration::Configuration, rating_a: f32, drift_a: f32, rating_b: f32, drift_b: f32, a_wins: bool) -> Result<models::CalcRatingResponse, Error<CalcRatingGetError>> {
245    // add a prefix to parameters to efficiently prevent name collisions
246    let p_rating_a = rating_a;
247    let p_drift_a = drift_a;
248    let p_rating_b = rating_b;
249    let p_drift_b = drift_b;
250    let p_a_wins = a_wins;
251
252    let uri_str = format!("{}/calc_rating", configuration.base_path);
253    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
254
255    req_builder = req_builder.query(&[("rating_a", &p_rating_a.to_string())]);
256    req_builder = req_builder.query(&[("drift_a", &p_drift_a.to_string())]);
257    req_builder = req_builder.query(&[("rating_b", &p_rating_b.to_string())]);
258    req_builder = req_builder.query(&[("drift_b", &p_drift_b.to_string())]);
259    req_builder = req_builder.query(&[("a_wins", &p_a_wins.to_string())]);
260    if let Some(ref user_agent) = configuration.user_agent {
261        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
262    }
263
264    let req = req_builder.build()?;
265    let resp = configuration.client.execute(req).await?;
266
267    let status = resp.status();
268    let content_type = resp
269        .headers()
270        .get("content-type")
271        .and_then(|v| v.to_str().ok())
272        .unwrap_or("application/octet-stream");
273    let content_type = super::ContentType::from(content_type);
274
275    if !status.is_client_error() && !status.is_server_error() {
276        let content = resp.text().await?;
277        match content_type {
278            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
279            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CalcRatingResponse`"))),
280            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CalcRatingResponse`")))),
281        }
282    } else {
283        let content = resp.text().await?;
284        let entity: Option<CalcRatingGetError> = serde_json::from_str(&content).ok();
285        Err(Error::ResponseError(ResponseContent { status, content, entity }))
286    }
287}
288
289pub async fn characters_get(configuration: &configuration::Configuration, ) -> Result<Vec<Vec<String>>, Error<CharactersGetError>> {
290
291    let uri_str = format!("{}/characters", configuration.base_path);
292    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
293
294    if let Some(ref user_agent) = configuration.user_agent {
295        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
296    }
297
298    let req = req_builder.build()?;
299    let resp = configuration.client.execute(req).await?;
300
301    let status = resp.status();
302    let content_type = resp
303        .headers()
304        .get("content-type")
305        .and_then(|v| v.to_str().ok())
306        .unwrap_or("application/octet-stream");
307    let content_type = super::ContentType::from(content_type);
308
309    if !status.is_client_error() && !status.is_server_error() {
310        let content = resp.text().await?;
311        match content_type {
312            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
313            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;Vec&lt;String&gt;&gt;`"))),
314            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;Vec&lt;String&gt;&gt;`")))),
315        }
316    } else {
317        let content = resp.text().await?;
318        let entity: Option<CharactersGetError> = serde_json::from_str(&content).ok();
319        Err(Error::ResponseError(ResponseContent { status, content, entity }))
320    }
321}
322
323pub async fn claim_player_id_get(configuration: &configuration::Configuration, player_id: i64) -> Result<String, Error<ClaimPlayerIdGetError>> {
324    // add a prefix to parameters to efficiently prevent name collisions
325    let p_player_id = player_id;
326
327    let uri_str = format!("{}/claim/{player_id}", configuration.base_path, player_id=p_player_id);
328    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
329
330    if let Some(ref user_agent) = configuration.user_agent {
331        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
332    }
333
334    let req = req_builder.build()?;
335    let resp = configuration.client.execute(req).await?;
336
337    let status = resp.status();
338    let content_type = resp
339        .headers()
340        .get("content-type")
341        .and_then(|v| v.to_str().ok())
342        .unwrap_or("application/octet-stream");
343    let content_type = super::ContentType::from(content_type);
344
345    if !status.is_client_error() && !status.is_server_error() {
346        let content = resp.text().await?;
347        match content_type {
348            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
349            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
350            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
351        }
352    } else {
353        let content = resp.text().await?;
354        let entity: Option<ClaimPlayerIdGetError> = serde_json::from_str(&content).ok();
355        Err(Error::ResponseError(ResponseContent { status, content, entity }))
356    }
357}
358
359pub async fn claim_poll_player_id_get(configuration: &configuration::Configuration, player_id: i64) -> Result<String, Error<ClaimPollPlayerIdGetError>> {
360    // add a prefix to parameters to efficiently prevent name collisions
361    let p_player_id = player_id;
362
363    let uri_str = format!("{}/claim/poll/{player_id}", configuration.base_path, player_id=p_player_id);
364    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
365
366    if let Some(ref user_agent) = configuration.user_agent {
367        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
368    }
369
370    let req = req_builder.build()?;
371    let resp = configuration.client.execute(req).await?;
372
373    let status = resp.status();
374    let content_type = resp
375        .headers()
376        .get("content-type")
377        .and_then(|v| v.to_str().ok())
378        .unwrap_or("application/octet-stream");
379    let content_type = super::ContentType::from(content_type);
380
381    if !status.is_client_error() && !status.is_server_error() {
382        let content = resp.text().await?;
383        match content_type {
384            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
385            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
386            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
387        }
388    } else {
389        let content = resp.text().await?;
390        let entity: Option<ClaimPollPlayerIdGetError> = serde_json::from_str(&content).ok();
391        Err(Error::ResponseError(ResponseContent { status, content, entity }))
392    }
393}
394
395pub async fn distribution_get(configuration: &configuration::Configuration, ) -> Result<models::DistributionResponse, Error<DistributionGetError>> {
396
397    let uri_str = format!("{}/distribution", configuration.base_path);
398    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
399
400    if let Some(ref user_agent) = configuration.user_agent {
401        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
402    }
403
404    let req = req_builder.build()?;
405    let resp = configuration.client.execute(req).await?;
406
407    let status = resp.status();
408    let content_type = resp
409        .headers()
410        .get("content-type")
411        .and_then(|v| v.to_str().ok())
412        .unwrap_or("application/octet-stream");
413    let content_type = super::ContentType::from(content_type);
414
415    if !status.is_client_error() && !status.is_server_error() {
416        let content = resp.text().await?;
417        match content_type {
418            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
419            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DistributionResponse`"))),
420            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DistributionResponse`")))),
421        }
422    } else {
423        let content = resp.text().await?;
424        let entity: Option<DistributionGetError> = serde_json::from_str(&content).ok();
425        Err(Error::ResponseError(ResponseContent { status, content, entity }))
426    }
427}
428
429pub async fn health_get(configuration: &configuration::Configuration, ) -> Result<String, Error<HealthGetError>> {
430
431    let uri_str = format!("{}/health", configuration.base_path);
432    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
433
434    if let Some(ref user_agent) = configuration.user_agent {
435        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
436    }
437
438    let req = req_builder.build()?;
439    let resp = configuration.client.execute(req).await?;
440
441    let status = resp.status();
442    let content_type = resp
443        .headers()
444        .get("content-type")
445        .and_then(|v| v.to_str().ok())
446        .unwrap_or("application/octet-stream");
447    let content_type = super::ContentType::from(content_type);
448
449    if !status.is_client_error() && !status.is_server_error() {
450        let content = resp.text().await?;
451        match content_type {
452            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
453            ContentType::Text => return Ok(content),
454            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
455        }
456    } else {
457        let content = resp.text().await?;
458        let entity: Option<HealthGetError> = serde_json::from_str(&content).ok();
459        Err(Error::ResponseError(ResponseContent { status, content, entity }))
460    }
461}
462
463pub async fn matchups_get(configuration: &configuration::Configuration, ) -> Result<models::MatchupResponse, Error<MatchupsGetError>> {
464
465    let uri_str = format!("{}/matchups", configuration.base_path);
466    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
467
468    if let Some(ref user_agent) = configuration.user_agent {
469        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
470    }
471
472    let req = req_builder.build()?;
473    let resp = configuration.client.execute(req).await?;
474
475    let status = resp.status();
476    let content_type = resp
477        .headers()
478        .get("content-type")
479        .and_then(|v| v.to_str().ok())
480        .unwrap_or("application/octet-stream");
481    let content_type = super::ContentType::from(content_type);
482
483    if !status.is_client_error() && !status.is_server_error() {
484        let content = resp.text().await?;
485        match content_type {
486            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
487            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MatchupResponse`"))),
488            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::MatchupResponse`")))),
489        }
490    } else {
491        let content = resp.text().await?;
492        let entity: Option<MatchupsGetError> = serde_json::from_str(&content).ok();
493        Err(Error::ResponseError(ResponseContent { status, content, entity }))
494    }
495}
496
497pub async fn matchups_player_id_char_id_duration_get(configuration: &configuration::Configuration, player_id: i64, char_id: &str, duration: i32) -> Result<models::MatchupCharResponse, Error<MatchupsPlayerIdCharIdDurationGetError>> {
498    // add a prefix to parameters to efficiently prevent name collisions
499    let p_player_id = player_id;
500    let p_char_id = char_id;
501    let p_duration = duration;
502
503    let uri_str = format!("{}/matchups/{player_id}/{char_id}/{duration}", configuration.base_path, player_id=p_player_id, char_id=crate::apis::urlencode(p_char_id), duration=p_duration);
504    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
505
506    if let Some(ref user_agent) = configuration.user_agent {
507        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
508    }
509
510    let req = req_builder.build()?;
511    let resp = configuration.client.execute(req).await?;
512
513    let status = resp.status();
514    let content_type = resp
515        .headers()
516        .get("content-type")
517        .and_then(|v| v.to_str().ok())
518        .unwrap_or("application/octet-stream");
519    let content_type = super::ContentType::from(content_type);
520
521    if !status.is_client_error() && !status.is_server_error() {
522        let content = resp.text().await?;
523        match content_type {
524            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
525            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MatchupCharResponse`"))),
526            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::MatchupCharResponse`")))),
527        }
528    } else {
529        let content = resp.text().await?;
530        let entity: Option<MatchupsPlayerIdCharIdDurationGetError> = serde_json::from_str(&content).ok();
531        Err(Error::ResponseError(ResponseContent { status, content, entity }))
532    }
533}
534
535pub async fn player_id_get(configuration: &configuration::Configuration, id: i64) -> Result<models::PlayerResponse, Error<PlayerIdGetError>> {
536    // add a prefix to parameters to efficiently prevent name collisions
537    let p_id = id;
538
539    let uri_str = format!("{}/player/{id}", configuration.base_path, id=p_id);
540    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
541
542    if let Some(ref user_agent) = configuration.user_agent {
543        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
544    }
545
546    let req = req_builder.build()?;
547    let resp = configuration.client.execute(req).await?;
548
549    let status = resp.status();
550    let content_type = resp
551        .headers()
552        .get("content-type")
553        .and_then(|v| v.to_str().ok())
554        .unwrap_or("application/octet-stream");
555    let content_type = super::ContentType::from(content_type);
556
557    if !status.is_client_error() && !status.is_server_error() {
558        let content = resp.text().await?;
559        match content_type {
560            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
561            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlayerResponse`"))),
562            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlayerResponse`")))),
563        }
564    } else {
565        let content = resp.text().await?;
566        let entity: Option<PlayerIdGetError> = serde_json::from_str(&content).ok();
567        Err(Error::ResponseError(ResponseContent { status, content, entity }))
568    }
569}
570
571pub async fn player_player_id_char_id_history_get(configuration: &configuration::Configuration, player_id: i64, char_id: &str, count: Option<i32>, offset: Option<i32>) -> Result<models::PlayerGamesResponse, Error<PlayerPlayerIdCharIdHistoryGetError>> {
572    // add a prefix to parameters to efficiently prevent name collisions
573    let p_player_id = player_id;
574    let p_char_id = char_id;
575    let p_count = count;
576    let p_offset = offset;
577
578    let uri_str = format!("{}/player/{player_id}/{char_id}/history", configuration.base_path, player_id=p_player_id, char_id=crate::apis::urlencode(p_char_id));
579    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
580
581    if let Some(ref param_value) = p_count {
582        req_builder = req_builder.query(&[("count", &param_value.to_string())]);
583    }
584    if let Some(ref param_value) = p_offset {
585        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
586    }
587    if let Some(ref user_agent) = configuration.user_agent {
588        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
589    }
590
591    let req = req_builder.build()?;
592    let resp = configuration.client.execute(req).await?;
593
594    let status = resp.status();
595    let content_type = resp
596        .headers()
597        .get("content-type")
598        .and_then(|v| v.to_str().ok())
599        .unwrap_or("application/octet-stream");
600    let content_type = super::ContentType::from(content_type);
601
602    if !status.is_client_error() && !status.is_server_error() {
603        let content = resp.text().await?;
604        match content_type {
605            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
606            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlayerGamesResponse`"))),
607            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlayerGamesResponse`")))),
608        }
609    } else {
610        let content = resp.text().await?;
611        let entity: Option<PlayerPlayerIdCharIdHistoryGetError> = serde_json::from_str(&content).ok();
612        Err(Error::ResponseError(ResponseContent { status, content, entity }))
613    }
614}
615
616pub async fn player_search_get(configuration: &configuration::Configuration, search_string: &str, exact: Option<bool>) -> Result<models::SearchResponse, Error<PlayerSearchGetError>> {
617    // add a prefix to parameters to efficiently prevent name collisions
618    let p_search_string = search_string;
619    let p_exact = exact;
620
621    let uri_str = format!("{}/player/search", configuration.base_path);
622    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
623
624    req_builder = req_builder.query(&[("search_string", &p_search_string.to_string())]);
625    if let Some(ref param_value) = p_exact {
626        req_builder = req_builder.query(&[("exact", &param_value.to_string())]);
627    }
628    if let Some(ref user_agent) = configuration.user_agent {
629        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
630    }
631
632    let req = req_builder.build()?;
633    let resp = configuration.client.execute(req).await?;
634
635    let status = resp.status();
636    let content_type = resp
637        .headers()
638        .get("content-type")
639        .and_then(|v| v.to_str().ok())
640        .unwrap_or("application/octet-stream");
641    let content_type = super::ContentType::from(content_type);
642
643    if !status.is_client_error() && !status.is_server_error() {
644        let content = resp.text().await?;
645        match content_type {
646            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
647            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SearchResponse`"))),
648            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SearchResponse`")))),
649        }
650    } else {
651        let content = resp.text().await?;
652        let entity: Option<PlayerSearchGetError> = serde_json::from_str(&content).ok();
653        Err(Error::ResponseError(ResponseContent { status, content, entity }))
654    }
655}
656
657pub async fn popularity_get(configuration: &configuration::Configuration, ) -> Result<models::PopularityResult, Error<PopularityGetError>> {
658
659    let uri_str = format!("{}/popularity", configuration.base_path);
660    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
661
662    if let Some(ref user_agent) = configuration.user_agent {
663        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
664    }
665
666    let req = req_builder.build()?;
667    let resp = configuration.client.execute(req).await?;
668
669    let status = resp.status();
670    let content_type = resp
671        .headers()
672        .get("content-type")
673        .and_then(|v| v.to_str().ok())
674        .unwrap_or("application/octet-stream");
675    let content_type = super::ContentType::from(content_type);
676
677    if !status.is_client_error() && !status.is_server_error() {
678        let content = resp.text().await?;
679        match content_type {
680            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
681            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PopularityResult`"))),
682            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PopularityResult`")))),
683        }
684    } else {
685        let content = resp.text().await?;
686        let entity: Option<PopularityGetError> = serde_json::from_str(&content).ok();
687        Err(Error::ResponseError(ResponseContent { status, content, entity }))
688    }
689}
690
691pub async fn ratings_player_id_char_id_duration_get(configuration: &configuration::Configuration, player_id: i64, char_id: &str, duration: i32) -> Result<Vec<models::RatingsResponse>, Error<RatingsPlayerIdCharIdDurationGetError>> {
692    // add a prefix to parameters to efficiently prevent name collisions
693    let p_player_id = player_id;
694    let p_char_id = char_id;
695    let p_duration = duration;
696
697    let uri_str = format!("{}/ratings/{player_id}/{char_id}/{duration}", configuration.base_path, player_id=p_player_id, char_id=crate::apis::urlencode(p_char_id), duration=p_duration);
698    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
699
700    if let Some(ref user_agent) = configuration.user_agent {
701        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
702    }
703
704    let req = req_builder.build()?;
705    let resp = configuration.client.execute(req).await?;
706
707    let status = resp.status();
708    let content_type = resp
709        .headers()
710        .get("content-type")
711        .and_then(|v| v.to_str().ok())
712        .unwrap_or("application/octet-stream");
713    let content_type = super::ContentType::from(content_type);
714
715    if !status.is_client_error() && !status.is_server_error() {
716        let content = resp.text().await?;
717        match content_type {
718            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
719            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::RatingsResponse&gt;`"))),
720            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::RatingsResponse&gt;`")))),
721        }
722    } else {
723        let content = resp.text().await?;
724        let entity: Option<RatingsPlayerIdCharIdDurationGetError> = serde_json::from_str(&content).ok();
725        Err(Error::ResponseError(ResponseContent { status, content, entity }))
726    }
727}
728
729pub async fn settings_key_get(configuration: &configuration::Configuration, key: &str) -> Result<models::SettingsResponse, Error<SettingsKeyGetError>> {
730    // add a prefix to parameters to efficiently prevent name collisions
731    let p_key = key;
732
733    let uri_str = format!("{}/settings/{key}", configuration.base_path, key=crate::apis::urlencode(p_key));
734    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
735
736    if let Some(ref user_agent) = configuration.user_agent {
737        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
738    }
739
740    let req = req_builder.build()?;
741    let resp = configuration.client.execute(req).await?;
742
743    let status = resp.status();
744    let content_type = resp
745        .headers()
746        .get("content-type")
747        .and_then(|v| v.to_str().ok())
748        .unwrap_or("application/octet-stream");
749    let content_type = super::ContentType::from(content_type);
750
751    if !status.is_client_error() && !status.is_server_error() {
752        let content = resp.text().await?;
753        match content_type {
754            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
755            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SettingsResponse`"))),
756            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SettingsResponse`")))),
757        }
758    } else {
759        let content = resp.text().await?;
760        let entity: Option<SettingsKeyGetError> = serde_json::from_str(&content).ok();
761        Err(Error::ResponseError(ResponseContent { status, content, entity }))
762    }
763}
764
765pub async fn stats_get(configuration: &configuration::Configuration, ) -> Result<models::StatsResponse, Error<StatsGetError>> {
766
767    let uri_str = format!("{}/stats", configuration.base_path);
768    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
769
770    if let Some(ref user_agent) = configuration.user_agent {
771        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
772    }
773
774    let req = req_builder.build()?;
775    let resp = configuration.client.execute(req).await?;
776
777    let status = resp.status();
778    let content_type = resp
779        .headers()
780        .get("content-type")
781        .and_then(|v| v.to_str().ok())
782        .unwrap_or("application/octet-stream");
783    let content_type = super::ContentType::from(content_type);
784
785    if !status.is_client_error() && !status.is_server_error() {
786        let content = resp.text().await?;
787        match content_type {
788            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
789            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StatsResponse`"))),
790            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StatsResponse`")))),
791        }
792    } else {
793        let content = resp.text().await?;
794        let entity: Option<StatsGetError> = serde_json::from_str(&content).ok();
795        Err(Error::ResponseError(ResponseContent { status, content, entity }))
796    }
797}
798
799pub async fn supporters_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::Supporter>, Error<SupportersGetError>> {
800
801    let uri_str = format!("{}/supporters", configuration.base_path);
802    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
803
804    if let Some(ref user_agent) = configuration.user_agent {
805        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
806    }
807
808    let req = req_builder.build()?;
809    let resp = configuration.client.execute(req).await?;
810
811    let status = resp.status();
812    let content_type = resp
813        .headers()
814        .get("content-type")
815        .and_then(|v| v.to_str().ok())
816        .unwrap_or("application/octet-stream");
817    let content_type = super::ContentType::from(content_type);
818
819    if !status.is_client_error() && !status.is_server_error() {
820        let content = resp.text().await?;
821        match content_type {
822            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
823            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Supporter&gt;`"))),
824            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Supporter&gt;`")))),
825        }
826    } else {
827        let content = resp.text().await?;
828        let entity: Option<SupportersGetError> = serde_json::from_str(&content).ok();
829        Err(Error::ResponseError(ResponseContent { status, content, entity }))
830    }
831}
832
833pub async fn toggle_private_key_get(configuration: &configuration::Configuration, key: &str) -> Result<String, Error<TogglePrivateKeyGetError>> {
834    // add a prefix to parameters to efficiently prevent name collisions
835    let p_key = key;
836
837    let uri_str = format!("{}/toggle_private/{key}", configuration.base_path, key=crate::apis::urlencode(p_key));
838    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
839
840    if let Some(ref user_agent) = configuration.user_agent {
841        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
842    }
843
844    let req = req_builder.build()?;
845    let resp = configuration.client.execute(req).await?;
846
847    let status = resp.status();
848    let content_type = resp
849        .headers()
850        .get("content-type")
851        .and_then(|v| v.to_str().ok())
852        .unwrap_or("application/octet-stream");
853    let content_type = super::ContentType::from(content_type);
854
855    if !status.is_client_error() && !status.is_server_error() {
856        let content = resp.text().await?;
857        match content_type {
858            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
859            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
860            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
861        }
862    } else {
863        let content = resp.text().await?;
864        let entity: Option<TogglePrivateKeyGetError> = serde_json::from_str(&content).ok();
865        Err(Error::ResponseError(ResponseContent { status, content, entity }))
866    }
867}
868
869pub async fn top_char_char_id_get(configuration: &configuration::Configuration, char_id: &str, count: Option<i32>, offset: Option<i32>) -> Result<models::RankResponse, Error<TopCharCharIdGetError>> {
870    // add a prefix to parameters to efficiently prevent name collisions
871    let p_char_id = char_id;
872    let p_count = count;
873    let p_offset = offset;
874
875    let uri_str = format!("{}/top_char/{char_id}", configuration.base_path, char_id=crate::apis::urlencode(p_char_id));
876    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
877
878    if let Some(ref param_value) = p_count {
879        req_builder = req_builder.query(&[("count", &param_value.to_string())]);
880    }
881    if let Some(ref param_value) = p_offset {
882        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
883    }
884    if let Some(ref user_agent) = configuration.user_agent {
885        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
886    }
887
888    let req = req_builder.build()?;
889    let resp = configuration.client.execute(req).await?;
890
891    let status = resp.status();
892    let content_type = resp
893        .headers()
894        .get("content-type")
895        .and_then(|v| v.to_str().ok())
896        .unwrap_or("application/octet-stream");
897    let content_type = super::ContentType::from(content_type);
898
899    if !status.is_client_error() && !status.is_server_error() {
900        let content = resp.text().await?;
901        match content_type {
902            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
903            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RankResponse`"))),
904            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RankResponse`")))),
905        }
906    } else {
907        let content = resp.text().await?;
908        let entity: Option<TopCharCharIdGetError> = serde_json::from_str(&content).ok();
909        Err(Error::ResponseError(ResponseContent { status, content, entity }))
910    }
911}
912
913pub async fn top_get(configuration: &configuration::Configuration, count: Option<i32>, offset: Option<i32>) -> Result<models::RankResponse, Error<TopGetError>> {
914    // add a prefix to parameters to efficiently prevent name collisions
915    let p_count = count;
916    let p_offset = offset;
917
918    let uri_str = format!("{}/top", configuration.base_path);
919    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
920
921    if let Some(ref param_value) = p_count {
922        req_builder = req_builder.query(&[("count", &param_value.to_string())]);
923    }
924    if let Some(ref param_value) = p_offset {
925        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
926    }
927    if let Some(ref user_agent) = configuration.user_agent {
928        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
929    }
930
931    let req = req_builder.build()?;
932    let resp = configuration.client.execute(req).await?;
933
934    let status = resp.status();
935    let content_type = resp
936        .headers()
937        .get("content-type")
938        .and_then(|v| v.to_str().ok())
939        .unwrap_or("application/octet-stream");
940    let content_type = super::ContentType::from(content_type);
941
942    if !status.is_client_error() && !status.is_server_error() {
943        let content = resp.text().await?;
944        match content_type {
945            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
946            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RankResponse`"))),
947            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RankResponse`")))),
948        }
949    } else {
950        let content = resp.text().await?;
951        let entity: Option<TopGetError> = serde_json::from_str(&content).ok();
952        Err(Error::ResponseError(ResponseContent { status, content, entity }))
953    }
954}
955