@darco2903/altv-web-api 1.2.0 → 1.4.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.
@@ -164,5 +164,351 @@ declare const _default: {
164
164
  }>;
165
165
  };
166
166
  };
167
+ search: {
168
+ query: z.ZodObject<{
169
+ q: z.ZodString;
170
+ }, "strip", z.ZodTypeAny, {
171
+ q: string;
172
+ }, {
173
+ q: string;
174
+ }>;
175
+ description: "Search YouTube videos";
176
+ method: "GET";
177
+ path: "/youtube/search";
178
+ responses: {
179
+ 200: z.ZodObject<{
180
+ results: z.ZodArray<z.ZodObject<{
181
+ videoId: z.ZodString;
182
+ title: z.ZodString;
183
+ channel: z.ZodNullable<z.ZodString>;
184
+ duration: z.ZodNullable<z.ZodNumber>;
185
+ thumbnail: z.ZodNullable<z.ZodString>;
186
+ blocked: z.ZodNullable<z.ZodEnum<["live", "too_long"]>>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ videoId: string;
189
+ title: string;
190
+ duration: number | null;
191
+ channel: string | null;
192
+ thumbnail: string | null;
193
+ blocked: "live" | "too_long" | null;
194
+ }, {
195
+ videoId: string;
196
+ title: string;
197
+ duration: number | null;
198
+ channel: string | null;
199
+ thumbnail: string | null;
200
+ blocked: "live" | "too_long" | null;
201
+ }>, "many">;
202
+ }, "strip", z.ZodTypeAny, {
203
+ results: {
204
+ videoId: string;
205
+ title: string;
206
+ duration: number | null;
207
+ channel: string | null;
208
+ thumbnail: string | null;
209
+ blocked: "live" | "too_long" | null;
210
+ }[];
211
+ }, {
212
+ results: {
213
+ videoId: string;
214
+ title: string;
215
+ duration: number | null;
216
+ channel: string | null;
217
+ thumbnail: string | null;
218
+ blocked: "live" | "too_long" | null;
219
+ }[];
220
+ }>;
221
+ 400: z.ZodObject<{
222
+ name: z.ZodLiteral<"ZodError">;
223
+ issues: z.ZodArray<z.ZodObject<{
224
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
225
+ message: z.ZodOptional<z.ZodString>;
226
+ code: z.ZodNativeEnum<{
227
+ invalid_type: "invalid_type";
228
+ invalid_literal: "invalid_literal";
229
+ custom: "custom";
230
+ invalid_union: "invalid_union";
231
+ invalid_union_discriminator: "invalid_union_discriminator";
232
+ invalid_enum_value: "invalid_enum_value";
233
+ unrecognized_keys: "unrecognized_keys";
234
+ invalid_arguments: "invalid_arguments";
235
+ invalid_return_type: "invalid_return_type";
236
+ invalid_date: "invalid_date";
237
+ invalid_string: "invalid_string";
238
+ too_small: "too_small";
239
+ too_big: "too_big";
240
+ invalid_intersection_types: "invalid_intersection_types";
241
+ not_multiple_of: "not_multiple_of";
242
+ not_finite: "not_finite";
243
+ }>;
244
+ }, "strip", z.ZodAny, z.objectOutputType<{
245
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
246
+ message: z.ZodOptional<z.ZodString>;
247
+ code: z.ZodNativeEnum<{
248
+ invalid_type: "invalid_type";
249
+ invalid_literal: "invalid_literal";
250
+ custom: "custom";
251
+ invalid_union: "invalid_union";
252
+ invalid_union_discriminator: "invalid_union_discriminator";
253
+ invalid_enum_value: "invalid_enum_value";
254
+ unrecognized_keys: "unrecognized_keys";
255
+ invalid_arguments: "invalid_arguments";
256
+ invalid_return_type: "invalid_return_type";
257
+ invalid_date: "invalid_date";
258
+ invalid_string: "invalid_string";
259
+ too_small: "too_small";
260
+ too_big: "too_big";
261
+ invalid_intersection_types: "invalid_intersection_types";
262
+ not_multiple_of: "not_multiple_of";
263
+ not_finite: "not_finite";
264
+ }>;
265
+ }, z.ZodAny, "strip">, z.objectInputType<{
266
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
267
+ message: z.ZodOptional<z.ZodString>;
268
+ code: z.ZodNativeEnum<{
269
+ invalid_type: "invalid_type";
270
+ invalid_literal: "invalid_literal";
271
+ custom: "custom";
272
+ invalid_union: "invalid_union";
273
+ invalid_union_discriminator: "invalid_union_discriminator";
274
+ invalid_enum_value: "invalid_enum_value";
275
+ unrecognized_keys: "unrecognized_keys";
276
+ invalid_arguments: "invalid_arguments";
277
+ invalid_return_type: "invalid_return_type";
278
+ invalid_date: "invalid_date";
279
+ invalid_string: "invalid_string";
280
+ too_small: "too_small";
281
+ too_big: "too_big";
282
+ invalid_intersection_types: "invalid_intersection_types";
283
+ not_multiple_of: "not_multiple_of";
284
+ not_finite: "not_finite";
285
+ }>;
286
+ }, z.ZodAny, "strip">>, "many">;
287
+ }, "strip", z.ZodTypeAny, {
288
+ name: "ZodError";
289
+ issues: z.objectOutputType<{
290
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
291
+ message: z.ZodOptional<z.ZodString>;
292
+ code: z.ZodNativeEnum<{
293
+ invalid_type: "invalid_type";
294
+ invalid_literal: "invalid_literal";
295
+ custom: "custom";
296
+ invalid_union: "invalid_union";
297
+ invalid_union_discriminator: "invalid_union_discriminator";
298
+ invalid_enum_value: "invalid_enum_value";
299
+ unrecognized_keys: "unrecognized_keys";
300
+ invalid_arguments: "invalid_arguments";
301
+ invalid_return_type: "invalid_return_type";
302
+ invalid_date: "invalid_date";
303
+ invalid_string: "invalid_string";
304
+ too_small: "too_small";
305
+ too_big: "too_big";
306
+ invalid_intersection_types: "invalid_intersection_types";
307
+ not_multiple_of: "not_multiple_of";
308
+ not_finite: "not_finite";
309
+ }>;
310
+ }, z.ZodAny, "strip">[];
311
+ }, {
312
+ name: "ZodError";
313
+ issues: z.objectInputType<{
314
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
315
+ message: z.ZodOptional<z.ZodString>;
316
+ code: z.ZodNativeEnum<{
317
+ invalid_type: "invalid_type";
318
+ invalid_literal: "invalid_literal";
319
+ custom: "custom";
320
+ invalid_union: "invalid_union";
321
+ invalid_union_discriminator: "invalid_union_discriminator";
322
+ invalid_enum_value: "invalid_enum_value";
323
+ unrecognized_keys: "unrecognized_keys";
324
+ invalid_arguments: "invalid_arguments";
325
+ invalid_return_type: "invalid_return_type";
326
+ invalid_date: "invalid_date";
327
+ invalid_string: "invalid_string";
328
+ too_small: "too_small";
329
+ too_big: "too_big";
330
+ invalid_intersection_types: "invalid_intersection_types";
331
+ not_multiple_of: "not_multiple_of";
332
+ not_finite: "not_finite";
333
+ }>;
334
+ }, z.ZodAny, "strip">[];
335
+ }>;
336
+ 429: z.ZodObject<{
337
+ code: z.ZodType<"TOO_MANY_SEARCHES", z.ZodTypeDef, "TOO_MANY_SEARCHES">;
338
+ error: z.ZodType<"Too many searches are running", z.ZodTypeDef, "Too many searches are running">;
339
+ name: z.ZodLiteral<"APIError">;
340
+ }, "strip", z.ZodTypeAny, {
341
+ code: "TOO_MANY_SEARCHES";
342
+ error: "Too many searches are running";
343
+ name: "APIError";
344
+ }, {
345
+ code: "TOO_MANY_SEARCHES";
346
+ error: "Too many searches are running";
347
+ name: "APIError";
348
+ }>;
349
+ 500: z.ZodObject<{
350
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
351
+ error: z.ZodType<string, z.ZodTypeDef, string>;
352
+ name: z.ZodLiteral<"APIError">;
353
+ }, "strip", z.ZodTypeAny, {
354
+ code: "INTERNAL_SERVER_ERROR";
355
+ error: string;
356
+ name: "APIError";
357
+ }, {
358
+ code: "INTERNAL_SERVER_ERROR";
359
+ error: string;
360
+ name: "APIError";
361
+ }>;
362
+ };
363
+ };
364
+ suggest: {
365
+ query: z.ZodObject<{
366
+ q: z.ZodString;
367
+ }, "strip", z.ZodTypeAny, {
368
+ q: string;
369
+ }, {
370
+ q: string;
371
+ }>;
372
+ description: "Get YouTube search suggestions for a partial query";
373
+ method: "GET";
374
+ path: "/youtube/suggest";
375
+ responses: {
376
+ 200: z.ZodObject<{
377
+ suggestions: z.ZodArray<z.ZodString, "many">;
378
+ }, "strip", z.ZodTypeAny, {
379
+ suggestions: string[];
380
+ }, {
381
+ suggestions: string[];
382
+ }>;
383
+ 400: z.ZodObject<{
384
+ name: z.ZodLiteral<"ZodError">;
385
+ issues: z.ZodArray<z.ZodObject<{
386
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
387
+ message: z.ZodOptional<z.ZodString>;
388
+ code: z.ZodNativeEnum<{
389
+ invalid_type: "invalid_type";
390
+ invalid_literal: "invalid_literal";
391
+ custom: "custom";
392
+ invalid_union: "invalid_union";
393
+ invalid_union_discriminator: "invalid_union_discriminator";
394
+ invalid_enum_value: "invalid_enum_value";
395
+ unrecognized_keys: "unrecognized_keys";
396
+ invalid_arguments: "invalid_arguments";
397
+ invalid_return_type: "invalid_return_type";
398
+ invalid_date: "invalid_date";
399
+ invalid_string: "invalid_string";
400
+ too_small: "too_small";
401
+ too_big: "too_big";
402
+ invalid_intersection_types: "invalid_intersection_types";
403
+ not_multiple_of: "not_multiple_of";
404
+ not_finite: "not_finite";
405
+ }>;
406
+ }, "strip", z.ZodAny, z.objectOutputType<{
407
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
408
+ message: z.ZodOptional<z.ZodString>;
409
+ code: z.ZodNativeEnum<{
410
+ invalid_type: "invalid_type";
411
+ invalid_literal: "invalid_literal";
412
+ custom: "custom";
413
+ invalid_union: "invalid_union";
414
+ invalid_union_discriminator: "invalid_union_discriminator";
415
+ invalid_enum_value: "invalid_enum_value";
416
+ unrecognized_keys: "unrecognized_keys";
417
+ invalid_arguments: "invalid_arguments";
418
+ invalid_return_type: "invalid_return_type";
419
+ invalid_date: "invalid_date";
420
+ invalid_string: "invalid_string";
421
+ too_small: "too_small";
422
+ too_big: "too_big";
423
+ invalid_intersection_types: "invalid_intersection_types";
424
+ not_multiple_of: "not_multiple_of";
425
+ not_finite: "not_finite";
426
+ }>;
427
+ }, z.ZodAny, "strip">, z.objectInputType<{
428
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
429
+ message: z.ZodOptional<z.ZodString>;
430
+ code: z.ZodNativeEnum<{
431
+ invalid_type: "invalid_type";
432
+ invalid_literal: "invalid_literal";
433
+ custom: "custom";
434
+ invalid_union: "invalid_union";
435
+ invalid_union_discriminator: "invalid_union_discriminator";
436
+ invalid_enum_value: "invalid_enum_value";
437
+ unrecognized_keys: "unrecognized_keys";
438
+ invalid_arguments: "invalid_arguments";
439
+ invalid_return_type: "invalid_return_type";
440
+ invalid_date: "invalid_date";
441
+ invalid_string: "invalid_string";
442
+ too_small: "too_small";
443
+ too_big: "too_big";
444
+ invalid_intersection_types: "invalid_intersection_types";
445
+ not_multiple_of: "not_multiple_of";
446
+ not_finite: "not_finite";
447
+ }>;
448
+ }, z.ZodAny, "strip">>, "many">;
449
+ }, "strip", z.ZodTypeAny, {
450
+ name: "ZodError";
451
+ issues: z.objectOutputType<{
452
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
453
+ message: z.ZodOptional<z.ZodString>;
454
+ code: z.ZodNativeEnum<{
455
+ invalid_type: "invalid_type";
456
+ invalid_literal: "invalid_literal";
457
+ custom: "custom";
458
+ invalid_union: "invalid_union";
459
+ invalid_union_discriminator: "invalid_union_discriminator";
460
+ invalid_enum_value: "invalid_enum_value";
461
+ unrecognized_keys: "unrecognized_keys";
462
+ invalid_arguments: "invalid_arguments";
463
+ invalid_return_type: "invalid_return_type";
464
+ invalid_date: "invalid_date";
465
+ invalid_string: "invalid_string";
466
+ too_small: "too_small";
467
+ too_big: "too_big";
468
+ invalid_intersection_types: "invalid_intersection_types";
469
+ not_multiple_of: "not_multiple_of";
470
+ not_finite: "not_finite";
471
+ }>;
472
+ }, z.ZodAny, "strip">[];
473
+ }, {
474
+ name: "ZodError";
475
+ issues: z.objectInputType<{
476
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
477
+ message: z.ZodOptional<z.ZodString>;
478
+ code: z.ZodNativeEnum<{
479
+ invalid_type: "invalid_type";
480
+ invalid_literal: "invalid_literal";
481
+ custom: "custom";
482
+ invalid_union: "invalid_union";
483
+ invalid_union_discriminator: "invalid_union_discriminator";
484
+ invalid_enum_value: "invalid_enum_value";
485
+ unrecognized_keys: "unrecognized_keys";
486
+ invalid_arguments: "invalid_arguments";
487
+ invalid_return_type: "invalid_return_type";
488
+ invalid_date: "invalid_date";
489
+ invalid_string: "invalid_string";
490
+ too_small: "too_small";
491
+ too_big: "too_big";
492
+ invalid_intersection_types: "invalid_intersection_types";
493
+ not_multiple_of: "not_multiple_of";
494
+ not_finite: "not_finite";
495
+ }>;
496
+ }, z.ZodAny, "strip">[];
497
+ }>;
498
+ 500: z.ZodObject<{
499
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
500
+ error: z.ZodType<string, z.ZodTypeDef, string>;
501
+ name: z.ZodLiteral<"APIError">;
502
+ }, "strip", z.ZodTypeAny, {
503
+ code: "INTERNAL_SERVER_ERROR";
504
+ error: string;
505
+ name: "APIError";
506
+ }, {
507
+ code: "INTERNAL_SERVER_ERROR";
508
+ error: string;
509
+ name: "APIError";
510
+ }>;
511
+ };
512
+ };
167
513
  };
168
514
  export default _default;
@@ -1,8 +1,12 @@
1
1
  import { initContract, ZodErrorSchema } from "@ts-rest/core";
2
2
  import { z } from "zod";
3
3
  import { apiError, apiSuccess } from "../types.js";
4
- import { youTubeFilterSchema, youTubeQualitySchema } from "../types/youtube.js";
4
+ import { YOUTUBE_QUERY_MAX_LENGTH } from "../consts.js";
5
+ import { youTubeFilterSchema, youTubeQualitySchema, youTubeSearchResultSchema, } from "../types/youtube.js";
5
6
  const c = initContract();
7
+ const queryParams = z.object({
8
+ q: z.string().trim().min(1).max(YOUTUBE_QUERY_MAX_LENGTH),
9
+ });
6
10
  export default c.router({
7
11
  getLink: {
8
12
  method: "GET",
@@ -24,4 +28,31 @@ export default c.router({
24
28
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
25
29
  },
26
30
  },
31
+ search: {
32
+ method: "GET",
33
+ path: "/youtube/search",
34
+ description: "Search YouTube videos",
35
+ query: queryParams,
36
+ responses: {
37
+ 200: apiSuccess(z.object({
38
+ results: z.array(youTubeSearchResultSchema),
39
+ })),
40
+ 400: ZodErrorSchema,
41
+ 429: apiError(z.literal("TOO_MANY_SEARCHES"), z.literal("Too many searches are running")),
42
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
43
+ },
44
+ },
45
+ suggest: {
46
+ method: "GET",
47
+ path: "/youtube/suggest",
48
+ description: "Get YouTube search suggestions for a partial query",
49
+ query: queryParams,
50
+ responses: {
51
+ 200: apiSuccess(z.object({
52
+ suggestions: z.array(z.string()),
53
+ })),
54
+ 400: ZodErrorSchema,
55
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
56
+ },
57
+ },
27
58
  });
@@ -1,3 +1,4 @@
1
+ import type { MediaStreamScene } from "../types/scene.js";
1
2
  export interface SocketClientToServerMediaStream {
2
3
  mediaStreamListen: (streamId: string, callback: (success: boolean) => void) => void;
3
4
  mediaStreamUnlisten: (streamId: string, callback: (success: boolean) => void) => void;
@@ -15,4 +16,6 @@ export interface SocketServerToClientMediaStream {
15
16
  mediaStreamSeek: (streamId: string, startTime: number) => void;
16
17
  /** The stream is gone, every request about it now returns 404 */
17
18
  mediaStreamEnd: (streamId: string, reason: MediaStreamEndReason) => void;
19
+ /** The scene changed, the whole new scene */
20
+ mediaStreamScene: (streamId: string, scene: MediaStreamScene) => void;
18
21
  }
@@ -1 +1,2 @@
1
1
  export * from "./youtube.js";
2
+ export * from "./scene.js";
@@ -1 +1,2 @@
1
1
  export * from "./youtube.js";
2
+ export * from "./scene.js";