livescore

package
v0.0.0-...-ec10a6c Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeGoal             = 36
	EventTypeFoulPenaltyGoal  = 37
	EventTypeOvertimeGoal     = 47
	EventTypeYellowCard       = 43
	EventTypeRedCard          = 44
	EventTypeDoubleYellowCard = 45
	EventTypePenaltyGoal      = 41
	EventTypePenaltyMissed    = 40
)

Variables

View Source
var (
	ErrMatchAlreadyFollowed = errors.New("match already followed")
	ErrMatchHasFinished     = errors.New("match has finished")
	ErrListenerNotFound     = errors.New("listener not found")
)

errors

Functions

func GetTeamImgURL

func GetTeamImgURL(id string) string

func UnfollowMatch

func UnfollowMatch(id string)

Types

type Event

type Event struct {
	Score
	PlayerName                string
	Minute, ExtraMinute, Half int
	Type                      EventType
	Team                      *TeamInfo
}

type EventType

type EventType int

type ListenerFn

type ListenerFn func(*LiveMatch, error)

type LiveMatch

type LiveMatch struct {
	MatchID      string
	CurrentData  *MatchInfo
	PreviousData *MatchInfo
	Listeners    map[string]ListenerFn
}

func GetLiveMatch

func GetLiveMatch(id string) (*LiveMatch, error)

func (*LiveMatch) AddListener

func (liveMatch *LiveMatch) AddListener(id string, listener ListenerFn)

func (*LiveMatch) RemoveListener

func (liveMatch *LiveMatch) RemoveListener(id string) error

type MatchInfo

type MatchInfo struct {
	Score
	T1, T2                            *TeamInfo
	ID                                string
	CupName, StadiumName, StadiumCity string
	Time                              string // FIXME: time as string? NO!
	Events                            []*Event
}

func FetchMatchInfo

func FetchMatchInfo(matchID string) (*MatchInfo, error)

#nosec GG107

func FetchMatchInfoByTeamName

func FetchMatchInfoByTeamName(teamName string) (*MatchInfo, error)

func ListLives

func ListLives() ([]*MatchInfo, error)

func (*MatchInfo) GetBannerURL

func (m *MatchInfo) GetBannerURL() string

type Score

type Score struct {
	T1Score, T2Score int
}

type TeamInfo

type TeamInfo struct {
	Name, ImgURL, ImgID string
}

Jump to

Keyboard shortcuts

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