rozod 4.2.0 → 4.2.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.
- package/LICENSE +15 -15
- package/README.md +121 -121
- package/lib/endpoints/accountinformationv1.d.ts +788 -788
- package/lib/endpoints/accountsettingsv1.d.ts +881 -881
- package/lib/endpoints/assetdeliveryv1.d.ts +847 -847
- package/lib/endpoints/assetdeliveryv2.d.ts +849 -849
- package/lib/endpoints/authv1.d.ts +1615 -1615
- package/lib/endpoints/authv2.d.ts +1374 -1374
- package/lib/endpoints/authv3.d.ts +59 -59
- package/lib/endpoints/avatarv1.d.ts +936 -936
- package/lib/endpoints/avatarv2.d.ts +393 -393
- package/lib/endpoints/avatarv3.d.ts +279 -279
- package/lib/endpoints/badgesv1.d.ts +483 -483
- package/lib/endpoints/catalogv1.d.ts +1079 -1079
- package/lib/endpoints/chatv2.d.ts +911 -911
- package/lib/endpoints/developv1.d.ts +1923 -1923
- package/lib/endpoints/developv2.d.ts +418 -418
- package/lib/endpoints/economyv1.d.ts +32 -32
- package/lib/endpoints/friendsv1.d.ts +1124 -1124
- package/lib/endpoints/gamejoinv1.d.ts +424 -424
- package/lib/endpoints/gamesv1.d.ts +1807 -1807
- package/lib/endpoints/gamesv2.d.ts +389 -389
- package/lib/endpoints/groupsv1.d.ts +3438 -3438
- package/lib/endpoints/groupsv2.d.ts +259 -259
- package/lib/endpoints/inventoryv1.d.ts +610 -610
- package/lib/endpoints/inventoryv2.d.ts +331 -331
- package/lib/endpoints/itemconfigurationv1.d.ts +563 -563
- package/lib/endpoints/presencev1.d.ts +116 -116
- package/lib/endpoints/privatemessagesv1.d.ts +420 -420
- package/lib/endpoints/thumbnailsv1.d.ts +1054 -1054
- package/lib/endpoints/tradesv1.d.ts +534 -534
- package/lib/endpoints/translationsv1.d.ts +174 -174
- package/lib/endpoints/usersv1.d.ts +693 -693
- package/lib/index.js +31 -1
- package/package.json +12 -14
package/LICENSE
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Alex Op
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
copyright notice and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Alex Op
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
<h1 align="center" style="height: 200; overflow: 'hidden'">
|
|
2
|
-
<img src="https://github.com/alexop1000/RoZod/assets/46445843/1c2a6cb5-b1d6-4784-b084-0679d81109c3" alt="RoZod" width="400" />
|
|
3
|
-
<br>
|
|
4
|
-
|
|
5
|
-
</h1>
|
|
6
|
-
|
|
7
|
-
<h4 align="center">A TypeScript package designed to simplify fully type-safe data fetching from the Roblox API.</h4>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="https://www.npmjs.com/package/rozod"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/rozod?style=for-the-badge"></a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/rozod"><img alt="npm" src="https://img.shields.io/npm/v/rozod?style=for-the-badge"></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/rozod"><img alt="npm" src="https://img.shields.io/npm/dt/rozod?style=for-the-badge"></a>
|
|
13
|
-
</p>
|
|
14
|
-
<p align="center">
|
|
15
|
-
<a href="#about">About</a> •
|
|
16
|
-
<a href="#features">Features</a> •
|
|
17
|
-
<a href="#installation">Installation</a> •
|
|
18
|
-
<a href="#usage">Usage</a> •
|
|
19
|
-
<a href="#credits">Credits</a> •
|
|
20
|
-
<a href="#disclaimer">Disclaimer</a>
|
|
21
|
-
</p>
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## About
|
|
26
|
-
`RoZod` is a TypeScript package designed to simplify fetching data from the Roblox API. It provides the functions `fetchApi`, `fetchApiPages`, and `fetchApliSplit`.
|
|
27
|
-
These allow you to get fully typesafe data from the Roblox API with minimal effort. You can also make custom endpoints to use in any context.
|
|
28
|
-
|
|
29
|
-
## Features
|
|
30
|
-
|
|
31
|
-
- Type-safe API requests and responses
|
|
32
|
-
- Automatic validation of request and response data
|
|
33
|
-
- Helper functions for paginated requests and splitting requests
|
|
34
|
-
|
|
35
|
-
## Installation
|
|
36
|
-
|
|
37
|
-
To install the package, run the following command:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm install rozod
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Usage
|
|
46
|
-
First, import the necessary functions and an example endpoint from the RoZod package:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { fetchApi, fetchApiSplit, fetchApiPages, fetchApiPagesGenerator } from 'rozod';
|
|
50
|
-
import { getTradesTradestatustype } from 'rozod/lib/endpoints/tradesv1';
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Simple API Request
|
|
54
|
-
|
|
55
|
-
To make a simple API request, use the `fetchApi` function, and any endpoint from our exports:
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
const response = await fetchApi(getTradesTradestatustype, { tradeStatusType: 1 });
|
|
59
|
-
console.log(response);
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Split API Request
|
|
63
|
-
To split a request into multiple requests based on specified parameters, use the `fetchApiSplit` function:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
const data = await fetchApiSplit(getGamesIcons, { universeIds: [1534453623, 65241, ...] }, { universeIds: 100 });
|
|
67
|
-
console.log(data);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Fetching All Pages
|
|
71
|
-
To fetch all pages of a paginated endpoint, use the `fetchApiPages` function:
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
const allPages = await fetchApiPages(getGroupsGroupidWallPosts, { groupId: 11479637 });
|
|
75
|
-
console.log(allPages);
|
|
76
|
-
```
|
|
77
|
-
### Fetching Pages with a Generator
|
|
78
|
-
To fetch pages one at a time using an async generator, use the `fetchApiPagesGenerator` function:
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
const pages = fetchApiPagesGenerator(getGroupsGroupidWallPosts, { groupId: 11479637 });
|
|
82
|
-
for await (const page of pages) {
|
|
83
|
-
console.log(page);
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Custom Endpoints
|
|
88
|
-
To create a custom endpoint, define an EndpointSchema object and export it. Here's an example of an endpoint from tradesv1.ts:
|
|
89
|
-
```ts
|
|
90
|
-
import { z, endpoint } from 'zod';
|
|
91
|
-
|
|
92
|
-
export const getV1tradesTradeStatusType = endpoint({
|
|
93
|
-
method: 'get' as const,
|
|
94
|
-
path: '/v1/trades/:tradeStatusType', // Path parameters are optional
|
|
95
|
-
baseUrl: 'https://trades.roblox.com',
|
|
96
|
-
requestFormat: 'json' as const,
|
|
97
|
-
parameters: {
|
|
98
|
-
tradeStatusType: z.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)]),
|
|
99
|
-
limit: z
|
|
100
|
-
.union([z.literal(10), z.literal(25), z.literal(50), z.literal(100)])
|
|
101
|
-
.optional()
|
|
102
|
-
.default(10),
|
|
103
|
-
cursor: z.string().optional(),
|
|
104
|
-
sortOrder: z.enum(['Asc', 'Desc']).optional().default('Asc'),
|
|
105
|
-
}, // Parameters are optional
|
|
106
|
-
response: ..., // Zod schema
|
|
107
|
-
};
|
|
108
|
-
```
|
|
109
|
-
You can then use the endpoint with the `fetchApi` function:
|
|
110
|
-
```ts
|
|
111
|
-
const response = await fetchApi(getV1tradesTradeStatusType, { tradeStatusType: 1 });
|
|
112
|
-
console.log(response);
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Credits
|
|
118
|
-
This repository is maintained by Alrovi ApS, the company behind RoGold.
|
|
119
|
-
|
|
120
|
-
## Disclaimer
|
|
121
|
-
RoZod is not affiliated with, maintained, authorized, endorsed, or sponsored by Roblox Corporation or any of its affiliates.
|
|
1
|
+
<h1 align="center" style="height: 200; overflow: 'hidden'">
|
|
2
|
+
<img src="https://github.com/alexop1000/RoZod/assets/46445843/1c2a6cb5-b1d6-4784-b084-0679d81109c3" alt="RoZod" width="400" />
|
|
3
|
+
<br>
|
|
4
|
+
|
|
5
|
+
</h1>
|
|
6
|
+
|
|
7
|
+
<h4 align="center">A TypeScript package designed to simplify fully type-safe data fetching from the Roblox API.</h4>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/rozod"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/rozod?style=for-the-badge"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/rozod"><img alt="npm" src="https://img.shields.io/npm/v/rozod?style=for-the-badge"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/rozod"><img alt="npm" src="https://img.shields.io/npm/dt/rozod?style=for-the-badge"></a>
|
|
13
|
+
</p>
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="#about">About</a> •
|
|
16
|
+
<a href="#features">Features</a> •
|
|
17
|
+
<a href="#installation">Installation</a> •
|
|
18
|
+
<a href="#usage">Usage</a> •
|
|
19
|
+
<a href="#credits">Credits</a> •
|
|
20
|
+
<a href="#disclaimer">Disclaimer</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## About
|
|
26
|
+
`RoZod` is a TypeScript package designed to simplify fetching data from the Roblox API. It provides the functions `fetchApi`, `fetchApiPages`, and `fetchApliSplit`.
|
|
27
|
+
These allow you to get fully typesafe data from the Roblox API with minimal effort. You can also make custom endpoints to use in any context.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- Type-safe API requests and responses
|
|
32
|
+
- Automatic validation of request and response data
|
|
33
|
+
- Helper functions for paginated requests and splitting requests
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
To install the package, run the following command:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install rozod
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
First, import the necessary functions and an example endpoint from the RoZod package:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { fetchApi, fetchApiSplit, fetchApiPages, fetchApiPagesGenerator } from 'rozod';
|
|
50
|
+
import { getTradesTradestatustype } from 'rozod/lib/endpoints/tradesv1';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Simple API Request
|
|
54
|
+
|
|
55
|
+
To make a simple API request, use the `fetchApi` function, and any endpoint from our exports:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const response = await fetchApi(getTradesTradestatustype, { tradeStatusType: 1 });
|
|
59
|
+
console.log(response);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Split API Request
|
|
63
|
+
To split a request into multiple requests based on specified parameters, use the `fetchApiSplit` function:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const data = await fetchApiSplit(getGamesIcons, { universeIds: [1534453623, 65241, ...] }, { universeIds: 100 });
|
|
67
|
+
console.log(data);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Fetching All Pages
|
|
71
|
+
To fetch all pages of a paginated endpoint, use the `fetchApiPages` function:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const allPages = await fetchApiPages(getGroupsGroupidWallPosts, { groupId: 11479637 });
|
|
75
|
+
console.log(allPages);
|
|
76
|
+
```
|
|
77
|
+
### Fetching Pages with a Generator
|
|
78
|
+
To fetch pages one at a time using an async generator, use the `fetchApiPagesGenerator` function:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const pages = fetchApiPagesGenerator(getGroupsGroupidWallPosts, { groupId: 11479637 });
|
|
82
|
+
for await (const page of pages) {
|
|
83
|
+
console.log(page);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Custom Endpoints
|
|
88
|
+
To create a custom endpoint, define an EndpointSchema object and export it. Here's an example of an endpoint from tradesv1.ts:
|
|
89
|
+
```ts
|
|
90
|
+
import { z, endpoint } from 'zod';
|
|
91
|
+
|
|
92
|
+
export const getV1tradesTradeStatusType = endpoint({
|
|
93
|
+
method: 'get' as const,
|
|
94
|
+
path: '/v1/trades/:tradeStatusType', // Path parameters are optional
|
|
95
|
+
baseUrl: 'https://trades.roblox.com',
|
|
96
|
+
requestFormat: 'json' as const,
|
|
97
|
+
parameters: {
|
|
98
|
+
tradeStatusType: z.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)]),
|
|
99
|
+
limit: z
|
|
100
|
+
.union([z.literal(10), z.literal(25), z.literal(50), z.literal(100)])
|
|
101
|
+
.optional()
|
|
102
|
+
.default(10),
|
|
103
|
+
cursor: z.string().optional(),
|
|
104
|
+
sortOrder: z.enum(['Asc', 'Desc']).optional().default('Asc'),
|
|
105
|
+
}, // Parameters are optional
|
|
106
|
+
response: ..., // Zod schema
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
You can then use the endpoint with the `fetchApi` function:
|
|
110
|
+
```ts
|
|
111
|
+
const response = await fetchApi(getV1tradesTradeStatusType, { tradeStatusType: 1 });
|
|
112
|
+
console.log(response);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Credits
|
|
118
|
+
This repository is maintained by Alrovi ApS, the company behind RoGold.
|
|
119
|
+
|
|
120
|
+
## Disclaimer
|
|
121
|
+
RoZod is not affiliated with, maintained, authorized, endorsed, or sponsored by Roblox Corporation or any of its affiliates.
|