@pinta365/blizzard_api 0.3.6 → 0.3.9

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 (278) hide show
  1. package/README.md +1 -0
  2. package/esm/mod.d.ts +4 -2
  3. package/esm/mod.js +4 -2
  4. package/package.json +1 -1
  5. package/script/mod.d.ts +4 -2
  6. package/script/mod.js +8 -1
  7. package/esm/src/hearthstone/game_data/card_backs.d.ts +0 -22
  8. package/esm/src/hearthstone/game_data/card_backs.js +0 -23
  9. package/esm/src/hearthstone/game_data/cards.d.ts +0 -37
  10. package/esm/src/hearthstone/game_data/cards.js +0 -27
  11. package/esm/src/hearthstone/game_data/decks.d.ts +0 -88
  12. package/esm/src/hearthstone/game_data/decks.js +0 -14
  13. package/esm/src/hearthstone/game_data/metadata.d.ts +0 -95
  14. package/esm/src/hearthstone/game_data/metadata.js +0 -12
  15. package/esm/src/hearthstone/index.d.ts +0 -4
  16. package/esm/src/hearthstone/index.js +0 -4
  17. package/esm/src/hearthstone/search.d.ts +0 -20
  18. package/esm/src/hearthstone/search.js +0 -29
  19. package/esm/src/shared/auth.d.ts +0 -24
  20. package/esm/src/shared/auth.js +0 -58
  21. package/esm/src/shared/config.d.ts +0 -40
  22. package/esm/src/shared/config.js +0 -48
  23. package/esm/src/shared/errors.d.ts +0 -44
  24. package/esm/src/shared/errors.js +0 -83
  25. package/esm/src/shared/index.d.ts +0 -4
  26. package/esm/src/shared/index.js +0 -3
  27. package/esm/src/shared/request.d.ts +0 -13
  28. package/esm/src/shared/request.js +0 -43
  29. package/esm/src/shared/types.d.ts +0 -120
  30. package/esm/src/shared/types.js +0 -2
  31. package/esm/src/starcraft2/game_data/league.d.ts +0 -32
  32. package/esm/src/starcraft2/game_data/league.js +0 -21
  33. package/esm/src/starcraft2/index.d.ts +0 -1
  34. package/esm/src/starcraft2/index.js +0 -1
  35. package/esm/src/wow/game_data/achievement.d.ts +0 -84
  36. package/esm/src/wow/game_data/achievement.js +0 -69
  37. package/esm/src/wow/game_data/auction_house.d.ts +0 -64
  38. package/esm/src/wow/game_data/auction_house.js +0 -34
  39. package/esm/src/wow/game_data/azerite_essence.d.ts +0 -49
  40. package/esm/src/wow/game_data/azerite_essence.js +0 -49
  41. package/esm/src/wow/game_data/connected_realm.d.ts +0 -54
  42. package/esm/src/wow/game_data/connected_realm.js +0 -36
  43. package/esm/src/wow/game_data/covenant.d.ts +0 -108
  44. package/esm/src/wow/game_data/covenant.js +0 -89
  45. package/esm/src/wow/game_data/creature.d.ts +0 -97
  46. package/esm/src/wow/game_data/creature.js +0 -100
  47. package/esm/src/wow/game_data/guild_crest.d.ts +0 -55
  48. package/esm/src/wow/game_data/guild_crest.js +0 -39
  49. package/esm/src/wow/game_data/heirloom.d.ts +0 -79
  50. package/esm/src/wow/game_data/heirloom.js +0 -26
  51. package/esm/src/wow/game_data/item.d.ts +0 -166
  52. package/esm/src/wow/game_data/item.js +0 -101
  53. package/esm/src/wow/game_data/journal.d.ts +0 -121
  54. package/esm/src/wow/game_data/journal.js +0 -99
  55. package/esm/src/wow/game_data/keystone_affix.d.ts +0 -34
  56. package/esm/src/wow/game_data/keystone_affix.js +0 -39
  57. package/esm/src/wow/game_data/media_search.d.ts +0 -8
  58. package/esm/src/wow/game_data/media_search.js +0 -10
  59. package/esm/src/wow/game_data/modified_crafting.d.ts +0 -56
  60. package/esm/src/wow/game_data/modified_crafting.js +0 -63
  61. package/esm/src/wow/game_data/mount.d.ts +0 -30
  62. package/esm/src/wow/game_data/mount.js +0 -30
  63. package/esm/src/wow/game_data/mythic_keystone_dungeon.d.ts +0 -91
  64. package/esm/src/wow/game_data/mythic_keystone_dungeon.js +0 -88
  65. package/esm/src/wow/game_data/mythic_keystone_leaderboard.d.ts +0 -58
  66. package/esm/src/wow/game_data/mythic_keystone_leaderboard.js +0 -29
  67. package/esm/src/wow/game_data/mythic_raid_leaderboard.d.ts +0 -31
  68. package/esm/src/wow/game_data/mythic_raid_leaderboard.js +0 -15
  69. package/esm/src/wow/game_data/pet.d.ts +0 -91
  70. package/esm/src/wow/game_data/pet.js +0 -77
  71. package/esm/src/wow/game_data/playable_class.d.ts +0 -57
  72. package/esm/src/wow/game_data/playable_class.js +0 -52
  73. package/esm/src/wow/game_data/playable_race.d.ts +0 -29
  74. package/esm/src/wow/game_data/playable_race.js +0 -26
  75. package/esm/src/wow/game_data/power_type.d.ts +0 -21
  76. package/esm/src/wow/game_data/power_type.js +0 -26
  77. package/esm/src/wow/game_data/profession.d.ts +0 -85
  78. package/esm/src/wow/game_data/profession.js +0 -79
  79. package/esm/src/wow/game_data/pvp_season.d.ts +0 -99
  80. package/esm/src/wow/game_data/pvp_season.js +0 -66
  81. package/esm/src/wow/game_data/pvp_tier.d.ts +0 -40
  82. package/esm/src/wow/game_data/pvp_tier.js +0 -39
  83. package/esm/src/wow/game_data/quest.d.ts +0 -114
  84. package/esm/src/wow/game_data/quest.js +0 -101
  85. package/esm/src/wow/game_data/realm.d.ts +0 -42
  86. package/esm/src/wow/game_data/realm.js +0 -36
  87. package/esm/src/wow/game_data/region.d.ts +0 -24
  88. package/esm/src/wow/game_data/region.js +0 -26
  89. package/esm/src/wow/game_data/reputations.d.ts +0 -50
  90. package/esm/src/wow/game_data/reputations.js +0 -51
  91. package/esm/src/wow/game_data/spell.d.ts +0 -33
  92. package/esm/src/wow/game_data/spell.js +0 -37
  93. package/esm/src/wow/game_data/talent.d.ts +0 -129
  94. package/esm/src/wow/game_data/talent.js +0 -90
  95. package/esm/src/wow/game_data/tech_talent.d.ts +0 -70
  96. package/esm/src/wow/game_data/tech_talent.js +0 -64
  97. package/esm/src/wow/game_data/title.d.ts +0 -25
  98. package/esm/src/wow/game_data/title.js +0 -26
  99. package/esm/src/wow/game_data/token.d.ts +0 -16
  100. package/esm/src/wow/game_data/token.js +0 -19
  101. package/esm/src/wow/game_data/toy.d.ts +0 -24
  102. package/esm/src/wow/game_data/toy.js +0 -26
  103. package/esm/src/wow/index.d.ts +0 -53
  104. package/esm/src/wow/index.js +0 -55
  105. package/esm/src/wow/profile/character_achievements.d.ts +0 -87
  106. package/esm/src/wow/profile/character_achievements.js +0 -29
  107. package/esm/src/wow/profile/character_appearance.d.ts +0 -75
  108. package/esm/src/wow/profile/character_appearance.js +0 -15
  109. package/esm/src/wow/profile/character_collections.d.ts +0 -92
  110. package/esm/src/wow/profile/character_collections.js +0 -71
  111. package/esm/src/wow/profile/character_encounters.d.ts +0 -77
  112. package/esm/src/wow/profile/character_encounters.js +0 -43
  113. package/esm/src/wow/profile/character_equipment.d.ts +0 -132
  114. package/esm/src/wow/profile/character_equipment.js +0 -15
  115. package/esm/src/wow/profile/character_hunter_pets.d.ts +0 -21
  116. package/esm/src/wow/profile/character_hunter_pets.js +0 -15
  117. package/esm/src/wow/profile/character_media.d.ts +0 -13
  118. package/esm/src/wow/profile/character_media.js +0 -15
  119. package/esm/src/wow/profile/character_mythic_keystone_profile.d.ts +0 -58
  120. package/esm/src/wow/profile/character_mythic_keystone_profile.js +0 -32
  121. package/esm/src/wow/profile/character_professions.d.ts +0 -26
  122. package/esm/src/wow/profile/character_professions.js +0 -15
  123. package/esm/src/wow/profile/character_profile.d.ts +0 -82
  124. package/esm/src/wow/profile/character_profile.js +0 -40
  125. package/esm/src/wow/profile/character_pvp.d.ts +0 -51
  126. package/esm/src/wow/profile/character_pvp.js +0 -30
  127. package/esm/src/wow/profile/character_quests.d.ts +0 -28
  128. package/esm/src/wow/profile/character_quests.js +0 -29
  129. package/esm/src/wow/profile/character_reputations.d.ts +0 -22
  130. package/esm/src/wow/profile/character_reputations.js +0 -15
  131. package/esm/src/wow/profile/character_soulbinds.d.ts +0 -30
  132. package/esm/src/wow/profile/character_soulbinds.js +0 -15
  133. package/esm/src/wow/profile/character_specializations.d.ts +0 -44
  134. package/esm/src/wow/profile/character_specializations.js +0 -15
  135. package/esm/src/wow/profile/character_statistics.d.ts +0 -116
  136. package/esm/src/wow/profile/character_statistics.js +0 -15
  137. package/esm/src/wow/profile/character_titles.d.ts +0 -13
  138. package/esm/src/wow/profile/character_titles.js +0 -15
  139. package/esm/src/wow/profile/guild.d.ts +0 -117
  140. package/esm/src/wow/profile/guild.js +0 -57
  141. package/esm/src/wow/search.d.ts +0 -21
  142. package/esm/src/wow/search.js +0 -30
  143. package/script/src/hearthstone/game_data/card_backs.d.ts +0 -22
  144. package/script/src/hearthstone/game_data/card_backs.js +0 -28
  145. package/script/src/hearthstone/game_data/cards.d.ts +0 -37
  146. package/script/src/hearthstone/game_data/cards.js +0 -32
  147. package/script/src/hearthstone/game_data/decks.d.ts +0 -88
  148. package/script/src/hearthstone/game_data/decks.js +0 -18
  149. package/script/src/hearthstone/game_data/metadata.d.ts +0 -95
  150. package/script/src/hearthstone/game_data/metadata.js +0 -16
  151. package/script/src/hearthstone/index.d.ts +0 -4
  152. package/script/src/hearthstone/index.js +0 -13
  153. package/script/src/hearthstone/search.d.ts +0 -20
  154. package/script/src/hearthstone/search.js +0 -33
  155. package/script/src/shared/auth.d.ts +0 -24
  156. package/script/src/shared/auth.js +0 -63
  157. package/script/src/shared/config.d.ts +0 -40
  158. package/script/src/shared/config.js +0 -55
  159. package/script/src/shared/errors.d.ts +0 -44
  160. package/script/src/shared/errors.js +0 -91
  161. package/script/src/shared/index.d.ts +0 -4
  162. package/script/src/shared/index.js +0 -9
  163. package/script/src/shared/request.d.ts +0 -13
  164. package/script/src/shared/request.js +0 -47
  165. package/script/src/shared/types.d.ts +0 -120
  166. package/script/src/shared/types.js +0 -3
  167. package/script/src/starcraft2/game_data/league.d.ts +0 -32
  168. package/script/src/starcraft2/game_data/league.js +0 -25
  169. package/script/src/starcraft2/index.d.ts +0 -1
  170. package/script/src/starcraft2/index.js +0 -5
  171. package/script/src/wow/game_data/achievement.d.ts +0 -84
  172. package/script/src/wow/game_data/achievement.js +0 -77
  173. package/script/src/wow/game_data/auction_house.d.ts +0 -64
  174. package/script/src/wow/game_data/auction_house.js +0 -39
  175. package/script/src/wow/game_data/azerite_essence.d.ts +0 -49
  176. package/script/src/wow/game_data/azerite_essence.js +0 -56
  177. package/script/src/wow/game_data/connected_realm.d.ts +0 -54
  178. package/script/src/wow/game_data/connected_realm.js +0 -42
  179. package/script/src/wow/game_data/covenant.d.ts +0 -108
  180. package/script/src/wow/game_data/covenant.js +0 -99
  181. package/script/src/wow/game_data/creature.d.ts +0 -97
  182. package/script/src/wow/game_data/creature.js +0 -111
  183. package/script/src/wow/game_data/guild_crest.d.ts +0 -55
  184. package/script/src/wow/game_data/guild_crest.js +0 -45
  185. package/script/src/wow/game_data/heirloom.d.ts +0 -79
  186. package/script/src/wow/game_data/heirloom.js +0 -31
  187. package/script/src/wow/game_data/item.d.ts +0 -166
  188. package/script/src/wow/game_data/item.js +0 -112
  189. package/script/src/wow/game_data/journal.d.ts +0 -121
  190. package/script/src/wow/game_data/journal.js +0 -110
  191. package/script/src/wow/game_data/keystone_affix.d.ts +0 -34
  192. package/script/src/wow/game_data/keystone_affix.js +0 -45
  193. package/script/src/wow/game_data/media_search.d.ts +0 -8
  194. package/script/src/wow/game_data/media_search.js +0 -14
  195. package/script/src/wow/game_data/modified_crafting.d.ts +0 -56
  196. package/script/src/wow/game_data/modified_crafting.js +0 -71
  197. package/script/src/wow/game_data/mount.d.ts +0 -30
  198. package/script/src/wow/game_data/mount.js +0 -36
  199. package/script/src/wow/game_data/mythic_keystone_dungeon.d.ts +0 -91
  200. package/script/src/wow/game_data/mythic_keystone_dungeon.js +0 -98
  201. package/script/src/wow/game_data/mythic_keystone_leaderboard.d.ts +0 -58
  202. package/script/src/wow/game_data/mythic_keystone_leaderboard.js +0 -34
  203. package/script/src/wow/game_data/mythic_raid_leaderboard.d.ts +0 -31
  204. package/script/src/wow/game_data/mythic_raid_leaderboard.js +0 -19
  205. package/script/src/wow/game_data/pet.d.ts +0 -91
  206. package/script/src/wow/game_data/pet.js +0 -86
  207. package/script/src/wow/game_data/playable_class.d.ts +0 -57
  208. package/script/src/wow/game_data/playable_class.js +0 -59
  209. package/script/src/wow/game_data/playable_race.d.ts +0 -29
  210. package/script/src/wow/game_data/playable_race.js +0 -31
  211. package/script/src/wow/game_data/power_type.d.ts +0 -21
  212. package/script/src/wow/game_data/power_type.js +0 -31
  213. package/script/src/wow/game_data/profession.d.ts +0 -85
  214. package/script/src/wow/game_data/profession.js +0 -88
  215. package/script/src/wow/game_data/pvp_season.d.ts +0 -99
  216. package/script/src/wow/game_data/pvp_season.js +0 -74
  217. package/script/src/wow/game_data/pvp_tier.d.ts +0 -40
  218. package/script/src/wow/game_data/pvp_tier.js +0 -45
  219. package/script/src/wow/game_data/quest.d.ts +0 -114
  220. package/script/src/wow/game_data/quest.js +0 -112
  221. package/script/src/wow/game_data/realm.d.ts +0 -42
  222. package/script/src/wow/game_data/realm.js +0 -42
  223. package/script/src/wow/game_data/region.d.ts +0 -24
  224. package/script/src/wow/game_data/region.js +0 -31
  225. package/script/src/wow/game_data/reputations.d.ts +0 -50
  226. package/script/src/wow/game_data/reputations.js +0 -58
  227. package/script/src/wow/game_data/spell.d.ts +0 -33
  228. package/script/src/wow/game_data/spell.js +0 -43
  229. package/script/src/wow/game_data/talent.d.ts +0 -129
  230. package/script/src/wow/game_data/talent.js +0 -100
  231. package/script/src/wow/game_data/tech_talent.d.ts +0 -70
  232. package/script/src/wow/game_data/tech_talent.js +0 -72
  233. package/script/src/wow/game_data/title.d.ts +0 -25
  234. package/script/src/wow/game_data/title.js +0 -31
  235. package/script/src/wow/game_data/token.d.ts +0 -16
  236. package/script/src/wow/game_data/token.js +0 -23
  237. package/script/src/wow/game_data/toy.d.ts +0 -24
  238. package/script/src/wow/game_data/toy.js +0 -31
  239. package/script/src/wow/index.d.ts +0 -53
  240. package/script/src/wow/index.js +0 -228
  241. package/script/src/wow/profile/character_achievements.d.ts +0 -87
  242. package/script/src/wow/profile/character_achievements.js +0 -34
  243. package/script/src/wow/profile/character_appearance.d.ts +0 -75
  244. package/script/src/wow/profile/character_appearance.js +0 -19
  245. package/script/src/wow/profile/character_collections.d.ts +0 -92
  246. package/script/src/wow/profile/character_collections.js +0 -79
  247. package/script/src/wow/profile/character_encounters.d.ts +0 -77
  248. package/script/src/wow/profile/character_encounters.js +0 -49
  249. package/script/src/wow/profile/character_equipment.d.ts +0 -132
  250. package/script/src/wow/profile/character_equipment.js +0 -19
  251. package/script/src/wow/profile/character_hunter_pets.d.ts +0 -21
  252. package/script/src/wow/profile/character_hunter_pets.js +0 -19
  253. package/script/src/wow/profile/character_media.d.ts +0 -13
  254. package/script/src/wow/profile/character_media.js +0 -19
  255. package/script/src/wow/profile/character_mythic_keystone_profile.d.ts +0 -58
  256. package/script/src/wow/profile/character_mythic_keystone_profile.js +0 -37
  257. package/script/src/wow/profile/character_professions.d.ts +0 -26
  258. package/script/src/wow/profile/character_professions.js +0 -19
  259. package/script/src/wow/profile/character_profile.d.ts +0 -82
  260. package/script/src/wow/profile/character_profile.js +0 -45
  261. package/script/src/wow/profile/character_pvp.d.ts +0 -51
  262. package/script/src/wow/profile/character_pvp.js +0 -35
  263. package/script/src/wow/profile/character_quests.d.ts +0 -28
  264. package/script/src/wow/profile/character_quests.js +0 -34
  265. package/script/src/wow/profile/character_reputations.d.ts +0 -22
  266. package/script/src/wow/profile/character_reputations.js +0 -19
  267. package/script/src/wow/profile/character_soulbinds.d.ts +0 -30
  268. package/script/src/wow/profile/character_soulbinds.js +0 -19
  269. package/script/src/wow/profile/character_specializations.d.ts +0 -44
  270. package/script/src/wow/profile/character_specializations.js +0 -19
  271. package/script/src/wow/profile/character_statistics.d.ts +0 -116
  272. package/script/src/wow/profile/character_statistics.js +0 -19
  273. package/script/src/wow/profile/character_titles.d.ts +0 -13
  274. package/script/src/wow/profile/character_titles.js +0 -19
  275. package/script/src/wow/profile/guild.d.ts +0 -117
  276. package/script/src/wow/profile/guild.js +0 -64
  277. package/script/src/wow/search.d.ts +0 -21
  278. package/script/src/wow/search.js +0 -34
package/README.md CHANGED
@@ -22,6 +22,7 @@ to implement authorization code flow also.
22
22
  | **World of Warcraft:** Profile APIs | ✅ | |
23
23
  | | | |
24
24
  | **World of Warcraft Classic:** Game Data APIs | | |
25
+ | **World of Warcraft Classic:** Profile APIs | | |
25
26
  | | | |
26
27
  | **Diablo III:** Community APIs | ✅ | Missing profile endpoints |
27
28
  | **Diablo III:** Game Data APIs | ✅ | |
package/esm/mod.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { authenticate, setup } from "./src/shared/index.js";
1
+ import { authenticate, getAccessToken, getAuthConfig, requestHref, setup } from "./src/shared/index.js";
2
2
  import * as wow from "./src/wow/index.js";
3
+ import * as wowClassic from "./src/wow_classic/index.js";
3
4
  import * as hearthstone from "./src/hearthstone/index.js";
4
5
  import * as sc2 from "./src/starcraft2/index.js";
5
- export { authenticate, hearthstone, sc2, setup, wow };
6
+ import * as errors from "./src/shared/errors.js";
7
+ export { authenticate, errors, getAccessToken, getAuthConfig, hearthstone, requestHref, sc2, setup, wow, wowClassic };
package/esm/mod.js CHANGED
@@ -1,5 +1,7 @@
1
- import { authenticate, setup } from "./src/shared/index.js";
1
+ import { authenticate, getAccessToken, getAuthConfig, requestHref, setup } from "./src/shared/index.js";
2
2
  import * as wow from "./src/wow/index.js";
3
+ import * as wowClassic from "./src/wow_classic/index.js";
3
4
  import * as hearthstone from "./src/hearthstone/index.js";
4
5
  import * as sc2 from "./src/starcraft2/index.js";
5
- export { authenticate, hearthstone, sc2, setup, wow };
6
+ import * as errors from "./src/shared/errors.js";
7
+ export { authenticate, errors, getAccessToken, getAuthConfig, hearthstone, requestHref, sc2, setup, wow, wowClassic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinta365/blizzard_api",
3
- "version": "0.3.6",
3
+ "version": "0.3.9",
4
4
  "description": "TS library to interact with the Blizzard Battle.net API. World of Warcraft, World of Warcraft Classic, StarCraft 2, Diablo 3, Hearthstone.",
5
5
  "keywords": [
6
6
  "blizzard",
package/script/mod.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { authenticate, setup } from "./src/shared/index.js";
1
+ import { authenticate, getAccessToken, getAuthConfig, requestHref, setup } from "./src/shared/index.js";
2
2
  import * as wow from "./src/wow/index.js";
3
+ import * as wowClassic from "./src/wow_classic/index.js";
3
4
  import * as hearthstone from "./src/hearthstone/index.js";
4
5
  import * as sc2 from "./src/starcraft2/index.js";
5
- export { authenticate, hearthstone, sc2, setup, wow };
6
+ import * as errors from "./src/shared/errors.js";
7
+ export { authenticate, errors, getAccessToken, getAuthConfig, hearthstone, requestHref, sc2, setup, wow, wowClassic };
package/script/mod.js CHANGED
@@ -23,13 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.wow = exports.setup = exports.sc2 = exports.hearthstone = exports.authenticate = void 0;
26
+ exports.wowClassic = exports.wow = exports.setup = exports.sc2 = exports.requestHref = exports.hearthstone = exports.getAuthConfig = exports.getAccessToken = exports.errors = exports.authenticate = void 0;
27
27
  const index_js_1 = require("./src/shared/index.js");
28
28
  Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return index_js_1.authenticate; } });
29
+ Object.defineProperty(exports, "getAccessToken", { enumerable: true, get: function () { return index_js_1.getAccessToken; } });
30
+ Object.defineProperty(exports, "getAuthConfig", { enumerable: true, get: function () { return index_js_1.getAuthConfig; } });
31
+ Object.defineProperty(exports, "requestHref", { enumerable: true, get: function () { return index_js_1.requestHref; } });
29
32
  Object.defineProperty(exports, "setup", { enumerable: true, get: function () { return index_js_1.setup; } });
30
33
  const wow = __importStar(require("./src/wow/index.js"));
31
34
  exports.wow = wow;
35
+ const wowClassic = __importStar(require("./src/wow_classic/index.js"));
36
+ exports.wowClassic = wowClassic;
32
37
  const hearthstone = __importStar(require("./src/hearthstone/index.js"));
33
38
  exports.hearthstone = hearthstone;
34
39
  const sc2 = __importStar(require("./src/starcraft2/index.js"));
35
40
  exports.sc2 = sc2;
41
+ const errors = __importStar(require("./src/shared/errors.js"));
42
+ exports.errors = errors;
@@ -1,22 +0,0 @@
1
- import type { LocalizedString } from "../../shared/index.js";
2
- import type { Search, SearchParameters } from "../search.js";
3
- export interface Cardback {
4
- id: number;
5
- sortCategory: number;
6
- text: LocalizedString;
7
- name: LocalizedString;
8
- }
9
- /**
10
- * Returns an up-to-date list of all card backs matching the search criteria.
11
- *
12
- * @param SearchParameters - Object containing search parameters.
13
- * @returns A promise that resolves to an object representing an up-to-date list of all card backs matching the search criteria.
14
- */
15
- export declare function searchCardbacks(searchParameters: SearchParameters): Promise<Search>;
16
- /**
17
- * Returns the card back with an ID or slug that matches the one you specify.
18
- *
19
- * @param idorslug - The unique identifier for the card back by slug.
20
- * @returns A promise that resolves to an object representing details about a card back.
21
- */
22
- export declare function fetchCardback(idorslug: string): Promise<Cardback>;
@@ -1,23 +0,0 @@
1
- import { request } from "../../shared/index.js";
2
- import { search } from "../search.js";
3
- /**
4
- * Returns an up-to-date list of all card backs matching the search criteria.
5
- *
6
- * @param SearchParameters - Object containing search parameters.
7
- * @returns A promise that resolves to an object representing an up-to-date list of all card backs matching the search criteria.
8
- */
9
- export async function searchCardbacks(searchParameters) {
10
- return await search("/cardback", searchParameters);
11
- }
12
- /**
13
- * Returns the card back with an ID or slug that matches the one you specify.
14
- *
15
- * @param idorslug - The unique identifier for the card back by slug.
16
- * @returns A promise that resolves to an object representing details about a card back.
17
- */
18
- export async function fetchCardback(idorslug) {
19
- return await request({
20
- method: "GET",
21
- url: `/hearthstone/cardback/${idorslug}`,
22
- });
23
- }
@@ -1,37 +0,0 @@
1
- import type { LocalizedString } from "../../shared/index.js";
2
- import type { Search, SearchParameters } from "../search.js";
3
- export interface Card {
4
- id: number;
5
- collectible: number;
6
- slug: string;
7
- classId: number;
8
- multiClassIds: number[];
9
- cardTypeId: number;
10
- cardSetId: number;
11
- rarityId: number;
12
- artistName: string;
13
- health: number;
14
- attack: number;
15
- manaCost: number;
16
- name: LocalizedString;
17
- text: LocalizedString;
18
- image: string;
19
- imageGold: string;
20
- flavorText: LocalizedString;
21
- cropImage: string;
22
- keywordIds: number[];
23
- }
24
- /**
25
- * Returns an up-to-date list of all cards matching the search criteria.
26
- *
27
- * @param SearchParameters - Object containing search parameters.
28
- * @returns A promise that resolves to an object representing an up-to-date list of all cards matching the search criteria.
29
- */
30
- export declare function searchCards(searchParameters: SearchParameters): Promise<Search>;
31
- /**
32
- * Returns the card with an ID or slug that matches the one you specify.
33
- *
34
- * @param idorslug - The unique identifier for the card by slug.
35
- * @returns A promise that resolves to an object representing details about a card.
36
- */
37
- export declare function fetchCard(idorslug: string, gameMode?: string): Promise<Card>;
@@ -1,27 +0,0 @@
1
- import { request } from "../../shared/index.js";
2
- import { search } from "../search.js";
3
- /**
4
- * Returns an up-to-date list of all cards matching the search criteria.
5
- *
6
- * @param SearchParameters - Object containing search parameters.
7
- * @returns A promise that resolves to an object representing an up-to-date list of all cards matching the search criteria.
8
- */
9
- export async function searchCards(searchParameters) {
10
- return await search("/cards", searchParameters);
11
- }
12
- /**
13
- * Returns the card with an ID or slug that matches the one you specify.
14
- *
15
- * @param idorslug - The unique identifier for the card by slug.
16
- * @returns A promise that resolves to an object representing details about a card.
17
- */
18
- export async function fetchCard(idorslug, gameMode) {
19
- const reqOptions = {
20
- method: "GET",
21
- url: `/hearthstone/cards/${idorslug}`,
22
- };
23
- if (gameMode) {
24
- reqOptions["qs"] = { gameMode };
25
- }
26
- return await request(reqOptions);
27
- }
@@ -1,88 +0,0 @@
1
- import type { LocalizedString } from "../../shared/index.js";
2
- export interface Options {
3
- code?: string;
4
- ids?: string;
5
- hero?: string;
6
- }
7
- export interface Deck {
8
- deckCode: string;
9
- version: number;
10
- format: string;
11
- hero: {
12
- id: number;
13
- collectible: number;
14
- slug: string;
15
- classId: number;
16
- multiClassIds: number[];
17
- cardTypeId: number;
18
- cardSetId: number;
19
- rarityId: number;
20
- artistName: string;
21
- health: number;
22
- manaCost: number;
23
- name: LocalizedString;
24
- text: LocalizedString;
25
- image: string;
26
- imageGold: string;
27
- flavorText: LocalizedString;
28
- cropImage: string;
29
- childIds: number[];
30
- };
31
- heroPower: {
32
- id: number;
33
- collectible: number;
34
- slug: string;
35
- classId: number;
36
- multiClassIds: number[];
37
- cardTypeId: number;
38
- cardSetId: number;
39
- rarityId: number;
40
- artistName: null;
41
- manaCost: number;
42
- name: LocalizedString;
43
- text: LocalizedString;
44
- image: string;
45
- imageGold: string;
46
- flavorText: LocalizedString;
47
- cropImage: string;
48
- parentId: number;
49
- };
50
- class: {
51
- slug: string;
52
- id: number;
53
- name: LocalizedString;
54
- };
55
- cards: {
56
- id: number;
57
- collectible: number;
58
- slug: string;
59
- classId: number;
60
- multiClassIds: number[];
61
- cardTypeId: number;
62
- cardSetId: number;
63
- rarityId: number;
64
- artistName: string;
65
- health: number;
66
- attack: number;
67
- manaCost: number;
68
- name: LocalizedString;
69
- text: LocalizedString;
70
- image: string;
71
- imageGold: string;
72
- flavorText: LocalizedString;
73
- cropImage: string;
74
- copyOfCardId: number;
75
- duels: {
76
- relevant: boolean;
77
- constructed: boolean;
78
- };
79
- }[];
80
- cardCount: number;
81
- }
82
- /**
83
- * Returns the card with an ID or slug that matches the one you specify.
84
- *
85
- * @param options - find parameters fort the search.
86
- * @returns A promise that resolves to an object representing details about a card.
87
- */
88
- export declare function fetchDeck(options?: Options): Promise<Deck>;
@@ -1,14 +0,0 @@
1
- import { request } from "../../shared/index.js";
2
- /**
3
- * Returns the card with an ID or slug that matches the one you specify.
4
- *
5
- * @param options - find parameters fort the search.
6
- * @returns A promise that resolves to an object representing details about a card.
7
- */
8
- export async function fetchDeck(options) {
9
- return await request({
10
- method: "GET",
11
- url: `/hearthstone/deck`,
12
- qs: options,
13
- });
14
- }
@@ -1,95 +0,0 @@
1
- import type { LocalizedString } from "../../shared/index.js";
2
- export interface Metadata {
3
- sets: {
4
- id: number;
5
- name: LocalizedString;
6
- slug: string;
7
- aliasSetIds?: number[];
8
- type: string;
9
- collectibleCount: number;
10
- collectibleRevealedCount: number;
11
- nonCollectibleCount: number;
12
- nonCollectibleRevealedCount: number;
13
- }[];
14
- setGroups: {
15
- slug: string;
16
- year?: number;
17
- svg?: string;
18
- cardSets: string[];
19
- name: LocalizedString;
20
- standard?: boolean;
21
- yearRange?: string;
22
- icon?: string;
23
- }[];
24
- gameModes: {
25
- slug: string;
26
- id: number;
27
- name: LocalizedString;
28
- }[];
29
- arenaIds: number[];
30
- types: {
31
- slug: string;
32
- id: number;
33
- name: LocalizedString;
34
- gameModes: number[];
35
- }[];
36
- rarities: {
37
- slug: string;
38
- id: number;
39
- craftingCost: number[];
40
- dustValue: number[];
41
- name: LocalizedString;
42
- }[];
43
- classes: {
44
- slug: string;
45
- id: number;
46
- name: LocalizedString;
47
- cardId?: number;
48
- heroPowerCardId?: number;
49
- alternateHeroCardIds?: number[];
50
- }[];
51
- minionTypes: {
52
- slug: string;
53
- id: number;
54
- name: LocalizedString;
55
- gameModes: number[];
56
- }[];
57
- spellSchools: {
58
- slug: string;
59
- id: number;
60
- name: LocalizedString;
61
- }[];
62
- mercenaryRoles: {
63
- slug: string;
64
- id: number;
65
- name: LocalizedString;
66
- }[];
67
- mercenaryFactions: {
68
- slug: string;
69
- id: number;
70
- name: LocalizedString;
71
- }[];
72
- keywords: {
73
- id: number;
74
- slug: string;
75
- name: LocalizedString;
76
- refText: LocalizedString;
77
- text: LocalizedString;
78
- gameModes: number[];
79
- }[];
80
- filterableFields: string[];
81
- numericFields: string[];
82
- cardBackCategories: {
83
- slug: string;
84
- id: number;
85
- name: LocalizedString;
86
- }[];
87
- }
88
- type MetaTypes = "sets" | "setGroups" | "types" | "rarities" | "classes" | "minionTypes" | "keywords";
89
- /**
90
- * Returns information about the categorization of cards. Metadata includes the card set, set group (for example, Standard or Year of the Dragon), rarity, class, card type, minion type, and keywords.
91
- *
92
- * @returns A promise that resolves to an object representing the Metadata.
93
- */
94
- export declare function metadata(type: MetaTypes): Promise<Partial<Metadata>>;
95
- export {};
@@ -1,12 +0,0 @@
1
- import { request } from "../../shared/index.js";
2
- /**
3
- * Returns information about the categorization of cards. Metadata includes the card set, set group (for example, Standard or Year of the Dragon), rarity, class, card type, minion type, and keywords.
4
- *
5
- * @returns A promise that resolves to an object representing the Metadata.
6
- */
7
- export async function metadata(type) {
8
- return await request({
9
- method: "GET",
10
- url: `/hearthstone/metadata/${type}`,
11
- });
12
- }
@@ -1,4 +0,0 @@
1
- export { fetchCard, searchCards } from "./game_data/cards.js";
2
- export { fetchCardback, searchCardbacks } from "./game_data/card_backs.js";
3
- export { fetchDeck } from "./game_data/decks.js";
4
- export { metadata } from "./game_data/metadata.js";
@@ -1,4 +0,0 @@
1
- export { fetchCard, searchCards } from "./game_data/cards.js";
2
- export { fetchCardback, searchCardbacks } from "./game_data/card_backs.js";
3
- export { fetchDeck } from "./game_data/decks.js";
4
- export { metadata } from "./game_data/metadata.js";
@@ -1,20 +0,0 @@
1
- export interface SearchParameters {
2
- searchFields?: Record<string | symbol, string | number>;
3
- page?: number;
4
- pageSize?: number;
5
- sort?: string;
6
- }
7
- export interface Search {
8
- page: number;
9
- pageSize: number;
10
- maxPageSize: number;
11
- pageCount: number;
12
- results: unknown[];
13
- }
14
- /**
15
- * Performs a search.
16
- *
17
- * @param SearchParameters - Object containing search parameters.
18
- * @returns A promise that resolves to an object representing details about the search.
19
- */
20
- export declare function search(url: string, searchParameters: SearchParameters): Promise<Search>;
@@ -1,29 +0,0 @@
1
- import { request } from "../shared/index.js";
2
- /**
3
- * Performs a search.
4
- *
5
- * @param SearchParameters - Object containing search parameters.
6
- * @returns A promise that resolves to an object representing details about the search.
7
- */
8
- export async function search(url, searchParameters) {
9
- const searchFields = searchParameters.searchFields
10
- ? Object.fromEntries(Object.entries(searchParameters.searchFields).map(([key, value]) => [key, value.toString()]))
11
- : undefined;
12
- const qs = {
13
- ...searchFields,
14
- };
15
- if (searchParameters.sort) {
16
- qs.sort = searchParameters.sort;
17
- }
18
- if (searchParameters.page !== undefined) {
19
- qs.page = searchParameters.page;
20
- }
21
- if (searchParameters.pageSize !== undefined) {
22
- qs.pageSize = searchParameters.pageSize;
23
- }
24
- return await request({
25
- method: "GET",
26
- url: `/hearthstone${url}`,
27
- qs,
28
- });
29
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Represents the configuration data for authentication.
3
- * @property {string} accessToken - The current access token.
4
- * @property {number} tokenExpiration - The expiration timestamp of the access token (in milliseconds).
5
- */
6
- export interface AuthConfig {
7
- accessToken: string;
8
- tokenExpiration: number;
9
- }
10
- /**
11
- * Retrieves the global authentication configuration.
12
- * @returns {AuthConfig} The authentication configuration object.
13
- */
14
- export declare function getauthConfig(): AuthConfig;
15
- /**
16
- * Handles authentication and obtains an access token if needed.
17
- * @param {boolean} forceNewToken - If true, forces the retrieval of a new token, ignoring any existing one.
18
- * @returns {Promise<string>} Returns the access token (string).
19
- * @throws {MissingRegionError} If the region is not configured.
20
- * @throws {MissingClientIdError} If the client ID is not configured.
21
- * @throws {MissingClientSecretError} If the client secret is not configured.
22
- * @throws {AuthenticationError} If there is a problem during the authentication process.
23
- */
24
- export declare function authenticate(forceNewToken?: boolean): Promise<string>;
@@ -1,58 +0,0 @@
1
- //auth.ts
2
- import { getSetup, tokenUrl } from "./config.js";
3
- import { AuthenticationError, MissingClientIdError, MissingClientSecretError, MissingRegionError } from "./errors.js";
4
- /**
5
- * Global storage for authentication configuration data.
6
- */
7
- const authConfig = {
8
- accessToken: "",
9
- tokenExpiration: 0,
10
- };
11
- /**
12
- * Retrieves the global authentication configuration.
13
- * @returns {AuthConfig} The authentication configuration object.
14
- */
15
- export function getauthConfig() {
16
- return authConfig;
17
- }
18
- /**
19
- * Handles authentication and obtains an access token if needed.
20
- * @param {boolean} forceNewToken - If true, forces the retrieval of a new token, ignoring any existing one.
21
- * @returns {Promise<string>} Returns the access token (string).
22
- * @throws {MissingRegionError} If the region is not configured.
23
- * @throws {MissingClientIdError} If the client ID is not configured.
24
- * @throws {MissingClientSecretError} If the client secret is not configured.
25
- * @throws {AuthenticationError} If there is a problem during the authentication process.
26
- */
27
- export async function authenticate(forceNewToken = false) {
28
- if (!getSetup().region) {
29
- throw new MissingRegionError();
30
- }
31
- if (!getSetup().clientId) {
32
- throw new MissingClientIdError();
33
- }
34
- if (!getSetup().clientSecret) {
35
- throw new MissingClientSecretError();
36
- }
37
- if (!forceNewToken && authConfig.accessToken && authConfig.tokenExpiration &&
38
- new Date() < new Date(authConfig.tokenExpiration)) {
39
- return authConfig.accessToken;
40
- }
41
- const response = await fetch(tokenUrl(getSetup().region), {
42
- method: "POST",
43
- headers: {
44
- "Authorization": "Basic " + btoa(`${getSetup().clientId}:${getSetup().clientSecret}`),
45
- "Content-Type": "application/x-www-form-urlencoded",
46
- },
47
- body: "grant_type=client_credentials",
48
- });
49
- if (response.ok) {
50
- const data = await response.json();
51
- authConfig.accessToken = data.access_token;
52
- authConfig.tokenExpiration = Date.now() + data.expires_in * 1000;
53
- return authConfig.accessToken;
54
- }
55
- else {
56
- throw new AuthenticationError("Problem with Authentication", response.status, response.statusText);
57
- }
58
- }
@@ -1,40 +0,0 @@
1
- import type { Locales, Regions } from "./types.js";
2
- /**
3
- * Represents the required application configuration.
4
- * @property {Regions} region - The target Battle.net region for API requests.
5
- * @property {Locales} locale - The desired locale for data.
6
- * @property {string} clientId - The OAuth client ID.
7
- * @property {string} clientSecret - The OAuth client secret.
8
- */
9
- export interface Config {
10
- region: Regions;
11
- locale: Locales;
12
- clientId: string;
13
- clientSecret: string;
14
- }
15
- /**
16
- * Generates the OAuth token URL based on the specified region.
17
- * @param {Regions} region - The target Battle.net region.
18
- * @returns {string} The constructed token URL.
19
- */
20
- export declare function tokenUrl(region: Regions): string;
21
- /**
22
- * Generates the base API URL based on the specified region.
23
- * @param {Regions} region - The target Battle.net region.
24
- * @returns {string} The constructed base API URL.
25
- */
26
- export declare function apiBaseUrl(region: Regions): string;
27
- /**
28
- * Updates the application configuration and performs basic validation.
29
- * @param {Partial<Config>} userConfig - An object containing configuration properties to update.
30
- * @throws {MissingRegionError} If the region is not provided in the update.
31
- * @throws {MissingClientIdError} If the client ID is not provided in the update.
32
- * @throws {MissingClientSecretError} If the client secret is not provided in the update.
33
- */
34
- export declare function setup(userConfig: Partial<Config>): void;
35
- /**
36
- * Retrieves the current application configuration.
37
- * Note: The configuration may be partial if not fully setup.
38
- * @returns {Config | Partial<Config>} The full or partially loaded configuration object.
39
- */
40
- export declare function getSetup(): Config | Partial<Config>;
@@ -1,48 +0,0 @@
1
- import { MissingClientIdError, MissingClientSecretError, MissingRegionError } from "./errors.js";
2
- /**
3
- * Holds the partially loaded application configuration.
4
- */
5
- let config = {};
6
- /**
7
- * Generates the OAuth token URL based on the specified region.
8
- * @param {Regions} region - The target Battle.net region.
9
- * @returns {string} The constructed token URL.
10
- */
11
- export function tokenUrl(region) {
12
- return region === "cn" ? "https://www.battlenet.com.cn/oauth/token" : `https://${region}.battle.net/oauth/token`;
13
- }
14
- /**
15
- * Generates the base API URL based on the specified region.
16
- * @param {Regions} region - The target Battle.net region.
17
- * @returns {string} The constructed base API URL.
18
- */
19
- export function apiBaseUrl(region) {
20
- return region === "cn" ? "https://gateway.battlenet.com.cn" : `https://${region}.api.blizzard.com`;
21
- }
22
- /**
23
- * Updates the application configuration and performs basic validation.
24
- * @param {Partial<Config>} userConfig - An object containing configuration properties to update.
25
- * @throws {MissingRegionError} If the region is not provided in the update.
26
- * @throws {MissingClientIdError} If the client ID is not provided in the update.
27
- * @throws {MissingClientSecretError} If the client secret is not provided in the update.
28
- */
29
- export function setup(userConfig) {
30
- config = { ...config, ...userConfig };
31
- if (!config.region) {
32
- throw new MissingRegionError();
33
- }
34
- if (!config.clientId) {
35
- throw new MissingClientIdError();
36
- }
37
- if (!config.clientSecret) {
38
- throw new MissingClientSecretError();
39
- }
40
- }
41
- /**
42
- * Retrieves the current application configuration.
43
- * Note: The configuration may be partial if not fully setup.
44
- * @returns {Config | Partial<Config>} The full or partially loaded configuration object.
45
- */
46
- export function getSetup() {
47
- return config;
48
- }