Battlenet
A Golang HTTP client for obtaining data from Blizzard Entertainment's Battle.net API.
Install / Use
/learn @munsy/BattlenetREADME
BattleNet
A Golang library for retrieving data from Blizzard's Battle.net API.
Requires Go 1.12 or higher.
Install
$ go get github.com/munsy/battlenet
Example
package main
import (
"flag"
"fmt"
"net/http"
"time"
"github.com/munsy/battlenet"
)
var tokenFlag = flag.String("t", "", "Battle.net API token (required).")
func main() {
flag.Parse()
if *tokenFlag == "" {
fmt.Println("No token provided.")
return
}
// Create settings for the client. This is not required, but
// is necessary for non-default settings.
settings := &battlenet.Settings{
Client: &http.Client{Timeout: (10 * time.Second)},
Locale: battlenet.Locale.AmericanEnglish,
Region: battlenet.Regions.US,
}
// Create a new client for accessing the Battle.net Account API.
// There are also clients for Diablo III, Starcraft II, and WoW.
client, err := battlenet.AccountClient(settings, *tokenFlag)
if nil != err {
panic(err)
}
// Make a request. Each method corresponds to a Battle.net endpoint.
response, err := client.BattleID()
if nil != err {
panic(err)
}
// Get the underlying data. You can also see the endpoint that was called,
// as well as your quota usage.
bid := response.Data
fmt.Printf("ID: %d\n", bid.ID)
fmt.Printf("BattleTag: %s\n", bid.BattleTag)
}
$ go build -o account.exe
$ ./account.exe -t $YOUR_API_TOKEN_HERE
ID: 12345654321
BattleTag: Munsy#78910
Additional examples for Diablo III, Starcraft II, and World of Warcraft can be found in the examples package.
Bug Reporting/Fixing
Please submit all bug reports as issues. This section will be updated in the future with a more comprehensive guide to submitting helpful bug reports and/or bug fixes.
Contributing
- Testing is mostly what is needed right now
- Submit contributions as pull requests
Licensing
GoBattleNet is licensed under the MIT License. See LICENSE for the full license text.
Related Skills
gh-issues
344.1kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
344.1kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
tmux
344.1kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
