rozod 1.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/lib/endpoints/accountinformationv1.d.ts +551 -0
- package/lib/endpoints/accountinformationv1.js +652 -0
- package/lib/endpoints/accountsettingsv1.d.ts +548 -0
- package/lib/endpoints/accountsettingsv1.js +712 -0
- package/lib/endpoints/assetdeliveryv1.d.ts +599 -0
- package/lib/endpoints/assetdeliveryv1.js +268 -0
- package/lib/endpoints/assetdeliveryv2.d.ts +780 -0
- package/lib/endpoints/assetdeliveryv2.js +271 -0
- package/lib/endpoints/authv1.d.ts +1328 -0
- package/lib/endpoints/authv1.js +1168 -0
- package/lib/endpoints/authv2.d.ts +1239 -0
- package/lib/endpoints/authv2.js +1057 -0
- package/lib/endpoints/authv3.d.ts +35 -0
- package/lib/endpoints/authv3.js +41 -0
- package/lib/endpoints/avatarv1.d.ts +1841 -0
- package/lib/endpoints/avatarv1.js +726 -0
- package/lib/endpoints/avatarv2.d.ts +1077 -0
- package/lib/endpoints/avatarv2.js +316 -0
- package/lib/endpoints/avatarv3.d.ts +656 -0
- package/lib/endpoints/avatarv3.js +219 -0
- package/lib/endpoints/badgesv1.d.ts +641 -0
- package/lib/endpoints/badgesv1.js +345 -0
- package/lib/endpoints/catalogv1.d.ts +1715 -0
- package/lib/endpoints/catalogv1.js +792 -0
- package/lib/endpoints/chatv2.d.ts +2179 -0
- package/lib/endpoints/chatv2.js +721 -0
- package/lib/endpoints/developv1.d.ts +2097 -0
- package/lib/endpoints/developv1.js +1537 -0
- package/lib/endpoints/developv2.d.ts +619 -0
- package/lib/endpoints/developv2.js +316 -0
- package/lib/endpoints/economyv1.d.ts +20 -0
- package/lib/endpoints/economyv1.js +28 -0
- package/lib/endpoints/friendsv1.d.ts +1093 -0
- package/lib/endpoints/friendsv1.js +818 -0
- package/lib/endpoints/gamesv1.d.ts +2749 -0
- package/lib/endpoints/gamesv1.js +1294 -0
- package/lib/endpoints/gamesv2.d.ts +582 -0
- package/lib/endpoints/gamesv2.js +258 -0
- package/lib/endpoints/groupsv1.d.ts +5528 -0
- package/lib/endpoints/groupsv1.js +2434 -0
- package/lib/endpoints/groupsv2.d.ts +530 -0
- package/lib/endpoints/groupsv2.js +201 -0
- package/lib/endpoints/inventoryv1.d.ts +436 -0
- package/lib/endpoints/inventoryv1.js +434 -0
- package/lib/endpoints/inventoryv2.d.ts +256 -0
- package/lib/endpoints/inventoryv2.js +241 -0
- package/lib/endpoints/presencev1.d.ts +134 -0
- package/lib/endpoints/presencev1.js +93 -0
- package/lib/endpoints/privatemessagesv1.d.ts +620 -0
- package/lib/endpoints/privatemessagesv1.js +338 -0
- package/lib/endpoints/thumbnailsv1.d.ts +897 -0
- package/lib/endpoints/thumbnailsv1.js +560 -0
- package/lib/endpoints/tradesv1.d.ts +473 -0
- package/lib/endpoints/tradesv1.js +403 -0
- package/lib/endpoints/translationsv1.d.ts +80 -0
- package/lib/endpoints/translationsv1.js +122 -0
- package/lib/endpoints/usersv1.d.ts +391 -0
- package/lib/endpoints/usersv1.js +344 -0
- package/lib/index.d.ts +85 -0
- package/lib/index.js +293 -0
- package/package.json +39 -0
- package/readme.md +99 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getV1userssearch = exports.getV1usersauthenticatedroles = exports.getV1usersauthenticatedcountryCode = exports.getV1usersauthenticatedageBracket = exports.getV1usersauthenticated = exports.getV1usersUserIdusernameHistory = exports.getV1usersUserIddisplayNamesvalidate = exports.patchV1usersUserIddisplayNames = exports.getV1usersUserId = exports.postV1users = exports.postV1usernamesusers = exports.getV1displayNamesvalidate = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
var Roblox_Web_WebAPI_ApiEmptyResponseModel = zod_1.z.object({}).partial();
|
|
6
|
+
var Roblox_Users_Api_GetUserResponse = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
description: zod_1.z.string(),
|
|
9
|
+
created: zod_1.z.string().datetime(),
|
|
10
|
+
isBanned: zod_1.z.boolean(),
|
|
11
|
+
externalAppDisplayName: zod_1.z.string(),
|
|
12
|
+
hasVerifiedBadge: zod_1.z.boolean(),
|
|
13
|
+
id: zod_1.z.number().int(),
|
|
14
|
+
name: zod_1.z.string(),
|
|
15
|
+
displayName: zod_1.z.string(),
|
|
16
|
+
})
|
|
17
|
+
.partial();
|
|
18
|
+
var Roblox_Users_Api_UsernameHistoryResponse = zod_1.z.object({ name: zod_1.z.string() }).partial();
|
|
19
|
+
var Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UsernameHistoryResponse_ = zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
previousPageCursor: zod_1.z.string(),
|
|
22
|
+
nextPageCursor: zod_1.z.string(),
|
|
23
|
+
data: zod_1.z.array(Roblox_Users_Api_UsernameHistoryResponse),
|
|
24
|
+
})
|
|
25
|
+
.partial();
|
|
26
|
+
var Roblox_Users_Api_AuthenticatedUserResponse = zod_1.z
|
|
27
|
+
.object({ id: zod_1.z.number().int(), name: zod_1.z.string(), displayName: zod_1.z.string() })
|
|
28
|
+
.partial();
|
|
29
|
+
var Roblox_Users_Api_UserAgeBracketResponse = zod_1.z.object({ ageBracket: zod_1.z.number().int() }).partial();
|
|
30
|
+
var Roblox_Users_Api_UserCountryCodeResponse = zod_1.z.object({ countryCode: zod_1.z.string() }).partial();
|
|
31
|
+
var Roblox_Users_Api_UserRolesResponse = zod_1.z.object({ roles: zod_1.z.array(zod_1.z.string()) }).partial();
|
|
32
|
+
var Roblox_Users_Api_UserSearchResponse = zod_1.z
|
|
33
|
+
.object({
|
|
34
|
+
previousUsernames: zod_1.z.array(zod_1.z.string()),
|
|
35
|
+
hasVerifiedBadge: zod_1.z.boolean(),
|
|
36
|
+
id: zod_1.z.number().int(),
|
|
37
|
+
name: zod_1.z.string(),
|
|
38
|
+
displayName: zod_1.z.string(),
|
|
39
|
+
})
|
|
40
|
+
.partial();
|
|
41
|
+
var Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UserSearchResponse_ = zod_1.z
|
|
42
|
+
.object({
|
|
43
|
+
previousPageCursor: zod_1.z.string(),
|
|
44
|
+
nextPageCursor: zod_1.z.string(),
|
|
45
|
+
data: zod_1.z.array(Roblox_Users_Api_UserSearchResponse),
|
|
46
|
+
})
|
|
47
|
+
.partial();
|
|
48
|
+
var Roblox_Users_Api_MultiGetByUsernameRequest = zod_1.z
|
|
49
|
+
.object({ usernames: zod_1.z.array(zod_1.z.string()), excludeBannedUsers: zod_1.z.boolean() })
|
|
50
|
+
.partial();
|
|
51
|
+
var Roblox_Users_Api_MultiGetUserByNameResponse = zod_1.z
|
|
52
|
+
.object({
|
|
53
|
+
requestedUsername: zod_1.z.string(),
|
|
54
|
+
hasVerifiedBadge: zod_1.z.boolean(),
|
|
55
|
+
id: zod_1.z.number().int(),
|
|
56
|
+
name: zod_1.z.string(),
|
|
57
|
+
displayName: zod_1.z.string(),
|
|
58
|
+
})
|
|
59
|
+
.partial();
|
|
60
|
+
var Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_MultiGetUserByNameResponse_ = zod_1.z
|
|
61
|
+
.object({ data: zod_1.z.array(Roblox_Users_Api_MultiGetUserByNameResponse) })
|
|
62
|
+
.partial();
|
|
63
|
+
var Roblox_Users_Api_MultiGetByUserIdRequest = zod_1.z
|
|
64
|
+
.object({ userIds: zod_1.z.array(zod_1.z.number()), excludeBannedUsers: zod_1.z.boolean() })
|
|
65
|
+
.partial();
|
|
66
|
+
var Roblox_Users_Api_VerifiedBadgeUserResponse = zod_1.z
|
|
67
|
+
.object({
|
|
68
|
+
hasVerifiedBadge: zod_1.z.boolean(),
|
|
69
|
+
id: zod_1.z.number().int(),
|
|
70
|
+
name: zod_1.z.string(),
|
|
71
|
+
displayName: zod_1.z.string(),
|
|
72
|
+
})
|
|
73
|
+
.partial();
|
|
74
|
+
var Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_VerifiedBadgeUserResponse_ = zod_1.z
|
|
75
|
+
.object({ data: zod_1.z.array(Roblox_Users_Api_VerifiedBadgeUserResponse) })
|
|
76
|
+
.partial();
|
|
77
|
+
var Roblox_Users_Api_SetDisplayNameRequest = zod_1.z.object({ newDisplayName: zod_1.z.string() }).partial();
|
|
78
|
+
var schemas = {
|
|
79
|
+
Roblox_Web_WebAPI_ApiEmptyResponseModel: Roblox_Web_WebAPI_ApiEmptyResponseModel,
|
|
80
|
+
Roblox_Users_Api_GetUserResponse: Roblox_Users_Api_GetUserResponse,
|
|
81
|
+
Roblox_Users_Api_UsernameHistoryResponse: Roblox_Users_Api_UsernameHistoryResponse,
|
|
82
|
+
Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UsernameHistoryResponse_: Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UsernameHistoryResponse_,
|
|
83
|
+
Roblox_Users_Api_AuthenticatedUserResponse: Roblox_Users_Api_AuthenticatedUserResponse,
|
|
84
|
+
Roblox_Users_Api_UserAgeBracketResponse: Roblox_Users_Api_UserAgeBracketResponse,
|
|
85
|
+
Roblox_Users_Api_UserCountryCodeResponse: Roblox_Users_Api_UserCountryCodeResponse,
|
|
86
|
+
Roblox_Users_Api_UserRolesResponse: Roblox_Users_Api_UserRolesResponse,
|
|
87
|
+
Roblox_Users_Api_UserSearchResponse: Roblox_Users_Api_UserSearchResponse,
|
|
88
|
+
Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UserSearchResponse_: Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UserSearchResponse_,
|
|
89
|
+
Roblox_Users_Api_MultiGetByUsernameRequest: Roblox_Users_Api_MultiGetByUsernameRequest,
|
|
90
|
+
Roblox_Users_Api_MultiGetUserByNameResponse: Roblox_Users_Api_MultiGetUserByNameResponse,
|
|
91
|
+
Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_MultiGetUserByNameResponse_: Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_MultiGetUserByNameResponse_,
|
|
92
|
+
Roblox_Users_Api_MultiGetByUserIdRequest: Roblox_Users_Api_MultiGetByUserIdRequest,
|
|
93
|
+
Roblox_Users_Api_VerifiedBadgeUserResponse: Roblox_Users_Api_VerifiedBadgeUserResponse,
|
|
94
|
+
Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_VerifiedBadgeUserResponse_: Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_VerifiedBadgeUserResponse_,
|
|
95
|
+
Roblox_Users_Api_SetDisplayNameRequest: Roblox_Users_Api_SetDisplayNameRequest,
|
|
96
|
+
};
|
|
97
|
+
exports.getV1displayNamesvalidate = {
|
|
98
|
+
method: 'get',
|
|
99
|
+
path: '/v1/display-names/validate',
|
|
100
|
+
baseUrl: 'https://users.roblox.com',
|
|
101
|
+
requestFormat: 'json',
|
|
102
|
+
parameters: {
|
|
103
|
+
displayName: zod_1.z.string(),
|
|
104
|
+
birthdate: zod_1.z.string().datetime(),
|
|
105
|
+
},
|
|
106
|
+
response: zod_1.z.object({}).partial(),
|
|
107
|
+
errors: [
|
|
108
|
+
{
|
|
109
|
+
status: 400,
|
|
110
|
+
description: "1: Display name is too short\n2: Display name is too long\n3: Display name contains invalid characters\n4: Display name has been moderated\n6: Request must contain a birthdate",
|
|
111
|
+
schema: zod_1.z.void(),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
status: 429,
|
|
115
|
+
description: "5: Display name updates for this user have been throttled",
|
|
116
|
+
schema: zod_1.z.void(),
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
exports.postV1usernamesusers = {
|
|
121
|
+
method: 'post',
|
|
122
|
+
path: '/v1/usernames/users',
|
|
123
|
+
baseUrl: 'https://users.roblox.com',
|
|
124
|
+
description: "This endpoint will also check previous usernames.\nDoes not require X-CSRF-Token protection because this is essentially a get request but as a POST to avoid URI limits.",
|
|
125
|
+
requestFormat: 'json',
|
|
126
|
+
parameters: {
|
|
127
|
+
body: Roblox_Users_Api_MultiGetByUsernameRequest,
|
|
128
|
+
},
|
|
129
|
+
response: Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_MultiGetUserByNameResponse_,
|
|
130
|
+
errors: [
|
|
131
|
+
{
|
|
132
|
+
status: 400,
|
|
133
|
+
description: "2: Too many usernames.",
|
|
134
|
+
schema: zod_1.z.void(),
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
exports.postV1users = {
|
|
139
|
+
method: 'post',
|
|
140
|
+
path: '/v1/users',
|
|
141
|
+
baseUrl: 'https://users.roblox.com',
|
|
142
|
+
description: "Does not require X-CSRF-Token protection because this is essentially a get request but as a POST to avoid URI limits.",
|
|
143
|
+
requestFormat: 'json',
|
|
144
|
+
parameters: {
|
|
145
|
+
body: Roblox_Users_Api_MultiGetByUserIdRequest,
|
|
146
|
+
},
|
|
147
|
+
response: Roblox_Web_WebAPI_Models_ApiArrayResponse_Roblox_Users_Api_VerifiedBadgeUserResponse_,
|
|
148
|
+
errors: [
|
|
149
|
+
{
|
|
150
|
+
status: 400,
|
|
151
|
+
description: "1: Too many ids.",
|
|
152
|
+
schema: zod_1.z.void(),
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
exports.getV1usersUserId = {
|
|
157
|
+
method: 'get',
|
|
158
|
+
path: '/v1/users/:userId',
|
|
159
|
+
baseUrl: 'https://users.roblox.com',
|
|
160
|
+
requestFormat: 'json',
|
|
161
|
+
parameters: {
|
|
162
|
+
userId: zod_1.z.number().int(),
|
|
163
|
+
},
|
|
164
|
+
response: Roblox_Users_Api_GetUserResponse,
|
|
165
|
+
errors: [
|
|
166
|
+
{
|
|
167
|
+
status: 404,
|
|
168
|
+
description: "3: The user id is invalid.",
|
|
169
|
+
schema: zod_1.z.void(),
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
};
|
|
173
|
+
exports.patchV1usersUserIddisplayNames = {
|
|
174
|
+
method: 'patch',
|
|
175
|
+
path: '/v1/users/:userId/display-names',
|
|
176
|
+
baseUrl: 'https://users.roblox.com',
|
|
177
|
+
requestFormat: 'json',
|
|
178
|
+
parameters: {
|
|
179
|
+
body: zod_1.z.object({ newDisplayName: zod_1.z.string() }).partial(),
|
|
180
|
+
userId: zod_1.z.number().int(),
|
|
181
|
+
},
|
|
182
|
+
response: zod_1.z.object({}).partial(),
|
|
183
|
+
errors: [
|
|
184
|
+
{
|
|
185
|
+
status: 400,
|
|
186
|
+
description: "1: Display name is too short\n2: Display name is too long\n3: Display name contains invalid characters\n4: Display name has been moderated",
|
|
187
|
+
schema: zod_1.z.void(),
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
status: 401,
|
|
191
|
+
description: "0: Authorization has been denied for this request.",
|
|
192
|
+
schema: zod_1.z.void(),
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
status: 403,
|
|
196
|
+
description: "0: Token Validation Failed\n7: The user id is invalid.",
|
|
197
|
+
schema: zod_1.z.void(),
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
status: 429,
|
|
201
|
+
description: "5: Display name updates for this user have been throttled",
|
|
202
|
+
schema: zod_1.z.void(),
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
exports.getV1usersUserIddisplayNamesvalidate = {
|
|
207
|
+
method: 'get',
|
|
208
|
+
path: '/v1/users/:userId/display-names/validate',
|
|
209
|
+
baseUrl: 'https://users.roblox.com',
|
|
210
|
+
requestFormat: 'json',
|
|
211
|
+
parameters: {
|
|
212
|
+
userId: zod_1.z.number().int(),
|
|
213
|
+
displayName: zod_1.z.string(),
|
|
214
|
+
},
|
|
215
|
+
response: zod_1.z.object({}).partial(),
|
|
216
|
+
errors: [
|
|
217
|
+
{
|
|
218
|
+
status: 400,
|
|
219
|
+
description: "1: Display name is too short\n2: Display name is too long\n3: Display name contains invalid characters\n4: Display name has been moderated",
|
|
220
|
+
schema: zod_1.z.void(),
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
status: 401,
|
|
224
|
+
description: "0: Authorization has been denied for this request.",
|
|
225
|
+
schema: zod_1.z.void(),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
status: 403,
|
|
229
|
+
description: "7: The user id is invalid.",
|
|
230
|
+
schema: zod_1.z.void(),
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
status: 429,
|
|
234
|
+
description: "5: Display name updates for this user have been throttled",
|
|
235
|
+
schema: zod_1.z.void(),
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
};
|
|
239
|
+
exports.getV1usersUserIdusernameHistory = {
|
|
240
|
+
method: 'get',
|
|
241
|
+
path: '/v1/users/:userId/username-history',
|
|
242
|
+
baseUrl: 'https://users.roblox.com',
|
|
243
|
+
requestFormat: 'json',
|
|
244
|
+
parameters: {
|
|
245
|
+
userId: zod_1.z.number().int(),
|
|
246
|
+
limit: zod_1.z
|
|
247
|
+
.union([zod_1.z.literal(10), zod_1.z.literal(25), zod_1.z.literal(50), zod_1.z.literal(100)])
|
|
248
|
+
.optional()
|
|
249
|
+
.default(10),
|
|
250
|
+
cursor: zod_1.z.string().optional(),
|
|
251
|
+
sortOrder: zod_1.z.enum(['Asc', 'Desc']).optional().default('Asc'),
|
|
252
|
+
},
|
|
253
|
+
response: Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UsernameHistoryResponse_,
|
|
254
|
+
errors: [
|
|
255
|
+
{
|
|
256
|
+
status: 400,
|
|
257
|
+
description: "3: The user id is invalid.",
|
|
258
|
+
schema: zod_1.z.void(),
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
};
|
|
262
|
+
exports.getV1usersauthenticated = {
|
|
263
|
+
method: 'get',
|
|
264
|
+
path: '/v1/users/authenticated',
|
|
265
|
+
baseUrl: 'https://users.roblox.com',
|
|
266
|
+
requestFormat: 'json',
|
|
267
|
+
response: Roblox_Users_Api_AuthenticatedUserResponse,
|
|
268
|
+
errors: [
|
|
269
|
+
{
|
|
270
|
+
status: 401,
|
|
271
|
+
description: "0: Authorization has been denied for this request.",
|
|
272
|
+
schema: zod_1.z.void(),
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
exports.getV1usersauthenticatedageBracket = {
|
|
277
|
+
method: 'get',
|
|
278
|
+
path: '/v1/users/authenticated/age-bracket',
|
|
279
|
+
baseUrl: 'https://users.roblox.com',
|
|
280
|
+
requestFormat: 'json',
|
|
281
|
+
response: zod_1.z.object({ ageBracket: zod_1.z.number().int() }).partial(),
|
|
282
|
+
errors: [
|
|
283
|
+
{
|
|
284
|
+
status: 401,
|
|
285
|
+
description: "0: Authorization has been denied for this request.",
|
|
286
|
+
schema: zod_1.z.void(),
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
};
|
|
290
|
+
exports.getV1usersauthenticatedcountryCode = {
|
|
291
|
+
method: 'get',
|
|
292
|
+
path: '/v1/users/authenticated/country-code',
|
|
293
|
+
baseUrl: 'https://users.roblox.com',
|
|
294
|
+
requestFormat: 'json',
|
|
295
|
+
response: zod_1.z.object({ countryCode: zod_1.z.string() }).partial(),
|
|
296
|
+
errors: [
|
|
297
|
+
{
|
|
298
|
+
status: 401,
|
|
299
|
+
description: "0: Authorization has been denied for this request.",
|
|
300
|
+
schema: zod_1.z.void(),
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
};
|
|
304
|
+
exports.getV1usersauthenticatedroles = {
|
|
305
|
+
method: 'get',
|
|
306
|
+
path: '/v1/users/authenticated/roles',
|
|
307
|
+
baseUrl: 'https://users.roblox.com',
|
|
308
|
+
requestFormat: 'json',
|
|
309
|
+
response: Roblox_Users_Api_UserRolesResponse,
|
|
310
|
+
errors: [
|
|
311
|
+
{
|
|
312
|
+
status: 401,
|
|
313
|
+
description: "0: Authorization has been denied for this request.",
|
|
314
|
+
schema: zod_1.z.void(),
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
};
|
|
318
|
+
exports.getV1userssearch = {
|
|
319
|
+
method: 'get',
|
|
320
|
+
path: '/v1/users/search',
|
|
321
|
+
baseUrl: 'https://users.roblox.com',
|
|
322
|
+
requestFormat: 'json',
|
|
323
|
+
parameters: {
|
|
324
|
+
keyword: zod_1.z.string(),
|
|
325
|
+
limit: zod_1.z
|
|
326
|
+
.union([zod_1.z.literal(10), zod_1.z.literal(25), zod_1.z.literal(50), zod_1.z.literal(100)])
|
|
327
|
+
.optional()
|
|
328
|
+
.default(10),
|
|
329
|
+
cursor: zod_1.z.string().optional(),
|
|
330
|
+
},
|
|
331
|
+
response: Roblox_Web_WebAPI_Models_ApiPageResponse_Roblox_Users_Api_UserSearchResponse_,
|
|
332
|
+
errors: [
|
|
333
|
+
{
|
|
334
|
+
status: 400,
|
|
335
|
+
description: "5: The keyword was filtered.\n6: The keyword is too short.",
|
|
336
|
+
schema: zod_1.z.void(),
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
status: 429,
|
|
340
|
+
description: "4: Too many requests.",
|
|
341
|
+
schema: zod_1.z.void(),
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
type RequestMethod = 'get' | 'post' | 'put' | 'delete';
|
|
3
|
+
type RequestFormat = 'json' | 'text';
|
|
4
|
+
type EndpointSchema = {
|
|
5
|
+
method: RequestMethod;
|
|
6
|
+
path: string;
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
requestFormat: RequestFormat;
|
|
9
|
+
parameters: Record<string, z.Schema<any>>;
|
|
10
|
+
response: z.Schema<any>;
|
|
11
|
+
errors: {
|
|
12
|
+
status: number;
|
|
13
|
+
description: string;
|
|
14
|
+
schema: z.Schema<any>;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
type ExtractRequiredParams<S extends EndpointSchema> = {
|
|
18
|
+
[K in keyof S['parameters']]: S['parameters'][K] extends z.ZodOptional<any> | z.ZodDefault<any> ? never : K;
|
|
19
|
+
}[keyof S['parameters']];
|
|
20
|
+
type ExtractOptionalParams<S extends EndpointSchema> = {
|
|
21
|
+
[K in keyof S['parameters']]: S['parameters'][K] extends z.ZodOptional<any> | z.ZodDefault<any> ? K : never;
|
|
22
|
+
}[keyof S['parameters']];
|
|
23
|
+
type ExtractParams<S extends EndpointSchema> = {
|
|
24
|
+
[K in ExtractRequiredParams<S>]: z.infer<S['parameters'][K]>;
|
|
25
|
+
} & Partial<{
|
|
26
|
+
[K in ExtractOptionalParams<S>]: z.infer<S['parameters'][K]>;
|
|
27
|
+
}>;
|
|
28
|
+
type ExtractResponse<S extends EndpointSchema> = z.infer<S['response']>;
|
|
29
|
+
/**
|
|
30
|
+
* Fetches the data from the given endpoint and returns it.
|
|
31
|
+
*
|
|
32
|
+
* @param endpoint The endpoint to fetch from.
|
|
33
|
+
* @param params The parameters to pass to the endpoint.
|
|
34
|
+
* @param requestOptions Any additional options to pass to fetch.
|
|
35
|
+
* @returns The response from the endpoint.
|
|
36
|
+
*/
|
|
37
|
+
declare function fetchApi<S extends EndpointSchema>(endpoint: S, params: ExtractParams<S>, requestOptions?: RequestInit): Promise<ExtractResponse<S>>;
|
|
38
|
+
/**
|
|
39
|
+
* Fetches the data from the given endpoint, but splits the request into multiple requests if the specified parameter is larger than max specified.
|
|
40
|
+
*
|
|
41
|
+
* @param endpoint The endpoint to fetch from.
|
|
42
|
+
* @param params The parameters to pass to the endpoint.
|
|
43
|
+
* @param max The maximum number of items to pass to the endpoint.
|
|
44
|
+
* @param transform A function that accepts the endpoint response and transforms it into the desired type.
|
|
45
|
+
* @param requestOptions Any additional options to pass to fetch.
|
|
46
|
+
* @returns The transformed response from the endpoint.
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const data = await fetchApiSplit(getV1gamesicons, { universeIds: [1, 2, 3, 4, 5] }, { universeIds: 100 }, (response) => response.data);
|
|
50
|
+
* console.log(data); // [[{ "targetId": 0, "state": "Completed", "imageUrl": "..." }], ...]
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function fetchApiSplit<S extends EndpointSchema, T = ExtractResponse<S>>(endpoint: S, params: ExtractParams<S>, max?: Partial<{
|
|
54
|
+
[K in keyof ExtractParams<S>]: number;
|
|
55
|
+
}>, transform?: (response: ExtractResponse<S>) => T, requestOptions?: RequestInit): Promise<T[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Fetches all pages of results for the given endpoint and parameters.
|
|
58
|
+
*
|
|
59
|
+
* @param endpoint The endpoint to fetch.
|
|
60
|
+
* @param initialParams The initial parameters to use for the endpoint.
|
|
61
|
+
* @param requestOptions The options to use when making requests.
|
|
62
|
+
* @param limit The maximum number of pages to fetch.
|
|
63
|
+
* @returns An array of all results.
|
|
64
|
+
*/
|
|
65
|
+
declare function fetchApiPages<S extends EndpointSchema>(endpoint: S, initialParams: Omit<ExtractParams<S>, 'cursor'>, requestOptions?: RequestInit, limit?: number): Promise<ExtractResponse<S>[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Fetches all pages of results for the given endpoint and parameters.
|
|
68
|
+
* This is a generator function that yields each page as it is fetched.
|
|
69
|
+
*
|
|
70
|
+
* @param endpoint The endpoint to fetch.
|
|
71
|
+
* @param initialParams The initial parameters to use for the endpoint.
|
|
72
|
+
* @param requestOptions The options to use when making requests.
|
|
73
|
+
* @param limit The maximum number of pages to fetch.
|
|
74
|
+
* @returns An array of all results.
|
|
75
|
+
* @yields The next page of results.
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const pages = fetchApiPagesGenerator(getV1badgesicons, { badgeIds: [1, 2, 3] });
|
|
79
|
+
* for await (const page of pages) {
|
|
80
|
+
* console.log(page.data);
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
declare function fetchApiPagesGenerator<S extends EndpointSchema>(endpoint: S, initialParams: Omit<ExtractParams<S>, 'cursor'>, requestOptions?: RequestInit, limit?: number): AsyncGenerator<ExtractResponse<S>, void, unknown>;
|
|
85
|
+
export { fetchApi, fetchApiSplit, fetchApiPages, fetchApiPagesGenerator };
|