nba_ex v1.0.0-beta.1 NbaEx View Source

Wrapper API for data.nba.net

Link to this section Summary

Functions

Returns the boxscore for a given date(YYYYMMDD) and game id.

Returns all of the coaches in the league.

Returns individual plays for a specific period in a game.

Returns statistics and game information for the specified player's last three games.

Returns a list of all active players.

Returns the scoreboard for the current date in PST.

Returns the scoreboard for a given date.

Returns team leaders for each statistic.

Returns list of players of specified team.

Returns the schedule for a specified team.

Returns all of teams in the league.

Returns team colors, team id, tricode, etc..

Link to this section Functions

Link to this function

boxscore(date, game_id)

View Source
boxscore(String.t(), String.t()) :: %{} | {:error, String.t()}

Returns the boxscore for a given date(YYYYMMDD) and game id.

iex> NbaEx.boxscore("20180316", "0021701032")
%Boxscore{
  game: %Game{},
  home_team_stats: %TeamStat{},
  away_team_stats: %TeamStat{},
  player_stats: [%PlayerStat{}]
}
Link to this function

coaches()

View Source
coaches() :: [%{}]

Returns all of the coaches in the league.

iex> NbaEx.coaches()
[
  %NbaEx.Coach{
    college: "Oklahoma",
    firstName: "Terry",
    isAssistant: true,
    lastName: "Stotts",
    personId: "1337",
    sortSequence: "25",
    teamId: "1610612757"
  },
  %NbaEx.Coach{
    college: "St. Bonaventure",
    firstName: "David",
    isAssistant: false,
    lastName: "Vanterpool",
    personId: "203150",
    sortSequence: "204",
    teamId: "1610612757"
  },
  ....
]
Link to this function

play_by_play(date, game_id, period)

View Source
play_by_play(String.t(), String.t(), Integer.t()) :: %{} | {:error, String.t()}

Returns individual plays for a specific period in a game.

iex> NbaEx.play_by_play("20180317", "0021701044", 3)
%NbaEx.PlayByPlay{
  plays: [
    %NbaEx.Play{
      clock: "12:00",
      description: "Start Period",
      eventMsgType: "12",
      hTeamScore: "60",
      isScoreChange: false,
      isVideoAvailable: false,
      personId: "",
      teamId: "",
      vTeamScore: "52"
    },
    ....
  ]
}
Link to this function

player_game_log(player_id)

View Source
player_game_log(String.t()) :: [%{}] | {:error, String.t()}

Returns statistics and game information for the specified player's last three games.

iex> NbaEx.player_game_log("1628432")
[
  %NbaEx.PlayerGameLog{
    gameDateUTC: "2018-03-15",
    gameId: "0021701027",
    gameUrlCode: "20180315/PHXUTA",
    hTeam: %NbaEx.TeamScore{
      isWinner: true,
      score: "116",
      teamId: "1610612762",
      triCode: nil
    },
    isHomeGame: false,
    stats: %NbaEx.PlayerStat{
      assists: "0",
      blocks: nil,
      defReb: "2",
      ...
  }
]
Link to this function

players()

View Source
players() :: [%{}]

Returns a list of all active players.

iex> NbaEx.players()
[
  %NbaEx.Player{
    collegeName: "Texas",
    country: "USA",
    dateOfBirthUTC: "1985-07-19",
    firstName: "LaMarcus",
    heightFeet: "6",
    ...
  },
  ...
]
Link to this function

scoreboard()

View Source
scoreboard() :: %{}

Returns the scoreboard for the current date in PST.

iex> NbaEx.scoreboard()
%NbaEx.Scoreboard{
  games: [
    %NbaEx.Game{
      arena: %NbaEx.Arena{
        city: "Milwaukee",
        country: "USA",
        name: "BMO Harris Bradley Center",
        stateAbbr: "WI"
      },
      clock: "",
      endTimeUTC: "2018-03-17T23:34:00.000Z",
      ...
    },
    ...
  ]
}
Link to this function

scoreboard_for(date)

View Source
scoreboard_for(String.t()) :: %{} | {:error, String.t()}

Returns the scoreboard for a given date.

iex> NbaEx.scoreboard_for("20180317")
%NbaEx.Scoreboard{
  games: [
    %NbaEx.Game{
      arena: %NbaEx.Arena{
        city: "Milwaukee",
        country: "USA",
        name: "BMO Harris Bradley Center",
        stateAbbr: "WI"
      },
      clock: "",
      endTimeUTC: "2018-03-17T23:34:00.000Z",
      ...
    },
    ...
  ]
}
Link to this function

team_leaders(team_name)

View Source
team_leaders(String.t()) :: %{} | {:error, String.t()}

Returns team leaders for each statistic.

iex> NbaEx.team_leaders("warriors")
%NbaEx.TeamLeaders{
  apg: [%NbaEx.Leader{personId: "203110", value: "7.4"}],
  bpg: [%NbaEx.Leader{personId: "201142", value: "1.9"}],
  fgp: [%NbaEx.Leader{personId: "1628395", value: "0.657"}],
  ...
}
Link to this function

team_roster(team_name)

View Source
team_roster(String.t()) :: [%{}] | {:error, String.t()}

Returns list of players of specified team.

iex> NbaEx.team_roster("warriors")
[
  %NbaEx.Player{
    personId: "1628395"
  },
  ...
]
Link to this function

team_schedule(team_name)

View Source
team_schedule(String.t()) :: [%{}] | {:error, String.t()}

Returns the schedule for a specified team.

iex> NbaEx.team_schedule("warriors")
[
  %NbaEx.Game{
    arena: %NbaEx.Arena{city: nil, country: nil, name: nil, stateAbbr: nil},
    clock: "",
    endTimeUTC: "",
    gameId: "0011700001",
    ...
  },
  ...
]
Link to this function

teams()

View Source
teams() :: [%{}]

Returns all of teams in the league.

iex> NbaEx.teams()
[
  %NbaEx.Team{
    city: "Atlanta",
    confName: "East",
    divName: "Southeast",
    fullName: "Atlanta Hawks",
    isNBAFranchise: true,
    nickname: "Hawks",
    teamId: "1610612737",
    tricode: "ATL"
  },
  ...
]
Link to this function

teams_config()

View Source
teams_config() :: [%{}]

Returns team colors, team id, tricode, etc..

iex> NbaEx.teams_config()
[
  %NbaEx.TeamConfig{
    primaryColor: "#e21a37",
    secondaryColor: "#e21a37",
    teamId: "1610612737",
    tricode: "ATL",
    ttsName: "Atlanta Hawks"
  },
  ...
]