Some API Changes
This commit is contained in:
parent
af7437c238
commit
5e662ec995
6
aoc.go
6
aoc.go
@ -103,14 +103,14 @@ func (a *AoC) fetchLeaderboard(year int) (*Leaderboard, error) {
|
||||
}
|
||||
|
||||
type Leaderboard struct {
|
||||
OwnerID string `json:"owner_id"`
|
||||
OwnerID int `json:"owner_id"`
|
||||
Event string `json:"event"`
|
||||
Members map[string]Member `json:"members"`
|
||||
LastFetch time.Time
|
||||
}
|
||||
|
||||
type Member struct {
|
||||
ID string `json:"id"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Stars int `json:"stars"`
|
||||
RawStarTs string `json:"last_star_ts"`
|
||||
@ -151,7 +151,7 @@ func (m *Member) UnmarshalJSON(data []byte) error {
|
||||
if err = json.Unmarshal(data, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
m.ID = v["id"].(string)
|
||||
m.ID = int(v["id"].(float64))
|
||||
m.Name = v["name"].(string)
|
||||
m.Stars = int(v["stars"].(float64))
|
||||
|
||||
|
@ -16,7 +16,7 @@ func main() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
l, err := a.GetLeaderboard(2020)
|
||||
l, err := a.GetLeaderboard(2021)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user