@pinta365/blizzard_api 0.3.5

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 (281) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -0
  3. package/esm/mod.d.ts +5 -0
  4. package/esm/mod.js +5 -0
  5. package/esm/package.json +3 -0
  6. package/esm/src/hearthstone/game_data/card_backs.d.ts +22 -0
  7. package/esm/src/hearthstone/game_data/card_backs.js +23 -0
  8. package/esm/src/hearthstone/game_data/cards.d.ts +37 -0
  9. package/esm/src/hearthstone/game_data/cards.js +27 -0
  10. package/esm/src/hearthstone/game_data/decks.d.ts +88 -0
  11. package/esm/src/hearthstone/game_data/decks.js +14 -0
  12. package/esm/src/hearthstone/game_data/metadata.d.ts +95 -0
  13. package/esm/src/hearthstone/game_data/metadata.js +12 -0
  14. package/esm/src/hearthstone/index.d.ts +4 -0
  15. package/esm/src/hearthstone/index.js +4 -0
  16. package/esm/src/hearthstone/search.d.ts +20 -0
  17. package/esm/src/hearthstone/search.js +29 -0
  18. package/esm/src/shared/auth.d.ts +24 -0
  19. package/esm/src/shared/auth.js +58 -0
  20. package/esm/src/shared/config.d.ts +40 -0
  21. package/esm/src/shared/config.js +48 -0
  22. package/esm/src/shared/errors.d.ts +44 -0
  23. package/esm/src/shared/errors.js +83 -0
  24. package/esm/src/shared/index.d.ts +4 -0
  25. package/esm/src/shared/index.js +3 -0
  26. package/esm/src/shared/request.d.ts +13 -0
  27. package/esm/src/shared/request.js +43 -0
  28. package/esm/src/shared/types.d.ts +120 -0
  29. package/esm/src/shared/types.js +2 -0
  30. package/esm/src/starcraft2/game_data/league.d.ts +32 -0
  31. package/esm/src/starcraft2/game_data/league.js +21 -0
  32. package/esm/src/starcraft2/index.d.ts +1 -0
  33. package/esm/src/starcraft2/index.js +1 -0
  34. package/esm/src/wow/game_data/achievement.d.ts +84 -0
  35. package/esm/src/wow/game_data/achievement.js +69 -0
  36. package/esm/src/wow/game_data/auction_house.d.ts +64 -0
  37. package/esm/src/wow/game_data/auction_house.js +34 -0
  38. package/esm/src/wow/game_data/azerite_essence.d.ts +49 -0
  39. package/esm/src/wow/game_data/azerite_essence.js +49 -0
  40. package/esm/src/wow/game_data/connected_realm.d.ts +54 -0
  41. package/esm/src/wow/game_data/connected_realm.js +36 -0
  42. package/esm/src/wow/game_data/covenant.d.ts +108 -0
  43. package/esm/src/wow/game_data/covenant.js +89 -0
  44. package/esm/src/wow/game_data/creature.d.ts +97 -0
  45. package/esm/src/wow/game_data/creature.js +100 -0
  46. package/esm/src/wow/game_data/guild_crest.d.ts +55 -0
  47. package/esm/src/wow/game_data/guild_crest.js +39 -0
  48. package/esm/src/wow/game_data/heirloom.d.ts +79 -0
  49. package/esm/src/wow/game_data/heirloom.js +26 -0
  50. package/esm/src/wow/game_data/item.d.ts +166 -0
  51. package/esm/src/wow/game_data/item.js +101 -0
  52. package/esm/src/wow/game_data/journal.d.ts +121 -0
  53. package/esm/src/wow/game_data/journal.js +99 -0
  54. package/esm/src/wow/game_data/keystone_affix.d.ts +34 -0
  55. package/esm/src/wow/game_data/keystone_affix.js +39 -0
  56. package/esm/src/wow/game_data/media_search.d.ts +8 -0
  57. package/esm/src/wow/game_data/media_search.js +10 -0
  58. package/esm/src/wow/game_data/modified_crafting.d.ts +56 -0
  59. package/esm/src/wow/game_data/modified_crafting.js +63 -0
  60. package/esm/src/wow/game_data/mount.d.ts +30 -0
  61. package/esm/src/wow/game_data/mount.js +30 -0
  62. package/esm/src/wow/game_data/mythic_keystone_dungeon.d.ts +91 -0
  63. package/esm/src/wow/game_data/mythic_keystone_dungeon.js +88 -0
  64. package/esm/src/wow/game_data/mythic_keystone_leaderboard.d.ts +58 -0
  65. package/esm/src/wow/game_data/mythic_keystone_leaderboard.js +29 -0
  66. package/esm/src/wow/game_data/mythic_raid_leaderboard.d.ts +31 -0
  67. package/esm/src/wow/game_data/mythic_raid_leaderboard.js +15 -0
  68. package/esm/src/wow/game_data/pet.d.ts +91 -0
  69. package/esm/src/wow/game_data/pet.js +77 -0
  70. package/esm/src/wow/game_data/playable_class.d.ts +57 -0
  71. package/esm/src/wow/game_data/playable_class.js +52 -0
  72. package/esm/src/wow/game_data/playable_race.d.ts +29 -0
  73. package/esm/src/wow/game_data/playable_race.js +26 -0
  74. package/esm/src/wow/game_data/power_type.d.ts +21 -0
  75. package/esm/src/wow/game_data/power_type.js +26 -0
  76. package/esm/src/wow/game_data/profession.d.ts +85 -0
  77. package/esm/src/wow/game_data/profession.js +79 -0
  78. package/esm/src/wow/game_data/pvp_season.d.ts +99 -0
  79. package/esm/src/wow/game_data/pvp_season.js +66 -0
  80. package/esm/src/wow/game_data/pvp_tier.d.ts +40 -0
  81. package/esm/src/wow/game_data/pvp_tier.js +39 -0
  82. package/esm/src/wow/game_data/quest.d.ts +114 -0
  83. package/esm/src/wow/game_data/quest.js +101 -0
  84. package/esm/src/wow/game_data/realm.d.ts +42 -0
  85. package/esm/src/wow/game_data/realm.js +36 -0
  86. package/esm/src/wow/game_data/region.d.ts +24 -0
  87. package/esm/src/wow/game_data/region.js +26 -0
  88. package/esm/src/wow/game_data/reputations.d.ts +50 -0
  89. package/esm/src/wow/game_data/reputations.js +51 -0
  90. package/esm/src/wow/game_data/spell.d.ts +33 -0
  91. package/esm/src/wow/game_data/spell.js +37 -0
  92. package/esm/src/wow/game_data/talent.d.ts +129 -0
  93. package/esm/src/wow/game_data/talent.js +90 -0
  94. package/esm/src/wow/game_data/tech_talent.d.ts +70 -0
  95. package/esm/src/wow/game_data/tech_talent.js +64 -0
  96. package/esm/src/wow/game_data/title.d.ts +25 -0
  97. package/esm/src/wow/game_data/title.js +26 -0
  98. package/esm/src/wow/game_data/token.d.ts +16 -0
  99. package/esm/src/wow/game_data/token.js +19 -0
  100. package/esm/src/wow/game_data/toy.d.ts +24 -0
  101. package/esm/src/wow/game_data/toy.js +26 -0
  102. package/esm/src/wow/index.d.ts +53 -0
  103. package/esm/src/wow/index.js +55 -0
  104. package/esm/src/wow/profile/character_achievements.d.ts +87 -0
  105. package/esm/src/wow/profile/character_achievements.js +29 -0
  106. package/esm/src/wow/profile/character_appearance.d.ts +75 -0
  107. package/esm/src/wow/profile/character_appearance.js +15 -0
  108. package/esm/src/wow/profile/character_collections.d.ts +92 -0
  109. package/esm/src/wow/profile/character_collections.js +71 -0
  110. package/esm/src/wow/profile/character_encounters.d.ts +77 -0
  111. package/esm/src/wow/profile/character_encounters.js +43 -0
  112. package/esm/src/wow/profile/character_equipment.d.ts +132 -0
  113. package/esm/src/wow/profile/character_equipment.js +15 -0
  114. package/esm/src/wow/profile/character_hunter_pets.d.ts +21 -0
  115. package/esm/src/wow/profile/character_hunter_pets.js +15 -0
  116. package/esm/src/wow/profile/character_media.d.ts +13 -0
  117. package/esm/src/wow/profile/character_media.js +15 -0
  118. package/esm/src/wow/profile/character_mythic_keystone_profile.d.ts +58 -0
  119. package/esm/src/wow/profile/character_mythic_keystone_profile.js +32 -0
  120. package/esm/src/wow/profile/character_professions.d.ts +26 -0
  121. package/esm/src/wow/profile/character_professions.js +15 -0
  122. package/esm/src/wow/profile/character_profile.d.ts +82 -0
  123. package/esm/src/wow/profile/character_profile.js +40 -0
  124. package/esm/src/wow/profile/character_pvp.d.ts +51 -0
  125. package/esm/src/wow/profile/character_pvp.js +30 -0
  126. package/esm/src/wow/profile/character_quests.d.ts +28 -0
  127. package/esm/src/wow/profile/character_quests.js +29 -0
  128. package/esm/src/wow/profile/character_reputations.d.ts +22 -0
  129. package/esm/src/wow/profile/character_reputations.js +15 -0
  130. package/esm/src/wow/profile/character_soulbinds.d.ts +30 -0
  131. package/esm/src/wow/profile/character_soulbinds.js +15 -0
  132. package/esm/src/wow/profile/character_specializations.d.ts +44 -0
  133. package/esm/src/wow/profile/character_specializations.js +15 -0
  134. package/esm/src/wow/profile/character_statistics.d.ts +116 -0
  135. package/esm/src/wow/profile/character_statistics.js +15 -0
  136. package/esm/src/wow/profile/character_titles.d.ts +13 -0
  137. package/esm/src/wow/profile/character_titles.js +15 -0
  138. package/esm/src/wow/profile/guild.d.ts +117 -0
  139. package/esm/src/wow/profile/guild.js +57 -0
  140. package/esm/src/wow/search.d.ts +21 -0
  141. package/esm/src/wow/search.js +30 -0
  142. package/package.json +36 -0
  143. package/script/mod.d.ts +5 -0
  144. package/script/mod.js +35 -0
  145. package/script/package.json +3 -0
  146. package/script/src/hearthstone/game_data/card_backs.d.ts +22 -0
  147. package/script/src/hearthstone/game_data/card_backs.js +28 -0
  148. package/script/src/hearthstone/game_data/cards.d.ts +37 -0
  149. package/script/src/hearthstone/game_data/cards.js +32 -0
  150. package/script/src/hearthstone/game_data/decks.d.ts +88 -0
  151. package/script/src/hearthstone/game_data/decks.js +18 -0
  152. package/script/src/hearthstone/game_data/metadata.d.ts +95 -0
  153. package/script/src/hearthstone/game_data/metadata.js +16 -0
  154. package/script/src/hearthstone/index.d.ts +4 -0
  155. package/script/src/hearthstone/index.js +13 -0
  156. package/script/src/hearthstone/search.d.ts +20 -0
  157. package/script/src/hearthstone/search.js +33 -0
  158. package/script/src/shared/auth.d.ts +24 -0
  159. package/script/src/shared/auth.js +63 -0
  160. package/script/src/shared/config.d.ts +40 -0
  161. package/script/src/shared/config.js +55 -0
  162. package/script/src/shared/errors.d.ts +44 -0
  163. package/script/src/shared/errors.js +91 -0
  164. package/script/src/shared/index.d.ts +4 -0
  165. package/script/src/shared/index.js +9 -0
  166. package/script/src/shared/request.d.ts +13 -0
  167. package/script/src/shared/request.js +47 -0
  168. package/script/src/shared/types.d.ts +120 -0
  169. package/script/src/shared/types.js +3 -0
  170. package/script/src/starcraft2/game_data/league.d.ts +32 -0
  171. package/script/src/starcraft2/game_data/league.js +25 -0
  172. package/script/src/starcraft2/index.d.ts +1 -0
  173. package/script/src/starcraft2/index.js +5 -0
  174. package/script/src/wow/game_data/achievement.d.ts +84 -0
  175. package/script/src/wow/game_data/achievement.js +77 -0
  176. package/script/src/wow/game_data/auction_house.d.ts +64 -0
  177. package/script/src/wow/game_data/auction_house.js +39 -0
  178. package/script/src/wow/game_data/azerite_essence.d.ts +49 -0
  179. package/script/src/wow/game_data/azerite_essence.js +56 -0
  180. package/script/src/wow/game_data/connected_realm.d.ts +54 -0
  181. package/script/src/wow/game_data/connected_realm.js +42 -0
  182. package/script/src/wow/game_data/covenant.d.ts +108 -0
  183. package/script/src/wow/game_data/covenant.js +99 -0
  184. package/script/src/wow/game_data/creature.d.ts +97 -0
  185. package/script/src/wow/game_data/creature.js +111 -0
  186. package/script/src/wow/game_data/guild_crest.d.ts +55 -0
  187. package/script/src/wow/game_data/guild_crest.js +45 -0
  188. package/script/src/wow/game_data/heirloom.d.ts +79 -0
  189. package/script/src/wow/game_data/heirloom.js +31 -0
  190. package/script/src/wow/game_data/item.d.ts +166 -0
  191. package/script/src/wow/game_data/item.js +112 -0
  192. package/script/src/wow/game_data/journal.d.ts +121 -0
  193. package/script/src/wow/game_data/journal.js +110 -0
  194. package/script/src/wow/game_data/keystone_affix.d.ts +34 -0
  195. package/script/src/wow/game_data/keystone_affix.js +45 -0
  196. package/script/src/wow/game_data/media_search.d.ts +8 -0
  197. package/script/src/wow/game_data/media_search.js +14 -0
  198. package/script/src/wow/game_data/modified_crafting.d.ts +56 -0
  199. package/script/src/wow/game_data/modified_crafting.js +71 -0
  200. package/script/src/wow/game_data/mount.d.ts +30 -0
  201. package/script/src/wow/game_data/mount.js +36 -0
  202. package/script/src/wow/game_data/mythic_keystone_dungeon.d.ts +91 -0
  203. package/script/src/wow/game_data/mythic_keystone_dungeon.js +98 -0
  204. package/script/src/wow/game_data/mythic_keystone_leaderboard.d.ts +58 -0
  205. package/script/src/wow/game_data/mythic_keystone_leaderboard.js +34 -0
  206. package/script/src/wow/game_data/mythic_raid_leaderboard.d.ts +31 -0
  207. package/script/src/wow/game_data/mythic_raid_leaderboard.js +19 -0
  208. package/script/src/wow/game_data/pet.d.ts +91 -0
  209. package/script/src/wow/game_data/pet.js +86 -0
  210. package/script/src/wow/game_data/playable_class.d.ts +57 -0
  211. package/script/src/wow/game_data/playable_class.js +59 -0
  212. package/script/src/wow/game_data/playable_race.d.ts +29 -0
  213. package/script/src/wow/game_data/playable_race.js +31 -0
  214. package/script/src/wow/game_data/power_type.d.ts +21 -0
  215. package/script/src/wow/game_data/power_type.js +31 -0
  216. package/script/src/wow/game_data/profession.d.ts +85 -0
  217. package/script/src/wow/game_data/profession.js +88 -0
  218. package/script/src/wow/game_data/pvp_season.d.ts +99 -0
  219. package/script/src/wow/game_data/pvp_season.js +74 -0
  220. package/script/src/wow/game_data/pvp_tier.d.ts +40 -0
  221. package/script/src/wow/game_data/pvp_tier.js +45 -0
  222. package/script/src/wow/game_data/quest.d.ts +114 -0
  223. package/script/src/wow/game_data/quest.js +112 -0
  224. package/script/src/wow/game_data/realm.d.ts +42 -0
  225. package/script/src/wow/game_data/realm.js +42 -0
  226. package/script/src/wow/game_data/region.d.ts +24 -0
  227. package/script/src/wow/game_data/region.js +31 -0
  228. package/script/src/wow/game_data/reputations.d.ts +50 -0
  229. package/script/src/wow/game_data/reputations.js +58 -0
  230. package/script/src/wow/game_data/spell.d.ts +33 -0
  231. package/script/src/wow/game_data/spell.js +43 -0
  232. package/script/src/wow/game_data/talent.d.ts +129 -0
  233. package/script/src/wow/game_data/talent.js +100 -0
  234. package/script/src/wow/game_data/tech_talent.d.ts +70 -0
  235. package/script/src/wow/game_data/tech_talent.js +72 -0
  236. package/script/src/wow/game_data/title.d.ts +25 -0
  237. package/script/src/wow/game_data/title.js +31 -0
  238. package/script/src/wow/game_data/token.d.ts +16 -0
  239. package/script/src/wow/game_data/token.js +23 -0
  240. package/script/src/wow/game_data/toy.d.ts +24 -0
  241. package/script/src/wow/game_data/toy.js +31 -0
  242. package/script/src/wow/index.d.ts +53 -0
  243. package/script/src/wow/index.js +228 -0
  244. package/script/src/wow/profile/character_achievements.d.ts +87 -0
  245. package/script/src/wow/profile/character_achievements.js +34 -0
  246. package/script/src/wow/profile/character_appearance.d.ts +75 -0
  247. package/script/src/wow/profile/character_appearance.js +19 -0
  248. package/script/src/wow/profile/character_collections.d.ts +92 -0
  249. package/script/src/wow/profile/character_collections.js +79 -0
  250. package/script/src/wow/profile/character_encounters.d.ts +77 -0
  251. package/script/src/wow/profile/character_encounters.js +49 -0
  252. package/script/src/wow/profile/character_equipment.d.ts +132 -0
  253. package/script/src/wow/profile/character_equipment.js +19 -0
  254. package/script/src/wow/profile/character_hunter_pets.d.ts +21 -0
  255. package/script/src/wow/profile/character_hunter_pets.js +19 -0
  256. package/script/src/wow/profile/character_media.d.ts +13 -0
  257. package/script/src/wow/profile/character_media.js +19 -0
  258. package/script/src/wow/profile/character_mythic_keystone_profile.d.ts +58 -0
  259. package/script/src/wow/profile/character_mythic_keystone_profile.js +37 -0
  260. package/script/src/wow/profile/character_professions.d.ts +26 -0
  261. package/script/src/wow/profile/character_professions.js +19 -0
  262. package/script/src/wow/profile/character_profile.d.ts +82 -0
  263. package/script/src/wow/profile/character_profile.js +45 -0
  264. package/script/src/wow/profile/character_pvp.d.ts +51 -0
  265. package/script/src/wow/profile/character_pvp.js +35 -0
  266. package/script/src/wow/profile/character_quests.d.ts +28 -0
  267. package/script/src/wow/profile/character_quests.js +34 -0
  268. package/script/src/wow/profile/character_reputations.d.ts +22 -0
  269. package/script/src/wow/profile/character_reputations.js +19 -0
  270. package/script/src/wow/profile/character_soulbinds.d.ts +30 -0
  271. package/script/src/wow/profile/character_soulbinds.js +19 -0
  272. package/script/src/wow/profile/character_specializations.d.ts +44 -0
  273. package/script/src/wow/profile/character_specializations.js +19 -0
  274. package/script/src/wow/profile/character_statistics.d.ts +116 -0
  275. package/script/src/wow/profile/character_statistics.js +19 -0
  276. package/script/src/wow/profile/character_titles.d.ts +13 -0
  277. package/script/src/wow/profile/character_titles.js +19 -0
  278. package/script/src/wow/profile/guild.d.ts +117 -0
  279. package/script/src/wow/profile/guild.js +64 -0
  280. package/script/src/wow/search.d.ts +21 -0
  281. package/script/src/wow/search.js +34 -0
@@ -0,0 +1,117 @@
1
+ import type { Character, Href, KeyId, KeyNameId, LinkSelfHref, LocalizedString, TypeName } from "../../shared/index.js";
2
+ export interface Rgba {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ a: number;
7
+ }
8
+ export interface CrestAsset {
9
+ id?: number;
10
+ media?: KeyId;
11
+ color: {
12
+ id: number;
13
+ rgba: Rgba;
14
+ };
15
+ }
16
+ export interface Guild extends LinkSelfHref {
17
+ key?: Href;
18
+ id: number;
19
+ name: string;
20
+ faction: TypeName;
21
+ achievement_points?: number;
22
+ member_count?: number;
23
+ realm: {
24
+ key: Href;
25
+ name: LocalizedString;
26
+ id: number;
27
+ slug: string;
28
+ };
29
+ crest?: {
30
+ emblem: CrestAsset;
31
+ border: CrestAsset;
32
+ background: CrestAsset;
33
+ };
34
+ roster?: Href;
35
+ achievements?: Href;
36
+ created_timestamp?: number;
37
+ activity?: Href;
38
+ name_search: string;
39
+ }
40
+ export interface GuildActivity extends LinkSelfHref {
41
+ guild: Guild;
42
+ activities: {
43
+ character_achievement: {
44
+ character: Character;
45
+ achievement: KeyNameId;
46
+ };
47
+ activity: {
48
+ type: string;
49
+ };
50
+ timestamp: number;
51
+ }[];
52
+ }
53
+ export interface Critiera {
54
+ id: number;
55
+ amount?: number;
56
+ is_completed: boolean;
57
+ child_criteria?: Critiera[];
58
+ }
59
+ export interface GuildAchievements extends LinkSelfHref {
60
+ guild: Guild;
61
+ total_quantity: number;
62
+ total_points: number;
63
+ achievements: {
64
+ id: number;
65
+ achievement: KeyNameId;
66
+ criteria: Critiera;
67
+ completed_timestamp: number;
68
+ }[];
69
+ category_progress: {
70
+ category: KeyNameId;
71
+ quantity: number;
72
+ points: number;
73
+ }[];
74
+ recent_events: {
75
+ achievement: KeyNameId;
76
+ timestamp: number;
77
+ }[];
78
+ }
79
+ export interface GuildRoster extends LinkSelfHref {
80
+ guild: Guild;
81
+ members: {
82
+ character: Character;
83
+ rank: number;
84
+ }[];
85
+ }
86
+ /**
87
+ * Returns a single guild by its name and realm.
88
+ *
89
+ * @param realmSlug - The slug of the realm.
90
+ * @param nameSlug - The slug of the guild.
91
+ * @returns A promise that resolves to an object representing a single guild by its name and realm.
92
+ */
93
+ export declare function guild(realmSlug: string, nameSlug: string): Promise<Guild>;
94
+ /**
95
+ * Returns a single guild's activity by name and realm.
96
+ *
97
+ * @param realmSlug - The slug of the realm.
98
+ * @param nameSlug - The slug of the guild.
99
+ * @returns A promise that resolves to an object representing a single guild's activity by its name and realm.
100
+ */
101
+ export declare function guildActivity(realmSlug: string, nameSlug: string): Promise<GuildActivity>;
102
+ /**
103
+ * Returns a single guild's achievements by name and realm.
104
+ *
105
+ * @param realmSlug - The slug of the realm.
106
+ * @param nameSlug - The slug of the guild.
107
+ * @returns A promise that resolves to an object representing a single guild's achievements by its name and realm.
108
+ */
109
+ export declare function guildAchievements(realmSlug: string, nameSlug: string): Promise<GuildAchievements>;
110
+ /**
111
+ * Returns a single guild's roster by its name and realm.
112
+ *
113
+ * @param realmSlug - The slug of the realm.
114
+ * @param nameSlug - The slug of the guild.
115
+ * @returns A promise that resolves to an object representing a single guild's roster by its name and realm.
116
+ */
117
+ export declare function guildRoster(realmSlug: string, nameSlug: string): Promise<GuildRoster>;
@@ -0,0 +1,57 @@
1
+ import { request } from "../../shared/index.js";
2
+ /**
3
+ * Returns a single guild by its name and realm.
4
+ *
5
+ * @param realmSlug - The slug of the realm.
6
+ * @param nameSlug - The slug of the guild.
7
+ * @returns A promise that resolves to an object representing a single guild by its name and realm.
8
+ */
9
+ export async function guild(realmSlug, nameSlug) {
10
+ return await request({
11
+ method: "GET",
12
+ url: `/data/wow/guild/${realmSlug}/${nameSlug}`,
13
+ namespace: "profile",
14
+ });
15
+ }
16
+ /**
17
+ * Returns a single guild's activity by name and realm.
18
+ *
19
+ * @param realmSlug - The slug of the realm.
20
+ * @param nameSlug - The slug of the guild.
21
+ * @returns A promise that resolves to an object representing a single guild's activity by its name and realm.
22
+ */
23
+ export async function guildActivity(realmSlug, nameSlug) {
24
+ return await request({
25
+ method: "GET",
26
+ url: `/data/wow/guild/${realmSlug}/${nameSlug}/activity`,
27
+ namespace: "profile",
28
+ });
29
+ }
30
+ /**
31
+ * Returns a single guild's achievements by name and realm.
32
+ *
33
+ * @param realmSlug - The slug of the realm.
34
+ * @param nameSlug - The slug of the guild.
35
+ * @returns A promise that resolves to an object representing a single guild's achievements by its name and realm.
36
+ */
37
+ export async function guildAchievements(realmSlug, nameSlug) {
38
+ return await request({
39
+ method: "GET",
40
+ url: `/data/wow/guild/${realmSlug}/${nameSlug}/achievements`,
41
+ namespace: "profile",
42
+ });
43
+ }
44
+ /**
45
+ * Returns a single guild's roster by its name and realm.
46
+ *
47
+ * @param realmSlug - The slug of the realm.
48
+ * @param nameSlug - The slug of the guild.
49
+ * @returns A promise that resolves to an object representing a single guild's roster by its name and realm.
50
+ */
51
+ export async function guildRoster(realmSlug, nameSlug) {
52
+ return await request({
53
+ method: "GET",
54
+ url: `/data/wow/guild/${realmSlug}/${nameSlug}/roster`,
55
+ namespace: "profile",
56
+ });
57
+ }
@@ -0,0 +1,21 @@
1
+ import type { Namespaces } from "../shared/index.js";
2
+ export interface SearchParameters {
3
+ searchFields?: Record<string | symbol, string | number>;
4
+ orderBy?: string;
5
+ page?: number;
6
+ pageSize?: number;
7
+ }
8
+ export interface Search {
9
+ page: number;
10
+ pageSize: number;
11
+ maxPageSize: number;
12
+ pageCount: number;
13
+ results: unknown[];
14
+ }
15
+ /**
16
+ * Performs a search.
17
+ *
18
+ * @param SearchParameters - Object containing search parameters.
19
+ * @returns A promise that resolves to an object representing details about the search.
20
+ */
21
+ export declare function search(url: string, namespace: Namespaces, searchParameters: SearchParameters): Promise<Search>;
@@ -0,0 +1,30 @@
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, namespace, 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.orderBy) {
16
+ qs.orderby = searchParameters.orderBy;
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: `/data/wow/search${url}`,
27
+ qs,
28
+ namespace,
29
+ });
30
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@pinta365/blizzard_api",
3
+ "version": "0.3.5",
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
+ "keywords": [
6
+ "blizzard",
7
+ "battlenet",
8
+ "battle.net",
9
+ "bnet",
10
+ "World of Warcraft",
11
+ "StarCraft",
12
+ "Diablo",
13
+ "Hearthstone"
14
+ ],
15
+ "author": "Pinta <https://github.com/Pinta365>",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Pinta365/blizzard_api.git"
19
+ },
20
+ "license": "MIT",
21
+ "bugs": {
22
+ "url": "https://github.com/Pinta365/blizzard_api/issues"
23
+ },
24
+ "main": "./script/mod.js",
25
+ "module": "./esm/mod.js",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./esm/mod.js",
29
+ "require": "./script/mod.js"
30
+ }
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^20.9.0"
34
+ },
35
+ "_generatedBy": "dnt@0.40.0"
36
+ }
@@ -0,0 +1,5 @@
1
+ import { authenticate, setup } from "./src/shared/index.js";
2
+ import * as wow from "./src/wow/index.js";
3
+ import * as hearthstone from "./src/hearthstone/index.js";
4
+ import * as sc2 from "./src/starcraft2/index.js";
5
+ export { authenticate, hearthstone, sc2, setup, wow };
package/script/mod.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.wow = exports.setup = exports.sc2 = exports.hearthstone = exports.authenticate = void 0;
27
+ const index_js_1 = require("./src/shared/index.js");
28
+ Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return index_js_1.authenticate; } });
29
+ Object.defineProperty(exports, "setup", { enumerable: true, get: function () { return index_js_1.setup; } });
30
+ const wow = __importStar(require("./src/wow/index.js"));
31
+ exports.wow = wow;
32
+ const hearthstone = __importStar(require("./src/hearthstone/index.js"));
33
+ exports.hearthstone = hearthstone;
34
+ const sc2 = __importStar(require("./src/starcraft2/index.js"));
35
+ exports.sc2 = sc2;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,22 @@
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>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCardback = exports.searchCardbacks = void 0;
4
+ const index_js_1 = require("../../shared/index.js");
5
+ const search_js_1 = require("../search.js");
6
+ /**
7
+ * Returns an up-to-date list of all card backs matching the search criteria.
8
+ *
9
+ * @param SearchParameters - Object containing search parameters.
10
+ * @returns A promise that resolves to an object representing an up-to-date list of all card backs matching the search criteria.
11
+ */
12
+ async function searchCardbacks(searchParameters) {
13
+ return await (0, search_js_1.search)("/cardback", searchParameters);
14
+ }
15
+ exports.searchCardbacks = searchCardbacks;
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
+ async function fetchCardback(idorslug) {
23
+ return await (0, index_js_1.request)({
24
+ method: "GET",
25
+ url: `/hearthstone/cardback/${idorslug}`,
26
+ });
27
+ }
28
+ exports.fetchCardback = fetchCardback;
@@ -0,0 +1,37 @@
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>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCard = exports.searchCards = void 0;
4
+ const index_js_1 = require("../../shared/index.js");
5
+ const search_js_1 = require("../search.js");
6
+ /**
7
+ * Returns an up-to-date list of all cards matching the search criteria.
8
+ *
9
+ * @param SearchParameters - Object containing search parameters.
10
+ * @returns A promise that resolves to an object representing an up-to-date list of all cards matching the search criteria.
11
+ */
12
+ async function searchCards(searchParameters) {
13
+ return await (0, search_js_1.search)("/cards", searchParameters);
14
+ }
15
+ exports.searchCards = searchCards;
16
+ /**
17
+ * Returns the card with an ID or slug that matches the one you specify.
18
+ *
19
+ * @param idorslug - The unique identifier for the card by slug.
20
+ * @returns A promise that resolves to an object representing details about a card.
21
+ */
22
+ async function fetchCard(idorslug, gameMode) {
23
+ const reqOptions = {
24
+ method: "GET",
25
+ url: `/hearthstone/cards/${idorslug}`,
26
+ };
27
+ if (gameMode) {
28
+ reqOptions["qs"] = { gameMode };
29
+ }
30
+ return await (0, index_js_1.request)(reqOptions);
31
+ }
32
+ exports.fetchCard = fetchCard;
@@ -0,0 +1,88 @@
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>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchDeck = void 0;
4
+ const index_js_1 = require("../../shared/index.js");
5
+ /**
6
+ * Returns the card with an ID or slug that matches the one you specify.
7
+ *
8
+ * @param options - find parameters fort the search.
9
+ * @returns A promise that resolves to an object representing details about a card.
10
+ */
11
+ async function fetchDeck(options) {
12
+ return await (0, index_js_1.request)({
13
+ method: "GET",
14
+ url: `/hearthstone/deck`,
15
+ qs: options,
16
+ });
17
+ }
18
+ exports.fetchDeck = fetchDeck;
@@ -0,0 +1,95 @@
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 {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.metadata = void 0;
4
+ const index_js_1 = require("../../shared/index.js");
5
+ /**
6
+ * 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.
7
+ *
8
+ * @returns A promise that resolves to an object representing the Metadata.
9
+ */
10
+ async function metadata(type) {
11
+ return await (0, index_js_1.request)({
12
+ method: "GET",
13
+ url: `/hearthstone/metadata/${type}`,
14
+ });
15
+ }
16
+ exports.metadata = metadata;
@@ -0,0 +1,4 @@
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";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.metadata = exports.fetchDeck = exports.searchCardbacks = exports.fetchCardback = exports.searchCards = exports.fetchCard = void 0;
4
+ var cards_js_1 = require("./game_data/cards.js");
5
+ Object.defineProperty(exports, "fetchCard", { enumerable: true, get: function () { return cards_js_1.fetchCard; } });
6
+ Object.defineProperty(exports, "searchCards", { enumerable: true, get: function () { return cards_js_1.searchCards; } });
7
+ var card_backs_js_1 = require("./game_data/card_backs.js");
8
+ Object.defineProperty(exports, "fetchCardback", { enumerable: true, get: function () { return card_backs_js_1.fetchCardback; } });
9
+ Object.defineProperty(exports, "searchCardbacks", { enumerable: true, get: function () { return card_backs_js_1.searchCardbacks; } });
10
+ var decks_js_1 = require("./game_data/decks.js");
11
+ Object.defineProperty(exports, "fetchDeck", { enumerable: true, get: function () { return decks_js_1.fetchDeck; } });
12
+ var metadata_js_1 = require("./game_data/metadata.js");
13
+ Object.defineProperty(exports, "metadata", { enumerable: true, get: function () { return metadata_js_1.metadata; } });