mod player;
mod skaters;
mod goalies;
mod teams;
mod clubs;
mod roster;
mod schedule;
mod scores;
mod game;
use serde_json::Value;
use indexmap::IndexMap;
use crate::Puck;
impl Puck {
pub fn new() -> Puck{
Puck {
get_client: reqwest::Client::new(),
print_keys : false,
api_limit : 5,
}
}
pub fn set_print(mut self, setting : bool) -> Puck{
self.print_keys = setting;
self
}
pub fn open(self) -> reqwest::Client{
self.get_client
}
}
impl Puck {
pub async fn get_player_career_stats(&self, id: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(player::player_career_stats(&self, id).await?)
}
pub async fn get_player_game_log(&self, id: &str, season : &str, game_type : &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(player::player_game_log(&self, id, season, game_type).await?)
}
pub async fn get_player_game_log_now(&self, id: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(player::player_game_log_now(&self, id).await?)
}
pub async fn get_player_spotlight(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(player::player_spotlight(&self).await?)
}
}
impl Puck {
pub async fn get_current_skater_stats(&self, category: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(skaters::current_skater_stats(&self, category).await?)
}
pub async fn get_current_skater_stats_season_game_type(&self, season : &str, game_type :&str, category: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(skaters::current_skater_stats_season_game_type(&self, season, game_type, category).await?)
}
}
impl Puck {
pub async fn get_current_goalie_stats(&self, category: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(goalies::current_goalie_stats(&self, category).await?)
}
pub async fn get_current_goalie_stats_season_game_type(&self, season: &str, game_type: &str, category: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(goalies::current_goalie_stats_season_game_type(&self, season, game_type, category).await?)
}
}
impl Puck {
pub async fn get_team_standings(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(teams::team_standings(&self).await?)
}
pub async fn get_team_standings_date(&self, date : &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(teams::team_standings_date(&self, date).await?)
}
pub async fn get_team_standings_season(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(teams::team_standings_season(&self).await?)
}
}
impl Puck {
pub async fn get_club_stats(&self, team : &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(clubs::club_stats(&self, team).await?)
}
pub async fn get_club_stats_season(&self, team : &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(clubs::club_stats_season(&self, team).await?)
}
pub async fn get_club_stats_season_game_type(&self, team : &str, season : &str, game_type : &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(clubs::club_stats_season_game_type(&self, team, season, game_type).await?)
}
pub async fn get_club_scores(&self, team : &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(clubs::club_scores(&self, team).await?)
}
}
impl Puck {
pub async fn get_team_roster(&self, team: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(roster::team_roster(&self, team).await?)
}
pub async fn get_team_roster_season(&self, team: &str, season: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(roster::team_roster_season(&self, team, season).await?)
}
pub async fn get_team_played_seasons(&self, team: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(roster::team_played_seasons(&self, team).await?)
}
pub async fn get_team_prospects(&self, team: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(roster::team_prospects(&self, team).await?)
}
}
impl Puck {
pub async fn get_scores_now(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(scores::scores_now(&self).await?)
}
pub async fn get_scores_date(&self, date: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(scores::scores_date(&self, date).await?)
}
pub async fn get_scoreboard(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(scores::scoreboard(&self).await?)
}
}
impl Puck {
pub async fn get_play_by_play(&self, game_id: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(game::play_by_play(&self, game_id).await?)
}
pub async fn get_landing_page(&self, game_id: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(game::landing_page(&self, game_id).await?)
}
pub async fn get_game_odds(&self, country_code: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(game::game_odds(&self, country_code).await?)
}
}
impl Puck {
pub async fn get_team_schedule_now(&self, team: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::team_schedule_now(&self, team).await?)
}
pub async fn get_team_schedule_season(&self, team: &str, season: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::team_schedule_season(&self, team, season).await?)
}
pub async fn get_team_schedule_now_month(&self, team: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::team_schedule_now_month(&self, team).await?)
}
pub async fn get_team_schedule_at_month(&self, team: &str, month: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::team_schedule_at_month(&self, team, month).await?)
}
pub async fn get_team_schedule_at_week(&self, team: &str, date: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::team_schedule_at_week(&self, team, date).await?)
}
pub async fn get_team_schedule_now_week(&self, team: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::team_schedule_now_week(&self, team).await?)
}
pub async fn get_schedule_now(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::schedule_now(&self).await?)
}
pub async fn get_schedule_date(&self, date: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::schedule_date(&self, date).await?)
}
pub async fn get_schedule_calendar(&self) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::schedule_calendar(&self).await?)
}
pub async fn get_schedule_calendar_date(&self, date: &str) -> Result<IndexMap<String, Value>, reqwest::Error> {
Ok(schedule::schedule_calendar_date(&self, date).await?)
}
}