NBA.Stats.BoxScore (nba_api_ex v0.1.0)

View Source

Fetches box score data for a specific game.

Summary

Functions

get(type, params \\ [LeagueID: "00", endPeriod: 0, endRange: 31800, rangeType: 0, startPeriod: 0, startRange: 0], opts \\ [])

(since 0.1.0)
@spec get(atom(), keyword(), keyword()) :: {:ok, map()} | {:error, String.t()}

Fetches advanced box score data for a specific game.

Parameters

  • type: The type of data to fetch (e.g., "Advanced").

    • traditional: Fetches traditional box score data.
    • advanced: Fetches advanced box score data.
    • misc: Fetches miscellaneous box score data.
    • scoring: Fetches scoring box score data.
    • usage: Fetches usage box score data.
    • fourfactors: Fetches four factors box score data.
    • hustle: Fetches hustle box score data.
    • defense: Fetches defensive box score data.
    • matchups: Fetches matchups box score data.
  • params: A keyword list of parameters for the request.

    • GameID: (Required) The unique identifier for the game.

      • Type(s): Numeric String.
      • Example: GameID: "0022200001" (for a specific game).
    • LeagueID: The league ID.

      • Type(s): Numeric String.
      • Default: "00" (NBA).
      • Example: LeagueID: "10" (for WNBA).
      • Valueset:
        • "00" (NBA)
        • "01" (ABA)
        • "10" (WNBA)
        • "20" (G-League)
    • endPeriod: The end period for the box score data.

      • Type(s): Integer.
      • Default: 0 (all periods).
      • Example: endPeriod: 4.
    • endRange: The end range for the box score data in seconds.

      • Type(s): Integer.
      • Default: 31800 (full game).
      • Example: endRange: 3600 (for the first hour).
    • rangeType: The type of range for the box score data.

      • Type(s): Integer.
      • Default: 0 (full game).
      • Example: rangeType: 1 (for first half).
    • startPeriod: The start period for the box score data.

      • Type(s): Integer.
      • Default: 0 (all periods).
      • Example: startPeriod: 1.
    • startRange: The start range for the box score data in seconds.

      • Type(s): Integer.
      • Default: 0 (start of game).
      • Example: startRange: 1800 (for the first 30 minutes).
    • opts: A keyword list of additional options for the request, such as headers or timeout settings.

Example

iex> NBA.Stats.BoxScore.get(:traditional, GameID: "0022200001")
{:ok, [%{"gameId" => "0022200001", ...}, ...]}

Returns

  • {:ok, box_score}: A map containing the box score data.
  • {:error, reason}: An error tuple with the reason for failure.

get!(type, params \\ [LeagueID: "00", endPeriod: 0, endRange: 31800, rangeType: 0, startPeriod: 0, startRange: 0], opts \\ [])

(since 0.1.0)