stats

package module
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 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 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 NbaGetBoxscoreJson added in v0.2.9

func NbaGetBoxscoreJson(id string) []byte

func NbaGetPlaysJson added in v0.2.9

func NbaGetPlaysJson(id string) []byte

func NbaGetScheduleJson added in v0.2.7

func NbaGetScheduleJson() []byte

func NbaGetScoreboardTodayJson added in v0.2.9

func NbaGetScoreboardTodayJson() []byte

func PlaysApi

func PlaysApi(d string) 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 Base added in v0.2.16

type Base struct {
	Points         int     `json:"points"`
	Oreb           int     `json:"oreb"`
	Dreb           int     `json:"dreb"`
	Treb           int     `json:"treb"`
	Fta            int     `json:"fta"`
	Ftm            int     `json:"ftm"`
	Ftp            float64 `json:"ftp"`
	Fg2a           int     `json:"fg2a"`
	Fg2m           int     `json:"fg2m"`
	Fg2p           float64 `json:"fg2p"`
	Fg3a           int     `json:"fg3a"`
	Fg3m           int     `json:"fg3m"`
	Fg3p           float64 `json:"fg3p"`
	Fgta           int     `json:"fgta"`
	Fgtm           int     `json:"fgtm"`
	Fgtp           float64 `json:"fgtp"`
	Steals         int     `json:"steals"`
	Assists        int     `json:"assists"`
	Blocks         int     `json:"blocks"`
	Blocked        int     `json:"blocked"`
	Turnovers      int     `json:"turnovers"`
	Fouls          int     `json:"fouls"`
	Fouled         int     `json:"fouled"`
	FoulsOffensive int     `json:"foulsOffensive"`
	Technicals     int     `json:"technicals"`
	Paint          int     `json:"paint"`
	Fastbreak      int     `json:"fastbreak"`
	SecondChance   int     `json:"secondChance"`
}

type Cache added in v0.2.16

type Cache struct {
	Seasons map[string]Season `json:"seasons"`
}

type Game

type Game struct {
	GameID  string          `json:"gameId"`
	Date    string          `json:"date"`
	Away    TeamGame        `json:"away"`
	Home    TeamGame        `json:"home"`
	Periods map[int]Period  `json:"periods"`
	Plays   map[string]Play `json:"plays"`
}

type NbaAction added in v0.2.6

type NbaAction struct {
	ActionNumber          int      `json:"actionNumber"`
	Clock                 string   `json:"clock"`
	TimeActual            string   `json:"timeActual"`
	Description           string   `json:"description"`
	Descriptor            string   `json:"descriptor"`
	PersonID              int      `json:"personId"`
	TeamID                int      `json:"teamId"`
	TeamTriCode           string   `json:"teamTricode"`
	ActionType            string   `json:"actionType"`
	SubActionType         string   `json:"subType"`
	Qualifers             []string `json:"qualifiers"`
	X                     float64  `json:"x"`
	Y                     float64  `json:"y"`
	Side                  string   `json:"side"`
	ShotDistance          float64  `json:"shotDistance"`
	Possession            int      `json:"possession"`
	Period                int      `json:"period"`
	PeriodType            string   `json:"periodType"`
	AwayScore             string   `json:"scoreAway"`
	HomeScore             string   `json:"scoreHome"`
	Edited                string   `json:"edited"`
	OrderNumber           int      `json:"orderNumber"`
	XLegacy               int      `json:"xLegacy"`
	YLegacy               int      `json:"yLegacy"`
	IsFieldGoal           int      `json:"isFieldGoal"`
	ShotResult            string   `json:"shotResult"`
	Name                  string   `json:"playerName"`
	NameI                 string   `json:"playerNameI"`
	PersonIdsFilter       []int    `json:"personIdsFilter"`
	ScoreChange           bool     `json:"isScoreChange"`
	StealName             string   `json:"stealPlayerName"`
	StealPersonID         int      `json:"stealPersonId"`
	AssistName            string   `json:"assistPlayerName"`
	AssistPersonID        int      `json:"assistPersonId"`
	AssistNameI           string   `json:"assistPlayerNameInitial"`
	AssistTotal           int      `json:"assistTotal"`
	BlockName             string   `json:"blockPlayerName"`
	BlockPersonID         int      `json:"blockPersonId"`
	BlockTotal            int      `json:"blockTotal"`
	FoulDrawnPersonID     int      `json:"foulDrawnPersonId"`
	FoulDrawnName         string   `json:"foulDrawnPlayerName"`
	FoulPersonTotal       int      `json:"foulPersonTotal"`
	FoulTechTotal         int      `json:"foulTechnicalTotal"`
	JumpLostName          string   `json:"jumpBallLostPlayerName"`
	JumpLostPersonID      int      `json:"jumpBallLostPersonId"`
	JumpRecoveredName     string   `json:"jumpBallRecoveredPlayerName"`
	JumpRecoveredPersonID int      `json:"jumpBallRecoveredPersonId"`
	JumpWonName           string   `json:"jumpBallWonPlayerName"`
	JumpWonPersonID       int      `json:"jumpBallWonPersonId"`
	OfficialID            int      `json:"officialId"`
	ShotNum               int      `json:"shotActionNumber"`
	TurnoverTotal         int      `json:"turnoverTotal"`
	Value                 string   `json:"value"`
}

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:"fg2m"`
	Fga       string `json:"fg2a"`
	Fg3m      string `json:"fg3m"`
	Fg3a      string `json:"fg3a"`
	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
	Fg2p      string `json:"fg2p"` // 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 NbaGameActions added in v0.2.6

type NbaGameActions struct {
	Actions []NbaAction `json:"actions"`
}

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"`
}

type NbaGameDates

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

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 NbaPlayByPlay added in v0.2.6

type NbaPlayByPlay struct {
	Meta NbaMeta        `json:"meta"`
	Game NbaGameActions `json:"game"`
}

func NbaGetPlays added in v0.2.6

func NbaGetPlays(id string) *NbaPlayByPlay

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"`
	Order      int                 `json:"order"`
	Statistics NbaPlayerStatistics `json:"statistics"`
}

type NbaPlayerData

type NbaPlayerData struct {
	ID             string  `json:"personId"`
	TeamID         int     `json:"teamId"`
	First          string  `json:"firstName"`
	Last           string  `json:"familyName"`
	Points         int     `json:"points"`
	Minutes        string  `json:"minutesCalculated"`
	Fgm            int     `json:"fieldGoalsMade"`
	Fga            int     `json:"fieldGoalsAttempted"`
	Ftm            int     `json:"freeThrowsMade"`
	Fta            int     `json:"freeThrowsAttempted"`
	Fg2m           int     `json:"twoPointersMade"`
	Fg2a           int     `json:"twoPointersAttempted"`
	Fg3m           int     `json:"threePointersMade"`
	Fg3a           int     `json:"threePointersAttempted"`
	Oreb           int     `json:"reboundsOffensive"`
	Dreb           int     `json:"reboundsDefensive"`
	Treb           int     `json:"reboundsTotal"`
	Assists        int     `json:"assists"`
	Fouls          int     `json:"foulsPersonal"`
	FoulsOffensive int     `json:"foulsOffensive"`
	FoulsDrawn     int     `json:"foulsDrawn"`
	FoulsTechnical int     `json:"foulsTechnical"`
	Steals         int     `json:"steals"`
	Turnovers      int     `json:"turnovers"`
	Blocks         int     `json:"blocks"`
	Blocked        int     `json:"blocksReceived"`
	PlusMinus      float32 `json:"plusMinusPoints"`
	Position       string  `json:"position"`
	Fastbreak      int     `json:"pointsFastBreak"`
	Paint          int     `json:"pointsInThePaint"`
	SecondChance   int     `json:"pointsSecondChance"`
}

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:"minutesCalculated"`
	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 Period added in v0.2.16

type Period struct {
	Number     int    `json:"number"`
	PeriodType string `json:"periodType"`
	Away       int    `json:"away"`
	Home       int    `json:"home"`
}

type Play

type Play struct {
	ID     string `json:"id"`
	Detail string `json:"detail"`
}

type PlayerGame added in v0.2.16

type PlayerGame struct {
	GameID    string  `json:"gameId"`
	HomeCode  string  `json:"homeCode"`
	AwayCode  string  `json:"awayCode"`
	GameDate  string  `json:"gameDate"`
	Starter   string  `json:"starter"`
	Minutes   float64 `json:"minutes"`
	PlusMinus float64 `json:"plusMinus"`
	Base      `json:"stats"`
}

type PlayerInfo

type PlayerInfo 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"`
}

func TPlayerGame added in v0.2.18

func TPlayerGame(p NbaPlayer) PlayerInfo

type Season

type Season struct {
	ID           string               `json:"id"`
	Players      map[int]SeasonPlayer `json:"players"`
	Teams        int                  `json:"teams"`
	Games        map[string]Game      `json:"games"`
	Leaderboard  int                  `json:"leaderboard"`
	Standings    int                  `json:"standings"`
	Transactions int                  `json:"transactions"`
}

type SeasonPlayer added in v0.2.16

type SeasonPlayer struct {
	Games map[string]PlayerGame `json:"games"`
	Info  PlayerInfo            `json:"info"`
}

type SeasonTeam added in v0.2.16

type SeasonTeam struct {
	Games map[string]Game `json:"games"`
	Info  TeamInfo        `json:"info"`
}

type TeamGame added in v0.2.16

type TeamGame struct {
	ID      int                `json:"id"`
	Abv     string             `json:"abv"`
	Score   int                `json:"score"`
	Players map[int]PlayerGame `json:"players"`
}

type TeamInfo

type TeamInfo struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Code   string `json:"last"`
	City   string `json:"full"`
	Mascot string `json:"abv"`
	Conf   string `json:"position"`
	Div    string `json:"active"`
}

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