-
Notifications
You must be signed in to change notification settings - Fork 0
/
pvp_bracket.go
91 lines (87 loc) · 2.1 KB
/
pvp_bracket.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
package wowapi
import (
"encoding/json"
"fmt"
)
type PvpBracket struct {
SeasonRoundStatistics struct {
Won float64 `json:"won"`
Lost float64 `json:"lost"`
Played float64 `json:"played"`
} `json:"season_round_statistics"`
WeeklyRoundStatistics struct {
Lost float64 `json:"lost"`
Played float64 `json:"played"`
Won float64 `json:"won"`
} `json:"weekly_round_statistics"`
Links struct {
Self struct {
Href string `json:"href"`
} `json:"self"`
} `json:"_links"`
Faction struct {
Type string `json:"type"`
Name string `json:"name"`
} `json:"faction"`
Bracket struct {
Type string `json:"type"`
Id float64 `json:"id"`
} `json:"bracket"`
Season struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Id float64 `json:"id"`
} `json:"season"`
Tier struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Id float64 `json:"id"`
} `json:"tier"`
WeeklyMatchStatistics struct {
Won float64 `json:"won"`
Lost float64 `json:"lost"`
Played float64 `json:"played"`
} `json:"weekly_match_statistics"`
Character struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
Realm struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
Slug string `json:"slug"`
} `json:"realm"`
} `json:"character"`
Rating float64 `json:"rating"`
SeasonMatchStatistics struct {
Played float64 `json:"played"`
Won float64 `json:"won"`
Lost float64 `json:"lost"`
} `json:"season_match_statistics"`
Specialization struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
} `json:"specialization"`
}
func (req RequestFunc) CharacterPvpBracket(realm string, name string, pvpbracket string) (s PvpBracket, err error) {
url := fmt.Sprintf("/profile/wow/character/%s/%s/pvp-bracket/%s", realm, name, pvpbracket)
body, err := req(url)
if err != nil {
return
}
err = json.Unmarshal(body, &s)
if err != nil {
return
}
return
}