-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.go
34 lines (28 loc) · 844 Bytes
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package fixtures
import (
"github.com/syurchen93/api-football-client/common"
)
type Event struct {
Time Time `json:"time"`
Team Team `json:"team"`
Player Player `json:"player"`
Assist Player `json:"assist"`
Type common.EventType `json:"type"`
Detail common.EventTypeDetails `json:"detail"`
Comments string `json:"comments"`
}
type Time struct {
Elapsed int `json:"elapsed"`
Extra int `json:"extra"`
}
type Player struct {
ID int `json:"id"`
Name string `json:"name"`
Photo string `mapstructure:"omitempty" json:"photo,omitempty"`
}
func (e Event) IsPenaltyShootout() bool {
return e.Comments == common.CommentPenaltyShootout
}
func (e Event) IsFoul() bool {
return e.Comments == common.CommentFoul
}