@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.
Files changed (423) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +145 -37
  3. package/esm/mod.d.ts +43 -6
  4. package/esm/mod.js +69 -6
  5. package/esm/src/client.d.ts +95 -0
  6. package/esm/src/client.js +52 -0
  7. package/esm/src/diablo3/community/act.d.ts +29 -0
  8. package/esm/src/diablo3/community/act.js +23 -0
  9. package/esm/src/diablo3/community/artisan.d.ts +50 -0
  10. package/esm/src/diablo3/community/artisan.js +25 -0
  11. package/esm/src/diablo3/community/follower.d.ts +25 -0
  12. package/esm/src/diablo3/community/follower.js +12 -0
  13. package/esm/src/diablo3/community/hero.d.ts +57 -0
  14. package/esm/src/diablo3/community/hero.js +25 -0
  15. package/esm/src/diablo3/community/item.d.ts +48 -0
  16. package/esm/src/diablo3/community/item.js +12 -0
  17. package/esm/src/diablo3/community/item_type.d.ts +26 -0
  18. package/esm/src/diablo3/community/item_type.js +23 -0
  19. package/esm/src/diablo3/community/profile.d.ts +352 -0
  20. package/esm/src/diablo3/community/profile.js +61 -0
  21. package/esm/src/diablo3/game_data/d3.d.ts +127 -0
  22. package/esm/src/diablo3/game_data/d3.js +72 -0
  23. package/esm/src/diablo3/index.d.ts +8 -0
  24. package/esm/src/diablo3/index.js +8 -0
  25. package/esm/src/diablo3/types.d.ts +8 -0
  26. package/esm/src/diablo3/types.js +1 -0
  27. package/esm/src/generated/diablo3_api.d.ts +156 -0
  28. package/esm/src/generated/diablo3_api.js +2 -0
  29. package/esm/src/generated/hearthstone_api.d.ts +51 -0
  30. package/esm/src/generated/hearthstone_api.js +2 -0
  31. package/esm/src/generated/sc2_api.d.ts +139 -0
  32. package/esm/src/generated/sc2_api.js +2 -0
  33. package/esm/src/generated/wow_api.d.ts +1482 -0
  34. package/esm/src/generated/wow_api.js +2 -0
  35. package/esm/src/generated/wow_classic_api.d.ts +555 -0
  36. package/esm/src/generated/wow_classic_api.js +2 -0
  37. package/esm/src/generated/wow_classic_era_api.d.ts +418 -0
  38. package/esm/src/generated/wow_classic_era_api.js +2 -0
  39. package/esm/src/hearthstone/game_data/card_backs.d.ts +31 -0
  40. package/esm/src/hearthstone/game_data/card_backs.js +22 -0
  41. package/esm/src/hearthstone/game_data/cards.d.ts +55 -0
  42. package/esm/src/hearthstone/game_data/cards.js +26 -0
  43. package/esm/src/hearthstone/game_data/decks.d.ts +29 -0
  44. package/esm/src/hearthstone/game_data/decks.js +13 -0
  45. package/esm/src/hearthstone/game_data/metadata.d.ts +82 -0
  46. package/esm/src/hearthstone/game_data/metadata.js +11 -0
  47. package/esm/src/hearthstone/index.d.ts +4 -0
  48. package/esm/src/hearthstone/index.js +4 -0
  49. package/esm/src/hearthstone/search.d.ts +21 -0
  50. package/esm/src/hearthstone/search.js +28 -0
  51. package/esm/src/hearthstone/types.d.ts +5 -0
  52. package/esm/src/hearthstone/types.js +1 -0
  53. package/esm/src/shared/bind.d.ts +14 -0
  54. package/esm/src/shared/bind.js +15 -0
  55. package/esm/src/shared/context.d.ts +163 -0
  56. package/esm/src/shared/context.js +304 -0
  57. package/esm/src/shared/errors.d.ts +53 -0
  58. package/esm/src/shared/errors.js +95 -0
  59. package/esm/src/shared/index.d.ts +4 -0
  60. package/esm/src/shared/index.js +2 -0
  61. package/esm/src/shared/types.d.ts +133 -0
  62. package/esm/src/shared/types.js +2 -0
  63. package/esm/src/starcraft2/community/account.d.ts +19 -0
  64. package/esm/src/starcraft2/community/account.js +15 -0
  65. package/esm/src/starcraft2/community/ladder.d.ts +29 -0
  66. package/esm/src/starcraft2/community/ladder.js +27 -0
  67. package/esm/src/starcraft2/community/legacy.d.ts +206 -0
  68. package/esm/src/starcraft2/community/legacy.js +83 -0
  69. package/esm/src/starcraft2/community/profile.d.ts +255 -0
  70. package/esm/src/starcraft2/community/profile.js +73 -0
  71. package/esm/src/starcraft2/game_data/league.d.ts +35 -0
  72. package/esm/src/starcraft2/game_data/league.js +20 -0
  73. package/esm/src/starcraft2/index.d.ts +5 -0
  74. package/esm/src/starcraft2/index.js +5 -0
  75. package/esm/src/starcraft2/types.d.ts +5 -0
  76. package/esm/src/starcraft2/types.js +1 -0
  77. package/esm/src/wow/game_data/achievement.d.ts +87 -0
  78. package/esm/src/wow/game_data/achievement.js +68 -0
  79. package/esm/src/wow/game_data/auction_house.d.ts +65 -0
  80. package/esm/src/wow/game_data/auction_house.js +33 -0
  81. package/esm/src/wow/game_data/azerite_essence.d.ts +50 -0
  82. package/esm/src/wow/game_data/azerite_essence.js +48 -0
  83. package/esm/src/wow/game_data/connected_realm.d.ts +62 -0
  84. package/esm/src/wow/game_data/connected_realm.js +35 -0
  85. package/esm/src/wow/game_data/covenant.d.ts +115 -0
  86. package/esm/src/wow/game_data/covenant.js +88 -0
  87. package/esm/src/wow/game_data/creature.d.ts +98 -0
  88. package/esm/src/wow/game_data/creature.js +99 -0
  89. package/esm/src/wow/game_data/guild_crest.d.ts +56 -0
  90. package/esm/src/wow/game_data/guild_crest.js +38 -0
  91. package/esm/src/wow/game_data/heirloom.d.ts +82 -0
  92. package/esm/src/wow/game_data/heirloom.js +25 -0
  93. package/esm/src/wow/game_data/housing.d.ts +111 -0
  94. package/esm/src/wow/game_data/housing.js +124 -0
  95. package/esm/src/wow/game_data/item.d.ts +183 -0
  96. package/esm/src/wow/game_data/item.js +100 -0
  97. package/esm/src/wow/game_data/item_appearance.d.ts +102 -0
  98. package/esm/src/wow/game_data/item_appearance.js +73 -0
  99. package/esm/src/wow/game_data/journal.d.ts +124 -0
  100. package/esm/src/wow/game_data/journal.js +98 -0
  101. package/esm/src/wow/game_data/keystone_affix.d.ts +39 -0
  102. package/esm/src/wow/game_data/keystone_affix.js +38 -0
  103. package/esm/src/wow/game_data/media_search.d.ts +9 -0
  104. package/esm/src/wow/game_data/media_search.js +10 -0
  105. package/esm/src/wow/game_data/modified_crafting.d.ts +65 -0
  106. package/esm/src/wow/game_data/modified_crafting.js +62 -0
  107. package/esm/src/wow/game_data/mount.d.ts +38 -0
  108. package/esm/src/wow/game_data/mount.js +35 -0
  109. package/esm/src/wow/game_data/mythic_keystone_dungeon.d.ts +92 -0
  110. package/esm/src/wow/game_data/mythic_keystone_dungeon.js +87 -0
  111. package/esm/src/wow/game_data/mythic_keystone_leaderboard.d.ts +70 -0
  112. package/esm/src/wow/game_data/mythic_keystone_leaderboard.js +28 -0
  113. package/esm/src/wow/game_data/mythic_raid_leaderboard.d.ts +36 -0
  114. package/esm/src/wow/game_data/mythic_raid_leaderboard.js +14 -0
  115. package/esm/src/wow/game_data/neighborhood.d.ts +36 -0
  116. package/esm/src/wow/game_data/neighborhood.js +38 -0
  117. package/esm/src/wow/game_data/pet.d.ts +93 -0
  118. package/esm/src/wow/game_data/pet.js +76 -0
  119. package/esm/src/wow/game_data/playable_class.d.ts +58 -0
  120. package/esm/src/wow/game_data/playable_class.js +51 -0
  121. package/esm/src/wow/game_data/playable_race.d.ts +31 -0
  122. package/esm/src/wow/game_data/playable_race.js +25 -0
  123. package/esm/src/wow/game_data/playable_specialization.d.ts +63 -0
  124. package/esm/src/wow/game_data/playable_specialization.js +38 -0
  125. package/esm/src/wow/game_data/power_type.d.ts +22 -0
  126. package/esm/src/wow/game_data/power_type.js +25 -0
  127. package/esm/src/wow/game_data/profession.d.ts +88 -0
  128. package/esm/src/wow/game_data/profession.js +78 -0
  129. package/esm/src/wow/game_data/pvp_season.d.ts +108 -0
  130. package/esm/src/wow/game_data/pvp_season.js +66 -0
  131. package/esm/src/wow/game_data/pvp_tier.d.ts +41 -0
  132. package/esm/src/wow/game_data/pvp_tier.js +38 -0
  133. package/esm/src/wow/game_data/quest.d.ts +116 -0
  134. package/esm/src/wow/game_data/quest.js +100 -0
  135. package/esm/src/wow/game_data/realm.d.ts +43 -0
  136. package/esm/src/wow/game_data/realm.js +35 -0
  137. package/esm/src/wow/game_data/region.d.ts +26 -0
  138. package/esm/src/wow/game_data/region.js +25 -0
  139. package/esm/src/wow/game_data/reputations.d.ts +57 -0
  140. package/esm/src/wow/game_data/reputations.js +50 -0
  141. package/esm/src/wow/game_data/spell.d.ts +34 -0
  142. package/esm/src/wow/game_data/spell.js +36 -0
  143. package/esm/src/wow/game_data/talent.d.ts +143 -0
  144. package/esm/src/wow/game_data/talent.js +89 -0
  145. package/esm/src/wow/game_data/tech_talent.d.ts +72 -0
  146. package/esm/src/wow/game_data/tech_talent.js +63 -0
  147. package/esm/src/wow/game_data/title.d.ts +33 -0
  148. package/esm/src/wow/game_data/title.js +25 -0
  149. package/esm/src/wow/game_data/token.d.ts +17 -0
  150. package/esm/src/wow/game_data/token.js +18 -0
  151. package/esm/src/wow/game_data/toy.d.ts +25 -0
  152. package/esm/src/wow/game_data/toy.js +25 -0
  153. package/esm/src/wow/index.d.ts +59 -0
  154. package/esm/src/wow/index.js +61 -0
  155. package/esm/src/wow/profile/account_profile.d.ts +185 -0
  156. package/esm/src/wow/profile/account_profile.js +132 -0
  157. package/esm/src/wow/profile/character_achievements.d.ts +88 -0
  158. package/esm/src/wow/profile/character_achievements.js +28 -0
  159. package/esm/src/wow/profile/character_appearance.d.ts +79 -0
  160. package/esm/src/wow/profile/character_appearance.js +14 -0
  161. package/esm/src/wow/profile/character_collections.d.ts +132 -0
  162. package/esm/src/wow/profile/character_collections.js +98 -0
  163. package/esm/src/wow/profile/character_encounters.d.ts +78 -0
  164. package/esm/src/wow/profile/character_encounters.js +42 -0
  165. package/esm/src/wow/profile/character_equipment.d.ts +177 -0
  166. package/esm/src/wow/profile/character_equipment.js +14 -0
  167. package/esm/src/wow/profile/character_house.d.ts +16 -0
  168. package/esm/src/wow/profile/character_house.js +17 -0
  169. package/esm/src/wow/profile/character_hunter_pets.d.ts +22 -0
  170. package/esm/src/wow/profile/character_hunter_pets.js +14 -0
  171. package/esm/src/wow/profile/character_media.d.ts +14 -0
  172. package/esm/src/wow/profile/character_media.js +14 -0
  173. package/esm/src/wow/profile/character_mythic_keystone_profile.d.ts +70 -0
  174. package/esm/src/wow/profile/character_mythic_keystone_profile.js +31 -0
  175. package/esm/src/wow/profile/character_professions.d.ts +29 -0
  176. package/esm/src/wow/profile/character_professions.js +14 -0
  177. package/esm/src/wow/profile/character_profile.d.ts +83 -0
  178. package/esm/src/wow/profile/character_profile.js +39 -0
  179. package/esm/src/wow/profile/character_pvp.d.ts +53 -0
  180. package/esm/src/wow/profile/character_pvp.js +29 -0
  181. package/esm/src/wow/profile/character_quests.d.ts +29 -0
  182. package/esm/src/wow/profile/character_quests.js +28 -0
  183. package/esm/src/wow/profile/character_reputations.d.ts +30 -0
  184. package/esm/src/wow/profile/character_reputations.js +14 -0
  185. package/esm/src/wow/profile/character_soulbinds.d.ts +31 -0
  186. package/esm/src/wow/profile/character_soulbinds.js +14 -0
  187. package/esm/src/wow/profile/character_specializations.d.ts +82 -0
  188. package/esm/src/wow/profile/character_specializations.js +14 -0
  189. package/esm/src/wow/profile/character_statistics.d.ts +104 -0
  190. package/esm/src/wow/profile/character_statistics.js +14 -0
  191. package/esm/src/wow/profile/character_titles.d.ts +14 -0
  192. package/esm/src/wow/profile/character_titles.js +14 -0
  193. package/esm/src/wow/profile/guild.d.ts +150 -0
  194. package/esm/src/wow/profile/guild.js +56 -0
  195. package/esm/src/wow/search.d.ts +23 -0
  196. package/esm/src/wow/search.js +29 -0
  197. package/esm/src/wow/types.d.ts +58 -0
  198. package/esm/src/wow/types.js +1 -0
  199. package/esm/src/wow_classic/auction_house.d.ts +41 -0
  200. package/esm/src/wow_classic/auction_house.js +31 -0
  201. package/esm/src/wow_classic/character_specializations.d.ts +45 -0
  202. package/esm/src/wow_classic/character_specializations.js +18 -0
  203. package/esm/src/wow_classic/era.d.ts +8 -0
  204. package/esm/src/wow_classic/era.js +10 -0
  205. package/esm/src/wow_classic/index.d.ts +15 -0
  206. package/esm/src/wow_classic/index.js +17 -0
  207. package/esm/src/wow_classic/profile_overrides.d.ts +125 -0
  208. package/esm/src/wow_classic/profile_overrides.js +111 -0
  209. package/esm/src/wow_classic/shared.d.ts +23 -0
  210. package/esm/src/wow_classic/shared.js +26 -0
  211. package/esm/src/wow_classic/types.d.ts +3 -0
  212. package/esm/src/wow_classic/types.js +1 -0
  213. package/package.json +23 -2
  214. package/script/mod.d.ts +43 -6
  215. package/script/mod.js +91 -21
  216. package/script/src/client.d.ts +95 -0
  217. package/script/src/client.js +89 -0
  218. package/script/src/diablo3/community/act.d.ts +29 -0
  219. package/script/src/diablo3/community/act.js +27 -0
  220. package/script/src/diablo3/community/artisan.d.ts +50 -0
  221. package/script/src/diablo3/community/artisan.js +29 -0
  222. package/script/src/diablo3/community/follower.d.ts +25 -0
  223. package/script/src/diablo3/community/follower.js +15 -0
  224. package/script/src/diablo3/community/hero.d.ts +57 -0
  225. package/script/src/diablo3/community/hero.js +29 -0
  226. package/script/src/diablo3/community/item.d.ts +48 -0
  227. package/script/src/diablo3/community/item.js +15 -0
  228. package/script/src/diablo3/community/item_type.d.ts +26 -0
  229. package/script/src/diablo3/community/item_type.js +27 -0
  230. package/script/src/diablo3/community/profile.d.ts +352 -0
  231. package/script/src/diablo3/community/profile.js +67 -0
  232. package/script/src/diablo3/game_data/d3.d.ts +127 -0
  233. package/script/src/diablo3/game_data/d3.js +80 -0
  234. package/script/src/diablo3/index.d.ts +8 -0
  235. package/script/src/diablo3/index.js +31 -0
  236. package/script/src/diablo3/types.d.ts +8 -0
  237. package/script/src/diablo3/types.js +2 -0
  238. package/script/src/generated/diablo3_api.d.ts +156 -0
  239. package/script/src/generated/diablo3_api.js +3 -0
  240. package/script/src/generated/hearthstone_api.d.ts +51 -0
  241. package/script/src/generated/hearthstone_api.js +3 -0
  242. package/script/src/generated/sc2_api.d.ts +139 -0
  243. package/script/src/generated/sc2_api.js +3 -0
  244. package/script/src/generated/wow_api.d.ts +1482 -0
  245. package/script/src/generated/wow_api.js +3 -0
  246. package/script/src/generated/wow_classic_api.d.ts +555 -0
  247. package/script/src/generated/wow_classic_api.js +3 -0
  248. package/script/src/generated/wow_classic_era_api.d.ts +418 -0
  249. package/script/src/generated/wow_classic_era_api.js +3 -0
  250. package/script/src/hearthstone/game_data/card_backs.d.ts +31 -0
  251. package/script/src/hearthstone/game_data/card_backs.js +26 -0
  252. package/script/src/hearthstone/game_data/cards.d.ts +55 -0
  253. package/script/src/hearthstone/game_data/cards.js +30 -0
  254. package/script/src/hearthstone/game_data/decks.d.ts +29 -0
  255. package/script/src/hearthstone/game_data/decks.js +16 -0
  256. package/script/src/hearthstone/game_data/metadata.d.ts +82 -0
  257. package/script/src/hearthstone/game_data/metadata.js +14 -0
  258. package/script/src/hearthstone/index.d.ts +4 -0
  259. package/script/src/hearthstone/index.js +13 -0
  260. package/script/src/hearthstone/search.d.ts +21 -0
  261. package/script/src/hearthstone/search.js +31 -0
  262. package/script/src/hearthstone/types.d.ts +5 -0
  263. package/script/src/hearthstone/types.js +2 -0
  264. package/script/src/shared/bind.d.ts +14 -0
  265. package/script/src/shared/bind.js +18 -0
  266. package/script/src/shared/context.d.ts +163 -0
  267. package/script/src/shared/context.js +312 -0
  268. package/script/src/shared/errors.d.ts +53 -0
  269. package/script/src/shared/errors.js +104 -0
  270. package/script/src/shared/index.d.ts +4 -0
  271. package/script/src/shared/index.js +10 -0
  272. package/script/src/shared/types.d.ts +133 -0
  273. package/script/src/shared/types.js +3 -0
  274. package/script/src/starcraft2/community/account.d.ts +19 -0
  275. package/script/src/starcraft2/community/account.js +18 -0
  276. package/script/src/starcraft2/community/ladder.d.ts +29 -0
  277. package/script/src/starcraft2/community/ladder.js +31 -0
  278. package/script/src/starcraft2/community/legacy.d.ts +206 -0
  279. package/script/src/starcraft2/community/legacy.js +91 -0
  280. package/script/src/starcraft2/community/profile.d.ts +255 -0
  281. package/script/src/starcraft2/community/profile.js +80 -0
  282. package/script/src/starcraft2/game_data/league.d.ts +35 -0
  283. package/script/src/starcraft2/game_data/league.js +23 -0
  284. package/script/src/starcraft2/index.d.ts +5 -0
  285. package/script/src/starcraft2/index.js +23 -0
  286. package/script/src/starcraft2/types.d.ts +5 -0
  287. package/script/src/starcraft2/types.js +2 -0
  288. package/script/src/wow/game_data/achievement.d.ts +87 -0
  289. package/script/src/wow/game_data/achievement.js +75 -0
  290. package/script/src/wow/game_data/auction_house.d.ts +65 -0
  291. package/script/src/wow/game_data/auction_house.js +37 -0
  292. package/script/src/wow/game_data/azerite_essence.d.ts +50 -0
  293. package/script/src/wow/game_data/azerite_essence.js +54 -0
  294. package/script/src/wow/game_data/connected_realm.d.ts +62 -0
  295. package/script/src/wow/game_data/connected_realm.js +40 -0
  296. package/script/src/wow/game_data/covenant.d.ts +115 -0
  297. package/script/src/wow/game_data/covenant.js +97 -0
  298. package/script/src/wow/game_data/creature.d.ts +98 -0
  299. package/script/src/wow/game_data/creature.js +109 -0
  300. package/script/src/wow/game_data/guild_crest.d.ts +56 -0
  301. package/script/src/wow/game_data/guild_crest.js +43 -0
  302. package/script/src/wow/game_data/heirloom.d.ts +82 -0
  303. package/script/src/wow/game_data/heirloom.js +29 -0
  304. package/script/src/wow/game_data/housing.d.ts +111 -0
  305. package/script/src/wow/game_data/housing.js +138 -0
  306. package/script/src/wow/game_data/item.d.ts +183 -0
  307. package/script/src/wow/game_data/item.js +110 -0
  308. package/script/src/wow/game_data/item_appearance.d.ts +102 -0
  309. package/script/src/wow/game_data/item_appearance.js +81 -0
  310. package/script/src/wow/game_data/journal.d.ts +124 -0
  311. package/script/src/wow/game_data/journal.js +108 -0
  312. package/script/src/wow/game_data/keystone_affix.d.ts +39 -0
  313. package/script/src/wow/game_data/keystone_affix.js +43 -0
  314. package/script/src/wow/game_data/media_search.d.ts +9 -0
  315. package/script/src/wow/game_data/media_search.js +13 -0
  316. package/script/src/wow/game_data/modified_crafting.d.ts +65 -0
  317. package/script/src/wow/game_data/modified_crafting.js +69 -0
  318. package/script/src/wow/game_data/mount.d.ts +38 -0
  319. package/script/src/wow/game_data/mount.js +40 -0
  320. package/script/src/wow/game_data/mythic_keystone_dungeon.d.ts +92 -0
  321. package/script/src/wow/game_data/mythic_keystone_dungeon.js +96 -0
  322. package/script/src/wow/game_data/mythic_keystone_leaderboard.d.ts +70 -0
  323. package/script/src/wow/game_data/mythic_keystone_leaderboard.js +32 -0
  324. package/script/src/wow/game_data/mythic_raid_leaderboard.d.ts +36 -0
  325. package/script/src/wow/game_data/mythic_raid_leaderboard.js +17 -0
  326. package/script/src/wow/game_data/neighborhood.d.ts +36 -0
  327. package/script/src/wow/game_data/neighborhood.js +43 -0
  328. package/script/src/wow/game_data/pet.d.ts +93 -0
  329. package/script/src/wow/game_data/pet.js +84 -0
  330. package/script/src/wow/game_data/playable_class.d.ts +58 -0
  331. package/script/src/wow/game_data/playable_class.js +57 -0
  332. package/script/src/wow/game_data/playable_race.d.ts +31 -0
  333. package/script/src/wow/game_data/playable_race.js +29 -0
  334. package/script/src/wow/game_data/playable_specialization.d.ts +63 -0
  335. package/script/src/wow/game_data/playable_specialization.js +43 -0
  336. package/script/src/wow/game_data/power_type.d.ts +22 -0
  337. package/script/src/wow/game_data/power_type.js +29 -0
  338. package/script/src/wow/game_data/profession.d.ts +88 -0
  339. package/script/src/wow/game_data/profession.js +86 -0
  340. package/script/src/wow/game_data/pvp_season.d.ts +108 -0
  341. package/script/src/wow/game_data/pvp_season.js +73 -0
  342. package/script/src/wow/game_data/pvp_tier.d.ts +41 -0
  343. package/script/src/wow/game_data/pvp_tier.js +43 -0
  344. package/script/src/wow/game_data/quest.d.ts +116 -0
  345. package/script/src/wow/game_data/quest.js +110 -0
  346. package/script/src/wow/game_data/realm.d.ts +43 -0
  347. package/script/src/wow/game_data/realm.js +40 -0
  348. package/script/src/wow/game_data/region.d.ts +26 -0
  349. package/script/src/wow/game_data/region.js +29 -0
  350. package/script/src/wow/game_data/reputations.d.ts +57 -0
  351. package/script/src/wow/game_data/reputations.js +56 -0
  352. package/script/src/wow/game_data/spell.d.ts +34 -0
  353. package/script/src/wow/game_data/spell.js +41 -0
  354. package/script/src/wow/game_data/talent.d.ts +143 -0
  355. package/script/src/wow/game_data/talent.js +98 -0
  356. package/script/src/wow/game_data/tech_talent.d.ts +72 -0
  357. package/script/src/wow/game_data/tech_talent.js +70 -0
  358. package/script/src/wow/game_data/title.d.ts +33 -0
  359. package/script/src/wow/game_data/title.js +29 -0
  360. package/script/src/wow/game_data/token.d.ts +17 -0
  361. package/script/src/wow/game_data/token.js +21 -0
  362. package/script/src/wow/game_data/toy.d.ts +25 -0
  363. package/script/src/wow/game_data/toy.js +29 -0
  364. package/script/src/wow/index.d.ts +59 -0
  365. package/script/src/wow/index.js +272 -0
  366. package/script/src/wow/profile/account_profile.d.ts +185 -0
  367. package/script/src/wow/profile/account_profile.js +143 -0
  368. package/script/src/wow/profile/character_achievements.d.ts +88 -0
  369. package/script/src/wow/profile/character_achievements.js +32 -0
  370. package/script/src/wow/profile/character_appearance.d.ts +79 -0
  371. package/script/src/wow/profile/character_appearance.js +17 -0
  372. package/script/src/wow/profile/character_collections.d.ts +132 -0
  373. package/script/src/wow/profile/character_collections.js +107 -0
  374. package/script/src/wow/profile/character_encounters.d.ts +78 -0
  375. package/script/src/wow/profile/character_encounters.js +47 -0
  376. package/script/src/wow/profile/character_equipment.d.ts +177 -0
  377. package/script/src/wow/profile/character_equipment.js +17 -0
  378. package/script/src/wow/profile/character_house.d.ts +16 -0
  379. package/script/src/wow/profile/character_house.js +20 -0
  380. package/script/src/wow/profile/character_hunter_pets.d.ts +22 -0
  381. package/script/src/wow/profile/character_hunter_pets.js +17 -0
  382. package/script/src/wow/profile/character_media.d.ts +14 -0
  383. package/script/src/wow/profile/character_media.js +17 -0
  384. package/script/src/wow/profile/character_mythic_keystone_profile.d.ts +70 -0
  385. package/script/src/wow/profile/character_mythic_keystone_profile.js +35 -0
  386. package/script/src/wow/profile/character_professions.d.ts +29 -0
  387. package/script/src/wow/profile/character_professions.js +17 -0
  388. package/script/src/wow/profile/character_profile.d.ts +83 -0
  389. package/script/src/wow/profile/character_profile.js +43 -0
  390. package/script/src/wow/profile/character_pvp.d.ts +53 -0
  391. package/script/src/wow/profile/character_pvp.js +33 -0
  392. package/script/src/wow/profile/character_quests.d.ts +29 -0
  393. package/script/src/wow/profile/character_quests.js +32 -0
  394. package/script/src/wow/profile/character_reputations.d.ts +30 -0
  395. package/script/src/wow/profile/character_reputations.js +17 -0
  396. package/script/src/wow/profile/character_soulbinds.d.ts +31 -0
  397. package/script/src/wow/profile/character_soulbinds.js +17 -0
  398. package/script/src/wow/profile/character_specializations.d.ts +82 -0
  399. package/script/src/wow/profile/character_specializations.js +17 -0
  400. package/script/src/wow/profile/character_statistics.d.ts +104 -0
  401. package/script/src/wow/profile/character_statistics.js +17 -0
  402. package/script/src/wow/profile/character_titles.d.ts +14 -0
  403. package/script/src/wow/profile/character_titles.js +17 -0
  404. package/script/src/wow/profile/guild.d.ts +150 -0
  405. package/script/src/wow/profile/guild.js +62 -0
  406. package/script/src/wow/search.d.ts +23 -0
  407. package/script/src/wow/search.js +32 -0
  408. package/script/src/wow/types.d.ts +58 -0
  409. package/script/src/wow/types.js +2 -0
  410. package/script/src/wow_classic/auction_house.d.ts +41 -0
  411. package/script/src/wow_classic/auction_house.js +35 -0
  412. package/script/src/wow_classic/character_specializations.d.ts +45 -0
  413. package/script/src/wow_classic/character_specializations.js +21 -0
  414. package/script/src/wow_classic/era.d.ts +8 -0
  415. package/script/src/wow_classic/era.js +30 -0
  416. package/script/src/wow_classic/index.d.ts +15 -0
  417. package/script/src/wow_classic/index.js +55 -0
  418. package/script/src/wow_classic/profile_overrides.d.ts +125 -0
  419. package/script/src/wow_classic/profile_overrides.js +123 -0
  420. package/script/src/wow_classic/shared.d.ts +23 -0
  421. package/script/src/wow_classic/shared.js +81 -0
  422. package/script/src/wow_classic/types.d.ts +3 -0
  423. package/script/src/wow_classic/types.js +2 -0
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _ApiContext_instances, _ApiContext_config, _ApiContext_token, _ApiContext_userToken, _ApiContext_namespaceVariant, _ApiContext_namespaceHeader, _ApiContext_send, _ApiContext_requestToken;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ApiContext = void 0;
16
+ exports.defaultLocale = defaultLocale;
17
+ exports.oauthBaseUrl = oauthBaseUrl;
18
+ exports.apiBaseUrl = apiBaseUrl;
19
+ exports.assertConfig = assertConfig;
20
+ const errors_js_1 = require("./errors.js");
21
+ /**
22
+ * Renew the token this long before it actually expires, so in-flight requests don't race the expiry.
23
+ */
24
+ const TOKEN_EXPIRY_MARGIN_MS = 60_000;
25
+ /**
26
+ * How often a request is retried after a 429 (Too Many Requests) response, and the base backoff between tries.
27
+ */
28
+ const MAX_RATE_LIMIT_RETRIES = 3;
29
+ const RATE_LIMIT_BACKOFF_MS = 1_000;
30
+ /**
31
+ * Server errors that are retried once, after a short delay.
32
+ */
33
+ const SERVER_ERROR_STATUSES = new Set([500, 502, 503, 504]);
34
+ const SERVER_ERROR_RETRY_DELAY_MS = 500;
35
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
36
+ function retryAfterMs(header) {
37
+ const seconds = header === null ? NaN : Number(header);
38
+ return Number.isFinite(seconds) && seconds >= 0 ? Math.min(seconds, 60) * 1000 : undefined;
39
+ }
40
+ const DEFAULT_LOCALES = {
41
+ us: "en_US",
42
+ eu: "en_GB",
43
+ kr: "ko_KR",
44
+ tw: "zh_TW",
45
+ cn: "zh_CN",
46
+ };
47
+ /**
48
+ * Returns the locale used when none is configured. A locale is always sent, so localized fields are plain strings.
49
+ * @param {Regions} region - The target Battle.net region.
50
+ * @returns {Locales} The default locale of the region.
51
+ */
52
+ function defaultLocale(region) {
53
+ return DEFAULT_LOCALES[region];
54
+ }
55
+ /**
56
+ * Generates the OAuth base URL based on the specified region.
57
+ * @param {Regions} region - The target Battle.net region.
58
+ * @returns {string} The OAuth base URL.
59
+ */
60
+ function oauthBaseUrl(region) {
61
+ return region === "cn" ? "https://oauth.battlenet.com.cn" : "https://oauth.battle.net";
62
+ }
63
+ /**
64
+ * Generates the base API URL based on the specified region.
65
+ * @param {Regions} region - The target Battle.net region.
66
+ * @returns {string} The constructed base API URL.
67
+ */
68
+ function apiBaseUrl(region) {
69
+ return region === "cn" ? "https://gateway.battlenet.com.cn" : `https://${region}.api.blizzard.com`;
70
+ }
71
+ /**
72
+ * Validates that a configuration has everything needed to make requests.
73
+ * @throws {MissingRegionError | MissingClientIdError | MissingClientSecretError}
74
+ */
75
+ function assertConfig(config) {
76
+ if (!config.region)
77
+ throw new errors_js_1.MissingRegionError();
78
+ if (!config.clientId)
79
+ throw new errors_js_1.MissingClientIdError();
80
+ if (!config.clientSecret)
81
+ throw new errors_js_1.MissingClientSecretError();
82
+ }
83
+ function toQueryParams(qs) {
84
+ return qs
85
+ ? Object.fromEntries(Object.entries(qs).filter(([, value]) => value !== undefined).map(([key, value]) => [key, String(value)]))
86
+ : {};
87
+ }
88
+ /**
89
+ * Holds the configuration and token state of one client and performs its requests.
90
+ * Every endpoint function takes an ApiContext as its first argument.
91
+ */
92
+ class ApiContext {
93
+ /**
94
+ * @param {Partial<ClientConfig>} config - The client configuration. Shared by reference with derived contexts.
95
+ * @param {TokenState} [token] - Token state to share (used by derived contexts).
96
+ * @param {ContextOptions} [options] - User token and namespace variant.
97
+ */
98
+ constructor(config = {}, token, options = {}) {
99
+ _ApiContext_instances.add(this);
100
+ _ApiContext_config.set(this, void 0);
101
+ _ApiContext_token.set(this, void 0);
102
+ _ApiContext_userToken.set(this, void 0);
103
+ _ApiContext_namespaceVariant.set(this, void 0);
104
+ __classPrivateFieldSet(this, _ApiContext_config, config, "f");
105
+ __classPrivateFieldSet(this, _ApiContext_token, token ?? { accessToken: "", tokenExpiration: 0 }, "f");
106
+ __classPrivateFieldSet(this, _ApiContext_userToken, options.userToken, "f");
107
+ __classPrivateFieldSet(this, _ApiContext_namespaceVariant, options.namespaceVariant, "f");
108
+ }
109
+ /**
110
+ * The current configuration (may be partial if not fully set up).
111
+ */
112
+ get config() {
113
+ return __classPrivateFieldGet(this, _ApiContext_config, "f");
114
+ }
115
+ /**
116
+ * Merges configuration into this context. Changing the region or credentials discards the cached token.
117
+ * @param {Partial<ClientConfig>} config - The configuration properties to update.
118
+ */
119
+ configure(config) {
120
+ const invalidatesToken = ["region", "clientId", "clientSecret"].some((key) => key in config && config[key] !== __classPrivateFieldGet(this, _ApiContext_config, "f")[key]);
121
+ Object.assign(__classPrivateFieldGet(this, _ApiContext_config, "f"), config);
122
+ if (invalidatesToken) {
123
+ __classPrivateFieldGet(this, _ApiContext_token, "f").accessToken = "";
124
+ __classPrivateFieldGet(this, _ApiContext_token, "f").tokenExpiration = 0;
125
+ }
126
+ }
127
+ /**
128
+ * Returns a copy of the client credentials token state.
129
+ */
130
+ getAuthConfig() {
131
+ return { accessToken: __classPrivateFieldGet(this, _ApiContext_token, "f").accessToken, tokenExpiration: __classPrivateFieldGet(this, _ApiContext_token, "f").tokenExpiration };
132
+ }
133
+ /**
134
+ * Returns a context that uses the given user access token for user-scoped endpoints
135
+ * (e.g. the WoW account profile). It shares configuration and the client credentials token with this context.
136
+ * @param {string} userToken - A user access token from the authorization code flow.
137
+ */
138
+ forUser(userToken) {
139
+ return new ApiContext(__classPrivateFieldGet(this, _ApiContext_config, "f"), __classPrivateFieldGet(this, _ApiContext_token, "f"), { userToken, namespaceVariant: __classPrivateFieldGet(this, _ApiContext_namespaceVariant, "f") });
140
+ }
141
+ /**
142
+ * Returns a context for another game version: base namespaces ("static", "dynamic", "profile") get the variant
143
+ * inserted before the region, e.g. "classic1x" turns "static" into "static-classic1x-eu".
144
+ * It shares configuration, tokens and the user token with this context.
145
+ * @param {string} namespaceVariant - The namespace variant, e.g. "classic" or "classic1x".
146
+ */
147
+ withNamespaceVariant(namespaceVariant) {
148
+ return new ApiContext(__classPrivateFieldGet(this, _ApiContext_config, "f"), __classPrivateFieldGet(this, _ApiContext_token, "f"), { userToken: __classPrivateFieldGet(this, _ApiContext_userToken, "f"), namespaceVariant });
149
+ }
150
+ /**
151
+ * Obtains a client credentials access token, reusing the cached one while it is valid.
152
+ * Concurrent callers share a single token request.
153
+ * @param {boolean} forceNewToken - If true, fetches a new token even if the cached one is valid.
154
+ * @returns {Promise<string>} The access token.
155
+ * @throws {MissingRegionError | MissingClientIdError | MissingClientSecretError} If the client is not configured.
156
+ * @throws {AuthenticationError} If there is a problem during the authentication process.
157
+ */
158
+ authenticate(forceNewToken = false) {
159
+ const config = __classPrivateFieldGet(this, _ApiContext_config, "f");
160
+ assertConfig(config);
161
+ const token = __classPrivateFieldGet(this, _ApiContext_token, "f");
162
+ if (!forceNewToken && token.accessToken && Date.now() < token.tokenExpiration - TOKEN_EXPIRY_MARGIN_MS) {
163
+ return Promise.resolve(token.accessToken);
164
+ }
165
+ if (token.pending) {
166
+ return token.pending;
167
+ }
168
+ token.pending = __classPrivateFieldGet(this, _ApiContext_instances, "m", _ApiContext_requestToken).call(this, config, "grant_type=client_credentials")
169
+ .then((data) => {
170
+ token.accessToken = data.access_token;
171
+ token.tokenExpiration = Date.now() + data.expires_in * 1000;
172
+ return token.accessToken;
173
+ })
174
+ .finally(() => {
175
+ token.pending = undefined;
176
+ });
177
+ return token.pending;
178
+ }
179
+ /**
180
+ * Builds the URL to send a user to for the authorization code flow.
181
+ * @param {AuthorizeUrlOptions} options - Redirect URI, scopes and state.
182
+ * @returns {string} The authorize URL.
183
+ */
184
+ authorizeUrl(options) {
185
+ const config = __classPrivateFieldGet(this, _ApiContext_config, "f");
186
+ assertConfig(config);
187
+ const scope = new Set(["openid", ...(options.scope ?? [])]);
188
+ const params = new URLSearchParams({
189
+ response_type: "code",
190
+ client_id: config.clientId,
191
+ redirect_uri: options.redirectUri,
192
+ scope: [...scope].join(" "),
193
+ state: options.state,
194
+ });
195
+ return `${oauthBaseUrl(config.region)}/authorize?${params}`;
196
+ }
197
+ /**
198
+ * Exchanges an authorization code for a user access token.
199
+ * @param {ExchangeCodeOptions} options - The code and the redirect URI used to obtain it.
200
+ * @returns {Promise<TokenResponse>} The token response; pass `access_token` to forUser().
201
+ * @throws {AuthenticationError} If the exchange fails.
202
+ */
203
+ exchangeCode(options) {
204
+ const config = __classPrivateFieldGet(this, _ApiContext_config, "f");
205
+ assertConfig(config);
206
+ const body = new URLSearchParams({
207
+ grant_type: "authorization_code",
208
+ code: options.code,
209
+ redirect_uri: options.redirectUri,
210
+ });
211
+ return __classPrivateFieldGet(this, _ApiContext_instances, "m", _ApiContext_requestToken).call(this, config, body.toString());
212
+ }
213
+ /**
214
+ * Makes an authenticated request to the API.
215
+ * @param {RequestOptions} requestOptions - Method, path, namespace, query string and auth mode.
216
+ * @returns {Promise<unknown>} The parsed JSON response.
217
+ * @throws {APIError} If the response is not successful.
218
+ * @throws {MissingUserTokenError} If the endpoint needs a user token and this context has none.
219
+ */
220
+ request(requestOptions) {
221
+ const config = __classPrivateFieldGet(this, _ApiContext_config, "f");
222
+ assertConfig(config);
223
+ const { url, namespace, qs, auth } = requestOptions;
224
+ const params = new URLSearchParams(toQueryParams({ locale: config.locale ?? defaultLocale(config.region), ...qs }));
225
+ const query = params.size ? `?${params}` : "";
226
+ const fullUrl = apiBaseUrl(config.region) + encodeURI(url) + query;
227
+ return __classPrivateFieldGet(this, _ApiContext_instances, "m", _ApiContext_send).call(this, fullUrl, namespace ? __classPrivateFieldGet(this, _ApiContext_instances, "m", _ApiContext_namespaceHeader).call(this, namespace, config.region) : undefined, auth === "user");
228
+ }
229
+ /**
230
+ * Makes an authenticated request to a full href returned in an API response.
231
+ * @param {string} href - The full href URL from a Blizzard API response.
232
+ * @param {Record<string, string | number>} [qs] - Optional query string parameters to append.
233
+ * @returns {Promise<unknown>} The parsed JSON response.
234
+ * @throws {APIError} If the response is not successful.
235
+ */
236
+ requestHref(href, qs) {
237
+ const config = __classPrivateFieldGet(this, _ApiContext_config, "f");
238
+ assertConfig(config);
239
+ const url = new URL(href);
240
+ for (const [key, value] of Object.entries(toQueryParams({ locale: config.locale ?? defaultLocale(config.region), ...qs }))) {
241
+ if (!url.searchParams.has(key))
242
+ url.searchParams.set(key, value);
243
+ }
244
+ // Hrefs from the API already carry their full namespace in the query string.
245
+ return __classPrivateFieldGet(this, _ApiContext_instances, "m", _ApiContext_send).call(this, url.toString(), undefined, url.pathname.startsWith("/profile/user/"));
246
+ }
247
+ }
248
+ exports.ApiContext = ApiContext;
249
+ _ApiContext_config = new WeakMap(), _ApiContext_token = new WeakMap(), _ApiContext_userToken = new WeakMap(), _ApiContext_namespaceVariant = new WeakMap(), _ApiContext_instances = new WeakSet(), _ApiContext_namespaceHeader = function _ApiContext_namespaceHeader(namespace, region) {
250
+ const isBase = namespace === "static" || namespace === "dynamic" || namespace === "profile";
251
+ return isBase && __classPrivateFieldGet(this, _ApiContext_namespaceVariant, "f")
252
+ ? `${namespace}-${__classPrivateFieldGet(this, _ApiContext_namespaceVariant, "f")}-${region}`
253
+ : `${namespace}-${region}`;
254
+ }, _ApiContext_send = async function _ApiContext_send(url, namespaceHeader, userScoped) {
255
+ if (userScoped && !__classPrivateFieldGet(this, _ApiContext_userToken, "f")) {
256
+ throw new errors_js_1.MissingUserTokenError();
257
+ }
258
+ const doFetch = async (forceNewToken) => {
259
+ const token = userScoped ? __classPrivateFieldGet(this, _ApiContext_userToken, "f") : await this.authenticate(forceNewToken);
260
+ const headers = { "Authorization": `Bearer ${token}` };
261
+ if (namespaceHeader)
262
+ headers["Battlenet-Namespace"] = namespaceHeader;
263
+ return await fetch(url, { method: "GET", headers });
264
+ };
265
+ let response = await doFetch(false);
266
+ if (response.status === 401 && !userScoped) {
267
+ // The cached token may have been revoked or expired early; retry once with a fresh one.
268
+ await response.body?.cancel();
269
+ response = await doFetch(true);
270
+ }
271
+ if (SERVER_ERROR_STATUSES.has(response.status)) {
272
+ // Transient gateway/server errors: requests are GETs, so retrying once is safe.
273
+ await response.body?.cancel();
274
+ await sleep(SERVER_ERROR_RETRY_DELAY_MS);
275
+ response = await doFetch(false);
276
+ }
277
+ for (let attempt = 1; response.status === 429 && attempt <= MAX_RATE_LIMIT_RETRIES; attempt++) {
278
+ // Rate limited: wait for Retry-After (seconds) if given, otherwise back off exponentially.
279
+ await response.body?.cancel();
280
+ await sleep(retryAfterMs(response.headers.get("Retry-After")) ?? RATE_LIMIT_BACKOFF_MS * 2 ** (attempt - 1));
281
+ response = await doFetch(false);
282
+ }
283
+ if (response.ok) {
284
+ return await response.json();
285
+ }
286
+ const text = await response.text();
287
+ let errorData = null;
288
+ try {
289
+ errorData = text ? JSON.parse(text) : null;
290
+ }
291
+ catch {
292
+ // Empty or non-JSON body (e.g. 404 with no body)
293
+ }
294
+ const statusCode = errorData?.code ?? response.status;
295
+ const errorMessage = errorData
296
+ ? JSON.stringify(errorData)
297
+ : response.statusText || "Problem fetching data from API";
298
+ throw new errors_js_1.APIError(errorMessage, statusCode, response.statusText);
299
+ }, _ApiContext_requestToken = async function _ApiContext_requestToken(config, body) {
300
+ const response = await fetch(`${oauthBaseUrl(config.region)}/token`, {
301
+ method: "POST",
302
+ headers: {
303
+ "Authorization": "Basic " + btoa(`${config.clientId}:${config.clientSecret}`),
304
+ "Content-Type": "application/x-www-form-urlencoded",
305
+ },
306
+ body,
307
+ });
308
+ if (!response.ok) {
309
+ throw new errors_js_1.AuthenticationError("Problem with Authentication", response.status, await response.text());
310
+ }
311
+ return await response.json();
312
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Custom error class representing an API error.
3
+ * @class
4
+ * @extends {Error}
5
+ */
6
+ export declare class APIError extends Error {
7
+ statusCode: number;
8
+ responseBody: string;
9
+ constructor(message: string, statusCode: number, responseBody: string);
10
+ }
11
+ /**
12
+ * Custom error class representing an Authentication error.
13
+ * @class
14
+ * @extends {Error}
15
+ */
16
+ export declare class AuthenticationError extends Error {
17
+ statusCode: number;
18
+ responseBody: string;
19
+ constructor(message: string, statusCode: number, responseBody: string);
20
+ }
21
+ /**
22
+ * Custom error class representing a missing client id error.
23
+ * @class
24
+ * @extends {Error}
25
+ */
26
+ export declare class MissingClientIdError extends Error {
27
+ constructor();
28
+ }
29
+ /**
30
+ * Custom error class representing a missing client secret error.
31
+ * @class
32
+ * @extends {Error}
33
+ */
34
+ export declare class MissingClientSecretError extends Error {
35
+ constructor();
36
+ }
37
+ /**
38
+ * Custom error class representing a missing api region error.
39
+ * @class
40
+ * @extends {Error}
41
+ */
42
+ export declare class MissingRegionError extends Error {
43
+ constructor();
44
+ }
45
+ /**
46
+ * Custom error class representing a missing user access token, needed for user-scoped endpoints
47
+ * such as the WoW account profile. Obtain one with the authorization code flow and use client.forUser(token).
48
+ * @class
49
+ * @extends {Error}
50
+ */
51
+ export declare class MissingUserTokenError extends Error {
52
+ constructor();
53
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MissingUserTokenError = exports.MissingRegionError = exports.MissingClientSecretError = exports.MissingClientIdError = exports.AuthenticationError = exports.APIError = void 0;
4
+ /**
5
+ * Custom error class representing an API error.
6
+ * @class
7
+ * @extends {Error}
8
+ */
9
+ class APIError extends Error {
10
+ constructor(message, statusCode, responseBody) {
11
+ super(message);
12
+ Object.defineProperty(this, "statusCode", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ Object.defineProperty(this, "responseBody", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: void 0
23
+ });
24
+ this.name = "APIError";
25
+ this.statusCode = statusCode;
26
+ this.responseBody = responseBody;
27
+ }
28
+ }
29
+ exports.APIError = APIError;
30
+ /**
31
+ * Custom error class representing an Authentication error.
32
+ * @class
33
+ * @extends {Error}
34
+ */
35
+ class AuthenticationError extends Error {
36
+ constructor(message, statusCode, responseBody) {
37
+ super(message);
38
+ Object.defineProperty(this, "statusCode", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: void 0
43
+ });
44
+ Object.defineProperty(this, "responseBody", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: void 0
49
+ });
50
+ this.name = "AuthenticationError";
51
+ this.statusCode = statusCode;
52
+ this.responseBody = responseBody;
53
+ }
54
+ }
55
+ exports.AuthenticationError = AuthenticationError;
56
+ /**
57
+ * Custom error class representing a missing client id error.
58
+ * @class
59
+ * @extends {Error}
60
+ */
61
+ class MissingClientIdError extends Error {
62
+ constructor() {
63
+ super("Client Id must be setup. Check documentation");
64
+ this.name = "MissingClientIdError";
65
+ }
66
+ }
67
+ exports.MissingClientIdError = MissingClientIdError;
68
+ /**
69
+ * Custom error class representing a missing client secret error.
70
+ * @class
71
+ * @extends {Error}
72
+ */
73
+ class MissingClientSecretError extends Error {
74
+ constructor() {
75
+ super("Client Secret must be setup. Check documentation");
76
+ this.name = "MissingClientSecretError";
77
+ }
78
+ }
79
+ exports.MissingClientSecretError = MissingClientSecretError;
80
+ /**
81
+ * Custom error class representing a missing api region error.
82
+ * @class
83
+ * @extends {Error}
84
+ */
85
+ class MissingRegionError extends Error {
86
+ constructor() {
87
+ super("Api region must be setup. Check documentation");
88
+ this.name = "MissingRegionError";
89
+ }
90
+ }
91
+ exports.MissingRegionError = MissingRegionError;
92
+ /**
93
+ * Custom error class representing a missing user access token, needed for user-scoped endpoints
94
+ * such as the WoW account profile. Obtain one with the authorization code flow and use client.forUser(token).
95
+ * @class
96
+ * @extends {Error}
97
+ */
98
+ class MissingUserTokenError extends Error {
99
+ constructor() {
100
+ super("This endpoint requires a user access token. Use client.forUser(token). Check documentation");
101
+ this.name = "MissingUserTokenError";
102
+ }
103
+ }
104
+ exports.MissingUserTokenError = MissingUserTokenError;
@@ -0,0 +1,4 @@
1
+ export { apiBaseUrl, ApiContext, assertConfig, oauthBaseUrl } from "./context.js";
2
+ export type { AuthConfig, AuthorizeUrlOptions, ClientConfig, ExchangeCodeOptions, TokenResponse } from "./context.js";
3
+ export { bindAll, type Bound } from "./bind.js";
4
+ export type { Asset, Character, Href, KeyId, KeyName, KeyNameId, LinkSelfHref, Locales, LocalizedString, NamedRef, NameId, Namespaces, Regions, RequestOptions, TypeName, } from "./types.js";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bindAll = exports.oauthBaseUrl = exports.assertConfig = exports.ApiContext = exports.apiBaseUrl = void 0;
4
+ var context_js_1 = require("./context.js");
5
+ Object.defineProperty(exports, "apiBaseUrl", { enumerable: true, get: function () { return context_js_1.apiBaseUrl; } });
6
+ Object.defineProperty(exports, "ApiContext", { enumerable: true, get: function () { return context_js_1.ApiContext; } });
7
+ Object.defineProperty(exports, "assertConfig", { enumerable: true, get: function () { return context_js_1.assertConfig; } });
8
+ Object.defineProperty(exports, "oauthBaseUrl", { enumerable: true, get: function () { return context_js_1.oauthBaseUrl; } });
9
+ var bind_js_1 = require("./bind.js");
10
+ Object.defineProperty(exports, "bindAll", { enumerable: true, get: function () { return bind_js_1.bindAll; } });
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Represents the configuration options for an API request.
3
+ * @property {string} method - The HTTP method to use (currently restricted to "GET").
4
+ * @property {string} url - The API endpoint path.
5
+ * @property {Namespaces} [namespace] - The optional Battle.net namespace for the request.
6
+ * @property {Record<string, string | number>} [qs] - An optional object for query string parameters.
7
+ * @property {"user"} [auth] - Set to "user" for endpoints that require a user access token (authorization code flow).
8
+ */
9
+ export interface RequestOptions {
10
+ method: "GET";
11
+ url: string;
12
+ namespace?: Namespaces;
13
+ qs?: Record<string, string | number>;
14
+ auth?: "user";
15
+ }
16
+ /**
17
+ * Supported Battle.net regions.
18
+ */
19
+ export type Regions = "us" | "eu" | "kr" | "tw" | "cn";
20
+ /**
21
+ * Supported locales for data.
22
+ */
23
+ export type Locales = "en_US" | "es_MX" | "pt_BR" | "en_GB" | "es_ES" | "fr_FR" | "ru_RU" | "de_DE" | "pt_PT" | "it_IT" | "ko_KR" | "zh_TW" | "zh_CN";
24
+ /**
25
+ * Available Battle.net namespaces.
26
+ */
27
+ export type Namespaces = "static" | "dynamic" | "profile" | //Retail
28
+ "static-classic1x" | "dynamic-classic1x" | "profile-classic1x" | //Classic
29
+ "static-classic" | "dynamic-classic" | "profile-classic";
30
+ /**
31
+ * Represents a reference (link) with a URL.
32
+ */
33
+ export interface Href {
34
+ /**
35
+ * The URL or address of the reference.
36
+ */
37
+ href: string;
38
+ }
39
+ /**
40
+ * Represents the self link found at the top of most API responses.
41
+ */
42
+ export interface LinkSelfHref {
43
+ _links: {
44
+ self: Href;
45
+ };
46
+ }
47
+ /**
48
+ * Represents localized text. The client always sends a locale (the configured one, or the region's default), so
49
+ * localized fields are plain strings.
50
+ */
51
+ export type LocalizedString = string;
52
+ /**
53
+ * Represents an object with a key (link), ID and LocalizedString name.
54
+ */
55
+ export interface KeyNameId {
56
+ key: {
57
+ href: string;
58
+ };
59
+ name: LocalizedString;
60
+ id: number;
61
+ }
62
+ /**
63
+ * Represents a reference to another resource: a key (link), a name and an ID.
64
+ */
65
+ export interface NamedRef {
66
+ key: Href;
67
+ name: string;
68
+ id: number;
69
+ }
70
+ /**
71
+ * Represents an object with a key (link) and LocalizedString name.
72
+ */
73
+ export interface KeyName {
74
+ key: {
75
+ href: string;
76
+ };
77
+ name: LocalizedString;
78
+ }
79
+ /**
80
+ * Represents an object with a key (link) and ID.
81
+ */
82
+ export interface KeyId {
83
+ key: {
84
+ href: string;
85
+ };
86
+ id: number;
87
+ }
88
+ /**
89
+ * Represents an object with LocalizedString name and ID.
90
+ */
91
+ export interface NameId {
92
+ name: LocalizedString;
93
+ id: number;
94
+ }
95
+ /**
96
+ * Represents an object with a type and a LocalizedString name.
97
+ */
98
+ export interface TypeName {
99
+ type: string;
100
+ name: LocalizedString;
101
+ }
102
+ /**
103
+ * Represents a character profile.
104
+ */
105
+ export interface Character {
106
+ key?: {
107
+ href: string;
108
+ };
109
+ name: string;
110
+ id: number;
111
+ realm: {
112
+ key: {
113
+ href: string;
114
+ };
115
+ name: LocalizedString;
116
+ id: number;
117
+ slug: string;
118
+ };
119
+ level?: number;
120
+ playable_class?: KeyId;
121
+ playable_race?: KeyId;
122
+ }
123
+ /**
124
+ * Represents a generic asset within a system.
125
+ * @property {string} key - A unique identifier for the asset.
126
+ * @property {string} value - The value associated with the asset.
127
+ * @property {number} [file_data_id] - (Optional) The ID of the file data associated with the asset (if any).
128
+ */
129
+ export interface Asset {
130
+ key: string;
131
+ value: string;
132
+ file_data_id?: number;
133
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ //types.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This module provides the StarCraft II account endpoint (player) using the Blizzard API.
3
+ */
4
+ import type { ApiContext } from "../../shared/index.js";
5
+ export interface Sc2Player {
6
+ name: string;
7
+ profileUrl: string;
8
+ avatarUrl: string;
9
+ profileId: string;
10
+ regionId: number;
11
+ realmId: number;
12
+ }
13
+ /**
14
+ * Returns the StarCraft II players linked to an account.
15
+ *
16
+ * @param accountId - The unique identifier for the account.
17
+ * @returns A promise that resolves to an array of players linked to the account.
18
+ */
19
+ export declare function player(ctx: ApiContext, accountId: number): Promise<Sc2Player[]>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * This module provides the StarCraft II account endpoint (player) using the Blizzard API.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.player = player;
7
+ /**
8
+ * Returns the StarCraft II players linked to an account.
9
+ *
10
+ * @param accountId - The unique identifier for the account.
11
+ * @returns A promise that resolves to an array of players linked to the account.
12
+ */
13
+ async function player(ctx, accountId) {
14
+ return await ctx.request({
15
+ method: "GET",
16
+ url: `/sc2/player/${accountId}`,
17
+ });
18
+ }