Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 1.74 KB

File metadata and controls

49 lines (40 loc) · 1.74 KB

Hearthstone API GoDoc Build Status Go Report Card

Golang Bindings for the hearthstoneapi.com API

Summary

Unoficial hearthstoneapi Go Client Library

Instalation

go get github.com/eefret/hsapi

Documentation

For the general api docs please see the Official Mashape Docs. For details on all the functionality on this library, see the GoDoc documentation.

Usage Example

import(
    "github.com/eefret/hsapi"
    "fmt"
)

  // Search Example
  func main() {
  	api := hsapi.NewHsAPI("tntkXJyM7EmshBgQYsXtCHHEX8Izp1uHrN1jsnTpw7tNCxEZIN") // Get yours in mashape
	api.Debug = true // Will print debug outputs
	config := hsapi.NewCardSearch("tirion fordring") // or any incomplete search
	config.Collectible = true // To narrow the search a little more
	resp, _ := api.Search(config)
	fmt.Println(resp[0].Name) // Tirion Fordring
	
	c := hsapi.NewCardImage(resp[0].CardID)
	c.Gold = true
	resp, _ := api.CardImage(c)
	f, _ := os.Create("Tirion_Fordring.gif")
	defer f.Close()
	f.Write(resp.Image) // Writing []byte into the file

	//Now featuring card sounds
	c2 := hs.NewCardSound("EX1_383", hs.PLAY)
    c2.Locale = hs.EsES
    c2.Extension = hs.MP3
    resp, _ := api.CardSound(c2)
	f, _ := os.Create("Tirion_Fordring_Play.mp3")
	defer f.Close()
	f.Write(resp.Sound) // Writing []byte into the file
  }