nba v0.7.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:, ...]

Pass in the atom :help as a parameter to an endpoint function to get a list of the available query parameters for the endpoint.

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

If you need example values for a query param, use Nba.Stats.values_for/1.

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

Boilerplate default values should be filled in for the most part, but as the API is always changing, the app may not fill in all the values correctly. Pay attention to the error message to see what was missing from the API call.

Nba.Stats.player_profile()
#=> {:error, "PlayerID is required"}

Now that you know what query params you can pass, we can make a call to the endpoint by passing in a list of tuples to the endpoint function. Alternatively, you have the option of passing in a map.

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

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

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

Note: The functions with a ! raise an exception if the API call results in an error.

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 \\ %{})
assist_tracker(:help) :: [String.t()]
assist_tracker(map()) :: {:ok | :error, map() | String.t()}
assist_tracker([tuple()]) :: {: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 \\ %{})
box_score(:help) :: [String.t()]
box_score(map()) :: {:ok | :error, map() | String.t()}
box_score([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function box_score_defensive!(user_input_map \\ %{})
box_score_defensive!(map()) :: map()
Link to this function box_score_defensive(user_input \\ %{})
box_score_defensive(:help) :: [String.t()]
box_score_defensive(map()) :: {:ok | :error, map() | String.t()}
box_score_defensive([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function box_score_hustle!(user_input_map \\ %{})
box_score_hustle!(map()) :: map()
Link to this function box_score_hustle(user_input \\ %{})
box_score_hustle(:help) :: [String.t()]
box_score_hustle(map()) :: {:ok | :error, map() | String.t()}
box_score_hustle([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function box_score_matchups!(user_input_map \\ %{})
box_score_matchups!(map()) :: map()
Link to this function box_score_matchups(user_input \\ %{})
box_score_matchups(:help) :: [String.t()]
box_score_matchups(map()) :: {:ok | :error, map() | String.t()}
box_score_matchups([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function box_score_player_track!(user_input_map \\ %{})
box_score_player_track!(map()) :: map()
Link to this function box_score_player_track(user_input \\ %{})
box_score_player_track(:help) :: [String.t()]
box_score_player_track(map()) :: {:ok | :error, map() | String.t()}
box_score_player_track([tuple()]) :: {: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 \\ %{})
box_score_summary(:help) :: [String.t()]
box_score_summary(map()) :: {:ok | :error, map() | String.t()}
box_score_summary([tuple()]) :: {: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 \\ %{})
common_team_roster(:help) :: [String.t()]
common_team_roster(map()) :: {:ok | :error, map() | String.t()}
common_team_roster([tuple()]) :: {: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 \\ %{})
homepage_v2(:help) :: [String.t()]
homepage_v2(map()) :: {:ok | :error, map() | String.t()}
homepage_v2([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function league_game_log!(user_input_map \\ %{})
league_game_log!(map()) :: map()
Link to this function league_game_log(user_input \\ %{})
league_game_log(:help) :: [String.t()]
league_game_log(map()) :: {:ok | :error, map() | String.t()}
league_game_log([tuple()]) :: {: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 \\ %{})
league_leaders(:help) :: [String.t()]
league_leaders(map()) :: {:ok | :error, map() | String.t()}
league_leaders([tuple()]) :: {: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 \\ %{})
league_standings(:help) :: [String.t()]
league_standings(map()) :: {:ok | :error, map() | String.t()}
league_standings([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function lineups!(user_input_map \\ %{})
lineups!(map()) :: map()
Link to this function lineups(user_input \\ %{})
lineups(:help) :: [String.t()]
lineups(map()) :: {:ok | :error, map() | String.t()}
lineups([tuple()]) :: {: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 \\ %{})
play_by_play(:help) :: [String.t()]
play_by_play(map()) :: {:ok | :error, map() | String.t()}
play_by_play([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function player_bio_stats!(user_input_map \\ %{})
player_bio_stats!(map()) :: map()
Link to this function player_bio_stats(user_input \\ %{})
player_bio_stats(:help) :: [String.t()]
player_bio_stats(map()) :: {:ok | :error, map() | String.t()}
player_bio_stats([tuple()]) :: {: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 \\ %{})
player_clutch(:help) :: [String.t()]
player_clutch(map()) :: {:ok | :error, map() | String.t()}
player_clutch([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function player_defensive_dashboard!(user_input_map \\ %{})
player_defensive_dashboard!(map()) :: map()
Link to this function player_defensive_dashboard(user_input \\ %{})
player_defensive_dashboard(:help) :: [String.t()]
player_defensive_dashboard(map()) :: {:ok | :error, map() | String.t()}
player_defensive_dashboard([tuple()]) :: {: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 \\ %{})
player_game_logs(:help) :: [String.t()]
player_game_logs(map()) :: {:ok | :error, map() | String.t()}
player_game_logs([tuple()]) :: {: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 \\ %{})
player_hustle(:help) :: [String.t()]
player_hustle(map()) :: {:ok | :error, map() | String.t()}
player_hustle([tuple()]) :: {: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 \\ %{})
player_hustle_leaders(:help) :: [String.t()]
player_hustle_leaders(map()) :: {:ok | :error, map() | String.t()}
player_hustle_leaders([tuple()]) :: {: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 \\ %{})
player_profile(:help) :: [String.t()]
player_profile(map()) :: {:ok | :error, map() | String.t()}
player_profile([tuple()]) :: {: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 \\ %{})
player_shooting(:help) :: [String.t()]
player_shooting(map()) :: {:ok | :error, map() | String.t()}
player_shooting([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function player_shot_locations!(user_input_map \\ %{})
player_shot_locations!(map()) :: map()
Link to this function player_shot_locations(user_input \\ %{})
player_shot_locations(:help) :: [String.t()]
player_shot_locations(map()) :: {:ok | :error, map() | String.t()}
player_shot_locations([tuple()]) :: {: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 \\ %{})
player_splits(:help) :: [String.t()]
player_splits(map()) :: {:ok | :error, map() | String.t()}
player_splits([tuple()]) :: {: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 \\ %{})
player_stats(:help) :: [String.t()]
player_stats(map()) :: {:ok | :error, map() | String.t()}
player_stats([tuple()]) :: {: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 \\ %{})
player_tracking(:help) :: [String.t()]
player_tracking(map()) :: {:ok | :error, map() | String.t()}
player_tracking([tuple()]) :: {: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 \\ %{})
players_info(:help) :: [String.t()]
players_info(map()) :: {:ok | :error, map() | String.t()}
players_info([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function scoreboard!(user_input_map \\ %{})
scoreboard!(map()) :: map()
Link to this function scoreboard(user_input \\ %{})
scoreboard(:help) :: [String.t()]
scoreboard(map()) :: {:ok | :error, map() | String.t()}
scoreboard([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function shots!(user_input_map \\ %{})
shots!(map()) :: map()
Link to this function shots(user_input \\ %{})
shots(:help) :: [String.t()]
shots(map()) :: {:ok | :error, map() | String.t()}
shots([tuple()]) :: {: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 \\ %{})
team_clutch(:help) :: [String.t()]
team_clutch(map()) :: {:ok | :error, map() | String.t()}
team_clutch([tuple()]) :: {: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 \\ %{})
team_historical_leaders(:help) :: [String.t()]
team_historical_leaders(map()) :: {:ok | :error, map() | String.t()}
team_historical_leaders([tuple()]) :: {: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 \\ %{})
team_hustle(:help) :: [String.t()]
team_hustle(map()) :: {:ok | :error, map() | String.t()}
team_hustle([tuple()]) :: {: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 \\ %{})
team_hustle_leaders(:help) :: [String.t()]
team_hustle_leaders(map()) :: {:ok | :error, map() | String.t()}
team_hustle_leaders([tuple()]) :: {: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 \\ %{})
team_info_common(:help) :: [String.t()]
team_info_common(map()) :: {:ok | :error, map() | String.t()}
team_info_common([tuple()]) :: {: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 \\ %{})
team_player_dashboard(:help) :: [String.t()]
team_player_dashboard(map()) :: {:ok | :error, map() | String.t()}
team_player_dashboard([tuple()]) :: {: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 \\ %{})
team_shooting(:help) :: [String.t()]
team_shooting(map()) :: {:ok | :error, map() | String.t()}
team_shooting([tuple()]) :: {: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 \\ %{})
team_shot_locations(:help) :: [String.t()]
team_shot_locations(map()) :: {:ok | :error, map() | String.t()}
team_shot_locations([tuple()]) :: {: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 \\ %{})
team_splits(:help) :: [String.t()]
team_splits(map()) :: {:ok | :error, map() | String.t()}
team_splits([tuple()]) :: {: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 \\ %{})
team_stats(:help) :: [String.t()]
team_stats(map()) :: {:ok | :error, map() | String.t()}
team_stats([tuple()]) :: {: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 \\ %{})
team_years(:help) :: [String.t()]
team_years(map()) :: {:ok | :error, map() | String.t()}
team_years([tuple()]) :: {:ok | :error, map() | String.t()}
Link to this function values_for(param_name)
values_for(String.t() | atom()) :: [String.t()]

Returns a list of valid query param keys for an endpoint