Some API Changes

This commit is contained in:
Brian Buller 2022-12-01 07:02:27 -06:00
parent af7437c238
commit 5e662ec995
3 changed files with 4 additions and 4 deletions

6
aoc.go
View File

@ -103,14 +103,14 @@ func (a *AoC) fetchLeaderboard(year int) (*Leaderboard, error) {
} }
type Leaderboard struct { type Leaderboard struct {
OwnerID string `json:"owner_id"` OwnerID int `json:"owner_id"`
Event string `json:"event"` Event string `json:"event"`
Members map[string]Member `json:"members"` Members map[string]Member `json:"members"`
LastFetch time.Time LastFetch time.Time
} }
type Member struct { type Member struct {
ID string `json:"id"` ID int `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Stars int `json:"stars"` Stars int `json:"stars"`
RawStarTs string `json:"last_star_ts"` 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 { if err = json.Unmarshal(data, &v); err != nil {
return err return err
} }
m.ID = v["id"].(string) m.ID = int(v["id"].(float64))
m.Name = v["name"].(string) m.Name = v["name"].(string)
m.Stars = int(v["stars"].(float64)) m.Stars = int(v["stars"].(float64))

BIN
cmd/cmd

Binary file not shown.

View File

@ -16,7 +16,7 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
l, err := a.GetLeaderboard(2020) l, err := a.GetLeaderboard(2021)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
os.Exit(1) os.Exit(1)