# NHL Stats API Client for Rust [![Crates.io](https://img.shields.io/crates/v/nhl-stats)](https://crates.io/crates/nhl-stats) [![](https://docs.rs/nhl-stats/badge.svg)](https://docs.rs/nhl-stats) Rust client for using the NHL Stats API. - OpenAPI 3.0 spec provided by [erunion/sport-api-specifications/nhl](https://github.com/erunion/sport-api-specifications/tree/master/nhl) - Generated using [OpenAPI Generator](https://openapi-generator.tech) - More comprehensive documentation from [dword4/nhlapi/stats-api.md](https://gitlab.com/dword4/nhlapi/blob/master/stats-api.md) Both `reqwest` and `hyper` clients are avaialable by default, and behind feature flags `sync` and `async`, respectively. ## Known Issues - The openapi spec being used isn't perfect, neither is the generator for Rust, so expect lots of problems and things that are just wrong. Please open issues so I can fix. - Modifiers defined in the openapi spec are currently required within applicable ApiClient methods, only some allow passing blank values. Eventually I'll try to convert these over to Options for better usability. ## Example ```rust use nhl_stats::parameters::*; use nhl_stats::sync::configuration::Configuration; use nhl_stats::sync::*; use std::rc::Rc; fn main() -> Result<(), Error> { let config = Rc::from(Configuration::default()); let teams_client = TeamsApiClient::new(config); // First parameter is expand=, use applicable enum from parameters module // Second parameter is season (both years included) let expand = EnumExpandTeams::TeamRoster; let teams = teams_client.get_teams(expand, "20192020")?; for team in teams.teams.unwrap() { println!("{:#?}", team); } Ok(()) } ``` ## OpenAPI Generator This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.RustClientCodegen For more information, please visit [https://github.com/erunion/sport-api-specifications](https://github.com/erunion/sport-api-specifications) ## Documentation for API Endpoints All URIs are relative to *https://statsapi.web.nhl.com/api/v1* | Class | Method | HTTP request | Description | | ---------------- | ----------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------- | | *ConferencesApi* | [**get_conference**](docs/ConferencesApi.md#get_conference) | **Get** /conferences/{id} | Get an NHL conference. | | *ConferencesApi* | [**get_conferences**](docs/ConferencesApi.md#get_conferences) | **Get** /conferences | Get all current NHL conferences. | | *DivisionsApi* | [**get_division**](docs/DivisionsApi.md#get_division) | **Get** /divisions/{id} | Get an NHL division. | | *DivisionsApi* | [**get_divisions**](docs/DivisionsApi.md#get_divisions) | **Get** /divisions | Get all current NHL divisions. | | *DraftApi* | [**get_draft**](docs/DraftApi.md#get_draft) | **Get** /draft | Get round-by-round data for current year's NHL Entry Draft. | | *DraftApi* | [**get_draft_by_year**](docs/DraftApi.md#get_draft_by_year) | **Get** /draft/{year} | Get round-by-round data for a specific year's NHL Entry Draft. | | *DraftApi* | [**get_draft_prospect**](docs/DraftApi.md#get_draft_prospect) | **Get** /draft/prospects/{id} | Get an NHL Entry Draft prospect. | | *DraftApi* | [**get_draft_prospects**](docs/DraftApi.md#get_draft_prospects) | **Get** /draft/prospects | Get all NHL Entry Draft prospects. | | *GamesApi* | [**get_game**](docs/GamesApi.md#get_game) | **Get** /game/{id}/feed/live | Get all available data for an NHL game. | | *GamesApi* | [**get_game_boxscore**](docs/GamesApi.md#get_game_boxscore) | **Get** /game/{id}/boxscore | Get the boxscore for an NHL game. | | *GamesApi* | [**get_game_content**](docs/GamesApi.md#get_game_content) | **Get** /game/{id}/content | Get editorials, video replays and photo highlights for an NHL game. | | *GamesApi* | [**get_game_diff**](docs/GamesApi.md#get_game_diff) | **Get** /game/{id}/feed/live/diffPatch | Get all available data for an NHL game after a specific time. | | *PlayersApi* | [**get_player**](docs/PlayersApi.md#get_player) | **Get** /people/{id} | Get an NHL player. | | *PlayersApi* | [**get_player_stats**](docs/PlayersApi.md#get_player_stats) | **Get** /people/{id}/stats | Get specific statistics for an NHL player. | | *ScheduleApi* | [**get_schedule**](docs/ScheduleApi.md#get_schedule) | **Get** /schedule | Get the NHL game schedule. | | *StandingsApi* | [**get_standing_types**](docs/StandingsApi.md#get_standing_types) | **Get** /standingsTypes | Get all available NHL standing types. | | *StandingsApi* | [**get_standings**](docs/StandingsApi.md#get_standings) | **Get** /standings | Get NHL division standings. | | *StandingsApi* | [**get_standings_by_type**](docs/StandingsApi.md#get_standings_by_type) | **Get** /standings/{type} | Get NHL standings for a specific standing type. | | *StatsApi* | [**get_stat_types**](docs/StatsApi.md#get_stat_types) | **Get** /statTypes | Get all available NHL statistic types. | | *TeamsApi* | [**get_team**](docs/TeamsApi.md#get_team) | **Get** /teams/{id} | Get an NHL team. | | *TeamsApi* | [**get_team_roster**](docs/TeamsApi.md#get_team_roster) | **Get** /teams/{id}/roster | Get an NHL team's roster. | | *TeamsApi* | [**get_team_stats**](docs/TeamsApi.md#get_team_stats) | **Get** /teams/{id}/stats | Get all statistics for an NHL team. | | *TeamsApi* | [**get_teams**](docs/TeamsApi.md#get_teams) | **Get** /teams | Get all NHL teams. | ## Documentation For Models - [Conference](docs/Conference.md) - [Conferences](docs/Conferences.md) - [Division](docs/Division.md) - [DivisionConference](docs/DivisionConference.md) - [Divisions](docs/Divisions.md) - [Draft](docs/Draft.md) - [DraftDrafts](docs/DraftDrafts.md) - [DraftPicks](docs/DraftPicks.md) - [DraftProspect](docs/DraftProspect.md) - [DraftProspectAmateurLeague](docs/DraftProspectAmateurLeague.md) - [DraftProspectAmateurTeam](docs/DraftProspectAmateurTeam.md) - [DraftProspectPrimaryPosition](docs/DraftProspectPrimaryPosition.md) - [DraftProspectProspectCategory](docs/DraftProspectProspectCategory.md) - [DraftProspects](docs/DraftProspects.md) - [DraftRounds](docs/DraftRounds.md) - [DraftTeam](docs/DraftTeam.md) - [EnumExpandSchedule](docs/EnumExpandSchedule.md) - [EnumExpandTeams](docs/EnumExpandTeams.md) - [EnumStandingTypes](docs/EnumStandingTypes.md) - [EnumStatTypes](docs/EnumStatTypes.md) - [Error](docs/Error.md) - [Franchise](docs/Franchise.md) - [Game](docs/Game.md) - [GameBoxscore](docs/GameBoxscore.md) - [GameBoxscoreTeam](docs/GameBoxscoreTeam.md) - [GameBoxscoreTeamCoaches](docs/GameBoxscoreTeamCoaches.md) - [GameBoxscoreTeamOnIcePlus](docs/GameBoxscoreTeamOnIcePlus.md) - [GameBoxscoreTeamPerson](docs/GameBoxscoreTeamPerson.md) - [GameBoxscoreTeamPlayers](docs/GameBoxscoreTeamPlayers.md) - [GameBoxscoreTeamPlayersPerson](docs/GameBoxscoreTeamPlayersPerson.md) - [GameBoxscoreTeamPlayersPosition](docs/GameBoxscoreTeamPlayersPosition.md) - [GameBoxscoreTeamPlayersStats](docs/GameBoxscoreTeamPlayersStats.md) - [GameBoxscoreTeamPlayersStatsSkaterStats](docs/GameBoxscoreTeamPlayersStatsSkaterStats.md) - [GameBoxscoreTeamPosition](docs/GameBoxscoreTeamPosition.md) - [GameBoxscoreTeamTeam](docs/GameBoxscoreTeamTeam.md) - [GameBoxscoreTeamTeamStats](docs/GameBoxscoreTeamTeamStats.md) - [GameBoxscoreTeamTeamStatsTeamSkaterStats](docs/GameBoxscoreTeamTeamStatsTeamSkaterStats.md) - [GameBoxscoreTeams](docs/GameBoxscoreTeams.md) - [GameBoxscores](docs/GameBoxscores.md) - [GameBoxscoresAllOf](docs/GameBoxscoresAllOf.md) - [GameContent](docs/GameContent.md) - [GameContentEditorial](docs/GameContentEditorial.md) - [GameContentHighlights](docs/GameContentHighlights.md) - [GameContentMedia](docs/GameContentMedia.md) - [GameContentMediaMilestones](docs/GameContentMediaMilestones.md) - [GameContentMediaMilestonesItems](docs/GameContentMediaMilestonesItems.md) - [GameDecisionPlayer](docs/GameDecisionPlayer.md) - [GameEditorial](docs/GameEditorial.md) - [GameEditorialContributor](docs/GameEditorialContributor.md) - [GameEditorialContributorContributors](docs/GameEditorialContributorContributors.md) - [GameEditorialKeyword](docs/GameEditorialKeyword.md) - [GameEditorialMedia](docs/GameEditorialMedia.md) - [GameEditorialTokenData](docs/GameEditorialTokenData.md) - [GameEditorials](docs/GameEditorials.md) - [GameGameData](docs/GameGameData.md) - [GameGameDataDatetime](docs/GameGameDataDatetime.md) - [GameGameDataGame](docs/GameGameDataGame.md) - [GameGameDataStatus](docs/GameGameDataStatus.md) - [GameGameDataTeams](docs/GameGameDataTeams.md) - [GameGameDataVenue](docs/GameGameDataVenue.md) - [GameHighlight](docs/GameHighlight.md) - [GameHighlightPlaybacks](docs/GameHighlightPlaybacks.md) - [GameHighlightType](docs/GameHighlightType.md) - [GameHighlights](docs/GameHighlights.md) - [GameLinescore](docs/GameLinescore.md) - [GameLinescoreIntermissionInfo](docs/GameLinescoreIntermissionInfo.md) - [GameLinescorePowerPlayInfo](docs/GameLinescorePowerPlayInfo.md) - [GameLinescoreShootoutInfo](docs/GameLinescoreShootoutInfo.md) - [GameLinescoreShootoutInfoAway](docs/GameLinescoreShootoutInfoAway.md) - [GameLinescoreTeam](docs/GameLinescoreTeam.md) - [GameLinescoreTeams](docs/GameLinescoreTeams.md) - [GameLiveData](docs/GameLiveData.md) - [GameLiveDataDecisions](docs/GameLiveDataDecisions.md) - [GameLiveDataPlays](docs/GameLiveDataPlays.md) - [GameLiveDataPlaysPlaysByPeriod](docs/GameLiveDataPlaysPlaysByPeriod.md) - [GameMediaAudio](docs/GameMediaAudio.md) - [GameMediaAudioItems](docs/GameMediaAudioItems.md) - [GameMediaNhltv](docs/GameMediaNhltv.md) - [GameMediaNhltvItems](docs/GameMediaNhltvItems.md) - [GameMetaData](docs/GameMetaData.md) - [GameOfficial](docs/GameOfficial.md) - [GameOfficialOfficial](docs/GameOfficialOfficial.md) - [GamePeriod](docs/GamePeriod.md) - [GamePeriodAway](docs/GamePeriodAway.md) - [GamePeriodHome](docs/GamePeriodHome.md) - [GamePlay](docs/GamePlay.md) - [GamePlayAbout](docs/GamePlayAbout.md) - [GamePlayAboutGoals](docs/GamePlayAboutGoals.md) - [GamePlayCoordinates](docs/GamePlayCoordinates.md) - [GamePlayPlayer](docs/GamePlayPlayer.md) - [GamePlayPlayers](docs/GamePlayPlayers.md) - [GamePlayResult](docs/GamePlayResult.md) - [GamePlayTeam](docs/GamePlayTeam.md) - [Photo](docs/Photo.md) - [PhotoCuts](docs/PhotoCuts.md) - [Player](docs/Player.md) - [PlayerCurrentTeam](docs/PlayerCurrentTeam.md) - [PlayerStats](docs/PlayerStats.md) - [PlayerStatsOpponentDivision](docs/PlayerStatsOpponentDivision.md) - [PlayerStatsSplits](docs/PlayerStatsSplits.md) - [PlayerStatsStat](docs/PlayerStatsStat.md) - [PlayerStatsStats](docs/PlayerStatsStats.md) - [Players](docs/Players.md) - [Roster](docs/Roster.md) - [RosterPerson](docs/RosterPerson.md) - [Rosters](docs/Rosters.md) - [Schedule](docs/Schedule.md) - [ScheduleDay](docs/ScheduleDay.md) - [ScheduleGame](docs/ScheduleGame.md) - [ScheduleGameContent](docs/ScheduleGameContent.md) - [ScheduleGameTeams](docs/ScheduleGameTeams.md) - [ScheduleGameTeamsAway](docs/ScheduleGameTeamsAway.md) - [ScheduleGameTeamsAwayLeagueRecord](docs/ScheduleGameTeamsAwayLeagueRecord.md) - [ScheduleGameTeamsAwayTeam](docs/ScheduleGameTeamsAwayTeam.md) - [ScheduleGameTeamsHome](docs/ScheduleGameTeamsHome.md) - [ScheduleGameTeamsHomeLeagueRecord](docs/ScheduleGameTeamsHomeLeagueRecord.md) - [ScheduleGameTickets](docs/ScheduleGameTickets.md) - [StandingTypes](docs/StandingTypes.md) - [StandingTypesRecords](docs/StandingTypesRecords.md) - [Standings](docs/Standings.md) - [StandingsDivision](docs/StandingsDivision.md) - [StandingsLeague](docs/StandingsLeague.md) - [StandingsRecords](docs/StandingsRecords.md) - [StandingsStreak](docs/StandingsStreak.md) - [StandingsTeamRecords](docs/StandingsTeamRecords.md) - [StatType](docs/StatType.md) - [StatTypes](docs/StatTypes.md) - [Team](docs/Team.md) - [TeamRoster](docs/TeamRoster.md) - [TeamStats](docs/TeamStats.md) - [TeamStatsRankings](docs/TeamStatsRankings.md) - [TeamStatsStats](docs/TeamStatsStats.md) - [TeamStatsStatsRecords](docs/TeamStatsStatsRecords.md) - [TeamStatsStatsSplits](docs/TeamStatsStatsSplits.md) - [TeamStatsStatsType](docs/TeamStatsStatsType.md) - [TeamStatsValues](docs/TeamStatsValues.md) - [Teams](docs/Teams.md) - [Venue](docs/Venue.md) - [VenueTimeZone](docs/VenueTimeZone.md) To get access to the crate's generated documentation, use: ``` cargo doc --open ``` ## Author