NBA.Stats.PlayerVsPlayer (nba_api_ex v0.1.0)
View SourceProvides functions to interact with the NBA stats API for PlayerVsPlayer.
See get/2 for parameter and usage details.
Summary
Functions
get(params \\ [LastNGames: 0, MeasureType: "Base", Month: 0, OpponentTeamID: 0, PaceAdjust: "Y", PerMode: "PerGame", Period: 0, PlayerID: nil, PlusMinus: "Y", Rank: "Y", Season: nil, SeasonType: "Regular Season", VsPlayerID: nil, VsDivision: nil, VsConference: nil, SeasonSegment: nil, Outcome: nil, Location: nil, LeagueID: "00", GameSegment: nil, DateTo: nil, DateFrom: nil], opts \\ [])
(since 0.1.0)Fetches PlayerVsPlayer data.
Parameters
params: A keyword list of parameters to filter the data.LastNGames: (Required) Number of last games to include.- Type(s):
Integer - Example:
LastNGames: 5 - Default:
0
- Type(s):
MeasureType: (Required) The type of measure. Accepts one of"Base","Advanced","Misc","Four Factors","Scoring","Opponent","Usage","Defense".- Type(s):
String - Example:
MeasureType: "Base" - Default:
"Base" - Valueset:
"Base","Advanced","Misc","Four Factors","Scoring","Opponent","Usage","Defense" - Pattern:
^(Base)|(Advanced)|(Misc)|(Four Factors)|(Scoring)|(Opponent)|(Usage)|(Defense)$
- Type(s):
Month: (Required) The month (1-12, 0 for all).- Type(s):
Integer - Example:
Month: 0 - Default:
0
- Type(s):
OpponentTeamID: (Required) The opponent team ID.PaceAdjust: (Required) Whether to adjust for pace. Accepts"Y"or"N".- Type(s):
String - Example:
PaceAdjust: "N" - Default:
"N" - Valueset:
"Y","N" - Pattern:
^(Y)|(N)$
- Type(s):
PerMode: (Required) The data aggregation mode. Accepts one of"Totals","PerGame","MinutesPer","Per48","Per40","Per36","PerMinute","PerPossession","PerPlay","Per100Possessions","Per100Plays".- Type(s):
String - Example:
PerMode: "PerGame" - Default:
"PerGame" - Valueset:
"Totals","PerGame","MinutesPer","Per48","Per40","Per36","PerMinute","PerPossession","PerPlay","Per100Possessions","Per100Plays" - Pattern:
^(Totals)|(PerGame)|(MinutesPer)|(Per48)|(Per40)|(Per36)|(PerMinute)|(PerPossession)|(PerPlay)|(Per100Possessions)|(Per100Plays)$
- Type(s):
Period: (Required) The period (0 for all).- Type(s):
Integer - Example:
Period: 0 - Default:
0
- Type(s):
PlayerID: (Required) The player ID.PlusMinus: (Required) Whether to include plus/minus. Accepts"Y"or"N".- Type(s):
String - Example:
PlusMinus: "N" - Default:
"N" - Valueset:
"Y","N" - Pattern:
^(Y)|(N)$
- Type(s):
Rank: (Required) Whether to include rank. Accepts"Y"or"N".- Type(s):
String - Example:
Rank: "N" - Default:
"N" - Valueset:
"Y","N" - Pattern:
^(Y)|(N)$
- Type(s):
Season: (Required) The season.- Type(s):
String - Example:
Season: "2024-25" - Default:
nil
- Type(s):
SeasonType: (Required) The season type. Accepts one of"Regular Season","Pre Season","Playoffs".- Type(s):
String - Example:
SeasonType: "Regular Season" - Default:
"Regular Season" - Valueset:
"Regular Season","Pre Season","Playoffs" - Pattern:
^(Regular Season)|(Pre Season)|(Playoffs)$
- Type(s):
VsPlayerID: (Required) The opposing player ID.VsDivision: The opposing division. Acceptsnilor one of"Atlantic","Central","Northwest","Pacific","Southeast","Southwest","East","West".Type(s):
String|nil- Example:
VsDivision: "Pacific" - Default:
nil - Pattern:
^((Atlantic)|(Central)|(Northwest)|(Pacific)|(Southeast)|(Southwest)|(East)|(West))?$
VsConference: The opposing conference. Acceptsnilor"East","West".Type(s):
String|nil- Example:
VsConference: "West" - Default:
nil - Pattern:
^((East)|(West))?$
SeasonSegment: The season segment. Acceptsnilor"Post All-Star","Pre All-Star".Type(s):
String|nil- Example:
SeasonSegment: "Pre All-Star" - Default:
nil - Pattern:
^((Post All-Star)|(Pre All-Star))?$
Outcome: The game outcome. Acceptsnilor"W","L".Type(s):
String|nil- Example:
Outcome: "W" - Default:
nil - Pattern:
^((W)|(L))?$
Location: The game location. Acceptsnilor"Home","Road".Type(s):
String|nil- Example:
Location: "Home" - Default:
nil - Pattern:
^((Home)|(Road))?$
LeagueID: The league ID. Defaults to"00"(NBA). Not required.- Type(s):
String - Example:
LeagueID: "00" - Default:
"00"
- Type(s):
GameSegment: The game segment. Acceptsnilor"First Half","Overtime","Second Half".Type(s):
String|nil- Example:
GameSegment: "First Half" - Default:
nil - Pattern:
^((First Half)|(Overtime)|(Second Half))?$
DateTo: The end date (YYYY-MM-DD). Acceptsnilor a date string.Type(s):
String|nil- Example:
DateTo: "2025-03-01" - Default:
nil
DateFrom: The start date (YYYY-MM-DD). Acceptsnilor a date string.Type(s):
String|nil- Example:
DateFrom: "2025-01-01" - Default:
nil
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.PlayerVsPlayer.get(Season: "2024-25", PlayerID: 201939, VsPlayerID: 2544)
{:ok, %{"PlayerVsPlayer" => [%{...}, ...]}}