@darco2903/altv-web-api 1.3.0 → 1.5.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 +251 -77
- package/dist/consts.d.ts +1 -1
- package/dist/consts.js +1 -1
- package/dist/contract/index.d.ts +478 -114
- package/dist/contract/mediaStream.d.ts +218 -88
- package/dist/contract/mediaStream.js +6 -6
- package/dist/contract/youtube.d.ts +260 -26
- package/dist/contract/youtube.js +28 -15
- package/dist/types/youtube.d.ts +25 -4
- package/dist/types/youtube.js +10 -16
- package/dist/types.d.ts +29 -0
- package/dist/types.js +5 -0
- package/package.json +1 -1
|
@@ -1,28 +1,112 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
declare const _default: {
|
|
3
|
-
|
|
3
|
+
search: {
|
|
4
4
|
query: z.ZodObject<{
|
|
5
|
-
|
|
6
|
-
filter: z.ZodOptional<z.ZodEnum<["audio", "audioandvideo", "audioonly", "video", "videoandaudio", "videoonly"]>>;
|
|
5
|
+
q: z.ZodString;
|
|
7
6
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
|
|
9
|
-
quality?: "highest" | "highestaudio" | "highestvideo" | "lowest" | "lowestaudio" | "lowestvideo" | undefined;
|
|
7
|
+
q: string;
|
|
10
8
|
}, {
|
|
11
|
-
|
|
12
|
-
quality?: "highest" | "highestaudio" | "highestvideo" | "lowest" | "lowestaudio" | "lowestvideo" | undefined;
|
|
9
|
+
q: string;
|
|
13
10
|
}>;
|
|
14
|
-
description: "
|
|
11
|
+
description: "Search YouTube videos";
|
|
15
12
|
method: "GET";
|
|
16
|
-
path: "/youtube/
|
|
13
|
+
path: "/youtube/search";
|
|
17
14
|
responses: {
|
|
15
|
+
429: z.ZodObject<{
|
|
16
|
+
code: z.ZodType<"TOO_MANY_SEARCHES", z.ZodTypeDef, "TOO_MANY_SEARCHES">;
|
|
17
|
+
error: z.ZodType<"Too many searches are running", z.ZodTypeDef, "Too many searches are running">;
|
|
18
|
+
name: z.ZodLiteral<"APIError">;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
code: "TOO_MANY_SEARCHES";
|
|
21
|
+
error: "Too many searches are running";
|
|
22
|
+
name: "APIError";
|
|
23
|
+
}, {
|
|
24
|
+
code: "TOO_MANY_SEARCHES";
|
|
25
|
+
error: "Too many searches are running";
|
|
26
|
+
name: "APIError";
|
|
27
|
+
}>;
|
|
28
|
+
500: z.ZodObject<{
|
|
29
|
+
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
30
|
+
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
31
|
+
name: z.ZodLiteral<"APIError">;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
34
|
+
error: string;
|
|
35
|
+
name: "APIError";
|
|
36
|
+
}, {
|
|
37
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
38
|
+
error: string;
|
|
39
|
+
name: "APIError";
|
|
40
|
+
}>;
|
|
41
|
+
401: z.ZodObject<{
|
|
42
|
+
code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
|
|
43
|
+
error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
|
|
44
|
+
name: z.ZodLiteral<"APIError">;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
code: "UNAUTHORIZED";
|
|
47
|
+
error: "Unauthorized";
|
|
48
|
+
name: "APIError";
|
|
49
|
+
}, {
|
|
50
|
+
code: "UNAUTHORIZED";
|
|
51
|
+
error: "Unauthorized";
|
|
52
|
+
name: "APIError";
|
|
53
|
+
}>;
|
|
54
|
+
403: z.ZodObject<{
|
|
55
|
+
code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
|
|
56
|
+
error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
|
|
57
|
+
name: z.ZodLiteral<"APIError">;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
code: "FORBIDDEN";
|
|
60
|
+
error: "Forbidden";
|
|
61
|
+
name: "APIError";
|
|
62
|
+
}, {
|
|
63
|
+
code: "FORBIDDEN";
|
|
64
|
+
error: "Forbidden";
|
|
65
|
+
name: "APIError";
|
|
66
|
+
}>;
|
|
18
67
|
200: z.ZodObject<{
|
|
19
|
-
|
|
68
|
+
results: z.ZodArray<z.ZodObject<{
|
|
69
|
+
videoId: z.ZodString;
|
|
70
|
+
title: z.ZodString;
|
|
71
|
+
channel: z.ZodNullable<z.ZodString>;
|
|
72
|
+
duration: z.ZodNullable<z.ZodNumber>;
|
|
73
|
+
thumbnail: z.ZodNullable<z.ZodString>;
|
|
74
|
+
blocked: z.ZodNullable<z.ZodEnum<["live", "too_long"]>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
videoId: string;
|
|
77
|
+
title: string;
|
|
78
|
+
duration: number | null;
|
|
79
|
+
channel: string | null;
|
|
80
|
+
thumbnail: string | null;
|
|
81
|
+
blocked: "live" | "too_long" | null;
|
|
82
|
+
}, {
|
|
83
|
+
videoId: string;
|
|
84
|
+
title: string;
|
|
85
|
+
duration: number | null;
|
|
86
|
+
channel: string | null;
|
|
87
|
+
thumbnail: string | null;
|
|
88
|
+
blocked: "live" | "too_long" | null;
|
|
89
|
+
}>, "many">;
|
|
20
90
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
|
|
91
|
+
results: {
|
|
92
|
+
videoId: string;
|
|
93
|
+
title: string;
|
|
94
|
+
duration: number | null;
|
|
95
|
+
channel: string | null;
|
|
96
|
+
thumbnail: string | null;
|
|
97
|
+
blocked: "live" | "too_long" | null;
|
|
98
|
+
}[];
|
|
22
99
|
}, {
|
|
23
|
-
|
|
100
|
+
results: {
|
|
101
|
+
videoId: string;
|
|
102
|
+
title: string;
|
|
103
|
+
duration: number | null;
|
|
104
|
+
channel: string | null;
|
|
105
|
+
thumbnail: string | null;
|
|
106
|
+
blocked: "live" | "too_long" | null;
|
|
107
|
+
}[];
|
|
24
108
|
}>;
|
|
25
|
-
400: z.
|
|
109
|
+
400: z.ZodObject<{
|
|
26
110
|
name: z.ZodLiteral<"ZodError">;
|
|
27
111
|
issues: z.ZodArray<z.ZodObject<{
|
|
28
112
|
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
@@ -136,19 +220,21 @@ declare const _default: {
|
|
|
136
220
|
not_finite: "not_finite";
|
|
137
221
|
}>;
|
|
138
222
|
}, z.ZodAny, "strip">[];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
223
|
+
}>;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
suggest: {
|
|
227
|
+
query: z.ZodObject<{
|
|
228
|
+
q: z.ZodString;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
q: string;
|
|
231
|
+
}, {
|
|
232
|
+
q: string;
|
|
233
|
+
}>;
|
|
234
|
+
description: "Get YouTube search suggestions for a partial query";
|
|
235
|
+
method: "GET";
|
|
236
|
+
path: "/youtube/suggest";
|
|
237
|
+
responses: {
|
|
152
238
|
500: z.ZodObject<{
|
|
153
239
|
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
154
240
|
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
@@ -162,6 +248,154 @@ declare const _default: {
|
|
|
162
248
|
error: string;
|
|
163
249
|
name: "APIError";
|
|
164
250
|
}>;
|
|
251
|
+
401: z.ZodObject<{
|
|
252
|
+
code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
|
|
253
|
+
error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
|
|
254
|
+
name: z.ZodLiteral<"APIError">;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
code: "UNAUTHORIZED";
|
|
257
|
+
error: "Unauthorized";
|
|
258
|
+
name: "APIError";
|
|
259
|
+
}, {
|
|
260
|
+
code: "UNAUTHORIZED";
|
|
261
|
+
error: "Unauthorized";
|
|
262
|
+
name: "APIError";
|
|
263
|
+
}>;
|
|
264
|
+
403: z.ZodObject<{
|
|
265
|
+
code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
|
|
266
|
+
error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
|
|
267
|
+
name: z.ZodLiteral<"APIError">;
|
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
code: "FORBIDDEN";
|
|
270
|
+
error: "Forbidden";
|
|
271
|
+
name: "APIError";
|
|
272
|
+
}, {
|
|
273
|
+
code: "FORBIDDEN";
|
|
274
|
+
error: "Forbidden";
|
|
275
|
+
name: "APIError";
|
|
276
|
+
}>;
|
|
277
|
+
200: z.ZodObject<{
|
|
278
|
+
suggestions: z.ZodArray<z.ZodString, "many">;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
suggestions: string[];
|
|
281
|
+
}, {
|
|
282
|
+
suggestions: string[];
|
|
283
|
+
}>;
|
|
284
|
+
400: z.ZodObject<{
|
|
285
|
+
name: z.ZodLiteral<"ZodError">;
|
|
286
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
287
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
288
|
+
message: z.ZodOptional<z.ZodString>;
|
|
289
|
+
code: z.ZodNativeEnum<{
|
|
290
|
+
invalid_type: "invalid_type";
|
|
291
|
+
invalid_literal: "invalid_literal";
|
|
292
|
+
custom: "custom";
|
|
293
|
+
invalid_union: "invalid_union";
|
|
294
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
295
|
+
invalid_enum_value: "invalid_enum_value";
|
|
296
|
+
unrecognized_keys: "unrecognized_keys";
|
|
297
|
+
invalid_arguments: "invalid_arguments";
|
|
298
|
+
invalid_return_type: "invalid_return_type";
|
|
299
|
+
invalid_date: "invalid_date";
|
|
300
|
+
invalid_string: "invalid_string";
|
|
301
|
+
too_small: "too_small";
|
|
302
|
+
too_big: "too_big";
|
|
303
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
304
|
+
not_multiple_of: "not_multiple_of";
|
|
305
|
+
not_finite: "not_finite";
|
|
306
|
+
}>;
|
|
307
|
+
}, "strip", z.ZodAny, z.objectOutputType<{
|
|
308
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
309
|
+
message: z.ZodOptional<z.ZodString>;
|
|
310
|
+
code: z.ZodNativeEnum<{
|
|
311
|
+
invalid_type: "invalid_type";
|
|
312
|
+
invalid_literal: "invalid_literal";
|
|
313
|
+
custom: "custom";
|
|
314
|
+
invalid_union: "invalid_union";
|
|
315
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
316
|
+
invalid_enum_value: "invalid_enum_value";
|
|
317
|
+
unrecognized_keys: "unrecognized_keys";
|
|
318
|
+
invalid_arguments: "invalid_arguments";
|
|
319
|
+
invalid_return_type: "invalid_return_type";
|
|
320
|
+
invalid_date: "invalid_date";
|
|
321
|
+
invalid_string: "invalid_string";
|
|
322
|
+
too_small: "too_small";
|
|
323
|
+
too_big: "too_big";
|
|
324
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
325
|
+
not_multiple_of: "not_multiple_of";
|
|
326
|
+
not_finite: "not_finite";
|
|
327
|
+
}>;
|
|
328
|
+
}, z.ZodAny, "strip">, z.objectInputType<{
|
|
329
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
330
|
+
message: z.ZodOptional<z.ZodString>;
|
|
331
|
+
code: z.ZodNativeEnum<{
|
|
332
|
+
invalid_type: "invalid_type";
|
|
333
|
+
invalid_literal: "invalid_literal";
|
|
334
|
+
custom: "custom";
|
|
335
|
+
invalid_union: "invalid_union";
|
|
336
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
337
|
+
invalid_enum_value: "invalid_enum_value";
|
|
338
|
+
unrecognized_keys: "unrecognized_keys";
|
|
339
|
+
invalid_arguments: "invalid_arguments";
|
|
340
|
+
invalid_return_type: "invalid_return_type";
|
|
341
|
+
invalid_date: "invalid_date";
|
|
342
|
+
invalid_string: "invalid_string";
|
|
343
|
+
too_small: "too_small";
|
|
344
|
+
too_big: "too_big";
|
|
345
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
346
|
+
not_multiple_of: "not_multiple_of";
|
|
347
|
+
not_finite: "not_finite";
|
|
348
|
+
}>;
|
|
349
|
+
}, z.ZodAny, "strip">>, "many">;
|
|
350
|
+
}, "strip", z.ZodTypeAny, {
|
|
351
|
+
name: "ZodError";
|
|
352
|
+
issues: z.objectOutputType<{
|
|
353
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
354
|
+
message: z.ZodOptional<z.ZodString>;
|
|
355
|
+
code: z.ZodNativeEnum<{
|
|
356
|
+
invalid_type: "invalid_type";
|
|
357
|
+
invalid_literal: "invalid_literal";
|
|
358
|
+
custom: "custom";
|
|
359
|
+
invalid_union: "invalid_union";
|
|
360
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
361
|
+
invalid_enum_value: "invalid_enum_value";
|
|
362
|
+
unrecognized_keys: "unrecognized_keys";
|
|
363
|
+
invalid_arguments: "invalid_arguments";
|
|
364
|
+
invalid_return_type: "invalid_return_type";
|
|
365
|
+
invalid_date: "invalid_date";
|
|
366
|
+
invalid_string: "invalid_string";
|
|
367
|
+
too_small: "too_small";
|
|
368
|
+
too_big: "too_big";
|
|
369
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
370
|
+
not_multiple_of: "not_multiple_of";
|
|
371
|
+
not_finite: "not_finite";
|
|
372
|
+
}>;
|
|
373
|
+
}, z.ZodAny, "strip">[];
|
|
374
|
+
}, {
|
|
375
|
+
name: "ZodError";
|
|
376
|
+
issues: z.objectInputType<{
|
|
377
|
+
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
378
|
+
message: z.ZodOptional<z.ZodString>;
|
|
379
|
+
code: z.ZodNativeEnum<{
|
|
380
|
+
invalid_type: "invalid_type";
|
|
381
|
+
invalid_literal: "invalid_literal";
|
|
382
|
+
custom: "custom";
|
|
383
|
+
invalid_union: "invalid_union";
|
|
384
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
385
|
+
invalid_enum_value: "invalid_enum_value";
|
|
386
|
+
unrecognized_keys: "unrecognized_keys";
|
|
387
|
+
invalid_arguments: "invalid_arguments";
|
|
388
|
+
invalid_return_type: "invalid_return_type";
|
|
389
|
+
invalid_date: "invalid_date";
|
|
390
|
+
invalid_string: "invalid_string";
|
|
391
|
+
too_small: "too_small";
|
|
392
|
+
too_big: "too_big";
|
|
393
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
394
|
+
not_multiple_of: "not_multiple_of";
|
|
395
|
+
not_finite: "not_finite";
|
|
396
|
+
}>;
|
|
397
|
+
}, z.ZodAny, "strip">[];
|
|
398
|
+
}>;
|
|
165
399
|
};
|
|
166
400
|
};
|
|
167
401
|
};
|
package/dist/contract/youtube.js
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import { initContract, ZodErrorSchema } from "@ts-rest/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { apiError, apiSuccess } from "../types.js";
|
|
4
|
-
import {
|
|
3
|
+
import { apiError, apiSuccess, authResponses } from "../types.js";
|
|
4
|
+
import { YOUTUBE_QUERY_MAX_LENGTH } from "../consts.js";
|
|
5
|
+
import { 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
|
+
search: {
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: "/youtube/search",
|
|
14
|
+
description: "Search YouTube videos",
|
|
15
|
+
query: queryParams,
|
|
16
|
+
responses: {
|
|
17
|
+
200: apiSuccess(z.object({
|
|
18
|
+
results: z.array(youTubeSearchResultSchema),
|
|
19
|
+
})),
|
|
20
|
+
400: ZodErrorSchema,
|
|
21
|
+
...authResponses,
|
|
22
|
+
429: apiError(z.literal("TOO_MANY_SEARCHES"), z.literal("Too many searches are running")),
|
|
23
|
+
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
suggest: {
|
|
8
27
|
method: "GET",
|
|
9
|
-
path: "/youtube/
|
|
10
|
-
description: "Get
|
|
11
|
-
query:
|
|
12
|
-
quality: youTubeQualitySchema.optional(),
|
|
13
|
-
filter: youTubeFilterSchema.optional(),
|
|
14
|
-
}),
|
|
28
|
+
path: "/youtube/suggest",
|
|
29
|
+
description: "Get YouTube search suggestions for a partial query",
|
|
30
|
+
query: queryParams,
|
|
15
31
|
responses: {
|
|
16
32
|
200: apiSuccess(z.object({
|
|
17
|
-
|
|
33
|
+
suggestions: z.array(z.string()),
|
|
18
34
|
})),
|
|
19
|
-
400:
|
|
20
|
-
|
|
21
|
-
apiError(z.literal("INVALID_VIDEO_ID"), z.literal("The provided video ID is invalid")),
|
|
22
|
-
]),
|
|
23
|
-
// 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
|
|
35
|
+
400: ZodErrorSchema,
|
|
36
|
+
...authResponses,
|
|
24
37
|
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
25
38
|
},
|
|
26
39
|
},
|
package/dist/types/youtube.d.ts
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export declare const youTubeSearchResultSchema: z.ZodObject<{
|
|
3
|
+
videoId: z.ZodString;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
channel: z.ZodNullable<z.ZodString>;
|
|
6
|
+
/** Seconds, null if YouTube doesn't give it, e.g. for live videos */
|
|
7
|
+
duration: z.ZodNullable<z.ZodNumber>;
|
|
8
|
+
thumbnail: z.ZodNullable<z.ZodString>;
|
|
9
|
+
/** Why the video can't be streamed, null if it can */
|
|
10
|
+
blocked: z.ZodNullable<z.ZodEnum<["live", "too_long"]>>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
videoId: string;
|
|
13
|
+
title: string;
|
|
14
|
+
duration: number | null;
|
|
15
|
+
channel: string | null;
|
|
16
|
+
thumbnail: string | null;
|
|
17
|
+
blocked: "live" | "too_long" | null;
|
|
18
|
+
}, {
|
|
19
|
+
videoId: string;
|
|
20
|
+
title: string;
|
|
21
|
+
duration: number | null;
|
|
22
|
+
channel: string | null;
|
|
23
|
+
thumbnail: string | null;
|
|
24
|
+
blocked: "live" | "too_long" | null;
|
|
25
|
+
}>;
|
|
26
|
+
export type YouTubeSearchResult = z.infer<typeof youTubeSearchResultSchema>;
|
package/dist/types/youtube.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"audioandvideo",
|
|
13
|
-
"audioonly",
|
|
14
|
-
"video",
|
|
15
|
-
"videoandaudio",
|
|
16
|
-
"videoonly",
|
|
17
|
-
]);
|
|
2
|
+
export const youTubeSearchResultSchema = z.object({
|
|
3
|
+
videoId: z.string(),
|
|
4
|
+
title: z.string(),
|
|
5
|
+
channel: z.string().nullable(),
|
|
6
|
+
/** Seconds, null if YouTube doesn't give it, e.g. for live videos */
|
|
7
|
+
duration: z.number().nullable(),
|
|
8
|
+
thumbnail: z.string().url().nullable(),
|
|
9
|
+
/** Why the video can't be streamed, null if it can */
|
|
10
|
+
blocked: z.enum(["live", "too_long"]).nullable(),
|
|
11
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -29,3 +29,32 @@ export declare const apiErrorData: <T, U, V>(code: ZodType<T>, error: ZodType<U>
|
|
|
29
29
|
name: z.ZodLiteral<"APIError">;
|
|
30
30
|
data: z.ZodType<V, z.ZodTypeDef, V>;
|
|
31
31
|
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
32
|
+
/** Responses of the routes that need a logged in user */
|
|
33
|
+
export declare const authResponses: {
|
|
34
|
+
401: z.ZodObject<{
|
|
35
|
+
code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
|
|
36
|
+
error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
|
|
37
|
+
name: z.ZodLiteral<"APIError">;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
code: "UNAUTHORIZED";
|
|
40
|
+
error: "Unauthorized";
|
|
41
|
+
name: "APIError";
|
|
42
|
+
}, {
|
|
43
|
+
code: "UNAUTHORIZED";
|
|
44
|
+
error: "Unauthorized";
|
|
45
|
+
name: "APIError";
|
|
46
|
+
}>;
|
|
47
|
+
403: z.ZodObject<{
|
|
48
|
+
code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
|
|
49
|
+
error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
|
|
50
|
+
name: z.ZodLiteral<"APIError">;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
code: "FORBIDDEN";
|
|
53
|
+
error: "Forbidden";
|
|
54
|
+
name: "APIError";
|
|
55
|
+
}, {
|
|
56
|
+
code: "FORBIDDEN";
|
|
57
|
+
error: "Forbidden";
|
|
58
|
+
name: "APIError";
|
|
59
|
+
}>;
|
|
60
|
+
};
|
package/dist/types.js
CHANGED
|
@@ -12,3 +12,8 @@ export const apiErrorData = (code, error, data) => z.object({
|
|
|
12
12
|
name: z.literal("APIError"),
|
|
13
13
|
data,
|
|
14
14
|
});
|
|
15
|
+
/** Responses of the routes that need a logged in user */
|
|
16
|
+
export const authResponses = {
|
|
17
|
+
401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
|
|
18
|
+
403: apiError(z.literal("FORBIDDEN"), z.literal("Forbidden")),
|
|
19
|
+
};
|