NBA.Stats.LeagueGameFinder (nba_api_ex v0.1.0)

View Source

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

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [Conference: nil, DateFrom: nil, DateTo: nil, Division: nil, DraftNumber: nil, DraftRound: nil, DraftTeamID: nil, DraftYear: nil, GameID: nil, LeagueID: "00", Location: nil, Outcome: nil, PlayerID: nil, PlayerOrTeam: "P", PORound: 0, RookieYear: nil, Season: nil, SeasonSegment: nil, SeasonType: "Regular Season", StarterBench: nil, TeamID: 0, VsConference: nil, VsDivision: nil, VsTeamID: nil, YearsExperience: nil, LtAST: nil, LtBLK: nil, LtDD: nil, LtDREB: nil, LtFG3A: nil, LtFG3M: nil, LtFG3_PCT: nil, LtFGA: nil, LtFGM: nil, LtFG_PCT: nil, LtFTA: nil, LtFTM: nil, LtFT_PCT: nil, LtMINUTES: nil, LtOREB: nil, LtPF: nil, LtPTS: nil, LtREB: nil, LtSTL: nil, LtTD: nil, LtTOV: nil, GtAST: nil, GtBLK: nil, GtDD: nil, GtDREB: nil, GtFG3A: nil, GtFG3M: nil, GtFG3_PCT: nil, GtFGA: nil, GtFGM: nil, GtFG_PCT: nil, GtFTA: nil, GtFTM: nil, GtFT_PCT: nil, GtMINUTES: nil, GtOREB: nil, GtPF: nil, GtPTS: nil, GtREB: nil, GtSTL: nil, GtTD: nil, GtTOV: nil, EqAST: nil, EqBLK: nil, EqDD: nil, EqDREB: nil, EqFG3A: nil, EqFG3M: nil, EqFG3_PCT: nil, EqFGA: nil, EqFGM: nil, EqFG_PCT: nil, EqFTA: nil, EqFTM: nil, EqFT_PCT: nil, EqMINUTES: nil, EqOREB: nil, EqPF: nil, EqPTS: nil, EqREB: nil, EqSTL: nil, EqTD: nil, EqTOV: nil], opts \\ [])

(since 0.1.0)

Fetches league game finder data.

Parameters

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

    • Note: This endpoint also supports a wide range of advanced stat filters in the form of LtX, GtX, and EqX (e.g., LtPTS, GtAST, EqREB), where X is a stat name. These accept Integer or Float values and default to nil.

      • LtX: "Less than" filter for statistic X.
      • GtX: "Greater than" filter for statistic X.
      • EqX: "Equal to" filter for statistic X.
    • Conference: The conference of the team.

      • Type(s): String
      • Example: Conference: "West"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • 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
    • Division: The division of the team.

      • Type(s): String
      • Example: Division: "Pacific"
      • Default: nil
      • Valueset:
        • "Atlantic"
        • "Central"
        • "Southeast"
        • "Northwest"
        • "Pacific"
        • "Southwest"
    • DraftNumber: The draft number.

      • Type(s): Integer
      • Example: DraftNumber: 1
      • Default: nil
    • DraftRound: The draft round.

      • Type(s): Integer
      • Example: DraftRound: 1
      • Default: nil
    • DraftTeamID: The draft team ID.

      • Type(s): Integer | String

      • Example: DraftTeamID: 1610612747
      • Default: nil
    • DraftYear: The draft year of the player.

      • Type(s): Integer
      • Example: DraftYear: 2019
      • Default: nil
    • GameID: The NBA game ID.

      • Type(s): String
      • Example: GameID: "0022100001"
      • Default: nil
    • GameSegment: The segment of the game.

      • Type(s): String
      • Example: GameSegment: "First Half"
      • Default: nil
      • Valueset:
        • "First Half"
        • "Second Half"
        • "Overtime"
    • LeagueID: The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
      • Valueset:
        • "00" (NBA)
        • "01" (ABA)
        • "10" (WNBA)
        • "20" (G-League)
    • Location: Game location ("Home", "Away", or nil for all).

      • Type(s): String
      • Example: Location: "Home"
      • Default: nil
      • Valueset:
        • "Home"
        • "Away"
    • Outcome: Game outcome ("W", "L", or nil for all).

      • Type(s): String
      • Example: Outcome: "W"
      • Default: nil
      • Valueset:
        • "W"
        • "L"
    • PlayerID: The NBA player ID.

    • PlayerOrTeam: Whether to search for player or team games.

      • Type(s): String
      • Example: PlayerOrTeam: "P"
      • Default: "P"
      • Valueset:
        • "P" (Player)
        • "T" (Team)
    • PORound: The playoff round (0 for regular season).

      • Type(s): Integer
      • Example: PORound: 0
      • Default: 0
    • RookieYear: The rookie year of the player.

      • Type(s): String
      • Example: RookieYear: "2019"
      • Default: nil
    • Season: The season for which to fetch data.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
    • SeasonSegment: Season segment ("Post All-Star", "Pre All-Star", or nil).

      • Type(s): String
      • Example: SeasonSegment: "Post All-Star"
      • Default: nil
      • Valueset:
        • "Post All-Star"
        • "Pre All-Star"
    • SeasonType: The type of season.

      • Type(s): String
      • Example: SeasonType: "Regular Season"
      • Default: "Regular Season"
      • Valueset:
        • "Regular Season"
        • "Playoffs"
        • "Pre Season"
        • "All Star"
    • StarterBench: Whether the player is a starter or bench.

      • Type(s): String
      • Example: StarterBench: "Bench"
      • Default: nil
      • Valueset:
        • "Starter"
        • "Bench"
    • TeamID: Team ID (0 for all teams).

    • VsConference: Opponent conference filter ("East", "West", or nil).

      • Type(s): String
      • Example: VsConference: "West"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • VsDivision: Opponent division filter (e.g., "Atlantic", "Central", etc., or nil).

      • Type(s): String
      • Example: VsDivision: "Central"
      • Default: nil
      • Valueset:
        • "Atlantic"
        • "Central"
        • "Southeast"
        • "Northwest"
        • "Pacific"
        • "Southwest"
    • VsTeamID: The opposing team ID.

      • Type(s): Integer | String

      • Example: VsTeamID: 1610612747
      • Default: nil
    • YearsExperience: Years of NBA experience.

      • Type(s): Integer
      • Example: YearsExperience: 5
      • 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.LeagueGameFinder.get(LeagueID: "00", PlayerOrTeam: "P")
{:ok, %{"LeagueGameFinder" => [%{...}, ...]}}

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

(since 0.1.0)