@blizzard-api/d3 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/README.md +75 -75
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,75 +1,75 @@
1
- # @blizzard-api/d3
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/d3
9
- ```
10
-
11
- ## Usage
12
-
13
- You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `d3` export.
14
-
15
- ```ts
16
- import { d3 } from "@blizzard-api/d3"
17
- //or
18
- import d3 from "@blizzard-api/d3"
19
-
20
- const achievement = d3.achievement(123);
21
- ^ { path: string, namespace?: string, parameters?: Record<string, never> }
22
- ```
23
-
24
- If you don't want to use the exported d3 object, you can also access the functions directly:
25
-
26
- ```ts
27
- import { achievement } from "@blizzard-api/d3"
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/d3';
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 { d3 } from "@blizzard-api/d3"
45
-
46
- const achievement = d3.achievement(123);
47
- ^ { path: string, namespace?: string, parameters?: Record<string, never> }
48
-
49
- type AchievementResponse = ExtractResourceType<typeof achievement>;
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 { d3 } from '@blizzard-api/d3';
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(d3.commodities());
72
-
73
- console.log(response);
74
- ^ typeof AuctionHouseCommoditiesResponse
75
- ```
1
+ # @blizzard-api/d3
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/d3
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `d3` export.
14
+
15
+ ```ts
16
+ import { d3 } from "@blizzard-api/d3"
17
+ //or
18
+ import d3 from "@blizzard-api/d3"
19
+
20
+ const achievement = d3.achievement(123);
21
+ ^ { path: string, namespace?: string, parameters?: Record<string, never> }
22
+ ```
23
+
24
+ If you don't want to use the exported d3 object, you can also access the functions directly:
25
+
26
+ ```ts
27
+ import { achievement } from "@blizzard-api/d3"
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/d3';
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 { d3 } from "@blizzard-api/d3"
45
+
46
+ const achievement = d3.achievement(123);
47
+ ^ { path: string, namespace?: string, parameters?: Record<string, never> }
48
+
49
+ type AchievementResponse = ExtractResourceType<typeof achievement>;
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 { d3 } from '@blizzard-api/d3';
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(d3.commodities());
72
+
73
+ console.log(response);
74
+ ^ typeof AuctionHouseCommoditiesResponse
75
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blizzard-api/d3",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Putro",
6
6
  "description": "A series of helpers to interact with the Diablo 3 Blizzard API",
@@ -34,10 +34,10 @@
34
34
  ],
35
35
  "dependencies": {},
36
36
  "peerDependencies": {
37
- "@blizzard-api/core": "3.0.0"
37
+ "@blizzard-api/core": "3.0.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@blizzard-api/core": "3.0.0"
40
+ "@blizzard-api/core": "3.0.1"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsdown",