@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
package/dist/contract/room.d.ts
CHANGED
|
@@ -1178,6 +1178,389 @@ declare const _default: {
|
|
|
1178
1178
|
}>]>;
|
|
1179
1179
|
};
|
|
1180
1180
|
};
|
|
1181
|
+
queuePlaylist: {
|
|
1182
|
+
description: "Add a YouTube playlist to the queue of a room, as many tracks as fit. It plays right away if the room has nothing to play. A Mix only exists around a video, it needs videoId";
|
|
1183
|
+
method: "POST";
|
|
1184
|
+
body: z.ZodObject<{
|
|
1185
|
+
playlistId: z.ZodString;
|
|
1186
|
+
videoId: z.ZodOptional<z.ZodString>;
|
|
1187
|
+
}, "strip", z.ZodTypeAny, {
|
|
1188
|
+
playlistId: string;
|
|
1189
|
+
videoId?: string | undefined;
|
|
1190
|
+
}, {
|
|
1191
|
+
playlistId: string;
|
|
1192
|
+
videoId?: string | undefined;
|
|
1193
|
+
}>;
|
|
1194
|
+
path: "/room/:roomId/queue/playlist";
|
|
1195
|
+
responses: {
|
|
1196
|
+
500: z.ZodObject<{
|
|
1197
|
+
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
1198
|
+
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
1199
|
+
name: z.ZodLiteral<"APIError">;
|
|
1200
|
+
}, "strip", z.ZodTypeAny, {
|
|
1201
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
1202
|
+
error: string;
|
|
1203
|
+
name: "APIError";
|
|
1204
|
+
}, {
|
|
1205
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
1206
|
+
error: string;
|
|
1207
|
+
name: "APIError";
|
|
1208
|
+
}>;
|
|
1209
|
+
404: z.ZodUnion<[z.ZodObject<{
|
|
1210
|
+
code: z.ZodType<"ROOM_NOT_FOUND", z.ZodTypeDef, "ROOM_NOT_FOUND">;
|
|
1211
|
+
error: z.ZodType<"The requested room was not found", z.ZodTypeDef, "The requested room was not found">;
|
|
1212
|
+
name: z.ZodLiteral<"APIError">;
|
|
1213
|
+
}, "strip", z.ZodTypeAny, {
|
|
1214
|
+
code: "ROOM_NOT_FOUND";
|
|
1215
|
+
error: "The requested room was not found";
|
|
1216
|
+
name: "APIError";
|
|
1217
|
+
}, {
|
|
1218
|
+
code: "ROOM_NOT_FOUND";
|
|
1219
|
+
error: "The requested room was not found";
|
|
1220
|
+
name: "APIError";
|
|
1221
|
+
}>, z.ZodObject<{
|
|
1222
|
+
code: z.ZodType<"PLAYLIST_UNAVAILABLE", z.ZodTypeDef, "PLAYLIST_UNAVAILABLE">;
|
|
1223
|
+
error: z.ZodType<"This playlist can't be read, it may be private", z.ZodTypeDef, "This playlist can't be read, it may be private">;
|
|
1224
|
+
name: z.ZodLiteral<"APIError">;
|
|
1225
|
+
}, "strip", z.ZodTypeAny, {
|
|
1226
|
+
code: "PLAYLIST_UNAVAILABLE";
|
|
1227
|
+
error: "This playlist can't be read, it may be private";
|
|
1228
|
+
name: "APIError";
|
|
1229
|
+
}, {
|
|
1230
|
+
code: "PLAYLIST_UNAVAILABLE";
|
|
1231
|
+
error: "This playlist can't be read, it may be private";
|
|
1232
|
+
name: "APIError";
|
|
1233
|
+
}>]>;
|
|
1234
|
+
409: z.ZodObject<{
|
|
1235
|
+
code: z.ZodType<"QUEUE_FULL", z.ZodTypeDef, "QUEUE_FULL">;
|
|
1236
|
+
error: z.ZodType<"The queue of this room is full", z.ZodTypeDef, "The queue of this room is full">;
|
|
1237
|
+
name: z.ZodLiteral<"APIError">;
|
|
1238
|
+
}, "strip", z.ZodTypeAny, {
|
|
1239
|
+
code: "QUEUE_FULL";
|
|
1240
|
+
error: "The queue of this room is full";
|
|
1241
|
+
name: "APIError";
|
|
1242
|
+
}, {
|
|
1243
|
+
code: "QUEUE_FULL";
|
|
1244
|
+
error: "The queue of this room is full";
|
|
1245
|
+
name: "APIError";
|
|
1246
|
+
}>;
|
|
1247
|
+
429: z.ZodObject<{
|
|
1248
|
+
code: z.ZodType<"TOO_MANY_SEARCHES", z.ZodTypeDef, "TOO_MANY_SEARCHES">;
|
|
1249
|
+
error: z.ZodType<"Too many searches are running", z.ZodTypeDef, "Too many searches are running">;
|
|
1250
|
+
name: z.ZodLiteral<"APIError">;
|
|
1251
|
+
}, "strip", z.ZodTypeAny, {
|
|
1252
|
+
code: "TOO_MANY_SEARCHES";
|
|
1253
|
+
error: "Too many searches are running";
|
|
1254
|
+
name: "APIError";
|
|
1255
|
+
}, {
|
|
1256
|
+
code: "TOO_MANY_SEARCHES";
|
|
1257
|
+
error: "Too many searches are running";
|
|
1258
|
+
name: "APIError";
|
|
1259
|
+
}>;
|
|
1260
|
+
401: z.ZodObject<{
|
|
1261
|
+
code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
|
|
1262
|
+
error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
|
|
1263
|
+
name: z.ZodLiteral<"APIError">;
|
|
1264
|
+
}, "strip", z.ZodTypeAny, {
|
|
1265
|
+
code: "UNAUTHORIZED";
|
|
1266
|
+
error: "Unauthorized";
|
|
1267
|
+
name: "APIError";
|
|
1268
|
+
}, {
|
|
1269
|
+
code: "UNAUTHORIZED";
|
|
1270
|
+
error: "Unauthorized";
|
|
1271
|
+
name: "APIError";
|
|
1272
|
+
}>;
|
|
1273
|
+
403: z.ZodObject<{
|
|
1274
|
+
code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
|
|
1275
|
+
error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
|
|
1276
|
+
name: z.ZodLiteral<"APIError">;
|
|
1277
|
+
}, "strip", z.ZodTypeAny, {
|
|
1278
|
+
code: "FORBIDDEN";
|
|
1279
|
+
error: "Forbidden";
|
|
1280
|
+
name: "APIError";
|
|
1281
|
+
}, {
|
|
1282
|
+
code: "FORBIDDEN";
|
|
1283
|
+
error: "Forbidden";
|
|
1284
|
+
name: "APIError";
|
|
1285
|
+
}>;
|
|
1286
|
+
200: z.ZodObject<{
|
|
1287
|
+
added: z.ZodNumber;
|
|
1288
|
+
/** Can't be played: live, too long or without a duration */
|
|
1289
|
+
skipped: z.ZodNumber;
|
|
1290
|
+
/** Tracks of the playlist. A Mix has no end: added + skipped, it never looks cut */
|
|
1291
|
+
total: z.ZodNumber;
|
|
1292
|
+
}, "strip", z.ZodTypeAny, {
|
|
1293
|
+
added: number;
|
|
1294
|
+
skipped: number;
|
|
1295
|
+
total: number;
|
|
1296
|
+
}, {
|
|
1297
|
+
added: number;
|
|
1298
|
+
skipped: number;
|
|
1299
|
+
total: number;
|
|
1300
|
+
}>;
|
|
1301
|
+
400: z.ZodUnion<[z.ZodObject<{
|
|
1302
|
+
name: z.ZodLiteral<"ZodError">;
|
|
1303
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
1304
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
1305
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1306
|
+
code: z.ZodNativeEnum<{
|
|
1307
|
+
invalid_type: "invalid_type";
|
|
1308
|
+
invalid_literal: "invalid_literal";
|
|
1309
|
+
custom: "custom";
|
|
1310
|
+
invalid_union: "invalid_union";
|
|
1311
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
1312
|
+
invalid_enum_value: "invalid_enum_value";
|
|
1313
|
+
unrecognized_keys: "unrecognized_keys";
|
|
1314
|
+
invalid_arguments: "invalid_arguments";
|
|
1315
|
+
invalid_return_type: "invalid_return_type";
|
|
1316
|
+
invalid_date: "invalid_date";
|
|
1317
|
+
invalid_string: "invalid_string";
|
|
1318
|
+
too_small: "too_small";
|
|
1319
|
+
too_big: "too_big";
|
|
1320
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
1321
|
+
not_multiple_of: "not_multiple_of";
|
|
1322
|
+
not_finite: "not_finite";
|
|
1323
|
+
}>;
|
|
1324
|
+
}, "strip", z.ZodAny, z.objectOutputType<{
|
|
1325
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
1326
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1327
|
+
code: z.ZodNativeEnum<{
|
|
1328
|
+
invalid_type: "invalid_type";
|
|
1329
|
+
invalid_literal: "invalid_literal";
|
|
1330
|
+
custom: "custom";
|
|
1331
|
+
invalid_union: "invalid_union";
|
|
1332
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
1333
|
+
invalid_enum_value: "invalid_enum_value";
|
|
1334
|
+
unrecognized_keys: "unrecognized_keys";
|
|
1335
|
+
invalid_arguments: "invalid_arguments";
|
|
1336
|
+
invalid_return_type: "invalid_return_type";
|
|
1337
|
+
invalid_date: "invalid_date";
|
|
1338
|
+
invalid_string: "invalid_string";
|
|
1339
|
+
too_small: "too_small";
|
|
1340
|
+
too_big: "too_big";
|
|
1341
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
1342
|
+
not_multiple_of: "not_multiple_of";
|
|
1343
|
+
not_finite: "not_finite";
|
|
1344
|
+
}>;
|
|
1345
|
+
}, z.ZodAny, "strip">, z.objectInputType<{
|
|
1346
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
1347
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1348
|
+
code: z.ZodNativeEnum<{
|
|
1349
|
+
invalid_type: "invalid_type";
|
|
1350
|
+
invalid_literal: "invalid_literal";
|
|
1351
|
+
custom: "custom";
|
|
1352
|
+
invalid_union: "invalid_union";
|
|
1353
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
1354
|
+
invalid_enum_value: "invalid_enum_value";
|
|
1355
|
+
unrecognized_keys: "unrecognized_keys";
|
|
1356
|
+
invalid_arguments: "invalid_arguments";
|
|
1357
|
+
invalid_return_type: "invalid_return_type";
|
|
1358
|
+
invalid_date: "invalid_date";
|
|
1359
|
+
invalid_string: "invalid_string";
|
|
1360
|
+
too_small: "too_small";
|
|
1361
|
+
too_big: "too_big";
|
|
1362
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
1363
|
+
not_multiple_of: "not_multiple_of";
|
|
1364
|
+
not_finite: "not_finite";
|
|
1365
|
+
}>;
|
|
1366
|
+
}, z.ZodAny, "strip">>, "many">;
|
|
1367
|
+
}, "strip", z.ZodTypeAny, {
|
|
1368
|
+
name: "ZodError";
|
|
1369
|
+
issues: z.objectOutputType<{
|
|
1370
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
1371
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1372
|
+
code: z.ZodNativeEnum<{
|
|
1373
|
+
invalid_type: "invalid_type";
|
|
1374
|
+
invalid_literal: "invalid_literal";
|
|
1375
|
+
custom: "custom";
|
|
1376
|
+
invalid_union: "invalid_union";
|
|
1377
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
1378
|
+
invalid_enum_value: "invalid_enum_value";
|
|
1379
|
+
unrecognized_keys: "unrecognized_keys";
|
|
1380
|
+
invalid_arguments: "invalid_arguments";
|
|
1381
|
+
invalid_return_type: "invalid_return_type";
|
|
1382
|
+
invalid_date: "invalid_date";
|
|
1383
|
+
invalid_string: "invalid_string";
|
|
1384
|
+
too_small: "too_small";
|
|
1385
|
+
too_big: "too_big";
|
|
1386
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
1387
|
+
not_multiple_of: "not_multiple_of";
|
|
1388
|
+
not_finite: "not_finite";
|
|
1389
|
+
}>;
|
|
1390
|
+
}, z.ZodAny, "strip">[];
|
|
1391
|
+
}, {
|
|
1392
|
+
name: "ZodError";
|
|
1393
|
+
issues: z.objectInputType<{
|
|
1394
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
1395
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1396
|
+
code: z.ZodNativeEnum<{
|
|
1397
|
+
invalid_type: "invalid_type";
|
|
1398
|
+
invalid_literal: "invalid_literal";
|
|
1399
|
+
custom: "custom";
|
|
1400
|
+
invalid_union: "invalid_union";
|
|
1401
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
1402
|
+
invalid_enum_value: "invalid_enum_value";
|
|
1403
|
+
unrecognized_keys: "unrecognized_keys";
|
|
1404
|
+
invalid_arguments: "invalid_arguments";
|
|
1405
|
+
invalid_return_type: "invalid_return_type";
|
|
1406
|
+
invalid_date: "invalid_date";
|
|
1407
|
+
invalid_string: "invalid_string";
|
|
1408
|
+
too_small: "too_small";
|
|
1409
|
+
too_big: "too_big";
|
|
1410
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
1411
|
+
not_multiple_of: "not_multiple_of";
|
|
1412
|
+
not_finite: "not_finite";
|
|
1413
|
+
}>;
|
|
1414
|
+
}, z.ZodAny, "strip">[];
|
|
1415
|
+
}>, z.ZodObject<{
|
|
1416
|
+
code: z.ZodType<"INVALID_VIDEO_ID", z.ZodTypeDef, "INVALID_VIDEO_ID">;
|
|
1417
|
+
error: z.ZodType<"The provided video ID is invalid", z.ZodTypeDef, "The provided video ID is invalid">;
|
|
1418
|
+
name: z.ZodLiteral<"APIError">;
|
|
1419
|
+
}, "strip", z.ZodTypeAny, {
|
|
1420
|
+
code: "INVALID_VIDEO_ID";
|
|
1421
|
+
error: "The provided video ID is invalid";
|
|
1422
|
+
name: "APIError";
|
|
1423
|
+
}, {
|
|
1424
|
+
code: "INVALID_VIDEO_ID";
|
|
1425
|
+
error: "The provided video ID is invalid";
|
|
1426
|
+
name: "APIError";
|
|
1427
|
+
}>, z.ZodObject<{
|
|
1428
|
+
code: z.ZodType<"INVALID_PLAYLIST_ID", z.ZodTypeDef, "INVALID_PLAYLIST_ID">;
|
|
1429
|
+
error: z.ZodType<"The provided playlist ID is invalid", z.ZodTypeDef, "The provided playlist ID is invalid">;
|
|
1430
|
+
name: z.ZodLiteral<"APIError">;
|
|
1431
|
+
}, "strip", z.ZodTypeAny, {
|
|
1432
|
+
code: "INVALID_PLAYLIST_ID";
|
|
1433
|
+
error: "The provided playlist ID is invalid";
|
|
1434
|
+
name: "APIError";
|
|
1435
|
+
}, {
|
|
1436
|
+
code: "INVALID_PLAYLIST_ID";
|
|
1437
|
+
error: "The provided playlist ID is invalid";
|
|
1438
|
+
name: "APIError";
|
|
1439
|
+
}>]>;
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1442
|
+
queueClear: {
|
|
1443
|
+
description: "Remove every track from the queue of a room";
|
|
1444
|
+
method: "DELETE";
|
|
1445
|
+
body: z.ZodUndefined;
|
|
1446
|
+
path: "/room/:roomId/queue";
|
|
1447
|
+
responses: {
|
|
1448
|
+
500: z.ZodObject<{
|
|
1449
|
+
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
1450
|
+
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
1451
|
+
name: z.ZodLiteral<"APIError">;
|
|
1452
|
+
}, "strip", z.ZodTypeAny, {
|
|
1453
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
1454
|
+
error: string;
|
|
1455
|
+
name: "APIError";
|
|
1456
|
+
}, {
|
|
1457
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
1458
|
+
error: string;
|
|
1459
|
+
name: "APIError";
|
|
1460
|
+
}>;
|
|
1461
|
+
404: z.ZodObject<{
|
|
1462
|
+
code: z.ZodType<"ROOM_NOT_FOUND", z.ZodTypeDef, "ROOM_NOT_FOUND">;
|
|
1463
|
+
error: z.ZodType<"The requested room was not found", z.ZodTypeDef, "The requested room was not found">;
|
|
1464
|
+
name: z.ZodLiteral<"APIError">;
|
|
1465
|
+
}, "strip", z.ZodTypeAny, {
|
|
1466
|
+
code: "ROOM_NOT_FOUND";
|
|
1467
|
+
error: "The requested room was not found";
|
|
1468
|
+
name: "APIError";
|
|
1469
|
+
}, {
|
|
1470
|
+
code: "ROOM_NOT_FOUND";
|
|
1471
|
+
error: "The requested room was not found";
|
|
1472
|
+
name: "APIError";
|
|
1473
|
+
}>;
|
|
1474
|
+
401: z.ZodObject<{
|
|
1475
|
+
code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
|
|
1476
|
+
error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
|
|
1477
|
+
name: z.ZodLiteral<"APIError">;
|
|
1478
|
+
}, "strip", z.ZodTypeAny, {
|
|
1479
|
+
code: "UNAUTHORIZED";
|
|
1480
|
+
error: "Unauthorized";
|
|
1481
|
+
name: "APIError";
|
|
1482
|
+
}, {
|
|
1483
|
+
code: "UNAUTHORIZED";
|
|
1484
|
+
error: "Unauthorized";
|
|
1485
|
+
name: "APIError";
|
|
1486
|
+
}>;
|
|
1487
|
+
403: z.ZodObject<{
|
|
1488
|
+
code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
|
|
1489
|
+
error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
|
|
1490
|
+
name: z.ZodLiteral<"APIError">;
|
|
1491
|
+
}, "strip", z.ZodTypeAny, {
|
|
1492
|
+
code: "FORBIDDEN";
|
|
1493
|
+
error: "Forbidden";
|
|
1494
|
+
name: "APIError";
|
|
1495
|
+
}, {
|
|
1496
|
+
code: "FORBIDDEN";
|
|
1497
|
+
error: "Forbidden";
|
|
1498
|
+
name: "APIError";
|
|
1499
|
+
}>;
|
|
1500
|
+
200: typeof import("@ts-rest/core").ContractNoBody;
|
|
1501
|
+
};
|
|
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
|
+
};
|
|
1181
1564
|
queueRemove: {
|
|
1182
1565
|
description: "Remove a track from the queue of a room";
|
|
1183
1566
|
method: "DELETE";
|
package/dist/contract/room.js
CHANGED
|
@@ -13,6 +13,7 @@ const internalError = {
|
|
|
13
13
|
const noTrack = apiError(z.literal("NO_TRACK"), z.literal("The room has no track"));
|
|
14
14
|
const queueItemNotFound = apiError(z.literal("QUEUE_ITEM_NOT_FOUND"), z.literal("The queue doesn't have this track"));
|
|
15
15
|
const invalidVideoId = apiError(z.literal("INVALID_VIDEO_ID"), z.literal("The provided video ID is invalid"));
|
|
16
|
+
const queueFull = apiError(z.literal("QUEUE_FULL"), z.literal("The queue of this room is full"));
|
|
16
17
|
export default c.router({
|
|
17
18
|
create: {
|
|
18
19
|
method: "POST",
|
|
@@ -107,7 +108,62 @@ export default c.router({
|
|
|
107
108
|
400: z.union([ZodErrorSchema, invalidVideoId]),
|
|
108
109
|
...authResponses,
|
|
109
110
|
...notFound,
|
|
110
|
-
409:
|
|
111
|
+
409: queueFull,
|
|
112
|
+
...internalError,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
queuePlaylist: {
|
|
116
|
+
method: "POST",
|
|
117
|
+
path: "/room/:roomId/queue/playlist",
|
|
118
|
+
description: "Add a YouTube playlist to the queue of a room, as many tracks as fit. It plays right away if the room has nothing to play. A Mix only exists around a video, it needs videoId",
|
|
119
|
+
body: z.object({
|
|
120
|
+
playlistId: z.string(),
|
|
121
|
+
videoId: z.string().optional(),
|
|
122
|
+
}),
|
|
123
|
+
responses: {
|
|
124
|
+
200: apiSuccess(z.object({
|
|
125
|
+
added: z.number(),
|
|
126
|
+
/** Can't be played: live, too long or without a duration */
|
|
127
|
+
skipped: z.number(),
|
|
128
|
+
/** Tracks of the playlist. A Mix has no end: added + skipped, it never looks cut */
|
|
129
|
+
total: z.number(),
|
|
130
|
+
})),
|
|
131
|
+
400: z.union([
|
|
132
|
+
ZodErrorSchema,
|
|
133
|
+
invalidVideoId,
|
|
134
|
+
apiError(z.literal("INVALID_PLAYLIST_ID"), z.literal("The provided playlist ID is invalid")),
|
|
135
|
+
]),
|
|
136
|
+
...authResponses,
|
|
137
|
+
404: z.union([
|
|
138
|
+
notFound[404],
|
|
139
|
+
apiError(z.literal("PLAYLIST_UNAVAILABLE"), z.literal("This playlist can't be read, it may be private")),
|
|
140
|
+
]),
|
|
141
|
+
409: queueFull,
|
|
142
|
+
429: apiError(z.literal("TOO_MANY_SEARCHES"), z.literal("Too many searches are running")),
|
|
143
|
+
...internalError,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
queueClear: {
|
|
147
|
+
method: "DELETE",
|
|
148
|
+
path: "/room/:roomId/queue",
|
|
149
|
+
description: "Remove every track from the queue of a room",
|
|
150
|
+
body: z.undefined(),
|
|
151
|
+
responses: {
|
|
152
|
+
200: c.noBody(),
|
|
153
|
+
...authResponses,
|
|
154
|
+
...notFound,
|
|
155
|
+
...internalError,
|
|
156
|
+
},
|
|
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,
|
|
111
167
|
...internalError,
|
|
112
168
|
},
|
|
113
169
|
},
|