Documentation ¶
Index ¶
- Constants
- Variables
- type AllCardResponse
- type AllCardsConfig
- type BaseConfig
- type Card
- type CardBack
- type CardBacksConfig
- type CardImageConfig
- type CardImageResponse
- type CardSearchConfig
- type CardSoundConfig
- type CardSoundResponse
- type CardsByClassConfig
- type CardsByFactionConfig
- type CardsByQualityConfig
- type CardsByRaceConfig
- type CardsBySetConfig
- type CardsByTypeConfig
- type Class
- type Faction
- type FileExtension
- type GetCardConfig
- type HsAPI
- func (hs *HsAPI) AllCards(config AllCardsConfig) (AllCardResponse, error)
- func (hs *HsAPI) CardBacks(config CardBacksConfig) ([]CardBack, error)
- func (hs *HsAPI) CardImage(config CardImageConfig) (CardImageResponse, error)
- func (hs *HsAPI) CardSound(config CardSoundConfig) (CardSoundResponse, error)
- func (hs *HsAPI) CardsByClass(config CardsByClassConfig) ([]Card, error)
- func (hs *HsAPI) CardsByFaction(config CardsByFactionConfig) ([]Card, error)
- func (hs *HsAPI) CardsByQuality(config CardsByQualityConfig) ([]Card, error)
- func (hs *HsAPI) CardsByRace(config CardsByRaceConfig) ([]Card, error)
- func (hs *HsAPI) CardsBySet(config CardsBySetConfig) ([]Card, error)
- func (hs *HsAPI) CardsByType(config CardsByTypeConfig) ([]Card, error)
- func (hs *HsAPI) GetCard(config GetCardConfig) ([]Card, error)
- func (hs *HsAPI) Info(config InfoConfig) InfoResponse
- func (hs *HsAPI) Search(config CardSearchConfig) ([]Card, error)
- type InfoConfig
- type InfoResponse
- type Locale
- type Quality
- type Race
- type Set
- type SoundType
- type Type
Constants ¶
const ( BaseURL = "https://omgvamp-hearthstone-v1.p.mashape.com/" INFO = "info" CARDS = "cards" GetCARD = "cards/%v" CardBACK = "cardbacks" CardSEARCH = "cards/search/%v" CardBySET = "cards/sets/%v" CardByCLASS = "cards/classes/%v" CardByRACE = "cards/races/%v" CardByQUALITY = "cards/qualities/%v" CardByTYPE = "cards/types/%v" CardByFACTION = "cards/factions/%v" SoundsURL = "http://wowimg.zamimg.com/hearthhead/sounds%v/VO_%v_%v_%v.%v" )
All constants
Variables ¶
var ErrMultipleCards = errors.New("Multiple Cards obtained in a single card context.")
ErrMultipleCards is thrown when a single card is required but the query returns several
Functions ¶
This section is empty.
Types ¶
type AllCardResponse ¶
type AllCardResponse struct { Basic []Card `json:"Basic"` BlackrockMountain []Card `json:"Blackrock Mountain"` Classic []Card `json:"Classic"` Credits []Card `json:"Credits"` Debug []Card `json:"Debug"` GoblinsvsGnomes []Card `json:"Goblins vs Gnomes"` HeroSkins []Card `json:"Hero Skins"` Missions []Card `json:"Missions"` Naxxramas []Card `json:"Naxxramas"` Promotion []Card `json:"Promotion"` Reward []Card `json:"Reward"` System []Card `json:"System"` TavernBrawl []Card `json:"Tavern Brawl"` TheGrandTournament []Card `json:"The Grand Tournament"` }
AllCardResponse is a struct for allcards method
type AllCardsConfig ¶
type AllCardsConfig struct { Attack int Collectible bool Cost int Durability int Health int Locale Locale }
AllCardsConfig configuration of the AllCards method
func NewAllCards ¶
func NewAllCards() AllCardsConfig
NewAllCards creates a new AllCardsConfig no mandatory parameters required default locale is enUS
type BaseConfig ¶
type BaseConfig struct { Attack int Collectible bool Cost int Durability int Health int Locale Locale }
BaseConfig is the base for most of the configuration types
type Card ¶
type Card struct { Artist string `json:"artist"` Attack int `json:"attack"` CardID string `json:"cardId"` CardSet string `json:"cardSet"` Collectible bool `json:"collectible"` Cost int `json:"cost"` Elite bool `json:"elite"` Faction string `json:"faction"` Flavor string `json:"flavor"` Health int `json:"health"` Img string `json:"img"` PlayerClass string `json:"playerClass"` ImgGold string `json:"imgGold"` Locale string `json:"locale"` Mechanics []struct { Name string `json:"name"` } `json:"mechanics"` Name string `json:"name"` Rarity string `json:"rarity"` Text string `json:"text"` Type string `json:"type"` }
Card is the main struct for cards
type CardBack ¶
type CardBack struct { CardBackID string `json:"cardBackId"` Description string `json:"description"` Enabled bool `json:"enabled"` HowToGet string `json:"howToGet"` Img string `json:"img"` ImgAnimated string `json:"imgAnimated"` Locale string `json:"locale"` Name string `json:"name"` SortCategory string `json:"sortCategory"` SortOrder string `json:"sortOrder"` Source string `json:"source"` }
CardBack is the response returned by the cardbacks endpoint
type CardBacksConfig ¶
type CardBacksConfig struct {
Locale Locale
}
CardBacksConfig configuration of the CardBacks method
func NewCardBacks ¶
func NewCardBacks() CardBacksConfig
NewCardBacks creates a new CardBacksConfig no mandatory parameters required default locale is enUS
type CardImageConfig ¶
CardImageConfig configuration of the CardImage method
func NewCardImage ¶
func NewCardImage(cardID string) CardImageConfig
NewCardImage creates a new CardImageConfig CardID is mandatory default locale is enUS Gold is default false
type CardImageResponse ¶
type CardImageResponse struct { Image []byte ContentLength int64 Extension FileExtension }
CardImageResponse is the response returned by the CardImage endpoint
type CardSearchConfig ¶
CardSearchConfig configuration of the CardSearch method
func NewCardSearch ¶
func NewCardSearch(name string) CardSearchConfig
NewCardSearch creates a new CardSearchConfig name parameter is mandatory default locale is enUS
type CardSoundConfig ¶
type CardSoundConfig struct { CardID string Type SoundType Locale Locale Extension FileExtension }
CardSoundConfig configudation of the GetCardSound method
func NewCardSound ¶
func NewCardSound(cardID string, soundType SoundType) CardSoundConfig
NewCardSound creates a new CardSoundConfig CardID and SoundType are mandatory, default local is enUS and default extension is MP3
type CardSoundResponse ¶
type CardSoundResponse struct { Sound []byte ContentLength int64 Extension FileExtension Type SoundType }
CardSoundResponse is the response returned by the CardSound endpoint
type CardsByClassConfig ¶
type CardsByClassConfig struct { Class Class BaseConfig }
CardsByClassConfig configuration of the CardsByClassConfig method
func NewCardsByClass ¶
func NewCardsByClass(class Class) CardsByClassConfig
NewCardsByClass creates a new CardsByClassConfig set parameter is mandatory default locale is enUS
type CardsByFactionConfig ¶
type CardsByFactionConfig struct { Faction Faction BaseConfig }
CardsByFactionConfig configuration of the CardsByFaction method
func NewCardsByFaction ¶
func NewCardsByFaction(faction Faction) CardsByFactionConfig
NewCardsByFaction creates a new CardsByFactionConfig faction parameter is mandatory default locale is enUS
type CardsByQualityConfig ¶
type CardsByQualityConfig struct { Quality Quality BaseConfig }
CardsByQualityConfig configuration of the CardsByQuality method
func NewCardsByQuality ¶
func NewCardsByQuality(quality Quality) CardsByQualityConfig
NewCardsByQuality creates a new CardsByQualityConfig quality parameter is mandatory default local is enUS
type CardsByRaceConfig ¶
type CardsByRaceConfig struct { Race Race BaseConfig }
CardsByRaceConfig configuration of the CardsByRace method
func NewCardsByRace ¶
func NewCardsByRace(race Race) CardsByRaceConfig
NewCardsByRace creates a new CardsByQualityConfig race parameter is mandatory default local is enUS
type CardsBySetConfig ¶
type CardsBySetConfig struct { Set Set BaseConfig }
CardsBySetConfig configuration of the CardsBySet method
func NewCardsBySet ¶
func NewCardsBySet(set Set) CardsBySetConfig
NewCardsBySet creates a new CardsBySetConfig set parameter is mandatory default locale is enUS
type CardsByTypeConfig ¶
type CardsByTypeConfig struct { Type Type BaseConfig }
CardsByTypeConfig configuration of the CardsByType method
func NewCardsByType ¶
func NewCardsByType(typ Type) CardsByTypeConfig
NewCardsByType creates a new CardsByTypeConfig type parameter is mandatory default local is enUS
type FileExtension ¶
type FileExtension int
FileExtension is the enum for the extensions
const ( JPG FileExtension = iota + 1 JPEG GIF PNG MP3 OGG )
FileExtension objects
func (FileExtension) String ¶
func (f FileExtension) String() string
type GetCardConfig ¶
GetCardConfig configuration of the GetCard method
func NewGetCard ¶
func NewGetCard(id string) GetCardConfig
NewGetCard creates a new GetCardConfig name parameter is mandatory, should be exact name or ID default local is enUS
type HsAPI ¶
type HsAPI struct { Token string `json:"token"` Debug bool `json:"debug"` Client *http.Client `json:"-"` }
HsAPI is the main struct for our API
func NewHsAPIWithClient ¶
NewHsAPIWithClient returns a new client with a custom client
func (*HsAPI) AllCards ¶
func (hs *HsAPI) AllCards(config AllCardsConfig) (AllCardResponse, error)
AllCards obtain all cards in Hearthstone
func (*HsAPI) CardBacks ¶
func (hs *HsAPI) CardBacks(config CardBacksConfig) ([]CardBack, error)
CardBacks obtain all cards backs in Hearthstone
func (*HsAPI) CardImage ¶
func (hs *HsAPI) CardImage(config CardImageConfig) (CardImageResponse, error)
CardImage returns an Image given a Card
func (*HsAPI) CardSound ¶
func (hs *HsAPI) CardSound(config CardSoundConfig) (CardSoundResponse, error)
CardSound search a the sound card scrapping HearthHead if there is any match it returns it.
func (*HsAPI) CardsByClass ¶
func (hs *HsAPI) CardsByClass(config CardsByClassConfig) ([]Card, error)
CardsByClass obtains all cards by class Class param is mandatory
func (*HsAPI) CardsByFaction ¶
func (hs *HsAPI) CardsByFaction(config CardsByFactionConfig) ([]Card, error)
CardsByFaction obtains all cards by faction Faction param is mandatory
func (*HsAPI) CardsByQuality ¶
func (hs *HsAPI) CardsByQuality(config CardsByQualityConfig) ([]Card, error)
CardsByQuality obtains all cards by quality Quality param is mandatory
func (*HsAPI) CardsByRace ¶
func (hs *HsAPI) CardsByRace(config CardsByRaceConfig) ([]Card, error)
CardsByRace obtains all cards by race Race param is mandatory
func (*HsAPI) CardsBySet ¶
func (hs *HsAPI) CardsBySet(config CardsBySetConfig) ([]Card, error)
CardsBySet obtains all cards of the given Set Set param is mandatory
func (*HsAPI) CardsByType ¶
func (hs *HsAPI) CardsByType(config CardsByTypeConfig) ([]Card, error)
CardsByType obtains all cards by type Type param is mandatory
func (*HsAPI) GetCard ¶
func (hs *HsAPI) GetCard(config GetCardConfig) ([]Card, error)
GetCard obtain a single card Exact Name or ID is mandatory, please use ID for more accurate
func (*HsAPI) Info ¶
func (hs *HsAPI) Info(config InfoConfig) InfoResponse
Info obtains info about the API
type InfoConfig ¶
type InfoConfig struct {
Locale Locale
}
InfoConfig configuration of the Info method
func NewInfo ¶
func NewInfo() InfoConfig
NewInfo creates a new InfoConfig no mandatory params default locale is enUS
type InfoResponse ¶
type InfoResponse struct { Classes []string `json:"classes"` Factions []string `json:"factions"` Locales []string `json:"locales"` Patch string `json:"patch"` Qualities []string `json:"qualities"` Races []string `json:"races"` Sets []string `json:"sets"` Types []string `json:"types"` }
InfoResponse is the response returned by the info endpoint
type Locale ¶
type Locale int
Locale is the type that defines the language for the endpoints
Locales objects
type Set ¶
type Set int
Set is the type that defines cardsets in some of the endpoints