@pinta365/blizzard_api 0.7.1 → 0.8.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 (60) hide show
  1. package/README.md +40 -4
  2. package/esm/mod.d.ts +4 -2
  3. package/esm/mod.js +2 -0
  4. package/esm/src/client.d.ts +9 -1
  5. package/esm/src/client.js +2 -0
  6. package/esm/src/generated/wow_forever_api.d.ts +939 -0
  7. package/esm/src/generated/wow_forever_api.js +2 -0
  8. package/esm/src/shared/context.d.ts +13 -2
  9. package/esm/src/shared/context.js +24 -9
  10. package/esm/src/shared/types.d.ts +1 -1
  11. package/esm/src/wow/game_data/achievement.d.ts +4 -0
  12. package/esm/src/wow/game_data/item.d.ts +29 -6
  13. package/esm/src/wow/game_data/mount.d.ts +2 -1
  14. package/esm/src/wow/game_data/reputations.d.ts +7 -1
  15. package/esm/src/wow/game_data/talent.d.ts +6 -2
  16. package/esm/src/wow/profile/character_statistics.d.ts +4 -0
  17. package/esm/src/wow_forever/account.d.ts +42 -0
  18. package/esm/src/wow_forever/account.js +24 -0
  19. package/esm/src/wow_forever/character.d.ts +336 -0
  20. package/esm/src/wow_forever/character.js +269 -0
  21. package/esm/src/wow_forever/game_data.d.ts +196 -0
  22. package/esm/src/wow_forever/game_data.js +166 -0
  23. package/esm/src/wow_forever/guild.d.ts +88 -0
  24. package/esm/src/wow_forever/guild.js +57 -0
  25. package/esm/src/wow_forever/index.d.ts +39 -0
  26. package/esm/src/wow_forever/index.js +45 -0
  27. package/esm/src/wow_forever/ruleset.d.ts +32 -0
  28. package/esm/src/wow_forever/ruleset.js +30 -0
  29. package/esm/src/wow_forever/types.d.ts +5 -0
  30. package/esm/src/wow_forever/types.js +1 -0
  31. package/package.json +5 -1
  32. package/script/mod.d.ts +4 -2
  33. package/script/mod.js +3 -1
  34. package/script/src/client.d.ts +9 -1
  35. package/script/src/client.js +2 -0
  36. package/script/src/generated/wow_forever_api.d.ts +939 -0
  37. package/script/src/generated/wow_forever_api.js +3 -0
  38. package/script/src/shared/context.d.ts +13 -2
  39. package/script/src/shared/context.js +24 -9
  40. package/script/src/shared/types.d.ts +1 -1
  41. package/script/src/wow/game_data/achievement.d.ts +4 -0
  42. package/script/src/wow/game_data/item.d.ts +29 -6
  43. package/script/src/wow/game_data/mount.d.ts +2 -1
  44. package/script/src/wow/game_data/reputations.d.ts +7 -1
  45. package/script/src/wow/game_data/talent.d.ts +6 -2
  46. package/script/src/wow/profile/character_statistics.d.ts +4 -0
  47. package/script/src/wow_forever/account.d.ts +42 -0
  48. package/script/src/wow_forever/account.js +28 -0
  49. package/script/src/wow_forever/character.d.ts +336 -0
  50. package/script/src/wow_forever/character.js +296 -0
  51. package/script/src/wow_forever/game_data.d.ts +196 -0
  52. package/script/src/wow_forever/game_data.js +185 -0
  53. package/script/src/wow_forever/guild.d.ts +88 -0
  54. package/script/src/wow_forever/guild.js +63 -0
  55. package/script/src/wow_forever/index.d.ts +39 -0
  56. package/script/src/wow_forever/index.js +180 -0
  57. package/script/src/wow_forever/ruleset.d.ts +32 -0
  58. package/script/src/wow_forever/ruleset.js +34 -0
  59. package/script/src/wow_forever/types.d.ts +5 -0
  60. package/script/src/wow_forever/types.js +2 -0
package/README.md CHANGED
@@ -18,6 +18,7 @@ Available as:
18
18
  | **World of Warcraft:** Profile APIs | ✅ | Account profile endpoints need a user token |
19
19
  | **World of Warcraft Classic:** Game Data | ✅ | Progression (`wowClassic`) and Era (`wowClassicEra`) |
20
20
  | **World of Warcraft Classic:** Profile APIs | ✅ | Progression (`wowClassic`) and Era (`wowClassicEra`) |
21
+ | **World of Warcraft: Forever** | ✅ | `wowForever`; auctions once Blizzard serves them |
21
22
  | **Diablo III:** Community APIs | ✅ | Including account and hero profiles |
22
23
  | **Diablo III:** Game Data APIs | ✅ | |
23
24
  | **Hearthstone:** Game Data APIs | ✅ | |
@@ -81,11 +82,39 @@ const { createClient } = require("@pinta365/blizzard_api");
81
82
  | `client.wow` | World of Warcraft (Retail) |
82
83
  | `client.wowClassic` | WoW Classic progression (currently Mists of Pandaria Classic) |
83
84
  | `client.wowClassicEra` | WoW Classic Era, Season of Discovery, Hardcore, Anniversary |
85
+ | `client.wowForever` | WoW: Forever (game data, characters and account profile) |
84
86
  | `client.hearthstone` | Hearthstone |
85
87
  | `client.sc2` | StarCraft II |
86
88
  | `client.diablo3` | Diablo III |
87
89
 
88
- The two Classic properties only include the endpoints Blizzard supports for that flavor.
90
+ The Classic and Forever properties only include the endpoints Blizzard supports for that flavor.
91
+
92
+ ### WoW: Forever
93
+
94
+ Blizzard hasn't documented the Forever API yet; `wowForever` covers what answers so far: game data, rulesets, character
95
+ profiles, guilds and the account profile. Auction endpoints follow once Blizzard serves them.
96
+
97
+ Forever is realmless. Players pick a ruleset (Normal, PvP, Roleplay, Roleplay PvP) instead of a realm, so use
98
+ `rulesets()` and `ruleset(id)` instead of the realm endpoints. Characters have a two-part name, unique per region, and
99
+ are looked up by `name` and `surname`:
100
+
101
+ ```ts
102
+ const profile = await client.wowForever.characterProfile("Anduin", "Wrynn");
103
+ const gear = await client.wowForever.characterEquipments("Anduin", "Wrynn");
104
+ ```
105
+
106
+ Characters only show up from level 10, after they log out; before that the API returns 404. Guilds are realmless too, so
107
+ they are looked up by their slug alone: `client.wowForever.guildRoster("my-guild")`.
108
+
109
+ Static game data uses `static-forever-{region}`, which serves the current game version. To pin a specific version, set
110
+ `foreverStaticVersion`:
111
+
112
+ ```ts
113
+ const client = createClient({ region: "eu", clientId, clientSecret, foreverStaticVersion: "1.60.1_70399" });
114
+ const races = await client.wowForever.playableRaces();
115
+ ```
116
+
117
+ The version is in the `namespace` of the `self` link of any static response.
89
118
 
90
119
  ## Response types
91
120
 
@@ -96,9 +125,10 @@ import type { Mount } from "@pinta365/blizzard-api/wow";
96
125
  import type { Card } from "@pinta365/blizzard-api/hearthstone";
97
126
  ```
98
127
 
99
- Entry points: `/wow`, `/wow-classic`, `/hearthstone`, `/sc2` and `/diablo3`. The Classic clients mostly return the same
100
- types as Retail (import those from `/wow`). `/wow-classic` holds the Classic-only ones, such as
101
- `ClassicCharacterProfile`, where fields that only Retail returns are optional.
128
+ Entry points: `/wow`, `/wow-classic`, `/wow-forever`, `/hearthstone`, `/sc2` and `/diablo3`. The Classic and Forever
129
+ clients mostly return the same types as Retail (import those from `/wow`). `/wow-classic` and `/wow-forever` hold the
130
+ flavor-only ones, such as `ClassicCharacterProfile` or `ForeverCharacterProfile`, where fields that only Retail returns
131
+ are optional.
102
132
 
103
133
  ## Following links
104
134
 
@@ -162,6 +192,12 @@ const sword = await blizzardAPI.wow.item(33791);
162
192
 
163
193
  ## Upgrading
164
194
 
195
+ ### From 0.7 to 0.8
196
+
197
+ - New `wowForever` client for WoW: Forever (see [WoW: Forever](#wow-forever)).
198
+ - Retail `Item.preview_item.stats`, `requirements` and `durability` are optional: the API omits them for items without
199
+ them, such as companion pets, so you may need to handle `undefined`.
200
+
165
201
  ### From 0.6 to 0.7
166
202
 
167
203
  - More response fields that only some characters, players or brackets have are now optional, so you may need to handle
package/esm/mod.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { AuthConfig, ClientConfig } from "./src/shared/index.js";
2
- import type { Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi } from "./src/client.js";
2
+ import type { Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi, WowForeverApi } from "./src/client.js";
3
3
  import * as errors from "./src/shared/errors.js";
4
4
  export { createClient } from "./src/client.js";
5
- export type { BlizzardClient, Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi, } from "./src/client.js";
5
+ export type { BlizzardClient, Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi, WowForeverApi, } from "./src/client.js";
6
6
  export type { AuthConfig, AuthorizeUrlOptions, ClientConfig, ExchangeCodeOptions, Locales, Namespaces, Regions, TokenResponse, } from "./src/shared/index.js";
7
7
  export { errors };
8
8
  /**
@@ -36,6 +36,8 @@ export declare const wow: WowApi;
36
36
  export declare const wowClassic: WowClassicApi;
37
37
  /** World of Warcraft Classic Era endpoints on the default client. */
38
38
  export declare const wowClassicEra: WowClassicEraApi;
39
+ /** World of Warcraft: Forever endpoints on the default client. */
40
+ export declare const wowForever: WowForeverApi;
39
41
  /** Hearthstone endpoints on the default client. */
40
42
  export declare const hearthstone: HearthstoneApi;
41
43
  /** StarCraft II endpoints on the default client. */
package/esm/mod.js CHANGED
@@ -62,6 +62,8 @@ export const wow = defaultClient.wow;
62
62
  export const wowClassic = defaultClient.wowClassic;
63
63
  /** World of Warcraft Classic Era endpoints on the default client. */
64
64
  export const wowClassicEra = defaultClient.wowClassicEra;
65
+ /** World of Warcraft: Forever endpoints on the default client. */
66
+ export const wowForever = defaultClient.wowForever;
65
67
  /** Hearthstone endpoints on the default client. */
66
68
  export const hearthstone = defaultClient.hearthstone;
67
69
  /** StarCraft II endpoints on the default client. */
@@ -4,22 +4,25 @@ import { type Bound } from "./shared/bind.js";
4
4
  import * as wowEndpoints from "./wow/index.js";
5
5
  import * as wowClassicEndpoints from "./wow_classic/index.js";
6
6
  import * as wowClassicEraEndpoints from "./wow_classic/era.js";
7
+ import * as wowForeverEndpoints from "./wow_forever/index.js";
7
8
  import * as hearthstoneEndpoints from "./hearthstone/index.js";
8
9
  import * as sc2Endpoints from "./starcraft2/index.js";
9
10
  import * as diablo3Endpoints from "./diablo3/index.js";
10
11
  import type { WowApi } from "./generated/wow_api.js";
11
12
  import type { WowClassicApi } from "./generated/wow_classic_api.js";
12
13
  import type { WowClassicEraApi } from "./generated/wow_classic_era_api.js";
14
+ import type { WowForeverApi } from "./generated/wow_forever_api.js";
13
15
  import type { HearthstoneApi } from "./generated/hearthstone_api.js";
14
16
  import type { Sc2Api } from "./generated/sc2_api.js";
15
17
  import type { Diablo3Api } from "./generated/diablo3_api.js";
16
- export type { Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi };
18
+ export type { Diablo3Api, HearthstoneApi, Sc2Api, WowApi, WowClassicApi, WowClassicEraApi, WowForeverApi };
17
19
  type Exact<A, B> = [keyof A] extends [keyof B] ? ([keyof B] extends [keyof A] ? ([A] extends [B] ? true : false) : false) : false;
18
20
  type Assert<T extends true> = T;
19
21
  export type _GeneratedApisAreCurrent = [
20
22
  Assert<Exact<WowApi, Bound<typeof wowEndpoints>>>,
21
23
  Assert<Exact<WowClassicApi, Bound<typeof wowClassicEndpoints>>>,
22
24
  Assert<Exact<WowClassicEraApi, Bound<typeof wowClassicEraEndpoints>>>,
25
+ Assert<Exact<WowForeverApi, Bound<typeof wowForeverEndpoints>>>,
23
26
  Assert<Exact<HearthstoneApi, Bound<typeof hearthstoneEndpoints>>>,
24
27
  Assert<Exact<Sc2Api, Bound<typeof sc2Endpoints>>>,
25
28
  Assert<Exact<Diablo3Api, Bound<typeof diablo3Endpoints>>>
@@ -34,6 +37,11 @@ export interface BlizzardClient {
34
37
  readonly wowClassic: WowClassicApi;
35
38
  /** World of Warcraft Classic Era endpoints (Era, Season of Discovery, Hardcore, Anniversary). */
36
39
  readonly wowClassicEra: WowClassicEraApi;
40
+ /**
41
+ * World of Warcraft: Forever endpoints (game data and account profile). Before launch, set
42
+ * `foreverStaticVersion` in the client config for static game data.
43
+ */
44
+ readonly wowForever: WowForeverApi;
37
45
  /** Hearthstone endpoints. */
38
46
  readonly hearthstone: HearthstoneApi;
39
47
  /** StarCraft II endpoints. */
package/esm/src/client.js CHANGED
@@ -4,6 +4,7 @@ import { bindAll } from "./shared/bind.js";
4
4
  import * as wowEndpoints from "./wow/index.js";
5
5
  import * as wowClassicEndpoints from "./wow_classic/index.js";
6
6
  import * as wowClassicEraEndpoints from "./wow_classic/era.js";
7
+ import * as wowForeverEndpoints from "./wow_forever/index.js";
7
8
  import * as hearthstoneEndpoints from "./hearthstone/index.js";
8
9
  import * as sc2Endpoints from "./starcraft2/index.js";
9
10
  import * as diablo3Endpoints from "./diablo3/index.js";
@@ -17,6 +18,7 @@ export function clientFromContext(ctx) {
17
18
  wow: bindAll(ctx, wowEndpoints),
18
19
  wowClassic: bindAll(ctx.withNamespaceVariant("classic"), wowClassicEndpoints),
19
20
  wowClassicEra: bindAll(ctx.withNamespaceVariant("classic1x"), wowClassicEraEndpoints),
21
+ wowForever: bindAll(ctx.withNamespaceVariant("forever", (config) => config.foreverStaticVersion), wowForeverEndpoints),
20
22
  // bind() keeps metadata<T> generic at runtime; the mapped Bound type cannot, so use the generated interface.
21
23
  hearthstone: bindAll(ctx, hearthstoneEndpoints),
22
24
  sc2: bindAll(ctx, sc2Endpoints),