NBA.Stats.PlayerNextNGames (nba_api_ex v0.1.0)

View Source

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

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [NumberOfGames: 5, PlayerID: nil, Season: nil, SeasonType: "Regular Season", LeagueID: "00"], opts \\ [])

(since 0.1.0)

Fetches PlayerNextNGames data.

Parameters

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

    • PlayerID: (Required) The player ID.

    • Season: (Required) The season.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
      • Pattern: ^(\d{4}-\d{2})|(ALL)$
    • NumberOfGames: The number of upcoming games to return.

      • Type(s): Integer
      • Example: NumberOfGames: 5
      • Default: nil
    • SeasonType: The season type.

      • Type(s): String
      • Example: SeasonType: "Regular Season"
      • Default: nil
      • Valueset:
        • "Regular Season"
        • "Pre Season"
        • "Playoffs"
        • "All-Star"
        • "All Star"
    • LeagueID: The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
      • Pattern: ^\d{2}$
  • 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.PlayerNextNGames.get(PlayerID: 201939, NumberOfGames: 5, Season: "2024-25", SeasonType: "Regular Season")
{:ok, %{"PlayerNextNGames" => [%{...}, ...]}}

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

(since 0.1.0)