NBA.Stats.LeaguePlayerOnDetails (nba_api_ex v0.1.0)

View Source

Provides functions to interact with the NBA stats API for league player on details.

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [LastNGames: 0, MeasureType: "Base", Month: 0, OpponentTeamID: 0, PaceAdjust: "N", PerMode: "PerGame", Period: 0, PlusMinus: "N", Rank: "N", Season: nil, SeasonType: "Regular Season", TeamID: nil, VsDivision: nil, VsConference: nil, SeasonSegment: nil, Outcome: nil, Location: nil, LeagueID: nil, GameSegment: nil, DateTo: nil, DateFrom: nil], opts \\ [])

(since 0.1.0)

Fetches league player on details data.

Parameters

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

    • Season: (Required) The season for which to fetch data.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
    • TeamID: (Required) Team ID filter.

    • LastNGames: Number of most recent games to include.

      • Type(s): Integer
      • Example: LastNGames: 0
      • Default: 0
    • MeasureType: The type of measure to return.

      • Type(s): String
      • Example: MeasureType: "Base"
      • Default: "Base"
      • Valueset:
        • "Base"
        • "Advanced"
        • "Misc"
        • "Four Factors"
        • "Scoring"
        • "Opponent"
        • "Usage"
        • "Defense"
    • Month: Month filter.

      • Type(s): Integer
      • Example: Month: 0
      • Default: 0
    • OpponentTeamID: Opponent team ID filter.

    • PaceAdjust: Whether to adjust stats for pace.

      • Type(s): String
      • Example: PaceAdjust: "N"
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • PerMode: How stats are aggregated.

      • Type(s): String
      • Example: PerMode: "PerGame"
      • Default: "PerGame"
      • Valueset:
        • "Totals"
        • "PerGame"
        • "MinutesPer"
        • "Per48"
        • "Per40"
        • "Per36"
        • "PerMinute"
        • "PerPossession"
        • "PerPlay"
        • "Per100Possessions"
        • "Per100Plays"
    • Period: Period filter.

      • Type(s): Integer
      • Example: Period: 0
      • Default: 0
    • PlusMinus: Whether to include plus/minus splits.

      • Type(s): String
      • Example: PlusMinus: "N"
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • Rank: Whether to include team rank.

      • Type(s): String
      • Example: Rank: "N"
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • SeasonType: The type of season.

      • Type(s): String
      • Example: SeasonType: "Regular Season"
      • Default: "Regular Season"
      • Valueset:
        • "Regular Season"
        • "Pre Season"
        • "Playoffs"
        • "All Star"
    • VsDivision: Opponent division filter (e.g., "Atlantic", "Central", etc.).

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

      • Type(s): String
      • Example: VsConference: "West"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • SeasonSegment: Season segment filter ("Post All-Star", "Pre All-Star").

      • Type(s): String
      • Example: SeasonSegment: "Post All-Star"
      • Default: nil
      • Valueset:
        • "Post All-Star"
        • "Pre All-Star"
    • Outcome: Game outcome filter ("W", "L").

      • Type(s): String
      • Example: Outcome: "W"
      • Default: nil
      • Valueset:
        • "W"
        • "L"
    • Location: Game location filter ("Home", "Road").

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

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
      • Valueset:
        • "00" (NBA)
        • "01" (ABA)
        • "10" (WNBA)
        • "20" (G League)
    • GameSegment: Game segment filter (e.g., "First Half", "Second Half", "Overtime").

      • Type(s): String
      • Example: GameSegment: "First Half"
      • Default: nil
      • Valueset:
        • "First Half"
        • "Second Half"
        • "Overtime"
    • DateTo: End date filter (format: "MM/DD/YYYY").

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

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

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

(since 0.1.0)