@blizzard-api/wow 2.1.0 → 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/README.md +80 -80
- package/dist/index.d.ts +694 -621
- package/dist/index.js +150 -383
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
# @blizzard-api/wow
|
|
2
|
-
|
|
3
|
-
This package aims to make it easier for you to integrate with the Blizzard Battle.net API, specifically for World of Warcraft.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm i @blizzard-api/core @blizzard-api/wow
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `wow` export.
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { wow } from "@blizzard-api/wow"
|
|
17
|
-
//or
|
|
18
|
-
import wow from "@blizzard-api/wow"
|
|
19
|
-
|
|
20
|
-
const achievement = wow.achievement(123);
|
|
21
|
-
^ { path: string, namespace?: string, parameters?: Record<string, never> }
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
If you don't want to use the exported wow object, you can also access the functions directly:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { achievement } from "@blizzard-api/wow"
|
|
28
|
-
|
|
29
|
-
const achi = achievement(123);
|
|
30
|
-
^ { path: string, namespace?: string, parameters?: Record<string, never> }
|
|
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 { AchievementResponse } from '@blizzard-api/wow';
|
|
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 type { ExtractResourceType } from "@blizzard-api/core";
|
|
45
|
-
import { wow } from "@blizzard-api/wow"
|
|
46
|
-
|
|
47
|
-
const achievement = wow.achievement(123);
|
|
48
|
-
^ { path: string, namespace?: string, parameters?: Record<string, never> }
|
|
49
|
-
|
|
50
|
-
type AchievementResponse = ExtractResourceType<typeof achievement>;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Differences to @blizzard-api/classic-wow
|
|
54
|
-
|
|
55
|
-
This package is specifically for World of Warcraft (retail or modern), and as such, the endpoints and responses are different from the classic variants. If you are looking for the classic version of World of Warcraft, you should use `@blizzard-api/classic-wow` instead.
|
|
56
|
-
|
|
57
|
-
## Notes on Types
|
|
58
|
-
|
|
59
|
-
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.
|
|
60
|
-
|
|
61
|
-
## Client
|
|
62
|
-
|
|
63
|
-
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.
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { createBlizzardApiClient } from '@blizzard-api/client';
|
|
67
|
-
import { wow } from '@blizzard-api/wow';
|
|
68
|
-
|
|
69
|
-
const client = await createBlizzardApiClient({
|
|
70
|
-
key: 'environment.blizzardClientId',
|
|
71
|
-
secret: 'environment.blizzardClientSecret',
|
|
72
|
-
origin: 'eu',
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
//Response will automatically be typed with the appropriate values
|
|
76
|
-
const response = await client.sendRequest(wow.commodities());
|
|
77
|
-
|
|
78
|
-
console.log(response);
|
|
79
|
-
^ typeof AuctionHouseCommoditiesResponse
|
|
80
|
-
```
|
|
1
|
+
# @blizzard-api/wow
|
|
2
|
+
|
|
3
|
+
This package aims to make it easier for you to integrate with the Blizzard Battle.net API, specifically for World of Warcraft.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i @blizzard-api/core @blizzard-api/wow
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `wow` export.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { wow } from "@blizzard-api/wow"
|
|
17
|
+
//or
|
|
18
|
+
import wow from "@blizzard-api/wow"
|
|
19
|
+
|
|
20
|
+
const achievement = wow.achievement(123);
|
|
21
|
+
^ { path: string, namespace?: string, parameters?: Record<string, never> }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you don't want to use the exported wow object, you can also access the functions directly:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { achievement } from "@blizzard-api/wow"
|
|
28
|
+
|
|
29
|
+
const achi = achievement(123);
|
|
30
|
+
^ { path: string, namespace?: string, parameters?: Record<string, never> }
|
|
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 { AchievementResponse } from '@blizzard-api/wow';
|
|
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 type { ExtractResourceType } from "@blizzard-api/core";
|
|
45
|
+
import { wow } from "@blizzard-api/wow"
|
|
46
|
+
|
|
47
|
+
const achievement = wow.achievement(123);
|
|
48
|
+
^ { path: string, namespace?: string, parameters?: Record<string, never> }
|
|
49
|
+
|
|
50
|
+
type AchievementResponse = ExtractResourceType<typeof achievement>;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Differences to @blizzard-api/classic-wow
|
|
54
|
+
|
|
55
|
+
This package is specifically for World of Warcraft (retail or modern), and as such, the endpoints and responses are different from the classic variants. If you are looking for the classic version of World of Warcraft, you should use `@blizzard-api/classic-wow` instead.
|
|
56
|
+
|
|
57
|
+
## Notes on Types
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
## Client
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { createBlizzardApiClient } from '@blizzard-api/client';
|
|
67
|
+
import { wow } from '@blizzard-api/wow';
|
|
68
|
+
|
|
69
|
+
const client = await createBlizzardApiClient({
|
|
70
|
+
key: 'environment.blizzardClientId',
|
|
71
|
+
secret: 'environment.blizzardClientSecret',
|
|
72
|
+
origin: 'eu',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
//Response will automatically be typed with the appropriate values
|
|
76
|
+
const response = await client.sendRequest(wow.commodities());
|
|
77
|
+
|
|
78
|
+
console.log(response);
|
|
79
|
+
^ typeof AuctionHouseCommoditiesResponse
|
|
80
|
+
```
|