@pinta365/blizzard_api 0.3.7 → 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 (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
@@ -1,83 +0,0 @@
1
- /**
2
- * Custom error class representing an API error.
3
- * @class
4
- * @extends {Error}
5
- */
6
- export class APIError extends Error {
7
- constructor(message, statusCode, responseBody) {
8
- super(message);
9
- Object.defineProperty(this, "statusCode", {
10
- enumerable: true,
11
- configurable: true,
12
- writable: true,
13
- value: void 0
14
- });
15
- Object.defineProperty(this, "responseBody", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: void 0
20
- });
21
- this.name = "APIError";
22
- this.statusCode = statusCode;
23
- this.responseBody = responseBody;
24
- }
25
- }
26
- /**
27
- * Custom error class representing an Authentication error.
28
- * @class
29
- * @extends {Error}
30
- */
31
- export class AuthenticationError extends Error {
32
- constructor(message, statusCode, responseBody) {
33
- super(message);
34
- Object.defineProperty(this, "statusCode", {
35
- enumerable: true,
36
- configurable: true,
37
- writable: true,
38
- value: void 0
39
- });
40
- Object.defineProperty(this, "responseBody", {
41
- enumerable: true,
42
- configurable: true,
43
- writable: true,
44
- value: void 0
45
- });
46
- this.name = "AuthenticationError";
47
- this.statusCode = statusCode;
48
- this.responseBody = responseBody;
49
- }
50
- }
51
- /**
52
- * Custom error class representing a missing client id error.
53
- * @class
54
- * @extends {Error}
55
- */
56
- export class MissingClientIdError extends Error {
57
- constructor() {
58
- super("Client Id must be setup. Check documentation");
59
- this.name = "MissingClientIdError";
60
- }
61
- }
62
- /**
63
- * Custom error class representing a missing client secret error.
64
- * @class
65
- * @extends {Error}
66
- */
67
- export class MissingClientSecretError extends Error {
68
- constructor() {
69
- super("Client Secret must be setup. Check documentation");
70
- this.name = "MissingClientSecretError";
71
- }
72
- }
73
- /**
74
- * Custom error class representing a missing api region error.
75
- * @class
76
- * @extends {Error}
77
- */
78
- export class MissingRegionError extends Error {
79
- constructor() {
80
- super("Api region must be setup. Check documentation");
81
- this.name = "MissingRegionError";
82
- }
83
- }
@@ -1,4 +0,0 @@
1
- export { setup } from "./config.js";
2
- export { authenticate } from "./auth.js";
3
- export { request } from "./request.js";
4
- export type { Asset, Character, Href, KeyId, KeyName, KeyNameId, LinkSelfHref, LocalizedString, NameId, Namespaces, RequestOptions, TypeName, } from "./types.js";
@@ -1,3 +0,0 @@
1
- export { setup } from "./config.js";
2
- export { authenticate } from "./auth.js";
3
- export { request } from "./request.js";
@@ -1,13 +0,0 @@
1
- import type { RequestOptions } from "./types.js";
2
- /**
3
- * Makes an authenticated request to the API and handles potential errors.
4
- * @param {RequestOptions} requestOptions - An object containing the following:
5
- * * method: The HTTP method (e.g., "GET", "POST")
6
- * * url: The API endpoint path.
7
- * * namespace (optional): The Battlenet namespace for the request.
8
- * * qs (optional): An object representing query string parameters.
9
- * @returns {Promise<any>} The parsed JSON response from the API.
10
- * @throws {APIError} If there is a problem fetching or the response is not successful.
11
- * @throws {AuthenticationError} (Potentially) If authentication fails during the process.
12
- */
13
- export declare function request(requestOptions: RequestOptions): Promise<unknown>;
@@ -1,46 +0,0 @@
1
- import { apiBaseUrl, getSetup } from "./config.js";
2
- import { authenticate, getauthConfig } from "./auth.js";
3
- import { APIError } from "./errors.js";
4
- /**
5
- * Makes an authenticated request to the API and handles potential errors.
6
- * @param {RequestOptions} requestOptions - An object containing the following:
7
- * * method: The HTTP method (e.g., "GET", "POST")
8
- * * url: The API endpoint path.
9
- * * namespace (optional): The Battlenet namespace for the request.
10
- * * qs (optional): An object representing query string parameters.
11
- * @returns {Promise<any>} The parsed JSON response from the API.
12
- * @throws {APIError} If there is a problem fetching or the response is not successful.
13
- * @throws {AuthenticationError} (Potentially) If authentication fails during the process.
14
- */
15
- export async function request(requestOptions) {
16
- if (!getauthConfig().accessToken || (getauthConfig().accessToken && getauthConfig().tokenExpiration &&
17
- new Date() < new Date(getauthConfig().tokenExpiration))) {
18
- await authenticate(true);
19
- }
20
- const { method, url, namespace } = requestOptions;
21
- let { qs } = requestOptions;
22
- if (getSetup().locale) {
23
- qs = { ...{ locale: getSetup().locale }, ...qs };
24
- }
25
- const qsString = qs
26
- ? Object.fromEntries(Object.entries(qs).filter(([, value]) => value !== undefined).map(([key, value]) => [key, value.toString()]))
27
- : {};
28
- const params = new URLSearchParams(qsString);
29
- const headers = {
30
- "Authorization": "Bearer " + getauthConfig().accessToken,
31
- };
32
- if (namespace) {
33
- headers["Battlenet-Namespace"] = `${namespace}-${getSetup().region}`;
34
- }
35
- const response = await fetch(apiBaseUrl(getSetup().region) + encodeURI(url) + (qsString ? "?" + params.toString() : ""), {
36
- method: method,
37
- headers: headers,
38
- });
39
- if (response.ok) {
40
- return await response.json();
41
- }
42
- const errorData = await response.json();
43
- const statusCode = errorData.code || response.status;
44
- const errorMessage = JSON.stringify(errorData) || "Problem fetching data from API";
45
- throw new APIError(errorMessage, statusCode, response.statusText);
46
- }
@@ -1,120 +0,0 @@
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
- */
8
- export interface RequestOptions {
9
- method: "GET";
10
- url: string;
11
- namespace?: Namespaces;
12
- qs?: Record<string, string | number>;
13
- }
14
- /**
15
- * Supported Battle.net regions.
16
- */
17
- export type Regions = "us" | "eu" | "kr" | "tw" | "cn";
18
- /**
19
- * Supported locales for data.
20
- */
21
- 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";
22
- /**
23
- * Available Battle.net namespaces.
24
- */
25
- export type Namespaces = "static" | "dynamic" | "profile";
26
- /**
27
- * Represents a reference (link) with a URL.
28
- */
29
- export interface Href {
30
- /**
31
- * The URL or address of the reference.
32
- */
33
- href: string;
34
- }
35
- /**
36
- * Represents a self-referential link structure commonly found in API responses.
37
- */
38
- export interface LinkSelfHref {
39
- self: Href;
40
- }
41
- /**
42
- * Represents localized text. It can be either a string (if no locale was used) or a key-value object for multiple locales.
43
- */
44
- export interface LocalizedString {
45
- name: string | Record<Locales, string>;
46
- }
47
- /**
48
- * Represents an object with a key (link), ID and LocalizedString name.
49
- */
50
- export interface KeyNameId {
51
- key: {
52
- href: string;
53
- };
54
- name: LocalizedString;
55
- id: number;
56
- }
57
- /**
58
- * Represents an object with a key (link) and LocalizedString name.
59
- */
60
- export interface KeyName {
61
- key: {
62
- href: string;
63
- };
64
- name: LocalizedString;
65
- }
66
- /**
67
- * Represents an object with a key (link) and ID.
68
- */
69
- export interface KeyId {
70
- key: {
71
- href: string;
72
- };
73
- id: number;
74
- }
75
- /**
76
- * Represents an object with LocalizedString name and ID.
77
- */
78
- export interface NameId {
79
- name: LocalizedString;
80
- id: number;
81
- }
82
- /**
83
- * Represents an object with a type and a LocalizedString name.
84
- */
85
- export interface TypeName {
86
- type: string;
87
- name: LocalizedString;
88
- }
89
- /**
90
- * Represents a character profile.
91
- */
92
- export interface Character {
93
- key?: {
94
- href: string;
95
- };
96
- name: string;
97
- id: number;
98
- realm: {
99
- key: {
100
- href: string;
101
- };
102
- name: LocalizedString;
103
- id: number;
104
- slug: string;
105
- };
106
- level?: number;
107
- playable_class?: KeyId;
108
- playable_race?: KeyId;
109
- }
110
- /**
111
- * Represents a generic asset within a system.
112
- * @property {string} key - A unique identifier for the asset.
113
- * @property {string} value - The value associated with the asset.
114
- * @property {number} [file_data_id] - (Optional) The ID of the file data associated with the asset (if any).
115
- */
116
- export interface Asset {
117
- key: string;
118
- value: string;
119
- file_data_id?: number;
120
- }
@@ -1,2 +0,0 @@
1
- //types.ts
2
- export {};
@@ -1,32 +0,0 @@
1
- import type { LinkSelfHref } from "../../shared/index.js";
2
- export interface League extends LinkSelfHref {
3
- key: {
4
- league_id: number;
5
- season_id: number;
6
- queue_id: number;
7
- team_type: number;
8
- };
9
- tier: {
10
- id: number;
11
- division: {
12
- id: number;
13
- ladder_id: number;
14
- member_count: number;
15
- }[];
16
- }[];
17
- }
18
- /**
19
- * Returns data for the specified season, queue, team, and league.
20
- *
21
- * Notes from the battle.net docs:
22
- * queueId: the standard available queueIds are: 1=WoL 1v1, 2=WoL 2v2, 3=WoL 3v3, 4=WoL 4v4, 101=HotS 1v1, 102=HotS 2v2, 103=HotS 3v3, 104=HotS 4v4, 201=LotV 1v1, 202=LotV 2v2, 203=LotV 3v3, 204=LotV 4v4, 206=LotV Archon. Note that other available queues may not be listed here.
23
- * teamType: there are two available teamTypes: 0=arranged, 1=random.
24
- * leagueId: available leagueIds are: 0=Bronze, 1=Silver, 2=Gold, 3=Platinum, 4=Diamond, 5=Master, 6=Grandmaster.
25
- *
26
- * @param seasonId - The season ID of the data to retrieve.
27
- * @param queueId - The queue ID of the data to retrieve.
28
- * @param teamType - The team type of the data to retrieve.
29
- * @param leagueId - The league ID of the data to retrieve.
30
- * @returns A promise that resolves to an object representing the data for a league.
31
- */
32
- export declare function leagueData(seasonId: number, queueId: number, teamType: number, leagueId: number): Promise<League>;
@@ -1,21 +0,0 @@
1
- import { request } from "../../shared/index.js";
2
- /**
3
- * Returns data for the specified season, queue, team, and league.
4
- *
5
- * Notes from the battle.net docs:
6
- * queueId: the standard available queueIds are: 1=WoL 1v1, 2=WoL 2v2, 3=WoL 3v3, 4=WoL 4v4, 101=HotS 1v1, 102=HotS 2v2, 103=HotS 3v3, 104=HotS 4v4, 201=LotV 1v1, 202=LotV 2v2, 203=LotV 3v3, 204=LotV 4v4, 206=LotV Archon. Note that other available queues may not be listed here.
7
- * teamType: there are two available teamTypes: 0=arranged, 1=random.
8
- * leagueId: available leagueIds are: 0=Bronze, 1=Silver, 2=Gold, 3=Platinum, 4=Diamond, 5=Master, 6=Grandmaster.
9
- *
10
- * @param seasonId - The season ID of the data to retrieve.
11
- * @param queueId - The queue ID of the data to retrieve.
12
- * @param teamType - The team type of the data to retrieve.
13
- * @param leagueId - The league ID of the data to retrieve.
14
- * @returns A promise that resolves to an object representing the data for a league.
15
- */
16
- export async function leagueData(seasonId, queueId, teamType, leagueId) {
17
- return await request({
18
- method: "GET",
19
- url: `/data/sc2/league/${seasonId}/${queueId}/${teamType}/${leagueId}`,
20
- });
21
- }
@@ -1 +0,0 @@
1
- export { leagueData } from "./game_data/league.js";
@@ -1 +0,0 @@
1
- export { leagueData } from "./game_data/league.js";
@@ -1,84 +0,0 @@
1
- /**
2
- * This module provides interfaces and API function definitions for fetching World of Warcraft achievement data using the Blizzard API.
3
- *
4
- * @author Pinta <https://github.com/Pinta365>
5
- */
6
- import type { Asset, KeyId, KeyNameId, LinkSelfHref, LocalizedString } from "../../shared/index.js";
7
- export interface AchievementCategories extends LinkSelfHref {
8
- categories: KeyNameId[];
9
- }
10
- export interface AggregatesByFaction {
11
- alliance: {
12
- quantity: number;
13
- points: number;
14
- };
15
- horde: {
16
- quantity: number;
17
- points: number;
18
- };
19
- }
20
- export interface AchievementCategory extends LinkSelfHref {
21
- id: number;
22
- name: LocalizedString;
23
- achievements: KeyNameId[];
24
- parent_category: KeyNameId;
25
- is_guild_category: boolean;
26
- aggregates_by_faction: AggregatesByFaction;
27
- display_order: number;
28
- }
29
- export interface Achievements extends LinkSelfHref {
30
- achievements: KeyNameId[];
31
- }
32
- export interface Achievement extends LinkSelfHref {
33
- id: number;
34
- category: KeyNameId;
35
- name: LocalizedString;
36
- description: LocalizedString;
37
- points: number;
38
- is_account_wide: boolean;
39
- criteria: {
40
- id: number;
41
- description: LocalizedString;
42
- amount: number;
43
- };
44
- next_achievement: KeyNameId;
45
- media: KeyId;
46
- display_order: number;
47
- }
48
- export interface AchievementMedia extends LinkSelfHref {
49
- assets: Asset[];
50
- id: number;
51
- }
52
- /**
53
- * Fetches and returns an index of achievement categories.
54
- *
55
- * @returns A promise that resolves to an object representing the index of achievement categories.
56
- */
57
- export declare function achievementCategories(): Promise<AchievementCategories>;
58
- /**
59
- * Fetches and returns details of a specific achievement category identified by its ID.
60
- *
61
- * @param achievementCategoryId - The unique identifier of the achievement category to retrieve.
62
- * @returns A promise that resolves to an object representing the achievement category details.
63
- */
64
- export declare function achievementCategory(achievementCategoryId: number): Promise<AchievementCategory>;
65
- /**
66
- * Fetches and returns an index of achievements.
67
- *
68
- * @returns A promise that resolves to an object representing the index of achievements.
69
- */
70
- export declare function achievements(): Promise<Achievements>;
71
- /**
72
- * Fetches and returns details of a specific achievement identified by its ID.
73
- *
74
- * @param achievementId - The unique identifier of the achievement to retrieve.
75
- * @returns A promise that resolves to an object representing the achievement details.
76
- */
77
- export declare function achievement(achievementId: number): Promise<Achievement>;
78
- /**
79
- * Fetches and returns media details for a specific achievement identified by its ID.
80
- *
81
- * @param achievementId - The unique identifier of the achievement to retrieve media details for.
82
- * @returns A promise that resolves to an object representing the achievement media details.
83
- */
84
- export declare function achievementMedia(achievementId: number): Promise<AchievementMedia>;
@@ -1,69 +0,0 @@
1
- /**
2
- * This module provides interfaces and API function definitions for fetching World of Warcraft achievement data using the Blizzard API.
3
- *
4
- * @author Pinta <https://github.com/Pinta365>
5
- */
6
- import { request } from "../../shared/index.js";
7
- /**
8
- * Fetches and returns an index of achievement categories.
9
- *
10
- * @returns A promise that resolves to an object representing the index of achievement categories.
11
- */
12
- export async function achievementCategories() {
13
- return await request({
14
- method: "GET",
15
- url: "/data/wow/achievement-category/index",
16
- namespace: "static",
17
- });
18
- }
19
- /**
20
- * Fetches and returns details of a specific achievement category identified by its ID.
21
- *
22
- * @param achievementCategoryId - The unique identifier of the achievement category to retrieve.
23
- * @returns A promise that resolves to an object representing the achievement category details.
24
- */
25
- export async function achievementCategory(achievementCategoryId) {
26
- return await request({
27
- method: "GET",
28
- url: `/data/wow/achievement-category/${achievementCategoryId}`,
29
- namespace: "static",
30
- });
31
- }
32
- /**
33
- * Fetches and returns an index of achievements.
34
- *
35
- * @returns A promise that resolves to an object representing the index of achievements.
36
- */
37
- export async function achievements() {
38
- return await request({
39
- method: "GET",
40
- url: "/data/wow/achievement/index",
41
- namespace: "static",
42
- });
43
- }
44
- /**
45
- * Fetches and returns details of a specific achievement identified by its ID.
46
- *
47
- * @param achievementId - The unique identifier of the achievement to retrieve.
48
- * @returns A promise that resolves to an object representing the achievement details.
49
- */
50
- export async function achievement(achievementId) {
51
- return await request({
52
- method: "GET",
53
- url: `/data/wow/achievement/${achievementId}`,
54
- namespace: "static",
55
- });
56
- }
57
- /**
58
- * Fetches and returns media details for a specific achievement identified by its ID.
59
- *
60
- * @param achievementId - The unique identifier of the achievement to retrieve media details for.
61
- * @returns A promise that resolves to an object representing the achievement media details.
62
- */
63
- export async function achievementMedia(achievementId) {
64
- return await request({
65
- method: "GET",
66
- url: `/data/wow/media/achievement/${achievementId}`,
67
- namespace: "static",
68
- });
69
- }
@@ -1,64 +0,0 @@
1
- import type { LinkSelfHref } from "../../shared/index.js";
2
- export interface AuctionItem {
3
- id: number;
4
- modifiers?: {
5
- type: number;
6
- value: number;
7
- }[];
8
- pet_breed_id?: number;
9
- pet_level?: number;
10
- pet_quality_id?: number;
11
- pet_species_id?: number;
12
- bonus_lists?: number[];
13
- context?: number;
14
- }
15
- export interface AuctionListing {
16
- id: number;
17
- item: AuctionItem;
18
- bid?: number;
19
- buyout?: number;
20
- quantity: number;
21
- time_left: "SHORT" | "MEDIUM" | "LONG" | "VERY_LONG";
22
- }
23
- export interface Auctions extends LinkSelfHref {
24
- connected_realm: {
25
- href: string;
26
- };
27
- auctions: AuctionListing[];
28
- commodities: {
29
- href: string;
30
- };
31
- }
32
- export interface commodity {
33
- "id": number;
34
- "item": {
35
- "id": number;
36
- };
37
- "quantity": number;
38
- "unit_price": number;
39
- "time_left": "SHORT" | "MEDIUM" | "LONG" | "VERY_LONG";
40
- }
41
- export interface Commodities extends LinkSelfHref {
42
- auctions: commodity[];
43
- }
44
- /**
45
- * Returns all active auctions for a connected realm.
46
- *
47
- * Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice.
48
- *
49
- * NOTE: Depending on the number of active auctions on the specified connected realm, the response from this endpoint may be rather large.
50
- *
51
- * @param connectedRealmId - The id of the connected realm to return auctions from.
52
- * @returns A promise that resolves to an object representing the auctions being listed.
53
- */
54
- export declare function auctions(connectedRealmId: number): Promise<Auctions>;
55
- /**
56
- * Returns all active auctions for commodity items for the entire game region.
57
- *
58
- * Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice.
59
- *
60
- * NOTE: Depending on the number of active auctions on the specified region, the response from this endpoint may be rather large.
61
- *
62
- * @returns A promise that resolves to an object representing the commodities being listed.
63
- */
64
- export declare function commodities(): Promise<Commodities>;
@@ -1,34 +0,0 @@
1
- import { request } from "../../shared/index.js";
2
- /**
3
- * Returns all active auctions for a connected realm.
4
- *
5
- * Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice.
6
- *
7
- * NOTE: Depending on the number of active auctions on the specified connected realm, the response from this endpoint may be rather large.
8
- *
9
- * @param connectedRealmId - The id of the connected realm to return auctions from.
10
- * @returns A promise that resolves to an object representing the auctions being listed.
11
- */
12
- export async function auctions(connectedRealmId) {
13
- return await request({
14
- method: "GET",
15
- url: `/data/wow/connected-realm/${connectedRealmId}/auctions`,
16
- namespace: "dynamic",
17
- });
18
- }
19
- /**
20
- * Returns all active auctions for commodity items for the entire game region.
21
- *
22
- * Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice.
23
- *
24
- * NOTE: Depending on the number of active auctions on the specified region, the response from this endpoint may be rather large.
25
- *
26
- * @returns A promise that resolves to an object representing the commodities being listed.
27
- */
28
- export async function commodities() {
29
- return await request({
30
- method: "GET",
31
- url: "/data/wow/auctions/commodities",
32
- namespace: "dynamic",
33
- });
34
- }
@@ -1,49 +0,0 @@
1
- import type { Asset, KeyId, KeyNameId, LinkSelfHref, LocalizedString } from "../../shared/index.js";
2
- import type { Search, SearchParameters } from "../search.js";
3
- export interface AzeriteEssences extends LinkSelfHref {
4
- azerite_essences: KeyNameId[];
5
- }
6
- export interface AzeritePower {
7
- id: number;
8
- rank: number;
9
- main_power_spell: KeyNameId;
10
- passive_power_spell: KeyNameId;
11
- }
12
- export interface AzeriteEssenceDetails extends LinkSelfHref {
13
- id: number;
14
- name: LocalizedString;
15
- allowed_specializations: KeyNameId[];
16
- powers: AzeritePower[];
17
- media: KeyId;
18
- }
19
- export interface AzeritEessenceMedia extends LinkSelfHref {
20
- assets: Asset[];
21
- id: number;
22
- }
23
- /**
24
- * Returns Azerite Essences Index
25
- *
26
- * @returns A promise that resolves to an object representing a list of all Azerite Essences.
27
- */
28
- export declare function azeriteEssences(): Promise<AzeriteEssences>;
29
- /**
30
- * Returns details about a specific Azerite Essence Id
31
- *
32
- * @param azeriteEssenceId - The unique identifier Azerite Essence.
33
- * @returns A promise that resolves to an object representing details about an Azerite Essences.
34
- */
35
- export declare function azeriteEssence(azeriteEssenceId: number): Promise<AzeriteEssenceDetails>;
36
- /**
37
- * Performs a search of azerite essences.
38
- *
39
- * @param SearchParameters - Object containing search parameters.
40
- * @returns A promise that resolves to an object representing details about a Azerite Essences search.
41
- */
42
- export declare function searchAzeriteEssence(searchParameters: SearchParameters): Promise<Search>;
43
- /**
44
- * Returns media details about a specific Azerite Essence Id
45
- *
46
- * @param azeriteEssenceId - The unique identifier Azerite Essence.
47
- * @returns A promise that resolves to an object representing media details about an Azerite Essences.
48
- */
49
- export declare function azeriteEssenceMedia(azeriteEssenceId: number): Promise<AzeritEessenceMedia>;