NBA.Stats.ShotChartDetail (nba_api_ex v0.1.0)
View SourceProvides functions to interact with the NBA stats API for ShotChartDetail.
See get/2 for parameter and usage details.
Summary
Functions
get(params \\ [ContextMeasure: "FGA", LastNGames: 0, LeagueID: "00", Month: 0, OpponentTeamID: 0, Period: 0, PlayerID: nil, SeasonType: "Regular Season", TeamID: nil, VsDivision: nil, VsConference: nil, StartRange: nil, StartPeriod: nil, SeasonSegment: nil, Season: nil, RookieYear: nil, RangeType: nil, Position: nil, PointDiff: nil, PlayerPosition: nil, Outcome: nil, Location: nil, GameSegment: nil, GameID: nil, EndRange: nil, EndPeriod: nil, DateTo: nil, DateFrom: nil, ContextFilter: nil, ClutchTime: nil, AheadBehind: nil], opts \\ [])
(since 0.1.0)Fetches ShotChartDetail data.
Parameters
params: A keyword list of parameters to filter the data.PlayerID: (Required) The player ID.Season: (Required) The season.- Type(s):
String - Example:
Season: "2024-25" - Default:
nil
- Type(s):
AheadBehind: The ahead/behind context.- Type(s):
String - Example:
AheadBehind: "Ahead or Tied" - Default:
nil - Valueset:
"Ahead or Behind""Ahead or Tied""Behind or Tied"
- Type(s):
ClutchTime: The clutch time.- Type(s):
String - Example:
ClutchTime: "Last 5 Minutes" - Default:
nil - Valueset:
"Last 5 Minutes""Last 4 Minutes""Last 3 Minutes""Last 2 Minutes""Last 1 Minute""Last 30 Seconds""Last 10 Seconds"
- Type(s):
ContextFilter: The context filter.- Type(s):
String - Example:
ContextFilter: "" - Default:
nil
- Type(s):
ContextMeasure: The context measure.- Type(s):
String - Example:
ContextMeasure: "FGA" - Default:
"FGA" - Valueset:
"PTS""FGM""FGA""FG_PCT""FG3M""FG3A""FG3_PCT""PF""EFG_PCT""TS_PCT""PTS_FB""PTS_OFF_TOV""PTS_2ND_CHANCE"
- Type(s):
DateFrom: The start date (YYYY-MM-DD).- Type(s):
String - Example:
DateFrom: "2025-01-01" - Default:
nil
- Type(s):
DateTo: The end date (YYYY-MM-DD).- Type(s):
String - Example:
DateTo: "2025-03-01" - Default:
nil
- Type(s):
EndPeriod: The end period.- Type(s):
Integer - Example:
EndPeriod: 4 - Default:
nil
- Type(s):
EndRange: The end range.GameID: The game ID. 10-digit string or nil.- Type(s):
String - Example:
GameID: "0022100001" - Default:
nil
- Type(s):
GameSegment: The game segment.- Type(s):
String - Example:
GameSegment: "First Half" - Default:
nil - Valueset:
"First Half""Overtime""Second Half"
- Type(s):
LastNGames: Number of last games to include.- Type(s):
Integer - Example:
LastNGames: 0 - Default:
0
- Type(s):
LeagueID: The league ID.- Type(s):
String - Example:
LeagueID: "00" - Default:
"00"
- Type(s):
Location: The game location.- Type(s):
String - Example:
Location: "Home" - Default:
nil - Valueset:
"Home""Road"
- Type(s):
Month: The month (1-12, 0 for all).- Type(s):
Integer - Example:
Month: 0 - Default:
0
- Type(s):
OpponentTeamID: The opponent team ID.Outcome: The game outcome.- Type(s):
String - Example:
Outcome: "W" - Default:
nil - Valueset:
"W""L"
- Type(s):
Period: The period (0 for all).- Type(s):
Integer - Example:
Period: 0 - Default:
0
- Type(s):
PlayerPosition: The player position.- Type(s):
String - Example:
PlayerPosition: "Guard" - Default:
nil - Valueset:
"Guard""Center""Forward"
- Type(s):
PointDiff: The point differential.Position: The position.- Type(s):
String - Example:
Position: "Guard" - Default:
nil
- Type(s):
RangeType: The range type.RookieYear: The rookie year.- Type(s):
String - Example:
RookieYear: "2019" - Default:
nil
- Type(s):
SeasonSegment: The season segment.- Type(s):
String - Example:
SeasonSegment: "Pre All-Star" - Default:
nil - Valueset:
"Post All-Star""Pre All-Star"
- Type(s):
StartPeriod: The start period.- Type(s):
Integer - Example:
StartPeriod: 1 - Default:
nil
- Type(s):
StartRange: The start range.TeamID: The team ID.VsConference: The opposing conference.- Type(s):
String - Example:
VsConference: "West" - Default:
nil - Valueset:
"East""West"
- Type(s):
VsDivision: The opposing division.- Type(s):
String - Example:
VsDivision: "Pacific" - Default:
nil - Valueset:
"Atlantic""Central""Northwest""Pacific""Southeast""Southwest""East""West"
- Type(s):
opts: A keyword list of additional options for the request, such as headers or timeout settings.- For a full list of options, see the Req documentation.
Returns
{:ok, data}: On success, returns the data from the API.{:error, reason}: On failure, returns an error tuple with the reason.
Example
iex> NBA.Stats.ShotChartDetail.get(ContextMeasure: "FGA", LastNGames: 0, LeagueID: "00", Month: 0, OpponentTeamID: 0, Period: 0, PlayerID: 201939, SeasonType: "Regular Season", TeamID: 1610612737)
{:ok, %{"ShotChartDetail" => [%{...}, ...]}}