@blizzard-api/hs 2.0.1 → 3.0.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/dist/card-backs/index.d.ts +2 -0
- package/dist/card-backs/index.js +28 -0
- package/dist/card-backs/index.js.map +1 -0
- package/dist/cards/index.d.ts +2 -0
- package/dist/cards/index.js +48 -0
- package/dist/cards/index.js.map +1 -0
- package/dist/decks/index.d.ts +2 -0
- package/dist/decks/index.js +23 -0
- package/dist/decks/index.js.map +1 -0
- package/dist/index-BKJLD2Xh.d.ts +90 -0
- package/dist/index-DbPHKsXS.d.ts +121 -0
- package/dist/index-Drg-Gvee.d.ts +91 -0
- package/dist/index-HHvhYDVQ.d.ts +47 -0
- package/dist/index.d.ts +4 -334
- package/dist/index.js +5 -112
- package/dist/index.js.map +1 -1
- package/dist/metadata/index.d.ts +2 -0
- package/dist/metadata/index.js +20 -0
- package/dist/metadata/index.js.map +1 -0
- package/package.json +16 -7
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/card-backs/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns a list of card backs based on the search parameters provided.
|
|
4
|
+
* @param options The options for fetching card backs. See {@link CardBackSearchParameters}.
|
|
5
|
+
* @returns The card back search resource. See {@link CardBackSearchResponse}.
|
|
6
|
+
*/
|
|
7
|
+
function cardBackSearch(options) {
|
|
8
|
+
return {
|
|
9
|
+
parameters: options,
|
|
10
|
+
path: "hearthstone/cardbacks"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns a single card back based on the ID provided.
|
|
15
|
+
* @param id The card back ID
|
|
16
|
+
* @param locale The locale to use for fetching the card back (optional).
|
|
17
|
+
* @returns The card back resource. See {@link SingleCardBackSearchResponse}.
|
|
18
|
+
*/
|
|
19
|
+
function fetchOneCardBack(id, locale) {
|
|
20
|
+
return {
|
|
21
|
+
parameters: { locale },
|
|
22
|
+
path: `hearthstone/cardbacks/${id}`
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { cardBackSearch, fetchOneCardBack };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/card-backs/index.ts"],"sourcesContent":["import type { Locales, Resource } from '@blizzard-api/core';\nimport type { CardBackSearchParameters, CardBackSearchResponse, SingleCardBackSearchResponse } from './types';\n\n/**\n * Returns a list of card backs based on the search parameters provided.\n * @param options The options for fetching card backs. See {@link CardBackSearchParameters}.\n * @returns The card back search resource. See {@link CardBackSearchResponse}.\n */\nexport function cardBackSearch(\n options: CardBackSearchParameters,\n): Resource<CardBackSearchResponse, CardBackSearchParameters> {\n return {\n parameters: options,\n path: 'hearthstone/cardbacks',\n };\n}\n\n/**\n * Returns a single card back based on the ID provided.\n * @param id The card back ID\n * @param locale The locale to use for fetching the card back (optional).\n * @returns The card back resource. See {@link SingleCardBackSearchResponse}.\n */\nexport function fetchOneCardBack(\n id: string,\n locale?: Locales,\n): Resource<SingleCardBackSearchResponse, { locale?: Locales }> {\n return {\n parameters: { locale },\n path: `hearthstone/cardbacks/${id}`,\n };\n}\n"],"mappings":";;;;;;AAQA,SAAgB,eACd,SAC4D;AAC5D,QAAO;EACL,YAAY;EACZ,MAAM;EACP;;;;;;;;AASH,SAAgB,iBACd,IACA,QAC8D;AAC9D,QAAO;EACL,YAAY,EAAE,QAAQ;EACtB,MAAM,yBAAyB;EAChC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/cards/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns a list of cards based on the search parameters provided.
|
|
4
|
+
* @param options The options for fetching cards. See {@link CardSearchParameters}.
|
|
5
|
+
* @returns The card search resource. See {@link CardSearchResponse}.
|
|
6
|
+
*/
|
|
7
|
+
function cardSearch(options) {
|
|
8
|
+
let attack = void 0;
|
|
9
|
+
let defaultMercenary = void 0;
|
|
10
|
+
let health = void 0;
|
|
11
|
+
let mercenaryId = void 0;
|
|
12
|
+
if (options.attack) attack = Array.isArray(options.attack) ? options.attack.join(",") : `${options.attack}`;
|
|
13
|
+
if (options.defaultMercenary) defaultMercenary = Array.isArray(options.defaultMercenary) ? options.defaultMercenary.join(",") : `${options.defaultMercenary}`;
|
|
14
|
+
if (options.health) health = Array.isArray(options.health) ? options.health.join(",") : `${options.health}`;
|
|
15
|
+
if (options.mercenaryId) mercenaryId = Array.isArray(options.mercenaryId) ? options.mercenaryId.join(",") : `${options.mercenaryId}`;
|
|
16
|
+
return {
|
|
17
|
+
parameters: {
|
|
18
|
+
...options,
|
|
19
|
+
attack,
|
|
20
|
+
defaultMercenary,
|
|
21
|
+
health,
|
|
22
|
+
mercenaryId
|
|
23
|
+
},
|
|
24
|
+
path: "hearthstone/cards"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns a single card based on the ID provided.
|
|
29
|
+
* @param id The card ID
|
|
30
|
+
* @param options The options for fetching a card.
|
|
31
|
+
* @param options.gameMode The game mode to use for fetching the card (optional).
|
|
32
|
+
* @param options.locale The locale to use for fetching the card (optional).
|
|
33
|
+
* @returns The card resource. See {@link FetchOneCardResponse}.
|
|
34
|
+
*/
|
|
35
|
+
function fetchOneCard(id, options) {
|
|
36
|
+
const { gameMode = "constructed", locale } = options ?? {};
|
|
37
|
+
return {
|
|
38
|
+
parameters: {
|
|
39
|
+
gameMode,
|
|
40
|
+
locale
|
|
41
|
+
},
|
|
42
|
+
path: `hearthstone/cards/${id}`
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { cardSearch, fetchOneCard };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/cards/index.ts"],"sourcesContent":["import type { Locales, Resource } from '@blizzard-api/core';\nimport type {\n BlizzardCardSearchParameters,\n CardSearchParameters,\n CardSearchResponse,\n FetchOneCardResponse,\n GameMode,\n} from './types';\n\n/**\n * Returns a list of cards based on the search parameters provided.\n * @param options The options for fetching cards. See {@link CardSearchParameters}.\n * @returns The card search resource. See {@link CardSearchResponse}.\n */\nexport function cardSearch(options: CardSearchParameters): Resource<CardSearchResponse, BlizzardCardSearchParameters> {\n let attack: string | undefined = undefined;\n let defaultMercenary: string | undefined = undefined;\n let health: string | undefined = undefined;\n let mercenaryId: string | undefined = undefined;\n\n if (options.attack) {\n attack = Array.isArray(options.attack) ? options.attack.join(',') : `${options.attack}`;\n }\n if (options.defaultMercenary) {\n defaultMercenary = Array.isArray(options.defaultMercenary)\n ? options.defaultMercenary.join(',')\n : `${options.defaultMercenary}`;\n }\n if (options.health) {\n health = Array.isArray(options.health) ? options.health.join(',') : `${options.health}`;\n }\n if (options.mercenaryId) {\n mercenaryId = Array.isArray(options.mercenaryId) ? options.mercenaryId.join(',') : `${options.mercenaryId}`;\n }\n\n return {\n parameters: {\n ...options,\n attack,\n defaultMercenary,\n health,\n mercenaryId,\n },\n path: 'hearthstone/cards',\n };\n}\n\n/**\n * Returns a single card based on the ID provided.\n * @param id The card ID\n * @param options The options for fetching a card.\n * @param options.gameMode The game mode to use for fetching the card (optional).\n * @param options.locale The locale to use for fetching the card (optional).\n * @returns The card resource. See {@link FetchOneCardResponse}.\n */\nexport function fetchOneCard(\n id: string,\n options?: {\n gameMode?: GameMode;\n locale?: Locales;\n },\n): Resource<FetchOneCardResponse, { gameMode?: GameMode; locale?: Locales }> {\n const { gameMode = 'constructed', locale } = options ?? {};\n return {\n parameters: { gameMode, locale },\n path: `hearthstone/cards/${id}`,\n };\n}\n"],"mappings":";;;;;;AAcA,SAAgB,WAAW,SAA2F;CACpH,IAAI,SAA6B,KAAA;CACjC,IAAI,mBAAuC,KAAA;CAC3C,IAAI,SAA6B,KAAA;CACjC,IAAI,cAAkC,KAAA;AAEtC,KAAI,QAAQ,OACV,UAAS,MAAM,QAAQ,QAAQ,OAAO,GAAG,QAAQ,OAAO,KAAK,IAAI,GAAG,GAAG,QAAQ;AAEjF,KAAI,QAAQ,iBACV,oBAAmB,MAAM,QAAQ,QAAQ,iBAAiB,GACtD,QAAQ,iBAAiB,KAAK,IAAI,GAClC,GAAG,QAAQ;AAEjB,KAAI,QAAQ,OACV,UAAS,MAAM,QAAQ,QAAQ,OAAO,GAAG,QAAQ,OAAO,KAAK,IAAI,GAAG,GAAG,QAAQ;AAEjF,KAAI,QAAQ,YACV,eAAc,MAAM,QAAQ,QAAQ,YAAY,GAAG,QAAQ,YAAY,KAAK,IAAI,GAAG,GAAG,QAAQ;AAGhG,QAAO;EACL,YAAY;GACV,GAAG;GACH;GACA;GACA;GACA;GACD;EACD,MAAM;EACP;;;;;;;;;;AAWH,SAAgB,aACd,IACA,SAI2E;CAC3E,MAAM,EAAE,WAAW,eAAe,WAAW,WAAW,EAAE;AAC1D,QAAO;EACL,YAAY;GAAE;GAAU;GAAQ;EAChC,MAAM,qBAAqB;EAC5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/decks/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns a deck based on the code provided.
|
|
4
|
+
* @param options The options for fetching a deck.
|
|
5
|
+
* @returns The deck resource. See {@link DeckResponse}.
|
|
6
|
+
*/
|
|
7
|
+
function getDeck(options) {
|
|
8
|
+
if ("code" in options) return {
|
|
9
|
+
parameters: { code: encodeURI(options.code) },
|
|
10
|
+
path: "hearthstone/deck"
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
parameters: {
|
|
14
|
+
hero: options.hero,
|
|
15
|
+
ids: options.ids?.join(",")
|
|
16
|
+
},
|
|
17
|
+
path: "hearthstone/deck"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getDeck };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/decks/index.ts"],"sourcesContent":["import type { Resource } from '@blizzard-api/core';\nimport type { DeckResponse, DeckSearchParameters } from './types';\n\n/**\n * Returns a deck based on the code provided.\n * @param options The options for fetching a deck.\n * @returns The deck resource. See {@link DeckResponse}.\n */\nexport function getDeck(\n options: { code: string } | { hero?: string; ids: Array<string> },\n): Resource<DeckResponse, DeckSearchParameters> {\n if ('code' in options) {\n return {\n parameters: {\n code: encodeURI(options.code),\n },\n path: 'hearthstone/deck',\n };\n }\n\n return {\n parameters: {\n hero: options.hero,\n ids: options.ids?.join(','),\n },\n path: 'hearthstone/deck',\n };\n}\n"],"mappings":";;;;;;AAQA,SAAgB,QACd,SAC8C;AAC9C,KAAI,UAAU,QACZ,QAAO;EACL,YAAY,EACV,MAAM,UAAU,QAAQ,KAAK,EAC9B;EACD,MAAM;EACP;AAGH,QAAO;EACL,YAAY;GACV,MAAM,QAAQ;GACd,KAAK,QAAQ,KAAK,KAAK,IAAI;GAC5B;EACD,MAAM;EACP"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Resource } from "@blizzard-api/core";
|
|
2
|
+
|
|
3
|
+
//#region src/decks/types.d.ts
|
|
4
|
+
interface DeckResponse {
|
|
5
|
+
cardCount: number;
|
|
6
|
+
cards: Array<Card>;
|
|
7
|
+
class: Class;
|
|
8
|
+
deckCode: string;
|
|
9
|
+
format: string;
|
|
10
|
+
hero: Hero;
|
|
11
|
+
heroPower: Hero;
|
|
12
|
+
version: number;
|
|
13
|
+
}
|
|
14
|
+
type DeckSearchParameters = {
|
|
15
|
+
code: string;
|
|
16
|
+
} | {
|
|
17
|
+
hero?: string;
|
|
18
|
+
ids: string;
|
|
19
|
+
};
|
|
20
|
+
interface Card {
|
|
21
|
+
armor?: number;
|
|
22
|
+
artistName: string;
|
|
23
|
+
attack?: number;
|
|
24
|
+
bannedFromSideboard?: number;
|
|
25
|
+
cardSetId: number;
|
|
26
|
+
cardTypeId: number;
|
|
27
|
+
childIds?: Array<number>;
|
|
28
|
+
classId: number;
|
|
29
|
+
collectible: number;
|
|
30
|
+
cropImage: string;
|
|
31
|
+
flavorText: string;
|
|
32
|
+
health?: number;
|
|
33
|
+
id: number;
|
|
34
|
+
image: string;
|
|
35
|
+
imageGold: string;
|
|
36
|
+
isZilliaxCosmeticModule: boolean;
|
|
37
|
+
isZilliaxFunctionalModule: boolean;
|
|
38
|
+
keywordIds?: Array<number>;
|
|
39
|
+
manaCost: number;
|
|
40
|
+
minionTypeId?: number;
|
|
41
|
+
multiClassIds: Array<number>;
|
|
42
|
+
name: string;
|
|
43
|
+
rarityId: number;
|
|
44
|
+
slug: string;
|
|
45
|
+
spellSchoolId?: number;
|
|
46
|
+
text: string;
|
|
47
|
+
}
|
|
48
|
+
interface Class {
|
|
49
|
+
id: number;
|
|
50
|
+
name: string;
|
|
51
|
+
slug: string;
|
|
52
|
+
}
|
|
53
|
+
interface Hero {
|
|
54
|
+
artistName: null | string;
|
|
55
|
+
cardSetId: number;
|
|
56
|
+
cardTypeId: number;
|
|
57
|
+
classId: number;
|
|
58
|
+
collectible: number;
|
|
59
|
+
cropImage: null;
|
|
60
|
+
flavorText: string;
|
|
61
|
+
health?: number;
|
|
62
|
+
id: number;
|
|
63
|
+
image: string;
|
|
64
|
+
imageGold: string;
|
|
65
|
+
isZilliaxCosmeticModule: boolean;
|
|
66
|
+
isZilliaxFunctionalModule: boolean;
|
|
67
|
+
manaCost: number;
|
|
68
|
+
multiClassIds: Array<number>;
|
|
69
|
+
name: string;
|
|
70
|
+
parentId: number;
|
|
71
|
+
rarityId: null | number;
|
|
72
|
+
slug: string;
|
|
73
|
+
text: string;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/decks/index.d.ts
|
|
77
|
+
/**
|
|
78
|
+
* Returns a deck based on the code provided.
|
|
79
|
+
* @param options The options for fetching a deck.
|
|
80
|
+
* @returns The deck resource. See {@link DeckResponse}.
|
|
81
|
+
*/
|
|
82
|
+
declare function getDeck(options: {
|
|
83
|
+
code: string;
|
|
84
|
+
} | {
|
|
85
|
+
hero?: string;
|
|
86
|
+
ids: Array<string>;
|
|
87
|
+
}): Resource<DeckResponse, DeckSearchParameters>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { DeckResponse as n, DeckSearchParameters as r, getDeck as t };
|
|
90
|
+
//# sourceMappingURL=index-BKJLD2Xh.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Locales, Resource } from "@blizzard-api/core";
|
|
2
|
+
|
|
3
|
+
//#region src/cards/types.d.ts
|
|
4
|
+
interface BlizzardCardSearchParameters extends BaseSearchParameters {
|
|
5
|
+
attack?: string;
|
|
6
|
+
defaultMercenary?: string;
|
|
7
|
+
health?: string;
|
|
8
|
+
mercenaryId?: string;
|
|
9
|
+
}
|
|
10
|
+
interface CardSearchParameters extends BaseSearchParameters {
|
|
11
|
+
attack?: Array<number> | number;
|
|
12
|
+
defaultMercenary?: Array<number> | number;
|
|
13
|
+
health?: Array<number> | number;
|
|
14
|
+
mercenaryId?: Array<number> | number;
|
|
15
|
+
}
|
|
16
|
+
interface CardSearchResponse {
|
|
17
|
+
cardCount: number;
|
|
18
|
+
cards: Array<Card>;
|
|
19
|
+
page: number;
|
|
20
|
+
pageCount: number;
|
|
21
|
+
}
|
|
22
|
+
interface FetchOneCardResponse {
|
|
23
|
+
artistName: string;
|
|
24
|
+
attack: number;
|
|
25
|
+
cardSetId: number;
|
|
26
|
+
cardTypeId: number;
|
|
27
|
+
classId: number;
|
|
28
|
+
collectible: number;
|
|
29
|
+
cropImage: string;
|
|
30
|
+
flavorText: Record<Locales, string> | string;
|
|
31
|
+
health: number;
|
|
32
|
+
id: number;
|
|
33
|
+
image: Record<Locales, string> | string;
|
|
34
|
+
imageGold: Record<Locales, string> | string;
|
|
35
|
+
isZilliaxCosmeticModule: boolean;
|
|
36
|
+
isZilliaxFunctionalModule: boolean;
|
|
37
|
+
keywordIds: Array<number>;
|
|
38
|
+
manaCost: number;
|
|
39
|
+
multiClassIds: Array<number>;
|
|
40
|
+
name: Record<Locales, string> | string;
|
|
41
|
+
rarityId: number;
|
|
42
|
+
slug: string;
|
|
43
|
+
text: Record<Locales, string> | string;
|
|
44
|
+
}
|
|
45
|
+
type GameMode = 'arena' | 'battlegrounds' | 'classic' | 'constructed' | 'duels' | 'mercenaries' | 'standard';
|
|
46
|
+
interface BaseSearchParameters {
|
|
47
|
+
gameMode?: GameMode;
|
|
48
|
+
locale?: Locales;
|
|
49
|
+
mercenaryRole?: string;
|
|
50
|
+
minionType?: string;
|
|
51
|
+
page?: number;
|
|
52
|
+
pageSize?: number;
|
|
53
|
+
sort?: 'attack:asc' | 'attack:desc' | 'health:asc' | 'health:desc' | 'name:asc' | 'name:desc' | 'tier:asc' | 'tier:desc';
|
|
54
|
+
textFilter?: string;
|
|
55
|
+
tier?: 1 | 2 | 3 | 4 | 5 | 6 | 'hero';
|
|
56
|
+
}
|
|
57
|
+
interface Card {
|
|
58
|
+
artistName: null | string;
|
|
59
|
+
attack: number;
|
|
60
|
+
cardSetId: number;
|
|
61
|
+
cardTypeId: number;
|
|
62
|
+
classId: null | number;
|
|
63
|
+
collectible: number;
|
|
64
|
+
cropImage: null | string;
|
|
65
|
+
flavorText: string;
|
|
66
|
+
health: number;
|
|
67
|
+
id: number;
|
|
68
|
+
image: string;
|
|
69
|
+
imageGold: string;
|
|
70
|
+
isZilliaxCosmeticModule: boolean;
|
|
71
|
+
isZilliaxFunctionalModule: boolean;
|
|
72
|
+
manaCost: number;
|
|
73
|
+
mercenaryHero: MercenaryHero;
|
|
74
|
+
minionTypeId: number;
|
|
75
|
+
multiClassIds: Array<number>;
|
|
76
|
+
multiTypeIds?: Array<number>;
|
|
77
|
+
name: string;
|
|
78
|
+
rarityId: number;
|
|
79
|
+
slug: string;
|
|
80
|
+
text: string;
|
|
81
|
+
}
|
|
82
|
+
interface MercenaryHero {
|
|
83
|
+
collectible: number;
|
|
84
|
+
craftingCost: number;
|
|
85
|
+
default: number;
|
|
86
|
+
faction: null | number;
|
|
87
|
+
mercId: number;
|
|
88
|
+
rarity: number;
|
|
89
|
+
roleId: number;
|
|
90
|
+
statsByLevel: Record<string, StatsByLevel>;
|
|
91
|
+
}
|
|
92
|
+
interface StatsByLevel {
|
|
93
|
+
attack: number;
|
|
94
|
+
health: number;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/cards/index.d.ts
|
|
98
|
+
/**
|
|
99
|
+
* Returns a list of cards based on the search parameters provided.
|
|
100
|
+
* @param options The options for fetching cards. See {@link CardSearchParameters}.
|
|
101
|
+
* @returns The card search resource. See {@link CardSearchResponse}.
|
|
102
|
+
*/
|
|
103
|
+
declare function cardSearch(options: CardSearchParameters): Resource<CardSearchResponse, BlizzardCardSearchParameters>;
|
|
104
|
+
/**
|
|
105
|
+
* Returns a single card based on the ID provided.
|
|
106
|
+
* @param id The card ID
|
|
107
|
+
* @param options The options for fetching a card.
|
|
108
|
+
* @param options.gameMode The game mode to use for fetching the card (optional).
|
|
109
|
+
* @param options.locale The locale to use for fetching the card (optional).
|
|
110
|
+
* @returns The card resource. See {@link FetchOneCardResponse}.
|
|
111
|
+
*/
|
|
112
|
+
declare function fetchOneCard(id: string, options?: {
|
|
113
|
+
gameMode?: GameMode;
|
|
114
|
+
locale?: Locales;
|
|
115
|
+
}): Resource<FetchOneCardResponse, {
|
|
116
|
+
gameMode?: GameMode;
|
|
117
|
+
locale?: Locales;
|
|
118
|
+
}>;
|
|
119
|
+
//#endregion
|
|
120
|
+
export { CardSearchResponse as a, CardSearchParameters as i, fetchOneCard as n, FetchOneCardResponse as o, BlizzardCardSearchParameters as r, GameMode as s, cardSearch as t };
|
|
121
|
+
//# sourceMappingURL=index-DbPHKsXS.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { NameId, Resource } from "@blizzard-api/core";
|
|
2
|
+
|
|
3
|
+
//#region src/metadata/types.d.ts
|
|
4
|
+
interface AllMetadataResponse {
|
|
5
|
+
arenaIds: Array<number>;
|
|
6
|
+
bgGameModes: Array<GameMode>;
|
|
7
|
+
cardBackCategories: Array<GameMode>;
|
|
8
|
+
classes: Array<Class>;
|
|
9
|
+
filterableFields: Array<string>;
|
|
10
|
+
gameModes: Array<GameMode>;
|
|
11
|
+
keywords: Array<Keyword>;
|
|
12
|
+
mercenaryFactions: Array<GameMode>;
|
|
13
|
+
mercenaryRoles: Array<GameMode>;
|
|
14
|
+
minionTypes: Array<GameMode>;
|
|
15
|
+
numericFields: Array<string>;
|
|
16
|
+
rarities: Array<Rarity>;
|
|
17
|
+
setGroups: Array<SetGroup>;
|
|
18
|
+
sets: Array<Set>;
|
|
19
|
+
spellSchools: Array<GameMode>;
|
|
20
|
+
types: Array<GameMode>;
|
|
21
|
+
}
|
|
22
|
+
interface SpecificMetadataResponse extends NameId {
|
|
23
|
+
aliasSetIds?: Array<number>;
|
|
24
|
+
collectibleCount: number;
|
|
25
|
+
collectibleRevealedCount: number;
|
|
26
|
+
hyped: boolean;
|
|
27
|
+
nonCollectibleCount: number;
|
|
28
|
+
nonCollectibleRevealedCount: number;
|
|
29
|
+
slug: string;
|
|
30
|
+
type: SetType;
|
|
31
|
+
}
|
|
32
|
+
interface Class {
|
|
33
|
+
alternateHeroCardIds?: Array<number>;
|
|
34
|
+
cardId?: number;
|
|
35
|
+
heroPowerCardId?: number;
|
|
36
|
+
id: number;
|
|
37
|
+
name: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
}
|
|
40
|
+
interface GameMode extends NameId {
|
|
41
|
+
gameModes?: Array<number>;
|
|
42
|
+
slug: string;
|
|
43
|
+
}
|
|
44
|
+
interface Keyword extends NameId {
|
|
45
|
+
gameModes: Array<number>;
|
|
46
|
+
refText: string;
|
|
47
|
+
slug: string;
|
|
48
|
+
text: string;
|
|
49
|
+
}
|
|
50
|
+
interface Rarity extends NameId {
|
|
51
|
+
craftingCost: Array<null | number>;
|
|
52
|
+
dustValue: Array<null | number>;
|
|
53
|
+
slug: string;
|
|
54
|
+
}
|
|
55
|
+
interface Set extends NameId {
|
|
56
|
+
aliasSetIds?: Array<number>;
|
|
57
|
+
collectibleCount: number;
|
|
58
|
+
collectibleRevealedCount: number;
|
|
59
|
+
hyped: boolean;
|
|
60
|
+
nonCollectibleCount: number;
|
|
61
|
+
nonCollectibleRevealedCount: number;
|
|
62
|
+
slug: string;
|
|
63
|
+
type: SetType;
|
|
64
|
+
}
|
|
65
|
+
interface SetGroup {
|
|
66
|
+
cardSets: Array<string>;
|
|
67
|
+
icon?: string;
|
|
68
|
+
name: string;
|
|
69
|
+
slug: string;
|
|
70
|
+
standard?: boolean;
|
|
71
|
+
svg?: null | string;
|
|
72
|
+
year?: number;
|
|
73
|
+
yearRange?: string;
|
|
74
|
+
}
|
|
75
|
+
type SetType = '' | 'adventure' | 'base' | 'expansion';
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/metadata/index.d.ts
|
|
78
|
+
/**
|
|
79
|
+
* Returns all metadata
|
|
80
|
+
* @returns The all metadata resource. See {@link AllMetadataResponse}.
|
|
81
|
+
*/
|
|
82
|
+
declare function allMetadata(): Resource<AllMetadataResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Returns specific metadata based on the type requested.
|
|
85
|
+
* @param type The type of metadata to retrieve.
|
|
86
|
+
* @returns The specific metadata resource. See {@link SpecificMetadataResponse}.
|
|
87
|
+
*/
|
|
88
|
+
declare function specificMetadata(type: 'classes' | 'keywords' | 'minionTypes' | 'rarities' | 'setGroups' | 'sets' | 'types'): Resource<SpecificMetadataResponse>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { SpecificMetadataResponse as i, specificMetadata as n, AllMetadataResponse as r, allMetadata as t };
|
|
91
|
+
//# sourceMappingURL=index-Drg-Gvee.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Locales, Resource } from "@blizzard-api/core";
|
|
2
|
+
|
|
3
|
+
//#region src/card-backs/types.d.ts
|
|
4
|
+
interface CardBackSearchParameters {
|
|
5
|
+
cardBackCategory?: 'achieve' | 'base' | 'blizzard' | 'esports' | 'events' | 'fireside' | 'game_license' | 'golden' | 'heroes' | 'legend' | 'pre_purchase' | 'promotion' | 'season';
|
|
6
|
+
locale?: Locales;
|
|
7
|
+
page?: number;
|
|
8
|
+
pageSize?: number;
|
|
9
|
+
sort?: `${SearchOptions}:${SortOptions}`;
|
|
10
|
+
textFilter?: string;
|
|
11
|
+
}
|
|
12
|
+
interface CardBackSearchResponse {
|
|
13
|
+
cardBacks: Array<SingleCardBackSearchResponse>;
|
|
14
|
+
cardCount: number;
|
|
15
|
+
page: number;
|
|
16
|
+
pageCount: number;
|
|
17
|
+
}
|
|
18
|
+
type SearchOptions = 'attack' | 'class' | 'dataAdded' | 'groupByClass' | 'health' | 'manaCost' | 'name';
|
|
19
|
+
interface SingleCardBackSearchResponse {
|
|
20
|
+
id: number;
|
|
21
|
+
image: string;
|
|
22
|
+
name: Record<Locales, string> | string;
|
|
23
|
+
slug: string;
|
|
24
|
+
sortCategory: number;
|
|
25
|
+
text: Record<Locales, string> | string;
|
|
26
|
+
}
|
|
27
|
+
type SortOptions = 'asc' | 'desc';
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/card-backs/index.d.ts
|
|
30
|
+
/**
|
|
31
|
+
* Returns a list of card backs based on the search parameters provided.
|
|
32
|
+
* @param options The options for fetching card backs. See {@link CardBackSearchParameters}.
|
|
33
|
+
* @returns The card back search resource. See {@link CardBackSearchResponse}.
|
|
34
|
+
*/
|
|
35
|
+
declare function cardBackSearch(options: CardBackSearchParameters): Resource<CardBackSearchResponse, CardBackSearchParameters>;
|
|
36
|
+
/**
|
|
37
|
+
* Returns a single card back based on the ID provided.
|
|
38
|
+
* @param id The card back ID
|
|
39
|
+
* @param locale The locale to use for fetching the card back (optional).
|
|
40
|
+
* @returns The card back resource. See {@link SingleCardBackSearchResponse}.
|
|
41
|
+
*/
|
|
42
|
+
declare function fetchOneCardBack(id: string, locale?: Locales): Resource<SingleCardBackSearchResponse, {
|
|
43
|
+
locale?: Locales;
|
|
44
|
+
}>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { SearchOptions as a, CardBackSearchResponse as i, fetchOneCardBack as n, SingleCardBackSearchResponse as o, CardBackSearchParameters as r, SortOptions as s, cardBackSearch as t };
|
|
47
|
+
//# sourceMappingURL=index-HHvhYDVQ.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,338 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as SearchOptions, i as CardBackSearchResponse, n as fetchOneCardBack, o as SingleCardBackSearchResponse, r as CardBackSearchParameters, s as SortOptions, t as cardBackSearch } from "./index-HHvhYDVQ.js";
|
|
2
|
+
import { a as CardSearchResponse, i as CardSearchParameters, n as fetchOneCard, o as FetchOneCardResponse, r as BlizzardCardSearchParameters, s as GameMode, t as cardSearch } from "./index-DbPHKsXS.js";
|
|
3
|
+
import { n as DeckResponse, r as DeckSearchParameters, t as getDeck } from "./index-BKJLD2Xh.js";
|
|
4
|
+
import { i as SpecificMetadataResponse, n as specificMetadata, r as AllMetadataResponse, t as allMetadata } from "./index-Drg-Gvee.js";
|
|
2
5
|
|
|
3
|
-
//#region src/card-backs/types.d.ts
|
|
4
|
-
interface CardBackSearchParameters {
|
|
5
|
-
cardBackCategory?: 'achieve' | 'base' | 'blizzard' | 'esports' | 'events' | 'fireside' | 'game_license' | 'golden' | 'heroes' | 'legend' | 'pre_purchase' | 'promotion' | 'season';
|
|
6
|
-
locale?: Locales;
|
|
7
|
-
page?: number;
|
|
8
|
-
pageSize?: number;
|
|
9
|
-
sort?: `${SearchOptions}:${SortOptions}`;
|
|
10
|
-
textFilter?: string;
|
|
11
|
-
}
|
|
12
|
-
interface CardBackSearchResponse {
|
|
13
|
-
cardBacks: Array<SingleCardBackSearchResponse>;
|
|
14
|
-
cardCount: number;
|
|
15
|
-
page: number;
|
|
16
|
-
pageCount: number;
|
|
17
|
-
}
|
|
18
|
-
type SearchOptions = 'attack' | 'class' | 'dataAdded' | 'groupByClass' | 'health' | 'manaCost' | 'name';
|
|
19
|
-
interface SingleCardBackSearchResponse {
|
|
20
|
-
id: number;
|
|
21
|
-
image: string;
|
|
22
|
-
name: Record<Locales, string> | string;
|
|
23
|
-
slug: string;
|
|
24
|
-
sortCategory: number;
|
|
25
|
-
text: Record<Locales, string> | string;
|
|
26
|
-
}
|
|
27
|
-
type SortOptions = 'asc' | 'desc';
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/card-backs/card-backs.d.ts
|
|
30
|
-
/**
|
|
31
|
-
* Returns a list of card backs based on the search parameters provided.
|
|
32
|
-
* @param options The options for fetching card backs. See {@link CardBackSearchParameters}.
|
|
33
|
-
* @returns The card back search resource. See {@link CardBackSearchResponse}.
|
|
34
|
-
*/
|
|
35
|
-
declare function cardBackSearch(options: CardBackSearchParameters): Resource<CardBackSearchResponse, CardBackSearchParameters>;
|
|
36
|
-
/**
|
|
37
|
-
* Returns a single card back based on the ID provided.
|
|
38
|
-
* @param id The card back ID
|
|
39
|
-
* @param locale The locale to use for fetching the card back (optional).
|
|
40
|
-
* @returns The card back resource. See {@link SingleCardBackSearchResponse}.
|
|
41
|
-
*/
|
|
42
|
-
declare function fetchOneCardBack(id: string, locale?: Locales): Resource<SingleCardBackSearchResponse, {
|
|
43
|
-
locale?: Locales;
|
|
44
|
-
}>;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/cards/types.d.ts
|
|
47
|
-
interface BlizzardCardSearchParameters extends BaseSearchParameters {
|
|
48
|
-
attack?: string;
|
|
49
|
-
defaultMercenary?: string;
|
|
50
|
-
health?: string;
|
|
51
|
-
mercenaryId?: string;
|
|
52
|
-
}
|
|
53
|
-
interface CardSearchParameters extends BaseSearchParameters {
|
|
54
|
-
attack?: Array<number> | number;
|
|
55
|
-
defaultMercenary?: Array<number> | number;
|
|
56
|
-
health?: Array<number> | number;
|
|
57
|
-
mercenaryId?: Array<number> | number;
|
|
58
|
-
}
|
|
59
|
-
interface CardSearchResponse {
|
|
60
|
-
cardCount: number;
|
|
61
|
-
cards: Array<Card$1>;
|
|
62
|
-
page: number;
|
|
63
|
-
pageCount: number;
|
|
64
|
-
}
|
|
65
|
-
interface FetchOneCardResponse {
|
|
66
|
-
artistName: string;
|
|
67
|
-
attack: number;
|
|
68
|
-
cardSetId: number;
|
|
69
|
-
cardTypeId: number;
|
|
70
|
-
classId: number;
|
|
71
|
-
collectible: number;
|
|
72
|
-
cropImage: string;
|
|
73
|
-
flavorText: Record<Locales, string> | string;
|
|
74
|
-
health: number;
|
|
75
|
-
id: number;
|
|
76
|
-
image: Record<Locales, string> | string;
|
|
77
|
-
imageGold: Record<Locales, string> | string;
|
|
78
|
-
isZilliaxCosmeticModule: boolean;
|
|
79
|
-
isZilliaxFunctionalModule: boolean;
|
|
80
|
-
keywordIds: Array<number>;
|
|
81
|
-
manaCost: number;
|
|
82
|
-
multiClassIds: Array<number>;
|
|
83
|
-
name: Record<Locales, string> | string;
|
|
84
|
-
rarityId: number;
|
|
85
|
-
slug: string;
|
|
86
|
-
text: Record<Locales, string> | string;
|
|
87
|
-
}
|
|
88
|
-
type GameMode = 'arena' | 'battlegrounds' | 'classic' | 'constructed' | 'duels' | 'mercenaries' | 'standard';
|
|
89
|
-
interface BaseSearchParameters {
|
|
90
|
-
gameMode?: GameMode;
|
|
91
|
-
locale?: Locales;
|
|
92
|
-
mercenaryRole?: string;
|
|
93
|
-
minionType?: string;
|
|
94
|
-
page?: number;
|
|
95
|
-
pageSize?: number;
|
|
96
|
-
sort?: 'attack:asc' | 'attack:desc' | 'health:asc' | 'health:desc' | 'name:asc' | 'name:desc' | 'tier:asc' | 'tier:desc';
|
|
97
|
-
textFilter?: string;
|
|
98
|
-
tier?: 1 | 2 | 3 | 4 | 5 | 6 | 'hero';
|
|
99
|
-
}
|
|
100
|
-
interface Card$1 {
|
|
101
|
-
artistName: null | string;
|
|
102
|
-
attack: number;
|
|
103
|
-
cardSetId: number;
|
|
104
|
-
cardTypeId: number;
|
|
105
|
-
classId: null | number;
|
|
106
|
-
collectible: number;
|
|
107
|
-
cropImage: null | string;
|
|
108
|
-
flavorText: string;
|
|
109
|
-
health: number;
|
|
110
|
-
id: number;
|
|
111
|
-
image: string;
|
|
112
|
-
imageGold: string;
|
|
113
|
-
isZilliaxCosmeticModule: boolean;
|
|
114
|
-
isZilliaxFunctionalModule: boolean;
|
|
115
|
-
manaCost: number;
|
|
116
|
-
mercenaryHero: MercenaryHero;
|
|
117
|
-
minionTypeId: number;
|
|
118
|
-
multiClassIds: Array<number>;
|
|
119
|
-
multiTypeIds?: Array<number>;
|
|
120
|
-
name: string;
|
|
121
|
-
rarityId: number;
|
|
122
|
-
slug: string;
|
|
123
|
-
text: string;
|
|
124
|
-
}
|
|
125
|
-
interface MercenaryHero {
|
|
126
|
-
collectible: number;
|
|
127
|
-
craftingCost: number;
|
|
128
|
-
default: number;
|
|
129
|
-
faction: null | number;
|
|
130
|
-
mercId: number;
|
|
131
|
-
rarity: number;
|
|
132
|
-
roleId: number;
|
|
133
|
-
statsByLevel: Record<string, StatsByLevel>;
|
|
134
|
-
}
|
|
135
|
-
interface StatsByLevel {
|
|
136
|
-
attack: number;
|
|
137
|
-
health: number;
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region src/cards/cards.d.ts
|
|
141
|
-
/**
|
|
142
|
-
* Returns a list of cards based on the search parameters provided.
|
|
143
|
-
* @param options The options for fetching cards. See {@link CardSearchParameters}.
|
|
144
|
-
* @returns The card search resource. See {@link CardSearchResponse}.
|
|
145
|
-
*/
|
|
146
|
-
declare function cardSearch(options: CardSearchParameters): Resource<CardSearchResponse, BlizzardCardSearchParameters>;
|
|
147
|
-
/**
|
|
148
|
-
* Returns a single card based on the ID provided.
|
|
149
|
-
* @param id The card ID
|
|
150
|
-
* @param options The options for fetching a card.
|
|
151
|
-
* @param options.gameMode The game mode to use for fetching the card (optional).
|
|
152
|
-
* @param options.locale The locale to use for fetching the card (optional).
|
|
153
|
-
* @returns The card resource. See {@link FetchOneCardResponse}.
|
|
154
|
-
*/
|
|
155
|
-
declare function fetchOneCard(id: string, options?: {
|
|
156
|
-
gameMode?: GameMode;
|
|
157
|
-
locale?: Locales;
|
|
158
|
-
}): Resource<FetchOneCardResponse, {
|
|
159
|
-
gameMode?: GameMode;
|
|
160
|
-
locale?: Locales;
|
|
161
|
-
}>;
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/decks/types.d.ts
|
|
164
|
-
interface DeckResponse {
|
|
165
|
-
cardCount: number;
|
|
166
|
-
cards: Array<Card>;
|
|
167
|
-
class: Class$1;
|
|
168
|
-
deckCode: string;
|
|
169
|
-
format: string;
|
|
170
|
-
hero: Hero;
|
|
171
|
-
heroPower: Hero;
|
|
172
|
-
version: number;
|
|
173
|
-
}
|
|
174
|
-
type DeckSearchParameters = {
|
|
175
|
-
code: string;
|
|
176
|
-
} | {
|
|
177
|
-
hero?: string;
|
|
178
|
-
ids: string;
|
|
179
|
-
};
|
|
180
|
-
interface Card {
|
|
181
|
-
armor?: number;
|
|
182
|
-
artistName: string;
|
|
183
|
-
attack?: number;
|
|
184
|
-
bannedFromSideboard?: number;
|
|
185
|
-
cardSetId: number;
|
|
186
|
-
cardTypeId: number;
|
|
187
|
-
childIds?: Array<number>;
|
|
188
|
-
classId: number;
|
|
189
|
-
collectible: number;
|
|
190
|
-
cropImage: string;
|
|
191
|
-
flavorText: string;
|
|
192
|
-
health?: number;
|
|
193
|
-
id: number;
|
|
194
|
-
image: string;
|
|
195
|
-
imageGold: string;
|
|
196
|
-
isZilliaxCosmeticModule: boolean;
|
|
197
|
-
isZilliaxFunctionalModule: boolean;
|
|
198
|
-
keywordIds?: Array<number>;
|
|
199
|
-
manaCost: number;
|
|
200
|
-
minionTypeId?: number;
|
|
201
|
-
multiClassIds: Array<number>;
|
|
202
|
-
name: string;
|
|
203
|
-
rarityId: number;
|
|
204
|
-
slug: string;
|
|
205
|
-
spellSchoolId?: number;
|
|
206
|
-
text: string;
|
|
207
|
-
}
|
|
208
|
-
interface Class$1 {
|
|
209
|
-
id: number;
|
|
210
|
-
name: string;
|
|
211
|
-
slug: string;
|
|
212
|
-
}
|
|
213
|
-
interface Hero {
|
|
214
|
-
artistName: null | string;
|
|
215
|
-
cardSetId: number;
|
|
216
|
-
cardTypeId: number;
|
|
217
|
-
classId: number;
|
|
218
|
-
collectible: number;
|
|
219
|
-
cropImage: null;
|
|
220
|
-
flavorText: string;
|
|
221
|
-
health?: number;
|
|
222
|
-
id: number;
|
|
223
|
-
image: string;
|
|
224
|
-
imageGold: string;
|
|
225
|
-
isZilliaxCosmeticModule: boolean;
|
|
226
|
-
isZilliaxFunctionalModule: boolean;
|
|
227
|
-
manaCost: number;
|
|
228
|
-
multiClassIds: Array<number>;
|
|
229
|
-
name: string;
|
|
230
|
-
parentId: number;
|
|
231
|
-
rarityId: null | number;
|
|
232
|
-
slug: string;
|
|
233
|
-
text: string;
|
|
234
|
-
}
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region src/decks/decks.d.ts
|
|
237
|
-
/**
|
|
238
|
-
* Returns a deck based on the code provided.
|
|
239
|
-
* @param options The options for fetching a deck.
|
|
240
|
-
* @returns The deck resource. See {@link DeckResponse}.
|
|
241
|
-
*/
|
|
242
|
-
declare function getDeck(options: {
|
|
243
|
-
code: string;
|
|
244
|
-
} | {
|
|
245
|
-
hero?: string;
|
|
246
|
-
ids: Array<string>;
|
|
247
|
-
}): Resource<DeckResponse, DeckSearchParameters>;
|
|
248
|
-
//#endregion
|
|
249
|
-
//#region src/metadata/types.d.ts
|
|
250
|
-
interface AllMetadataResponse {
|
|
251
|
-
arenaIds: Array<number>;
|
|
252
|
-
bgGameModes: Array<GameMode$1>;
|
|
253
|
-
cardBackCategories: Array<GameMode$1>;
|
|
254
|
-
classes: Array<Class>;
|
|
255
|
-
filterableFields: Array<string>;
|
|
256
|
-
gameModes: Array<GameMode$1>;
|
|
257
|
-
keywords: Array<Keyword>;
|
|
258
|
-
mercenaryFactions: Array<GameMode$1>;
|
|
259
|
-
mercenaryRoles: Array<GameMode$1>;
|
|
260
|
-
minionTypes: Array<GameMode$1>;
|
|
261
|
-
numericFields: Array<string>;
|
|
262
|
-
rarities: Array<Rarity>;
|
|
263
|
-
setGroups: Array<SetGroup>;
|
|
264
|
-
sets: Array<Set>;
|
|
265
|
-
spellSchools: Array<GameMode$1>;
|
|
266
|
-
types: Array<GameMode$1>;
|
|
267
|
-
}
|
|
268
|
-
interface SpecificMetadataResponse extends NameId {
|
|
269
|
-
aliasSetIds?: Array<number>;
|
|
270
|
-
collectibleCount: number;
|
|
271
|
-
collectibleRevealedCount: number;
|
|
272
|
-
hyped: boolean;
|
|
273
|
-
nonCollectibleCount: number;
|
|
274
|
-
nonCollectibleRevealedCount: number;
|
|
275
|
-
slug: string;
|
|
276
|
-
type: SetType;
|
|
277
|
-
}
|
|
278
|
-
interface Class {
|
|
279
|
-
alternateHeroCardIds?: Array<number>;
|
|
280
|
-
cardId?: number;
|
|
281
|
-
heroPowerCardId?: number;
|
|
282
|
-
id: number;
|
|
283
|
-
name: string;
|
|
284
|
-
slug: string;
|
|
285
|
-
}
|
|
286
|
-
interface GameMode$1 extends NameId {
|
|
287
|
-
gameModes?: Array<number>;
|
|
288
|
-
slug: string;
|
|
289
|
-
}
|
|
290
|
-
interface Keyword extends NameId {
|
|
291
|
-
gameModes: Array<number>;
|
|
292
|
-
refText: string;
|
|
293
|
-
slug: string;
|
|
294
|
-
text: string;
|
|
295
|
-
}
|
|
296
|
-
interface Rarity extends NameId {
|
|
297
|
-
craftingCost: Array<null | number>;
|
|
298
|
-
dustValue: Array<null | number>;
|
|
299
|
-
slug: string;
|
|
300
|
-
}
|
|
301
|
-
interface Set extends NameId {
|
|
302
|
-
aliasSetIds?: Array<number>;
|
|
303
|
-
collectibleCount: number;
|
|
304
|
-
collectibleRevealedCount: number;
|
|
305
|
-
hyped: boolean;
|
|
306
|
-
nonCollectibleCount: number;
|
|
307
|
-
nonCollectibleRevealedCount: number;
|
|
308
|
-
slug: string;
|
|
309
|
-
type: SetType;
|
|
310
|
-
}
|
|
311
|
-
interface SetGroup {
|
|
312
|
-
cardSets: Array<string>;
|
|
313
|
-
icon?: string;
|
|
314
|
-
name: string;
|
|
315
|
-
slug: string;
|
|
316
|
-
standard?: boolean;
|
|
317
|
-
svg?: null | string;
|
|
318
|
-
year?: number;
|
|
319
|
-
yearRange?: string;
|
|
320
|
-
}
|
|
321
|
-
type SetType = '' | 'adventure' | 'base' | 'expansion';
|
|
322
|
-
//#endregion
|
|
323
|
-
//#region src/metadata/metadata.d.ts
|
|
324
|
-
/**
|
|
325
|
-
* Returns all metadata
|
|
326
|
-
* @returns The all metadata resource. See {@link AllMetadataResponse}.
|
|
327
|
-
*/
|
|
328
|
-
declare function allMetadata(): Resource<AllMetadataResponse>;
|
|
329
|
-
/**
|
|
330
|
-
* Returns specific metadata based on the type requested.
|
|
331
|
-
* @param type The type of metadata to retrieve.
|
|
332
|
-
* @returns The specific metadata resource. See {@link SpecificMetadataResponse}.
|
|
333
|
-
*/
|
|
334
|
-
declare function specificMetadata(type: 'classes' | 'keywords' | 'minionTypes' | 'rarities' | 'setGroups' | 'sets' | 'types'): Resource<SpecificMetadataResponse>;
|
|
335
|
-
//#endregion
|
|
336
6
|
//#region src/index.d.ts
|
|
337
7
|
declare const hs: {
|
|
338
8
|
cardBackSearch: typeof cardBackSearch;
|
package/dist/index.js
CHANGED
|
@@ -1,114 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @returns The card back search resource. See {@link CardBackSearchResponse}.
|
|
6
|
-
*/
|
|
7
|
-
function cardBackSearch(options) {
|
|
8
|
-
return {
|
|
9
|
-
parameters: options,
|
|
10
|
-
path: "hearthstone/cardbacks"
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Returns a single card back based on the ID provided.
|
|
15
|
-
* @param id The card back ID
|
|
16
|
-
* @param locale The locale to use for fetching the card back (optional).
|
|
17
|
-
* @returns The card back resource. See {@link SingleCardBackSearchResponse}.
|
|
18
|
-
*/
|
|
19
|
-
function fetchOneCardBack(id, locale) {
|
|
20
|
-
return {
|
|
21
|
-
parameters: { locale },
|
|
22
|
-
path: `hearthstone/cardbacks/${id}`
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/cards/cards.ts
|
|
28
|
-
/**
|
|
29
|
-
* Returns a list of cards based on the search parameters provided.
|
|
30
|
-
* @param options The options for fetching cards. See {@link CardSearchParameters}.
|
|
31
|
-
* @returns The card search resource. See {@link CardSearchResponse}.
|
|
32
|
-
*/
|
|
33
|
-
function cardSearch(options) {
|
|
34
|
-
let attack = void 0;
|
|
35
|
-
let defaultMercenary = void 0;
|
|
36
|
-
let health = void 0;
|
|
37
|
-
let mercenaryId = void 0;
|
|
38
|
-
if (options.attack) attack = Array.isArray(options.attack) ? options.attack.join(",") : `${options.attack}`;
|
|
39
|
-
if (options.defaultMercenary) defaultMercenary = Array.isArray(options.defaultMercenary) ? options.defaultMercenary.join(",") : `${options.defaultMercenary}`;
|
|
40
|
-
if (options.health) health = Array.isArray(options.health) ? options.health.join(",") : `${options.health}`;
|
|
41
|
-
if (options.mercenaryId) mercenaryId = Array.isArray(options.mercenaryId) ? options.mercenaryId.join(",") : `${options.mercenaryId}`;
|
|
42
|
-
return {
|
|
43
|
-
parameters: {
|
|
44
|
-
...options,
|
|
45
|
-
attack,
|
|
46
|
-
defaultMercenary,
|
|
47
|
-
health,
|
|
48
|
-
mercenaryId
|
|
49
|
-
},
|
|
50
|
-
path: "hearthstone/cards"
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Returns a single card based on the ID provided.
|
|
55
|
-
* @param id The card ID
|
|
56
|
-
* @param options The options for fetching a card.
|
|
57
|
-
* @param options.gameMode The game mode to use for fetching the card (optional).
|
|
58
|
-
* @param options.locale The locale to use for fetching the card (optional).
|
|
59
|
-
* @returns The card resource. See {@link FetchOneCardResponse}.
|
|
60
|
-
*/
|
|
61
|
-
function fetchOneCard(id, options) {
|
|
62
|
-
const { gameMode = "constructed", locale } = options ?? {};
|
|
63
|
-
return {
|
|
64
|
-
parameters: {
|
|
65
|
-
gameMode,
|
|
66
|
-
locale
|
|
67
|
-
},
|
|
68
|
-
path: `hearthstone/cards/${id}`
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/decks/decks.ts
|
|
74
|
-
/**
|
|
75
|
-
* Returns a deck based on the code provided.
|
|
76
|
-
* @param options The options for fetching a deck.
|
|
77
|
-
* @returns The deck resource. See {@link DeckResponse}.
|
|
78
|
-
*/
|
|
79
|
-
function getDeck(options) {
|
|
80
|
-
if ("code" in options) return {
|
|
81
|
-
parameters: { code: encodeURI(options.code) },
|
|
82
|
-
path: "hearthstone/deck"
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
parameters: {
|
|
86
|
-
hero: options.hero,
|
|
87
|
-
ids: options.ids?.join(",")
|
|
88
|
-
},
|
|
89
|
-
path: "hearthstone/deck"
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/metadata/metadata.ts
|
|
95
|
-
/**
|
|
96
|
-
* Returns all metadata
|
|
97
|
-
* @returns The all metadata resource. See {@link AllMetadataResponse}.
|
|
98
|
-
*/
|
|
99
|
-
function allMetadata() {
|
|
100
|
-
return { path: "hearthstone/metadata" };
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Returns specific metadata based on the type requested.
|
|
104
|
-
* @param type The type of metadata to retrieve.
|
|
105
|
-
* @returns The specific metadata resource. See {@link SpecificMetadataResponse}.
|
|
106
|
-
*/
|
|
107
|
-
function specificMetadata(type) {
|
|
108
|
-
return { path: `hearthstone/metadata/${type}` };
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
//#endregion
|
|
1
|
+
import { cardBackSearch, fetchOneCardBack } from "./card-backs/index.js";
|
|
2
|
+
import { cardSearch, fetchOneCard } from "./cards/index.js";
|
|
3
|
+
import { getDeck } from "./decks/index.js";
|
|
4
|
+
import { allMetadata, specificMetadata } from "./metadata/index.js";
|
|
112
5
|
//#region src/index.ts
|
|
113
6
|
const hs = {
|
|
114
7
|
cardBackSearch,
|
|
@@ -119,7 +12,7 @@ const hs = {
|
|
|
119
12
|
allMetadata,
|
|
120
13
|
specificMetadata
|
|
121
14
|
};
|
|
122
|
-
|
|
123
15
|
//#endregion
|
|
124
16
|
export { allMetadata, cardBackSearch, cardSearch, hs as default, hs, fetchOneCard, fetchOneCardBack, getDeck, specificMetadata };
|
|
17
|
+
|
|
125
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cardBackSearch, fetchOneCardBack } from './card-backs/index';\r\nimport { cardSearch, fetchOneCard } from './cards/index';\r\nimport { getDeck } from './decks/index';\r\nimport { allMetadata, specificMetadata } from './metadata/index';\r\n\r\nconst hs = {\r\n //Card Backs\r\n cardBackSearch,\r\n fetchOneCardBack,\r\n //Cards\r\n cardSearch,\r\n fetchOneCard,\r\n //Decks\r\n getDeck,\r\n //Metadata\r\n allMetadata,\r\n specificMetadata,\r\n};\r\nexport default hs;\r\nexport { hs };\r\n\r\n//Card Backs\r\nexport * from './card-backs/index';\r\nexport type * from './card-backs/types';\r\n//Cards\r\nexport * from './cards/index';\r\nexport type * from './cards/types';\r\n//Decks\r\nexport * from './decks/index';\r\nexport type * from './decks/types';\r\n//Metadata\r\nexport * from './metadata/index';\r\nexport type * from './metadata/types';\r\n"],"mappings":";;;;;AAKA,MAAM,KAAK;CAET;CACA;CAEA;CACA;CAEA;CAEA;CACA;CACD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/metadata/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns all metadata
|
|
4
|
+
* @returns The all metadata resource. See {@link AllMetadataResponse}.
|
|
5
|
+
*/
|
|
6
|
+
function allMetadata() {
|
|
7
|
+
return { path: "hearthstone/metadata" };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns specific metadata based on the type requested.
|
|
11
|
+
* @param type The type of metadata to retrieve.
|
|
12
|
+
* @returns The specific metadata resource. See {@link SpecificMetadataResponse}.
|
|
13
|
+
*/
|
|
14
|
+
function specificMetadata(type) {
|
|
15
|
+
return { path: `hearthstone/metadata/${type}` };
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { allMetadata, specificMetadata };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/metadata/index.ts"],"sourcesContent":["import type { Resource } from '@blizzard-api/core';\nimport type { AllMetadataResponse, SpecificMetadataResponse } from './types';\n\n/**\n * Returns all metadata\n * @returns The all metadata resource. See {@link AllMetadataResponse}.\n */\nexport function allMetadata(): Resource<AllMetadataResponse> {\n return {\n path: 'hearthstone/metadata',\n };\n}\n\n/**\n * Returns specific metadata based on the type requested.\n * @param type The type of metadata to retrieve.\n * @returns The specific metadata resource. See {@link SpecificMetadataResponse}.\n */\nexport function specificMetadata(\n type: 'classes' | 'keywords' | 'minionTypes' | 'rarities' | 'setGroups' | 'sets' | 'types',\n): Resource<SpecificMetadataResponse> {\n return {\n path: `hearthstone/metadata/${type}`,\n };\n}\n"],"mappings":";;;;;AAOA,SAAgB,cAA6C;AAC3D,QAAO,EACL,MAAM,wBACP;;;;;;;AAQH,SAAgB,iBACd,MACoC;AACpC,QAAO,EACL,MAAM,wBAAwB,QAC/B"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blizzard-api/hs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Putro",
|
|
6
6
|
"description": "A series of helpers to interact with the Hearthstone Blizzard API",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Pewtro/blizzard-api.git",
|
|
10
|
+
"directory": "packages/hs"
|
|
11
|
+
},
|
|
8
12
|
"type": "module",
|
|
9
13
|
"engines": {
|
|
10
|
-
"node": "^
|
|
14
|
+
"node": "^22.13.0 || ^24 || ^26"
|
|
11
15
|
},
|
|
12
16
|
"module": "./dist/index.js",
|
|
13
17
|
"types": "./dist/index.d.ts",
|
|
14
18
|
"exports": {
|
|
15
|
-
"
|
|
16
|
-
"@blizzard-api/
|
|
19
|
+
".": {
|
|
20
|
+
"@blizzard-api/source": "./src/index.ts",
|
|
17
21
|
"types": "./dist/index.d.ts",
|
|
18
22
|
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./*": {
|
|
25
|
+
"@blizzard-api/source": "./src/*/index.ts",
|
|
26
|
+
"types": "./dist/*/index.d.ts",
|
|
27
|
+
"default": "./dist/*/index.js"
|
|
19
28
|
}
|
|
20
29
|
},
|
|
21
30
|
"files": [
|
|
@@ -32,10 +41,10 @@
|
|
|
32
41
|
],
|
|
33
42
|
"dependencies": {},
|
|
34
43
|
"peerDependencies": {
|
|
35
|
-
"@blizzard-api/core": "
|
|
44
|
+
"@blizzard-api/core": "4.0.0"
|
|
36
45
|
},
|
|
37
46
|
"devDependencies": {
|
|
38
|
-
"@blizzard-api/core": "
|
|
47
|
+
"@blizzard-api/core": "4.0.0"
|
|
39
48
|
},
|
|
40
49
|
"scripts": {
|
|
41
50
|
"build": "tsdown",
|