@darco2903/altv-web-api 1.4.0 → 1.6.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.
@@ -1,9 +1,11 @@
1
1
  import { initContract } from "@ts-rest/core";
2
+ import history from "./history.js";
2
3
  import mediaStream from "./mediaStream.js";
3
4
  import sync from "./sync.js";
4
5
  import youtube from "./youtube.js";
5
6
  const c = initContract();
6
7
  export default c.router({
8
+ history,
7
9
  mediaStream,
8
10
  ...sync,
9
11
  youtube,
@@ -12,6 +12,45 @@ declare const _default: {
12
12
  }>;
13
13
  path: "/media-stream/init";
14
14
  responses: {
15
+ 500: z.ZodObject<{
16
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
17
+ error: z.ZodType<string, z.ZodTypeDef, string>;
18
+ name: z.ZodLiteral<"APIError">;
19
+ }, "strip", z.ZodTypeAny, {
20
+ code: "INTERNAL_SERVER_ERROR";
21
+ error: string;
22
+ name: "APIError";
23
+ }, {
24
+ code: "INTERNAL_SERVER_ERROR";
25
+ error: string;
26
+ name: "APIError";
27
+ }>;
28
+ 401: z.ZodObject<{
29
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
30
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
31
+ name: z.ZodLiteral<"APIError">;
32
+ }, "strip", z.ZodTypeAny, {
33
+ code: "UNAUTHORIZED";
34
+ error: "Unauthorized";
35
+ name: "APIError";
36
+ }, {
37
+ code: "UNAUTHORIZED";
38
+ error: "Unauthorized";
39
+ name: "APIError";
40
+ }>;
41
+ 403: z.ZodObject<{
42
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
43
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
44
+ name: z.ZodLiteral<"APIError">;
45
+ }, "strip", z.ZodTypeAny, {
46
+ code: "FORBIDDEN";
47
+ error: "Forbidden";
48
+ name: "APIError";
49
+ }, {
50
+ code: "FORBIDDEN";
51
+ error: "Forbidden";
52
+ name: "APIError";
53
+ }>;
15
54
  200: z.ZodObject<{
16
55
  streamId: z.ZodString;
17
56
  }, "strip", z.ZodTypeAny, {
@@ -146,19 +185,6 @@ declare const _default: {
146
185
  error: "The provided video ID is invalid";
147
186
  name: "APIError";
148
187
  }>]>;
149
- 500: z.ZodObject<{
150
- code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
151
- error: z.ZodType<string, z.ZodTypeDef, string>;
152
- name: z.ZodLiteral<"APIError">;
153
- }, "strip", z.ZodTypeAny, {
154
- code: "INTERNAL_SERVER_ERROR";
155
- error: string;
156
- name: "APIError";
157
- }, {
158
- code: "INTERNAL_SERVER_ERROR";
159
- error: string;
160
- name: "APIError";
161
- }>;
162
188
  };
163
189
  };
164
190
  get: {
@@ -267,10 +293,10 @@ declare const _default: {
267
293
  }[];
268
294
  }>;
269
295
  }, "strip", z.ZodTypeAny, {
270
- streamId: string;
271
296
  title: string;
272
- startTime: number;
273
297
  duration: number;
298
+ streamId: string;
299
+ startTime: number;
274
300
  currentTime: number;
275
301
  url: string;
276
302
  paused: boolean;
@@ -295,10 +321,10 @@ declare const _default: {
295
321
  }[];
296
322
  };
297
323
  }, {
298
- streamId: string;
299
324
  title: string;
300
- startTime: number;
301
325
  duration: number;
326
+ streamId: string;
327
+ startTime: number;
302
328
  currentTime: number;
303
329
  url: string;
304
330
  paused: boolean;
@@ -471,6 +497,58 @@ declare const _default: {
471
497
  body: z.ZodUndefined;
472
498
  path: "/media-stream/play/:streamId";
473
499
  responses: {
500
+ 404: z.ZodObject<{
501
+ code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
502
+ error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
503
+ name: z.ZodLiteral<"APIError">;
504
+ }, "strip", z.ZodTypeAny, {
505
+ code: "STREAM_NOT_FOUND";
506
+ error: "The requested stream was not found";
507
+ name: "APIError";
508
+ }, {
509
+ code: "STREAM_NOT_FOUND";
510
+ error: "The requested stream was not found";
511
+ name: "APIError";
512
+ }>;
513
+ 500: z.ZodObject<{
514
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
515
+ error: z.ZodType<string, z.ZodTypeDef, string>;
516
+ name: z.ZodLiteral<"APIError">;
517
+ }, "strip", z.ZodTypeAny, {
518
+ code: "INTERNAL_SERVER_ERROR";
519
+ error: string;
520
+ name: "APIError";
521
+ }, {
522
+ code: "INTERNAL_SERVER_ERROR";
523
+ error: string;
524
+ name: "APIError";
525
+ }>;
526
+ 401: z.ZodObject<{
527
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
528
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
529
+ name: z.ZodLiteral<"APIError">;
530
+ }, "strip", z.ZodTypeAny, {
531
+ code: "UNAUTHORIZED";
532
+ error: "Unauthorized";
533
+ name: "APIError";
534
+ }, {
535
+ code: "UNAUTHORIZED";
536
+ error: "Unauthorized";
537
+ name: "APIError";
538
+ }>;
539
+ 403: z.ZodObject<{
540
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
541
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
542
+ name: z.ZodLiteral<"APIError">;
543
+ }, "strip", z.ZodTypeAny, {
544
+ code: "FORBIDDEN";
545
+ error: "Forbidden";
546
+ name: "APIError";
547
+ }, {
548
+ code: "FORBIDDEN";
549
+ error: "Forbidden";
550
+ name: "APIError";
551
+ }>;
474
552
  200: typeof import("@ts-rest/core").ContractNoBody;
475
553
  400: z.ZodUnion<[z.ZodObject<{
476
554
  name: z.ZodLiteral<"ZodError">;
@@ -599,6 +677,14 @@ declare const _default: {
599
677
  error: "The provided stream ID is invalid";
600
678
  name: "APIError";
601
679
  }>]>;
680
+ };
681
+ };
682
+ pause: {
683
+ description: "Pause a media stream";
684
+ method: "POST";
685
+ body: z.ZodUndefined;
686
+ path: "/media-stream/pause/:streamId";
687
+ responses: {
602
688
  404: z.ZodObject<{
603
689
  code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
604
690
  error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
@@ -625,14 +711,32 @@ declare const _default: {
625
711
  error: string;
626
712
  name: "APIError";
627
713
  }>;
628
- };
629
- };
630
- pause: {
631
- description: "Pause a media stream";
632
- method: "POST";
633
- body: z.ZodUndefined;
634
- path: "/media-stream/pause/:streamId";
635
- responses: {
714
+ 401: z.ZodObject<{
715
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
716
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
717
+ name: z.ZodLiteral<"APIError">;
718
+ }, "strip", z.ZodTypeAny, {
719
+ code: "UNAUTHORIZED";
720
+ error: "Unauthorized";
721
+ name: "APIError";
722
+ }, {
723
+ code: "UNAUTHORIZED";
724
+ error: "Unauthorized";
725
+ name: "APIError";
726
+ }>;
727
+ 403: z.ZodObject<{
728
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
729
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
730
+ name: z.ZodLiteral<"APIError">;
731
+ }, "strip", z.ZodTypeAny, {
732
+ code: "FORBIDDEN";
733
+ error: "Forbidden";
734
+ name: "APIError";
735
+ }, {
736
+ code: "FORBIDDEN";
737
+ error: "Forbidden";
738
+ name: "APIError";
739
+ }>;
636
740
  200: typeof import("@ts-rest/core").ContractNoBody;
637
741
  400: z.ZodUnion<[z.ZodObject<{
638
742
  name: z.ZodLiteral<"ZodError">;
@@ -761,6 +865,21 @@ declare const _default: {
761
865
  error: "The provided stream ID is invalid";
762
866
  name: "APIError";
763
867
  }>]>;
868
+ };
869
+ };
870
+ seek: {
871
+ query: z.ZodObject<{
872
+ time: z.ZodNumber;
873
+ }, "strip", z.ZodTypeAny, {
874
+ time: number;
875
+ }, {
876
+ time: number;
877
+ }>;
878
+ description: "Seek a media stream";
879
+ method: "POST";
880
+ body: z.ZodUndefined;
881
+ path: "/media-stream/seek/:streamId";
882
+ responses: {
764
883
  404: z.ZodObject<{
765
884
  code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
766
885
  error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
@@ -787,21 +906,32 @@ declare const _default: {
787
906
  error: string;
788
907
  name: "APIError";
789
908
  }>;
790
- };
791
- };
792
- seek: {
793
- query: z.ZodObject<{
794
- time: z.ZodNumber;
795
- }, "strip", z.ZodTypeAny, {
796
- time: number;
797
- }, {
798
- time: number;
799
- }>;
800
- description: "Seek a media stream";
801
- method: "POST";
802
- body: z.ZodUndefined;
803
- path: "/media-stream/seek/:streamId";
804
- responses: {
909
+ 401: z.ZodObject<{
910
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
911
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
912
+ name: z.ZodLiteral<"APIError">;
913
+ }, "strip", z.ZodTypeAny, {
914
+ code: "UNAUTHORIZED";
915
+ error: "Unauthorized";
916
+ name: "APIError";
917
+ }, {
918
+ code: "UNAUTHORIZED";
919
+ error: "Unauthorized";
920
+ name: "APIError";
921
+ }>;
922
+ 403: z.ZodObject<{
923
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
924
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
925
+ name: z.ZodLiteral<"APIError">;
926
+ }, "strip", z.ZodTypeAny, {
927
+ code: "FORBIDDEN";
928
+ error: "Forbidden";
929
+ name: "APIError";
930
+ }, {
931
+ code: "FORBIDDEN";
932
+ error: "Forbidden";
933
+ name: "APIError";
934
+ }>;
805
935
  200: typeof import("@ts-rest/core").ContractNoBody;
806
936
  400: z.ZodUnion<[z.ZodObject<{
807
937
  name: z.ZodLiteral<"ZodError">;
@@ -930,32 +1060,6 @@ declare const _default: {
930
1060
  error: "The provided stream ID is invalid";
931
1061
  name: "APIError";
932
1062
  }>]>;
933
- 404: z.ZodObject<{
934
- code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
935
- error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
936
- name: z.ZodLiteral<"APIError">;
937
- }, "strip", z.ZodTypeAny, {
938
- code: "STREAM_NOT_FOUND";
939
- error: "The requested stream was not found";
940
- name: "APIError";
941
- }, {
942
- code: "STREAM_NOT_FOUND";
943
- error: "The requested stream was not found";
944
- name: "APIError";
945
- }>;
946
- 500: z.ZodObject<{
947
- code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
948
- error: z.ZodType<string, z.ZodTypeDef, string>;
949
- name: z.ZodLiteral<"APIError">;
950
- }, "strip", z.ZodTypeAny, {
951
- code: "INTERNAL_SERVER_ERROR";
952
- error: string;
953
- name: "APIError";
954
- }, {
955
- code: "INTERNAL_SERVER_ERROR";
956
- error: string;
957
- name: "APIError";
958
- }>;
959
1063
  };
960
1064
  };
961
1065
  scene: {
@@ -1099,6 +1203,58 @@ declare const _default: {
1099
1203
  }>]>;
1100
1204
  path: "/media-stream/scene/:streamId";
1101
1205
  responses: {
1206
+ 404: z.ZodObject<{
1207
+ code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
1208
+ error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
1209
+ name: z.ZodLiteral<"APIError">;
1210
+ }, "strip", z.ZodTypeAny, {
1211
+ code: "STREAM_NOT_FOUND";
1212
+ error: "The requested stream was not found";
1213
+ name: "APIError";
1214
+ }, {
1215
+ code: "STREAM_NOT_FOUND";
1216
+ error: "The requested stream was not found";
1217
+ name: "APIError";
1218
+ }>;
1219
+ 500: z.ZodObject<{
1220
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
1221
+ error: z.ZodType<string, z.ZodTypeDef, string>;
1222
+ name: z.ZodLiteral<"APIError">;
1223
+ }, "strip", z.ZodTypeAny, {
1224
+ code: "INTERNAL_SERVER_ERROR";
1225
+ error: string;
1226
+ name: "APIError";
1227
+ }, {
1228
+ code: "INTERNAL_SERVER_ERROR";
1229
+ error: string;
1230
+ name: "APIError";
1231
+ }>;
1232
+ 401: z.ZodObject<{
1233
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
1234
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
1235
+ name: z.ZodLiteral<"APIError">;
1236
+ }, "strip", z.ZodTypeAny, {
1237
+ code: "UNAUTHORIZED";
1238
+ error: "Unauthorized";
1239
+ name: "APIError";
1240
+ }, {
1241
+ code: "UNAUTHORIZED";
1242
+ error: "Unauthorized";
1243
+ name: "APIError";
1244
+ }>;
1245
+ 403: z.ZodObject<{
1246
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
1247
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
1248
+ name: z.ZodLiteral<"APIError">;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ code: "FORBIDDEN";
1251
+ error: "Forbidden";
1252
+ name: "APIError";
1253
+ }, {
1254
+ code: "FORBIDDEN";
1255
+ error: "Forbidden";
1256
+ name: "APIError";
1257
+ }>;
1102
1258
  200: typeof import("@ts-rest/core").ContractNoBody;
1103
1259
  400: z.ZodUnion<[z.ZodObject<{
1104
1260
  name: z.ZodLiteral<"ZodError">;
@@ -1239,32 +1395,6 @@ declare const _default: {
1239
1395
  error: "The scene object was not found";
1240
1396
  name: "APIError";
1241
1397
  }>]>;
1242
- 404: z.ZodObject<{
1243
- code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
1244
- error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
1245
- name: z.ZodLiteral<"APIError">;
1246
- }, "strip", z.ZodTypeAny, {
1247
- code: "STREAM_NOT_FOUND";
1248
- error: "The requested stream was not found";
1249
- name: "APIError";
1250
- }, {
1251
- code: "STREAM_NOT_FOUND";
1252
- error: "The requested stream was not found";
1253
- name: "APIError";
1254
- }>;
1255
- 500: z.ZodObject<{
1256
- code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
1257
- error: z.ZodType<string, z.ZodTypeDef, string>;
1258
- name: z.ZodLiteral<"APIError">;
1259
- }, "strip", z.ZodTypeAny, {
1260
- code: "INTERNAL_SERVER_ERROR";
1261
- error: string;
1262
- name: "APIError";
1263
- }, {
1264
- code: "INTERNAL_SERVER_ERROR";
1265
- error: string;
1266
- name: "APIError";
1267
- }>;
1268
1398
  };
1269
1399
  };
1270
1400
  stream: {
@@ -1,6 +1,6 @@
1
1
  import { initContract, ZodErrorSchema } from "@ts-rest/core";
2
2
  import { z } from "zod";
3
- import { apiError, apiSuccess } from "../types.js";
3
+ import { apiError, apiSuccess, authResponses } from "../types.js";
4
4
  import { mediaStreamSceneSchema, sceneActionSchema } from "../types/scene.js";
5
5
  const c = initContract();
6
6
  export default c.router({
@@ -19,7 +19,7 @@ export default c.router({
19
19
  ZodErrorSchema,
20
20
  apiError(z.literal("INVALID_VIDEO_ID"), z.literal("The provided video ID is invalid")),
21
21
  ]),
22
- // 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
22
+ ...authResponses,
23
23
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
24
24
  },
25
25
  },
@@ -59,7 +59,7 @@ export default c.router({
59
59
  ZodErrorSchema,
60
60
  apiError(z.literal("INVALID_STREAM_ID"), z.literal("The provided stream ID is invalid")),
61
61
  ]),
62
- // 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
62
+ ...authResponses,
63
63
  404: apiError(z.literal("STREAM_NOT_FOUND"), z.literal("The requested stream was not found")),
64
64
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
65
65
  },
@@ -75,7 +75,7 @@ export default c.router({
75
75
  ZodErrorSchema,
76
76
  apiError(z.literal("INVALID_STREAM_ID"), z.literal("The provided stream ID is invalid")),
77
77
  ]),
78
- // 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
78
+ ...authResponses,
79
79
  404: apiError(z.literal("STREAM_NOT_FOUND"), z.literal("The requested stream was not found")),
80
80
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
81
81
  },
@@ -94,7 +94,7 @@ export default c.router({
94
94
  ZodErrorSchema,
95
95
  apiError(z.literal("INVALID_STREAM_ID"), z.literal("The provided stream ID is invalid")),
96
96
  ]),
97
- // 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
97
+ ...authResponses,
98
98
  404: apiError(z.literal("STREAM_NOT_FOUND"), z.literal("The requested stream was not found")),
99
99
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
100
100
  },
@@ -111,7 +111,7 @@ export default c.router({
111
111
  apiError(z.literal("SCENE_FULL"), z.literal("The scene can't have more of this object")),
112
112
  apiError(z.literal("SCENE_OBJECT_NOT_FOUND"), z.literal("The scene object was not found")),
113
113
  ]),
114
- // 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
114
+ ...authResponses,
115
115
  404: apiError(z.literal("STREAM_NOT_FOUND"), z.literal("The requested stream was not found")),
116
116
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
117
117
  },