NBA.Stats.TeamAndPlayersVsPlayers (nba_api_ex v0.1.0)

View Source

Provides functions to interact with the NBA stats API for TeamAndPlayersVsPlayers.

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [LastNGames: 0, MeasureType: "Base", Month: 0, OpponentTeamID: 0, PaceAdjust: "N", PerMode: "PerGame", Period: 0, PlayerID1: nil, PlayerID2: nil, PlayerID3: nil, PlayerID4: nil, PlayerID5: nil, PlusMinus: "N", Rank: "N", Season: nil, SeasonType: "Regular Season", TeamID: nil, VsPlayerID1: nil, VsPlayerID2: nil, VsPlayerID3: nil, VsPlayerID4: nil, VsPlayerID5: nil, VsTeamID: nil, VsDivision: nil, VsConference: nil, ShotClockRange: nil, SeasonSegment: nil, Outcome: nil, Location: nil, LeagueID: "00", GameSegment: nil, Division: nil, DateTo: nil, DateFrom: nil, Conference: nil], opts \\ [])

(since 0.1.0)

Fetches TeamAndPlayersVsPlayers data.

Parameters

  • params: A keyword list of parameters to filter the data.

    • LastNGames: (Required) Number of last games to include.

    • MeasureType: (Required) The measure type.

      • Type(s): String
      • Default: "Base"
      • Valueset:
        • "Base"
        • "Advanced"
        • "Misc"
        • "Four Factors"
        • "Scoring"
        • "Opponent"
        • "Usage"
        • "Defense"
    • Month: (Required) The month (1-12, 0 for all).

    • OpponentTeamID: (Required) The opponent team ID.

    • PaceAdjust: (Required) Whether to adjust for pace.

      • Type(s): String
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • PerMode: (Required) The per mode.

      • Type(s): String
      • Default: "PerGame"
      • Valueset:
        • "Totals"
        • "PerGame"
        • "MinutesPer"
        • "Per48"
        • "Per40"
        • "Per36"
        • "PerMinute"
        • "PerPossession"
        • "PerPlay"
        • "Per100Possessions"
        • "Per100Plays"
    • Period: (Required) The period (0 for all).

    • PlayerID1: (Required) The first player ID.

    • PlayerID2: (Required) The second player ID.

    • PlayerID3: (Required) The third player ID.

    • PlayerID4: (Required) The fourth player ID.

    • PlayerID5: (Required) The fifth player ID.

    • PlusMinus: (Required) Whether to include plus/minus.

      • Type(s): String
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • Rank: (Required) Whether to include rank.

      • Type(s): String
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • Season: (Required) The season.

    • SeasonType: (Required) The season type.

      • Type(s): String
      • Default: "Regular Season"
      • Valueset:
        • "Regular Season"
        • "Pre Season"
        • "Playoffs"
    • TeamID: (Required) The team ID.

    • VsPlayerID1: (Required) The first opposing player ID.

    • VsPlayerID2: (Required) The second opposing player ID.

    • VsPlayerID3: (Required) The third opposing player ID.

    • VsPlayerID4: (Required) The fourth opposing player ID.

    • VsPlayerID5: (Required) The fifth opposing player ID.

    • VsTeamID: (Required) The opposing team ID.

    • Conference: The conference.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • DateFrom: The start date (YYYY-MM-DD).

    • DateTo: The end date (YYYY-MM-DD).

    • Division: The division.

    • GameSegment: The game segment.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "First Half"
        • "Overtime"
        • "Second Half"
    • LeagueID: The league ID.

    • Location: The game location.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "Home"
        • "Road"
    • Outcome: The game outcome.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "W"
        • "L"
    • SeasonSegment: The season segment.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "Post All-Star"
        • "Pre All-Star"
    • ShotClockRange: The shot clock range.

    • VsConference: The opposing conference.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • VsDivision: The opposing division.

      • Type(s): String
      • Default: nil
      • Valueset:
        • "Atlantic"
        • "Central"
        • "Northwest"
        • "Pacific"
        • "Southeast"
        • "Southwest"
        • "East"
        • "West"
  • opts: A keyword list of additional options for the request, such as headers or timeout settings.

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.TeamAndPlayersVsPlayers.get(LastNGames: 0, MeasureType: "Base", Month: 0, OpponentTeamID: 1610612737, PaceAdjust: "N", PerMode: "PerGame", Period: 0, PlayerID1: 201939, PlayerID2: 202691, PlayerID3: 203507, PlayerID4: 1629029, PlayerID5: 1629630, PlusMinus: "N", Rank: "N", Season: "2024-25", SeasonType: "Regular Season", TeamID: 1610612744, VsPlayerID1: 1627759, VsPlayerID2: 1628369, VsPlayerID3: 1629027, VsPlayerID4: 1629631, VsPlayerID5: 1630162, VsTeamID: 1610612738)
{:ok, %{"TeamAndPlayersVsPlayers" => [%{...}, ...]}}

get!(params \\ [], opts \\ [])

(since 0.1.0)