-
Notifications
You must be signed in to change notification settings - Fork 2
/
team.go
126 lines (120 loc) · 4.89 KB
/
team.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package owl
import (
"fmt"
"net/http"
)
type TeamResponse struct {
Data struct {
ID int `json:"id"`
DivisionID int `json:"divisionId"`
Handle string `json:"handle"`
Name string `json:"name"`
AbbreviatedName string `json:"abbreviatedName"`
Logo struct {
Main struct {
Svg string `json:"svg"`
Png string `json:"png"`
} `json:"main"`
MainName struct {
Svg string `json:"svg"`
Png string `json:"png"`
} `json:"mainName"`
} `json:"logo"`
HasFallback bool `json:"hasFallback"`
Location string `json:"location"`
Players []struct {
ID int `json:"id"`
Handle string `json:"handle"`
Name string `json:"name"`
FullName string `json:"fullName"`
Role string `json:"role"`
Accounts []struct {
ID int `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
} `json:"accounts"`
Number int `json:"number"`
Headshot string `json:"headshot"`
HomeLocation string `json:"homeLocation,omitempty"`
} `json:"players"`
Colors struct {
Primary struct {
Color string `json:"color"`
Opacity int `json:"opacity"`
} `json:"primary"`
Secondary struct {
Color string `json:"color"`
Opacity int `json:"opacity"`
} `json:"secondary"`
Tertiary struct {
Color string `json:"color"`
Opacity int `json:"opacity"`
} `json:"tertiary"`
} `json:"colors"`
Accounts []struct {
ID int `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
} `json:"accounts"`
Website string `json:"website"`
Placement int `json:"placement"`
Advantage int `json:"advantage"`
Records struct {
MatchWin int `json:"matchWin"`
MatchLoss int `json:"matchLoss"`
MatchDraw int `json:"matchDraw"`
MatchBye int `json:"matchBye"`
GameWin int `json:"gameWin"`
GameLoss int `json:"gameLoss"`
GameTie int `json:"gameTie"`
GamePointsFor int `json:"gamePointsFor"`
GamePointsAgainst int `json:"gamePointsAgainst"`
} `json:"records"`
} `json:"data"`
Meta struct {
Strings struct {
OwlTeamHeaderAtlantic string `json:"owl.team.header.atlantic"`
OwlTeamHeaderPacific string `json:"owl.team.header.pacific"`
OwlTeamViewAll string `json:"owl.team.view-all"`
OwlTeamsRecentMatchVods string `json:"owl.teams.recent-match-vods"`
OwlTeamHeaderSocial string `json:"owl.team.header.social"`
OwlTeamHeaderW string `json:"owl.team.header.w"`
OwlTeamHeaderL string `json:"owl.team.header.l"`
OwlStandingsHeaderAltDivision string `json:"owl.standings.header.alt.division"`
OwlTeamLeagueStanding string `json:"owl.team.league-standing"`
OwlTeamLocation string `json:"owl.team.location"`
OwcContentModulesRoundRobinMatchRecord string `json:"owc.content-modules.round-robin.match-record"`
OwlTeamsRosterTeamWebsite string `json:"owl.teams.roster.team-website"`
OwlTeamUpcomingMatches string `json:"owl.team.upcoming-matches"`
OwlMatchesGameRoster string `json:"owl.matches.game.roster"`
OwlContentModulesRecentNewsTitle string `json:"owl.content-modules.recent-news.title"`
OwlPlayersRolesOffense string `json:"owl.players.roles.offense"`
OwlPlayersRolesDefense string `json:"owl.players.roles.defense"`
OwlPlayersRolesTank string `json:"owl.players.roles.tank"`
OwlPlayersRolesSupport string `json:"owl.players.roles.support"`
OwlPlayersRolesFlex string `json:"owl.players.roles.flex"`
OwlScheduleToday string `json:"owl.schedule.today"`
OwlScheduleMatchDetails string `json:"owl.schedule.match-details"`
OwlLabelsNews string `json:"owl.labels.news"`
OwlLabelsFeature string `json:"owl.labels.feature"`
OwlLabelsAnnouncement string `json:"owl.labels.announcement"`
OwlLabelsTraining string `json:"owl.labels.training"`
OwlLabelsPathToPro string `json:"owl.labels.path-to-pro"`
OwlLabelsHighlight string `json:"owl.labels.highlight"`
OwlLabelsAnalysis string `json:"owl.labels.analysis"`
} `json:"strings"`
} `json:"meta"`
}
// GetTeam gets a team from the OWL API
// Endpoint: GET /teams/:id
func (c *Client) GetTeam(teamID string) (*TeamResponse, error) {
t := &TeamResponse{}
req, err := http.NewRequest("GET", fmt.Sprintf("%s/v2/teams/%s", c.baseURL, teamID), nil)
if err != nil {
return t, err
}
if err = c.sendRequest(req, t); err != nil {
return t, err
}
return t, nil
}