nba v0.5.0 Nba.Stats

Provides a function for each stats.nba.com endpoint.

Examples

See what endpoints you can hit:

Nba.Stats.endpoints()
#=> [:assist_tracker:, :box_score:, :box_score_summary:, ...] 

Each endpoint has a corresponding function with an arity of 0 that returns a list of the available query parameters for the endpoint.

Nba.Stats.player_profile()
#=> ["LeagueID", "PerMode", "PlayerID"]

If you need example keys for a query param, use Nba.Stats.keys_for/1. Note that you do not necessarily need to pass in values for all the keys listed.

Nba.Stats.keys_for("PerMode")
#=> ["Totals", "PerGame", "MinutesPer", "Per48", ...]

Now that you know what query params you can pass, let’s make a call to the endpoint by passing in a map of query param key/values. The functions with a ! raise an exception if the API call results in an error.

Nba.Stats.player_profile(%{"PlayerID" => 1628366})
#=> {:ok, %{"CareerHighs" => ...}}

Nba.Stats.player_profile(%{"PlayerID" => "Go Bruins"})
#=> {:error, "The value 'Go Bruins' is not valid for PlayerID.; PlayerID is required"}

Nba.Stats.player_profile!(%{"PlayerID" => 1628366})
#=> %{"CareerHighs" => ...}

Nba.Stats.player_profile!(%{"PlayerID" => "Go Bruins"})
#=> ** (RuntimeError) The value 'Go Bruins' is not valid for PlayerID.; PlayerID is required

Link to this section Summary

Functions

Returns a list of atoms, one for each endpoint function in the Stats module

Returns a list of valid query param keys for an endpoint

Link to this section Functions

Link to this function assist_tracker!(user_input_map)
assist_tracker!(map()) :: map()
Link to this function assist_tracker(user_input_map)
assist_tracker(map()) :: {:ok | :error, map() | String.t()}
Link to this function box_score!(user_input_map)
box_score!(map()) :: map()
Link to this function box_score(user_input_map)
box_score(map()) :: {:ok | :error, map() | String.t()}
Link to this function box_score_summary!(user_input_map)
box_score_summary!(map()) :: map()
Link to this function box_score_summary(user_input_map)
box_score_summary(map()) :: {:ok | :error, map() | String.t()}
Link to this function common_team_roster!(user_input_map)
common_team_roster!(map()) :: map()
Link to this function common_team_roster(user_input_map)
common_team_roster(map()) :: {:ok | :error, map() | String.t()}
Link to this function endpoints()
endpoints() :: [atom()]

Returns a list of atoms, one for each endpoint function in the Stats module

Link to this function homepage_v2!(user_input_map)
homepage_v2!(map()) :: map()
Link to this function homepage_v2(user_input_map)
homepage_v2(map()) :: {:ok | :error, map() | String.t()}
Link to this function keys_for(param_name)
keys_for(String.t()) :: [String.t()]

Returns a list of valid query param keys for an endpoint

Link to this function league_game_log!(user_input_map)
league_game_log!(map()) :: map()
Link to this function league_game_log(user_input_map)
league_game_log(map()) :: {:ok | :error, map() | String.t()}
Link to this function league_leaders!(user_input_map)
league_leaders!(map()) :: map()
Link to this function league_leaders(user_input_map)
league_leaders(map()) :: {:ok | :error, map() | String.t()}
Link to this function league_standings!(user_input_map)
league_standings!(map()) :: map()
Link to this function league_standings(user_input_map)
league_standings(map()) :: {:ok | :error, map() | String.t()}
Link to this function lineups!(user_input_map)
lineups!(map()) :: map()
Link to this function lineups(user_input_map)
lineups(map()) :: {:ok | :error, map() | String.t()}
Link to this function play_by_play!(user_input_map)
play_by_play!(map()) :: map()
Link to this function play_by_play(user_input_map)
play_by_play(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_clutch!(user_input_map)
player_clutch!(map()) :: map()
Link to this function player_clutch(user_input_map)
player_clutch(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_game_logs!(user_input_map)
player_game_logs!(map()) :: map()
Link to this function player_game_logs(user_input_map)
player_game_logs(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_hustle!(user_input_map)
player_hustle!(map()) :: map()
Link to this function player_hustle(user_input_map)
player_hustle(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_hustle_leaders!(user_input_map)
player_hustle_leaders!(map()) :: map()
Link to this function player_hustle_leaders(user_input_map)
player_hustle_leaders(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_profile!(user_input_map)
player_profile!(map()) :: map()
Link to this function player_profile(user_input_map)
player_profile(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_shooting!(user_input_map)
player_shooting!(map()) :: map()
Link to this function player_shooting(user_input_map)
player_shooting(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_splits!(user_input_map)
player_splits!(map()) :: map()
Link to this function player_splits(user_input_map)
player_splits(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_stats!(user_input_map)
player_stats!(map()) :: map()
Link to this function player_stats(user_input_map)
player_stats(map()) :: {:ok | :error, map() | String.t()}
Link to this function player_tracking!(user_input_map)
player_tracking!(map()) :: map()
Link to this function player_tracking(user_input_map)
player_tracking(map()) :: {:ok | :error, map() | String.t()}
Link to this function players_info!(user_input_map)
players_info!(map()) :: map()
Link to this function players_info(user_input_map)
players_info(map()) :: {:ok | :error, map() | String.t()}
Link to this function scoreboard!(user_input_map)
scoreboard!(map()) :: map()
Link to this function scoreboard(user_input_map)
scoreboard(map()) :: {:ok | :error, map() | String.t()}
Link to this function shots!(user_input_map)
shots!(map()) :: map()
Link to this function shots(user_input_map)
shots(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_clutch!(user_input_map)
team_clutch!(map()) :: map()
Link to this function team_clutch(user_input_map)
team_clutch(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_historical_leaders!(user_input_map)
team_historical_leaders!(map()) :: map()
Link to this function team_historical_leaders(user_input_map)
team_historical_leaders(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_hustle!(user_input_map)
team_hustle!(map()) :: map()
Link to this function team_hustle(user_input_map)
team_hustle(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_hustle_leaders!(user_input_map)
team_hustle_leaders!(map()) :: map()
Link to this function team_hustle_leaders(user_input_map)
team_hustle_leaders(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_info_common!(user_input_map)
team_info_common!(map()) :: map()
Link to this function team_info_common(user_input_map)
team_info_common(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_player_dashboard!(user_input_map)
team_player_dashboard!(map()) :: map()
Link to this function team_player_dashboard(user_input_map)
team_player_dashboard(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_shooting!(user_input_map)
team_shooting!(map()) :: map()
Link to this function team_shooting(user_input_map)
team_shooting(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_shot_locations!(user_input_map)
team_shot_locations!(map()) :: map()
Link to this function team_shot_locations(user_input_map)
team_shot_locations(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_splits!(user_input_map)
team_splits!(map()) :: map()
Link to this function team_splits(user_input_map)
team_splits(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_stats!(user_input_map)
team_stats!(map()) :: map()
Link to this function team_stats(user_input_map)
team_stats(map()) :: {:ok | :error, map() | String.t()}
Link to this function team_years!(user_input_map)
team_years!(map()) :: map()
Link to this function team_years(user_input_map)
team_years(map()) :: {:ok | :error, map() | String.t()}