@darco2903/altv-web-api 1.5.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.
package/dist/client.d.ts CHANGED
@@ -41,8 +41,8 @@ export declare function createClient(origin: string): {
41
41
  results: {
42
42
  videoId: string;
43
43
  title: string;
44
- duration: number | null;
45
44
  channel: string | null;
45
+ duration: number | null;
46
46
  thumbnail: string | null;
47
47
  blocked: "live" | "too_long" | null;
48
48
  }[];
@@ -225,6 +225,55 @@ export declare function createClient(origin: string): {
225
225
  body: unknown;
226
226
  headers: Headers;
227
227
  }>;
228
+ history: {
229
+ list: (args?: {
230
+ cache?: RequestCache | undefined;
231
+ extraHeaders?: Record<string, string | undefined> | undefined;
232
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
233
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
234
+ } | undefined) => Promise<{
235
+ status: 500;
236
+ body: {
237
+ code: "INTERNAL_SERVER_ERROR";
238
+ error: string;
239
+ name: "APIError";
240
+ };
241
+ headers: Headers;
242
+ } | {
243
+ status: 401;
244
+ body: {
245
+ code: "UNAUTHORIZED";
246
+ error: "Unauthorized";
247
+ name: "APIError";
248
+ };
249
+ headers: Headers;
250
+ } | {
251
+ status: 403;
252
+ body: {
253
+ code: "FORBIDDEN";
254
+ error: "Forbidden";
255
+ name: "APIError";
256
+ };
257
+ headers: Headers;
258
+ } | {
259
+ status: 200;
260
+ body: {
261
+ tracks: {
262
+ videoId: string;
263
+ title: string;
264
+ channel: string | null;
265
+ duration: number | null;
266
+ thumbnail: string | null;
267
+ blocked: "live" | "too_long" | null;
268
+ }[];
269
+ };
270
+ headers: Headers;
271
+ } | {
272
+ status: 400 | 404 | 100 | 429 | 101 | 102 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 409 | 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;
273
+ body: unknown;
274
+ headers: Headers;
275
+ }>;
276
+ };
228
277
  mediaStream: {
229
278
  init: (args: {
230
279
  body: {
@@ -320,10 +369,10 @@ export declare function createClient(origin: string): {
320
369
  } | {
321
370
  status: 200;
322
371
  body: {
323
- streamId: string;
324
372
  title: string;
325
- startTime: number;
326
373
  duration: number;
374
+ streamId: string;
375
+ startTime: number;
327
376
  currentTime: number;
328
377
  url: string;
329
378
  paused: boolean;
@@ -0,0 +1,92 @@
1
+ import { z } from "zod";
2
+ declare const _default: {
3
+ list: {
4
+ description: "Tracks the logged in user started recently, last played first";
5
+ method: "GET";
6
+ path: "/history";
7
+ responses: {
8
+ 500: z.ZodObject<{
9
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
10
+ error: z.ZodType<string, z.ZodTypeDef, string>;
11
+ name: z.ZodLiteral<"APIError">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ code: "INTERNAL_SERVER_ERROR";
14
+ error: string;
15
+ name: "APIError";
16
+ }, {
17
+ code: "INTERNAL_SERVER_ERROR";
18
+ error: string;
19
+ name: "APIError";
20
+ }>;
21
+ 401: z.ZodObject<{
22
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
23
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
24
+ name: z.ZodLiteral<"APIError">;
25
+ }, "strip", z.ZodTypeAny, {
26
+ code: "UNAUTHORIZED";
27
+ error: "Unauthorized";
28
+ name: "APIError";
29
+ }, {
30
+ code: "UNAUTHORIZED";
31
+ error: "Unauthorized";
32
+ name: "APIError";
33
+ }>;
34
+ 403: z.ZodObject<{
35
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
36
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
37
+ name: z.ZodLiteral<"APIError">;
38
+ }, "strip", z.ZodTypeAny, {
39
+ code: "FORBIDDEN";
40
+ error: "Forbidden";
41
+ name: "APIError";
42
+ }, {
43
+ code: "FORBIDDEN";
44
+ error: "Forbidden";
45
+ name: "APIError";
46
+ }>;
47
+ 200: z.ZodObject<{
48
+ tracks: z.ZodArray<z.ZodObject<{
49
+ videoId: z.ZodString;
50
+ title: z.ZodString;
51
+ channel: z.ZodNullable<z.ZodString>;
52
+ duration: z.ZodNullable<z.ZodNumber>;
53
+ thumbnail: z.ZodNullable<z.ZodString>;
54
+ blocked: z.ZodNullable<z.ZodEnum<["live", "too_long"]>>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ videoId: string;
57
+ title: string;
58
+ channel: string | null;
59
+ duration: number | null;
60
+ thumbnail: string | null;
61
+ blocked: "live" | "too_long" | null;
62
+ }, {
63
+ videoId: string;
64
+ title: string;
65
+ channel: string | null;
66
+ duration: number | null;
67
+ thumbnail: string | null;
68
+ blocked: "live" | "too_long" | null;
69
+ }>, "many">;
70
+ }, "strip", z.ZodTypeAny, {
71
+ tracks: {
72
+ videoId: string;
73
+ title: string;
74
+ channel: string | null;
75
+ duration: number | null;
76
+ thumbnail: string | null;
77
+ blocked: "live" | "too_long" | null;
78
+ }[];
79
+ }, {
80
+ tracks: {
81
+ videoId: string;
82
+ title: string;
83
+ channel: string | null;
84
+ duration: number | null;
85
+ thumbnail: string | null;
86
+ blocked: "live" | "too_long" | null;
87
+ }[];
88
+ }>;
89
+ };
90
+ };
91
+ };
92
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { initContract } from "@ts-rest/core";
2
+ import { z } from "zod";
3
+ import { apiError, apiSuccess, authResponses } from "../types.js";
4
+ import { youTubeSearchResultSchema } from "../types/youtube.js";
5
+ const c = initContract();
6
+ export default c.router({
7
+ list: {
8
+ method: "GET",
9
+ path: "/history",
10
+ description: "Tracks the logged in user started recently, last played first",
11
+ responses: {
12
+ 200: apiSuccess(z.object({
13
+ tracks: z.array(youTubeSearchResultSchema),
14
+ })),
15
+ ...authResponses,
16
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
17
+ },
18
+ },
19
+ });
@@ -75,15 +75,15 @@ declare const _default: {
75
75
  }, "strip", import("zod").ZodTypeAny, {
76
76
  videoId: string;
77
77
  title: string;
78
- duration: number | null;
79
78
  channel: string | null;
79
+ duration: number | null;
80
80
  thumbnail: string | null;
81
81
  blocked: "live" | "too_long" | null;
82
82
  }, {
83
83
  videoId: string;
84
84
  title: string;
85
- duration: number | null;
86
85
  channel: string | null;
86
+ duration: number | null;
87
87
  thumbnail: string | null;
88
88
  blocked: "live" | "too_long" | null;
89
89
  }>, "many">;
@@ -91,8 +91,8 @@ declare const _default: {
91
91
  results: {
92
92
  videoId: string;
93
93
  title: string;
94
- duration: number | null;
95
94
  channel: string | null;
95
+ duration: number | null;
96
96
  thumbnail: string | null;
97
97
  blocked: "live" | "too_long" | null;
98
98
  }[];
@@ -100,8 +100,8 @@ declare const _default: {
100
100
  results: {
101
101
  videoId: string;
102
102
  title: string;
103
- duration: number | null;
104
103
  channel: string | null;
104
+ duration: number | null;
105
105
  thumbnail: string | null;
106
106
  blocked: "live" | "too_long" | null;
107
107
  }[];
@@ -552,6 +552,96 @@ declare const _default: {
552
552
  }>;
553
553
  };
554
554
  };
555
+ history: {
556
+ list: {
557
+ description: "Tracks the logged in user started recently, last played first";
558
+ method: "GET";
559
+ path: "/api/v2/history";
560
+ responses: {
561
+ 500: import("zod").ZodObject<{
562
+ code: import("zod").ZodType<"INTERNAL_SERVER_ERROR", import("zod").ZodTypeDef, "INTERNAL_SERVER_ERROR">;
563
+ error: import("zod").ZodType<string, import("zod").ZodTypeDef, string>;
564
+ name: import("zod").ZodLiteral<"APIError">;
565
+ }, "strip", import("zod").ZodTypeAny, {
566
+ code: "INTERNAL_SERVER_ERROR";
567
+ error: string;
568
+ name: "APIError";
569
+ }, {
570
+ code: "INTERNAL_SERVER_ERROR";
571
+ error: string;
572
+ name: "APIError";
573
+ }>;
574
+ 401: import("zod").ZodObject<{
575
+ code: import("zod").ZodType<"UNAUTHORIZED", import("zod").ZodTypeDef, "UNAUTHORIZED">;
576
+ error: import("zod").ZodType<"Unauthorized", import("zod").ZodTypeDef, "Unauthorized">;
577
+ name: import("zod").ZodLiteral<"APIError">;
578
+ }, "strip", import("zod").ZodTypeAny, {
579
+ code: "UNAUTHORIZED";
580
+ error: "Unauthorized";
581
+ name: "APIError";
582
+ }, {
583
+ code: "UNAUTHORIZED";
584
+ error: "Unauthorized";
585
+ name: "APIError";
586
+ }>;
587
+ 403: import("zod").ZodObject<{
588
+ code: import("zod").ZodType<"FORBIDDEN", import("zod").ZodTypeDef, "FORBIDDEN">;
589
+ error: import("zod").ZodType<"Forbidden", import("zod").ZodTypeDef, "Forbidden">;
590
+ name: import("zod").ZodLiteral<"APIError">;
591
+ }, "strip", import("zod").ZodTypeAny, {
592
+ code: "FORBIDDEN";
593
+ error: "Forbidden";
594
+ name: "APIError";
595
+ }, {
596
+ code: "FORBIDDEN";
597
+ error: "Forbidden";
598
+ name: "APIError";
599
+ }>;
600
+ 200: import("zod").ZodObject<{
601
+ tracks: import("zod").ZodArray<import("zod").ZodObject<{
602
+ videoId: import("zod").ZodString;
603
+ title: import("zod").ZodString;
604
+ channel: import("zod").ZodNullable<import("zod").ZodString>;
605
+ duration: import("zod").ZodNullable<import("zod").ZodNumber>;
606
+ thumbnail: import("zod").ZodNullable<import("zod").ZodString>;
607
+ blocked: import("zod").ZodNullable<import("zod").ZodEnum<["live", "too_long"]>>;
608
+ }, "strip", import("zod").ZodTypeAny, {
609
+ videoId: string;
610
+ title: string;
611
+ channel: string | null;
612
+ duration: number | null;
613
+ thumbnail: string | null;
614
+ blocked: "live" | "too_long" | null;
615
+ }, {
616
+ videoId: string;
617
+ title: string;
618
+ channel: string | null;
619
+ duration: number | null;
620
+ thumbnail: string | null;
621
+ blocked: "live" | "too_long" | null;
622
+ }>, "many">;
623
+ }, "strip", import("zod").ZodTypeAny, {
624
+ tracks: {
625
+ videoId: string;
626
+ title: string;
627
+ channel: string | null;
628
+ duration: number | null;
629
+ thumbnail: string | null;
630
+ blocked: "live" | "too_long" | null;
631
+ }[];
632
+ }, {
633
+ tracks: {
634
+ videoId: string;
635
+ title: string;
636
+ channel: string | null;
637
+ duration: number | null;
638
+ thumbnail: string | null;
639
+ blocked: "live" | "too_long" | null;
640
+ }[];
641
+ }>;
642
+ };
643
+ };
644
+ };
555
645
  mediaStream: {
556
646
  init: {
557
647
  description: "Initialize a new media stream from a YouTube video";
@@ -844,10 +934,10 @@ declare const _default: {
844
934
  }[];
845
935
  }>;
846
936
  }, "strip", import("zod").ZodTypeAny, {
847
- streamId: string;
848
937
  title: string;
849
- startTime: number;
850
938
  duration: number;
939
+ streamId: string;
940
+ startTime: number;
851
941
  currentTime: number;
852
942
  url: string;
853
943
  paused: boolean;
@@ -872,10 +962,10 @@ declare const _default: {
872
962
  }[];
873
963
  };
874
964
  }, {
875
- streamId: string;
876
965
  title: string;
877
- startTime: number;
878
966
  duration: number;
967
+ streamId: string;
968
+ startTime: number;
879
969
  currentTime: number;
880
970
  url: string;
881
971
  paused: boolean;
@@ -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,
@@ -293,10 +293,10 @@ declare const _default: {
293
293
  }[];
294
294
  }>;
295
295
  }, "strip", z.ZodTypeAny, {
296
- streamId: string;
297
296
  title: string;
298
- startTime: number;
299
297
  duration: number;
298
+ streamId: string;
299
+ startTime: number;
300
300
  currentTime: number;
301
301
  url: string;
302
302
  paused: boolean;
@@ -321,10 +321,10 @@ declare const _default: {
321
321
  }[];
322
322
  };
323
323
  }, {
324
- streamId: string;
325
324
  title: string;
326
- startTime: number;
327
325
  duration: number;
326
+ streamId: string;
327
+ startTime: number;
328
328
  currentTime: number;
329
329
  url: string;
330
330
  paused: boolean;
@@ -75,15 +75,15 @@ declare const _default: {
75
75
  }, "strip", z.ZodTypeAny, {
76
76
  videoId: string;
77
77
  title: string;
78
- duration: number | null;
79
78
  channel: string | null;
79
+ duration: number | null;
80
80
  thumbnail: string | null;
81
81
  blocked: "live" | "too_long" | null;
82
82
  }, {
83
83
  videoId: string;
84
84
  title: string;
85
- duration: number | null;
86
85
  channel: string | null;
86
+ duration: number | null;
87
87
  thumbnail: string | null;
88
88
  blocked: "live" | "too_long" | null;
89
89
  }>, "many">;
@@ -91,8 +91,8 @@ declare const _default: {
91
91
  results: {
92
92
  videoId: string;
93
93
  title: string;
94
- duration: number | null;
95
94
  channel: string | null;
95
+ duration: number | null;
96
96
  thumbnail: string | null;
97
97
  blocked: "live" | "too_long" | null;
98
98
  }[];
@@ -100,8 +100,8 @@ declare const _default: {
100
100
  results: {
101
101
  videoId: string;
102
102
  title: string;
103
- duration: number | null;
104
103
  channel: string | null;
104
+ duration: number | null;
105
105
  thumbnail: string | null;
106
106
  blocked: "live" | "too_long" | null;
107
107
  }[];
@@ -11,15 +11,15 @@ export declare const youTubeSearchResultSchema: z.ZodObject<{
11
11
  }, "strip", z.ZodTypeAny, {
12
12
  videoId: string;
13
13
  title: string;
14
- duration: number | null;
15
14
  channel: string | null;
15
+ duration: number | null;
16
16
  thumbnail: string | null;
17
17
  blocked: "live" | "too_long" | null;
18
18
  }, {
19
19
  videoId: string;
20
20
  title: string;
21
- duration: number | null;
22
21
  channel: string | null;
22
+ duration: number | null;
23
23
  thumbnail: string | null;
24
24
  blocked: "live" | "too_long" | null;
25
25
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darco2903/altv-web-api",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "keywords": [],