nag

package
v0.0.0-...-d6640ab Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultBaseURL sets default base URL for request to NBA stats.
	DefaultBaseURL = &url.URL{
		Host:   "stats.nba.com",
		Scheme: "https",
		Path:   "/stats",
	}
	// DefaultStatsHeader sets default headers for request to NBA stats.
	// no idea which is necessary and which is not
	DefaultStatsHeader = http.Header{
		"Host":               []string{"stats.nba.com"},
		"Referer":            []string{"https://stats.nba.com"},
		"User-Agent":         []string{"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"},
		"Connection":         []string{"keep-alive"},
		"Pragma":             []string{"no-cache"},
		"Cache-Control":      []string{"no-cache"},
		"Accept":             []string{"application/json", "text/plain", "*/*"},
		"Accept-Encoding":    []string{"gzip", "deflate", "br"},
		"Accept-Language":    []string{"en-US,en;q=0.9"},
		"x-nba-stats-origin": []string{"stats"},
		"x-nba-stats-token":  []string{"true"},
	}
)

Functions

func JSON

func JSON(res Response) (json.RawMessage, error)

JSON returns a JSON representation of Map

func Map

func Map(res Response) map[string]interface{}

Map maps ResultSet(s) from Response based on name and headers.

Types

type AdvStat

type AdvStat struct {
	GameID           string  `mapstructure:"GAME_ID"`
	TeamID           int64   `mapstructure:"TEAM_ID"`
	TeamAbbreviation string  `mapstructure:"TEAM_ABBREVIATION"`
	TeamCity         string  `mapstructure:"TEAM_CITY"`
	PlayerID         int64   `mapstructure:"PLAYER_ID,omitempty"`
	PlayerName       string  `mapstructure:"PLAYER_NAME,omitempty"`
	Nickname         string  `mapstructure:"NICKNAME,omitempty"`
	StartPosition    string  `mapstructure:"START_POSITION,omitempty"`
	Comment          string  `mapstructure:"COMMENT,omitempty"`
	Min              string  `mapstructure:"MIN"`
	EOffRating       float64 `mapstructure:"E_OFF_RATING"`
	OffRating        float64 `mapstructure:"OFF_RATING"`
	EDefRating       float64 `mapstructure:"E_DEF_RATING"`
	DefRating        float64 `mapstructure:"DEF_RATING"`
	ENetRating       float64 `mapstructure:"E_NET_RATING"`
	NetRating        float64 `mapstructure:"NET_RATING"`
	ASTPct           float64 `mapstructure:"AST_PCT"`
	ASTTov           float64 `mapstructure:"AST_TOV"`
	ASTRatio         float64 `mapstructure:"AST_RATIO"`
	OrebPct          float64 `mapstructure:"OREB_PCT"`
	DrebPct          float64 `mapstructure:"DREB_PCT"`
	RebPct           float64 `mapstructure:"REB_PCT"`
	TmTovPct         float64 `mapstructure:"TM_TOV_PCT"`
	EfgPct           float64 `mapstructure:"EFG_PCT"`
	TsPct            float64 `mapstructure:"TS_PCT"`
	UsgPct           float64 `mapstructure:"USG_PCT"`
	EUsgPct          float64 `mapstructure:"E_USG_PCT"`
	EPace            float64 `mapstructure:"E_PACE"`
	Pace             float64 `mapstructure:"PACE"`
	PacePer40        float64 `mapstructure:"PACE_PER40"`
	Poss             int64   `mapstructure:"POSS"`
	Pie              float64 `mapstructure:"PIE"`
	TeamName         string  `mapstructure:"TEAM_NAME,omitempty"`
	ETmTovPct        float64 `mapstructure:"E_TM_TOV_PCT,omitempty"`
}

type AllTimeLeadersGrids

type AllTimeLeadersGrids struct {
	*Client
	LeagueID   string
	PerMode    params.PerMode
	SeasonType params.SeasonType
	TopX       int

	Response *Response
}

AllTimeLeadersGrids wraps request to and response from alltimeleadersgrids endpoint.

func NewAllTimeLeadersGrids

func NewAllTimeLeadersGrids() *AllTimeLeadersGrids

NewAllTimeLeadersGrids creates a default AllTimeLeadersGrids instance.

func (*AllTimeLeadersGrids) Get

func (c *AllTimeLeadersGrids) Get() error

Get sends a GET request to alltimeleadersgrids endpoint.

type AssistLeaders

type AssistLeaders struct {
	*Client
	LeagueID     string
	PerMode      params.PerMode
	PlayerOrTeam params.PlayerOrTeam
	Season       string
	SeasonType   params.SeasonType

	Response *Response
}

AssistLeaders wraps request to and response from assistleaders endpoint.

func NewAssistLeaders

func NewAssistLeaders() *AssistLeaders

NewAssistLeaders creates a default AssistLeaders instance.

func (*AssistLeaders) Get

func (c *AssistLeaders) Get() error

Get sends a GET request to assistleaders endpoint.

type Available

type Available struct {
	GameID      string `mapstructure:"GAME_ID"`
	PtAvailable int64  `mapstructure:"PT_AVAILABLE"`
}

type AvailableVideo

type AvailableVideo struct {
	GameID             string `mapstructure:"GAME_ID"`
	VideoAvailableFlag int64  `mapstructure:"VIDEO_AVAILABLE_FLAG"`
	PtAvailable        int64  `mapstructure:"PT_AVAILABLE"`
	PtXyzAvailable     int64  `mapstructure:"PT_XYZ_AVAILABLE"`
	WhStatus           int64  `mapstructure:"WH_STATUS"`
	HustleStatus       int64  `mapstructure:"HUSTLE_STATUS"`
	HistoricalStatus   int64  `mapstructure:"HISTORICAL_STATUS"`
}

type BoxScoreAdvancedV2

type BoxScoreAdvancedV2 struct {
	*Client
	GameID      string
	StartRange  string
	EndRange    string
	RangeType   string
	StartPeriod string
	EndPeriod   string

	Response *Response
}

BoxScoreAdvancedV2 wraps request to and response from boxscoreadvancedv2 endpoint.

func NewBoxScoreAdvancedV2

func NewBoxScoreAdvancedV2(id string) *BoxScoreAdvancedV2

NewBoxScoreAdvancedV2 creates a default BoxScoreAdvancedV2 instance.

func (*BoxScoreAdvancedV2) Get

func (c *BoxScoreAdvancedV2) Get() error

Get sends a GET request to boxscoreadvancedv2 endpoint.

type BoxScoreDefensive

type BoxScoreDefensive struct {
	*Client
	GameID string

	Response *Response
}

BoxScoreDefensive wraps request to and response from boxscoredefensive endpoint.

func NewBoxScoreDefensive

func NewBoxScoreDefensive(id string) *BoxScoreDefensive

NewBoxScoreDefensive creates a default BoxScoreDefensive instance.

func (*BoxScoreDefensive) Get

func (c *BoxScoreDefensive) Get() error

Get sends a GET request to boxscoredefensive endpoint.

type BoxScoreFourFactorsV2

type BoxScoreFourFactorsV2 struct {
	*Client
	GameID      string
	StartRange  string
	EndRange    string
	RangeType   string
	StartPeriod string
	EndPeriod   string

	Response *Response
}

BoxScoreFourFactorsV2 wraps request to and response from boxscorefourfactorsv2 endpoint.

func NewBoxScoreFourFactorsV2

func NewBoxScoreFourFactorsV2(id string) *BoxScoreFourFactorsV2

NewBoxScoreFourFactorsV2 creates a default BoxScoreFourFactorsV2 instance.

func (*BoxScoreFourFactorsV2) Get

func (c *BoxScoreFourFactorsV2) Get() error

Get sends a GET request to boxscorefourfactorsv2 endpoint.

type BoxScoreMiscV2

type BoxScoreMiscV2 struct {
	*Client
	GameID      string
	StartRange  string
	EndRange    string
	RangeType   string
	StartPeriod string
	EndPeriod   string

	Response *Response
}

BoxScoreMiscV2 wraps request to and response from boxscoremiscv2 endpoint.

func NewBoxScoreMiscV2

func NewBoxScoreMiscV2(id string) *BoxScoreMiscV2

NewBoxScoreMiscV2 creates a default BoxScoreMiscV2 instance.

func (*BoxScoreMiscV2) Get

func (c *BoxScoreMiscV2) Get() error

Get sends a GET request to boxscoremiscv2 endpoint.

type BoxScorePlayerTrackV2

type BoxScorePlayerTrackV2 struct {
	*Client
	GameID string

	Response *Response
}

BoxScorePlayerTrackV2 wraps request to and response from boxscoreplayertrackv2 endpoint.

func NewBoxScorePlayerTrackV2

func NewBoxScorePlayerTrackV2(id string) *BoxScorePlayerTrackV2

NewBoxScorePlayerTrackV2 creates a default BoxScorePlayerTrackV2 instance.

func (*BoxScorePlayerTrackV2) Get

func (c *BoxScorePlayerTrackV2) Get() error

Get sends a GET request to boxscoreplayertrackv2 endpoint.

type BoxScoreScoringV2

type BoxScoreScoringV2 struct {
	*Client
	GameID      string
	StartRange  string
	EndRange    string
	RangeType   string
	StartPeriod string
	EndPeriod   string

	Response *Response
}

BoxScoreScoringV2 wraps request to and response from boxscorescoringv2 endpoint.

func NewBoxScoreScoringV2

func NewBoxScoreScoringV2(id string) *BoxScoreScoringV2

NewBoxScoreScoringV2 creates a default BoxScoreScoringV2 instance.

func (*BoxScoreScoringV2) Get

func (c *BoxScoreScoringV2) Get() error

Get sends a GET request to boxscorescoringv2 endpoint.

type BoxScoreSummaryResponse

type BoxScoreSummaryResponse struct {
	GameSummary     []GameSummary    `mapstructure:"GameSummary"`
	OtherStats      []OtherStat      `mapstructure:"OtherStats"`
	Officials       []Official       `mapstructure:"Officials"`
	InactivePlayers []InactivePlayer `mapstructure:"InactivePlayers"`
	GameInfo        []GameInfo       `mapstructure:"GameInfo"`
	LineScore       []LineScore      `mapstructure:"LineScore"`
	LastMeeting     []LastMeeting    `mapstructure:"LastMeeting"`
	SeasonSeries    []SeasonSery     `mapstructure:"SeasonSeries"`
	AvailableVideo  []AvailableVideo `mapstructure:"AvailableVideo"`
}

type BoxScoreSummaryV2

type BoxScoreSummaryV2 struct {
	*Client
	GameID string

	Response *Response
}

BoxScoreSummaryV2 wraps request to and response from boxscoresummaryv2 endpoint.

func NewBoxScoreSummaryV2

func NewBoxScoreSummaryV2(id string) *BoxScoreSummaryV2

NewBoxScoreSummaryV2 creates a default BoxScoreSummaryV2 instance.

func (*BoxScoreSummaryV2) Get

func (c *BoxScoreSummaryV2) Get() error

Get sends a GET request to boxscoresummaryv2 endpoint.

type BoxScoreTraditionalResponse

type BoxScoreTraditionalResponse struct {
	PlayerStats           []Stat `mapstructure:"PlayerStats"`
	TeamStats             []Stat `mapstructure:"TeamStats"`
	TeamStarterBenchStats []Stat `mapstructure:"TeamStarterBenchStats"`
}

type BoxScoreTraditionalV2

type BoxScoreTraditionalV2 struct {
	*Client
	GameID      string
	StartRange  string
	EndRange    string
	RangeType   string
	StartPeriod string
	EndPeriod   string

	Response *Response
}

BoxScoreTraditionalV2 wraps request to and response from boxscoretraditionalv2 endpoint.

func NewBoxScoreTraditionalV2

func NewBoxScoreTraditionalV2(id string) *BoxScoreTraditionalV2

NewBoxScoreTraditionalV2 creates a default BoxScoreTraditionalV2 instance.

func (*BoxScoreTraditionalV2) Get

func (c *BoxScoreTraditionalV2) Get() error

Get sends a GET request to boxscoretraditionalv2 endpoint.

type BoxScoreUsageV2

type BoxScoreUsageV2 struct {
	*Client
	GameID      string
	StartRange  string
	EndRange    string
	RangeType   string
	StartPeriod string
	EndPeriod   string

	Response *Response
}

BoxScoreUsageV2 wraps request to and response from boxscoreusagev2 endpoint.

func NewBoxScoreUsageV2

func NewBoxScoreUsageV2(id string) *BoxScoreUsageV2

NewBoxScoreUsageV2 creates a default BoxScoreUsageV2 instance.

func (*BoxScoreUsageV2) Get

func (c *BoxScoreUsageV2) Get() error

Get sends a GET request to boxscoreusagev2 endpoint.

type Client

type Client struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
}

Client contains the base URL to send request to and the HTTP client being used.

func NewDefaultClient

func NewDefaultClient() *Client

NewDefaultClient uses stdlib default HTTP client to make request to default NBA stats endpoint.

func (*Client) Do

func (c *Client) Do(req *http.Request) ([]byte, error)

Do sends request to NBA stats endpoint and unpacks the received response.

type CommonAllPlayers

type CommonAllPlayers struct {
	*Client
	IsOnlyCurrentSeason int
	LeagueID            string
	Season              string

	Response *Response
}

CommonAllPlayers wraps request to and response from commonallplayers endpoint.

func NewCommonAllPlayers

func NewCommonAllPlayers() *CommonAllPlayers

NewCommonAllPlayers creates a default CommonAllPlayers instance.

func (*CommonAllPlayers) Get

func (c *CommonAllPlayers) Get() error

Get sends a GET request to commonallplayers endpoint.

type CommonPlayerInfo

type CommonPlayerInfo struct {
	*Client
	Response *Response
	PlayerID string
	LeagueID string
}

CommonPlayerInfo wraps request to and response from commonplayerinfo endpoint.

func NewCommonPlayerInfo

func NewCommonPlayerInfo(id string) *CommonPlayerInfo

NewCommonPlayerInfo creates a default CommonPlayerInfo instance.

func (*CommonPlayerInfo) Get

func (c *CommonPlayerInfo) Get() error

Get sends a GET request to commonplayerinfo endpoint.

type CommonPlayoffSeries

type CommonPlayoffSeries struct {
	*Client
	LeagueID string
	Season   string
	SeriesID string

	Response *Response
}

CommonPlayoffSeries wraps request to and response from commonplayoffseries endpoint.

func NewCommonPlayoffSeries

func NewCommonPlayoffSeries() *CommonPlayoffSeries

NewCommonPlayoffSeries creates a default CommonPlayoffSeries instance.

func (*CommonPlayoffSeries) Get

func (c *CommonPlayoffSeries) Get() error

Get sends a GET request to commonplayoffseries endpoint.

type CommonTeamRoster

type CommonTeamRoster struct {
	*Client
	TeamID   string
	Season   string
	LeagueID string

	Response *Response
}

CommonTeamRoster wraps request to and response from commonteamroster endpoint.

func NewCommonTeamRoster

func NewCommonTeamRoster(id string) *CommonTeamRoster

NewCommonTeamRoster creates a default CommonTeamRoster instance.

func (*CommonTeamRoster) Get

func (c *CommonTeamRoster) Get() error

Get sends a GET request to commonteamroster endpoint.

type Conference

type Conference string
const (
	East Conference = "East"
	West Conference = "West"
)

type GameHeader

type GameHeader struct {
	ArenaName                     string      `mapstructure:"ARENA_NAME"`
	AwayTvBroadcasterAbbreviation string      `mapstructure:"AWAY_TV_BROADCASTER_ABBREVIATION"`
	Gamecode                      string      `mapstructure:"GAMECODE"`
	GameDateEst                   string      `mapstructure:"GAME_DATE_EST"`
	GameID                        string      `mapstructure:"GAME_ID"`
	GameSequence                  int64       `mapstructure:"GAME_SEQUENCE"`
	GameStatusID                  int64       `mapstructure:"GAME_STATUS_ID"`
	GameStatusText                string      `mapstructure:"GAME_STATUS_TEXT"`
	HomeTeamID                    int64       `mapstructure:"HOME_TEAM_ID"`
	HomeTvBroadcasterAbbreviation string      `mapstructure:"HOME_TV_BROADCASTER_ABBREVIATION"`
	LivePCTime                    string      `mapstructure:"LIVE_PC_TIME"`
	LivePeriod                    int64       `mapstructure:"LIVE_PERIOD"`
	LivePeriodTimeBcast           string      `mapstructure:"LIVE_PERIOD_TIME_BCAST"`
	NatlTvBroadcasterAbbreviation interface{} `mapstructure:"NATL_TV_BROADCASTER_ABBREVIATION"`
	Season                        string      `mapstructure:"SEASON"`
	VisitorTeamID                 int64       `mapstructure:"VISITOR_TEAM_ID"`
	WhStatus                      int64       `mapstructure:"WH_STATUS"`
	WnbaCommissionerFlag          int64       `mapstructure:"WNBA_COMMISSIONER_FLAG"`
}

type GameInfo

type GameInfo struct {
	GameDate   string `mapstructure:"GAME_DATE"`
	Attendance int64  `mapstructure:"ATTENDANCE"`
	GameTime   string `mapstructure:"GAME_TIME"`
}

type GameLog

type GameLog struct {
	SeasonID            int    `json:"SEASON_ID"`
	PlayerID            int    `json:"Player_ID"`
	GameID              int    `json:"Game_ID"`
	GameDate            string `json:"GAME_DATE"`
	Matchup             string `json:"MATCHUP"`
	WL                  string `json:"WL"`
	Min                 int    `json:"MIN"`
	Points              int    `json:"PTS"`
	Assists             int    `json:"AST"`
	Rebounds            int    `json:"REB"`
	Steals              int    `json:"STL"`
	Blocks              int    `json:"BLK"`
	FieldGoalsMade      int    `json:"FGM"`
	FieldGoalsAttempted int    `json:"FGA"`
}

type GameRotation

type GameRotation struct {
	*Client
	GameID   string
	LeagueID string

	Response *Response
}

GameRotation wraps request to and response from gamerotation endpoint.

func NewGameRotation

func NewGameRotation(id string) *GameRotation

NewGameRotation creates a default GameRotation instance.

func (*GameRotation) Get

func (c *GameRotation) Get() error

Get sends a GET request to gamerotation endpoint.

type GameSummary

type GameSummary struct {
	GameDateEst                   string      `mapstructure:"GAME_DATE_EST"`
	GameSequence                  int64       `mapstructure:"GAME_SEQUENCE"`
	GameID                        string      `mapstructure:"GAME_ID"`
	GameStatusID                  int64       `mapstructure:"GAME_STATUS_ID"`
	GameStatusText                string      `mapstructure:"GAME_STATUS_TEXT"`
	Gamecode                      string      `mapstructure:"GAMECODE"`
	HomeTeamID                    int64       `mapstructure:"HOME_TEAM_ID"`
	VisitorTeamID                 int64       `mapstructure:"VISITOR_TEAM_ID"`
	Season                        string      `mapstructure:"SEASON"`
	LivePeriod                    int64       `mapstructure:"LIVE_PERIOD"`
	LivePCTime                    string      `mapstructure:"LIVE_PC_TIME"`
	NatlTvBroadcasterAbbreviation interface{} `mapstructure:"NATL_TV_BROADCASTER_ABBREVIATION"`
	LivePeriodTimeBcast           string      `mapstructure:"LIVE_PERIOD_TIME_BCAST"`
	WhStatus                      int64       `mapstructure:"WH_STATUS"`
}

type InactivePlayer

type InactivePlayer struct {
	PlayerID         int64  `mapstructure:"PLAYER_ID"`
	FirstName        string `mapstructure:"FIRST_NAME"`
	LastName         string `mapstructure:"LAST_NAME"`
	JerseyNum        string `mapstructure:"JERSEY_NUM"`
	TeamID           int64  `mapstructure:"TEAM_ID"`
	TeamCity         string `mapstructure:"TEAM_CITY"`
	TeamName         string `mapstructure:"TEAM_NAME"`
	TeamAbbreviation string `mapstructure:"TEAM_ABBREVIATION"`
}

type LastMeeting

type LastMeeting struct {
	GameID                       string `mapstructure:"GAME_ID"`
	LastGameDateEst              string `mapstructure:"LAST_GAME_DATE_EST"`
	LastGameHomeTeamAbbreviation string `mapstructure:"LAST_GAME_HOME_TEAM_ABBREVIATION"`
	LastGameHomeTeamCity         string `mapstructure:"LAST_GAME_HOME_TEAM_CITY"`
	LastGameHomeTeamID           int64  `mapstructure:"LAST_GAME_HOME_TEAM_ID"`
	LastGameHomeTeamName         string `mapstructure:"LAST_GAME_HOME_TEAM_NAME"`
	LastGameHomeTeamPoints       int64  `mapstructure:"LAST_GAME_HOME_TEAM_POINTS"`
	LastGameID                   string `mapstructure:"LAST_GAME_ID"`
	LastGameVisitorTeamCity      string `mapstructure:"LAST_GAME_VISITOR_TEAM_CITY"`
	LastGameVisitorTeamCity1     string `mapstructure:"LAST_GAME_VISITOR_TEAM_CITY1"`
	LastGameVisitorTeamID        int64  `mapstructure:"LAST_GAME_VISITOR_TEAM_ID"`
	LastGameVisitorTeamName      string `mapstructure:"LAST_GAME_VISITOR_TEAM_NAME"`
	LastGameVisitorTeamPoints    int64  `mapstructure:"LAST_GAME_VISITOR_TEAM_POINTS"`
}

type LeagueStandingsResponse

type LeagueStandingsResponse struct {
	Standings []Standing `mapstructure:"Standings"`
}

type LeagueStandingsV3

type LeagueStandingsV3 struct {
	*Client
	LeagueID   string
	Season     string
	SeasonType params.SeasonType

	Response *Response
}

LeagueStandingsV3 wraps request to and response from leaguestandingsv3 endpoint.

func NewLeagueStandingsV3

func NewLeagueStandingsV3() *LeagueStandingsV3

NewLeagueStandingsV3 creates a default LeagueStandingsV3 instance.

func (*LeagueStandingsV3) Get

func (c *LeagueStandingsV3) Get() error

Get sends a GET request to leaguestandingsv3 endpoint.

type LineScore

type LineScore struct {
	AST              interface{} `mapstructure:"AST"`
	Fg3Pct           interface{} `mapstructure:"FG3_PCT"`
	FgPct            interface{} `mapstructure:"FG_PCT"`
	FtPct            interface{} `mapstructure:"FT_PCT"`
	GameDateEst      string      `mapstructure:"GAME_DATE_EST"`
	GameID           string      `mapstructure:"GAME_ID"`
	GameSequence     int64       `mapstructure:"GAME_SEQUENCE"`
	Pts              int         `mapstructure:"PTS"`
	PtsOt1           interface{} `mapstructure:"PTS_OT1"`
	PtsOt10          interface{} `mapstructure:"PTS_OT10"`
	PtsOt2           interface{} `mapstructure:"PTS_OT2"`
	PtsOt3           interface{} `mapstructure:"PTS_OT3"`
	PtsOt4           interface{} `mapstructure:"PTS_OT4"`
	PtsOt5           interface{} `mapstructure:"PTS_OT5"`
	PtsOt6           interface{} `mapstructure:"PTS_OT6"`
	PtsOt7           interface{} `mapstructure:"PTS_OT7"`
	PtsOt8           interface{} `mapstructure:"PTS_OT8"`
	PtsOt9           interface{} `mapstructure:"PTS_OT9"`
	PtsQtr1          interface{} `mapstructure:"PTS_QTR1"`
	PtsQtr2          interface{} `mapstructure:"PTS_QTR2"`
	PtsQtr3          interface{} `mapstructure:"PTS_QTR3"`
	PtsQtr4          interface{} `mapstructure:"PTS_QTR4"`
	Reb              interface{} `mapstructure:"REB"`
	TeamAbbreviation string      `mapstructure:"TEAM_ABBREVIATION"`
	TeamCityName     string      `mapstructure:"TEAM_CITY_NAME"`
	TeamID           int64       `mapstructure:"TEAM_ID"`
	TeamName         string      `mapstructure:"TEAM_NAME"`
	TeamWINSLosses   string      `mapstructure:"TEAM_WINS_LOSSES"`
	Tov              interface{} `mapstructure:"TOV"`
}

type NewBoxScoreAdvancedResponse

type NewBoxScoreAdvancedResponse struct {
	PlayerStats []AdvStat `mapstructure:"PlayerStats"`
	TeamStats   []AdvStat `mapstructure:"TeamStats"`
}

type Official

type Official struct {
	OfficialID int64  `mapstructure:"OFFICIAL_ID"`
	FirstName  string `mapstructure:"FIRST_NAME"`
	LastName   string `mapstructure:"LAST_NAME"`
	JerseyNum  string `mapstructure:"JERSEY_NUM"`
}

type OtherStat

type OtherStat struct {
	LeagueID         string `mapstructure:"LEAGUE_ID"`
	TeamID           int64  `mapstructure:"TEAM_ID"`
	TeamAbbreviation string `mapstructure:"TEAM_ABBREVIATION"`
	TeamCity         string `mapstructure:"TEAM_CITY"`
	PtsPaint         int64  `mapstructure:"PTS_PAINT"`
	Pts2NdChance     int64  `mapstructure:"PTS_2ND_CHANCE"`
	PtsFb            int64  `mapstructure:"PTS_FB"`
	LargestLead      int64  `mapstructure:"LARGEST_LEAD"`
	LeadChanges      int64  `mapstructure:"LEAD_CHANGES"`
	TimesTied        int64  `mapstructure:"TIMES_TIED"`
	TeamTurnovers    int64  `mapstructure:"TEAM_TURNOVERS"`
	TotalTurnovers   int64  `mapstructure:"TOTAL_TURNOVERS"`
	TeamRebounds     int64  `mapstructure:"TEAM_REBOUNDS"`
	PtsOffTo         int64  `mapstructure:"PTS_OFF_TO"`
}

type PlayByPlayAction

type PlayByPlayAction struct {
	ActionNumber            int       `json:"actionNumber"`
	ActionType              string    `json:"actionType"`
	Clock                   string    `json:"clock"`
	Desc                    string    `json:"description"`
	Edited                  time.Time `json:"edited"`
	IsFieldGoal             int       `json:"isFieldGoal"`
	IsTargetScoreLastPeriod bool      `json:"isTargetScoreLastPeriod"`
	OrderNumber             int       `json:"orderNumber"`
	Period                  int       `json:"period"`
	PeriodType              string    `json:"periodType"`
	PersonId                int       `json:"personId"`
	PersonIdsFilter         []int     `json:"personIdsFilter"`
	PlayerName              string    `json:"playerName"`
	PlayerNameI             string    `json:"playerNameI"`
	Possession              int       `json:"possession"`
	Qualifiers              []string  `json:"qualifiers"`
	ReboundDefensiveTotal   int       `json:"reboundDefensiveTotal"`
	ReboundOffensiveTotal   int       `json:"reboundOffensiveTotal"`
	ReboundTotal            int       `json:"reboundTotal"`
	ScoreAway               string    `json:"scoreAway"`
	ScoreHome               string    `json:"scoreHome"`
	ShotActionNumber        int       `json:"shotActionNumber"`
	Side                    string    `json:"side"`
	SubType                 string    `json:"subType"`
	TeamId                  int       `json:"teamId"`
	TeamTricode             string    `json:"teamTricode"`
	TimeActual              string    `json:"timeActual"`
}

type PlayByPlayGame

type PlayByPlayGame struct {
	GameID  string             `json:"gameId"`
	Actions []PlayByPlayAction `json:"actions"`
}

func (*PlayByPlayGame) SetActions

func (p *PlayByPlayGame) SetActions(actions []PlayByPlayAction)

type PlayByPlayResponse

type PlayByPlayResponse struct {
	Meta any             `json:"-"`
	Game *PlayByPlayGame `json:"game"`
}

type PlayByPlayV2

type PlayByPlayV2 struct {
	*Client
	GameID             string
	PlayByPlayResponse *PlayByPlayResponse
}

PlayByPlayV2 wraps request to and response from playbyplayv2 endpoint.

func NewPlayByPlayV2

func NewPlayByPlayV2(id string) *PlayByPlayV2

NewPlayByPlayV2 creates a default PlayByPlayV2 instance.

func (*PlayByPlayV2) Get

func (c *PlayByPlayV2) Get() error

Get sends a GET request to playbyplayv2 endpoint.

type PlayerGameLog

type PlayerGameLog struct {
	*Client
	Response   *Response
	PlayerID   string
	LeagueID   string
	Season     string
	SeasonType params.SeasonType
	DateFrom   string
	DateTo     string
}

CommonPlayerInfo wraps request to and response from commonplayerinfo endpoint.

func NewPlayerGameLog

func NewPlayerGameLog(id string) *PlayerGameLog

NewCommonPlayerInfo creates a default CommonPlayerInfo instance.

func (*PlayerGameLog) Get

func (c *PlayerGameLog) Get() error

Get sends a GET request to commonplayerinfo endpoint.

type PlayerGameLogResponse

type PlayerGameLogResponse struct {
	GameLog struct {
		Headers []string        `json:"[]"`
		RowSet  [][]interface{} `json:"[]"`
	} `json:"playergamelog"`
}

type Response

type Response struct {
	Resource string `json:"resource"`
	// Parameters map[string]interface{} `json:"parameters"`
	ResultSet  ResultSet   `json:"resultSet"`
	ResultSets []ResultSet `json:"resultSets"`
}

Response represents response from NBA endpoint.

type ResultSet

type ResultSet struct {
	Name    string          `json:"name"`
	Headers []string        `json:"headers"`
	RowSet  [][]interface{} `json:"rowSet"`
}

ResultSet represents relevant data from Response.

type ScoreBoardResponse

type ScoreBoardResponse struct {
	Available              []Available            `mapstructure:"Available"`
	EastConfStandingsByDay []StConfStandingsByDay `mapstructure:"EastConfStandingsByDay"`
	GameHeader             []GameHeader           `mapstructure:"GameHeader"`
	LastMeeting            []LastMeeting          `mapstructure:"LastMeeting"`
	LineScore              []LineScore            `mapstructure:"LineScore"`
	SeriesStandings        interface{}            `mapstructure:"SeriesStandings"`
	TeamLeaders            interface{}            `mapstructure:"TeamLeaders"`
	TicketLinks            interface{}            `mapstructure:"TicketLinks"`
	WestConfStandingsByDay []StConfStandingsByDay `mapstructure:"WestConfStandingsByDay"`
	WinProbability         interface{}            `mapstructure:"WinProbability"`
}

type ScoreBoardV2

type ScoreBoardV2 struct {
	*Client
	DayOffset int
	GameDate  string
	LeagueID  string

	Response *Response
}

ScoreBoardV2 wraps request to and response from scoreboardv2 endpoint.

func NewScoreBoardV2

func NewScoreBoardV2(date time.Time) *ScoreBoardV2

NewScoreBoardV2 creates a default ScoreBoardV2 instance.

func (*ScoreBoardV2) Get

func (c *ScoreBoardV2) Get() error

Get sends a GET request to scoreboardv2 endpoint.

type SeasonSery

type SeasonSery struct {
	GameID string `mapstructure:"GAME_ID"`
}

type StConfStandingsByDay

type StConfStandingsByDay struct {
	Conference    Conference    `mapstructure:"CONFERENCE"`
	G             int64         `mapstructure:"G"`
	HomeRecord    string        `mapstructure:"HOME_RECORD"`
	L             int64         `mapstructure:"L"`
	LeagueID      string        `mapstructure:"LEAGUE_ID"`
	RoadRecord    string        `mapstructure:"ROAD_RECORD"`
	SeasonID      string        `mapstructure:"SEASON_ID"`
	Standingsdate Standingsdate `mapstructure:"STANDINGSDATE"`
	Team          string        `mapstructure:"TEAM"`
	TeamID        int64         `mapstructure:"TEAM_ID"`
	W             int64         `mapstructure:"W"`
	WPct          float64       `mapstructure:"W_PCT"`
}

type Standing

type Standing struct {
	LeagueID                string      `mapstructure:"LeagueID"`
	SeasonID                string      `mapstructure:"SeasonID"`
	TeamID                  int64       `mapstructure:"TeamID"`
	TeamCity                string      `mapstructure:"TeamCity"`
	TeamName                string      `mapstructure:"TeamName"`
	TeamSlug                string      `mapstructure:"TeamSlug"`
	Conference              Conference  `mapstructure:"Conference"`
	ConferenceRecord        string      `mapstructure:"ConferenceRecord"`
	PlayoffRank             int64       `mapstructure:"PlayoffRank"`
	ClinchIndicator         string      `mapstructure:"ClinchIndicator"`
	Division                string      `mapstructure:"Division"`
	DivisionRecord          string      `mapstructure:"DivisionRecord"`
	DivisionRank            int64       `mapstructure:"DivisionRank"`
	WINS                    int64       `mapstructure:"WINS"`
	Losses                  int64       `mapstructure:"LOSSES"`
	WinPCT                  float64     `mapstructure:"WinPCT"`
	LeagueRank              int64       `mapstructure:"LeagueRank"`
	Record                  string      `mapstructure:"Record"`
	Home                    string      `mapstructure:"HOME"`
	Road                    string      `mapstructure:"ROAD"`
	L10                     string      `mapstructure:"L10"`
	Last10Home              string      `mapstructure:"Last10Home"`
	Last10Road              string      `mapstructure:"Last10Road"`
	Ot                      string      `mapstructure:"OT"`
	ThreePTSOrLess          string      `mapstructure:"ThreePTSOrLess"`
	TenPTSOrMore            string      `mapstructure:"TenPTSOrMore"`
	LongHomeStreak          int64       `mapstructure:"LongHomeStreak"`
	StrLongHomeStreak       string      `mapstructure:"strLongHomeStreak"`
	LongRoadStreak          int64       `mapstructure:"LongRoadStreak"`
	StrLongRoadStreak       string      `mapstructure:"strLongRoadStreak"`
	LongWinStreak           int64       `mapstructure:"LongWinStreak"`
	LongLossStreak          int64       `mapstructure:"LongLossStreak"`
	CurrentHomeStreak       int64       `mapstructure:"CurrentHomeStreak"`
	StrCurrentHomeStreak    string      `mapstructure:"strCurrentHomeStreak"`
	CurrentRoadStreak       int64       `mapstructure:"CurrentRoadStreak"`
	StrCurrentRoadStreak    string      `mapstructure:"strCurrentRoadStreak"`
	CurrentStreak           int64       `mapstructure:"CurrentStreak"`
	StrCurrentStreak        string      `mapstructure:"strCurrentStreak"`
	ConferenceGamesBack     float64     `mapstructure:"ConferenceGamesBack"`
	DivisionGamesBack       float64     `mapstructure:"DivisionGamesBack"`
	ClinchedConferenceTitle int64       `mapstructure:"ClinchedConferenceTitle"`
	ClinchedDivisionTitle   int64       `mapstructure:"ClinchedDivisionTitle"`
	ClinchedPlayoffBirth    int64       `mapstructure:"ClinchedPlayoffBirth"`
	ClinchedPlayIn          int64       `mapstructure:"ClinchedPlayIn"`
	EliminatedConference    int64       `mapstructure:"EliminatedConference"`
	EliminatedDivision      int64       `mapstructure:"EliminatedDivision"`
	AheadAtHalf             string      `mapstructure:"AheadAtHalf"`
	BehindAtHalf            string      `mapstructure:"BehindAtHalf"`
	TiedAtHalf              string      `mapstructure:"TiedAtHalf"`
	AheadAtThird            string      `mapstructure:"AheadAtThird"`
	BehindAtThird           string      `mapstructure:"BehindAtThird"`
	TiedAtThird             string      `mapstructure:"TiedAtThird"`
	Score100PTS             string      `mapstructure:"Score100PTS"`
	OppScore100PTS          string      `mapstructure:"OppScore100PTS"`
	OppOver500              string      `mapstructure:"OppOver500"`
	LeadInFGPCT             string      `mapstructure:"LeadInFGPCT"`
	LeadInReb               string      `mapstructure:"LeadInReb"`
	FewerTurnovers          string      `mapstructure:"FewerTurnovers"`
	PointsPG                float64     `mapstructure:"PointsPG"`
	OppPointsPG             float64     `mapstructure:"OppPointsPG"`
	DiffPointsPG            float64     `mapstructure:"DiffPointsPG"`
	VsEast                  string      `mapstructure:"vsEast"`
	VsAtlantic              string      `mapstructure:"vsAtlantic"`
	VsCentral               string      `mapstructure:"vsCentral"`
	VsSoutheast             string      `mapstructure:"vsSoutheast"`
	VsWest                  string      `mapstructure:"vsWest"`
	VsNorthwest             string      `mapstructure:"vsNorthwest"`
	VsPacific               string      `mapstructure:"vsPacific"`
	VsSouthwest             string      `mapstructure:"vsSouthwest"`
	Jan                     interface{} `mapstructure:"Jan"`
	Feb                     interface{} `mapstructure:"Feb"`
	Mar                     interface{} `mapstructure:"Mar"`
	APR                     interface{} `mapstructure:"Apr"`
	May                     interface{} `mapstructure:"May"`
	Jun                     interface{} `mapstructure:"Jun"`
	Jul                     interface{} `mapstructure:"Jul"`
	Aug                     interface{} `mapstructure:"Aug"`
	Sep                     interface{} `mapstructure:"Sep"`
	Oct                     string      `mapstructure:"Oct"`
	Nov                     string      `mapstructure:"Nov"`
	DEC                     string      `mapstructure:"Dec"`
	Score80_Plus            string      `mapstructure:"Score_80_Plus"`
	OppScore80_Plus         string      `mapstructure:"Opp_Score_80_Plus"`
	ScoreBelow80            string      `mapstructure:"Score_Below_80"`
	OppScoreBelow80         string      `mapstructure:"Opp_Score_Below_80"`
	TotalPoints             int64       `mapstructure:"TotalPoints"`
	OppTotalPoints          int64       `mapstructure:"OppTotalPoints"`
	DiffTotalPoints         int64       `mapstructure:"DiffTotalPoints"`
}

type Standingsdate

type Standingsdate string
const (
	The11062022 Standingsdate = "11/06/2022"
)

type Stat

type Stat struct {
	GameID           string  `mapstructure:"GAME_ID"`
	TeamID           int64   `mapstructure:"TEAM_ID"`
	TeamAbbreviation string  `mapstructure:"TEAM_ABBREVIATION"`
	TeamCity         string  `mapstructure:"TEAM_CITY"`
	PlayerID         int64   `mapstructure:"PLAYER_ID,omitempty"`
	PlayerName       string  `mapstructure:"PLAYER_NAME,omitempty"`
	Nickname         string  `mapstructure:"NICKNAME,omitempty"`
	StartPosition    string  `mapstructure:"START_POSITION,omitempty"`
	Comment          string  `mapstructure:"COMMENT,omitempty"`
	Min              string  `mapstructure:"MIN"`
	Fgm              int64   `mapstructure:"FGM"`
	Fga              int64   `mapstructure:"FGA"`
	FgPct            float64 `mapstructure:"FG_PCT"`
	Fg3M             int64   `mapstructure:"FG3M"`
	Fg3A             int64   `mapstructure:"FG3A"`
	Fg3Pct           float64 `mapstructure:"FG3_PCT"`
	Ftm              int64   `mapstructure:"FTM"`
	Fta              int64   `mapstructure:"FTA"`
	FtPct            float64 `mapstructure:"FT_PCT"`
	Oreb             int64   `mapstructure:"OREB"`
	Dreb             int64   `mapstructure:"DREB"`
	Reb              int64   `mapstructure:"REB"`
	AST              int64   `mapstructure:"AST"`
	Stl              int64   `mapstructure:"STL"`
	Blk              int64   `mapstructure:"BLK"`
	To               int64   `mapstructure:"TO"`
	Pf               int64   `mapstructure:"PF"`
	Pts              int64   `mapstructure:"PTS"`
	PlusMinus        int64   `mapstructure:"PLUS_MINUS"`
	TeamName         string  `mapstructure:"TEAM_NAME,omitempty"`
	StartersBench    string  `mapstructure:"STARTERS_BENCH,omitempty"`
}

type TeamGameLog

type TeamGameLog struct {
	*Client
	LeagueID   string
	TeamID     string
	Season     string
	SeasonType params.SeasonType
	DateFrom   string
	DateTo     string

	Response *Response
}

TeamGameLog wraps request to and response from teamgamelog endpoint.

func NewTeamGameLog

func NewTeamGameLog(id string) *TeamGameLog

NewTeamGameLog creates a default TeamGameLog instance.

func (*TeamGameLog) Get

func (c *TeamGameLog) Get() error

Get sends a GET request to teamgamelog endpoint.

type TeamGameLogs

type TeamGameLogs struct {
	*Client
	LeagueID       string
	TeamID         string
	OppTeamID      string
	Season         string
	SeasonSegment  params.SeasonSegment
	SeasonType     params.SeasonType
	DateFrom       string
	DateTo         string
	GameSegment    params.GameSegment
	LastNGames     string
	Location       string
	MeasureType    string
	Month          string
	Outcome        params.Outcome
	PORound        string
	PerMode        params.PerMode
	Period         string
	PlayerID       string
	ShotClockRange params.ShotClockRange
	VsConference   params.Conference
	VsDivision     params.Division

	Response *Response
}

TeamGameLogs wraps request to and response from teamgamelogs endpoint.

func NewTeamGameLogs

func NewTeamGameLogs() *TeamGameLogs

NewTeamGameLogs creates a default TeamGameLogs instance.

func (*TeamGameLogs) Get

func (c *TeamGameLogs) Get() error

Get sends a GET request to teamgamelogs endpoint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳