NBA.Stats.PlayerIndex (nba_api_ex v0.1.0)

View Source

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

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [Active: nil, AllStar: nil, College: nil, Country: nil, DraftPick: nil, DraftRound: nil, DraftYear: nil, Height: nil, Historical: 1, LeagueID: "00", Season: nil, TeamID: 0, Weight: nil], opts \\ [])

(since 0.1.0)

Fetches PlayerIndex data.

Parameters

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

    • LeagueID: (Required) The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
      • Pattern: ^\d{2}$
    • Season: (Required) The season.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
      • Pattern: ^(\d{4}-\d{2})$
    • Active: Whether the player is active.

      • Type(s): Integer
      • Example: Active: 1
      • Default: nil
    • AllStar: Whether the player is an all-star.

      • Type(s): Integer
      • Example: AllStar: 1
      • Default: nil
    • College: The college attended.

      • Type(s): String
      • Example: College: "Duke"
      • Default: nil
    • Country: The country of origin.

      • Type(s): String
      • Example: Country: "USA"
      • Default: nil
    • DraftPick: The draft pick.

      • Type(s): String
      • Example: DraftPick: "1"
      • Default: nil
    • DraftRound: The draft round.

      • Type(s): String
      • Example: DraftRound: "1"
      • Default: nil
    • DraftYear: The draft year.

      • Type(s): String
      • Example: DraftYear: "2003"
      • Default: nil
    • Height: The height.

      • Type(s): String
      • Example: Height: "6-8"
      • Default: nil
    • Historical: Whether the player is historical.

      • Type(s): Integer
      • Example: Historical: 1
      • Default: nil
    • TeamID: The team ID.

    • Weight: The weight.

      • Type(s): Integer
      • Example: Weight: 250
      • 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.PlayerIndex.get(LeagueID: "00", Season: "2024-25")
{:ok, %{"PlayerIndex" => [%{...}, ...]}}

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

(since 0.1.0)