From 4e224b8f17f18addfd4fdaf637500ea121ae9dc5 Mon Sep 17 00:00:00 2001 From: FuzzyStatic Date: Fri, 29 Jan 2021 15:20:56 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=F0=9F=93=9A=20update=20v1=20/=20up?= =?UTF-8?q?date=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- README.md | 4 +-- go.sum | 1 + v1/sc2gd.go | 22 ++++++++++++++++ v1/wowp/characterAchievements.go | 43 ++++++++++++++++++++++++++++++++ v1/wowp/characterMedia.go | 7 +++--- 6 files changed, 73 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32c33ee..6b690bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ env: # You don't need to test on very old version of the Go compiler. It's the user's # responsibility to keep their compilers up to date. go: - - 1.13.x + - 1.16.x # Only clone the most recent commit. git: diff --git a/README.md b/README.md index 268fdaf..b9cccec 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # blizzard -[![GoDoc](https://godoc.org/github.com/FuzzyStatic/blizzard?status.svg)](http://godoc.org/github.com/FuzzyStatic/blizzard) [![Go Report Card](https://goreportcard.com/badge/github.com/FuzzyStatic/blizzard)](https://goreportcard.com/report/github.com/FuzzyStatic/blizzard) [![Build Status](https://travis-ci.org/FuzzyStatic/blizzard.svg?branch=master)](https://travis-ci.org/FuzzyStatic/blizzard) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fa25319c93814ff4878ee049f04317d4)](https://www.codacy.com/app/FuzzyStatic/blizzard?utm_source=github.com&utm_medium=referral&utm_content=FuzzyStatic/blizzard&utm_campaign=Badge_Grade) +[![Go Reference](https://pkg.go.dev/badge/github.com/FuzzyStatic/blizzard/v2.svg)](https://pkg.go.dev/github.com/FuzzyStatic/blizzard/v2) [![Go Report Card](https://goreportcard.com/badge/github.com/FuzzyStatic/blizzard)](https://goreportcard.com/report/github.com/FuzzyStatic/blizzard) [![Build Status](https://travis-ci.org/FuzzyStatic/blizzard.svg?branch=master)](https://travis-ci.org/FuzzyStatic/blizzard) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fa25319c93814ff4878ee049f04317d4)](https://www.codacy.com/app/FuzzyStatic/blizzard?utm_source=github.com&utm_medium=referral&utm_content=FuzzyStatic/blizzard&utm_campaign=Badge_Grade) -> This is a Go client library for gathering [Blizzard API reference](https://develop.battle.net/documentation/api-reference) data +> This is a Go client library for gathering [Blizzard API reference](https://develop.battle.net/documentation/api-reference) data ## Table of Contents diff --git a/go.sum b/go.sum index 39a49fd..e3ba8b0 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= diff --git a/v1/sc2gd.go b/v1/sc2gd.go index 3e7b89c..e4b375b 100644 --- a/v1/sc2gd.go +++ b/v1/sc2gd.go @@ -27,3 +27,25 @@ func (c *Client) SC2LeagueData(seasonID int, queueID sc2gd.QueueID, teamType sc2 return &dat, b, nil } + +// SC2LadderData returns SC2 ladder for given division's ladderID. +// This API is undocumented by Blizzard, so it may be unstable. +func (c *Client) SC2LadderData(ladderID int) (*sc2gd.Ladder, []byte, error) { + var ( + dat sc2gd.Ladder + b []byte + err error + ) + + b, err = c.getURLBody(c.apiURL+fmt.Sprintf("/data/sc2/ladder/%d?locale=%s", ladderID, c.locale), "") + if err != nil { + return &dat, b, err + } + + err = json.Unmarshal(b, &dat) + if err != nil { + return &dat, b, err + } + + return &dat, b, nil +} diff --git a/v1/wowp/characterAchievements.go b/v1/wowp/characterAchievements.go index 96cece5..9125347 100644 --- a/v1/wowp/characterAchievements.go +++ b/v1/wowp/characterAchievements.go @@ -71,3 +71,46 @@ type CharacterAchievementsSummary struct { } `json:"realm"` } `json:"character"` } + +// Statistics struct used for representing nested Statistics +type Statistics []struct { + ID int `json:"id"` + Name string `json:"name"` + LastUpdatedTimestamp int64 `json:"last_updated_timestamp"` + Quantity float64 `json:"quantity"` + Description string `json:"description,omitempty"` +} + +// CharacterAchievementsStatistics structure +type CharacterAchievementsStatistics struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + Character struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + Realm struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + Slug string `json:"slug"` + } `json:"realm"` + } `json:"character"` + Categories []struct { + ID int `json:"id"` + Name string `json:"name"` + SubCategories []struct { + ID int `json:"id"` + Name string `json:"name"` + Statistics Statistics `json:"statistics"` + } `json:"sub_categories,omitempty"` + Statistics Statistics `json:"statistics,omitempty"` + } `json:"categories"` +} diff --git a/v1/wowp/characterMedia.go b/v1/wowp/characterMedia.go index 52dd74f..87aedee 100644 --- a/v1/wowp/characterMedia.go +++ b/v1/wowp/characterMedia.go @@ -22,7 +22,8 @@ type CharacterMediaSummary struct { Slug string `json:"slug"` } `json:"realm"` } `json:"character"` - AvatarURL string `json:"avatar_url"` - BustURL string `json:"bust_url"` - RenderURL string `json:"render_url"` + Assets []struct { + Key string `json:"key"` + Value string `json:"value"` + } `json:"assets"` }