@pinta365/blizzard_api 0.6.3 → 0.7.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.
package/README.md CHANGED
@@ -162,6 +162,13 @@ const sword = await blizzardAPI.wow.item(33791);
162
162
 
163
163
  ## Upgrading
164
164
 
165
+ ### From 0.6 to 0.7
166
+
167
+ - More response fields that only some characters, players or brackets have are now optional, so you may need to handle
168
+ `undefined`. Among them: `active_spec`, `guild_crest`, `current_mythic_rating`, `PvpSeasons.current_season`,
169
+ `PvpSeasonLeaderboard.entries` (omitted for empty brackets), StarCraft II `clanName`/`clanTag`, and the Diablo III
170
+ hero `followers`, `legendaryPowers` and `seasonCreated`.
171
+
165
172
  ### From 0.5 to 0.6
166
173
 
167
174
  - A locale is always sent: when `locale` is not set, the region's main locale is used (`us`: `en_US`, `eu`: `en_GB`,
@@ -132,9 +132,9 @@ export interface D3FollowerItems {
132
132
  special?: D3HeroItem;
133
133
  }
134
134
  export interface D3HeroFollowerItems {
135
- templar: D3FollowerItems;
136
- scoundrel: D3FollowerItems;
137
- enchantress: D3FollowerItems;
135
+ templar?: D3FollowerItems;
136
+ scoundrel?: D3FollowerItems;
137
+ enchantress?: D3FollowerItems;
138
138
  }
139
139
  export interface D3Skill {
140
140
  slug: string;
@@ -211,23 +211,27 @@ export interface D3Hero {
211
211
  };
212
212
  hardcore: boolean;
213
213
  seasonal: boolean;
214
- seasonCreated: number;
214
+ /** Absent for non-seasonal heroes. */
215
+ seasonCreated?: number;
215
216
  skills: {
216
217
  active: {
217
218
  skill: D3Skill;
218
- rune: D3SkillRune;
219
+ /** Absent when the skill has no rune selected. */
220
+ rune?: D3SkillRune;
219
221
  }[];
220
222
  passive: {
221
223
  skill: D3Skill;
222
224
  }[];
223
225
  };
224
226
  items: D3HeroItems;
225
- followers: {
226
- templar: D3Follower;
227
- scoundrel: D3Follower;
228
- enchantress: D3Follower;
227
+ /** Absent for some heroes. */
228
+ followers?: {
229
+ templar?: D3Follower;
230
+ scoundrel?: D3Follower;
231
+ enchantress?: D3Follower;
229
232
  };
230
- legendaryPowers: D3ItemRef[];
233
+ /** Absent for some heroes. */
234
+ legendaryPowers?: D3ItemRef[];
231
235
  progression: {
232
236
  act1: D3ActProgress;
233
237
  act2: D3ActProgress;
@@ -292,7 +296,8 @@ export interface D3Account {
292
296
  paragonLevelHardcore: number;
293
297
  paragonLevelSeason: number;
294
298
  paragonLevelSeasonHardcore: number;
295
- guildName: string;
299
+ /** Absent when the account is not in a guild. */
300
+ guildName?: string;
296
301
  heroes: D3AccountHero[];
297
302
  lastHeroPlayed: number;
298
303
  lastUpdated: number;
@@ -16,8 +16,8 @@ export interface Sc2LegacyCharacter {
16
16
  realm: number;
17
17
  region: number;
18
18
  displayName: string;
19
- clanName: string;
20
- clanTag: string;
19
+ clanName?: string;
20
+ clanTag?: string;
21
21
  profilePath: string;
22
22
  }
23
23
  export interface Sc2LegacyCareer {
@@ -66,8 +66,8 @@ export interface Sc2LegacyProfile {
66
66
  id: string;
67
67
  realm: number;
68
68
  displayName: string;
69
- clanName: string;
70
- clanTag: string;
69
+ clanName?: string;
70
+ clanTag?: string;
71
71
  profilePath: string;
72
72
  portrait: Sc2LegacyIcon;
73
73
  career: Sc2LegacyCareer;
@@ -65,8 +65,8 @@ export interface Sc2ProfileSummary {
65
65
  id: string;
66
66
  realm: number;
67
67
  displayName: string;
68
- clanName: string;
69
- clanTag: string;
68
+ clanName?: string;
69
+ clanTag?: string;
70
70
  portrait: string;
71
71
  decalTerran: string;
72
72
  decalProtoss: string;
@@ -199,6 +199,8 @@ export interface Sc2LadderSummary {
199
199
  export interface Sc2Ladder {
200
200
  ladderTeams: Sc2LadderTeam[];
201
201
  allLadderMemberships: Sc2LadderMembership[];
202
+ /** Absent for ladders without divisions (e.g. Grandmaster). */
203
+ localizedDivision?: string;
202
204
  league: string;
203
205
  currentLadderMembership: {
204
206
  ladderId: string;
@@ -207,6 +209,8 @@ export interface Sc2Ladder {
207
209
  ranksAndPools: {
208
210
  rank: number;
209
211
  mmr: number;
212
+ /** Absent for ladders without a bonus pool (e.g. Grandmaster). */
213
+ bonusPool?: number;
210
214
  }[];
211
215
  }
212
216
  /**
@@ -2,7 +2,8 @@ import type { ApiContext } from "../../shared/index.js";
2
2
  import type { Href, KeyId, KeyNameId, LinkSelfHref, TypeName } from "../../shared/index.js";
3
3
  export interface PvpSeasons extends LinkSelfHref {
4
4
  seasons: KeyId[];
5
- current_season: KeyId;
5
+ /** Absent when there is no active PvP season (between seasons). */
6
+ current_season?: KeyId;
6
7
  }
7
8
  export interface PvpSeason extends LinkSelfHref {
8
9
  id: number;
@@ -32,7 +33,10 @@ export interface PvpSeasonLeaderboard extends LinkSelfHref {
32
33
  id: number;
33
34
  type: string;
34
35
  };
35
- entries: {
36
+ /**
37
+ * Omitted when the bracket has no entries (e.g. an empty Classic bracket).
38
+ */
39
+ entries?: {
36
40
  character: {
37
41
  name: string;
38
42
  id: number;
@@ -4,10 +4,12 @@ export interface CharacterAppearanceSummary extends LinkSelfHref {
4
4
  character: Character;
5
5
  playable_race: KeyNameId;
6
6
  playable_class: KeyNameId;
7
- active_spec: KeyNameId;
7
+ /** Absent for characters below level 10, which have no specialization. */
8
+ active_spec?: KeyNameId;
8
9
  gender: TypeName;
9
10
  faction: TypeName;
10
- guild_crest: {
11
+ /** Absent when the character is not in a guild. */
12
+ guild_crest?: {
11
13
  emblem: {
12
14
  id: number;
13
15
  media: KeyId;
@@ -59,7 +61,8 @@ export interface CharacterAppearanceSummary extends LinkSelfHref {
59
61
  }[];
60
62
  customizations: {
61
63
  option: {
62
- name: LocalizedString;
64
+ /** Absent for some options that have no localized name. */
65
+ name?: LocalizedString;
63
66
  id: number;
64
67
  };
65
68
  choice: {
@@ -53,7 +53,8 @@ export interface CollectedHeirloom {
53
53
  };
54
54
  }
55
55
  export interface CharacterCollectionHeirlooms extends LinkSelfHref {
56
- heirlooms: CollectedHeirloom[];
56
+ /** Absent when the character has collected no heirlooms. */
57
+ heirlooms?: CollectedHeirloom[];
57
58
  }
58
59
  export interface DecorItem {
59
60
  decor: NamedRef;
@@ -51,6 +51,11 @@ export interface characterEquipments extends LinkSelfHref {
51
51
  enchantments?: {
52
52
  display_string?: LocalizedString;
53
53
  source_item?: KeyNameId;
54
+ /** The spell an on-use enchantment casts (seen on Classic, e.g. Synapse Springs). */
55
+ spell?: {
56
+ spell: KeyNameId;
57
+ description: LocalizedString;
58
+ };
54
59
  enchantment_id: number;
55
60
  enchantment_slot: {
56
61
  id: number;
@@ -118,6 +123,11 @@ export interface characterEquipments extends LinkSelfHref {
118
123
  min_reputation_level: number;
119
124
  display_string: LocalizedString;
120
125
  };
126
+ skill?: {
127
+ profession: KeyNameId;
128
+ level: number;
129
+ display_string: LocalizedString;
130
+ };
121
131
  };
122
132
  set?: {
123
133
  item_set: KeyNameId;
@@ -41,13 +41,15 @@ export interface CharacterMythicKeystoneProfile extends LinkSelfHref {
41
41
  };
42
42
  seasons: KeyId[];
43
43
  character: Character;
44
- current_mythic_rating: MythicRating;
44
+ /** Absent until the character has earned a rating in the current season. */
45
+ current_mythic_rating?: MythicRating;
45
46
  }
46
47
  export interface CharacterMythicKeystoneSeasonDetails extends LinkSelfHref {
47
48
  season: KeyId;
48
49
  best_runs: MythicKeystoneBestRun[];
49
50
  character: Character;
50
- mythic_rating: MythicRating;
51
+ /** Absent for seasons in which the character earned no rating. */
52
+ mythic_rating?: MythicRating;
51
53
  }
52
54
  /**
53
55
  * Returns the Mythic Keystone profile index for a character.
@@ -12,7 +12,8 @@ export interface CharacterProfile extends LinkSelfHref {
12
12
  faction: TypeName;
13
13
  race: KeyNameId;
14
14
  character_class: KeyNameId;
15
- active_spec: KeyNameId;
15
+ /** Absent for characters below level 10, which have no specialization. */
16
+ active_spec?: KeyNameId;
16
17
  realm: CharacterRealm;
17
18
  guild?: {
18
19
  key: Href;
@@ -42,6 +43,8 @@ export interface CharacterProfile extends LinkSelfHref {
42
43
  quests: Href;
43
44
  achievements_statistics: Href;
44
45
  professions: Href;
46
+ /** Only present for hunters. */
47
+ hunter_pets?: Href;
45
48
  covenant_progress?: {
46
49
  chosen_covenant: KeyNameId;
47
50
  renown_level: number;
@@ -10,7 +10,7 @@ export interface CharacterSoulbinds extends LinkSelfHref {
10
10
  trait?: KeyNameId;
11
11
  conduit_socket?: {
12
12
  type: TypeName;
13
- socket: {
13
+ socket?: {
14
14
  conduit: KeyNameId;
15
15
  rank: number;
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinta365/blizzard_api",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "description": "TS library to interact with the Blizzard Battle.net API. World of Warcraft, World of Warcraft Classic, StarCraft 2, Diablo 3, Hearthstone.",
5
5
  "keywords": [
6
6
  "blizzard",
@@ -132,9 +132,9 @@ export interface D3FollowerItems {
132
132
  special?: D3HeroItem;
133
133
  }
134
134
  export interface D3HeroFollowerItems {
135
- templar: D3FollowerItems;
136
- scoundrel: D3FollowerItems;
137
- enchantress: D3FollowerItems;
135
+ templar?: D3FollowerItems;
136
+ scoundrel?: D3FollowerItems;
137
+ enchantress?: D3FollowerItems;
138
138
  }
139
139
  export interface D3Skill {
140
140
  slug: string;
@@ -211,23 +211,27 @@ export interface D3Hero {
211
211
  };
212
212
  hardcore: boolean;
213
213
  seasonal: boolean;
214
- seasonCreated: number;
214
+ /** Absent for non-seasonal heroes. */
215
+ seasonCreated?: number;
215
216
  skills: {
216
217
  active: {
217
218
  skill: D3Skill;
218
- rune: D3SkillRune;
219
+ /** Absent when the skill has no rune selected. */
220
+ rune?: D3SkillRune;
219
221
  }[];
220
222
  passive: {
221
223
  skill: D3Skill;
222
224
  }[];
223
225
  };
224
226
  items: D3HeroItems;
225
- followers: {
226
- templar: D3Follower;
227
- scoundrel: D3Follower;
228
- enchantress: D3Follower;
227
+ /** Absent for some heroes. */
228
+ followers?: {
229
+ templar?: D3Follower;
230
+ scoundrel?: D3Follower;
231
+ enchantress?: D3Follower;
229
232
  };
230
- legendaryPowers: D3ItemRef[];
233
+ /** Absent for some heroes. */
234
+ legendaryPowers?: D3ItemRef[];
231
235
  progression: {
232
236
  act1: D3ActProgress;
233
237
  act2: D3ActProgress;
@@ -292,7 +296,8 @@ export interface D3Account {
292
296
  paragonLevelHardcore: number;
293
297
  paragonLevelSeason: number;
294
298
  paragonLevelSeasonHardcore: number;
295
- guildName: string;
299
+ /** Absent when the account is not in a guild. */
300
+ guildName?: string;
296
301
  heroes: D3AccountHero[];
297
302
  lastHeroPlayed: number;
298
303
  lastUpdated: number;
@@ -16,8 +16,8 @@ export interface Sc2LegacyCharacter {
16
16
  realm: number;
17
17
  region: number;
18
18
  displayName: string;
19
- clanName: string;
20
- clanTag: string;
19
+ clanName?: string;
20
+ clanTag?: string;
21
21
  profilePath: string;
22
22
  }
23
23
  export interface Sc2LegacyCareer {
@@ -66,8 +66,8 @@ export interface Sc2LegacyProfile {
66
66
  id: string;
67
67
  realm: number;
68
68
  displayName: string;
69
- clanName: string;
70
- clanTag: string;
69
+ clanName?: string;
70
+ clanTag?: string;
71
71
  profilePath: string;
72
72
  portrait: Sc2LegacyIcon;
73
73
  career: Sc2LegacyCareer;
@@ -65,8 +65,8 @@ export interface Sc2ProfileSummary {
65
65
  id: string;
66
66
  realm: number;
67
67
  displayName: string;
68
- clanName: string;
69
- clanTag: string;
68
+ clanName?: string;
69
+ clanTag?: string;
70
70
  portrait: string;
71
71
  decalTerran: string;
72
72
  decalProtoss: string;
@@ -199,6 +199,8 @@ export interface Sc2LadderSummary {
199
199
  export interface Sc2Ladder {
200
200
  ladderTeams: Sc2LadderTeam[];
201
201
  allLadderMemberships: Sc2LadderMembership[];
202
+ /** Absent for ladders without divisions (e.g. Grandmaster). */
203
+ localizedDivision?: string;
202
204
  league: string;
203
205
  currentLadderMembership: {
204
206
  ladderId: string;
@@ -207,6 +209,8 @@ export interface Sc2Ladder {
207
209
  ranksAndPools: {
208
210
  rank: number;
209
211
  mmr: number;
212
+ /** Absent for ladders without a bonus pool (e.g. Grandmaster). */
213
+ bonusPool?: number;
210
214
  }[];
211
215
  }
212
216
  /**
@@ -2,7 +2,8 @@ import type { ApiContext } from "../../shared/index.js";
2
2
  import type { Href, KeyId, KeyNameId, LinkSelfHref, TypeName } from "../../shared/index.js";
3
3
  export interface PvpSeasons extends LinkSelfHref {
4
4
  seasons: KeyId[];
5
- current_season: KeyId;
5
+ /** Absent when there is no active PvP season (between seasons). */
6
+ current_season?: KeyId;
6
7
  }
7
8
  export interface PvpSeason extends LinkSelfHref {
8
9
  id: number;
@@ -32,7 +33,10 @@ export interface PvpSeasonLeaderboard extends LinkSelfHref {
32
33
  id: number;
33
34
  type: string;
34
35
  };
35
- entries: {
36
+ /**
37
+ * Omitted when the bracket has no entries (e.g. an empty Classic bracket).
38
+ */
39
+ entries?: {
36
40
  character: {
37
41
  name: string;
38
42
  id: number;
@@ -4,10 +4,12 @@ export interface CharacterAppearanceSummary extends LinkSelfHref {
4
4
  character: Character;
5
5
  playable_race: KeyNameId;
6
6
  playable_class: KeyNameId;
7
- active_spec: KeyNameId;
7
+ /** Absent for characters below level 10, which have no specialization. */
8
+ active_spec?: KeyNameId;
8
9
  gender: TypeName;
9
10
  faction: TypeName;
10
- guild_crest: {
11
+ /** Absent when the character is not in a guild. */
12
+ guild_crest?: {
11
13
  emblem: {
12
14
  id: number;
13
15
  media: KeyId;
@@ -59,7 +61,8 @@ export interface CharacterAppearanceSummary extends LinkSelfHref {
59
61
  }[];
60
62
  customizations: {
61
63
  option: {
62
- name: LocalizedString;
64
+ /** Absent for some options that have no localized name. */
65
+ name?: LocalizedString;
63
66
  id: number;
64
67
  };
65
68
  choice: {
@@ -53,7 +53,8 @@ export interface CollectedHeirloom {
53
53
  };
54
54
  }
55
55
  export interface CharacterCollectionHeirlooms extends LinkSelfHref {
56
- heirlooms: CollectedHeirloom[];
56
+ /** Absent when the character has collected no heirlooms. */
57
+ heirlooms?: CollectedHeirloom[];
57
58
  }
58
59
  export interface DecorItem {
59
60
  decor: NamedRef;
@@ -51,6 +51,11 @@ export interface characterEquipments extends LinkSelfHref {
51
51
  enchantments?: {
52
52
  display_string?: LocalizedString;
53
53
  source_item?: KeyNameId;
54
+ /** The spell an on-use enchantment casts (seen on Classic, e.g. Synapse Springs). */
55
+ spell?: {
56
+ spell: KeyNameId;
57
+ description: LocalizedString;
58
+ };
54
59
  enchantment_id: number;
55
60
  enchantment_slot: {
56
61
  id: number;
@@ -118,6 +123,11 @@ export interface characterEquipments extends LinkSelfHref {
118
123
  min_reputation_level: number;
119
124
  display_string: LocalizedString;
120
125
  };
126
+ skill?: {
127
+ profession: KeyNameId;
128
+ level: number;
129
+ display_string: LocalizedString;
130
+ };
121
131
  };
122
132
  set?: {
123
133
  item_set: KeyNameId;
@@ -41,13 +41,15 @@ export interface CharacterMythicKeystoneProfile extends LinkSelfHref {
41
41
  };
42
42
  seasons: KeyId[];
43
43
  character: Character;
44
- current_mythic_rating: MythicRating;
44
+ /** Absent until the character has earned a rating in the current season. */
45
+ current_mythic_rating?: MythicRating;
45
46
  }
46
47
  export interface CharacterMythicKeystoneSeasonDetails extends LinkSelfHref {
47
48
  season: KeyId;
48
49
  best_runs: MythicKeystoneBestRun[];
49
50
  character: Character;
50
- mythic_rating: MythicRating;
51
+ /** Absent for seasons in which the character earned no rating. */
52
+ mythic_rating?: MythicRating;
51
53
  }
52
54
  /**
53
55
  * Returns the Mythic Keystone profile index for a character.
@@ -12,7 +12,8 @@ export interface CharacterProfile extends LinkSelfHref {
12
12
  faction: TypeName;
13
13
  race: KeyNameId;
14
14
  character_class: KeyNameId;
15
- active_spec: KeyNameId;
15
+ /** Absent for characters below level 10, which have no specialization. */
16
+ active_spec?: KeyNameId;
16
17
  realm: CharacterRealm;
17
18
  guild?: {
18
19
  key: Href;
@@ -42,6 +43,8 @@ export interface CharacterProfile extends LinkSelfHref {
42
43
  quests: Href;
43
44
  achievements_statistics: Href;
44
45
  professions: Href;
46
+ /** Only present for hunters. */
47
+ hunter_pets?: Href;
45
48
  covenant_progress?: {
46
49
  chosen_covenant: KeyNameId;
47
50
  renown_level: number;
@@ -10,7 +10,7 @@ export interface CharacterSoulbinds extends LinkSelfHref {
10
10
  trait?: KeyNameId;
11
11
  conduit_socket?: {
12
12
  type: TypeName;
13
- socket: {
13
+ socket?: {
14
14
  conduit: KeyNameId;
15
15
  rank: number;
16
16
  };