Skip to content

Hearthstone

Ben Weier edited this page Jun 6, 2023 · 3 revisions

In addition to all parameters documented here, all API methods can accept key, secret, token, origin, locale, for cases where you need to use different values to the default instance.

All methods accept a second headers argument allowing an object of { [key: string]: string } to be added to the request headers. For example, some requests can potentially return large response bodies and you might want to avoid this if the resource has not been updated between the previously observed state with a If-Modified-Since header. If a method does not accept an argument, or it's first argument is optional, pass null | undefined followed by a headers object, e.g. token(null, { 'X-Header-Key': 'X-Header-Value' })

Method parameters are encoded with encodeURIComponent for URL safety.

Methods with optional parameters will fallback to API endpoints that best match the provided parameters.


cardSearch

hs.cardSearch({
  attack?: number | number[]
  class?:
    | 'demonhunter'
    | 'druid'
    | 'hunter'
    | 'mage'
    | 'paladin'
    | 'priest'
    | 'rogue'
    | 'shaman'
    | 'warlock'
    | 'warrior'
    | 'neutral'
  collectible?: 0 | 1
  gameMode?: 'constructed' | 'battlegrounds' | 'arena' | 'duels'
  health?: number | number[]
  keyword?: string
  manaCost?: number | number[]
  minionType?: 'murloc' | 'demon' | 'mech' | 'elemental' | 'beast' | 'totem' | 'pirate' | 'dragon' | 'all'
  order?: 'asc' | 'desc'
  page?: number
  pageSize?: number
  rarity?: 'free' | 'common' | 'rare' | 'epic' | 'legendary'
  set?: string
  sort?: 'manaCost' | 'attack' | 'health' | 'name'
  textFilter?: string
  tier?: 1 | 2 | 3 | 4 | 5 | 6 | 'hero' | Array<1 | 2 | 3 | 4 | 5 | 6 | 'hero'>
  type?: 'hero' | 'minion' | 'spell' | 'weapon'
})

card

hs.card({ id: number | string; gameMode?: 'constructed' | 'battlegrounds' | 'arena' | 'duels' })

cardBacks

hs.cardBacks({
  id?: number | string
  category?:
    | 'base'
    | 'fireside'
    | 'achieve'
    | 'heroes'
    | 'season'
    | 'legend'
    | 'esports'
    | 'game_license'
    | 'promotion'
    | 'pre_purchase'
    | 'blizzard'
    | 'golden'
    | 'events'
  order?: 'asc' | 'desc'
  sort?: string
  textFilter?: string
})

deck

hs.deck({ code?: string; ids?: number | number[]; hero?: number })

metadata

hs.metadata({ type: 'sets' | 'setGroups' | 'types' | 'rarities' | 'classes' | 'minionTypes' | 'keywords' })
Clone this wiki locally