@blizzard-api/sc2 3.1.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -75
- package/dist/account/index.d.ts +1 -2
- package/dist/{index-Dxs7pfrO.d.ts → index-BZARQmum.d.ts} +2 -2
- package/dist/{index-BBcAaWfH.d.ts → index-mkx0Rr6s.d.ts} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy/index.d.ts +1 -1
- package/dist/profile/index.d.ts +1 -1
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# @blizzard-api/sc2
|
|
2
|
-
|
|
3
|
-
This package aims to make it easier for you to integrate with the Blizzard Battle.net API, specifically for Diablo 3.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm i @blizzard-api/core @blizzard-api/sc2
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `sc2` export.
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { sc2 } from "@blizzard-api/sc2"
|
|
17
|
-
//or
|
|
18
|
-
import sc2 from "@blizzard-api/sc2"
|
|
19
|
-
|
|
20
|
-
const season = sc2.season(123);
|
|
21
|
-
^ { endDate: string; number: number; seasonId: number; startDate: string; year: number; }
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
If you don't want to use the exported sc2 object, you can also access the functions directly:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { season } from "@blizzard-api/sc2"
|
|
28
|
-
|
|
29
|
-
const seasonI = season(123);
|
|
30
|
-
^ { endDate: string; number: number; seasonId: number; startDate: string; year: number; }
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Types
|
|
34
|
-
|
|
35
|
-
If you need the response types, they are also exported with "Response" appended, so to get the response type from the above code, you can import it like this:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
import type { SeasonResponse } from '@blizzard-api/sc2';
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
If you simply want to use the existing object, you can use the helper, `ExtractResourceType`, from `@blizzard-api/core` like so:
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import { sc2 } from "@blizzard-api/sc2"
|
|
45
|
-
|
|
46
|
-
const season = sc2.season("eu");
|
|
47
|
-
^ { endDate: string; number: number; seasonId: number; startDate: string; year: number; }
|
|
48
|
-
|
|
49
|
-
type SeasonResponse = ExtractResourceType<typeof season>;
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Notes on Types
|
|
53
|
-
|
|
54
|
-
The types are manually created from using the Blizzard API documentation, and are as accurate as possible with smoke testing each endpoint. However, no-one is perfect so there is likely to be some discrepancies. If you encounter any issues with the types from this package, please open an issue or a pull request.
|
|
55
|
-
|
|
56
|
-
### Client
|
|
57
|
-
|
|
58
|
-
While this package is made to function on it's own, it performs even better when combined with `@blizzard-api/client` where you can easily request data combining the two libraries.
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
import { createBlizzardApiClient } from '@blizzard-api/client';
|
|
62
|
-
import { sc2 } from '@blizzard-api/sc2';
|
|
63
|
-
|
|
64
|
-
const client = await createBlizzardApiClient({
|
|
65
|
-
key: 'environment.blizzardClientId',
|
|
66
|
-
secret: 'environment.blizzardClientSecret',
|
|
67
|
-
origin: 'eu',
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
//Response will automatically be typed with the appropriate values
|
|
71
|
-
const response = await client.sendRequest(sc2.season("eu"));
|
|
72
|
-
|
|
73
|
-
console.log(response);
|
|
74
|
-
^ typeof SeasonResponse
|
|
75
|
-
```
|
|
1
|
+
# @blizzard-api/sc2
|
|
2
|
+
|
|
3
|
+
This package aims to make it easier for you to integrate with the Blizzard Battle.net API, specifically for Diablo 3.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i @blizzard-api/core @blizzard-api/sc2
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `sc2` export.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { sc2 } from "@blizzard-api/sc2"
|
|
17
|
+
//or
|
|
18
|
+
import sc2 from "@blizzard-api/sc2"
|
|
19
|
+
|
|
20
|
+
const season = sc2.season(123);
|
|
21
|
+
^ { endDate: string; number: number; seasonId: number; startDate: string; year: number; }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you don't want to use the exported sc2 object, you can also access the functions directly:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { season } from "@blizzard-api/sc2"
|
|
28
|
+
|
|
29
|
+
const seasonI = season(123);
|
|
30
|
+
^ { endDate: string; number: number; seasonId: number; startDate: string; year: number; }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Types
|
|
34
|
+
|
|
35
|
+
If you need the response types, they are also exported with "Response" appended, so to get the response type from the above code, you can import it like this:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import type { SeasonResponse } from '@blizzard-api/sc2';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If you simply want to use the existing object, you can use the helper, `ExtractResourceType`, from `@blizzard-api/core` like so:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { sc2 } from "@blizzard-api/sc2"
|
|
45
|
+
|
|
46
|
+
const season = sc2.season("eu");
|
|
47
|
+
^ { endDate: string; number: number; seasonId: number; startDate: string; year: number; }
|
|
48
|
+
|
|
49
|
+
type SeasonResponse = ExtractResourceType<typeof season>;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Notes on Types
|
|
53
|
+
|
|
54
|
+
The types are manually created from using the Blizzard API documentation, and are as accurate as possible with smoke testing each endpoint. However, no-one is perfect so there is likely to be some discrepancies. If you encounter any issues with the types from this package, please open an issue or a pull request.
|
|
55
|
+
|
|
56
|
+
### Client
|
|
57
|
+
|
|
58
|
+
While this package is made to function on it's own, it performs even better when combined with `@blizzard-api/client` where you can easily request data combining the two libraries.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { createBlizzardApiClient } from '@blizzard-api/client';
|
|
62
|
+
import { sc2 } from '@blizzard-api/sc2';
|
|
63
|
+
|
|
64
|
+
const client = await createBlizzardApiClient({
|
|
65
|
+
key: 'environment.blizzardClientId',
|
|
66
|
+
secret: 'environment.blizzardClientSecret',
|
|
67
|
+
origin: 'eu',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//Response will automatically be typed with the appropriate values
|
|
71
|
+
const response = await client.sendRequest(sc2.season("eu"));
|
|
72
|
+
|
|
73
|
+
console.log(response);
|
|
74
|
+
^ typeof SeasonResponse
|
|
75
|
+
```
|
package/dist/account/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { Resource } from "@blizzard-api/core";
|
|
|
5
5
|
* @param accountId The account ID
|
|
6
6
|
* @returns The player resource. See {@link Resource}.
|
|
7
7
|
*/
|
|
8
|
-
declare function player(accountId: string): Resource<Array<unknown>>;
|
|
8
|
+
export declare function player(accountId: string): Resource<Array<unknown>>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { player };
|
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -56,7 +56,7 @@ interface Achievements {
|
|
|
56
56
|
}
|
|
57
57
|
interface Animation {
|
|
58
58
|
achievementId: string;
|
|
59
|
-
command?: '/dance';
|
|
59
|
+
command?: '/dance' | (string & {});
|
|
60
60
|
icon: Icon;
|
|
61
61
|
id: string;
|
|
62
62
|
name?: string;
|
|
@@ -225,4 +225,4 @@ declare function legacyProfile(regionId: StarcraftRegion, realmId: 1 | 2, profil
|
|
|
225
225
|
declare function legacyRewards(regionId: StarcraftRegion): Resource<LegacyRewardsResponse>;
|
|
226
226
|
//#endregion
|
|
227
227
|
export { legacyProfile as a, LegacyLaddersResponse as c, LegacyRewardsResponse as d, SingleLegacyLadderResponse as f, legacyMatchHistory as i, LegacyMatchHistoryResponse as l, legacyLadder as n, legacyRewards as o, legacyLadders as r, LegacyAchievementsResponse as s, legacyAchievements as t, LegacyProfileResponse as u };
|
|
228
|
-
//# sourceMappingURL=index-
|
|
228
|
+
//# sourceMappingURL=index-BZARQmum.d.ts.map
|
|
@@ -154,7 +154,7 @@ interface ProfileSwarmLevels {
|
|
|
154
154
|
}
|
|
155
155
|
interface Reward {
|
|
156
156
|
achievementId?: string;
|
|
157
|
-
command?: '/dance';
|
|
157
|
+
command?: '/dance' | (string & {});
|
|
158
158
|
flags: number;
|
|
159
159
|
id: string;
|
|
160
160
|
imageUrl: string;
|
|
@@ -212,4 +212,4 @@ declare function profile(regionId: StarcraftRegion, realmId: 1 | 2, profileId: n
|
|
|
212
212
|
declare function staticProfile(regionId: StarcraftRegion): Resource<StaticProfileResponse>;
|
|
213
213
|
//#endregion
|
|
214
214
|
export { staticProfile as a, MetadataResponse as c, profile as i, ProfileResponse as l, ladderSummary as n, LadderResponse as o, metadata as r, LadderSummaryResponse as s, ladder as t, StaticProfileResponse as u };
|
|
215
|
-
//# sourceMappingURL=index-
|
|
215
|
+
//# sourceMappingURL=index-mkx0Rr6s.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { player } from "./account/index.js";
|
|
2
2
|
import { i as SeasonResponse, n as season, r as GrandmasterLeaderboardResponse, t as grandmasterLeaderboard } from "./index-BtQ6VqOV.js";
|
|
3
3
|
import { a as StarcraftLeagueTeamType, i as StarcraftLeagueQueue, n as LeagueDataResponse, r as StarcraftLeagueId, t as getLeagueData } from "./index-BawvMD5r.js";
|
|
4
|
-
import { a as legacyProfile, c as LegacyLaddersResponse, d as LegacyRewardsResponse, f as SingleLegacyLadderResponse, i as legacyMatchHistory, l as LegacyMatchHistoryResponse, n as legacyLadder, o as legacyRewards, r as legacyLadders, s as LegacyAchievementsResponse, t as legacyAchievements, u as LegacyProfileResponse } from "./index-
|
|
5
|
-
import { a as staticProfile, c as MetadataResponse, i as profile, l as ProfileResponse, n as ladderSummary, o as LadderResponse, r as metadata, s as LadderSummaryResponse, t as ladder, u as StaticProfileResponse } from "./index-
|
|
4
|
+
import { a as legacyProfile, c as LegacyLaddersResponse, d as LegacyRewardsResponse, f as SingleLegacyLadderResponse, i as legacyMatchHistory, l as LegacyMatchHistoryResponse, n as legacyLadder, o as legacyRewards, r as legacyLadders, s as LegacyAchievementsResponse, t as legacyAchievements, u as LegacyProfileResponse } from "./index-BZARQmum.js";
|
|
5
|
+
import { a as staticProfile, c as MetadataResponse, i as profile, l as ProfileResponse, n as ladderSummary, o as LadderResponse, r as metadata, s as LadderSummaryResponse, t as ladder, u as StaticProfileResponse } from "./index-mkx0Rr6s.js";
|
|
6
6
|
//#region src/index.d.ts
|
|
7
7
|
declare const sc2: {
|
|
8
8
|
player: typeof player;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { player } from './account/index';\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { player } from './account/index';\nimport { grandmasterLeaderboard, season } from './ladder/index';\nimport { getLeagueData } from './league/index';\nimport {\n legacyAchievements,\n legacyLadder,\n legacyLadders,\n legacyMatchHistory,\n legacyProfile,\n legacyRewards,\n} from './legacy/index';\nimport { ladder, ladderSummary, metadata, profile, staticProfile } from './profile/index';\n\nconst sc2 = {\n //Account\n player,\n //Ladder\n grandmasterLeaderboard,\n season,\n //League\n getLeagueData,\n //Legacy\n legacyAchievements,\n legacyLadder,\n legacyLadders,\n legacyMatchHistory,\n legacyProfile,\n legacyRewards,\n //Profile\n ladder,\n ladderSummary,\n metadata,\n profile,\n staticProfile,\n};\nexport default sc2;\nexport { sc2 };\n\n//Account\nexport * from './account/index';\n//Ladder\nexport * from './ladder/index';\nexport type * from './ladder/types';\n//League\nexport * from './league/index';\nexport type * from './league/types';\n//Legacy\nexport * from './legacy/index';\nexport type * from './legacy/types';\n//Profile\nexport * from './profile/index';\nexport type * from './profile/types';\n"],"mappings":";;;;;;AAaA,MAAM,MAAM;CAEV;CAEA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/legacy/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as legacyProfile, i as legacyMatchHistory, n as legacyLadder, o as legacyRewards, r as legacyLadders, t as legacyAchievements } from "../index-
|
|
1
|
+
import { a as legacyProfile, i as legacyMatchHistory, n as legacyLadder, o as legacyRewards, r as legacyLadders, t as legacyAchievements } from "../index-BZARQmum.js";
|
|
2
2
|
export { legacyAchievements, legacyLadder, legacyLadders, legacyMatchHistory, legacyProfile, legacyRewards };
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as staticProfile, i as profile, n as ladderSummary, r as metadata, t as ladder } from "../index-
|
|
1
|
+
import { a as staticProfile, i as profile, n as ladderSummary, r as metadata, t as ladder } from "../index-mkx0Rr6s.js";
|
|
2
2
|
export { ladder, ladderSummary, metadata, profile, staticProfile };
|
package/package.json
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blizzard-api/sc2",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
|
+
"description": "A series of helpers to interact with the Starcraft II Blizzard API",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"api",
|
|
7
|
+
"battle.net",
|
|
8
|
+
"battlenet",
|
|
9
|
+
"blizzard",
|
|
10
|
+
"bnet",
|
|
11
|
+
"sc2",
|
|
12
|
+
"starcraft"
|
|
13
|
+
],
|
|
4
14
|
"license": "MIT",
|
|
5
15
|
"author": "Putro",
|
|
6
|
-
"description": "A series of helpers to interact with the Starcraft II Blizzard API",
|
|
7
16
|
"repository": {
|
|
8
17
|
"type": "git",
|
|
9
18
|
"url": "git+https://github.com/Pewtro/blizzard-api.git",
|
|
10
19
|
"directory": "packages/sc2"
|
|
11
20
|
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
12
24
|
"type": "module",
|
|
13
|
-
"
|
|
14
|
-
"node": "^22.13.0 || ^24 || ^26"
|
|
15
|
-
},
|
|
25
|
+
"sideEffects": false,
|
|
16
26
|
"module": "./dist/index.js",
|
|
17
27
|
"types": "./dist/index.d.ts",
|
|
18
28
|
"exports": {
|
|
@@ -27,25 +37,15 @@
|
|
|
27
37
|
"default": "./dist/*/index.js"
|
|
28
38
|
}
|
|
29
39
|
},
|
|
30
|
-
"files": [
|
|
31
|
-
"dist"
|
|
32
|
-
],
|
|
33
|
-
"sideEffects": false,
|
|
34
|
-
"keywords": [
|
|
35
|
-
"blizzard",
|
|
36
|
-
"battlenet",
|
|
37
|
-
"battle.net",
|
|
38
|
-
"bnet",
|
|
39
|
-
"api",
|
|
40
|
-
"starcraft",
|
|
41
|
-
"sc2"
|
|
42
|
-
],
|
|
43
40
|
"dependencies": {},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@blizzard-api/core": "4.1.3"
|
|
43
|
+
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@blizzard-api/core": "4.1.
|
|
45
|
+
"@blizzard-api/core": "4.1.3"
|
|
46
46
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": "^22.13.0 || ^24 || ^26"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsdown",
|