NBA.Stats.LeagueGameLog (nba_api_ex v0.1.0)

View Source

Provides functions to interact with the NBA stats API for league game logs.

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [Counter: 1000, Direction: "DESC", LeagueID: "00", PlayerOrTeam: "P", Season: nil, SeasonType: "Regular Season", Sorter: "DATE", DateFrom: nil, DateTo: nil], opts \\ [])

(since 0.1.0)

Fetches league game log data.

Parameters

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

    • Counter: The number of records to return (default: 1000).

      • Type(s): Integer
      • Example: Counter: 1000
      • Default: 1000
    • Direction: The sort direction.

      • Type(s): String
      • Example: Direction: "DESC"
      • Default: "DESC"
      • Valueset:
        • "ASC"
        • "DESC"
    • LeagueID: The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
    • PlayerOrTeam: Whether to return player or team logs.

      • Type(s): String
      • Example: PlayerOrTeam: "P"
      • Default: "P"
      • Valueset:
        • "P" (Player)
        • "T" (Team)
    • Season: The season for which to fetch data.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
    • SeasonType: The type of season.

      • Type(s): String
      • Example: SeasonType: "Regular Season"
      • Default: "Regular Season"
      • Valueset:
        • "Regular Season"
        • "Pre Season"
        • "Playoffs"
        • "All Star"
        • "All-Star"
    • Sorter: The stat or field to sort by.

      • Type(s): String
      • Example: Sorter: "DATE"
      • Default: "DATE"
      • Valueset:
        • "FGM"
        • "FGA"
        • "FG_PCT"
        • "FG3M"
        • "FG3A"
        • "FG3_PCT"
        • "FTM"
        • "FTA"
        • "FT_PCT"
        • "OREB"
        • "DREB"
        • "AST"
        • "STL"
        • "BLK"
        • "TOV"
        • "REB"
        • "PTS"
        • "DATE"
    • DateFrom: Start date filter (format: "MM/DD/YYYY").

      • Type(s): String
      • Example: DateFrom: "01/01/2024"
      • Default: nil
    • DateTo: End date filter (format: "MM/DD/YYYY").

      • Type(s): String
      • Example: DateTo: "01/31/2024"
      • 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.LeagueGameLog.get(Season: "2024-25", PlayerOrTeam: "P")
{:ok, %{"LeagueGameLog" => [%{...}, ...]}}

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

(since 0.1.0)