@taskeren/bungie-api-ts 5.10.3 → 5.10.4

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 CHANGED
@@ -1,97 +1,101 @@
1
- # Bungie API TypeScript support
2
-
3
- This project implements TypeScript definitions and API helpers for the [Bungie.net API](https://github.com/Bungie-net/api). It's meant for use in [Destiny Item Manager](https://destinyitemmanager.com), but should be general enough to use in any project. The code is completely generated from Bungie's documentation - I considered using something like Swagger Codegen, but instead opted for a custom generator so we could make the result as nice as possible.
4
-
5
- # Ports
6
-
7
- Feel free to fork this and use it to generate for your favorite language!
8
-
9
- - [Dart](https://github.com/marquesinijatinha/bungie-api-dart/)
10
-
11
- # Install
12
-
13
- ```
14
- pnpm add bungie-api-ts
15
- ```
16
-
17
- # Interfaces and Enums
18
-
19
- All the interface type definitions and enums are for type info only - everything will compile out. Only the API helpers produce real JavaScript output. You can import types from each service defined on Bungie.net:
20
-
21
- ```typescript
22
- import { DestinyInventoryComponent, DestinyInventoryItemDefinition } from 'bungie-api-ts/destiny2';
23
- ```
24
-
25
- There are definitions for every type defined in the Bungie.net services. See [their documentation](https://bungie-net.github.io/multi/) for a list - the interface names are the last part of the full name (for example, `Destiny.Definitions.DestinyVendorActionDefinition` becomes `DestinyVendorActionDefinition`). There are a few exceptions, like `SingleComponentResponseOfDestinyInventoryComponent`, which have been mapped into nicer forms like `SingleComponentResponse<DestinyInventoryComponent>`, and the server responses, which are now `ServerResponse<T>` instead of something like `DestinyCharacterResponse`.
26
-
27
- # API Helpers
28
-
29
- In addition to the types, there are also simple helper functions for each API endpoint. They define the inputs and outputs to that endpoint, and will call a user-provided function with HTTP request info that you can then use to make an HTTP request. This pattern was used so the API helpers could provide full type information. These helpers are not a full API client - they assist in building one. An example:
30
-
31
- ```typescript
32
- import { getProfile, HttpClientConfig } from 'bungie-api-ts/destiny2';
33
-
34
- async function $http(config: HttpClientConfig) {
35
- // fill in the API key, handle OAuth, etc., then make an HTTP request using the config.
36
- return fetch(config.url, ...);
37
- }
38
-
39
- const profileInfo: ServerResponse<DestinyProfileResponse> = await getProfile($http, {
40
- components: [DestinyComponentType.Profiles, DestinyComponentType.Characters],
41
- destinyMembershipId: 12345,
42
- membershipType: BungieMembershipType.TigerPsn
43
- });
44
- ```
45
-
46
- # Imports
47
-
48
- It is possible to import all services from `bungie-api-ts` directly, but it's better to import the specific service and pick out what you want:
49
-
50
- ```typescript
51
- // good
52
- import { getProfile, HttpClientConfig } from 'bungie-api-ts/destiny2';
53
- getProfile(...);
54
-
55
- // works, but not as good
56
- import { Destiny2 } from 'bungie-api-ts';
57
- Destiny2.getProfile(...);
58
- ```
59
-
60
- # Manifest Helpers
61
-
62
- The `destiny2` import also contains helpers for typing and downloading the Destiny manifest:
63
-
64
- ```typescript
65
- import { getDestinyManifestSlice, getDestinyManifest, type HttpClientConfig } from 'bungie-api-ts/destiny2';
66
-
67
- async function $http(config: HttpClientConfig) {
68
- // fill in the API key, handle OAuth, etc., then make an HTTP request using the config.
69
- return fetch(config.url, ...);
70
- }
71
-
72
- const destinyManifest = await getDestinyManifest($http);
73
- const manifestTables = getDestinyManifestSlice($http, {
74
- destinyManifest: destinyManifest.Response,
75
- tableNames: ['DestinyInventoryItemDefinition', 'DestinySocketDefinition'],
76
- language: 'en',
77
- });
78
-
79
- // manifestTables is an object with properties DestinyInventoryItemDefinition and DestinySocketDefinition
80
- ```
81
-
82
- # Build
83
-
84
- ```
85
- # setup
86
- pnpm i && pnpm submodule
87
- # run
88
- pnpm start
89
- ```
90
-
91
- # Updating API sources
92
-
93
- Run the [update API sources](https://github.com/DestinyItemManager/bungie-api-ts/actions/workflows/update.yml) GitHub Action and it should create a new PR for the updated sources.
94
-
95
- # Publishing
96
-
97
- Update the version in `package.json`, and when the PR merges to `master`, a GitHub workflow will automatically publish to NPM. Don't forget to run `pnpm start` and commit all changed files!
1
+ # Taskeren's Bungie API TypeScript support
2
+
3
+ This is a fork of [DestinyItemManager/bungie-api-ts](https://github.com/DestinyItemManager/bungie-api-ts), which generates non-const enums.
4
+
5
+ # Bungie API TypeScript support
6
+
7
+ This project implements TypeScript definitions and API helpers for the [Bungie.net API](https://github.com/Bungie-net/api). It's meant for use in [Destiny Item Manager](https://destinyitemmanager.com), but should be general enough to use in any project. The code is completely generated from Bungie's documentation - I considered using something like Swagger Codegen, but instead opted for a custom generator so we could make the result as nice as possible.
8
+
9
+ # Ports
10
+
11
+ Feel free to fork this and use it to generate for your favorite language!
12
+
13
+ - [Dart](https://github.com/marquesinijatinha/bungie-api-dart/)
14
+
15
+ # Install
16
+
17
+ ```
18
+ pnpm add bungie-api-ts
19
+ ```
20
+
21
+ # Interfaces and Enums
22
+
23
+ All the interface type definitions and enums are for type info only - everything will compile out. Only the API helpers produce real JavaScript output. You can import types from each service defined on Bungie.net:
24
+
25
+ ```typescript
26
+ import { DestinyInventoryComponent, DestinyInventoryItemDefinition } from 'bungie-api-ts/destiny2';
27
+ ```
28
+
29
+ There are definitions for every type defined in the Bungie.net services. See [their documentation](https://bungie-net.github.io/multi/) for a list - the interface names are the last part of the full name (for example, `Destiny.Definitions.DestinyVendorActionDefinition` becomes `DestinyVendorActionDefinition`). There are a few exceptions, like `SingleComponentResponseOfDestinyInventoryComponent`, which have been mapped into nicer forms like `SingleComponentResponse<DestinyInventoryComponent>`, and the server responses, which are now `ServerResponse<T>` instead of something like `DestinyCharacterResponse`.
30
+
31
+ # API Helpers
32
+
33
+ In addition to the types, there are also simple helper functions for each API endpoint. They define the inputs and outputs to that endpoint, and will call a user-provided function with HTTP request info that you can then use to make an HTTP request. This pattern was used so the API helpers could provide full type information. These helpers are not a full API client - they assist in building one. An example:
34
+
35
+ ```typescript
36
+ import { getProfile, HttpClientConfig } from 'bungie-api-ts/destiny2';
37
+
38
+ async function $http(config: HttpClientConfig) {
39
+ // fill in the API key, handle OAuth, etc., then make an HTTP request using the config.
40
+ return fetch(config.url, ...);
41
+ }
42
+
43
+ const profileInfo: ServerResponse<DestinyProfileResponse> = await getProfile($http, {
44
+ components: [DestinyComponentType.Profiles, DestinyComponentType.Characters],
45
+ destinyMembershipId: 12345,
46
+ membershipType: BungieMembershipType.TigerPsn
47
+ });
48
+ ```
49
+
50
+ # Imports
51
+
52
+ It is possible to import all services from `bungie-api-ts` directly, but it's better to import the specific service and pick out what you want:
53
+
54
+ ```typescript
55
+ // good
56
+ import { getProfile, HttpClientConfig } from 'bungie-api-ts/destiny2';
57
+ getProfile(...);
58
+
59
+ // works, but not as good
60
+ import { Destiny2 } from 'bungie-api-ts';
61
+ Destiny2.getProfile(...);
62
+ ```
63
+
64
+ # Manifest Helpers
65
+
66
+ The `destiny2` import also contains helpers for typing and downloading the Destiny manifest:
67
+
68
+ ```typescript
69
+ import { getDestinyManifestSlice, getDestinyManifest, type HttpClientConfig } from 'bungie-api-ts/destiny2';
70
+
71
+ async function $http(config: HttpClientConfig) {
72
+ // fill in the API key, handle OAuth, etc., then make an HTTP request using the config.
73
+ return fetch(config.url, ...);
74
+ }
75
+
76
+ const destinyManifest = await getDestinyManifest($http);
77
+ const manifestTables = getDestinyManifestSlice($http, {
78
+ destinyManifest: destinyManifest.Response,
79
+ tableNames: ['DestinyInventoryItemDefinition', 'DestinySocketDefinition'],
80
+ language: 'en',
81
+ });
82
+
83
+ // manifestTables is an object with properties DestinyInventoryItemDefinition and DestinySocketDefinition
84
+ ```
85
+
86
+ # Build
87
+
88
+ ```
89
+ # setup
90
+ pnpm i && pnpm submodule
91
+ # run
92
+ pnpm start
93
+ ```
94
+
95
+ # Updating API sources
96
+
97
+ Run the [update API sources](https://github.com/DestinyItemManager/bungie-api-ts/actions/workflows/update.yml) GitHub Action and it should create a new PR for the updated sources.
98
+
99
+ # Publishing
100
+
101
+ Update the version in `package.json`, and when the PR merges to `master`, a GitHub workflow will automatically publish to NPM. Don't forget to run `pnpm start` and commit all changed files!
@@ -1,29 +1,29 @@
1
- Bungie SDK License Agreement (BSD 3-Clause License)
2
-
3
- Copyright (c) 2017, Bungie, Inc.
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- * Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- * Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Bungie SDK License Agreement (BSD 3-Clause License)
2
+
3
+ Copyright (c) 2017, Bungie, Inc.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskeren/bungie-api-ts",
3
- "version": "5.10.3",
3
+ "version": "5.10.4",
4
4
  "description": "TypeScript mappings for the Bungie.net API",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/DestinyItemManager/bungie-api-ts.git"
20
+ "url": "https://github.com/Taskeren/bungie-api-ts.git"
21
21
  },
22
22
  "author": "Ben Hollis",
23
23
  "license": "MIT",
24
24
  "bugs": {
25
- "url": "https://github.com/DestinyItemManager/bungie-api-ts/issues"
25
+ "url": "https://github.com/Taskeren/bungie-api-ts/issues"
26
26
  },
27
27
  "keywords": [
28
28
  "Destiny",
@@ -30,7 +30,7 @@
30
30
  "Bungie.net",
31
31
  "TypeScript"
32
32
  ],
33
- "homepage": "https://github.com/DestinyItemManager/bungie-api-ts",
33
+ "homepage": "https://github.com/Taskeren/bungie-api-ts",
34
34
  "devDependencies": {},
35
35
  "packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81",
36
36
  "main": "./index.js",