NBA.Live.PBP (nba_api_ex v0.1.0)

View Source

Fetches play-by-play data for a specific NBA game.

Summary

Functions

get(params \\ [GameID: nil], opts \\ [])

(since 0.1.0)

Fetches play-by-play data for a specific game.

Parameters

  • 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).
  • opts: A keyword list of additional options for the request, such as headers or timeout settings.
    - For a list of available options, see the [Req documentation](https://hexdocs.pm/req/Req.html#new/1).

Notes

  • Upcoming games will return an empty map.

Returns

  • {:ok, pbp}: A map containing the play-by-play data for the game.
  • {:error, reason}: An error tuple with the reason for failure.

Example

iex> NBA.Live.PBP.get("0042400311") {:ok, %{"gameId" => "0042400311", actions: [%{actionNumber: 1, ...}] ...}}

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

(since 0.1.0)