{"id":13664987,"url":"https://github.com/FuzzyStatic/blizzard","last_synced_at":"2025-04-26T04:31:53.926Z","repository":{"id":40794786,"uuid":"116586064","full_name":"FuzzyStatic/blizzard","owner":"FuzzyStatic","description":"Go client library for Blizzard API data","archived":false,"fork":false,"pushed_at":"2025-04-17T00:54:03.000Z","size":1744,"stargazers_count":61,"open_issues_count":3,"forks_count":22,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-17T13:55:55.340Z","etag":null,"topics":["battlenet","blizzard","blizzard-api","blizzard-data","d3","diablo3","go","golang","hearthstone","hearthstone-api","overwatch","starcraft-ii","starcraft2","starcraft2-api","world-of-warcraft","world-of-warcraft-classic","worldofwarcraft","wow","wow-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FuzzyStatic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-01-07T17:41:52.000Z","updated_at":"2025-04-17T00:54:01.000Z","dependencies_parsed_at":"2023-12-19T04:40:00.887Z","dependency_job_id":"7c40eecc-791d-44e2-8aad-dd21c3db1a87","html_url":"https://github.com/FuzzyStatic/blizzard","commit_stats":{"total_commits":233,"total_committers":16,"mean_commits":14.5625,"dds":0.1802575107296137,"last_synced_commit":"8f5f95cec145cdba3d399bb0684ed6e118c2a16a"},"previous_names":["fuzzystatic/go-blizzard"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuzzyStatic%2Fblizzard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuzzyStatic%2Fblizzard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuzzyStatic%2Fblizzard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuzzyStatic%2Fblizzard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FuzzyStatic","download_url":"https://codeload.github.com/FuzzyStatic/blizzard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250931042,"owners_count":21509807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["battlenet","blizzard","blizzard-api","blizzard-data","d3","diablo3","go","golang","hearthstone","hearthstone-api","overwatch","starcraft-ii","starcraft2","starcraft2-api","world-of-warcraft","world-of-warcraft-classic","worldofwarcraft","wow","wow-api"],"created_at":"2024-08-02T05:03:14.089Z","updated_at":"2025-04-26T04:31:50.275Z","avatar_url":"https://github.com/FuzzyStatic.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# blizzard\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/FuzzyStatic/blizzard/v3.svg)](https://pkg.go.dev/github.com/FuzzyStatic/blizzard/v3) [![Go Report Card](https://goreportcard.com/badge/github.com/FuzzyStatic/blizzard)](https://goreportcard.com/report/github.com/FuzzyStatic/blizzard)\n\n\u003e This is a Go client library for gathering [Blizzard API reference](https://develop.battle.net/documentation) data\n\n## Table of Contents\n\n- [blizzard](#blizzard)\n  - [Table of Contents](#table-of-contents)\n  - [Getting Started](#getting-started)\n    - [Fetching Diablo 3 Data](#fetching-diablo-3-data)\n    - [Fetching Hearthstone Data](#fetching-hearthstone-data)\n    - [Fetching Overwatch League Data](#fetching-overwatch-league-data)\n    - [Fetching StarCraft 2 Data](#fetching-starcraft-2-data)\n    - [Fetching World of Warcraft Data](#fetching-world-of-warcraft-data)\n    - [Fetching World of Warcraft Classic Data](#fetching-world-of-warcraft-classic-data)\n  - [Authorization for User Data](#authorization-for-user-data)\n    - [Fetching OAuth Data](#fetching-oauth-data)\n  - [Header Information](#header-information)\n  - [Documentation](#documentation)\n  - [Special Thanks](#special-thanks)\n\n## Getting Started\n\nFirst, download the Blizzard library:\n\n```shell\ngo get github.com/FuzzyStatic/blizzard/v3\n```\n\nStart using the library by initiating a new Blizzard config structure for your desired region and locale (client_id and client_secret can be acquired through your developer account at [https://develop.battle.net/](https://develop.battle.net/)) and requesting an access token:\n\n```go\nusBlizzClient, err := blizzard.NewClient(blizzard.Config{\n  ClientID:     \"my_client_id\",\n  ClientSecret: \"my_client_secret\",\n  HTTPClient:   http.DefaultClient,\n  Region:       blizzard.US,\n  Locale:       blizzard.EnUS,\n})\n\nerr = usBlizzClient.AccessTokenRequest(ctx)\nif err != nil {\n  fmt.Println(err)\n}\n\neuBlizzClient, err := blizzard.NewClient(blizzard.Config{\n  ClientID:     \"my_client_id\",\n  ClientSecret: \"my_client_secret\",\n  HTTPClient:   http.DefaultClient,\n  Region:       blizzard.EU,\n  Locale:       blizzard.EnGB,\n})\n\nerr = euBlizzClient.AccessTokenRequest(ctx)\nif err != nil {\n  fmt.Println(err)\n}\n```\n\n### Fetching Diablo 3 Data\n\nYou can use the functions prefixed with \"D3\" to acquire Diablo 3 information. For example, you can get information about the current D3 hardcore necromancer leaderboards:\n\n```go\ndat, _, err := usBlizzClient.D3SeasonLeaderboardHardcoreNecromancer(ctx, 15)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n### Fetching Hearthstone Data\n\nYou can use the functions prefixed with \"HS\" to acquire Hearthstone information. For example, you can get information about all the Hearthstone cards:\n\n```go\ndat, _, err := usBlizzClient.HSCardsAll(ctx)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n### Fetching Overwatch League Data\n\nYou can use the functions prefixed with \"OWL\" to acquire Overwatch League information. For example, you can get information about the Overwatch League:\n\n```go\ndat, _, err := usBlizzClient.OWLSummaryData(ctx)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n### Fetching StarCraft 2 Data\n\nYou can use the functions prefixed with \"SC2\" to acquire StarCraft 2 information. For example, you can get information about the current SC2 grandmaster ladder:\n\n```go\ndat, _, err := usBlizzClient.SC2LadderGrandmaster(ctx, blizzard.EU)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n### Fetching World of Warcraft Data\n\nYou can use the functions prefixed with \"WoW\" to acquire World of Warcraft information. For example, you can get information about your WoW character profile:\n\n```go\ndat, _, err := usBlizzClient.WoWCharacterProfileSummary(ctx, \"illidan\", \"wildz\")\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\nor get information about specific spells:\n\n```go\ndat, _, err := usBlizzClient.WoWSpell(ctx, 17086)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\nor the PvP leaderboards:\n\n```go\ndat, _, err := usBlizzClient.WoWCharacterPvPBracketStatistics(ctx, wowp.Bracket3v3)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n### Fetching World of Warcraft Classic Data\n\nYou can use the functions prefixed with \"ClassicWoW\" to acquire World of Warcraft Classic information. For example, you can get information about WoW Classic creature data:\n\n```go\ndat, _, err := usBlizzClient.ClassicWoWCreature(ctx, 30)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n## Authorization for User Data\n\nTo use the `UserInfoHeader` or `WoWUserCharacters` functions to acquire data about other users (and not your own), you must use the OAuth2 redirect method to get an authorized token. This is useful for building websites that display more personal or individualized data. The following code snippet is an example on how to acquire authorized tokens for other users. A working example can be found in the [examples/authCodeFlow](https://github.com/FuzzyStatic/blizzard/tree/master/examples/authCodeFlow) directory. Before the redirect URI will work, you will have to add it to your client settings at \u003chttps://develop.battle.net/access\u003e:\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"encoding/json\"\n  \"fmt\"\n  \"log\"\n  \"net/http\"\n\n  \"github.com/FuzzyStatic/blizzard/v3\"\n  \"github.com/FuzzyStatic/blizzard/v3/oauth\"\n  \"golang.org/x/oauth2\"\n)\n\nvar (\n  cfg           oauth2.Config\n  usBlizzClient *blizzard.Client\n)\n\n// Homepage\nfunc HomePage(w http.ResponseWriter, r *http.Request) {\n  fmt.Println(\"Homepage Hit!\")\n  u := cfg.AuthCodeURL(\"my_random_state\")\n  http.Redirect(w, r, u, http.StatusFound)\n}\n\n// Authorize\nfunc Authorize(w http.ResponseWriter, r *http.Request) {\n  err := r.ParseForm()\n  if err != nil {\n    http.Error(w, err.Error(), http.StatusInternalServerError)\n    return\n  }\n\n  state := r.Form.Get(\"state\")\n  if state != \"my_random_state\" {\n    http.Error(w, \"State invalid\", http.StatusBadRequest)\n    return\n  }\n\n  code := r.Form.Get(\"code\")\n  if code == \"\" {\n    http.Error(w, \"Code not found\", http.StatusBadRequest)\n    return\n  }\n\n  token, err := cfg.Exchange(context.Background(), code)\n  if err != nil {\n    http.Error(w, err.Error(), http.StatusInternalServerError)\n    return\n  }\n\n  e := json.NewEncoder(w)\n  e.SetIndent(\"\", \"  \")\n  err = e.Encode(*token)\n  if err != nil {\n    http.Error(w, err.Error(), http.StatusInternalServerError)\n    return\n  }\n\n  dat1, _, err := usBlizzClient.UserInfoHeader(token)\n  if err != nil {\n    http.Error(w, err.Error(), http.StatusInternalServerError)\n    return\n  }\n\n  fmt.Printf(\"%+v\\n\", dat1)\n\n  dat2, _, err := usBlizzClient.WoWUserCharacters(token)\n  if err != nil {\n    http.Error(w, err.Error(), http.StatusInternalServerError)\n    return\n  }\n\n  fmt.Printf(\"%+v\\n\", dat2)\n}\n\nfunc main() {\n  blizz = blizzard.NewClient(\"client_id\", \"client_secret\", blizzard.US, blizzard.EnUS)\n  cfg = usBlizzClient.AuthorizeConfig(\"http://\u003cmydomain\u003e:9094/oauth2\", oauth.ProfileD3, oauth.ProfileSC2, oauth.ProfileWoW)\n\n  http.HandleFunc(\"/\", HomePage)\n  http.HandleFunc(\"/oauth2\", Authorize)\n\n  // We start up our Client on port 9094\n  log.Println(\"Client is running at 9094 port.\")\n  log.Fatal(http.ListenAndServe(\":9094\", nil))\n}\n```\n\n### Fetching OAuth Data\n\nNow you can validate those tokens with the OAuth API:\n\n```go\ndat, _, err := usBlizzClient.TokenValidation(ctx, token)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Printf(\"%+v\\n\", dat)\n```\n\n## Header Information\n\nEach API call will return HTTP response header information, if any. Use the second return variable to get a structure containing the response header information.\n\n```go\ndat, header, err := usBlizzClient.WoWAuctions(context.Background(), 1138)\nif err != nil {\n  fmt.Println(err)\n}\n\nfmt.Println(header.BattlenetNamespace)\nfmt.Println(header.LastModified)\n...\n```\n\n## Documentation\n\nSee the [Blizzard API reference](https://develop.battle.net/documentation/guides) and the [Go reference](https://pkg.go.dev/github.com/FuzzyStatic/blizzard/v3) for all the different datasets that can be acquired. For questions and discussion about the blizzard API go to the [Blizzard API Forum](https://us.forums.blizzard.com/en/blizzard/c/api-discussion/18).\n\n## Special Thanks\n\nThanks to [JSON-to-Go](https://mholt.github.io/json-to-go/) for making JSON to Go structure creation simple.\n\nThanks to all who contribute to keep this package current.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFuzzyStatic%2Fblizzard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFuzzyStatic%2Fblizzard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFuzzyStatic%2Fblizzard/lists"}