3 releases
Uses old Rust 2015
0.1.2 | Aug 9, 2019 |
---|---|
0.1.1 | Aug 8, 2019 |
0.1.0 | Aug 7, 2019 |
#31 in #generated-client
255KB
5K
SLoC
NHL Stats API Client for Rust
Rust client for using the NHL Stats API.
- OpenAPI 3.0 spec provided by erunion/sport-api-specifications/nhl
- Generated using OpenAPI Generator
- More comprehensive documentation from dword4/nhlapi/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
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 project. By using the openapi-spec 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
Documentation for API Endpoints
All URIs are relative to https://statsapi.web.nhl.com/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
ConferencesApi | get_conference | Get /conferences/{id} | Get an NHL conference. |
ConferencesApi | get_conferences | Get /conferences | Get all current NHL conferences. |
DivisionsApi | get_division | Get /divisions/{id} | Get an NHL division. |
DivisionsApi | get_divisions | Get /divisions | Get all current NHL divisions. |
DraftApi | get_draft | Get /draft | Get round-by-round data for current year's NHL Entry Draft. |
DraftApi | get_draft_by_year | Get /draft/{year} | Get round-by-round data for a specific year's NHL Entry Draft. |
DraftApi | get_draft_prospect | Get /draft/prospects/{id} | Get an NHL Entry Draft prospect. |
DraftApi | get_draft_prospects | Get /draft/prospects | Get all NHL Entry Draft prospects. |
GamesApi | get_game | Get /game/{id}/feed/live | Get all available data for an NHL game. |
GamesApi | get_game_boxscore | Get /game/{id}/boxscore | Get the boxscore for an NHL game. |
GamesApi | get_game_content | Get /game/{id}/content | Get editorials, video replays and photo highlights for an NHL game. |
GamesApi | get_game_diff | Get /game/{id}/feed/live/diffPatch | Get all available data for an NHL game after a specific time. |
PlayersApi | get_player | Get /people/{id} | Get an NHL player. |
PlayersApi | get_player_stats | Get /people/{id}/stats | Get specific statistics for an NHL player. |
ScheduleApi | get_schedule | Get /schedule | Get the NHL game schedule. |
StandingsApi | get_standing_types | Get /standingsTypes | Get all available NHL standing types. |
StandingsApi | get_standings | Get /standings | Get NHL division standings. |
StandingsApi | get_standings_by_type | Get /standings/{type} | Get NHL standings for a specific standing type. |
StatsApi | get_stat_types | Get /statTypes | Get all available NHL statistic types. |
TeamsApi | get_team | Get /teams/{id} | Get an NHL team. |
TeamsApi | get_team_roster | Get /teams/{id}/roster | Get an NHL team's roster. |
TeamsApi | get_team_stats | Get /teams/{id}/stats | Get all statistics for an NHL team. |
TeamsApi | get_teams | Get /teams | Get all NHL teams. |
Documentation For Models
- Conference
- Conferences
- Division
- DivisionConference
- Divisions
- Draft
- DraftDrafts
- DraftPicks
- DraftProspect
- DraftProspectAmateurLeague
- DraftProspectAmateurTeam
- DraftProspectPrimaryPosition
- DraftProspectProspectCategory
- DraftProspects
- DraftRounds
- DraftTeam
- EnumExpandSchedule
- EnumExpandTeams
- EnumStandingTypes
- EnumStatTypes
- Error
- Franchise
- Game
- GameBoxscore
- GameBoxscoreTeam
- GameBoxscoreTeamCoaches
- GameBoxscoreTeamOnIcePlus
- GameBoxscoreTeamPerson
- GameBoxscoreTeamPlayers
- GameBoxscoreTeamPlayersPerson
- GameBoxscoreTeamPlayersPosition
- GameBoxscoreTeamPlayersStats
- GameBoxscoreTeamPlayersStatsSkaterStats
- GameBoxscoreTeamPosition
- GameBoxscoreTeamTeam
- GameBoxscoreTeamTeamStats
- GameBoxscoreTeamTeamStatsTeamSkaterStats
- GameBoxscoreTeams
- GameBoxscores
- GameBoxscoresAllOf
- GameContent
- GameContentEditorial
- GameContentHighlights
- GameContentMedia
- GameContentMediaMilestones
- GameContentMediaMilestonesItems
- GameDecisionPlayer
- GameEditorial
- GameEditorialContributor
- GameEditorialContributorContributors
- GameEditorialKeyword
- GameEditorialMedia
- GameEditorialTokenData
- GameEditorials
- GameGameData
- GameGameDataDatetime
- GameGameDataGame
- GameGameDataStatus
- GameGameDataTeams
- GameGameDataVenue
- GameHighlight
- GameHighlightPlaybacks
- GameHighlightType
- GameHighlights
- GameLinescore
- GameLinescoreIntermissionInfo
- GameLinescorePowerPlayInfo
- GameLinescoreShootoutInfo
- GameLinescoreShootoutInfoAway
- GameLinescoreTeam
- GameLinescoreTeams
- GameLiveData
- GameLiveDataDecisions
- GameLiveDataPlays
- GameLiveDataPlaysPlaysByPeriod
- GameMediaAudio
- GameMediaAudioItems
- GameMediaNhltv
- GameMediaNhltvItems
- GameMetaData
- GameOfficial
- GameOfficialOfficial
- GamePeriod
- GamePeriodAway
- GamePeriodHome
- GamePlay
- GamePlayAbout
- GamePlayAboutGoals
- GamePlayCoordinates
- GamePlayPlayer
- GamePlayPlayers
- GamePlayResult
- GamePlayTeam
- Photo
- PhotoCuts
- Player
- PlayerCurrentTeam
- PlayerStats
- PlayerStatsOpponentDivision
- PlayerStatsSplits
- PlayerStatsStat
- PlayerStatsStats
- Players
- Roster
- RosterPerson
- Rosters
- Schedule
- ScheduleDay
- ScheduleGame
- ScheduleGameContent
- ScheduleGameTeams
- ScheduleGameTeamsAway
- ScheduleGameTeamsAwayLeagueRecord
- ScheduleGameTeamsAwayTeam
- ScheduleGameTeamsHome
- ScheduleGameTeamsHomeLeagueRecord
- ScheduleGameTickets
- StandingTypes
- StandingTypesRecords
- Standings
- StandingsDivision
- StandingsLeague
- StandingsRecords
- StandingsStreak
- StandingsTeamRecords
- StatType
- StatTypes
- Team
- TeamRoster
- TeamStats
- TeamStatsRankings
- TeamStatsStats
- TeamStatsStatsRecords
- TeamStatsStatsSplits
- TeamStatsStatsType
- TeamStatsValues
- Teams
- Venue
- VenueTimeZone
To get access to the crate's generated documentation, use:
cargo doc --open
Author
Dependencies
~2.2–6.5MB
~144K SLoC