8000 GitHub - ccod/blizzard: Go client library for Blizzard API data
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ blizzard Public
forked from FuzzyStatic/blizzard

Go client library for Blizzard API data

License

Notifications You must be signed in to change notification settings

ccod/blizzard

 
 

Repository files navigation

blizzard

GoDoc Go Report Card Build Status Codacy Badge Say Thanks!

This is a Go client library for gathering Blizzard API reference data

Getting started

Start by initiating a new Blizzard config structure for desired region and locale (client_id and client_secret can be acquired through your developer account at https://develop.battle.net/) and requesting an access token:

blizz := blizzard.NewClient("client_id", "client_secret", blizzard.US, blizzard.enUS)

err := blizz.AccessTokenReq()
if err != nil {
	fmt.Println(err)
}

Fetching OAuth Data

Now you can fetch data from the Blizzard API. For example, you validate your token:

dat, _, err := blizz.TokenValidation()
if err != nil {
	fmt.Println(err)
}

fmt.Printf("%+v\n", dat)

Fetching Diablo 3 Data

You 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:

dat, _, err := blizz.D3SeasonLeaderboardHardcoreNecromancer(15)
if err != nil {
	fmt.Println(err)
}

fmt.Printf("%+v\n", dat)

Fetching StarCraft 2 Data

You can use the functions prefixed with "SC2" to acquire StarCraft 2 information. For example, you can get information about the current SC2 grandmaster ladder:

dat, _, err := blizz.SC2LadderGrandmaster(EU)
if err != nil {
	fmt.Println(err)
}

fmt.Printf("%+v\n", dat)

Fetching World of Warcraft Data

You can use the functions prefixed with "WoW" to acquire World of Warcraft information. For example, you can get information about your WoW character profile:

dat, _, err := blizz.WoWCharacterProfile("emerald-dream", "Limejelly",
	[]string{
		wowc.FieldCharacterAchievements,
		wowc.FieldCharacterAppearance,
		wowc.FieldCharacterAudit,
		wowc.FieldCharacterFeed,
		wowc.FieldCharacterGuild,
		wowc.FieldCharacterItems,
		wowc.FieldCharacterMounts,
		wowc.FieldCharacterPVP,
		wowc.FieldCharacterPetSlots,
		wowc.FieldCharacterPets,
		wowc.FieldCharacterProfessions,
		wowc.FieldCharacterProgression,
		wowc.FieldCharacterQuests,
		wowc.FieldCharacterReputation,
		wowc.FieldCharacterStatistics,
		wowc.FieldCharacterStats,
		wowc.FieldCharacterTalents,
		wowc.FieldCharacterTitle,
	},
)
if err != nil {
	fmt.Println(err)
}

fmt.Printf("%+v\n", dat)

or get information about specific spells:

dat, _, err := blizz.WoWSpell(17086)
if err != nil {
	fmt.Println(err)
}

fmt.Printf("%+v\n", dat)

or the PVP leaderboards:

dat, _, err := blizz.WoWPVPLeaderboard(wowc.Bracket3v3)
if err != nil {
	t.Fail()
}

fmt.Printf("%+v\n", dat)

Documentation

See the Blizzard API reference and the godoc for all the different datasets that can be acquired.

Special Thanks

Thanks to JSON-to-Go for making JSON to Go structure creation simple.

About

Go client library for Blizzard API data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%
0