@pinta365/blizzard_api 0.3.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +145 -37
- package/esm/mod.d.ts +43 -6
- package/esm/mod.js +69 -6
- package/esm/src/client.d.ts +95 -0
- package/esm/src/client.js +52 -0
- package/esm/src/diablo3/community/act.d.ts +29 -0
- package/esm/src/diablo3/community/act.js +23 -0
- package/esm/src/diablo3/community/artisan.d.ts +50 -0
- package/esm/src/diablo3/community/artisan.js +25 -0
- package/esm/src/diablo3/community/follower.d.ts +25 -0
- package/esm/src/diablo3/community/follower.js +12 -0
- package/esm/src/diablo3/community/hero.d.ts +57 -0
- package/esm/src/diablo3/community/hero.js +25 -0
- package/esm/src/diablo3/community/item.d.ts +48 -0
- package/esm/src/diablo3/community/item.js +12 -0
- package/esm/src/diablo3/community/item_type.d.ts +26 -0
- package/esm/src/diablo3/community/item_type.js +23 -0
- package/esm/src/diablo3/community/profile.d.ts +352 -0
- package/esm/src/diablo3/community/profile.js +61 -0
- package/esm/src/diablo3/game_data/d3.d.ts +127 -0
- package/esm/src/diablo3/game_data/d3.js +72 -0
- package/esm/src/diablo3/index.d.ts +8 -0
- package/esm/src/diablo3/index.js +8 -0
- package/esm/src/diablo3/types.d.ts +8 -0
- package/esm/src/diablo3/types.js +1 -0
- package/esm/src/generated/diablo3_api.d.ts +156 -0
- package/esm/src/generated/diablo3_api.js +2 -0
- package/esm/src/generated/hearthstone_api.d.ts +51 -0
- package/esm/src/generated/hearthstone_api.js +2 -0
- package/esm/src/generated/sc2_api.d.ts +139 -0
- package/esm/src/generated/sc2_api.js +2 -0
- package/esm/src/generated/wow_api.d.ts +1482 -0
- package/esm/src/generated/wow_api.js +2 -0
- package/esm/src/generated/wow_classic_api.d.ts +555 -0
- package/esm/src/generated/wow_classic_api.js +2 -0
- package/esm/src/generated/wow_classic_era_api.d.ts +418 -0
- package/esm/src/generated/wow_classic_era_api.js +2 -0
- package/esm/src/hearthstone/game_data/card_backs.d.ts +31 -0
- package/esm/src/hearthstone/game_data/card_backs.js +22 -0
- package/esm/src/hearthstone/game_data/cards.d.ts +55 -0
- package/esm/src/hearthstone/game_data/cards.js +26 -0
- package/esm/src/hearthstone/game_data/decks.d.ts +29 -0
- package/esm/src/hearthstone/game_data/decks.js +13 -0
- package/esm/src/hearthstone/game_data/metadata.d.ts +82 -0
- package/esm/src/hearthstone/game_data/metadata.js +11 -0
- package/esm/src/hearthstone/index.d.ts +4 -0
- package/esm/src/hearthstone/index.js +4 -0
- package/esm/src/hearthstone/search.d.ts +21 -0
- package/esm/src/hearthstone/search.js +28 -0
- package/esm/src/hearthstone/types.d.ts +5 -0
- package/esm/src/hearthstone/types.js +1 -0
- package/esm/src/shared/bind.d.ts +14 -0
- package/esm/src/shared/bind.js +15 -0
- package/esm/src/shared/context.d.ts +163 -0
- package/esm/src/shared/context.js +304 -0
- package/esm/src/shared/errors.d.ts +53 -0
- package/esm/src/shared/errors.js +95 -0
- package/esm/src/shared/index.d.ts +4 -0
- package/esm/src/shared/index.js +2 -0
- package/esm/src/shared/types.d.ts +133 -0
- package/esm/src/shared/types.js +2 -0
- package/esm/src/starcraft2/community/account.d.ts +19 -0
- package/esm/src/starcraft2/community/account.js +15 -0
- package/esm/src/starcraft2/community/ladder.d.ts +29 -0
- package/esm/src/starcraft2/community/ladder.js +27 -0
- package/esm/src/starcraft2/community/legacy.d.ts +206 -0
- package/esm/src/starcraft2/community/legacy.js +83 -0
- package/esm/src/starcraft2/community/profile.d.ts +255 -0
- package/esm/src/starcraft2/community/profile.js +73 -0
- package/esm/src/starcraft2/game_data/league.d.ts +35 -0
- package/esm/src/starcraft2/game_data/league.js +20 -0
- package/esm/src/starcraft2/index.d.ts +5 -0
- package/esm/src/starcraft2/index.js +5 -0
- package/esm/src/starcraft2/types.d.ts +5 -0
- package/esm/src/starcraft2/types.js +1 -0
- package/esm/src/wow/game_data/achievement.d.ts +87 -0
- package/esm/src/wow/game_data/achievement.js +68 -0
- package/esm/src/wow/game_data/auction_house.d.ts +65 -0
- package/esm/src/wow/game_data/auction_house.js +33 -0
- package/esm/src/wow/game_data/azerite_essence.d.ts +50 -0
- package/esm/src/wow/game_data/azerite_essence.js +48 -0
- package/esm/src/wow/game_data/connected_realm.d.ts +62 -0
- package/esm/src/wow/game_data/connected_realm.js +35 -0
- package/esm/src/wow/game_data/covenant.d.ts +115 -0
- package/esm/src/wow/game_data/covenant.js +88 -0
- package/esm/src/wow/game_data/creature.d.ts +98 -0
- package/esm/src/wow/game_data/creature.js +99 -0
- package/esm/src/wow/game_data/guild_crest.d.ts +56 -0
- package/esm/src/wow/game_data/guild_crest.js +38 -0
- package/esm/src/wow/game_data/heirloom.d.ts +82 -0
- package/esm/src/wow/game_data/heirloom.js +25 -0
- package/esm/src/wow/game_data/housing.d.ts +111 -0
- package/esm/src/wow/game_data/housing.js +124 -0
- package/esm/src/wow/game_data/item.d.ts +183 -0
- package/esm/src/wow/game_data/item.js +100 -0
- package/esm/src/wow/game_data/item_appearance.d.ts +102 -0
- package/esm/src/wow/game_data/item_appearance.js +73 -0
- package/esm/src/wow/game_data/journal.d.ts +124 -0
- package/esm/src/wow/game_data/journal.js +98 -0
- package/esm/src/wow/game_data/keystone_affix.d.ts +39 -0
- package/esm/src/wow/game_data/keystone_affix.js +38 -0
- package/esm/src/wow/game_data/media_search.d.ts +9 -0
- package/esm/src/wow/game_data/media_search.js +10 -0
- package/esm/src/wow/game_data/modified_crafting.d.ts +65 -0
- package/esm/src/wow/game_data/modified_crafting.js +62 -0
- package/esm/src/wow/game_data/mount.d.ts +38 -0
- package/esm/src/wow/game_data/mount.js +35 -0
- package/esm/src/wow/game_data/mythic_keystone_dungeon.d.ts +92 -0
- package/esm/src/wow/game_data/mythic_keystone_dungeon.js +87 -0
- package/esm/src/wow/game_data/mythic_keystone_leaderboard.d.ts +70 -0
- package/esm/src/wow/game_data/mythic_keystone_leaderboard.js +28 -0
- package/esm/src/wow/game_data/mythic_raid_leaderboard.d.ts +36 -0
- package/esm/src/wow/game_data/mythic_raid_leaderboard.js +14 -0
- package/esm/src/wow/game_data/neighborhood.d.ts +36 -0
- package/esm/src/wow/game_data/neighborhood.js +38 -0
- package/esm/src/wow/game_data/pet.d.ts +93 -0
- package/esm/src/wow/game_data/pet.js +76 -0
- package/esm/src/wow/game_data/playable_class.d.ts +58 -0
- package/esm/src/wow/game_data/playable_class.js +51 -0
- package/esm/src/wow/game_data/playable_race.d.ts +31 -0
- package/esm/src/wow/game_data/playable_race.js +25 -0
- package/esm/src/wow/game_data/playable_specialization.d.ts +63 -0
- package/esm/src/wow/game_data/playable_specialization.js +38 -0
- package/esm/src/wow/game_data/power_type.d.ts +22 -0
- package/esm/src/wow/game_data/power_type.js +25 -0
- package/esm/src/wow/game_data/profession.d.ts +88 -0
- package/esm/src/wow/game_data/profession.js +78 -0
- package/esm/src/wow/game_data/pvp_season.d.ts +108 -0
- package/esm/src/wow/game_data/pvp_season.js +66 -0
- package/esm/src/wow/game_data/pvp_tier.d.ts +41 -0
- package/esm/src/wow/game_data/pvp_tier.js +38 -0
- package/esm/src/wow/game_data/quest.d.ts +116 -0
- package/esm/src/wow/game_data/quest.js +100 -0
- package/esm/src/wow/game_data/realm.d.ts +43 -0
- package/esm/src/wow/game_data/realm.js +35 -0
- package/esm/src/wow/game_data/region.d.ts +26 -0
- package/esm/src/wow/game_data/region.js +25 -0
- package/esm/src/wow/game_data/reputations.d.ts +57 -0
- package/esm/src/wow/game_data/reputations.js +50 -0
- package/esm/src/wow/game_data/spell.d.ts +34 -0
- package/esm/src/wow/game_data/spell.js +36 -0
- package/esm/src/wow/game_data/talent.d.ts +143 -0
- package/esm/src/wow/game_data/talent.js +89 -0
- package/esm/src/wow/game_data/tech_talent.d.ts +72 -0
- package/esm/src/wow/game_data/tech_talent.js +63 -0
- package/esm/src/wow/game_data/title.d.ts +33 -0
- package/esm/src/wow/game_data/title.js +25 -0
- package/esm/src/wow/game_data/token.d.ts +17 -0
- package/esm/src/wow/game_data/token.js +18 -0
- package/esm/src/wow/game_data/toy.d.ts +25 -0
- package/esm/src/wow/game_data/toy.js +25 -0
- package/esm/src/wow/index.d.ts +59 -0
- package/esm/src/wow/index.js +61 -0
- package/esm/src/wow/profile/account_profile.d.ts +185 -0
- package/esm/src/wow/profile/account_profile.js +132 -0
- package/esm/src/wow/profile/character_achievements.d.ts +88 -0
- package/esm/src/wow/profile/character_achievements.js +28 -0
- package/esm/src/wow/profile/character_appearance.d.ts +79 -0
- package/esm/src/wow/profile/character_appearance.js +14 -0
- package/esm/src/wow/profile/character_collections.d.ts +132 -0
- package/esm/src/wow/profile/character_collections.js +98 -0
- package/esm/src/wow/profile/character_encounters.d.ts +78 -0
- package/esm/src/wow/profile/character_encounters.js +42 -0
- package/esm/src/wow/profile/character_equipment.d.ts +177 -0
- package/esm/src/wow/profile/character_equipment.js +14 -0
- package/esm/src/wow/profile/character_house.d.ts +16 -0
- package/esm/src/wow/profile/character_house.js +17 -0
- package/esm/src/wow/profile/character_hunter_pets.d.ts +22 -0
- package/esm/src/wow/profile/character_hunter_pets.js +14 -0
- package/esm/src/wow/profile/character_media.d.ts +14 -0
- package/esm/src/wow/profile/character_media.js +14 -0
- package/esm/src/wow/profile/character_mythic_keystone_profile.d.ts +70 -0
- package/esm/src/wow/profile/character_mythic_keystone_profile.js +31 -0
- package/esm/src/wow/profile/character_professions.d.ts +29 -0
- package/esm/src/wow/profile/character_professions.js +14 -0
- package/esm/src/wow/profile/character_profile.d.ts +83 -0
- package/esm/src/wow/profile/character_profile.js +39 -0
- package/esm/src/wow/profile/character_pvp.d.ts +53 -0
- package/esm/src/wow/profile/character_pvp.js +29 -0
- package/esm/src/wow/profile/character_quests.d.ts +29 -0
- package/esm/src/wow/profile/character_quests.js +28 -0
- package/esm/src/wow/profile/character_reputations.d.ts +30 -0
- package/esm/src/wow/profile/character_reputations.js +14 -0
- package/esm/src/wow/profile/character_soulbinds.d.ts +31 -0
- package/esm/src/wow/profile/character_soulbinds.js +14 -0
- package/esm/src/wow/profile/character_specializations.d.ts +82 -0
- package/esm/src/wow/profile/character_specializations.js +14 -0
- package/esm/src/wow/profile/character_statistics.d.ts +104 -0
- package/esm/src/wow/profile/character_statistics.js +14 -0
- package/esm/src/wow/profile/character_titles.d.ts +14 -0
- package/esm/src/wow/profile/character_titles.js +14 -0
- package/esm/src/wow/profile/guild.d.ts +150 -0
- package/esm/src/wow/profile/guild.js +56 -0
- package/esm/src/wow/search.d.ts +23 -0
- package/esm/src/wow/search.js +29 -0
- package/esm/src/wow/types.d.ts +58 -0
- package/esm/src/wow/types.js +1 -0
- package/esm/src/wow_classic/auction_house.d.ts +41 -0
- package/esm/src/wow_classic/auction_house.js +31 -0
- package/esm/src/wow_classic/character_specializations.d.ts +45 -0
- package/esm/src/wow_classic/character_specializations.js +18 -0
- package/esm/src/wow_classic/era.d.ts +8 -0
- package/esm/src/wow_classic/era.js +10 -0
- package/esm/src/wow_classic/index.d.ts +15 -0
- package/esm/src/wow_classic/index.js +17 -0
- package/esm/src/wow_classic/profile_overrides.d.ts +125 -0
- package/esm/src/wow_classic/profile_overrides.js +111 -0
- package/esm/src/wow_classic/shared.d.ts +23 -0
- package/esm/src/wow_classic/shared.js +26 -0
- package/esm/src/wow_classic/types.d.ts +3 -0
- package/esm/src/wow_classic/types.js +1 -0
- package/package.json +23 -2
- package/script/mod.d.ts +43 -6
- package/script/mod.js +91 -21
- package/script/src/client.d.ts +95 -0
- package/script/src/client.js +89 -0
- package/script/src/diablo3/community/act.d.ts +29 -0
- package/script/src/diablo3/community/act.js +27 -0
- package/script/src/diablo3/community/artisan.d.ts +50 -0
- package/script/src/diablo3/community/artisan.js +29 -0
- package/script/src/diablo3/community/follower.d.ts +25 -0
- package/script/src/diablo3/community/follower.js +15 -0
- package/script/src/diablo3/community/hero.d.ts +57 -0
- package/script/src/diablo3/community/hero.js +29 -0
- package/script/src/diablo3/community/item.d.ts +48 -0
- package/script/src/diablo3/community/item.js +15 -0
- package/script/src/diablo3/community/item_type.d.ts +26 -0
- package/script/src/diablo3/community/item_type.js +27 -0
- package/script/src/diablo3/community/profile.d.ts +352 -0
- package/script/src/diablo3/community/profile.js +67 -0
- package/script/src/diablo3/game_data/d3.d.ts +127 -0
- package/script/src/diablo3/game_data/d3.js +80 -0
- package/script/src/diablo3/index.d.ts +8 -0
- package/script/src/diablo3/index.js +31 -0
- package/script/src/diablo3/types.d.ts +8 -0
- package/script/src/diablo3/types.js +2 -0
- package/script/src/generated/diablo3_api.d.ts +156 -0
- package/script/src/generated/diablo3_api.js +3 -0
- package/script/src/generated/hearthstone_api.d.ts +51 -0
- package/script/src/generated/hearthstone_api.js +3 -0
- package/script/src/generated/sc2_api.d.ts +139 -0
- package/script/src/generated/sc2_api.js +3 -0
- package/script/src/generated/wow_api.d.ts +1482 -0
- package/script/src/generated/wow_api.js +3 -0
- package/script/src/generated/wow_classic_api.d.ts +555 -0
- package/script/src/generated/wow_classic_api.js +3 -0
- package/script/src/generated/wow_classic_era_api.d.ts +418 -0
- package/script/src/generated/wow_classic_era_api.js +3 -0
- package/script/src/hearthstone/game_data/card_backs.d.ts +31 -0
- package/script/src/hearthstone/game_data/card_backs.js +26 -0
- package/script/src/hearthstone/game_data/cards.d.ts +55 -0
- package/script/src/hearthstone/game_data/cards.js +30 -0
- package/script/src/hearthstone/game_data/decks.d.ts +29 -0
- package/script/src/hearthstone/game_data/decks.js +16 -0
- package/script/src/hearthstone/game_data/metadata.d.ts +82 -0
- package/script/src/hearthstone/game_data/metadata.js +14 -0
- package/script/src/hearthstone/index.d.ts +4 -0
- package/script/src/hearthstone/index.js +13 -0
- package/script/src/hearthstone/search.d.ts +21 -0
- package/script/src/hearthstone/search.js +31 -0
- package/script/src/hearthstone/types.d.ts +5 -0
- package/script/src/hearthstone/types.js +2 -0
- package/script/src/shared/bind.d.ts +14 -0
- package/script/src/shared/bind.js +18 -0
- package/script/src/shared/context.d.ts +163 -0
- package/script/src/shared/context.js +312 -0
- package/script/src/shared/errors.d.ts +53 -0
- package/script/src/shared/errors.js +104 -0
- package/script/src/shared/index.d.ts +4 -0
- package/script/src/shared/index.js +10 -0
- package/script/src/shared/types.d.ts +133 -0
- package/script/src/shared/types.js +3 -0
- package/script/src/starcraft2/community/account.d.ts +19 -0
- package/script/src/starcraft2/community/account.js +18 -0
- package/script/src/starcraft2/community/ladder.d.ts +29 -0
- package/script/src/starcraft2/community/ladder.js +31 -0
- package/script/src/starcraft2/community/legacy.d.ts +206 -0
- package/script/src/starcraft2/community/legacy.js +91 -0
- package/script/src/starcraft2/community/profile.d.ts +255 -0
- package/script/src/starcraft2/community/profile.js +80 -0
- package/script/src/starcraft2/game_data/league.d.ts +35 -0
- package/script/src/starcraft2/game_data/league.js +23 -0
- package/script/src/starcraft2/index.d.ts +5 -0
- package/script/src/starcraft2/index.js +23 -0
- package/script/src/starcraft2/types.d.ts +5 -0
- package/script/src/starcraft2/types.js +2 -0
- package/script/src/wow/game_data/achievement.d.ts +87 -0
- package/script/src/wow/game_data/achievement.js +75 -0
- package/script/src/wow/game_data/auction_house.d.ts +65 -0
- package/script/src/wow/game_data/auction_house.js +37 -0
- package/script/src/wow/game_data/azerite_essence.d.ts +50 -0
- package/script/src/wow/game_data/azerite_essence.js +54 -0
- package/script/src/wow/game_data/connected_realm.d.ts +62 -0
- package/script/src/wow/game_data/connected_realm.js +40 -0
- package/script/src/wow/game_data/covenant.d.ts +115 -0
- package/script/src/wow/game_data/covenant.js +97 -0
- package/script/src/wow/game_data/creature.d.ts +98 -0
- package/script/src/wow/game_data/creature.js +109 -0
- package/script/src/wow/game_data/guild_crest.d.ts +56 -0
- package/script/src/wow/game_data/guild_crest.js +43 -0
- package/script/src/wow/game_data/heirloom.d.ts +82 -0
- package/script/src/wow/game_data/heirloom.js +29 -0
- package/script/src/wow/game_data/housing.d.ts +111 -0
- package/script/src/wow/game_data/housing.js +138 -0
- package/script/src/wow/game_data/item.d.ts +183 -0
- package/script/src/wow/game_data/item.js +110 -0
- package/script/src/wow/game_data/item_appearance.d.ts +102 -0
- package/script/src/wow/game_data/item_appearance.js +81 -0
- package/script/src/wow/game_data/journal.d.ts +124 -0
- package/script/src/wow/game_data/journal.js +108 -0
- package/script/src/wow/game_data/keystone_affix.d.ts +39 -0
- package/script/src/wow/game_data/keystone_affix.js +43 -0
- package/script/src/wow/game_data/media_search.d.ts +9 -0
- package/script/src/wow/game_data/media_search.js +13 -0
- package/script/src/wow/game_data/modified_crafting.d.ts +65 -0
- package/script/src/wow/game_data/modified_crafting.js +69 -0
- package/script/src/wow/game_data/mount.d.ts +38 -0
- package/script/src/wow/game_data/mount.js +40 -0
- package/script/src/wow/game_data/mythic_keystone_dungeon.d.ts +92 -0
- package/script/src/wow/game_data/mythic_keystone_dungeon.js +96 -0
- package/script/src/wow/game_data/mythic_keystone_leaderboard.d.ts +70 -0
- package/script/src/wow/game_data/mythic_keystone_leaderboard.js +32 -0
- package/script/src/wow/game_data/mythic_raid_leaderboard.d.ts +36 -0
- package/script/src/wow/game_data/mythic_raid_leaderboard.js +17 -0
- package/script/src/wow/game_data/neighborhood.d.ts +36 -0
- package/script/src/wow/game_data/neighborhood.js +43 -0
- package/script/src/wow/game_data/pet.d.ts +93 -0
- package/script/src/wow/game_data/pet.js +84 -0
- package/script/src/wow/game_data/playable_class.d.ts +58 -0
- package/script/src/wow/game_data/playable_class.js +57 -0
- package/script/src/wow/game_data/playable_race.d.ts +31 -0
- package/script/src/wow/game_data/playable_race.js +29 -0
- package/script/src/wow/game_data/playable_specialization.d.ts +63 -0
- package/script/src/wow/game_data/playable_specialization.js +43 -0
- package/script/src/wow/game_data/power_type.d.ts +22 -0
- package/script/src/wow/game_data/power_type.js +29 -0
- package/script/src/wow/game_data/profession.d.ts +88 -0
- package/script/src/wow/game_data/profession.js +86 -0
- package/script/src/wow/game_data/pvp_season.d.ts +108 -0
- package/script/src/wow/game_data/pvp_season.js +73 -0
- package/script/src/wow/game_data/pvp_tier.d.ts +41 -0
- package/script/src/wow/game_data/pvp_tier.js +43 -0
- package/script/src/wow/game_data/quest.d.ts +116 -0
- package/script/src/wow/game_data/quest.js +110 -0
- package/script/src/wow/game_data/realm.d.ts +43 -0
- package/script/src/wow/game_data/realm.js +40 -0
- package/script/src/wow/game_data/region.d.ts +26 -0
- package/script/src/wow/game_data/region.js +29 -0
- package/script/src/wow/game_data/reputations.d.ts +57 -0
- package/script/src/wow/game_data/reputations.js +56 -0
- package/script/src/wow/game_data/spell.d.ts +34 -0
- package/script/src/wow/game_data/spell.js +41 -0
- package/script/src/wow/game_data/talent.d.ts +143 -0
- package/script/src/wow/game_data/talent.js +98 -0
- package/script/src/wow/game_data/tech_talent.d.ts +72 -0
- package/script/src/wow/game_data/tech_talent.js +70 -0
- package/script/src/wow/game_data/title.d.ts +33 -0
- package/script/src/wow/game_data/title.js +29 -0
- package/script/src/wow/game_data/token.d.ts +17 -0
- package/script/src/wow/game_data/token.js +21 -0
- package/script/src/wow/game_data/toy.d.ts +25 -0
- package/script/src/wow/game_data/toy.js +29 -0
- package/script/src/wow/index.d.ts +59 -0
- package/script/src/wow/index.js +272 -0
- package/script/src/wow/profile/account_profile.d.ts +185 -0
- package/script/src/wow/profile/account_profile.js +143 -0
- package/script/src/wow/profile/character_achievements.d.ts +88 -0
- package/script/src/wow/profile/character_achievements.js +32 -0
- package/script/src/wow/profile/character_appearance.d.ts +79 -0
- package/script/src/wow/profile/character_appearance.js +17 -0
- package/script/src/wow/profile/character_collections.d.ts +132 -0
- package/script/src/wow/profile/character_collections.js +107 -0
- package/script/src/wow/profile/character_encounters.d.ts +78 -0
- package/script/src/wow/profile/character_encounters.js +47 -0
- package/script/src/wow/profile/character_equipment.d.ts +177 -0
- package/script/src/wow/profile/character_equipment.js +17 -0
- package/script/src/wow/profile/character_house.d.ts +16 -0
- package/script/src/wow/profile/character_house.js +20 -0
- package/script/src/wow/profile/character_hunter_pets.d.ts +22 -0
- package/script/src/wow/profile/character_hunter_pets.js +17 -0
- package/script/src/wow/profile/character_media.d.ts +14 -0
- package/script/src/wow/profile/character_media.js +17 -0
- package/script/src/wow/profile/character_mythic_keystone_profile.d.ts +70 -0
- package/script/src/wow/profile/character_mythic_keystone_profile.js +35 -0
- package/script/src/wow/profile/character_professions.d.ts +29 -0
- package/script/src/wow/profile/character_professions.js +17 -0
- package/script/src/wow/profile/character_profile.d.ts +83 -0
- package/script/src/wow/profile/character_profile.js +43 -0
- package/script/src/wow/profile/character_pvp.d.ts +53 -0
- package/script/src/wow/profile/character_pvp.js +33 -0
- package/script/src/wow/profile/character_quests.d.ts +29 -0
- package/script/src/wow/profile/character_quests.js +32 -0
- package/script/src/wow/profile/character_reputations.d.ts +30 -0
- package/script/src/wow/profile/character_reputations.js +17 -0
- package/script/src/wow/profile/character_soulbinds.d.ts +31 -0
- package/script/src/wow/profile/character_soulbinds.js +17 -0
- package/script/src/wow/profile/character_specializations.d.ts +82 -0
- package/script/src/wow/profile/character_specializations.js +17 -0
- package/script/src/wow/profile/character_statistics.d.ts +104 -0
- package/script/src/wow/profile/character_statistics.js +17 -0
- package/script/src/wow/profile/character_titles.d.ts +14 -0
- package/script/src/wow/profile/character_titles.js +17 -0
- package/script/src/wow/profile/guild.d.ts +150 -0
- package/script/src/wow/profile/guild.js +62 -0
- package/script/src/wow/search.d.ts +23 -0
- package/script/src/wow/search.js +32 -0
- package/script/src/wow/types.d.ts +58 -0
- package/script/src/wow/types.js +2 -0
- package/script/src/wow_classic/auction_house.d.ts +41 -0
- package/script/src/wow_classic/auction_house.js +35 -0
- package/script/src/wow_classic/character_specializations.d.ts +45 -0
- package/script/src/wow_classic/character_specializations.js +21 -0
- package/script/src/wow_classic/era.d.ts +8 -0
- package/script/src/wow_classic/era.js +30 -0
- package/script/src/wow_classic/index.d.ts +15 -0
- package/script/src/wow_classic/index.js +55 -0
- package/script/src/wow_classic/profile_overrides.d.ts +125 -0
- package/script/src/wow_classic/profile_overrides.js +123 -0
- package/script/src/wow_classic/shared.d.ts +23 -0
- package/script/src/wow_classic/shared.js +81 -0
- package/script/src/wow_classic/types.d.ts +3 -0
- package/script/src/wow_classic/types.js +2 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -2,35 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://jsr.io/@pinta365/blizzard-api)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
TypeScript client for the Blizzard Battle.net APIs: World of Warcraft (Retail, Classic and Classic Era), Hearthstone,
|
|
6
|
+
StarCraft II and Diablo III. Runs on Deno, Node.js, Bun and in the browser.
|
|
6
7
|
|
|
7
8
|
Available as:
|
|
8
9
|
|
|
9
10
|
- ESM module: [JSR](https://jsr.io/@pinta365/blizzard-api)
|
|
10
11
|
- CommonJS module: [NPM](https://www.npmjs.com/package/@pinta365/blizzard_api)
|
|
11
12
|
|
|
12
|
-
## WORK IN PROGRESS
|
|
13
|
-
|
|
14
|
-
Let me know if you want certain APIs to be prioritized. Currently only supports client credentials flow but the plan is
|
|
15
|
-
to implement authorization code flow also.
|
|
16
|
-
|
|
17
13
|
### APIs implemented
|
|
18
14
|
|
|
19
|
-
| APIs
|
|
20
|
-
|
|
|
21
|
-
| **World of Warcraft:** Game Data APIs
|
|
22
|
-
| **World of Warcraft:** Profile APIs
|
|
23
|
-
|
|
|
24
|
-
| **World of Warcraft Classic:**
|
|
25
|
-
| **
|
|
26
|
-
|
|
|
27
|
-
| **
|
|
28
|
-
| **
|
|
29
|
-
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| **StarCraft II:** Community APIs | | |
|
|
33
|
-
| **StarCraft II:** Game Data APIs | ✅ | |
|
|
15
|
+
| APIs | Status | Note |
|
|
16
|
+
| ------------------------------------------- | ------ | ---------------------------------------------------- |
|
|
17
|
+
| **World of Warcraft:** Game Data APIs | ✅ | Including housing, item appearances, hero talents |
|
|
18
|
+
| **World of Warcraft:** Profile APIs | ✅ | Account profile endpoints need a user token |
|
|
19
|
+
| **World of Warcraft Classic:** Game Data | ✅ | Progression (`wowClassic`) and Era (`wowClassicEra`) |
|
|
20
|
+
| **World of Warcraft Classic:** Profile APIs | ✅ | Progression (`wowClassic`) and Era (`wowClassicEra`) |
|
|
21
|
+
| **Diablo III:** Community APIs | ✅ | Including account and hero profiles |
|
|
22
|
+
| **Diablo III:** Game Data APIs | ✅ | |
|
|
23
|
+
| **Hearthstone:** Game Data APIs | ✅ | |
|
|
24
|
+
| **StarCraft II:** Community APIs | ✅ | Including the legacy endpoints |
|
|
25
|
+
| **StarCraft II:** Game Data APIs | ✅ | |
|
|
26
|
+
|
|
27
|
+
Every endpoint is checked against the live API by the project's smoke test.
|
|
34
28
|
|
|
35
29
|
## ⚡️ Quickstart
|
|
36
30
|
|
|
@@ -38,7 +32,7 @@ to implement authorization code flow also.
|
|
|
38
32
|
|
|
39
33
|
```bash
|
|
40
34
|
# Deno
|
|
41
|
-
deno add
|
|
35
|
+
deno add jsr:@pinta365/blizzard-api
|
|
42
36
|
|
|
43
37
|
# Bun
|
|
44
38
|
bunx jsr add @pinta365/blizzard-api
|
|
@@ -50,31 +44,145 @@ npx jsr add @pinta365/blizzard-api
|
|
|
50
44
|
npm install @pinta365/blizzard_api --save
|
|
51
45
|
```
|
|
52
46
|
|
|
53
|
-
**
|
|
47
|
+
**Usage**
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
import * as blizzardAPI from "@pinta365/blizzard-api";
|
|
49
|
+
Create an API client at <https://develop.battle.net/access/clients> to get a client ID and secret.
|
|
57
50
|
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
```ts
|
|
52
|
+
import { createClient } from "@pinta365/blizzard-api";
|
|
60
53
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
const client = createClient({
|
|
55
|
+
region: "eu", // "us" | "eu" | "kr" | "tw" | "cn"
|
|
56
|
+
locale: "en_GB", // optional: defaults to the main locale of the region (us: en_US, eu: en_GB, ...)
|
|
57
|
+
clientId: "<YOUR CLIENT ID>",
|
|
58
|
+
clientSecret: "<YOUR SECRET>",
|
|
66
59
|
});
|
|
67
60
|
|
|
61
|
+
const sword = await client.wow.item(33791);
|
|
62
|
+
const realms = await client.wowClassicEra.realms();
|
|
63
|
+
const card = await client.hearthstone.fetchCard("52119-arch-villain-rafaam");
|
|
64
|
+
const season = await client.sc2.season(2);
|
|
65
|
+
const hero = await client.diablo3.heroClass("barbarian");
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The client fetches and caches the access token for you and renews it before it expires. Each client has its own
|
|
69
|
+
configuration and token, so you can use several regions or credentials side by side.
|
|
70
|
+
|
|
71
|
+
**CommonJS**
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
const { createClient } = require("@pinta365/blizzard_api");
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Games and flavors
|
|
78
|
+
|
|
79
|
+
| Client property | Game |
|
|
80
|
+
| ---------------------- | ------------------------------------------------------------- |
|
|
81
|
+
| `client.wow` | World of Warcraft (Retail) |
|
|
82
|
+
| `client.wowClassic` | WoW Classic progression (currently Mists of Pandaria Classic) |
|
|
83
|
+
| `client.wowClassicEra` | WoW Classic Era, Season of Discovery, Hardcore, Anniversary |
|
|
84
|
+
| `client.hearthstone` | Hearthstone |
|
|
85
|
+
| `client.sc2` | StarCraft II |
|
|
86
|
+
| `client.diablo3` | Diablo III |
|
|
87
|
+
|
|
88
|
+
The two Classic properties only include the endpoints Blizzard supports for that flavor.
|
|
89
|
+
|
|
90
|
+
## Response types
|
|
91
|
+
|
|
92
|
+
Every response has a TypeScript type. Import them from the entry point of the game:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import type { Mount } from "@pinta365/blizzard-api/wow";
|
|
96
|
+
import type { Card } from "@pinta365/blizzard-api/hearthstone";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Entry points: `/wow`, `/wow-classic`, `/hearthstone`, `/sc2` and `/diablo3`. The Classic clients mostly return the same
|
|
100
|
+
types as Retail (import those from `/wow`). `/wow-classic` holds the Classic-only ones, such as
|
|
101
|
+
`ClassicCharacterProfile`, where fields that only Retail returns are optional.
|
|
102
|
+
|
|
103
|
+
## Following links
|
|
104
|
+
|
|
105
|
+
Responses contain `href` links to related resources. `requestHref` fetches them with the client's token:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
const mount = await client.wow.mount(6);
|
|
109
|
+
const display = await client.requestHref(mount.creature_displays[0].key.href);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## User tokens (account profile)
|
|
113
|
+
|
|
114
|
+
The WoW account profile endpoints (`accountProfileSummary`, `protectedCharacterProfile` and the `account*Collection`
|
|
115
|
+
endpoints) need a user access token from the OAuth authorization code flow:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
// 1. Send the user to Battle.net to log in.
|
|
119
|
+
const state = crypto.randomUUID(); // store it, and check it on the redirect
|
|
120
|
+
const url = client.authorizeUrl({ redirectUri: "https://example.com/callback", scope: ["wow.profile"], state });
|
|
121
|
+
|
|
122
|
+
// 2. On your redirect URI, exchange the code for a user token.
|
|
123
|
+
const { access_token } = await client.exchangeCode({ code, redirectUri: "https://example.com/callback" });
|
|
124
|
+
|
|
125
|
+
// 3. Use a user-scoped client. It is cheap to create, and it shares the app token with its parent.
|
|
126
|
+
const user = client.forUser(access_token);
|
|
127
|
+
const profile = await user.wow.accountProfileSummary();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The redirect URI must be registered on your API client. Calling a user-scoped endpoint without a user token throws
|
|
131
|
+
`MissingUserTokenError`.
|
|
132
|
+
|
|
133
|
+
## Errors and retries
|
|
134
|
+
|
|
135
|
+
- Failed requests throw `errors.APIError`, with `statusCode` and the response body.
|
|
136
|
+
- A `401` is retried once with a fresh token.
|
|
137
|
+
- A `429 Too Many Requests` is retried up to three times, honouring `Retry-After`.
|
|
138
|
+
- A server error (`500`, `502`, `503`, `504`) is retried once.
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
import { errors } from "@pinta365/blizzard-api";
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
await client.wow.characterProfile("silvermoon", "nosuchcharacter");
|
|
145
|
+
} catch (error) {
|
|
146
|
+
if (error instanceof errors.APIError && error.statusCode === 404) {
|
|
147
|
+
// Not found
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Module-level API
|
|
153
|
+
|
|
154
|
+
The module-level API from earlier versions still works. It uses a built-in default client:
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import * as blizzardAPI from "@pinta365/blizzard-api";
|
|
158
|
+
|
|
159
|
+
blizzardAPI.setup({ region: "eu", locale: "en_GB", clientId, clientSecret });
|
|
68
160
|
const sword = await blizzardAPI.wow.item(33791);
|
|
69
|
-
console.log(sword);
|
|
70
161
|
```
|
|
71
162
|
|
|
72
|
-
|
|
163
|
+
## Upgrading from 0.4
|
|
73
164
|
|
|
74
|
-
|
|
75
|
-
|
|
165
|
+
- `wowClassic` now targets Classic **progression**. For Classic Era realms, use `wowClassicEra`.
|
|
166
|
+
- `mythicRaidLeaderboard(raid, faction)` takes a raid slug and `"alliance"` or `"horde"`, e.g. `("uldir", "alliance")`.
|
|
167
|
+
- `pvpSeasonLeaderboard(seasonId, bracket)` takes a bracket name, e.g. `"3v3"` or `"shuffle-overall"`.
|
|
168
|
+
- `wow`, `hearthstone` and the other namespaces are plain objects. Import types from the game entry points (see
|
|
169
|
+
[Response types](#response-types)).
|
|
170
|
+
- A locale is always sent: when `locale` is not set, the region's main locale is used (`us`: `en_US`, `eu`: `en_GB`,
|
|
171
|
+
`kr`: `ko_KR`, `tw`: `zh_TW`, `cn`: `zh_CN`). Localized fields (`name`, `description`, ...) are therefore always
|
|
172
|
+
strings, and the types say so. Before, omitting `locale` returned an object with every locale.
|
|
173
|
+
- Response types were checked against live responses and corrected. Fields that only some characters or flavors have are
|
|
174
|
+
now optional, so you may need to handle `undefined`.
|
|
175
|
+
- Some types were renamed to remove duplicates. For example, entries of the character collections are now
|
|
176
|
+
`CollectedMount`, `CollectedPet`, `CollectedToy` and `CollectedHeirloom`.
|
|
76
177
|
|
|
77
|
-
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
deno task test # offline unit tests
|
|
182
|
+
deno task smoke # live smoke test of every endpoint (needs .env with BLIZZARD_CLIENT_ID / BLIZZARD_CLIENT_SECRET)
|
|
183
|
+
deno task gen:api # regenerate src/generated/ after adding or changing endpoints
|
|
184
|
+
deno task check:types # check the response types against the responses saved by the smoke test (fixtures/)
|
|
185
|
+
deno task check:fields # list fields the API returns that the response types don't declare
|
|
78
186
|
```
|
|
79
187
|
|
|
80
188
|
## Issues
|
package/esm/mod.d.ts
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import * as wowClassic from "./src/wow_classic/index.js";
|
|
4
|
-
import * as hearthstone from "./src/hearthstone/index.js";
|
|
5
|
-
import * as sc2 from "./src/starcraft2/index.js";
|
|
1
|
+
import type { AuthConfig, ClientConfig } from "./src/shared/index.js";
|
|
2
|
+
import type { Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi } from "./src/client.js";
|
|
6
3
|
import * as errors from "./src/shared/errors.js";
|
|
7
|
-
export {
|
|
4
|
+
export { createClient } from "./src/client.js";
|
|
5
|
+
export type { BlizzardClient, Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi, } from "./src/client.js";
|
|
6
|
+
export type { AuthConfig, AuthorizeUrlOptions, ClientConfig, ExchangeCodeOptions, Locales, Namespaces, Regions, TokenResponse, } from "./src/shared/index.js";
|
|
7
|
+
export { errors };
|
|
8
|
+
/**
|
|
9
|
+
* Configures the default client used by the module-level API. Prefer createClient() for new code.
|
|
10
|
+
* @param {Partial<ClientConfig>} userConfig - Configuration properties to update.
|
|
11
|
+
* @throws {MissingRegionError | MissingClientIdError | MissingClientSecretError} If the resulting configuration is incomplete.
|
|
12
|
+
*/
|
|
13
|
+
export declare function setup(userConfig: Partial<ClientConfig>): void;
|
|
14
|
+
/**
|
|
15
|
+
* Obtains a client credentials access token for the default client.
|
|
16
|
+
* @param {boolean} [forceNewToken] - If true, fetches a new token even if the cached one is valid.
|
|
17
|
+
*/
|
|
18
|
+
export declare function authenticate(forceNewToken?: boolean): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the default client's current access token, or an empty string if not authenticated.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAccessToken(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a copy of the default client's token state.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAuthConfig(): AuthConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Makes an authenticated request with the default client to a full href returned in an API response.
|
|
29
|
+
* @param {string} href - The full href URL.
|
|
30
|
+
* @param {Record<string, string | number>} [qs] - Optional query string parameters to append.
|
|
31
|
+
*/
|
|
32
|
+
export declare function requestHref(href: string, qs?: Record<string, string | number>): Promise<unknown>;
|
|
33
|
+
/** World of Warcraft endpoints on the default client. */
|
|
34
|
+
export declare const wow: WowApi;
|
|
35
|
+
/** World of Warcraft Classic (progression) endpoints on the default client. */
|
|
36
|
+
export declare const wowClassic: WowClassicApi;
|
|
37
|
+
/** World of Warcraft Classic Era endpoints on the default client. */
|
|
38
|
+
export declare const wowClassicEra: WowClassicEraApi;
|
|
39
|
+
/** Hearthstone endpoints on the default client. */
|
|
40
|
+
export declare const hearthstone: HearthstoneApi;
|
|
41
|
+
/** StarCraft II endpoints on the default client. */
|
|
42
|
+
export declare const sc2: Sc2Api;
|
|
43
|
+
/** Diablo III endpoints on the default client. */
|
|
44
|
+
export declare const diablo3: Diablo3Api;
|
package/esm/mod.js
CHANGED
|
@@ -1,7 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* TS library for the Blizzard Battle.net API: World of Warcraft, World of Warcraft Classic, Hearthstone,
|
|
3
|
+
* StarCraft II and Diablo III.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { createClient } from "@pinta365/blizzard-api";
|
|
8
|
+
*
|
|
9
|
+
* const client = createClient({ region: "eu", locale: "en_GB", clientId, clientSecret });
|
|
10
|
+
* const mount = await client.wow.mount(6);
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { ApiContext, assertConfig } from "./src/shared/index.js";
|
|
16
|
+
import { clientFromContext } from "./src/client.js";
|
|
6
17
|
import * as errors from "./src/shared/errors.js";
|
|
7
|
-
export {
|
|
18
|
+
export { createClient } from "./src/client.js";
|
|
19
|
+
export { errors };
|
|
20
|
+
// Default client behind the module-level API (setup() + wow.*, hearthstone.*, ...).
|
|
21
|
+
const defaultContext = new ApiContext();
|
|
22
|
+
const defaultClient = clientFromContext(defaultContext);
|
|
23
|
+
/**
|
|
24
|
+
* Configures the default client used by the module-level API. Prefer createClient() for new code.
|
|
25
|
+
* @param {Partial<ClientConfig>} userConfig - Configuration properties to update.
|
|
26
|
+
* @throws {MissingRegionError | MissingClientIdError | MissingClientSecretError} If the resulting configuration is incomplete.
|
|
27
|
+
*/
|
|
28
|
+
export function setup(userConfig) {
|
|
29
|
+
defaultContext.configure(userConfig);
|
|
30
|
+
assertConfig({ ...defaultContext.config });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Obtains a client credentials access token for the default client.
|
|
34
|
+
* @param {boolean} [forceNewToken] - If true, fetches a new token even if the cached one is valid.
|
|
35
|
+
*/
|
|
36
|
+
export function authenticate(forceNewToken) {
|
|
37
|
+
return defaultContext.authenticate(forceNewToken);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns the default client's current access token, or an empty string if not authenticated.
|
|
41
|
+
*/
|
|
42
|
+
export function getAccessToken() {
|
|
43
|
+
return defaultContext.getAuthConfig().accessToken;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns a copy of the default client's token state.
|
|
47
|
+
*/
|
|
48
|
+
export function getAuthConfig() {
|
|
49
|
+
return defaultContext.getAuthConfig();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Makes an authenticated request with the default client to a full href returned in an API response.
|
|
53
|
+
* @param {string} href - The full href URL.
|
|
54
|
+
* @param {Record<string, string | number>} [qs] - Optional query string parameters to append.
|
|
55
|
+
*/
|
|
56
|
+
export function requestHref(href, qs) {
|
|
57
|
+
return defaultContext.requestHref(href, qs);
|
|
58
|
+
}
|
|
59
|
+
/** World of Warcraft endpoints on the default client. */
|
|
60
|
+
export const wow = defaultClient.wow;
|
|
61
|
+
/** World of Warcraft Classic (progression) endpoints on the default client. */
|
|
62
|
+
export const wowClassic = defaultClient.wowClassic;
|
|
63
|
+
/** World of Warcraft Classic Era endpoints on the default client. */
|
|
64
|
+
export const wowClassicEra = defaultClient.wowClassicEra;
|
|
65
|
+
/** Hearthstone endpoints on the default client. */
|
|
66
|
+
export const hearthstone = defaultClient.hearthstone;
|
|
67
|
+
/** StarCraft II endpoints on the default client. */
|
|
68
|
+
export const sc2 = defaultClient.sc2;
|
|
69
|
+
/** Diablo III endpoints on the default client. */
|
|
70
|
+
export const diablo3 = defaultClient.diablo3;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ApiContext } from "./shared/context.js";
|
|
2
|
+
import type { AuthConfig, AuthorizeUrlOptions, ClientConfig, ExchangeCodeOptions, TokenResponse } from "./shared/context.js";
|
|
3
|
+
import { type Bound } from "./shared/bind.js";
|
|
4
|
+
import * as wowEndpoints from "./wow/index.js";
|
|
5
|
+
import * as wowClassicEndpoints from "./wow_classic/index.js";
|
|
6
|
+
import * as wowClassicEraEndpoints from "./wow_classic/era.js";
|
|
7
|
+
import * as hearthstoneEndpoints from "./hearthstone/index.js";
|
|
8
|
+
import * as sc2Endpoints from "./starcraft2/index.js";
|
|
9
|
+
import * as diablo3Endpoints from "./diablo3/index.js";
|
|
10
|
+
import type { WowApi } from "./generated/wow_api.js";
|
|
11
|
+
import type { WowClassicApi } from "./generated/wow_classic_api.js";
|
|
12
|
+
import type { WowClassicEraApi } from "./generated/wow_classic_era_api.js";
|
|
13
|
+
import type { HearthstoneApi } from "./generated/hearthstone_api.js";
|
|
14
|
+
import type { Sc2Api } from "./generated/sc2_api.js";
|
|
15
|
+
import type { Diablo3Api } from "./generated/diablo3_api.js";
|
|
16
|
+
export type { Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi };
|
|
17
|
+
type Exact<A, B> = [keyof A] extends [keyof B] ? ([keyof B] extends [keyof A] ? ([A] extends [B] ? true : false) : false) : false;
|
|
18
|
+
type Assert<T extends true> = T;
|
|
19
|
+
export type _GeneratedApisAreCurrent = [
|
|
20
|
+
Assert<Exact<WowApi, Bound<typeof wowEndpoints>>>,
|
|
21
|
+
Assert<Exact<WowClassicApi, Bound<typeof wowClassicEndpoints>>>,
|
|
22
|
+
Assert<Exact<WowClassicEraApi, Bound<typeof wowClassicEraEndpoints>>>,
|
|
23
|
+
Assert<Exact<HearthstoneApi, Bound<typeof hearthstoneEndpoints>>>,
|
|
24
|
+
Assert<Exact<Sc2Api, Bound<typeof sc2Endpoints>>>,
|
|
25
|
+
Assert<Exact<Diablo3Api, Bound<typeof diablo3Endpoints>>>
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* A Blizzard API client with its own configuration and token state.
|
|
29
|
+
*/
|
|
30
|
+
export interface BlizzardClient {
|
|
31
|
+
/** World of Warcraft endpoints. */
|
|
32
|
+
readonly wow: WowApi;
|
|
33
|
+
/** World of Warcraft Classic (progression, e.g. Mists of Pandaria Classic) endpoints. */
|
|
34
|
+
readonly wowClassic: WowClassicApi;
|
|
35
|
+
/** World of Warcraft Classic Era endpoints (Era, Season of Discovery, Hardcore, Anniversary). */
|
|
36
|
+
readonly wowClassicEra: WowClassicEraApi;
|
|
37
|
+
/** Hearthstone endpoints. */
|
|
38
|
+
readonly hearthstone: HearthstoneApi;
|
|
39
|
+
/** StarCraft II endpoints. */
|
|
40
|
+
readonly sc2: Sc2Api;
|
|
41
|
+
/** Diablo III endpoints. */
|
|
42
|
+
readonly diablo3: Diablo3Api;
|
|
43
|
+
/** The client configuration. */
|
|
44
|
+
readonly config: Readonly<Partial<ClientConfig>>;
|
|
45
|
+
/**
|
|
46
|
+
* Obtains a client credentials access token, reusing the cached one while it is valid.
|
|
47
|
+
* Requests authenticate automatically; calling this is optional.
|
|
48
|
+
* @param {boolean} [forceNewToken] - If true, fetches a new token even if the cached one is valid.
|
|
49
|
+
*/
|
|
50
|
+
authenticate(forceNewToken?: boolean): Promise<string>;
|
|
51
|
+
/** Returns a copy of the client credentials token state. */
|
|
52
|
+
getAuthConfig(): AuthConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Makes an authenticated request to a full href returned in an API response.
|
|
55
|
+
* @param {string} href - The full href URL.
|
|
56
|
+
* @param {Record<string, string | number>} [qs] - Optional query string parameters to append.
|
|
57
|
+
*/
|
|
58
|
+
requestHref(href: string, qs?: Record<string, string | number>): Promise<unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a client that uses the given user access token for user-scoped endpoints (e.g. the WoW account profile).
|
|
61
|
+
* It shares configuration and the client credentials token with this client, so it is cheap to create per request.
|
|
62
|
+
* @param {string} userToken - A user access token, e.g. `access_token` from exchangeCode().
|
|
63
|
+
*/
|
|
64
|
+
forUser(userToken: string): BlizzardClient;
|
|
65
|
+
/**
|
|
66
|
+
* Builds the URL to send a user to for the authorization code flow.
|
|
67
|
+
* @param {AuthorizeUrlOptions} options - Redirect URI, scopes (e.g. ["wow.profile"]) and state.
|
|
68
|
+
*/
|
|
69
|
+
authorizeUrl(options: AuthorizeUrlOptions): string;
|
|
70
|
+
/**
|
|
71
|
+
* Exchanges an authorization code for a user access token.
|
|
72
|
+
* @param {ExchangeCodeOptions} options - The code and the redirect URI used to obtain it.
|
|
73
|
+
*/
|
|
74
|
+
exchangeCode(options: ExchangeCodeOptions): Promise<TokenResponse>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Wraps a context in a client object.
|
|
78
|
+
* @param {ApiContext} ctx - The context to wrap.
|
|
79
|
+
* @returns {BlizzardClient} The client.
|
|
80
|
+
*/
|
|
81
|
+
export declare function clientFromContext(ctx: ApiContext): BlizzardClient;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a Blizzard API client with its own configuration and token state.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const client = createClient({ region: "eu", locale: "en_GB", clientId, clientSecret });
|
|
88
|
+
* const mount = await client.wow.mount(6);
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param {ClientConfig} config - Region, locale and OAuth client credentials.
|
|
92
|
+
* @returns {BlizzardClient} The client.
|
|
93
|
+
* @throws {MissingRegionError | MissingClientIdError | MissingClientSecretError} If the configuration is incomplete.
|
|
94
|
+
*/
|
|
95
|
+
export declare function createClient(config: ClientConfig): BlizzardClient;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//client.ts
|
|
2
|
+
import { ApiContext, assertConfig } from "./shared/context.js";
|
|
3
|
+
import { bindAll } from "./shared/bind.js";
|
|
4
|
+
import * as wowEndpoints from "./wow/index.js";
|
|
5
|
+
import * as wowClassicEndpoints from "./wow_classic/index.js";
|
|
6
|
+
import * as wowClassicEraEndpoints from "./wow_classic/era.js";
|
|
7
|
+
import * as hearthstoneEndpoints from "./hearthstone/index.js";
|
|
8
|
+
import * as sc2Endpoints from "./starcraft2/index.js";
|
|
9
|
+
import * as diablo3Endpoints from "./diablo3/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a context in a client object.
|
|
12
|
+
* @param {ApiContext} ctx - The context to wrap.
|
|
13
|
+
* @returns {BlizzardClient} The client.
|
|
14
|
+
*/
|
|
15
|
+
export function clientFromContext(ctx) {
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
wow: bindAll(ctx, wowEndpoints),
|
|
18
|
+
wowClassic: bindAll(ctx.withNamespaceVariant("classic"), wowClassicEndpoints),
|
|
19
|
+
wowClassicEra: bindAll(ctx.withNamespaceVariant("classic1x"), wowClassicEraEndpoints),
|
|
20
|
+
// bind() keeps metadata<T> generic at runtime; the mapped Bound type cannot, so use the generated interface.
|
|
21
|
+
hearthstone: bindAll(ctx, hearthstoneEndpoints),
|
|
22
|
+
sc2: bindAll(ctx, sc2Endpoints),
|
|
23
|
+
diablo3: bindAll(ctx, diablo3Endpoints),
|
|
24
|
+
get config() {
|
|
25
|
+
return ctx.config;
|
|
26
|
+
},
|
|
27
|
+
authenticate: (forceNewToken) => ctx.authenticate(forceNewToken),
|
|
28
|
+
getAuthConfig: () => ctx.getAuthConfig(),
|
|
29
|
+
requestHref: (href, qs) => ctx.requestHref(href, qs),
|
|
30
|
+
forUser: (userToken) => clientFromContext(ctx.forUser(userToken)),
|
|
31
|
+
authorizeUrl: (options) => ctx.authorizeUrl(options),
|
|
32
|
+
exchangeCode: (options) => ctx.exchangeCode(options),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a Blizzard API client with its own configuration and token state.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const client = createClient({ region: "eu", locale: "en_GB", clientId, clientSecret });
|
|
41
|
+
* const mount = await client.wow.mount(6);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param {ClientConfig} config - Region, locale and OAuth client credentials.
|
|
45
|
+
* @returns {BlizzardClient} The client.
|
|
46
|
+
* @throws {MissingRegionError | MissingClientIdError | MissingClientSecretError} If the configuration is incomplete.
|
|
47
|
+
*/
|
|
48
|
+
export function createClient(config) {
|
|
49
|
+
const copy = { ...config };
|
|
50
|
+
assertConfig(copy);
|
|
51
|
+
return clientFromContext(new ApiContext(copy));
|
|
52
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ApiContext } from "../../shared/index.js";
|
|
2
|
+
interface Quest {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Act {
|
|
8
|
+
slug: string;
|
|
9
|
+
number: number;
|
|
10
|
+
name: string;
|
|
11
|
+
quests: Quest[];
|
|
12
|
+
}
|
|
13
|
+
export interface Acts {
|
|
14
|
+
acts: Act[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns an index of acts.
|
|
18
|
+
*
|
|
19
|
+
* @returns A promise that resolves to an object representing an index of acts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function acts(ctx: ApiContext): Promise<Acts>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a single act by ID.
|
|
24
|
+
*
|
|
25
|
+
* @param seasonId - The season for the leaderboard list.
|
|
26
|
+
* @returns A promise that resolves to an object representing the data for a single act by ID.
|
|
27
|
+
*/
|
|
28
|
+
export declare function act(ctx: ApiContext, seasonId: number): Promise<Act>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns an index of acts.
|
|
3
|
+
*
|
|
4
|
+
* @returns A promise that resolves to an object representing an index of acts.
|
|
5
|
+
*/
|
|
6
|
+
export async function acts(ctx) {
|
|
7
|
+
return await ctx.request({
|
|
8
|
+
method: "GET",
|
|
9
|
+
url: "/d3/data/act/",
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns a single act by ID.
|
|
14
|
+
*
|
|
15
|
+
* @param seasonId - The season for the leaderboard list.
|
|
16
|
+
* @returns A promise that resolves to an object representing the data for a single act by ID.
|
|
17
|
+
*/
|
|
18
|
+
export async function act(ctx, seasonId) {
|
|
19
|
+
return await ctx.request({
|
|
20
|
+
method: "GET",
|
|
21
|
+
url: `/d3/data/act/${seasonId}`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ApiContext } from "../../shared/index.js";
|
|
2
|
+
interface Item {
|
|
3
|
+
id: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
name: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
path: string;
|
|
8
|
+
}
|
|
9
|
+
interface Reagent {
|
|
10
|
+
quantity: number;
|
|
11
|
+
item: Item;
|
|
12
|
+
}
|
|
13
|
+
export interface Recipe {
|
|
14
|
+
id: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
name: string;
|
|
17
|
+
cost: number;
|
|
18
|
+
reagents: Reagent[];
|
|
19
|
+
itemProduced: Item;
|
|
20
|
+
}
|
|
21
|
+
interface Tier {
|
|
22
|
+
tier: number;
|
|
23
|
+
trainedRecipes: Recipe[];
|
|
24
|
+
taughtRecipes?: Recipe[];
|
|
25
|
+
}
|
|
26
|
+
interface Training {
|
|
27
|
+
tiers: Tier[];
|
|
28
|
+
}
|
|
29
|
+
export interface Artisan {
|
|
30
|
+
slug: string;
|
|
31
|
+
name: string;
|
|
32
|
+
portrait: string;
|
|
33
|
+
training: Training;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns a single artisan by slug.
|
|
37
|
+
*
|
|
38
|
+
* @param artisanSlug - The slug of the artisan to retrieve.
|
|
39
|
+
* @returns A promise that resolves to an object representing the data for a single artisan by slug.
|
|
40
|
+
*/
|
|
41
|
+
export declare function artisan(ctx: ApiContext, artisanSlug: string): Promise<Artisan>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a single recipe by slug for the specified artisan.
|
|
44
|
+
*
|
|
45
|
+
* @param artisanSlug - The slug of the artisan to retrieve.
|
|
46
|
+
* @param recipeSlug - The slug of the recipe to retrieve.
|
|
47
|
+
* @returns A promise that resolves to an object representing the data for a single recipe by slug for the specified artisan.
|
|
48
|
+
*/
|
|
49
|
+
export declare function artisanRecipe(ctx: ApiContext, artisanSlug: string, recipeSlug: string): Promise<Recipe>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a single artisan by slug.
|
|
3
|
+
*
|
|
4
|
+
* @param artisanSlug - The slug of the artisan to retrieve.
|
|
5
|
+
* @returns A promise that resolves to an object representing the data for a single artisan by slug.
|
|
6
|
+
*/
|
|
7
|
+
export async function artisan(ctx, artisanSlug) {
|
|
8
|
+
return await ctx.request({
|
|
9
|
+
method: "GET",
|
|
10
|
+
url: `/d3/data/artisan/${artisanSlug}`,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns a single recipe by slug for the specified artisan.
|
|
15
|
+
*
|
|
16
|
+
* @param artisanSlug - The slug of the artisan to retrieve.
|
|
17
|
+
* @param recipeSlug - The slug of the recipe to retrieve.
|
|
18
|
+
* @returns A promise that resolves to an object representing the data for a single recipe by slug for the specified artisan.
|
|
19
|
+
*/
|
|
20
|
+
export async function artisanRecipe(ctx, artisanSlug, recipeSlug) {
|
|
21
|
+
return await ctx.request({
|
|
22
|
+
method: "GET",
|
|
23
|
+
url: `/d3/data/artisan/${artisanSlug}/recipe/${recipeSlug}`,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ApiContext } from "../../shared/index.js";
|
|
2
|
+
interface FollowerSkill {
|
|
3
|
+
slug: string;
|
|
4
|
+
name: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
level: number;
|
|
7
|
+
tooltipUrl: string;
|
|
8
|
+
description: string;
|
|
9
|
+
descriptionHtml: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Follower {
|
|
12
|
+
slug: string;
|
|
13
|
+
name: string;
|
|
14
|
+
realName: string;
|
|
15
|
+
portrait: string;
|
|
16
|
+
skills: FollowerSkill[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns a single follower by slug.
|
|
20
|
+
*
|
|
21
|
+
* @param followerSlug - The slug of the follower to retrieve.
|
|
22
|
+
* @returns A promise that resolves to an object representing the data for a single follower by slug.
|
|
23
|
+
*/
|
|
24
|
+
export declare function follower(ctx: ApiContext, followerSlug: string): Promise<Follower>;
|
|
25
|
+
export {};
|