@darco2903/altv-web-api 2.1.0 → 2.3.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/dist/client.d.ts +295 -0
- package/dist/contract/index.d.ts +594 -0
- package/dist/contract/room.d.ts +383 -0
- package/dist/contract/room.js +57 -1
- package/dist/contract/youtube.d.ts +213 -0
- package/dist/contract/youtube.js +18 -2
- package/dist/types/youtube.d.ts +17 -0
- package/dist/types/youtube.js +6 -0
- package/package.json +1 -1
|
@@ -223,6 +223,219 @@ declare const _default: {
|
|
|
223
223
|
}>;
|
|
224
224
|
};
|
|
225
225
|
};
|
|
226
|
+
searchPlaylists: {
|
|
227
|
+
query: z.ZodObject<{
|
|
228
|
+
q: z.ZodString;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
q: string;
|
|
231
|
+
}, {
|
|
232
|
+
q: string;
|
|
233
|
+
}>;
|
|
234
|
+
description: "Search YouTube playlists";
|
|
235
|
+
method: "GET";
|
|
236
|
+
path: "/youtube/search/playlists";
|
|
237
|
+
responses: {
|
|
238
|
+
429: z.ZodObject<{
|
|
239
|
+
code: z.ZodType<"TOO_MANY_SEARCHES", z.ZodTypeDef, "TOO_MANY_SEARCHES">;
|
|
240
|
+
error: z.ZodType<"Too many searches are running", z.ZodTypeDef, "Too many searches are running">;
|
|
241
|
+
name: z.ZodLiteral<"APIError">;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
code: "TOO_MANY_SEARCHES";
|
|
244
|
+
error: "Too many searches are running";
|
|
245
|
+
name: "APIError";
|
|
246
|
+
}, {
|
|
247
|
+
code: "TOO_MANY_SEARCHES";
|
|
248
|
+
error: "Too many searches are running";
|
|
249
|
+
name: "APIError";
|
|
250
|
+
}>;
|
|
251
|
+
500: z.ZodObject<{
|
|
252
|
+
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
253
|
+
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
254
|
+
name: z.ZodLiteral<"APIError">;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
257
|
+
error: string;
|
|
258
|
+
name: "APIError";
|
|
259
|
+
}, {
|
|
260
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
261
|
+
error: string;
|
|
262
|
+
name: "APIError";
|
|
263
|
+
}>;
|
|
264
|
+
401: z.ZodObject<{
|
|
265
|
+
code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
|
|
266
|
+
error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
|
|
267
|
+
name: z.ZodLiteral<"APIError">;
|
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
code: "UNAUTHORIZED";
|
|
270
|
+
error: "Unauthorized";
|
|
271
|
+
name: "APIError";
|
|
272
|
+
}, {
|
|
273
|
+
code: "UNAUTHORIZED";
|
|
274
|
+
error: "Unauthorized";
|
|
275
|
+
name: "APIError";
|
|
276
|
+
}>;
|
|
277
|
+
403: z.ZodObject<{
|
|
278
|
+
code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
|
|
279
|
+
error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
|
|
280
|
+
name: z.ZodLiteral<"APIError">;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
code: "FORBIDDEN";
|
|
283
|
+
error: "Forbidden";
|
|
284
|
+
name: "APIError";
|
|
285
|
+
}, {
|
|
286
|
+
code: "FORBIDDEN";
|
|
287
|
+
error: "Forbidden";
|
|
288
|
+
name: "APIError";
|
|
289
|
+
}>;
|
|
290
|
+
200: z.ZodObject<{
|
|
291
|
+
results: z.ZodArray<z.ZodObject<{
|
|
292
|
+
playlistId: z.ZodString;
|
|
293
|
+
title: z.ZodString;
|
|
294
|
+
channel: z.ZodNullable<z.ZodString>;
|
|
295
|
+
thumbnail: z.ZodNullable<z.ZodString>;
|
|
296
|
+
}, "strip", z.ZodTypeAny, {
|
|
297
|
+
title: string;
|
|
298
|
+
channel: string | null;
|
|
299
|
+
thumbnail: string | null;
|
|
300
|
+
playlistId: string;
|
|
301
|
+
}, {
|
|
302
|
+
title: string;
|
|
303
|
+
channel: string | null;
|
|
304
|
+
thumbnail: string | null;
|
|
305
|
+
playlistId: string;
|
|
306
|
+
}>, "many">;
|
|
307
|
+
}, "strip", z.ZodTypeAny, {
|
|
308
|
+
results: {
|
|
309
|
+
title: string;
|
|
310
|
+
channel: string | null;
|
|
311
|
+
thumbnail: string | null;
|
|
312
|
+
playlistId: string;
|
|
313
|
+
}[];
|
|
314
|
+
}, {
|
|
315
|
+
results: {
|
|
316
|
+
title: string;
|
|
317
|
+
channel: string | null;
|
|
318
|
+
thumbnail: string | null;
|
|
319
|
+
playlistId: string;
|
|
320
|
+
}[];
|
|
321
|
+
}>;
|
|
322
|
+
400: z.ZodObject<{
|
|
323
|
+
name: z.ZodLiteral<"ZodError">;
|
|
324
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
325
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
326
|
+
message: z.ZodOptional<z.ZodString>;
|
|
327
|
+
code: z.ZodNativeEnum<{
|
|
328
|
+
invalid_type: "invalid_type";
|
|
329
|
+
invalid_literal: "invalid_literal";
|
|
330
|
+
custom: "custom";
|
|
331
|
+
invalid_union: "invalid_union";
|
|
332
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
333
|
+
invalid_enum_value: "invalid_enum_value";
|
|
334
|
+
unrecognized_keys: "unrecognized_keys";
|
|
335
|
+
invalid_arguments: "invalid_arguments";
|
|
336
|
+
invalid_return_type: "invalid_return_type";
|
|
337
|
+
invalid_date: "invalid_date";
|
|
338
|
+
invalid_string: "invalid_string";
|
|
339
|
+
too_small: "too_small";
|
|
340
|
+
too_big: "too_big";
|
|
341
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
342
|
+
not_multiple_of: "not_multiple_of";
|
|
343
|
+
not_finite: "not_finite";
|
|
344
|
+
}>;
|
|
345
|
+
}, "strip", z.ZodAny, z.objectOutputType<{
|
|
346
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
347
|
+
message: z.ZodOptional<z.ZodString>;
|
|
348
|
+
code: z.ZodNativeEnum<{
|
|
349
|
+
invalid_type: "invalid_type";
|
|
350
|
+
invalid_literal: "invalid_literal";
|
|
351
|
+
custom: "custom";
|
|
352
|
+
invalid_union: "invalid_union";
|
|
353
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
354
|
+
invalid_enum_value: "invalid_enum_value";
|
|
355
|
+
unrecognized_keys: "unrecognized_keys";
|
|
356
|
+
invalid_arguments: "invalid_arguments";
|
|
357
|
+
invalid_return_type: "invalid_return_type";
|
|
358
|
+
invalid_date: "invalid_date";
|
|
359
|
+
invalid_string: "invalid_string";
|
|
360
|
+
too_small: "too_small";
|
|
361
|
+
too_big: "too_big";
|
|
362
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
363
|
+
not_multiple_of: "not_multiple_of";
|
|
364
|
+
not_finite: "not_finite";
|
|
365
|
+
}>;
|
|
366
|
+
}, z.ZodAny, "strip">, z.objectInputType<{
|
|
367
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
368
|
+
message: z.ZodOptional<z.ZodString>;
|
|
369
|
+
code: z.ZodNativeEnum<{
|
|
370
|
+
invalid_type: "invalid_type";
|
|
371
|
+
invalid_literal: "invalid_literal";
|
|
372
|
+
custom: "custom";
|
|
373
|
+
invalid_union: "invalid_union";
|
|
374
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
375
|
+
invalid_enum_value: "invalid_enum_value";
|
|
376
|
+
unrecognized_keys: "unrecognized_keys";
|
|
377
|
+
invalid_arguments: "invalid_arguments";
|
|
378
|
+
invalid_return_type: "invalid_return_type";
|
|
379
|
+
invalid_date: "invalid_date";
|
|
380
|
+
invalid_string: "invalid_string";
|
|
381
|
+
too_small: "too_small";
|
|
382
|
+
too_big: "too_big";
|
|
383
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
384
|
+
not_multiple_of: "not_multiple_of";
|
|
385
|
+
not_finite: "not_finite";
|
|
386
|
+
}>;
|
|
387
|
+
}, z.ZodAny, "strip">>, "many">;
|
|
388
|
+
}, "strip", z.ZodTypeAny, {
|
|
389
|
+
name: "ZodError";
|
|
390
|
+
issues: z.objectOutputType<{
|
|
391
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
392
|
+
message: z.ZodOptional<z.ZodString>;
|
|
393
|
+
code: z.ZodNativeEnum<{
|
|
394
|
+
invalid_type: "invalid_type";
|
|
395
|
+
invalid_literal: "invalid_literal";
|
|
396
|
+
custom: "custom";
|
|
397
|
+
invalid_union: "invalid_union";
|
|
398
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
399
|
+
invalid_enum_value: "invalid_enum_value";
|
|
400
|
+
unrecognized_keys: "unrecognized_keys";
|
|
401
|
+
invalid_arguments: "invalid_arguments";
|
|
402
|
+
invalid_return_type: "invalid_return_type";
|
|
403
|
+
invalid_date: "invalid_date";
|
|
404
|
+
invalid_string: "invalid_string";
|
|
405
|
+
too_small: "too_small";
|
|
406
|
+
too_big: "too_big";
|
|
407
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
408
|
+
not_multiple_of: "not_multiple_of";
|
|
409
|
+
not_finite: "not_finite";
|
|
410
|
+
}>;
|
|
411
|
+
}, z.ZodAny, "strip">[];
|
|
412
|
+
}, {
|
|
413
|
+
name: "ZodError";
|
|
414
|
+
issues: z.objectInputType<{
|
|
415
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
416
|
+
message: z.ZodOptional<z.ZodString>;
|
|
417
|
+
code: z.ZodNativeEnum<{
|
|
418
|
+
invalid_type: "invalid_type";
|
|
419
|
+
invalid_literal: "invalid_literal";
|
|
420
|
+
custom: "custom";
|
|
421
|
+
invalid_union: "invalid_union";
|
|
422
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
423
|
+
invalid_enum_value: "invalid_enum_value";
|
|
424
|
+
unrecognized_keys: "unrecognized_keys";
|
|
425
|
+
invalid_arguments: "invalid_arguments";
|
|
426
|
+
invalid_return_type: "invalid_return_type";
|
|
427
|
+
invalid_date: "invalid_date";
|
|
428
|
+
invalid_string: "invalid_string";
|
|
429
|
+
too_small: "too_small";
|
|
430
|
+
too_big: "too_big";
|
|
431
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
432
|
+
not_multiple_of: "not_multiple_of";
|
|
433
|
+
not_finite: "not_finite";
|
|
434
|
+
}>;
|
|
435
|
+
}, z.ZodAny, "strip">[];
|
|
436
|
+
}>;
|
|
437
|
+
};
|
|
438
|
+
};
|
|
226
439
|
suggest: {
|
|
227
440
|
query: z.ZodObject<{
|
|
228
441
|
q: z.ZodString;
|
package/dist/contract/youtube.js
CHANGED
|
@@ -2,11 +2,12 @@ import { initContract, ZodErrorSchema } from "@ts-rest/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { apiError, apiSuccess, authResponses } from "../types.js";
|
|
4
4
|
import { YOUTUBE_QUERY_MAX_LENGTH } from "../consts.js";
|
|
5
|
-
import { youTubeSearchResultSchema } from "../types/youtube.js";
|
|
5
|
+
import { youTubePlaylistResultSchema, youTubeSearchResultSchema, } from "../types/youtube.js";
|
|
6
6
|
const c = initContract();
|
|
7
7
|
const queryParams = z.object({
|
|
8
8
|
q: z.string().trim().min(1).max(YOUTUBE_QUERY_MAX_LENGTH),
|
|
9
9
|
});
|
|
10
|
+
const tooManySearches = apiError(z.literal("TOO_MANY_SEARCHES"), z.literal("Too many searches are running"));
|
|
10
11
|
export default c.router({
|
|
11
12
|
search: {
|
|
12
13
|
method: "GET",
|
|
@@ -19,7 +20,22 @@ export default c.router({
|
|
|
19
20
|
})),
|
|
20
21
|
400: ZodErrorSchema,
|
|
21
22
|
...authResponses,
|
|
22
|
-
429:
|
|
23
|
+
429: tooManySearches,
|
|
24
|
+
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
searchPlaylists: {
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: "/youtube/search/playlists",
|
|
30
|
+
description: "Search YouTube playlists",
|
|
31
|
+
query: queryParams,
|
|
32
|
+
responses: {
|
|
33
|
+
200: apiSuccess(z.object({
|
|
34
|
+
results: z.array(youTubePlaylistResultSchema),
|
|
35
|
+
})),
|
|
36
|
+
400: ZodErrorSchema,
|
|
37
|
+
...authResponses,
|
|
38
|
+
429: tooManySearches,
|
|
23
39
|
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
24
40
|
},
|
|
25
41
|
},
|
package/dist/types/youtube.d.ts
CHANGED
|
@@ -23,4 +23,21 @@ export declare const youTubeSearchResultSchema: z.ZodObject<{
|
|
|
23
23
|
thumbnail: string | null;
|
|
24
24
|
blocked: "live" | "too_long" | null;
|
|
25
25
|
}>;
|
|
26
|
+
export declare const youTubePlaylistResultSchema: z.ZodObject<{
|
|
27
|
+
playlistId: z.ZodString;
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
channel: z.ZodNullable<z.ZodString>;
|
|
30
|
+
thumbnail: z.ZodNullable<z.ZodString>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
title: string;
|
|
33
|
+
channel: string | null;
|
|
34
|
+
thumbnail: string | null;
|
|
35
|
+
playlistId: string;
|
|
36
|
+
}, {
|
|
37
|
+
title: string;
|
|
38
|
+
channel: string | null;
|
|
39
|
+
thumbnail: string | null;
|
|
40
|
+
playlistId: string;
|
|
41
|
+
}>;
|
|
26
42
|
export type YouTubeSearchResult = z.infer<typeof youTubeSearchResultSchema>;
|
|
43
|
+
export type YouTubePlaylistResult = z.infer<typeof youTubePlaylistResultSchema>;
|
package/dist/types/youtube.js
CHANGED
|
@@ -9,3 +9,9 @@ export const youTubeSearchResultSchema = z.object({
|
|
|
9
9
|
/** Why the video can't be streamed, null if it can */
|
|
10
10
|
blocked: z.enum(["live", "too_long"]).nullable(),
|
|
11
11
|
});
|
|
12
|
+
export const youTubePlaylistResultSchema = z.object({
|
|
13
|
+
playlistId: z.string(),
|
|
14
|
+
title: z.string(),
|
|
15
|
+
channel: z.string().nullable(),
|
|
16
|
+
thumbnail: z.string().url().nullable(),
|
|
17
|
+
});
|