stats

package module
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 9 Imported by: 4

README

stats

golang library for scraping nba stats from data.nba.net api's, normalizing this data, and provides a set of analysis functions. stats also leverages redis to persist data.

dependencies

  • go build

Documentation

Index

Constants

View Source
const (
	APP_NAME    = "stats"
	APP_STORAGE = "nba"
	APP_VERSION = "1.1"
)
View Source
const (
	ESPN_BASE_URL            = `https://www.espn.com`
	ESPN_SCOREBOARD_URL      = `https://espn.com/nba/scoreboard`
	ESPN_SCOREBOARD_DATE_URL = `https://espn.com/nba/scoreboard/_/date/%s`
	ESPN_BOXSCORE_URL        = `https://www.espn.com/nba/boxscore?gameId=`
	ESPN_PLAYER_ICON_URL     = `https://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/%s.png&h=80&w=110&scale=crop`
	ESPN_TEAM_ICON_URL       = `https://a.espncdn.com/i/teamlogos/nba/500/%s.png`
)
View Source
const (
	ESPN_SCOREBOARD_EVENTS_ID = "events"
	ESPN_BOXSCORE_ID          = "gamepackage-box-score"
	ESPN_TEAM_NAME_CLASS      = "team-name"
)
View Source
const (
	//NBA_BASE_URL									= "https://data.nba.net/data/10s/prod/v1"
	NBA_BASE_URL     = "https://cdn.nba.com/static/json"
	NBA_STATIC       = "/staticData"
	NBA_SCHEDULE     = "/scheduleLeagueV2_9.json"
	NBA_LIVE         = "/liveData"
	NBA_API_BOXSCORE = "/boxscore/boxscore_%s.json"
	NBA_API_PLAYS    = "/playbyplay/playbyplay_%s.json"
	//NBA_API_BOXSCORE							= "/%s/%s_boxscore.json"
	NBA_API_PLAYERS        = "/%s/players.json"
	NBA_API_PLAYER_PROFILE = "/%s/players/%s_profile.json"
	//NBA_API_PLAYS            			= "/%s/%s_pbp_%d.json"
	NBA_API_ROSTER = "/%s/teams/%s/roster.json"
	//NBA_API_SCOREBOARD            = "/%s/scoreboard.json"
	NBA_API_TODAYS_SCOREBOARD = "/scoreboard/todaysScoreboard_00.json"
	NBA_API_STANDINGS         = "/current/standings_all.json"
	NBA_API_TEAMS             = "/%s/teams.json"
	NBA_API_TEAM_RANKS        = "/%s/team_stats_rankings.json"
)
View Source
const (
	HTML_ANCHOR     = "a"
	HTML_ARTICLE    = "article"
	HTML_ATTR_CLASS = "class"
	HTML_ATTR_HREF  = "href"
	HTML_ATTR_ID    = "id"
	HTML_DIV        = "div"
	HTML_SCRIPT     = "script"
	HTML_SPAN       = "span"
	HTML_TABLE      = "table"
	HTML_TBODY      = "tbody"
	HTML_TD         = "td"
	HTML_TR         = "tr"
)
View Source
const (
	MATCH_BOXSCORE    = `/nba/game?gameId=`
	MATCH_BOXSCORE_RE = "gameId=[0-9]+}"
)
View Source
const (
	STRING_COLON        = ":"
	STRING_EMPTY        = ""
	STRING_EQUAL        = "="
	STRING_MINUS        = "-"
	STRING_NA           = "--"
	STRING_PERIOD       = "."
	STRING_SINGLE_QUOTE = "'"
	STRING_SPACE        = " "
	STRING_TWO_SPACES   = "  "
	STRING_TAB          = "    "
	STRING_ZERO         = "0"
	STRING_ZERO_FLOAT   = "0.0"
)
View Source
const (
	FIELD_FG  = "fg"
	FIELD_FG3 = "fg3"
	FIELD_FT  = "ft"
)
View Source
const (
	INDEX_MADE           = 0
	INDEX_ATTEMPTS       = 1
	INDEX_SPAN_NAME      = 0
	INDEX_SPAN_NAME_ABBR = 1
	INDEX_SPAN_POSITION  = 2
	INDEX_AWAY_STARTERS  = 0
	INDEX_AWAY_BENCH     = 1
	INDEX_HOME_STARTERS  = 2
	INDEX_HOME_BENCH     = 3
)
View Source
const (
	BASE10 = 10
	BITS32 = 32
	BY2    = 2
)
View Source
const (
	DNP       = "dnp"
	HIGHLIGHT = "highlight"
)
View Source
const (
	STARTERS = "starters"
	BENCH    = "bench"
)
View Source
const (
	EST_FORMAT          = "20060102 3:04 PM MST"
	DATE_FORMAT         = "20060102"
	YEAR_FORMAT         = "2006"
	NBA_DATETIME_FORMAT = "01/02/2006 15:04:05"
	EST                 = "America/New_York" // Eastern Standard Time
)
View Source
const (
	MAX_SEASON_END = "0630" // add buffer to be safe
	MAX_PERIODS    = 10     // 6 overtimes
)
View Source
const (
	JSON_INDENT = "  "
	JSON_PREFIX = ""
)
View Source
const (
	GAME_FILE    = "%s%s.json"
	PLAYERS_DIR  = "players"
	PLAYERS_FILE = "players.json"
	PLAYS_FILE   = "%s.%s.plays.json"
	//TEAMS_DIR                   = "teams"
	TEAMS_FILE        = "teams.json"
	TEAM_RANKS_FILE   = "team.ranks.json"
	NBA_SCHEDULE_FILE = "schedule.%s.json"
	UNTAGGED          = "untagged"
)
View Source
const (
	FLOAT_TO_PERCENT = 100.0
)
View Source
const (
	HTTP_TIMEOUT = 45 // seconds
)
View Source
const (
	INDEX_FIELD_NAME = 0
)

Variables

This section is empty.

Functions

func BoxscoreApi

func BoxscoreApi(id string) string

func GameAnalysis

func GameAnalysis()

func GameDateToString added in v0.2.5

func GameDateToString(d string) string

func GetCurrentSeason

func GetCurrentSeason() string

func IsAfterDate added in v0.2.4

func IsAfterDate(d1 string, d2 string) bool

func IsFutureGame

func IsFutureGame(d string) bool

func Percentage

func Percentage(p *Player, fn string) string

func PlaysApi

func PlaysApi(d string, gid string, period int) string

func ScheduleApi

func ScheduleApi() string

func ScoreboardTodayApi

func ScoreboardTodayApi() string

func UtcToString added in v0.2.5

func UtcToString(d string) string

Types

type AdvStats

type AdvStats struct {
	SeasonID  string  `json:"seasonId"`
	TeamID    int     `json:"teamId"`
	Minutes   int     `json:"minutes"`
	Points    int     `json:"points"`
	Oreb      int     `json:"oreb"`
	Dreb      int     `json:"dreb"`
	Treb      int     `json:"treb"`
	Assists   int     `json:"assists"`
	Turnovers int     `json:"turnovers"`
	Steals    int     `json:"steals"`
	Blocks    int     `json:"blocks"`
	Fouls     int     `json:"fouls"`
	Fgm       int     `json:"fgm"`
	Fga       int     `json:"fga"`
	Fg3m      int     `json:"fg3m"`
	Fg3a      int     `json:"fg3a"`
	Ftm       int     `json:"ftm"`
	Fta       int     `json:"fta"`
	Played    int     `json:"played"`
	Started   int     `json:"started"`
	PlusMinus int     `json:"plusMinus"`
	Ppg       float32 `json:"ppg"`  // points per game
	Rpg       float32 `json:"rpg"`  // rebounds per game
	Apg       float32 `json:"apg"`  // assists per game
	Mpg       float32 `json:"mpg"`  // minutes per game
	Tpg       float32 `json:"tpg"`  // turnovers per game
	Spg       float32 `json:"spg"`  // steals per game
	Bpg       float32 `json:"bpg"`  // blocks per game
	Fpg       float32 `json:"fpg"`  // fouls per game
	Fgp       float32 `json:"fgp"`  // fg %
	Fg3p      float32 `json:"fg3p"` // three point %
	Ftp       float32 `json:"ftp"`  // free throw %
}

func PlayerAverages

func PlayerAverages(games []Player) AdvStats

func TeamAverages

func TeamAverages(games []Team) AdvStats

type AllPlayers

type AllPlayers struct {
	SeasonID string       `json:"seasonId"`
	PubDate  string       `json:"pubDate"`
	Players  []PlayerInfo `json:"players"`
}

type AllRanks

type AllRanks struct {
	SeasonID string      `json:"seasonId"`
	PubDate  string      `json:"pubDate"`
	Teams    []TeamRanks `json:"teams"`
}

type AllTeams

type AllTeams struct {
	SeasonID string     `json:"seasonId"`
	PubDate  string     `json:"pubDate"`
	Teams    []TeamInfo `json:"teams"`
}

type Game

type Game struct {
	ID       string `json:"id"`
	SeasonID string `json:"seasonId"`
	Date     string `json:"date"`
	PubDate  string `json:"pubDate"`
	StartUtc string `json:"startUtc"`
	EndUtc   string `json:"endUtc"`
	Source   string `json:"source"`
	Home     Team   `json:"home"`
	Away     Team   `json:"away"`
	Plays    []Play `json:"plays"`
}

type GameLog

type GameLog struct {
	Date    string `json:"date"`
	PubDate string `json:"pubDate"`
	GameID  string `json:"gameId"`
	Plays   []Play `json:"plays"`
}

type NbaAdvStats

type NbaAdvStats struct {
	SeasonID  int    `json:"seasonYear"`
	TeamID    int    `json:"teamId"`
	Minutes   string `json:"min"`
	Points    string `json:"points"`
	Oreb      string `json:"offReb"`
	Dreb      string `json:"defReb"`
	Treb      string `json:"totReb"`
	Assists   string `json:"assists"`
	Turnovers string `json:"turnovers"`
	Steals    string `json:"steals"`
	Blocks    string `json:"blocks"`
	Fouls     string `json:"pFouls"`
	Fgm       string `json:"fgm"`
	Fga       string `json:"fga"`
	Fg3m      string `json:"tpm"`
	Fg3a      string `json:"tpa"`
	Ftm       string `json:"ftm"`
	Fta       string `json:"fta"`
	Played    string `json:"gamesPlayed"`
	Started   string `json:"gamesStarted"`
	PlusMinus string `json:"plusMinus"`
	Ppg       string `json:"ppg"`  // points per game
	Rpg       string `json:"rpg"`  // rebounds per game
	Apg       string `json:"apg"`  // assists per game
	Mpg       string `json:"mpg"`  // minutes per game
	Tpg       string `json:"topg"` // turnovers per game
	Spg       string `json:"spg"`  // steals per game
	Bpg       string `json:"bpg"`  // blocks per game
	Fgp       string `json:"fgp"`  // fg %
	Fg3p      string `json:"tpp"`  // three point %
	Ftp       string `json:"ftp"`  // free throw %
}

type NbaBoxscore

type NbaBoxscore struct {
	Meta NbaMeta `json:"meta"`
	Game NbaGame `json:"game"`
}

func NbaGetBoxscore

func NbaGetBoxscore(id string) *NbaBoxscore

type NbaFormatted

type NbaFormatted struct {
	Description string `json:"description"`
}

type NbaGame

type NbaGame struct {
	ID         string       `json:"gameId"`
	GameCode   string       `json:"gameCode"`
	WeekNumber int          `json:"weekNumber"`
	GameTime   string       `json:"gameTimeUTC"` // UTC
	Away       NbaTeamScore `json:"awayTeam"`
	Home       NbaTeamScore `json:"homeTeam"`
}

type NbaGameData

type NbaGameData struct {
	ID        string       `json:"gameId"`
	SeasonID  string       `json:"seasonYear"`
	Date      string       `json:"homeStartDate"`
	StartUtc  string       `json:"startTimeUTC"`
	EndUtc    string       `json:"endTimeUTC"`
	AwayScore NbaTeamScore `json:"vTeam"`
	HomeScore NbaTeamScore `json:"hTeam"`
	Plays     []NbaPlay    `json:"plays"`
}

type NbaGameDates

type NbaGameDates struct {
	GameDate string    `json:"gameDate"` // 10/05/2023 00:00:00
	Games    []NbaGame `json:"games"`
}

type NbaGameLog

type NbaGameLog struct {
	Plays  []NbaPlay `json:"plays"`
	Date   string    `json:"date"`
	GameID string    `json:"gameId"`
}

type NbaLeague

type NbaLeague struct {
	Players []NbaPlayerInfo `json:"standard"`
}

type NbaLeague2

type NbaLeague2 struct {
	NbaStats2 `json:"standard"`
}

type NbaLeague3

type NbaLeague3 struct {
	Teams []NbaTeamStandard `json:"standard"`
}

type NbaLeague4

type NbaLeague4 struct {
	NbaRegularSeason2 `json:"regularSeason"`
}

type NbaLeague5

type NbaLeague5 struct {
	NbaRegularSeason2 `json:"regularSeason"`
}

type NbaLeague6

type NbaLeague6 struct {
	NbaStandard4 `json:"standard"`
}

type NbaLeaguePlayers

type NbaLeaguePlayers struct {
	NbaLeague `json:"league"`
	SeasonID  string `json:"season"`
}

type NbaLeagueSchedule

type NbaLeagueSchedule struct {
	SeasonYear string         `json:"seasonYear"`
	LeagueId   string         `json:"leagueId"`
	GameDates  []NbaGameDates `json:"gameDates"`
	Weeks      []NbaWeek      `json:"weeks"`
}

type NbaMeta

type NbaMeta struct {
	Version int    `json:"version"`
	Request string `json:"request"`
	Time    string `json:"time"`
}

type NbaPlay

type NbaPlay struct {
	Clock        string       `json:"clock"`
	Description  string       `json:"description"`
	PersonID     string       `json:"personId"`
	TeamID       int          `json:"teamId"`
	Period       int          `json:"period"`
	AwayScore    string       `json:"vTeamScore"`
	HomeScore    string       `json:"hTeamScore"`
	EventMsgType string       `json:"eventMsgType"`
	ScoreChange  bool         `json:"isScoreChange"`
	FmtDesc      NbaFormatted `json:"formatted"`
}

type NbaPlayer

type NbaPlayer struct {
	ID         int                 `json:"personId"`
	First      string              `json:"firstName"`
	Last       string              `json:"familyName"`
	Name       string              `json:"name"`
	NameShort  string              `json:"nameI"`
	Jersey     string              `json:"jerseyNum"`
	Position   string              `json:"position"`
	Starter    string              `json:"starter"`
	Statistics NbaPlayerStatistics `json:"statistics"`
}

type NbaPlayerData

type NbaPlayerData struct {
	ID        string `json:"personId"`
	TeamID    int    `json:"teamId"`
	First     string `json:"firstName"`
	Last      string `json:"lastName"`
	Points    string `json:"points"`
	Minutes   string `json:"min"`
	Fgm       string `json:"fgm"`
	Fga       string `json:"fga"`
	Ftm       string `json:"ftm"`
	Fta       string `json:"fta"`
	Fg3m      string `json:"tpm"`
	Fg3a      string `json:"tpa"`
	Oreb      string `json:"offReb"`
	Dreb      string `json:"defReb"`
	Treb      string `json:"totReb"`
	Assists   string `json:"assists"`
	Fouls     string `json:"pFouls"`
	Steals    string `json:"steals"`
	Turnovers string `json:"turnovers"`
	Blocks    string `json:"blocks"`
	PlusMinus string `json:"plusMinus"`
	DnpReason string `json:"dnp"`
	Position  string `json:"pos"`
}

type NbaPlayerInfo

type NbaPlayerInfo struct {
	ID        string `json:"personId"`
	First     string `json:"firstName"`
	Last      string `json:"lastName"`
	TeamID    int    `json:"teamId"`
	Jersey    string `json:"jerseyNum"`
	Position  string `json:"position"`
	Starter   string `json:"starter"`
	Feet      string `json:"heightFeet"`
	Inches    string `json:"heightInches"`
	Meters    string `json:"heightMeters"`
	Pounds    string `json:"weightPounds"`
	Kilograms string `json:"weightKilograms"`
	Dob       string `json:"dateOfBirthUTC"`
	Rookie    string `json:"nbaDebutYear"`
	Years     string `json:"yearsPro"`
	College   string `json:"collegeName"`
	Active    bool   `json:"isActive"`
}

type NbaPlayerProfile

type NbaPlayerProfile struct {
	NbaLeague2 `json:"league"`
	ID         string `json:"id"`
	SeasonID   string `json:"seasonId"`
	First      string `json:"first"`
	Last       string `json:"last"`
}

type NbaPlayerStatistics

type NbaPlayerStatistics struct {
	Assists      int     `json:"assists"`
	Blocks       int     `json:"blocks"`
	Blocked      int     `json:"blocksReceived"`
	Fga          int     `json:"fga"`
	Fgm          int     `json:"fgm"`
	Fgp          float64 `json:"fta"`
	FoulsOff     int     `json:"foulsOffensive"`
	FoulsDrawn   int     `json:"foulsDrawn"`
	Fouls        int     `json:"foulsPersonal"`
	Technicals   int     `json:"foulsTechnical"`
	Fta          int     `json:"freeThrowsAttempted"`
	Ftm          int     `json:"freeThrowsMade"`
	Ftp          float64 `json:"freeThrowsPercentage"`
	Minutes      string  `json:"minutes"`
	Plus         float64 `json:"plus"`
	PlusMinus    float64 `json:"plusMinusPoints"`
	Points       int     `json:"points"`
	PointsFast   int     `json:"pointsFastBreak"`
	PointsPaint  int     `json:"pointsInThePaint"`
	PointsSecond int     `json:"pointsSecondChance"`
	Dreb         int     `json:"reboundsDefensive"`
	Oreb         int     `json:"reboundsOffensive"`
	Treb         int     `json:"reboundsTotal"`
	Steals       int     `json:"steals"`
	Fg3a         int     `json:"threePointersAttempted"`
	Fg3m         int     `json:"threePointersMade"`
	Fg3p         float64 `json:"threePointersPercentage"`
	Turnovers    int     `json:"turnovers"`
	Fg2a         int     `json:"twoPointersAttempted"`
	Fg2m         int     `json:"twoPointersMade"`
	Fg2p         float64 `json:"twoPointersPercentage"`
}

type NbaPlayerStats

type NbaPlayerStats struct {
	Latest           NbaAdvStats `json:"latest"`
	Career           NbaAdvStats `json:"careerSummary"`
	NbaRegularSeason `json:"regularSeason"`
}

type NbaRankStat

type NbaRankStat struct {
	Average string `json:"avg"`
	Rank    string `json:"rank"`
}

type NbaRanks

type NbaRanks struct {
	NbaStandard2 `json:"league"`
	SeasonID     string `json:"seasonId"`
}

type NbaRegularSeason

type NbaRegularSeason struct {
	SeasonInfo []NbaSeasonStats `json:"season"`
}

type NbaRegularSeason2

type NbaRegularSeason2 struct {
	Teams []NbaTeamRanks `json:"teams"`
}

type NbaSchedule

type NbaSchedule struct {
	Meta           NbaMeta           `json:"meta"`
	LeagueSchedule NbaLeagueSchedule `json:"leagueSchedule"`
}

func NbaGetSchedule

func NbaGetSchedule() *NbaSchedule

type NbaScoreData

type NbaScoreData struct {
	Score      int    `json:"score"`
	PeriodType string `json:"periodType"`
	Period     int    `json:"period"`
}

type NbaScoreboard

type NbaScoreboard struct {
	GameDate   string    `json:"gameDate"`
	LeagueId   string    `json:"leagueId"`
	LeagueName string    `json:"leagueName"`
	Games      []NbaGame `json:"games"`
}

type NbaScoreboardToday

type NbaScoreboardToday struct {
	Meta       NbaMeta       `json:"meta"`
	Scoreboard NbaScoreboard `json:"scoreboard"`
}

func NbaGetScoreboardToday

func NbaGetScoreboardToday() *NbaScoreboardToday

type NbaSeasonStats

type NbaSeasonStats struct {
	SeasonID int           `json:"seasonYear"`
	Teams    []NbaAdvStats `json:"teams"`
	Total    NbaAdvStats   `json:"total"`
}

type NbaStandard2

type NbaStandard2 struct {
	NbaLeague4 `json:"standard"`
}

type NbaStandard3

type NbaStandard3 struct {
	NbaTeam2 `json:"standard"`
}

type NbaStandard4

type NbaStandard4 struct {
	SeasonID int        `json:"seasonYear"`
	Teams    []NbaTeam3 `json:"teams"`
}

type NbaStats

type NbaStats struct {
	Players []NbaPlayerData `json:"activePlayers"`
	Away    NbaTeam         `json:"vTeam"`
	Home    NbaTeam         `json:"hTeam"`
}

type NbaStats2

type NbaStats2 struct {
	NbaPlayerStats `json:"stats"`
}

type NbaTeam

type NbaTeam struct {
	NbaTeamData `json:"totals"`
}

type NbaTeam2

type NbaTeam2 struct {
	Players []NbaTeamPlayer `json:"players"`
	TeamID  int             `json:"teamId"`
}

type NbaTeam3

type NbaTeam3 struct {
	TeamID    int    `json:"teamId"`
	W         string `json:"win"`
	L         string `json:"loss"`
	Pct       string `json:"winPct"`
	Gb        string `json:"gamesBehind"`
	Rank      string `json:"confRank"`
	Cw        string `json:"confWin"`
	Cl        string `json:"confLoss"`
	Dw        string `json:"divWin"`
	Dl        string `json:"divLoss"`
	Hw        string `json:"homeWin"`
	Hl        string `json:"homeLoss"`
	Aw        string `json:"awayWin"`
	Al        string `json:"awayLoss"`
	L10w      string `json:"lastTenWin"`
	L10l      string `json:"lastTenLoss"`
	Streak    string `json:"streak"`
	WinStreak bool   `json:"isWinStreak"`

	TeamSites `json:"teamSitesOnly"`
}

type NbaTeamData

type NbaTeamData struct {
	Points    string `json:"points"`
	Minutes   string `json:"min"`
	Fgm       string `json:"fgm"`
	Fga       string `json:"fga"`
	Ftm       string `json:"ftm"`
	Fta       string `json:"fta"`
	Fg3m      string `json:"tpm"`
	Fg3a      string `json:"tpa"`
	Oreb      string `json:"offReb"`
	Dreb      string `json:"defReb"`
	Treb      string `json:"totReb"`
	Assists   string `json:"assists"`
	Fouls     string `json:"pFouls"`
	Steals    string `json:"steals"`
	Turnovers string `json:"turnovers"`
	Blocks    string `json:"blocks"`
	PlusMinus string `json:"plusMinus"`
}

type NbaTeamPlayer

type NbaTeamPlayer struct {
	ID string `json:"personId"`
}

type NbaTeamRanks

type NbaTeamRanks struct {
	ID             int         `json:"teamId"`
	Fgp            NbaRankStat `json:"fgp"`
	Fg3p           NbaRankStat `json:"tpp"`
	Ftp            NbaRankStat `json:"ftp"`
	Oreb           NbaRankStat `json:"orpg"`
	Dreb           NbaRankStat `json:"drpg"`
	Treb           NbaRankStat `json:"trpg"`
	Assists        NbaRankStat `json:"apg"`
	Turnovers      NbaRankStat `json:"tpg"`
	Steals         NbaRankStat `json:"spg"`
	Blocks         NbaRankStat `json:"bpg"`
	Fouls          NbaRankStat `json:"pfpg"`
	Points         NbaRankStat `json:"ppg"`
	OpponentPoints NbaRankStat `json:"oppg"`
	Efficiency     NbaRankStat `json:"eff"`
	Minutes        NbaRankStat `json:"min"`
	Abbreviation   string      `json:"abbreviation"`
}

type NbaTeamRoster

type NbaTeamRoster struct {
	NbaStandard3 `json:"league"`
}

type NbaTeamScore

type NbaTeamScore struct {
	ID        int            `json:"teamId"`
	ShortName string         `json:"teamTriCode"`
	Score     int            `json:"score"`
	Periods   []NbaScoreData `json:"periods"`
	Players   []NbaPlayer    `json:"players"`
}

type NbaTeamStandard

type NbaTeamStandard struct {
	ID         int    `json:"teamId"`
	IsNba      bool   `json:"isNBAFranchise"`
	City       string `json:"city"`
	Code       string `json:"tricode"`
	Full       string `json:"fullName"`
	Short      string `json:"nickname"`
	Conference string `json:"confName"`
	Division   string `json:"divName"`
}

type NbaTeamStandings

type NbaTeamStandings struct {
	NbaLeague6 `json:"league"`
}

type NbaTeamStats

type NbaTeamStats struct {
	ShortName string          `json:"triCode"`
	Players   []NbaPlayerData `json:"activePlayers"`
}

type NbaTeams

type NbaTeams struct {
	NbaLeague3 `json:"league"`
	SeasonID   string `json:"seasonId"`
}

type NbaWeek

type NbaWeek struct {
	WeekNumber int    `json:"weekNumber"`
	StartDate  string `json:"startDate"` // UTC
	EndDate    string `json:"endDate"`   // UTC
}

type Play

type Play struct {
	Clock        string `json:"clock"`
	Description  string `json:"description"`
	PersonID     string `json:"personId"`
	TeamID       int    `json:"teamId"`
	TeamName     string `json:"teamName"`
	Period       int    `json:"period"`
	Away         int    `json:"away"`
	Home         int    `json:"home"`
	EventType    int    `json:"eventType"`
	ScoreChanged bool   `json:"scoreChanged"`
	Formatted    string `json:"formatted"`
}

type Player

type Player struct {
	ID        string `json:"id"`
	Opponent  string `json:"opponent"`
	Name      string `json:"name"`
	Minutes   int    `json:"minutes"`
	Seconds   int    `json:"seconds"`
	Starter   bool   `json:"starter"`
	DnpReason string `json:"dnpReason"`
	Position  string `json:"position"`
	Stats
}

type Player2

type Player2 struct {
	OpponentID string `json:"opponentId"`
	Opponent   string `json:"opponentName"`
	Player
}

type PlayerCareer

type PlayerCareer struct {
	ID        string        `json:"id"` // player id
	PubDate   string        `json:"pubDate"`
	SeasonID  string        `json:"seasonId"`
	First     string        `json:"first"`
	Last      string        `json:"last"`
	TeamName  string        `json:"teamName"`
	Latest    AdvStats      `json:"latest"`
	Career    AdvStats      `json:"career"`
	Seasons   []SeasonStats `json:"seasons"`
	LastGames []Player      `json:"lastGames"`
}

type PlayerInfo

type PlayerInfo struct {
	ID        string `json:"id"`
	First     string `json:"first"`
	Last      string `json:"last"`
	TeamID    int    `json:"teamId"`
	Jersey    string `json:"jersey"`
	Position  string `json:"position"`
	Feet      int    `json:"feet"`
	Inches    int    `json:"inches"`
	Meters    string `json:"meters"`
	Pounds    int    `json:"pounds"`
	Kilograms string `json:"kilograms"`
	Dob       string `json:"dob"`
	Rookie    string `json:"rookie"`
	Years     int    `json:"years"`
	College   string `json:"college"`
	Active    bool   `json:"active"`
}

type PlayerSeason

type PlayerSeason struct {
	ID       string `json:"id"` // player id
	PubDate  string `json:"pubDate"`
	SeasonID string `json:"seasonId"`
	First    string `json:"first"`
	Last     string `json:"last"`
	AdvStats
}

type RankStat

type RankStat struct {
	Val  float32 `json:"val"`
	Rank int     `json:"rank"`
}

type Roster

type Roster struct {
	TeamID  int      `json:"teamId"`
	Players []string `json:"players"`
}

type Season

type Season struct {
	ID       string            `json:"id"`
	Name     string            `json:"name"`
	Schedule map[string][]Game `json:"schedule"`
}

type SeasonStats

type SeasonStats struct {
	SeasonID string     `json:"seasonId"`
	Teams    []AdvStats `json:"teams"`
	Summary  AdvStats   `json:"summary"`
}

type Standings

type Standings struct {
	SeasonID string                `json:"seasonId"`
	PubDate  string                `json:"pubDate"`
	Records  map[string]TeamRecord `json:"records"`
}

type Stats

type Stats struct {
	Fga       int `json:"fga"`
	Fgm       int `json:"fgm"`
	Fg3a      int `json:"fg3a"`
	Fg3m      int `json:"fg3m"`
	Fta       int `json:"fta"`
	Ftm       int `json:"ftm"`
	Oreb      int `json:"oreb"`
	Dreb      int `json:"dreb"`
	Treb      int `json:"treb"`
	Assists   int `json:"assists"`
	Steals    int `json:"steals"`
	Blocks    int `json:"blocks"`
	Turnovers int `json:"turnovers"`
	Fouls     int `json:"fouls"`
	PlusMinus int `json:"plusMinus"`
	Points    int `json:"points"`
}

type Team

type Team struct {
	ID            int      `json:"id"`
	SeasonID      string   `json:"seasonId"` // discard
	Name          string   `json:"name"`
	Opponent      string   `json:"opponent"`
	Win           bool     `json:"win"`
	Score         int      `json:"score"`
	OpponentScore int      `json:"opponentScore"`
	Periods       []int    `json:"periods"`
	Players       []Player `json:"players"`
	Stats         `json:"summary"`
}

type TeamData

type TeamData struct {
	Name      string         `json:"name"`
	SeasonID  string         `json:"seasonId"`
	Ranks     TeamRanks      `json:"ranks"`
	Players   []PlayerSeason `json:"players"`
	Standings `json:"standings"`
	Games     []Team `json:"games"`
}

type TeamInfo

type TeamInfo struct {
	ID         int    `json:"id"`
	Full       string `json:"full"`
	Code       string `json:"code"`
	Short      string `json:"short"`
	City       string `json:"city"`
	Conference string `json:"conference"`
	Division   string `json:"division"`
}

type TeamRanks

type TeamRanks struct {
	ID             int      `json:"id"`
	Fgp            RankStat `json:"fgp"`
	Fg3p           RankStat `json:"fg3p"`
	Ftp            RankStat `json:"ftp"`
	Oreb           RankStat `json:"orpg"`
	Dreb           RankStat `json:"drpg"`
	Treb           RankStat `json:"trpg"`
	Assists        RankStat `json:"apg"`
	Turnovers      RankStat `json:"tpg"`
	Steals         RankStat `json:"spg"`
	Blocks         RankStat `json:"bpg"`
	Fouls          RankStat `json:"fpg"`
	Points         RankStat `json:"ppg"`
	OpponentPoints RankStat `json:"oppg"`
	Efficiency     RankStat `json:"efficiency"`
	Name           string   `json:"name"`
}

type TeamRecord

type TeamRecord struct {
	TeamID     int     `json:"teamId"`
	Name       string  `json:"name"`
	Mascot     string  `json:"mascot"`
	Rank       int     `json:"rank"`
	W          int     `json:"w"`
	L          int     `json:"l"`
	Pct        float32 `json:"pct"`
	Gb         float32 `json:"gb"`
	Cw         int     `json:"cw"`
	Cl         int     `json:"cl"`
	Dw         int     `json:"dw"`
	Dl         int     `json:"dl"`
	Hw         int     `json:"hw"`
	Hl         int     `json:"hl"`
	Aw         int     `json:"aw"`
	Al         int     `json:"al"`
	L10w       int     `json:"l10w"`
	L10l       int     `json:"l10l"`
	Streak     int     `json:"streak"`
	WinStreak  bool    `json:"isWinStreak"`
	StreakText string  `json:"streakText"`
}

type TeamSeasonStats

type TeamSeasonStats struct {
	Name string `json:"name"`
	AdvStats
	OpponentPoints int    `json:"opponentPoints"`
	Efficiency     string `json:"efficiency"`
}

type TeamSites

type TeamSites struct {
	Short      string `json:"teamTricode"`
	Mascot     string `json:"teamCode"`
	StreakText string `json:"streakText"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL