@pinta365/blizzard_api 0.3.7 → 0.4.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 (277) hide show
  1. package/esm/mod.d.ts +3 -2
  2. package/esm/mod.js +3 -2
  3. package/package.json +1 -1
  4. package/script/mod.d.ts +3 -2
  5. package/script/mod.js +6 -1
  6. package/esm/src/hearthstone/game_data/card_backs.d.ts +0 -22
  7. package/esm/src/hearthstone/game_data/card_backs.js +0 -23
  8. package/esm/src/hearthstone/game_data/cards.d.ts +0 -37
  9. package/esm/src/hearthstone/game_data/cards.js +0 -27
  10. package/esm/src/hearthstone/game_data/decks.d.ts +0 -88
  11. package/esm/src/hearthstone/game_data/decks.js +0 -14
  12. package/esm/src/hearthstone/game_data/metadata.d.ts +0 -95
  13. package/esm/src/hearthstone/game_data/metadata.js +0 -12
  14. package/esm/src/hearthstone/index.d.ts +0 -4
  15. package/esm/src/hearthstone/index.js +0 -4
  16. package/esm/src/hearthstone/search.d.ts +0 -20
  17. package/esm/src/hearthstone/search.js +0 -29
  18. package/esm/src/shared/auth.d.ts +0 -24
  19. package/esm/src/shared/auth.js +0 -58
  20. package/esm/src/shared/config.d.ts +0 -40
  21. package/esm/src/shared/config.js +0 -48
  22. package/esm/src/shared/errors.d.ts +0 -44
  23. package/esm/src/shared/errors.js +0 -83
  24. package/esm/src/shared/index.d.ts +0 -4
  25. package/esm/src/shared/index.js +0 -3
  26. package/esm/src/shared/request.d.ts +0 -13
  27. package/esm/src/shared/request.js +0 -46
  28. package/esm/src/shared/types.d.ts +0 -120
  29. package/esm/src/shared/types.js +0 -2
  30. package/esm/src/starcraft2/game_data/league.d.ts +0 -32
  31. package/esm/src/starcraft2/game_data/league.js +0 -21
  32. package/esm/src/starcraft2/index.d.ts +0 -1
  33. package/esm/src/starcraft2/index.js +0 -1
  34. package/esm/src/wow/game_data/achievement.d.ts +0 -84
  35. package/esm/src/wow/game_data/achievement.js +0 -69
  36. package/esm/src/wow/game_data/auction_house.d.ts +0 -64
  37. package/esm/src/wow/game_data/auction_house.js +0 -34
  38. package/esm/src/wow/game_data/azerite_essence.d.ts +0 -49
  39. package/esm/src/wow/game_data/azerite_essence.js +0 -49
  40. package/esm/src/wow/game_data/connected_realm.d.ts +0 -54
  41. package/esm/src/wow/game_data/connected_realm.js +0 -36
  42. package/esm/src/wow/game_data/covenant.d.ts +0 -108
  43. package/esm/src/wow/game_data/covenant.js +0 -89
  44. package/esm/src/wow/game_data/creature.d.ts +0 -97
  45. package/esm/src/wow/game_data/creature.js +0 -100
  46. package/esm/src/wow/game_data/guild_crest.d.ts +0 -55
  47. package/esm/src/wow/game_data/guild_crest.js +0 -39
  48. package/esm/src/wow/game_data/heirloom.d.ts +0 -79
  49. package/esm/src/wow/game_data/heirloom.js +0 -26
  50. package/esm/src/wow/game_data/item.d.ts +0 -166
  51. package/esm/src/wow/game_data/item.js +0 -101
  52. package/esm/src/wow/game_data/journal.d.ts +0 -121
  53. package/esm/src/wow/game_data/journal.js +0 -99
  54. package/esm/src/wow/game_data/keystone_affix.d.ts +0 -34
  55. package/esm/src/wow/game_data/keystone_affix.js +0 -39
  56. package/esm/src/wow/game_data/media_search.d.ts +0 -8
  57. package/esm/src/wow/game_data/media_search.js +0 -10
  58. package/esm/src/wow/game_data/modified_crafting.d.ts +0 -56
  59. package/esm/src/wow/game_data/modified_crafting.js +0 -63
  60. package/esm/src/wow/game_data/mount.d.ts +0 -30
  61. package/esm/src/wow/game_data/mount.js +0 -30
  62. package/esm/src/wow/game_data/mythic_keystone_dungeon.d.ts +0 -91
  63. package/esm/src/wow/game_data/mythic_keystone_dungeon.js +0 -88
  64. package/esm/src/wow/game_data/mythic_keystone_leaderboard.d.ts +0 -58
  65. package/esm/src/wow/game_data/mythic_keystone_leaderboard.js +0 -29
  66. package/esm/src/wow/game_data/mythic_raid_leaderboard.d.ts +0 -31
  67. package/esm/src/wow/game_data/mythic_raid_leaderboard.js +0 -15
  68. package/esm/src/wow/game_data/pet.d.ts +0 -91
  69. package/esm/src/wow/game_data/pet.js +0 -77
  70. package/esm/src/wow/game_data/playable_class.d.ts +0 -57
  71. package/esm/src/wow/game_data/playable_class.js +0 -52
  72. package/esm/src/wow/game_data/playable_race.d.ts +0 -29
  73. package/esm/src/wow/game_data/playable_race.js +0 -26
  74. package/esm/src/wow/game_data/power_type.d.ts +0 -21
  75. package/esm/src/wow/game_data/power_type.js +0 -26
  76. package/esm/src/wow/game_data/profession.d.ts +0 -85
  77. package/esm/src/wow/game_data/profession.js +0 -79
  78. package/esm/src/wow/game_data/pvp_season.d.ts +0 -99
  79. package/esm/src/wow/game_data/pvp_season.js +0 -66
  80. package/esm/src/wow/game_data/pvp_tier.d.ts +0 -40
  81. package/esm/src/wow/game_data/pvp_tier.js +0 -39
  82. package/esm/src/wow/game_data/quest.d.ts +0 -114
  83. package/esm/src/wow/game_data/quest.js +0 -101
  84. package/esm/src/wow/game_data/realm.d.ts +0 -42
  85. package/esm/src/wow/game_data/realm.js +0 -36
  86. package/esm/src/wow/game_data/region.d.ts +0 -24
  87. package/esm/src/wow/game_data/region.js +0 -26
  88. package/esm/src/wow/game_data/reputations.d.ts +0 -50
  89. package/esm/src/wow/game_data/reputations.js +0 -51
  90. package/esm/src/wow/game_data/spell.d.ts +0 -33
  91. package/esm/src/wow/game_data/spell.js +0 -37
  92. package/esm/src/wow/game_data/talent.d.ts +0 -129
  93. package/esm/src/wow/game_data/talent.js +0 -90
  94. package/esm/src/wow/game_data/tech_talent.d.ts +0 -70
  95. package/esm/src/wow/game_data/tech_talent.js +0 -64
  96. package/esm/src/wow/game_data/title.d.ts +0 -25
  97. package/esm/src/wow/game_data/title.js +0 -26
  98. package/esm/src/wow/game_data/token.d.ts +0 -16
  99. package/esm/src/wow/game_data/token.js +0 -19
  100. package/esm/src/wow/game_data/toy.d.ts +0 -24
  101. package/esm/src/wow/game_data/toy.js +0 -26
  102. package/esm/src/wow/index.d.ts +0 -53
  103. package/esm/src/wow/index.js +0 -55
  104. package/esm/src/wow/profile/character_achievements.d.ts +0 -87
  105. package/esm/src/wow/profile/character_achievements.js +0 -29
  106. package/esm/src/wow/profile/character_appearance.d.ts +0 -75
  107. package/esm/src/wow/profile/character_appearance.js +0 -15
  108. package/esm/src/wow/profile/character_collections.d.ts +0 -92
  109. package/esm/src/wow/profile/character_collections.js +0 -71
  110. package/esm/src/wow/profile/character_encounters.d.ts +0 -77
  111. package/esm/src/wow/profile/character_encounters.js +0 -43
  112. package/esm/src/wow/profile/character_equipment.d.ts +0 -132
  113. package/esm/src/wow/profile/character_equipment.js +0 -15
  114. package/esm/src/wow/profile/character_hunter_pets.d.ts +0 -21
  115. package/esm/src/wow/profile/character_hunter_pets.js +0 -15
  116. package/esm/src/wow/profile/character_media.d.ts +0 -13
  117. package/esm/src/wow/profile/character_media.js +0 -15
  118. package/esm/src/wow/profile/character_mythic_keystone_profile.d.ts +0 -58
  119. package/esm/src/wow/profile/character_mythic_keystone_profile.js +0 -32
  120. package/esm/src/wow/profile/character_professions.d.ts +0 -26
  121. package/esm/src/wow/profile/character_professions.js +0 -15
  122. package/esm/src/wow/profile/character_profile.d.ts +0 -82
  123. package/esm/src/wow/profile/character_profile.js +0 -40
  124. package/esm/src/wow/profile/character_pvp.d.ts +0 -51
  125. package/esm/src/wow/profile/character_pvp.js +0 -30
  126. package/esm/src/wow/profile/character_quests.d.ts +0 -28
  127. package/esm/src/wow/profile/character_quests.js +0 -29
  128. package/esm/src/wow/profile/character_reputations.d.ts +0 -22
  129. package/esm/src/wow/profile/character_reputations.js +0 -15
  130. package/esm/src/wow/profile/character_soulbinds.d.ts +0 -30
  131. package/esm/src/wow/profile/character_soulbinds.js +0 -15
  132. package/esm/src/wow/profile/character_specializations.d.ts +0 -44
  133. package/esm/src/wow/profile/character_specializations.js +0 -15
  134. package/esm/src/wow/profile/character_statistics.d.ts +0 -116
  135. package/esm/src/wow/profile/character_statistics.js +0 -15
  136. package/esm/src/wow/profile/character_titles.d.ts +0 -13
  137. package/esm/src/wow/profile/character_titles.js +0 -15
  138. package/esm/src/wow/profile/guild.d.ts +0 -117
  139. package/esm/src/wow/profile/guild.js +0 -57
  140. package/esm/src/wow/search.d.ts +0 -21
  141. package/esm/src/wow/search.js +0 -30
  142. package/script/src/hearthstone/game_data/card_backs.d.ts +0 -22
  143. package/script/src/hearthstone/game_data/card_backs.js +0 -28
  144. package/script/src/hearthstone/game_data/cards.d.ts +0 -37
  145. package/script/src/hearthstone/game_data/cards.js +0 -32
  146. package/script/src/hearthstone/game_data/decks.d.ts +0 -88
  147. package/script/src/hearthstone/game_data/decks.js +0 -18
  148. package/script/src/hearthstone/game_data/metadata.d.ts +0 -95
  149. package/script/src/hearthstone/game_data/metadata.js +0 -16
  150. package/script/src/hearthstone/index.d.ts +0 -4
  151. package/script/src/hearthstone/index.js +0 -13
  152. package/script/src/hearthstone/search.d.ts +0 -20
  153. package/script/src/hearthstone/search.js +0 -33
  154. package/script/src/shared/auth.d.ts +0 -24
  155. package/script/src/shared/auth.js +0 -63
  156. package/script/src/shared/config.d.ts +0 -40
  157. package/script/src/shared/config.js +0 -55
  158. package/script/src/shared/errors.d.ts +0 -44
  159. package/script/src/shared/errors.js +0 -91
  160. package/script/src/shared/index.d.ts +0 -4
  161. package/script/src/shared/index.js +0 -9
  162. package/script/src/shared/request.d.ts +0 -13
  163. package/script/src/shared/request.js +0 -50
  164. package/script/src/shared/types.d.ts +0 -120
  165. package/script/src/shared/types.js +0 -3
  166. package/script/src/starcraft2/game_data/league.d.ts +0 -32
  167. package/script/src/starcraft2/game_data/league.js +0 -25
  168. package/script/src/starcraft2/index.d.ts +0 -1
  169. package/script/src/starcraft2/index.js +0 -5
  170. package/script/src/wow/game_data/achievement.d.ts +0 -84
  171. package/script/src/wow/game_data/achievement.js +0 -77
  172. package/script/src/wow/game_data/auction_house.d.ts +0 -64
  173. package/script/src/wow/game_data/auction_house.js +0 -39
  174. package/script/src/wow/game_data/azerite_essence.d.ts +0 -49
  175. package/script/src/wow/game_data/azerite_essence.js +0 -56
  176. package/script/src/wow/game_data/connected_realm.d.ts +0 -54
  177. package/script/src/wow/game_data/connected_realm.js +0 -42
  178. package/script/src/wow/game_data/covenant.d.ts +0 -108
  179. package/script/src/wow/game_data/covenant.js +0 -99
  180. package/script/src/wow/game_data/creature.d.ts +0 -97
  181. package/script/src/wow/game_data/creature.js +0 -111
  182. package/script/src/wow/game_data/guild_crest.d.ts +0 -55
  183. package/script/src/wow/game_data/guild_crest.js +0 -45
  184. package/script/src/wow/game_data/heirloom.d.ts +0 -79
  185. package/script/src/wow/game_data/heirloom.js +0 -31
  186. package/script/src/wow/game_data/item.d.ts +0 -166
  187. package/script/src/wow/game_data/item.js +0 -112
  188. package/script/src/wow/game_data/journal.d.ts +0 -121
  189. package/script/src/wow/game_data/journal.js +0 -110
  190. package/script/src/wow/game_data/keystone_affix.d.ts +0 -34
  191. package/script/src/wow/game_data/keystone_affix.js +0 -45
  192. package/script/src/wow/game_data/media_search.d.ts +0 -8
  193. package/script/src/wow/game_data/media_search.js +0 -14
  194. package/script/src/wow/game_data/modified_crafting.d.ts +0 -56
  195. package/script/src/wow/game_data/modified_crafting.js +0 -71
  196. package/script/src/wow/game_data/mount.d.ts +0 -30
  197. package/script/src/wow/game_data/mount.js +0 -36
  198. package/script/src/wow/game_data/mythic_keystone_dungeon.d.ts +0 -91
  199. package/script/src/wow/game_data/mythic_keystone_dungeon.js +0 -98
  200. package/script/src/wow/game_data/mythic_keystone_leaderboard.d.ts +0 -58
  201. package/script/src/wow/game_data/mythic_keystone_leaderboard.js +0 -34
  202. package/script/src/wow/game_data/mythic_raid_leaderboard.d.ts +0 -31
  203. package/script/src/wow/game_data/mythic_raid_leaderboard.js +0 -19
  204. package/script/src/wow/game_data/pet.d.ts +0 -91
  205. package/script/src/wow/game_data/pet.js +0 -86
  206. package/script/src/wow/game_data/playable_class.d.ts +0 -57
  207. package/script/src/wow/game_data/playable_class.js +0 -59
  208. package/script/src/wow/game_data/playable_race.d.ts +0 -29
  209. package/script/src/wow/game_data/playable_race.js +0 -31
  210. package/script/src/wow/game_data/power_type.d.ts +0 -21
  211. package/script/src/wow/game_data/power_type.js +0 -31
  212. package/script/src/wow/game_data/profession.d.ts +0 -85
  213. package/script/src/wow/game_data/profession.js +0 -88
  214. package/script/src/wow/game_data/pvp_season.d.ts +0 -99
  215. package/script/src/wow/game_data/pvp_season.js +0 -74
  216. package/script/src/wow/game_data/pvp_tier.d.ts +0 -40
  217. package/script/src/wow/game_data/pvp_tier.js +0 -45
  218. package/script/src/wow/game_data/quest.d.ts +0 -114
  219. package/script/src/wow/game_data/quest.js +0 -112
  220. package/script/src/wow/game_data/realm.d.ts +0 -42
  221. package/script/src/wow/game_data/realm.js +0 -42
  222. package/script/src/wow/game_data/region.d.ts +0 -24
  223. package/script/src/wow/game_data/region.js +0 -31
  224. package/script/src/wow/game_data/reputations.d.ts +0 -50
  225. package/script/src/wow/game_data/reputations.js +0 -58
  226. package/script/src/wow/game_data/spell.d.ts +0 -33
  227. package/script/src/wow/game_data/spell.js +0 -43
  228. package/script/src/wow/game_data/talent.d.ts +0 -129
  229. package/script/src/wow/game_data/talent.js +0 -100
  230. package/script/src/wow/game_data/tech_talent.d.ts +0 -70
  231. package/script/src/wow/game_data/tech_talent.js +0 -72
  232. package/script/src/wow/game_data/title.d.ts +0 -25
  233. package/script/src/wow/game_data/title.js +0 -31
  234. package/script/src/wow/game_data/token.d.ts +0 -16
  235. package/script/src/wow/game_data/token.js +0 -23
  236. package/script/src/wow/game_data/toy.d.ts +0 -24
  237. package/script/src/wow/game_data/toy.js +0 -31
  238. package/script/src/wow/index.d.ts +0 -53
  239. package/script/src/wow/index.js +0 -228
  240. package/script/src/wow/profile/character_achievements.d.ts +0 -87
  241. package/script/src/wow/profile/character_achievements.js +0 -34
  242. package/script/src/wow/profile/character_appearance.d.ts +0 -75
  243. package/script/src/wow/profile/character_appearance.js +0 -19
  244. package/script/src/wow/profile/character_collections.d.ts +0 -92
  245. package/script/src/wow/profile/character_collections.js +0 -79
  246. package/script/src/wow/profile/character_encounters.d.ts +0 -77
  247. package/script/src/wow/profile/character_encounters.js +0 -49
  248. package/script/src/wow/profile/character_equipment.d.ts +0 -132
  249. package/script/src/wow/profile/character_equipment.js +0 -19
  250. package/script/src/wow/profile/character_hunter_pets.d.ts +0 -21
  251. package/script/src/wow/profile/character_hunter_pets.js +0 -19
  252. package/script/src/wow/profile/character_media.d.ts +0 -13
  253. package/script/src/wow/profile/character_media.js +0 -19
  254. package/script/src/wow/profile/character_mythic_keystone_profile.d.ts +0 -58
  255. package/script/src/wow/profile/character_mythic_keystone_profile.js +0 -37
  256. package/script/src/wow/profile/character_professions.d.ts +0 -26
  257. package/script/src/wow/profile/character_professions.js +0 -19
  258. package/script/src/wow/profile/character_profile.d.ts +0 -82
  259. package/script/src/wow/profile/character_profile.js +0 -45
  260. package/script/src/wow/profile/character_pvp.d.ts +0 -51
  261. package/script/src/wow/profile/character_pvp.js +0 -35
  262. package/script/src/wow/profile/character_quests.d.ts +0 -28
  263. package/script/src/wow/profile/character_quests.js +0 -34
  264. package/script/src/wow/profile/character_reputations.d.ts +0 -22
  265. package/script/src/wow/profile/character_reputations.js +0 -19
  266. package/script/src/wow/profile/character_soulbinds.d.ts +0 -30
  267. package/script/src/wow/profile/character_soulbinds.js +0 -19
  268. package/script/src/wow/profile/character_specializations.d.ts +0 -44
  269. package/script/src/wow/profile/character_specializations.js +0 -19
  270. package/script/src/wow/profile/character_statistics.d.ts +0 -116
  271. package/script/src/wow/profile/character_statistics.js +0 -19
  272. package/script/src/wow/profile/character_titles.d.ts +0 -13
  273. package/script/src/wow/profile/character_titles.js +0 -19
  274. package/script/src/wow/profile/guild.d.ts +0 -117
  275. package/script/src/wow/profile/guild.js +0 -64
  276. package/script/src/wow/search.d.ts +0 -21
  277. package/script/src/wow/search.js +0 -34
package/esm/mod.d.ts CHANGED
@@ -1,6 +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
6
  import * as errors from "./src/shared/errors.js";
6
- export { authenticate, errors, hearthstone, sc2, setup, wow };
7
+ export { authenticate, errors, getAccessToken, getAuthConfig, hearthstone, requestHref, sc2, setup, wow, wowClassic };
package/esm/mod.js CHANGED
@@ -1,6 +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
6
  import * as errors from "./src/shared/errors.js";
6
- export { authenticate, errors, hearthstone, sc2, setup, wow };
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.7",
3
+ "version": "0.4.0",
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,6 +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
6
  import * as errors from "./src/shared/errors.js";
6
- export { authenticate, errors, hearthstone, sc2, setup, wow };
7
+ export { authenticate, errors, getAccessToken, getAuthConfig, hearthstone, requestHref, sc2, setup, wow, wowClassic };
package/script/mod.js CHANGED
@@ -23,12 +23,17 @@ 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.errors = 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"));
@@ -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
- }
@@ -1,44 +0,0 @@
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
- }