@darco2903/altv-web-api 2.2.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 CHANGED
@@ -89,6 +89,90 @@ export declare function createClient(origin: string): {
89
89
  body: unknown;
90
90
  headers: Headers;
91
91
  }>;
92
+ searchPlaylists: (args: {
93
+ query: {
94
+ q: string;
95
+ };
96
+ cache?: RequestCache | undefined;
97
+ extraHeaders?: Record<string, string | undefined> | undefined;
98
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
99
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
100
+ }) => Promise<{
101
+ status: 500;
102
+ body: {
103
+ code: "INTERNAL_SERVER_ERROR";
104
+ error: string;
105
+ name: "APIError";
106
+ };
107
+ headers: Headers;
108
+ } | {
109
+ status: 401;
110
+ body: {
111
+ code: "UNAUTHORIZED";
112
+ error: "Unauthorized";
113
+ name: "APIError";
114
+ };
115
+ headers: Headers;
116
+ } | {
117
+ status: 403;
118
+ body: {
119
+ code: "FORBIDDEN";
120
+ error: "Forbidden";
121
+ name: "APIError";
122
+ };
123
+ headers: Headers;
124
+ } | {
125
+ status: 200;
126
+ body: {
127
+ results: {
128
+ title: string;
129
+ channel: string | null;
130
+ thumbnail: string | null;
131
+ playlistId: string;
132
+ }[];
133
+ };
134
+ headers: Headers;
135
+ } | {
136
+ status: 400;
137
+ body: {
138
+ name: "ZodError";
139
+ issues: import("zod").objectOutputType<{
140
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
141
+ message: import("zod").ZodOptional<import("zod").ZodString>;
142
+ code: import("zod").ZodNativeEnum<{
143
+ invalid_type: "invalid_type";
144
+ invalid_literal: "invalid_literal";
145
+ custom: "custom";
146
+ invalid_union: "invalid_union";
147
+ invalid_union_discriminator: "invalid_union_discriminator";
148
+ invalid_enum_value: "invalid_enum_value";
149
+ unrecognized_keys: "unrecognized_keys";
150
+ invalid_arguments: "invalid_arguments";
151
+ invalid_return_type: "invalid_return_type";
152
+ invalid_date: "invalid_date";
153
+ invalid_string: "invalid_string";
154
+ too_small: "too_small";
155
+ too_big: "too_big";
156
+ invalid_intersection_types: "invalid_intersection_types";
157
+ not_multiple_of: "not_multiple_of";
158
+ not_finite: "not_finite";
159
+ }>;
160
+ }, import("zod").ZodAny, "strip">[];
161
+ };
162
+ headers: Headers;
163
+ } | {
164
+ status: 429;
165
+ body: {
166
+ code: "TOO_MANY_SEARCHES";
167
+ error: "Too many searches are running";
168
+ name: "APIError";
169
+ };
170
+ headers: Headers;
171
+ } | {
172
+ status: 404 | 100 | 409 | 101 | 102 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
173
+ body: unknown;
174
+ headers: Headers;
175
+ }>;
92
176
  suggest: (args: {
93
177
  query: {
94
178
  q: string;
@@ -985,6 +1069,55 @@ export declare function createClient(origin: string): {
985
1069
  body: unknown;
986
1070
  headers: Headers;
987
1071
  }>;
1072
+ queueShuffle: (args: {
1073
+ params: {
1074
+ roomId: string;
1075
+ };
1076
+ cache?: RequestCache | undefined;
1077
+ extraHeaders?: Record<string, string | undefined> | undefined;
1078
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
1079
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
1080
+ }) => Promise<{
1081
+ status: 500;
1082
+ body: {
1083
+ code: "INTERNAL_SERVER_ERROR";
1084
+ error: string;
1085
+ name: "APIError";
1086
+ };
1087
+ headers: Headers;
1088
+ } | {
1089
+ status: 401;
1090
+ body: {
1091
+ code: "UNAUTHORIZED";
1092
+ error: "Unauthorized";
1093
+ name: "APIError";
1094
+ };
1095
+ headers: Headers;
1096
+ } | {
1097
+ status: 403;
1098
+ body: {
1099
+ code: "FORBIDDEN";
1100
+ error: "Forbidden";
1101
+ name: "APIError";
1102
+ };
1103
+ headers: Headers;
1104
+ } | {
1105
+ status: 200;
1106
+ body: undefined;
1107
+ headers: Headers;
1108
+ } | {
1109
+ status: 404;
1110
+ body: {
1111
+ code: "ROOM_NOT_FOUND";
1112
+ error: "The requested room was not found";
1113
+ name: "APIError";
1114
+ };
1115
+ headers: Headers;
1116
+ } | {
1117
+ status: 400 | 100 | 409 | 429 | 101 | 102 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
1118
+ body: unknown;
1119
+ headers: Headers;
1120
+ }>;
988
1121
  queueRemove: (args: {
989
1122
  params: {
990
1123
  roomId: string;
@@ -223,6 +223,219 @@ declare const _default: {
223
223
  }>;
224
224
  };
225
225
  };
226
+ searchPlaylists: {
227
+ query: import("zod").ZodObject<{
228
+ q: import("zod").ZodString;
229
+ }, "strip", import("zod").ZodTypeAny, {
230
+ q: string;
231
+ }, {
232
+ q: string;
233
+ }>;
234
+ description: "Search YouTube playlists";
235
+ method: "GET";
236
+ path: "/api/v2/youtube/search/playlists";
237
+ responses: {
238
+ 429: import("zod").ZodObject<{
239
+ code: import("zod").ZodType<"TOO_MANY_SEARCHES", import("zod").ZodTypeDef, "TOO_MANY_SEARCHES">;
240
+ error: import("zod").ZodType<"Too many searches are running", import("zod").ZodTypeDef, "Too many searches are running">;
241
+ name: import("zod").ZodLiteral<"APIError">;
242
+ }, "strip", import("zod").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: import("zod").ZodObject<{
252
+ code: import("zod").ZodType<"INTERNAL_SERVER_ERROR", import("zod").ZodTypeDef, "INTERNAL_SERVER_ERROR">;
253
+ error: import("zod").ZodType<string, import("zod").ZodTypeDef, string>;
254
+ name: import("zod").ZodLiteral<"APIError">;
255
+ }, "strip", import("zod").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: import("zod").ZodObject<{
265
+ code: import("zod").ZodType<"UNAUTHORIZED", import("zod").ZodTypeDef, "UNAUTHORIZED">;
266
+ error: import("zod").ZodType<"Unauthorized", import("zod").ZodTypeDef, "Unauthorized">;
267
+ name: import("zod").ZodLiteral<"APIError">;
268
+ }, "strip", import("zod").ZodTypeAny, {
269
+ code: "UNAUTHORIZED";
270
+ error: "Unauthorized";
271
+ name: "APIError";
272
+ }, {
273
+ code: "UNAUTHORIZED";
274
+ error: "Unauthorized";
275
+ name: "APIError";
276
+ }>;
277
+ 403: import("zod").ZodObject<{
278
+ code: import("zod").ZodType<"FORBIDDEN", import("zod").ZodTypeDef, "FORBIDDEN">;
279
+ error: import("zod").ZodType<"Forbidden", import("zod").ZodTypeDef, "Forbidden">;
280
+ name: import("zod").ZodLiteral<"APIError">;
281
+ }, "strip", import("zod").ZodTypeAny, {
282
+ code: "FORBIDDEN";
283
+ error: "Forbidden";
284
+ name: "APIError";
285
+ }, {
286
+ code: "FORBIDDEN";
287
+ error: "Forbidden";
288
+ name: "APIError";
289
+ }>;
290
+ 200: import("zod").ZodObject<{
291
+ results: import("zod").ZodArray<import("zod").ZodObject<{
292
+ playlistId: import("zod").ZodString;
293
+ title: import("zod").ZodString;
294
+ channel: import("zod").ZodNullable<import("zod").ZodString>;
295
+ thumbnail: import("zod").ZodNullable<import("zod").ZodString>;
296
+ }, "strip", import("zod").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", import("zod").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: import("zod").ZodObject<{
323
+ name: import("zod").ZodLiteral<"ZodError">;
324
+ issues: import("zod").ZodArray<import("zod").ZodObject<{
325
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
326
+ message: import("zod").ZodOptional<import("zod").ZodString>;
327
+ code: import("zod").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", import("zod").ZodAny, import("zod").objectOutputType<{
346
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
347
+ message: import("zod").ZodOptional<import("zod").ZodString>;
348
+ code: import("zod").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
+ }, import("zod").ZodAny, "strip">, import("zod").objectInputType<{
367
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
368
+ message: import("zod").ZodOptional<import("zod").ZodString>;
369
+ code: import("zod").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
+ }, import("zod").ZodAny, "strip">>, "many">;
388
+ }, "strip", import("zod").ZodTypeAny, {
389
+ name: "ZodError";
390
+ issues: import("zod").objectOutputType<{
391
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
392
+ message: import("zod").ZodOptional<import("zod").ZodString>;
393
+ code: import("zod").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
+ }, import("zod").ZodAny, "strip">[];
412
+ }, {
413
+ name: "ZodError";
414
+ issues: import("zod").objectInputType<{
415
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
416
+ message: import("zod").ZodOptional<import("zod").ZodString>;
417
+ code: import("zod").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
+ }, import("zod").ZodAny, "strip">[];
436
+ }>;
437
+ };
438
+ };
226
439
  suggest: {
227
440
  query: import("zod").ZodObject<{
228
441
  q: import("zod").ZodString;
@@ -2190,6 +2403,67 @@ declare const _default: {
2190
2403
  200: typeof import("@ts-rest/core").ContractNoBody;
2191
2404
  };
2192
2405
  };
2406
+ queueShuffle: {
2407
+ description: "Put the queue of a room in a new random order, listeners get it through the roomQueue socket event";
2408
+ method: "POST";
2409
+ body: import("zod").ZodUndefined;
2410
+ path: "/api/v2/room/:roomId/queue/shuffle";
2411
+ responses: {
2412
+ 500: import("zod").ZodObject<{
2413
+ code: import("zod").ZodType<"INTERNAL_SERVER_ERROR", import("zod").ZodTypeDef, "INTERNAL_SERVER_ERROR">;
2414
+ error: import("zod").ZodType<string, import("zod").ZodTypeDef, string>;
2415
+ name: import("zod").ZodLiteral<"APIError">;
2416
+ }, "strip", import("zod").ZodTypeAny, {
2417
+ code: "INTERNAL_SERVER_ERROR";
2418
+ error: string;
2419
+ name: "APIError";
2420
+ }, {
2421
+ code: "INTERNAL_SERVER_ERROR";
2422
+ error: string;
2423
+ name: "APIError";
2424
+ }>;
2425
+ 404: import("zod").ZodObject<{
2426
+ code: import("zod").ZodType<"ROOM_NOT_FOUND", import("zod").ZodTypeDef, "ROOM_NOT_FOUND">;
2427
+ error: import("zod").ZodType<"The requested room was not found", import("zod").ZodTypeDef, "The requested room was not found">;
2428
+ name: import("zod").ZodLiteral<"APIError">;
2429
+ }, "strip", import("zod").ZodTypeAny, {
2430
+ code: "ROOM_NOT_FOUND";
2431
+ error: "The requested room was not found";
2432
+ name: "APIError";
2433
+ }, {
2434
+ code: "ROOM_NOT_FOUND";
2435
+ error: "The requested room was not found";
2436
+ name: "APIError";
2437
+ }>;
2438
+ 401: import("zod").ZodObject<{
2439
+ code: import("zod").ZodType<"UNAUTHORIZED", import("zod").ZodTypeDef, "UNAUTHORIZED">;
2440
+ error: import("zod").ZodType<"Unauthorized", import("zod").ZodTypeDef, "Unauthorized">;
2441
+ name: import("zod").ZodLiteral<"APIError">;
2442
+ }, "strip", import("zod").ZodTypeAny, {
2443
+ code: "UNAUTHORIZED";
2444
+ error: "Unauthorized";
2445
+ name: "APIError";
2446
+ }, {
2447
+ code: "UNAUTHORIZED";
2448
+ error: "Unauthorized";
2449
+ name: "APIError";
2450
+ }>;
2451
+ 403: import("zod").ZodObject<{
2452
+ code: import("zod").ZodType<"FORBIDDEN", import("zod").ZodTypeDef, "FORBIDDEN">;
2453
+ error: import("zod").ZodType<"Forbidden", import("zod").ZodTypeDef, "Forbidden">;
2454
+ name: import("zod").ZodLiteral<"APIError">;
2455
+ }, "strip", import("zod").ZodTypeAny, {
2456
+ code: "FORBIDDEN";
2457
+ error: "Forbidden";
2458
+ name: "APIError";
2459
+ }, {
2460
+ code: "FORBIDDEN";
2461
+ error: "Forbidden";
2462
+ name: "APIError";
2463
+ }>;
2464
+ 200: typeof import("@ts-rest/core").ContractNoBody;
2465
+ };
2466
+ };
2193
2467
  queueRemove: {
2194
2468
  description: "Remove a track from the queue of a room";
2195
2469
  method: "DELETE";
@@ -1500,6 +1500,67 @@ declare const _default: {
1500
1500
  200: typeof import("@ts-rest/core").ContractNoBody;
1501
1501
  };
1502
1502
  };
1503
+ queueShuffle: {
1504
+ description: "Put the queue of a room in a new random order, listeners get it through the roomQueue socket event";
1505
+ method: "POST";
1506
+ body: z.ZodUndefined;
1507
+ path: "/room/:roomId/queue/shuffle";
1508
+ responses: {
1509
+ 500: z.ZodObject<{
1510
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
1511
+ error: z.ZodType<string, z.ZodTypeDef, string>;
1512
+ name: z.ZodLiteral<"APIError">;
1513
+ }, "strip", z.ZodTypeAny, {
1514
+ code: "INTERNAL_SERVER_ERROR";
1515
+ error: string;
1516
+ name: "APIError";
1517
+ }, {
1518
+ code: "INTERNAL_SERVER_ERROR";
1519
+ error: string;
1520
+ name: "APIError";
1521
+ }>;
1522
+ 404: z.ZodObject<{
1523
+ code: z.ZodType<"ROOM_NOT_FOUND", z.ZodTypeDef, "ROOM_NOT_FOUND">;
1524
+ error: z.ZodType<"The requested room was not found", z.ZodTypeDef, "The requested room was not found">;
1525
+ name: z.ZodLiteral<"APIError">;
1526
+ }, "strip", z.ZodTypeAny, {
1527
+ code: "ROOM_NOT_FOUND";
1528
+ error: "The requested room was not found";
1529
+ name: "APIError";
1530
+ }, {
1531
+ code: "ROOM_NOT_FOUND";
1532
+ error: "The requested room was not found";
1533
+ name: "APIError";
1534
+ }>;
1535
+ 401: z.ZodObject<{
1536
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
1537
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
1538
+ name: z.ZodLiteral<"APIError">;
1539
+ }, "strip", z.ZodTypeAny, {
1540
+ code: "UNAUTHORIZED";
1541
+ error: "Unauthorized";
1542
+ name: "APIError";
1543
+ }, {
1544
+ code: "UNAUTHORIZED";
1545
+ error: "Unauthorized";
1546
+ name: "APIError";
1547
+ }>;
1548
+ 403: z.ZodObject<{
1549
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
1550
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
1551
+ name: z.ZodLiteral<"APIError">;
1552
+ }, "strip", z.ZodTypeAny, {
1553
+ code: "FORBIDDEN";
1554
+ error: "Forbidden";
1555
+ name: "APIError";
1556
+ }, {
1557
+ code: "FORBIDDEN";
1558
+ error: "Forbidden";
1559
+ name: "APIError";
1560
+ }>;
1561
+ 200: typeof import("@ts-rest/core").ContractNoBody;
1562
+ };
1563
+ };
1503
1564
  queueRemove: {
1504
1565
  description: "Remove a track from the queue of a room";
1505
1566
  method: "DELETE";
@@ -155,6 +155,18 @@ export default c.router({
155
155
  ...internalError,
156
156
  },
157
157
  },
158
+ queueShuffle: {
159
+ method: "POST",
160
+ path: "/room/:roomId/queue/shuffle",
161
+ description: "Put the queue of a room in a new random order, listeners get it through the roomQueue socket event",
162
+ body: z.undefined(),
163
+ responses: {
164
+ 200: c.noBody(),
165
+ ...authResponses,
166
+ ...notFound,
167
+ ...internalError,
168
+ },
169
+ },
158
170
  queueRemove: {
159
171
  method: "DELETE",
160
172
  path: "/room/:roomId/queue/:itemId",
@@ -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;
@@ -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: apiError(z.literal("TOO_MANY_SEARCHES"), z.literal("Too many searches are running")),
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
  },
@@ -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>;
@@ -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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darco2903/altv-web-api",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "keywords": [],