espnboard

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const DateFormat = "20060102"

DateFormat for getting games

Variables

This section is empty.

Functions

func TimeToGameDateStr

func TimeToGameDateStr(t time.Time) string

TimeToGameDateStr converts a time.Time into the date string format the API expects

Types

type Conference

type Conference struct {
	Name         string
	Abbreviation string
}

Conference ...

type ESPNBoard

type ESPNBoard struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ESPNBoard ...

func New

func New(ctx context.Context, leaguer Leaguer, logger *zap.Logger, r rankSetter, rec rankSetter, opts ...Option) (*ESPNBoard, error)

New ...

func NewEPL

func NewEPL(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewEPL ...

func NewMLB

func NewMLB(ctx context.Context, logger *zap.Logger, opts ...Option) (*ESPNBoard, error)

NewMLB ...

func NewMLS

func NewMLS(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewMLS ...

func NewNBA

func NewNBA(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewNBA ...

func NewNCAAF

func NewNCAAF(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewNCAAF ...

func NewNCAAMensBasketball

func NewNCAAMensBasketball(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewNCAAMensBasketball ...

func NewNFL

func NewNFL(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewNFL ...

func NewNHL

func NewNHL(ctx context.Context, logger *zap.Logger) (*ESPNBoard, error)

NewNHL ...

func (*ESPNBoard) CacheClear

func (e *ESPNBoard) CacheClear(ctx context.Context)

CacheClear ...

func (*ESPNBoard) DateStr

func (e *ESPNBoard) DateStr(d time.Time) string

DateStr ...

func (*ESPNBoard) GetGames

func (e *ESPNBoard) GetGames(ctx context.Context, dateStr string) ([]*Game, error)

GetGames gets the games for a given date

func (e *ESPNBoard) GetLogo(ctx context.Context, logoKey string, logoConf *logo.Config, bounds image.Rectangle) (*logo.Logo, error)

GetLogo ...

func (*ESPNBoard) GetLogoSource

func (e *ESPNBoard) GetLogoSource(ctx context.Context, teamID string, logoURLSearch string) (image.Image, error)

GetLogoSource ...

func (*ESPNBoard) GetScheduledGames

func (e *ESPNBoard) GetScheduledGames(ctx context.Context, dates []time.Time) ([]sportboard.Game, error)

GetScheduledGames ...

func (*ESPNBoard) GetTeams

func (e *ESPNBoard) GetTeams(ctx context.Context) ([]sportboard.Team, error)

GetTeams ...

func (*ESPNBoard) GetWatchTeams

func (e *ESPNBoard) GetWatchTeams(teams []string, season string) []string

GetWatchTeams returns a list of team ID's

func (*ESPNBoard) HTTPPathPrefix

func (e *ESPNBoard) HTTPPathPrefix() string

HTTPPathPrefix ...

func (*ESPNBoard) League

func (e *ESPNBoard) League() string

League ...

func (*ESPNBoard) TeamFromID

func (e *ESPNBoard) TeamFromID(ctx context.Context, id string) (sportboard.Team, error)

TeamFromID ...

func (*ESPNBoard) TeamRank

func (e *ESPNBoard) TeamRank(ctx context.Context, team sportboard.Team, season string) string

TeamRank ...

func (*ESPNBoard) TeamRecord

func (e *ESPNBoard) TeamRecord(ctx context.Context, team sportboard.Team, season string) string

TeamRecord ...

func (*ESPNBoard) TeamsInConference

func (e *ESPNBoard) TeamsInConference(conference string) []*Team

TeamsInConference ...

func (*ESPNBoard) UpdateGames

func (e *ESPNBoard) UpdateGames(ctx context.Context, dateStr string) error

UpdateGames ...

type Game

type Game struct {
	ID       string
	Home     *Team
	Away     *Team
	GameTime time.Time

	Situation *baseballSituation
	// contains filtered or unexported fields
}

Game ...

func (*Game) AwayAbbrev

func (g *Game) AwayAbbrev() string

func (*Game) AwayColor

func (g *Game) AwayColor() (*color.RGBA, *color.RGBA, error)

func (*Game) AwayTeam

func (g *Game) AwayTeam() (sportboard.Team, error)

AwayTeam ...

func (*Game) GetAwayScore

func (g *Game) GetAwayScore(ctx context.Context) (int, error)

func (*Game) GetClock

func (g *Game) GetClock() (string, error)

GetClock ...

func (*Game) GetCount

func (g *Game) GetCount(ctx context.Context) (string, error)

func (*Game) GetHomeScore

func (g *Game) GetHomeScore(ctx context.Context) (int, error)

func (*Game) GetID

func (g *Game) GetID() int

GetID ...

func (*Game) GetInningState

func (g *Game) GetInningState(ctx context.Context) (*mlblive.InningState, error)
func (g *Game) GetLink() (string, error)

GetLink ...

func (*Game) GetOdds

func (g *Game) GetOdds() (string, string, error)

GetOdds ...

func (*Game) GetQuarter

func (g *Game) GetQuarter() (string, error)

GetQuarter ...

func (*Game) GetRunners

func (g *Game) GetRunners(ctx context.Context) (*mlblive.Runners, error)

func (*Game) GetStartTime

func (g *Game) GetStartTime(ctx context.Context) (time.Time, error)

GetStartTime ...

func (*Game) GetUpdate

func (g *Game) GetUpdate(ctx context.Context) (sportboard.Game, error)

GetUpdate ...

func (*Game) HomeAbbrev

func (g *Game) HomeAbbrev() string

func (*Game) HomeColor

func (g *Game) HomeColor() (*color.RGBA, *color.RGBA, error)

func (*Game) HomeTeam

func (g *Game) HomeTeam() (sportboard.Team, error)

HomeTeam ...

func (*Game) IsComplete

func (g *Game) IsComplete() (bool, error)

IsComplete ...

func (*Game) IsLive

func (g *Game) IsLive() (bool, error)

IsLive ...

func (*Game) IsPostponed

func (g *Game) IsPostponed() (bool, error)

IsPostponed ...

type Headlines

type Headlines struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Headlines ...

func NewHeadlines

func NewHeadlines(leaguer Leaguer, logger *zap.Logger) *Headlines

NewHeadlines ...

func (h *Headlines) GetLogo(ctx context.Context) (image.Image, error)

GetLogo ...

func (*Headlines) GetText

func (h *Headlines) GetText(ctx context.Context) ([]string, error)

GetText ...

func (*Headlines) HTTPPathPrefix

func (h *Headlines) HTTPPathPrefix() string

HTTPPathPrefix ...

type Leaguer

type Leaguer interface {
	League() string
	APIPath() string
	TeamEndpoints() []string
	HTTPPathPrefix() string
	HeadlinePath() string
}

Leaguer ...

func GetLeaguer

func GetLeaguer(league string) (Leaguer, error)

GetLeaguer ...

type Logo struct {
	Href  string `json:"href"`
	Width int    `json:"width"`
	Heigh int    `json:"height"`
}

Logo ...

type Odds

type Odds struct {
	Provider *struct {
		ID       string `json:"id"`
		Name     string `json:"name"`
		Priority int    `json:"priority"`
	} `json:"provider"`
	Details   string  `json:"details"`
	OverUnder float64 `json:"overUnder"`
}

Odds represents a game's betting odds

type Option

type Option func(e *ESPNBoard) error

func WithMockData

func WithMockData(mockSchedule []byte, mockLiveGames map[string][]byte) Option

type Team

type Team struct {
	ID             string  `json:"id"`
	Name           string  `json:"name"`
	DisplayName    string  `json:"displayName"`
	Abbreviation   string  `json:"abbreviation"`
	Color          string  `json:"color"`
	AlternateColor string  `json:"alternateColor"`
	Logos          []*Logo `json:"logos"`
	Points         string  `json:"score"`
	LogoURL        string  `json:"logo"`
	Conference     *Conference
	IsHome         bool

	sync.Mutex
	// contains filtered or unexported fields
}

Team implements sportboard.Team

func (*Team) ConferenceName

func (t *Team) ConferenceName() string

ConferenceName ...

func (*Team) GetAbbreviation

func (t *Team) GetAbbreviation() string

GetAbbreviation ...

func (*Team) GetDisplayName

func (t *Team) GetDisplayName() string

GetDisplayName ...

func (*Team) GetID

func (t *Team) GetID() string

GetID ...

func (*Team) GetName

func (t *Team) GetName() string

GetName ...

func (*Team) Score

func (t *Team) Score() int

Score ...

Jump to

Keyboard shortcuts

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