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
/*
 * NHL API
 *
 * Documenting the publicly accessible portions of the NHL API.
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use std::rc::Rc;
use std::borrow::Borrow;

use hyper;
use serde_json;
use futures::Future;

use super::{Error, configuration};
use super::request as __internal_request;

pub struct PlayersApiClient<C: hyper::client::Connect> {
    configuration: Rc<configuration::Configuration<C>>,
}

impl<C: hyper::client::Connect> PlayersApiClient<C> {
    pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PlayersApiClient<C> {
        PlayersApiClient {
            configuration: configuration,
        }
    }
}

pub trait PlayersApi {
    fn get_player(&self, id: u32) -> Box<Future<Item = crate::models::Players, Error = Error<serde_json::Value>>>;
    fn get_player_stats(&self, id: u32, stats: crate::models::EnumStatTypes, season: &str) -> Box<Future<Item = crate::models::PlayerStats, Error = Error<serde_json::Value>>>;
}


impl<C: hyper::client::Connect>PlayersApi for PlayersApiClient<C> {
    fn get_player(&self, id: u32) -> Box<Future<Item = crate::models::Players, Error = Error<serde_json::Value>>> {
        __internal_request::Request::new(hyper::Method::Get, "/people/{id}".to_string())
            .with_path_param("id".to_string(), id.to_string())
            .execute(self.configuration.borrow())
    }

    fn get_player_stats(&self, id: u32, stats: crate::models::EnumStatTypes, season: &str) -> Box<Future<Item = crate::models::PlayerStats, Error = Error<serde_json::Value>>> {
        __internal_request::Request::new(hyper::Method::Get, "/people/{id}/stats".to_string())
            .with_query_param("stats".to_string(), stats.to_string())
            .with_query_param("season".to_string(), season.to_string())
            .with_path_param("id".to_string(), id.to_string())
            .execute(self.configuration.borrow())
    }

}