boxscore

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 7 Imported by: 0

README

Boxscore

Go client to fetch NBA player info and statistics from https://data.nba.net

Usage

Installation
go get github.com/Funshinho/boxscore/v1
Importing
 import "github.com/Funshinho/boxscore/v1"
Get boxscores
boxscores := boxscore.GetBoxscores("20220101")

Documentation

Index

Constants

View Source
const (
	Forward Position = "F"
	Center           = "C"
	Guard            = "G"
)
View Source
const NBA_DATA_ENDPOINT = "https://data.nba.net/data/10s/prod/v1"

Variables

This section is empty.

Functions

func GetBoxscoreData

func GetBoxscoreData(date string, gameId string) map[string]interface{}

GetBoxscoreData returns the boxscore from a given date and game identifier

func GetMockServer

func GetMockServer(t *testing.T) *httptest.Server

GetMockServer initializes the mock responses when calling data api

func GetScoreboardData

func GetScoreboardData(date string) map[string]interface{}

GetScoreboardData returns the scoreboard from a given date

Types

type Boxscore

type Boxscore struct {
	HomeTeam   string
	VistorTeam string
	StatsList  []Stats
}

Boxscore represents the boxscore of a game

func GetBoxscore

func GetBoxscore(date string, homeTeam string, visitorTeam string) Boxscore

GetBoxscore returns the boxscore of a game between two teams that was played from a given date

func GetBoxscores

func GetBoxscores(date string) []Boxscore

GetBoxscores returns the list of boxscores that was played from a given date

type Game

type Game struct {
	ID         string
	HomeTeam   string
	VistorTeam string
}

Game represents the teams that were against

func GetGames

func GetGames(date string) []Game

GetGames returns the list of games that was played from a given date

type Player

type Player struct {
	ID        string
	TeamID    string
	FirstName string
	LastName  string
	Position  Position
}

Player represents the player information

type Position

type Position string

type Stats

type Stats struct {
	PlayerID  string
	FirstName string
	LastName  string
	TeamID    string
	Points    int
	Rebounds  int
	Assists   int
	Blocks    int
	Steals    int
	Turnovers int
	Fouls     int
	FGM       int // Field goal made
	FGA       int // Field goal attempted
	TPM       int // Three points made
	TPA       int // Three points attempted
	FTM       int // Free throw made
	FTA       int // Free throw attempted
}

Stats represents the statistics of a player

Jump to

Keyboard shortcuts

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