@pinta365/blizzard_api 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/mod.d.ts +3 -2
- package/esm/mod.js +3 -2
- package/package.json +1 -1
- package/script/mod.d.ts +3 -2
- package/script/mod.js +6 -1
- package/esm/src/hearthstone/game_data/card_backs.d.ts +0 -22
- package/esm/src/hearthstone/game_data/card_backs.js +0 -23
- package/esm/src/hearthstone/game_data/cards.d.ts +0 -37
- package/esm/src/hearthstone/game_data/cards.js +0 -27
- package/esm/src/hearthstone/game_data/decks.d.ts +0 -88
- package/esm/src/hearthstone/game_data/decks.js +0 -14
- package/esm/src/hearthstone/game_data/metadata.d.ts +0 -95
- package/esm/src/hearthstone/game_data/metadata.js +0 -12
- package/esm/src/hearthstone/index.d.ts +0 -4
- package/esm/src/hearthstone/index.js +0 -4
- package/esm/src/hearthstone/search.d.ts +0 -20
- package/esm/src/hearthstone/search.js +0 -29
- package/esm/src/shared/auth.d.ts +0 -24
- package/esm/src/shared/auth.js +0 -58
- package/esm/src/shared/config.d.ts +0 -40
- package/esm/src/shared/config.js +0 -48
- package/esm/src/shared/errors.d.ts +0 -44
- package/esm/src/shared/errors.js +0 -83
- package/esm/src/shared/index.d.ts +0 -4
- package/esm/src/shared/index.js +0 -3
- package/esm/src/shared/request.d.ts +0 -13
- package/esm/src/shared/request.js +0 -46
- package/esm/src/shared/types.d.ts +0 -120
- package/esm/src/shared/types.js +0 -2
- package/esm/src/starcraft2/game_data/league.d.ts +0 -32
- package/esm/src/starcraft2/game_data/league.js +0 -21
- package/esm/src/starcraft2/index.d.ts +0 -1
- package/esm/src/starcraft2/index.js +0 -1
- package/esm/src/wow/game_data/achievement.d.ts +0 -84
- package/esm/src/wow/game_data/achievement.js +0 -69
- package/esm/src/wow/game_data/auction_house.d.ts +0 -64
- package/esm/src/wow/game_data/auction_house.js +0 -34
- package/esm/src/wow/game_data/azerite_essence.d.ts +0 -49
- package/esm/src/wow/game_data/azerite_essence.js +0 -49
- package/esm/src/wow/game_data/connected_realm.d.ts +0 -54
- package/esm/src/wow/game_data/connected_realm.js +0 -36
- package/esm/src/wow/game_data/covenant.d.ts +0 -108
- package/esm/src/wow/game_data/covenant.js +0 -89
- package/esm/src/wow/game_data/creature.d.ts +0 -97
- package/esm/src/wow/game_data/creature.js +0 -100
- package/esm/src/wow/game_data/guild_crest.d.ts +0 -55
- package/esm/src/wow/game_data/guild_crest.js +0 -39
- package/esm/src/wow/game_data/heirloom.d.ts +0 -79
- package/esm/src/wow/game_data/heirloom.js +0 -26
- package/esm/src/wow/game_data/item.d.ts +0 -166
- package/esm/src/wow/game_data/item.js +0 -101
- package/esm/src/wow/game_data/journal.d.ts +0 -121
- package/esm/src/wow/game_data/journal.js +0 -99
- package/esm/src/wow/game_data/keystone_affix.d.ts +0 -34
- package/esm/src/wow/game_data/keystone_affix.js +0 -39
- package/esm/src/wow/game_data/media_search.d.ts +0 -8
- package/esm/src/wow/game_data/media_search.js +0 -10
- package/esm/src/wow/game_data/modified_crafting.d.ts +0 -56
- package/esm/src/wow/game_data/modified_crafting.js +0 -63
- package/esm/src/wow/game_data/mount.d.ts +0 -30
- package/esm/src/wow/game_data/mount.js +0 -30
- package/esm/src/wow/game_data/mythic_keystone_dungeon.d.ts +0 -91
- package/esm/src/wow/game_data/mythic_keystone_dungeon.js +0 -88
- package/esm/src/wow/game_data/mythic_keystone_leaderboard.d.ts +0 -58
- package/esm/src/wow/game_data/mythic_keystone_leaderboard.js +0 -29
- package/esm/src/wow/game_data/mythic_raid_leaderboard.d.ts +0 -31
- package/esm/src/wow/game_data/mythic_raid_leaderboard.js +0 -15
- package/esm/src/wow/game_data/pet.d.ts +0 -91
- package/esm/src/wow/game_data/pet.js +0 -77
- package/esm/src/wow/game_data/playable_class.d.ts +0 -57
- package/esm/src/wow/game_data/playable_class.js +0 -52
- package/esm/src/wow/game_data/playable_race.d.ts +0 -29
- package/esm/src/wow/game_data/playable_race.js +0 -26
- package/esm/src/wow/game_data/power_type.d.ts +0 -21
- package/esm/src/wow/game_data/power_type.js +0 -26
- package/esm/src/wow/game_data/profession.d.ts +0 -85
- package/esm/src/wow/game_data/profession.js +0 -79
- package/esm/src/wow/game_data/pvp_season.d.ts +0 -99
- package/esm/src/wow/game_data/pvp_season.js +0 -66
- package/esm/src/wow/game_data/pvp_tier.d.ts +0 -40
- package/esm/src/wow/game_data/pvp_tier.js +0 -39
- package/esm/src/wow/game_data/quest.d.ts +0 -114
- package/esm/src/wow/game_data/quest.js +0 -101
- package/esm/src/wow/game_data/realm.d.ts +0 -42
- package/esm/src/wow/game_data/realm.js +0 -36
- package/esm/src/wow/game_data/region.d.ts +0 -24
- package/esm/src/wow/game_data/region.js +0 -26
- package/esm/src/wow/game_data/reputations.d.ts +0 -50
- package/esm/src/wow/game_data/reputations.js +0 -51
- package/esm/src/wow/game_data/spell.d.ts +0 -33
- package/esm/src/wow/game_data/spell.js +0 -37
- package/esm/src/wow/game_data/talent.d.ts +0 -129
- package/esm/src/wow/game_data/talent.js +0 -90
- package/esm/src/wow/game_data/tech_talent.d.ts +0 -70
- package/esm/src/wow/game_data/tech_talent.js +0 -64
- package/esm/src/wow/game_data/title.d.ts +0 -25
- package/esm/src/wow/game_data/title.js +0 -26
- package/esm/src/wow/game_data/token.d.ts +0 -16
- package/esm/src/wow/game_data/token.js +0 -19
- package/esm/src/wow/game_data/toy.d.ts +0 -24
- package/esm/src/wow/game_data/toy.js +0 -26
- package/esm/src/wow/index.d.ts +0 -53
- package/esm/src/wow/index.js +0 -55
- package/esm/src/wow/profile/character_achievements.d.ts +0 -87
- package/esm/src/wow/profile/character_achievements.js +0 -29
- package/esm/src/wow/profile/character_appearance.d.ts +0 -75
- package/esm/src/wow/profile/character_appearance.js +0 -15
- package/esm/src/wow/profile/character_collections.d.ts +0 -92
- package/esm/src/wow/profile/character_collections.js +0 -71
- package/esm/src/wow/profile/character_encounters.d.ts +0 -77
- package/esm/src/wow/profile/character_encounters.js +0 -43
- package/esm/src/wow/profile/character_equipment.d.ts +0 -132
- package/esm/src/wow/profile/character_equipment.js +0 -15
- package/esm/src/wow/profile/character_hunter_pets.d.ts +0 -21
- package/esm/src/wow/profile/character_hunter_pets.js +0 -15
- package/esm/src/wow/profile/character_media.d.ts +0 -13
- package/esm/src/wow/profile/character_media.js +0 -15
- package/esm/src/wow/profile/character_mythic_keystone_profile.d.ts +0 -58
- package/esm/src/wow/profile/character_mythic_keystone_profile.js +0 -32
- package/esm/src/wow/profile/character_professions.d.ts +0 -26
- package/esm/src/wow/profile/character_professions.js +0 -15
- package/esm/src/wow/profile/character_profile.d.ts +0 -82
- package/esm/src/wow/profile/character_profile.js +0 -40
- package/esm/src/wow/profile/character_pvp.d.ts +0 -51
- package/esm/src/wow/profile/character_pvp.js +0 -30
- package/esm/src/wow/profile/character_quests.d.ts +0 -28
- package/esm/src/wow/profile/character_quests.js +0 -29
- package/esm/src/wow/profile/character_reputations.d.ts +0 -22
- package/esm/src/wow/profile/character_reputations.js +0 -15
- package/esm/src/wow/profile/character_soulbinds.d.ts +0 -30
- package/esm/src/wow/profile/character_soulbinds.js +0 -15
- package/esm/src/wow/profile/character_specializations.d.ts +0 -44
- package/esm/src/wow/profile/character_specializations.js +0 -15
- package/esm/src/wow/profile/character_statistics.d.ts +0 -116
- package/esm/src/wow/profile/character_statistics.js +0 -15
- package/esm/src/wow/profile/character_titles.d.ts +0 -13
- package/esm/src/wow/profile/character_titles.js +0 -15
- package/esm/src/wow/profile/guild.d.ts +0 -117
- package/esm/src/wow/profile/guild.js +0 -57
- package/esm/src/wow/search.d.ts +0 -21
- package/esm/src/wow/search.js +0 -30
- package/script/src/hearthstone/game_data/card_backs.d.ts +0 -22
- package/script/src/hearthstone/game_data/card_backs.js +0 -28
- package/script/src/hearthstone/game_data/cards.d.ts +0 -37
- package/script/src/hearthstone/game_data/cards.js +0 -32
- package/script/src/hearthstone/game_data/decks.d.ts +0 -88
- package/script/src/hearthstone/game_data/decks.js +0 -18
- package/script/src/hearthstone/game_data/metadata.d.ts +0 -95
- package/script/src/hearthstone/game_data/metadata.js +0 -16
- package/script/src/hearthstone/index.d.ts +0 -4
- package/script/src/hearthstone/index.js +0 -13
- package/script/src/hearthstone/search.d.ts +0 -20
- package/script/src/hearthstone/search.js +0 -33
- package/script/src/shared/auth.d.ts +0 -24
- package/script/src/shared/auth.js +0 -63
- package/script/src/shared/config.d.ts +0 -40
- package/script/src/shared/config.js +0 -55
- package/script/src/shared/errors.d.ts +0 -44
- package/script/src/shared/errors.js +0 -91
- package/script/src/shared/index.d.ts +0 -4
- package/script/src/shared/index.js +0 -9
- package/script/src/shared/request.d.ts +0 -13
- package/script/src/shared/request.js +0 -50
- package/script/src/shared/types.d.ts +0 -120
- package/script/src/shared/types.js +0 -3
- package/script/src/starcraft2/game_data/league.d.ts +0 -32
- package/script/src/starcraft2/game_data/league.js +0 -25
- package/script/src/starcraft2/index.d.ts +0 -1
- package/script/src/starcraft2/index.js +0 -5
- package/script/src/wow/game_data/achievement.d.ts +0 -84
- package/script/src/wow/game_data/achievement.js +0 -77
- package/script/src/wow/game_data/auction_house.d.ts +0 -64
- package/script/src/wow/game_data/auction_house.js +0 -39
- package/script/src/wow/game_data/azerite_essence.d.ts +0 -49
- package/script/src/wow/game_data/azerite_essence.js +0 -56
- package/script/src/wow/game_data/connected_realm.d.ts +0 -54
- package/script/src/wow/game_data/connected_realm.js +0 -42
- package/script/src/wow/game_data/covenant.d.ts +0 -108
- package/script/src/wow/game_data/covenant.js +0 -99
- package/script/src/wow/game_data/creature.d.ts +0 -97
- package/script/src/wow/game_data/creature.js +0 -111
- package/script/src/wow/game_data/guild_crest.d.ts +0 -55
- package/script/src/wow/game_data/guild_crest.js +0 -45
- package/script/src/wow/game_data/heirloom.d.ts +0 -79
- package/script/src/wow/game_data/heirloom.js +0 -31
- package/script/src/wow/game_data/item.d.ts +0 -166
- package/script/src/wow/game_data/item.js +0 -112
- package/script/src/wow/game_data/journal.d.ts +0 -121
- package/script/src/wow/game_data/journal.js +0 -110
- package/script/src/wow/game_data/keystone_affix.d.ts +0 -34
- package/script/src/wow/game_data/keystone_affix.js +0 -45
- package/script/src/wow/game_data/media_search.d.ts +0 -8
- package/script/src/wow/game_data/media_search.js +0 -14
- package/script/src/wow/game_data/modified_crafting.d.ts +0 -56
- package/script/src/wow/game_data/modified_crafting.js +0 -71
- package/script/src/wow/game_data/mount.d.ts +0 -30
- package/script/src/wow/game_data/mount.js +0 -36
- package/script/src/wow/game_data/mythic_keystone_dungeon.d.ts +0 -91
- package/script/src/wow/game_data/mythic_keystone_dungeon.js +0 -98
- package/script/src/wow/game_data/mythic_keystone_leaderboard.d.ts +0 -58
- package/script/src/wow/game_data/mythic_keystone_leaderboard.js +0 -34
- package/script/src/wow/game_data/mythic_raid_leaderboard.d.ts +0 -31
- package/script/src/wow/game_data/mythic_raid_leaderboard.js +0 -19
- package/script/src/wow/game_data/pet.d.ts +0 -91
- package/script/src/wow/game_data/pet.js +0 -86
- package/script/src/wow/game_data/playable_class.d.ts +0 -57
- package/script/src/wow/game_data/playable_class.js +0 -59
- package/script/src/wow/game_data/playable_race.d.ts +0 -29
- package/script/src/wow/game_data/playable_race.js +0 -31
- package/script/src/wow/game_data/power_type.d.ts +0 -21
- package/script/src/wow/game_data/power_type.js +0 -31
- package/script/src/wow/game_data/profession.d.ts +0 -85
- package/script/src/wow/game_data/profession.js +0 -88
- package/script/src/wow/game_data/pvp_season.d.ts +0 -99
- package/script/src/wow/game_data/pvp_season.js +0 -74
- package/script/src/wow/game_data/pvp_tier.d.ts +0 -40
- package/script/src/wow/game_data/pvp_tier.js +0 -45
- package/script/src/wow/game_data/quest.d.ts +0 -114
- package/script/src/wow/game_data/quest.js +0 -112
- package/script/src/wow/game_data/realm.d.ts +0 -42
- package/script/src/wow/game_data/realm.js +0 -42
- package/script/src/wow/game_data/region.d.ts +0 -24
- package/script/src/wow/game_data/region.js +0 -31
- package/script/src/wow/game_data/reputations.d.ts +0 -50
- package/script/src/wow/game_data/reputations.js +0 -58
- package/script/src/wow/game_data/spell.d.ts +0 -33
- package/script/src/wow/game_data/spell.js +0 -43
- package/script/src/wow/game_data/talent.d.ts +0 -129
- package/script/src/wow/game_data/talent.js +0 -100
- package/script/src/wow/game_data/tech_talent.d.ts +0 -70
- package/script/src/wow/game_data/tech_talent.js +0 -72
- package/script/src/wow/game_data/title.d.ts +0 -25
- package/script/src/wow/game_data/title.js +0 -31
- package/script/src/wow/game_data/token.d.ts +0 -16
- package/script/src/wow/game_data/token.js +0 -23
- package/script/src/wow/game_data/toy.d.ts +0 -24
- package/script/src/wow/game_data/toy.js +0 -31
- package/script/src/wow/index.d.ts +0 -53
- package/script/src/wow/index.js +0 -228
- package/script/src/wow/profile/character_achievements.d.ts +0 -87
- package/script/src/wow/profile/character_achievements.js +0 -34
- package/script/src/wow/profile/character_appearance.d.ts +0 -75
- package/script/src/wow/profile/character_appearance.js +0 -19
- package/script/src/wow/profile/character_collections.d.ts +0 -92
- package/script/src/wow/profile/character_collections.js +0 -79
- package/script/src/wow/profile/character_encounters.d.ts +0 -77
- package/script/src/wow/profile/character_encounters.js +0 -49
- package/script/src/wow/profile/character_equipment.d.ts +0 -132
- package/script/src/wow/profile/character_equipment.js +0 -19
- package/script/src/wow/profile/character_hunter_pets.d.ts +0 -21
- package/script/src/wow/profile/character_hunter_pets.js +0 -19
- package/script/src/wow/profile/character_media.d.ts +0 -13
- package/script/src/wow/profile/character_media.js +0 -19
- package/script/src/wow/profile/character_mythic_keystone_profile.d.ts +0 -58
- package/script/src/wow/profile/character_mythic_keystone_profile.js +0 -37
- package/script/src/wow/profile/character_professions.d.ts +0 -26
- package/script/src/wow/profile/character_professions.js +0 -19
- package/script/src/wow/profile/character_profile.d.ts +0 -82
- package/script/src/wow/profile/character_profile.js +0 -45
- package/script/src/wow/profile/character_pvp.d.ts +0 -51
- package/script/src/wow/profile/character_pvp.js +0 -35
- package/script/src/wow/profile/character_quests.d.ts +0 -28
- package/script/src/wow/profile/character_quests.js +0 -34
- package/script/src/wow/profile/character_reputations.d.ts +0 -22
- package/script/src/wow/profile/character_reputations.js +0 -19
- package/script/src/wow/profile/character_soulbinds.d.ts +0 -30
- package/script/src/wow/profile/character_soulbinds.js +0 -19
- package/script/src/wow/profile/character_specializations.d.ts +0 -44
- package/script/src/wow/profile/character_specializations.js +0 -19
- package/script/src/wow/profile/character_statistics.d.ts +0 -116
- package/script/src/wow/profile/character_statistics.js +0 -19
- package/script/src/wow/profile/character_titles.d.ts +0 -13
- package/script/src/wow/profile/character_titles.js +0 -19
- package/script/src/wow/profile/guild.d.ts +0 -117
- package/script/src/wow/profile/guild.js +0 -64
- package/script/src/wow/search.d.ts +0 -21
- package/script/src/wow/search.js +0 -34
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authenticate = exports.getauthConfig = void 0;
|
|
4
|
-
//auth.ts
|
|
5
|
-
const config_js_1 = require("./config.js");
|
|
6
|
-
const errors_js_1 = require("./errors.js");
|
|
7
|
-
/**
|
|
8
|
-
* Global storage for authentication configuration data.
|
|
9
|
-
*/
|
|
10
|
-
const authConfig = {
|
|
11
|
-
accessToken: "",
|
|
12
|
-
tokenExpiration: 0,
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Retrieves the global authentication configuration.
|
|
16
|
-
* @returns {AuthConfig} The authentication configuration object.
|
|
17
|
-
*/
|
|
18
|
-
function getauthConfig() {
|
|
19
|
-
return authConfig;
|
|
20
|
-
}
|
|
21
|
-
exports.getauthConfig = getauthConfig;
|
|
22
|
-
/**
|
|
23
|
-
* Handles authentication and obtains an access token if needed.
|
|
24
|
-
* @param {boolean} forceNewToken - If true, forces the retrieval of a new token, ignoring any existing one.
|
|
25
|
-
* @returns {Promise<string>} Returns the access token (string).
|
|
26
|
-
* @throws {MissingRegionError} If the region is not configured.
|
|
27
|
-
* @throws {MissingClientIdError} If the client ID is not configured.
|
|
28
|
-
* @throws {MissingClientSecretError} If the client secret is not configured.
|
|
29
|
-
* @throws {AuthenticationError} If there is a problem during the authentication process.
|
|
30
|
-
*/
|
|
31
|
-
async function authenticate(forceNewToken = false) {
|
|
32
|
-
if (!(0, config_js_1.getSetup)().region) {
|
|
33
|
-
throw new errors_js_1.MissingRegionError();
|
|
34
|
-
}
|
|
35
|
-
if (!(0, config_js_1.getSetup)().clientId) {
|
|
36
|
-
throw new errors_js_1.MissingClientIdError();
|
|
37
|
-
}
|
|
38
|
-
if (!(0, config_js_1.getSetup)().clientSecret) {
|
|
39
|
-
throw new errors_js_1.MissingClientSecretError();
|
|
40
|
-
}
|
|
41
|
-
if (!forceNewToken && authConfig.accessToken && authConfig.tokenExpiration &&
|
|
42
|
-
new Date() < new Date(authConfig.tokenExpiration)) {
|
|
43
|
-
return authConfig.accessToken;
|
|
44
|
-
}
|
|
45
|
-
const response = await fetch((0, config_js_1.tokenUrl)((0, config_js_1.getSetup)().region), {
|
|
46
|
-
method: "POST",
|
|
47
|
-
headers: {
|
|
48
|
-
"Authorization": "Basic " + btoa(`${(0, config_js_1.getSetup)().clientId}:${(0, config_js_1.getSetup)().clientSecret}`),
|
|
49
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
50
|
-
},
|
|
51
|
-
body: "grant_type=client_credentials",
|
|
52
|
-
});
|
|
53
|
-
if (response.ok) {
|
|
54
|
-
const data = await response.json();
|
|
55
|
-
authConfig.accessToken = data.access_token;
|
|
56
|
-
authConfig.tokenExpiration = Date.now() + data.expires_in * 1000;
|
|
57
|
-
return authConfig.accessToken;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
throw new errors_js_1.AuthenticationError("Problem with Authentication", response.status, response.statusText);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.authenticate = authenticate;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Locales, Regions } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Represents the required application configuration.
|
|
4
|
-
* @property {Regions} region - The target Battle.net region for API requests.
|
|
5
|
-
* @property {Locales} locale - The desired locale for data.
|
|
6
|
-
* @property {string} clientId - The OAuth client ID.
|
|
7
|
-
* @property {string} clientSecret - The OAuth client secret.
|
|
8
|
-
*/
|
|
9
|
-
export interface Config {
|
|
10
|
-
region: Regions;
|
|
11
|
-
locale: Locales;
|
|
12
|
-
clientId: string;
|
|
13
|
-
clientSecret: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Generates the OAuth token URL based on the specified region.
|
|
17
|
-
* @param {Regions} region - The target Battle.net region.
|
|
18
|
-
* @returns {string} The constructed token URL.
|
|
19
|
-
*/
|
|
20
|
-
export declare function tokenUrl(region: Regions): string;
|
|
21
|
-
/**
|
|
22
|
-
* Generates the base API URL based on the specified region.
|
|
23
|
-
* @param {Regions} region - The target Battle.net region.
|
|
24
|
-
* @returns {string} The constructed base API URL.
|
|
25
|
-
*/
|
|
26
|
-
export declare function apiBaseUrl(region: Regions): string;
|
|
27
|
-
/**
|
|
28
|
-
* Updates the application configuration and performs basic validation.
|
|
29
|
-
* @param {Partial<Config>} userConfig - An object containing configuration properties to update.
|
|
30
|
-
* @throws {MissingRegionError} If the region is not provided in the update.
|
|
31
|
-
* @throws {MissingClientIdError} If the client ID is not provided in the update.
|
|
32
|
-
* @throws {MissingClientSecretError} If the client secret is not provided in the update.
|
|
33
|
-
*/
|
|
34
|
-
export declare function setup(userConfig: Partial<Config>): void;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves the current application configuration.
|
|
37
|
-
* Note: The configuration may be partial if not fully setup.
|
|
38
|
-
* @returns {Config | Partial<Config>} The full or partially loaded configuration object.
|
|
39
|
-
*/
|
|
40
|
-
export declare function getSetup(): Config | Partial<Config>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSetup = exports.setup = exports.apiBaseUrl = exports.tokenUrl = void 0;
|
|
4
|
-
const errors_js_1 = require("./errors.js");
|
|
5
|
-
/**
|
|
6
|
-
* Holds the partially loaded application configuration.
|
|
7
|
-
*/
|
|
8
|
-
let config = {};
|
|
9
|
-
/**
|
|
10
|
-
* Generates the OAuth token URL based on the specified region.
|
|
11
|
-
* @param {Regions} region - The target Battle.net region.
|
|
12
|
-
* @returns {string} The constructed token URL.
|
|
13
|
-
*/
|
|
14
|
-
function tokenUrl(region) {
|
|
15
|
-
return region === "cn" ? "https://www.battlenet.com.cn/oauth/token" : `https://${region}.battle.net/oauth/token`;
|
|
16
|
-
}
|
|
17
|
-
exports.tokenUrl = tokenUrl;
|
|
18
|
-
/**
|
|
19
|
-
* Generates the base API URL based on the specified region.
|
|
20
|
-
* @param {Regions} region - The target Battle.net region.
|
|
21
|
-
* @returns {string} The constructed base API URL.
|
|
22
|
-
*/
|
|
23
|
-
function apiBaseUrl(region) {
|
|
24
|
-
return region === "cn" ? "https://gateway.battlenet.com.cn" : `https://${region}.api.blizzard.com`;
|
|
25
|
-
}
|
|
26
|
-
exports.apiBaseUrl = apiBaseUrl;
|
|
27
|
-
/**
|
|
28
|
-
* Updates the application configuration and performs basic validation.
|
|
29
|
-
* @param {Partial<Config>} userConfig - An object containing configuration properties to update.
|
|
30
|
-
* @throws {MissingRegionError} If the region is not provided in the update.
|
|
31
|
-
* @throws {MissingClientIdError} If the client ID is not provided in the update.
|
|
32
|
-
* @throws {MissingClientSecretError} If the client secret is not provided in the update.
|
|
33
|
-
*/
|
|
34
|
-
function setup(userConfig) {
|
|
35
|
-
config = { ...config, ...userConfig };
|
|
36
|
-
if (!config.region) {
|
|
37
|
-
throw new errors_js_1.MissingRegionError();
|
|
38
|
-
}
|
|
39
|
-
if (!config.clientId) {
|
|
40
|
-
throw new errors_js_1.MissingClientIdError();
|
|
41
|
-
}
|
|
42
|
-
if (!config.clientSecret) {
|
|
43
|
-
throw new errors_js_1.MissingClientSecretError();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.setup = setup;
|
|
47
|
-
/**
|
|
48
|
-
* Retrieves the current application configuration.
|
|
49
|
-
* Note: The configuration may be partial if not fully setup.
|
|
50
|
-
* @returns {Config | Partial<Config>} The full or partially loaded configuration object.
|
|
51
|
-
*/
|
|
52
|
-
function getSetup() {
|
|
53
|
-
return config;
|
|
54
|
-
}
|
|
55
|
-
exports.getSetup = getSetup;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error class representing an API error.
|
|
3
|
-
* @class
|
|
4
|
-
* @extends {Error}
|
|
5
|
-
*/
|
|
6
|
-
export declare class APIError extends Error {
|
|
7
|
-
statusCode: number;
|
|
8
|
-
responseBody: string;
|
|
9
|
-
constructor(message: string, statusCode: number, responseBody: string);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Custom error class representing an Authentication error.
|
|
13
|
-
* @class
|
|
14
|
-
* @extends {Error}
|
|
15
|
-
*/
|
|
16
|
-
export declare class AuthenticationError extends Error {
|
|
17
|
-
statusCode: number;
|
|
18
|
-
responseBody: string;
|
|
19
|
-
constructor(message: string, statusCode: number, responseBody: string);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Custom error class representing a missing client id error.
|
|
23
|
-
* @class
|
|
24
|
-
* @extends {Error}
|
|
25
|
-
*/
|
|
26
|
-
export declare class MissingClientIdError extends Error {
|
|
27
|
-
constructor();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Custom error class representing a missing client secret error.
|
|
31
|
-
* @class
|
|
32
|
-
* @extends {Error}
|
|
33
|
-
*/
|
|
34
|
-
export declare class MissingClientSecretError extends Error {
|
|
35
|
-
constructor();
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Custom error class representing a missing api region error.
|
|
39
|
-
* @class
|
|
40
|
-
* @extends {Error}
|
|
41
|
-
*/
|
|
42
|
-
export declare class MissingRegionError extends Error {
|
|
43
|
-
constructor();
|
|
44
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingRegionError = exports.MissingClientSecretError = exports.MissingClientIdError = exports.AuthenticationError = exports.APIError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Custom error class representing an API error.
|
|
6
|
-
* @class
|
|
7
|
-
* @extends {Error}
|
|
8
|
-
*/
|
|
9
|
-
class APIError extends Error {
|
|
10
|
-
constructor(message, statusCode, responseBody) {
|
|
11
|
-
super(message);
|
|
12
|
-
Object.defineProperty(this, "statusCode", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: void 0
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "responseBody", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
this.name = "APIError";
|
|
25
|
-
this.statusCode = statusCode;
|
|
26
|
-
this.responseBody = responseBody;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.APIError = APIError;
|
|
30
|
-
/**
|
|
31
|
-
* Custom error class representing an Authentication error.
|
|
32
|
-
* @class
|
|
33
|
-
* @extends {Error}
|
|
34
|
-
*/
|
|
35
|
-
class AuthenticationError extends Error {
|
|
36
|
-
constructor(message, statusCode, responseBody) {
|
|
37
|
-
super(message);
|
|
38
|
-
Object.defineProperty(this, "statusCode", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: void 0
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(this, "responseBody", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
configurable: true,
|
|
47
|
-
writable: true,
|
|
48
|
-
value: void 0
|
|
49
|
-
});
|
|
50
|
-
this.name = "AuthenticationError";
|
|
51
|
-
this.statusCode = statusCode;
|
|
52
|
-
this.responseBody = responseBody;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.AuthenticationError = AuthenticationError;
|
|
56
|
-
/**
|
|
57
|
-
* Custom error class representing a missing client id error.
|
|
58
|
-
* @class
|
|
59
|
-
* @extends {Error}
|
|
60
|
-
*/
|
|
61
|
-
class MissingClientIdError extends Error {
|
|
62
|
-
constructor() {
|
|
63
|
-
super("Client Id must be setup. Check documentation");
|
|
64
|
-
this.name = "MissingClientIdError";
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.MissingClientIdError = MissingClientIdError;
|
|
68
|
-
/**
|
|
69
|
-
* Custom error class representing a missing client secret error.
|
|
70
|
-
* @class
|
|
71
|
-
* @extends {Error}
|
|
72
|
-
*/
|
|
73
|
-
class MissingClientSecretError extends Error {
|
|
74
|
-
constructor() {
|
|
75
|
-
super("Client Secret must be setup. Check documentation");
|
|
76
|
-
this.name = "MissingClientSecretError";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.MissingClientSecretError = MissingClientSecretError;
|
|
80
|
-
/**
|
|
81
|
-
* Custom error class representing a missing api region error.
|
|
82
|
-
* @class
|
|
83
|
-
* @extends {Error}
|
|
84
|
-
*/
|
|
85
|
-
class MissingRegionError extends Error {
|
|
86
|
-
constructor() {
|
|
87
|
-
super("Api region must be setup. Check documentation");
|
|
88
|
-
this.name = "MissingRegionError";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.MissingRegionError = MissingRegionError;
|
|
@@ -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,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.request = exports.authenticate = exports.setup = void 0;
|
|
4
|
-
var config_js_1 = require("./config.js");
|
|
5
|
-
Object.defineProperty(exports, "setup", { enumerable: true, get: function () { return config_js_1.setup; } });
|
|
6
|
-
var auth_js_1 = require("./auth.js");
|
|
7
|
-
Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return auth_js_1.authenticate; } });
|
|
8
|
-
var request_js_1 = require("./request.js");
|
|
9
|
-
Object.defineProperty(exports, "request", { enumerable: true, get: function () { return request_js_1.request; } });
|
|
@@ -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,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.request = void 0;
|
|
4
|
-
const config_js_1 = require("./config.js");
|
|
5
|
-
const auth_js_1 = require("./auth.js");
|
|
6
|
-
const errors_js_1 = require("./errors.js");
|
|
7
|
-
/**
|
|
8
|
-
* Makes an authenticated request to the API and handles potential errors.
|
|
9
|
-
* @param {RequestOptions} requestOptions - An object containing the following:
|
|
10
|
-
* * method: The HTTP method (e.g., "GET", "POST")
|
|
11
|
-
* * url: The API endpoint path.
|
|
12
|
-
* * namespace (optional): The Battlenet namespace for the request.
|
|
13
|
-
* * qs (optional): An object representing query string parameters.
|
|
14
|
-
* @returns {Promise<any>} The parsed JSON response from the API.
|
|
15
|
-
* @throws {APIError} If there is a problem fetching or the response is not successful.
|
|
16
|
-
* @throws {AuthenticationError} (Potentially) If authentication fails during the process.
|
|
17
|
-
*/
|
|
18
|
-
async function request(requestOptions) {
|
|
19
|
-
if (!(0, auth_js_1.getauthConfig)().accessToken || ((0, auth_js_1.getauthConfig)().accessToken && (0, auth_js_1.getauthConfig)().tokenExpiration &&
|
|
20
|
-
new Date() < new Date((0, auth_js_1.getauthConfig)().tokenExpiration))) {
|
|
21
|
-
await (0, auth_js_1.authenticate)(true);
|
|
22
|
-
}
|
|
23
|
-
const { method, url, namespace } = requestOptions;
|
|
24
|
-
let { qs } = requestOptions;
|
|
25
|
-
if ((0, config_js_1.getSetup)().locale) {
|
|
26
|
-
qs = { ...{ locale: (0, config_js_1.getSetup)().locale }, ...qs };
|
|
27
|
-
}
|
|
28
|
-
const qsString = qs
|
|
29
|
-
? Object.fromEntries(Object.entries(qs).filter(([, value]) => value !== undefined).map(([key, value]) => [key, value.toString()]))
|
|
30
|
-
: {};
|
|
31
|
-
const params = new URLSearchParams(qsString);
|
|
32
|
-
const headers = {
|
|
33
|
-
"Authorization": "Bearer " + (0, auth_js_1.getauthConfig)().accessToken,
|
|
34
|
-
};
|
|
35
|
-
if (namespace) {
|
|
36
|
-
headers["Battlenet-Namespace"] = `${namespace}-${(0, config_js_1.getSetup)().region}`;
|
|
37
|
-
}
|
|
38
|
-
const response = await fetch((0, config_js_1.apiBaseUrl)((0, config_js_1.getSetup)().region) + encodeURI(url) + (qsString ? "?" + params.toString() : ""), {
|
|
39
|
-
method: method,
|
|
40
|
-
headers: headers,
|
|
41
|
-
});
|
|
42
|
-
if (response.ok) {
|
|
43
|
-
return await response.json();
|
|
44
|
-
}
|
|
45
|
-
const errorData = await response.json();
|
|
46
|
-
const statusCode = errorData.code || response.status;
|
|
47
|
-
const errorMessage = JSON.stringify(errorData) || "Problem fetching data from API";
|
|
48
|
-
throw new errors_js_1.APIError(errorMessage, statusCode, response.statusText);
|
|
49
|
-
}
|
|
50
|
-
exports.request = request;
|
|
@@ -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,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,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.leagueData = void 0;
|
|
4
|
-
const index_js_1 = require("../../shared/index.js");
|
|
5
|
-
/**
|
|
6
|
-
* Returns data for the specified season, queue, team, and league.
|
|
7
|
-
*
|
|
8
|
-
* Notes from the battle.net docs:
|
|
9
|
-
* 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.
|
|
10
|
-
* teamType: there are two available teamTypes: 0=arranged, 1=random.
|
|
11
|
-
* leagueId: available leagueIds are: 0=Bronze, 1=Silver, 2=Gold, 3=Platinum, 4=Diamond, 5=Master, 6=Grandmaster.
|
|
12
|
-
*
|
|
13
|
-
* @param seasonId - The season ID of the data to retrieve.
|
|
14
|
-
* @param queueId - The queue ID of the data to retrieve.
|
|
15
|
-
* @param teamType - The team type of the data to retrieve.
|
|
16
|
-
* @param leagueId - The league ID of the data to retrieve.
|
|
17
|
-
* @returns A promise that resolves to an object representing the data for a league.
|
|
18
|
-
*/
|
|
19
|
-
async function leagueData(seasonId, queueId, teamType, leagueId) {
|
|
20
|
-
return await (0, index_js_1.request)({
|
|
21
|
-
method: "GET",
|
|
22
|
-
url: `/data/sc2/league/${seasonId}/${queueId}/${teamType}/${leagueId}`,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
exports.leagueData = leagueData;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { leagueData } from "./game_data/league.js";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.leagueData = void 0;
|
|
4
|
-
var league_js_1 = require("./game_data/league.js");
|
|
5
|
-
Object.defineProperty(exports, "leagueData", { enumerable: true, get: function () { return league_js_1.leagueData; } });
|
|
@@ -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>;
|