-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclubs.go
43 lines (35 loc) · 983 Bytes
/
clubs.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
package chessdotcomgo
import (
"net/http"
"github.com/ATTron/chessdotcom-go/util"
)
// GetClub - Returns details about a club
func GetClub(clubID string) string {
reqURL := util.Join(util.CLUB_URL, clubID)
resp, err := http.Get(reqURL)
util.Check(err)
defer resp.Body.Close()
returnResp, err := processRespJSON(resp)
util.Check(err)
return returnResp
}
// GetClubMembers - Returns details a specific club members
func GetClubMembers(clubID string) string {
reqURL := util.Join(util.CLUB_URL, clubID, "/members")
resp, err := http.Get(reqURL)
util.Check(err)
defer resp.Body.Close()
returnResp, err := processRespJSON(resp)
util.Check(err)
return returnResp
}
// GetClubMatches - Returns club match details
func GetClubMatches(clubID string) string {
reqURL := util.Join(util.CLUB_URL, clubID, "/matches")
resp, err := http.Get(reqURL)
util.Check(err)
defer resp.Body.Close()
returnResp, err := processRespJSON(resp)
util.Check(err)
return returnResp
}