NBA.Stats.PlayerGameLogs (nba_api_ex v0.1.0)

View Source

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

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [VsDivision: nil, VsConference: nil, TeamID: nil, ShotClockRange: nil, SeasonType: "Regular Season", SeasonSegment: nil, SeasonYear: nil, PlayerID: nil, Period: 0, PerMode: "Totals", PORound: 0, Outcome: nil, OpposingTeamID: 0, Month: 0, MeasureType: "Base", Location: nil, LeagueID: "00", LastNGames: 0, GameSegment: nil, DateTo: nil, DateFrom: nil], opts \\ [])

(since 0.1.0)

Fetches PlayerGameLogs data.

Parameters

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

    • PlayerID: (Required) The player ID.

      • Type(s): Integer | String

      • Example: PlayerID: 201939
      • Default: nil
    • SeasonYear: (Required) The season.

      • Type(s): String
      • Example: SeasonYear: "2024-25"
      • Default: nil
    • VsDivision: The vs division.

      • Type(s): String
      • Example: VsDivision: "Atlantic"
      • Default: nil
      • Valueset:
        • "Atlantic"
        • "Central"
        • "Northwest"
        • "Pacific"
        • "Southeast"
        • "Southwest"
        • "East"
        • "West"
    • VsConference: The vs conference.

      • Type(s): String
      • Example: VsConference: "East"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • TeamID: The team ID.

      • Type(s): Integer | String

      • Example: TeamID: 1610612737
      • Default: nil
    • ShotClockRange: The shot clock range.

      • Type(s): String
      • Example: ShotClockRange: "24-22"
      • Default: nil
    • SeasonType: The type of season.

      • Type(s): String
      • Example: SeasonType: "Regular Season"
      • Default: nil
      • Valueset:
        • "Regular Season"
        • "Pre Season"
        • "Playoffs"
        • "All-Star"
        • "All Star"
    • SeasonSegment: The season segment.

      • Type(s): String
      • Example: SeasonSegment: "Pre All-Star"
      • Default: nil
      • Valueset:
        • "Post All-Star"
        • "Pre All-Star"
    • Period: The period number.

      • Type(s): Integer
      • Example: Period: 1
      • Default: nil
    • PerMode: How to aggregate stats.

      • Type(s): String
      • Example: PerMode: "Totals"
      • Default: nil
      • Valueset:
        • "Totals"
        • "PerGame"
    • PORound: The playoff round.

      • Type(s): Integer | String

      • Example: PORound: 1
      • Default: nil
    • Outcome: The outcome.

      • Type(s): String
      • Example: Outcome: "W"
      • Default: nil
      • Valueset:
        • "W"
        • "L"
    • OpposingTeamID: The opposing team ID.

      • Type(s): Integer | String

      • Example: OpposingTeamID: 1610612738
      • Default: nil
    • Month: The month number.

      • Type(s): Integer
      • Example: Month: 1
      • Default: nil
    • MeasureType: The measure type.

      • Type(s): String
      • Example: MeasureType: "Base"
      • Default: nil
    • Location: The location.

      • Type(s): String
      • Example: Location: "Home"
      • Default: nil
      • Valueset:
        • "Home"
        • "Road"
    • LeagueID: The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
      • Valueset:
        • "00" (NBA)
        • "01" (ABA)
        • "10" (WNBA)
        • "20" (G League)
    • LastNGames: Number of last games to include.

      • Type(s): Integer
      • Example: LastNGames: 10
      • Default: nil
    • GameSegment: The game segment.

      • Type(s): String
      • Example: GameSegment: "First Half"
      • Default: nil
      • Valueset:
        • "First Half"
        • "Overtime"
        • "Second Half"
    • DateTo: The end date.

      • Type(s): String
      • Example: DateTo: "2024-01-31"
      • Default: nil
    • DateFrom: The start date.

      • Type(s): String
      • Example: DateFrom: "2024-01-01"
      • 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.PlayerGameLogs.get(PlayerID: 201939, Season: "2024-25")
{:ok, %{"PlayerGameLogs" => [%{...}, ...]}}

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

(since 0.1.0)