NBA.Stats.PlayByPlay (nba_api_ex v0.1.0)

View Source

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

See get/2 for parameter and usage details.

Summary

Functions

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

(since 0.1.0)

Fetches PlayByPlay data.

Parameters

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

    • EndPeriod: The ending period for the play-by-play data.

      • Type(s): Integer | nil

      • Example: EndPeriod: 4
      • Default: nil
    • GameID: (Required) The game ID.

      • Type(s): String
      • Example: GameID: "0022100001"
      • Pattern: ^\d{10}$
      • Default: nil
    • StartPeriod: The starting period for the play-by-play data.

      • Type(s): Integer | nil

      • Example: StartPeriod: 1
      • Default: nil
  • 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.PlayByPlay.get(GameID: "0022100001", StartPeriod: 1, EndPeriod: 4)
{:ok, %{"PlayByPlay" => [%{...}, ...]}}

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

(since 0.1.0)