Skip to main content

nhl_stats/sync/
stats_api.rs

1/*
2 * NHL API
3 *
4 * Documenting the publicly accessible portions of the NHL API.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use std::rc::Rc;
12use std::borrow::Borrow;
13
14use reqwest;
15
16use super::{Error, configuration};
17
18pub struct StatsApiClient {
19    configuration: Rc<configuration::Configuration>,
20}
21
22impl StatsApiClient {
23    pub fn new(configuration: Rc<configuration::Configuration>) -> StatsApiClient {
24        StatsApiClient {
25            configuration: configuration,
26        }
27    }
28}
29
30pub trait StatsApi {
31    fn get_stat_types(&self, ) -> Result<crate::models::StatTypes, Error>;
32}
33
34impl StatsApi for StatsApiClient {
35    fn get_stat_types(&self, ) -> Result<crate::models::StatTypes, Error> {
36        let configuration: &configuration::Configuration = self.configuration.borrow();
37        let client = &configuration.client;
38
39        let uri_str = format!("{}/statTypes", configuration.base_path);
40        let mut req_builder = client.get(uri_str.as_str());
41
42        if let Some(ref user_agent) = configuration.user_agent {
43            req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
44        }
45
46        // send request
47        let req = req_builder.build()?;
48
49        Ok(client.execute(req)?.error_for_status()?.json()?)
50    }
51
52}