wynn-api-types 3.7.2
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/LICENSE +21 -0
- package/README.md +28 -0
- package/index.d.ts +3798 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ILikePlayingGames
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# wynn-api-types
|
|
2
|
+
TypeScript types for the Wynncraft API.
|
|
3
|
+
<br>
|
|
4
|
+
These types were generated using [OpenAPI TypeScript](https://openapi-ts.dev) from the
|
|
5
|
+
[Wynncraft API OpenAPI Schema](https://docs.wynncraft.com/openapi.json).
|
|
6
|
+
|
|
7
|
+
# Building
|
|
8
|
+
Note: Steps 1 and 2 are needed only during initial setup and when the Wynncraft API changes.
|
|
9
|
+
|
|
10
|
+
1. Run `npm download-spec` to download the OpenAPI spec from the Wynncraft API. It will be saved to `./schemas/original.json`.
|
|
11
|
+
2. Run `npm merge` to merge the overrides in `./schema/overrides.json` into the original spec.
|
|
12
|
+
3. Run `npm build` to generate the TypeScript type definitions.
|
|
13
|
+
|
|
14
|
+
# Usage Example
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import type { paths } from 'wynn-api-types';
|
|
18
|
+
|
|
19
|
+
// Run a global search for "Imperial"
|
|
20
|
+
const response = await fetch('https://api.wynncraft.com/v3/search/Imperial');
|
|
21
|
+
|
|
22
|
+
if (response.ok) {
|
|
23
|
+
// Cast to the correct response type for the request path to enable type-aware autocomplete
|
|
24
|
+
const searchResults = await response.json() as paths['/search/{query}']['get']['responses']['200']['content']['application/json'];
|
|
25
|
+
// List the matching guilds
|
|
26
|
+
console.log(JSON.stringify(searchResults.guilds, null, 2));
|
|
27
|
+
}
|
|
28
|
+
```
|