Skip to main content

Puck

Struct Puck 

Source
pub struct Puck { /* private fields */ }

Implementations§

Source§

impl Puck

§Puck util’s

Source

pub fn new() -> Puck

Create a new Puck client.

§Example
use nhl_data::Puck;
let client = Puck::new();
Source

pub fn set_print(self, setting: bool) -> Puck

Set whether to print keys from API responses.

§Example
use nhl_data::Puck;
let client = Puck::new().set_print(true);
Source

pub fn open(self) -> Client

Get the underlying reqwest client.

§Example
use nhl_data::Puck;
let client = Puck::new();
let reqwest_client = client.open();
Source§

impl Puck

§Players

Source

pub async fn get_player_career_stats( &self, id: &str, ) -> Result<IndexMap<String, Value>, Error>

Get career stats for a player.

§Arguments
  • id - Player ID
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_player_career_stats("8478402").await;
    assert!(result.is_ok());
}
Source

pub async fn get_player_game_log( &self, id: &str, season: &str, game_type: &str, ) -> Result<IndexMap<String, Value>, Error>

Get game log for a player for a season and game type.

§Arguments
  • id - Player ID
  • season - Season string
  • game_type - Game type (2=regular, 3=playoff)
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_player_game_log("8478402", "20232024", "2").await;
    assert!(result.is_ok());
}
Source

pub async fn get_player_game_log_now( &self, id: &str, ) -> Result<IndexMap<String, Value>, Error>

Get current game log for a player.

§Arguments
  • id - Player ID
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_player_game_log_now("8478402").await;
    assert!(result.is_ok());
}
Source

pub async fn get_player_spotlight( &self, ) -> Result<IndexMap<String, Value>, Error>

Get player spotlight data.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_player_spotlight().await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Skaters

Source

pub async fn get_current_skater_stats( &self, category: &str, ) -> Result<IndexMap<String, Value>, Error>

Get current skater stats leaders.

§Arguments
  • category - Stat category (can be empty)
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_current_skater_stats("goals").await;
    assert!(result.is_ok());
}
Source

pub async fn get_current_skater_stats_season_game_type( &self, season: &str, game_type: &str, category: &str, ) -> Result<IndexMap<String, Value>, Error>

Get skater stats leaders for a season and game type.

§Arguments
  • season - Season string
  • game_type - Game type
  • category - Stat category
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_current_skater_stats_season_game_type("20242025", "2", "").await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Goalies

Source

pub async fn get_current_goalie_stats( &self, category: &str, ) -> Result<IndexMap<String, Value>, Error>

Get current goalie stats leaders.

§Arguments
  • category - Stat category (can be empty)
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_current_goalie_stats("").await;
    assert!(result.is_ok());
}
Source

pub async fn get_current_goalie_stats_season_game_type( &self, season: &str, game_type: &str, category: &str, ) -> Result<IndexMap<String, Value>, Error>

Get goalie stats leaders for a season and game type.

§Arguments
  • season - Season string
  • game_type - Game type
  • category - Stat category
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_current_goalie_stats_season_game_type("20242025", "2", "").await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Teams

Source

pub async fn get_team_standings(&self) -> Result<IndexMap<String, Value>, Error>

Get current team standings.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_standings().await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_standings_date( &self, date: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team standings for a specific date.

§Arguments
  • date - Date in YYYY-MM-DD format
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_standings_date("2023-11-10").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_standings_season( &self, ) -> Result<IndexMap<String, Value>, Error>

Get team standings for each season.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_standings_season().await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Clubs

Source

pub async fn get_club_stats( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get current stats for a club.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_club_stats("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_club_stats_season( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get club stats for each season.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_club_stats_season("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_club_stats_season_game_type( &self, team: &str, season: &str, game_type: &str, ) -> Result<IndexMap<String, Value>, Error>

Get club stats for a season and game type.

§Arguments
  • team - Team code
  • season - Season string
  • game_type - Game type
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_club_stats_season_game_type("TOR", "20232024", "2").await;
    assert!(result.is_ok());
}
Source

pub async fn get_club_scores( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get club scoreboard as of now.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_club_scores("TOR").await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Roster

Source

pub async fn get_team_roster( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team roster as of now.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_roster("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_roster_season( &self, team: &str, season: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team roster for a specific season.

§Arguments
  • team - Team code
  • season - Season string
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_roster_season("TOR", "20232024").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_played_seasons( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get all seasons played by a team.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_played_seasons("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_prospects( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get prospects for a team.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_prospects("TOR").await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Scores

Source

pub async fn get_scores_now(&self) -> Result<IndexMap<String, Value>, Error>

Get daily scores as of now.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_scores_now().await;
    assert!(result.is_ok());
}
Source

pub async fn get_scores_date( &self, date: &str, ) -> Result<IndexMap<String, Value>, Error>

Get daily scores for a specific date.

§Arguments
  • date - Date in YYYY-MM-DD format
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_scores_date("2023-11-10").await;
    assert!(result.is_ok());
}
Source

pub async fn get_scoreboard(&self) -> Result<IndexMap<String, Value>, Error>

Get overall scoreboard as of now.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_scoreboard().await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Game

Source

pub async fn get_play_by_play( &self, game_id: &str, ) -> Result<IndexMap<String, Value>, Error>

Get play-by-play information for a game.

§Arguments
  • game_id - Game ID
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_play_by_play("2023020001").await;
    assert!(result.is_ok());
}
Source

pub async fn get_landing_page( &self, game_id: &str, ) -> Result<IndexMap<String, Value>, Error>

Get landing page information for a game.

§Arguments
  • game_id - Game ID
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_landing_page("2023020001").await;
    assert!(result.is_ok());
}
Source

pub async fn get_game_odds( &self, country_code: &str, ) -> Result<IndexMap<String, Value>, Error>

Get game odds for a country.

§Arguments
  • country_code - Country code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_game_odds("US").await;
    assert!(result.is_ok());
}
Source§

impl Puck

§Schedule

Source

pub async fn get_team_schedule_now( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team season schedule as of now.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_schedule_now("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_schedule_season( &self, team: &str, season: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team season schedule for a specific season.

§Arguments
  • team - Team code
  • season - Season string
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_schedule_season("TOR", "20232024").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_schedule_now_month( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team monthly schedule as of now.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_schedule_now_month("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_schedule_at_month( &self, team: &str, month: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team monthly schedule for a specific date.

§Arguments
  • team - Team code
  • month - Date in YYYY-MM format
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_schedule_at_month("TOR", "2023-11").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_schedule_at_week( &self, team: &str, date: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team weekly schedule for a specific date.

§Arguments
  • team - Team code
  • date - Date in YYYY-MM-DD format
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_schedule_at_week("TOR", "2023-11-10").await;
    assert!(result.is_ok());
}
Source

pub async fn get_team_schedule_now_week( &self, team: &str, ) -> Result<IndexMap<String, Value>, Error>

Get team weekly schedule as of now.

§Arguments
  • team - Team code
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_team_schedule_now_week("TOR").await;
    assert!(result.is_ok());
}
Source

pub async fn get_schedule_now(&self) -> Result<IndexMap<String, Value>, Error>

Get current NHL schedule.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_schedule_now().await;
    assert!(result.is_ok());
}
Source

pub async fn get_schedule_date( &self, date: &str, ) -> Result<IndexMap<String, Value>, Error>

Get NHL schedule for a specific date.

§Arguments
  • date - Date in YYYY-MM-DD format
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_schedule_date("2023-11-10").await;
    assert!(result.is_ok());
}
Source

pub async fn get_schedule_calendar( &self, ) -> Result<IndexMap<String, Value>, Error>

Get NHL schedule calendar as of now.

§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_schedule_calendar().await;
    assert!(result.is_ok());
}
Source

pub async fn get_schedule_calendar_date( &self, date: &str, ) -> Result<IndexMap<String, Value>, Error>

Get NHL schedule calendar for a specific date.

§Arguments
  • date - Date in YYYY-MM-DD format
§Example
use nhl_data::Puck;
#[tokio::main]
async fn main() {
    let client = Puck::new();
    let result = client.get_schedule_calendar_date("2023-11-10").await;
    assert!(result.is_ok());
}

Auto Trait Implementations§

§

impl !RefUnwindSafe for Puck

§

impl !UnwindSafe for Puck

§

impl Freeze for Puck

§

impl Send for Puck

§

impl Sync for Puck

§

impl Unpin for Puck

§

impl UnsafeUnpin for Puck

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more