models#

Typed models for Battle.net documents.

Models skip fields they do not declare, so new fields from Blizzard never break parsing.

  • account: Models for the Account Profile API.

  • achievement: Models for the Achievement API.

  • auction: Models for the Auction House API.

  • character: Models for the Character Profile API.

  • creature: Models for the Creature, Creature Family and Creature Type APIs.

  • guild: Models for the Guild API.

  • guild_crest: Models for the Guild Crest API.

  • item: Models for the Item, Item Class and Item Set APIs.

  • item_appearance: Models for the Item Appearance API.

  • media: Models for the Media Search API.

  • mount: Models for the Mount API.

  • pet: Models for the Pet API.

  • playable_class: Models for the Playable Class API.

  • playable_race: Models for the Playable Race API.

  • playable_specialization: Models for the Playable Specialization API.

  • power_type: Models for the Power Type API.

  • profession: Models for the Profession API.

  • quest: Models for the Quest API.

  • realm: Models for the Realm API.

  • recipe: Models for the Recipe API.

  • region: Models for the Region API.

  • reputation: Models for the Reputation API.

  • ruleset: Models for the Ruleset API.

  • spell: Models for the Spell API.

  • talent: Models for the Talent and Talent Tree APIs.

  • title: Models for the Title API.

  • toy: Models for the Toy API.

class wow.models.Document[source]#

Bases: Model

A top-level API document.

class wow.models.GenderedName[source]#

Bases: Model

A name with a male and a female form.

male: str#
female: str#
class wow.models.IdName[source]#

Bases: Model

An id and a localized name.

id: int#
name: str#
class wow.models.IdRef[source]#

Bases: Model

A reference that carries no name, such as a media or appearance link.

id: int#
key: Link#

Bases: Model

A link to another API document.

href: str#

Bases: Model

The _links block every document carries.

self_: Link#
type wow.models.LocalizedString = dict[str, str]#

Text in every locale, keyed like {"en_US": "Sword", "de_DE": "Schwert"}.

Search results always come back this way, whatever locale the client uses.

class wow.models.Media[source]#

Bases: Document

A media document: the rendered assets for one item, class, or other entity.

id: int#
assets: tuple[MediaAsset, ...]#
class wow.models.MediaAsset[source]#

Bases: Model

One rendered asset.

Variables:
  • key – The asset kind, such as icon.

  • value – Its URL on render.worldofwarcraft.com. Forever assets live under /forever-{region}/.

  • file_data_id – The game client’s file id. Guild crest media has none.

key: str#
value: str#
file_data_id: int | None = None#
class wow.models.Model[source]#

Bases: msgspec.Struct

Base for every response model.

Models are immutable. Fields they do not declare are skipped, so a field Blizzard adds tomorrow is never fatal; read it from the raw document with wow.Client.get() until a release models it.

Bases: Model

A reference that carries no id, such as a talent tree link.

key: Link#
name: str#
class wow.models.Ref[source]#

Bases: IdName

A reference to another document: its id, name and link, as in every index.

key: Link#
class wow.models.SearchPage[DataT: Model][source]#

Bases: Model

One page of search results.

Battle.net stops at 1,000 results per query however many pages that spans, and sets result_count_capped when it cut the results short.

page: int#
page_size: int#
max_page_size: int#
page_count: int#
results: tuple[SearchResult[DataT], ...]#
result_count_capped: bool#
class wow.models.SearchResult[DataT: Model][source]#

Bases: Model

One search hit: the link to the full document plus its indexed, all-locale data.

key: Link#
data: DataT#
class wow.models.TypedName[source]#

Bases: Model

A constant plus its localized label, such as {"type": "HORDE", "name": "Horde"}.

type is kept as a plain string so values Blizzard adds later still validate.

type: str#
name: str#