@darco2903/altv-web-api 1.4.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 +184 -135
- package/dist/contract/index.d.ts +297 -279
- package/dist/contract/mediaStream.d.ts +218 -88
- package/dist/contract/mediaStream.js +6 -6
- package/dist/contract/youtube.d.ts +79 -191
- package/dist/contract/youtube.js +4 -22
- package/dist/types/youtube.d.ts +0 -4
- package/dist/types/youtube.js +0 -16
- package/dist/types.d.ts +29 -0
- package/dist/types.js +5 -0
- package/package.json +1 -1
|
@@ -1,154 +1,30 @@
|
|
|
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: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
url: string;
|
|
22
|
-
}, {
|
|
23
|
-
url: string;
|
|
24
|
-
}>;
|
|
25
|
-
400: z.ZodUnion<[z.ZodObject<{
|
|
26
|
-
name: z.ZodLiteral<"ZodError">;
|
|
27
|
-
issues: z.ZodArray<z.ZodObject<{
|
|
28
|
-
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
29
|
-
message: z.ZodOptional<z.ZodString>;
|
|
30
|
-
code: z.ZodNativeEnum<{
|
|
31
|
-
invalid_type: "invalid_type";
|
|
32
|
-
invalid_literal: "invalid_literal";
|
|
33
|
-
custom: "custom";
|
|
34
|
-
invalid_union: "invalid_union";
|
|
35
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
36
|
-
invalid_enum_value: "invalid_enum_value";
|
|
37
|
-
unrecognized_keys: "unrecognized_keys";
|
|
38
|
-
invalid_arguments: "invalid_arguments";
|
|
39
|
-
invalid_return_type: "invalid_return_type";
|
|
40
|
-
invalid_date: "invalid_date";
|
|
41
|
-
invalid_string: "invalid_string";
|
|
42
|
-
too_small: "too_small";
|
|
43
|
-
too_big: "too_big";
|
|
44
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
45
|
-
not_multiple_of: "not_multiple_of";
|
|
46
|
-
not_finite: "not_finite";
|
|
47
|
-
}>;
|
|
48
|
-
}, "strip", z.ZodAny, z.objectOutputType<{
|
|
49
|
-
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
50
|
-
message: z.ZodOptional<z.ZodString>;
|
|
51
|
-
code: z.ZodNativeEnum<{
|
|
52
|
-
invalid_type: "invalid_type";
|
|
53
|
-
invalid_literal: "invalid_literal";
|
|
54
|
-
custom: "custom";
|
|
55
|
-
invalid_union: "invalid_union";
|
|
56
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
57
|
-
invalid_enum_value: "invalid_enum_value";
|
|
58
|
-
unrecognized_keys: "unrecognized_keys";
|
|
59
|
-
invalid_arguments: "invalid_arguments";
|
|
60
|
-
invalid_return_type: "invalid_return_type";
|
|
61
|
-
invalid_date: "invalid_date";
|
|
62
|
-
invalid_string: "invalid_string";
|
|
63
|
-
too_small: "too_small";
|
|
64
|
-
too_big: "too_big";
|
|
65
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
66
|
-
not_multiple_of: "not_multiple_of";
|
|
67
|
-
not_finite: "not_finite";
|
|
68
|
-
}>;
|
|
69
|
-
}, z.ZodAny, "strip">, z.objectInputType<{
|
|
70
|
-
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
71
|
-
message: z.ZodOptional<z.ZodString>;
|
|
72
|
-
code: z.ZodNativeEnum<{
|
|
73
|
-
invalid_type: "invalid_type";
|
|
74
|
-
invalid_literal: "invalid_literal";
|
|
75
|
-
custom: "custom";
|
|
76
|
-
invalid_union: "invalid_union";
|
|
77
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
78
|
-
invalid_enum_value: "invalid_enum_value";
|
|
79
|
-
unrecognized_keys: "unrecognized_keys";
|
|
80
|
-
invalid_arguments: "invalid_arguments";
|
|
81
|
-
invalid_return_type: "invalid_return_type";
|
|
82
|
-
invalid_date: "invalid_date";
|
|
83
|
-
invalid_string: "invalid_string";
|
|
84
|
-
too_small: "too_small";
|
|
85
|
-
too_big: "too_big";
|
|
86
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
87
|
-
not_multiple_of: "not_multiple_of";
|
|
88
|
-
not_finite: "not_finite";
|
|
89
|
-
}>;
|
|
90
|
-
}, z.ZodAny, "strip">>, "many">;
|
|
91
|
-
}, "strip", z.ZodTypeAny, {
|
|
92
|
-
name: "ZodError";
|
|
93
|
-
issues: z.objectOutputType<{
|
|
94
|
-
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
95
|
-
message: z.ZodOptional<z.ZodString>;
|
|
96
|
-
code: z.ZodNativeEnum<{
|
|
97
|
-
invalid_type: "invalid_type";
|
|
98
|
-
invalid_literal: "invalid_literal";
|
|
99
|
-
custom: "custom";
|
|
100
|
-
invalid_union: "invalid_union";
|
|
101
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
102
|
-
invalid_enum_value: "invalid_enum_value";
|
|
103
|
-
unrecognized_keys: "unrecognized_keys";
|
|
104
|
-
invalid_arguments: "invalid_arguments";
|
|
105
|
-
invalid_return_type: "invalid_return_type";
|
|
106
|
-
invalid_date: "invalid_date";
|
|
107
|
-
invalid_string: "invalid_string";
|
|
108
|
-
too_small: "too_small";
|
|
109
|
-
too_big: "too_big";
|
|
110
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
111
|
-
not_multiple_of: "not_multiple_of";
|
|
112
|
-
not_finite: "not_finite";
|
|
113
|
-
}>;
|
|
114
|
-
}, z.ZodAny, "strip">[];
|
|
115
|
-
}, {
|
|
116
|
-
name: "ZodError";
|
|
117
|
-
issues: z.objectInputType<{
|
|
118
|
-
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
119
|
-
message: z.ZodOptional<z.ZodString>;
|
|
120
|
-
code: z.ZodNativeEnum<{
|
|
121
|
-
invalid_type: "invalid_type";
|
|
122
|
-
invalid_literal: "invalid_literal";
|
|
123
|
-
custom: "custom";
|
|
124
|
-
invalid_union: "invalid_union";
|
|
125
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
126
|
-
invalid_enum_value: "invalid_enum_value";
|
|
127
|
-
unrecognized_keys: "unrecognized_keys";
|
|
128
|
-
invalid_arguments: "invalid_arguments";
|
|
129
|
-
invalid_return_type: "invalid_return_type";
|
|
130
|
-
invalid_date: "invalid_date";
|
|
131
|
-
invalid_string: "invalid_string";
|
|
132
|
-
too_small: "too_small";
|
|
133
|
-
too_big: "too_big";
|
|
134
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
135
|
-
not_multiple_of: "not_multiple_of";
|
|
136
|
-
not_finite: "not_finite";
|
|
137
|
-
}>;
|
|
138
|
-
}, z.ZodAny, "strip">[];
|
|
139
|
-
}>, z.ZodObject<{
|
|
140
|
-
code: z.ZodType<"INVALID_VIDEO_ID", z.ZodTypeDef, "INVALID_VIDEO_ID">;
|
|
141
|
-
error: z.ZodType<"The provided video ID is invalid", z.ZodTypeDef, "The provided video ID is invalid">;
|
|
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">;
|
|
142
18
|
name: z.ZodLiteral<"APIError">;
|
|
143
19
|
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
code: "
|
|
145
|
-
error: "
|
|
20
|
+
code: "TOO_MANY_SEARCHES";
|
|
21
|
+
error: "Too many searches are running";
|
|
146
22
|
name: "APIError";
|
|
147
23
|
}, {
|
|
148
|
-
code: "
|
|
149
|
-
error: "
|
|
24
|
+
code: "TOO_MANY_SEARCHES";
|
|
25
|
+
error: "Too many searches are running";
|
|
150
26
|
name: "APIError";
|
|
151
|
-
}
|
|
27
|
+
}>;
|
|
152
28
|
500: z.ZodObject<{
|
|
153
29
|
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
154
30
|
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
@@ -162,20 +38,32 @@ declare const _default: {
|
|
|
162
38
|
error: string;
|
|
163
39
|
name: "APIError";
|
|
164
40
|
}>;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
+
}>;
|
|
179
67
|
200: z.ZodObject<{
|
|
180
68
|
results: z.ZodArray<z.ZodObject<{
|
|
181
69
|
videoId: z.ZodString;
|
|
@@ -333,32 +221,6 @@ declare const _default: {
|
|
|
333
221
|
}>;
|
|
334
222
|
}, z.ZodAny, "strip">[];
|
|
335
223
|
}>;
|
|
336
|
-
429: z.ZodObject<{
|
|
337
|
-
code: z.ZodType<"TOO_MANY_SEARCHES", z.ZodTypeDef, "TOO_MANY_SEARCHES">;
|
|
338
|
-
error: z.ZodType<"Too many searches are running", z.ZodTypeDef, "Too many searches are running">;
|
|
339
|
-
name: z.ZodLiteral<"APIError">;
|
|
340
|
-
}, "strip", z.ZodTypeAny, {
|
|
341
|
-
code: "TOO_MANY_SEARCHES";
|
|
342
|
-
error: "Too many searches are running";
|
|
343
|
-
name: "APIError";
|
|
344
|
-
}, {
|
|
345
|
-
code: "TOO_MANY_SEARCHES";
|
|
346
|
-
error: "Too many searches are running";
|
|
347
|
-
name: "APIError";
|
|
348
|
-
}>;
|
|
349
|
-
500: z.ZodObject<{
|
|
350
|
-
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
351
|
-
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
352
|
-
name: z.ZodLiteral<"APIError">;
|
|
353
|
-
}, "strip", z.ZodTypeAny, {
|
|
354
|
-
code: "INTERNAL_SERVER_ERROR";
|
|
355
|
-
error: string;
|
|
356
|
-
name: "APIError";
|
|
357
|
-
}, {
|
|
358
|
-
code: "INTERNAL_SERVER_ERROR";
|
|
359
|
-
error: string;
|
|
360
|
-
name: "APIError";
|
|
361
|
-
}>;
|
|
362
224
|
};
|
|
363
225
|
};
|
|
364
226
|
suggest: {
|
|
@@ -373,6 +235,45 @@ declare const _default: {
|
|
|
373
235
|
method: "GET";
|
|
374
236
|
path: "/youtube/suggest";
|
|
375
237
|
responses: {
|
|
238
|
+
500: z.ZodObject<{
|
|
239
|
+
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
240
|
+
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
241
|
+
name: z.ZodLiteral<"APIError">;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
244
|
+
error: string;
|
|
245
|
+
name: "APIError";
|
|
246
|
+
}, {
|
|
247
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
248
|
+
error: string;
|
|
249
|
+
name: "APIError";
|
|
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
|
+
}>;
|
|
376
277
|
200: z.ZodObject<{
|
|
377
278
|
suggestions: z.ZodArray<z.ZodString, "many">;
|
|
378
279
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -495,19 +396,6 @@ declare const _default: {
|
|
|
495
396
|
}>;
|
|
496
397
|
}, z.ZodAny, "strip">[];
|
|
497
398
|
}>;
|
|
498
|
-
500: z.ZodObject<{
|
|
499
|
-
code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
|
|
500
|
-
error: z.ZodType<string, z.ZodTypeDef, string>;
|
|
501
|
-
name: z.ZodLiteral<"APIError">;
|
|
502
|
-
}, "strip", z.ZodTypeAny, {
|
|
503
|
-
code: "INTERNAL_SERVER_ERROR";
|
|
504
|
-
error: string;
|
|
505
|
-
name: "APIError";
|
|
506
|
-
}, {
|
|
507
|
-
code: "INTERNAL_SERVER_ERROR";
|
|
508
|
-
error: string;
|
|
509
|
-
name: "APIError";
|
|
510
|
-
}>;
|
|
511
399
|
};
|
|
512
400
|
};
|
|
513
401
|
};
|
package/dist/contract/youtube.js
CHANGED
|
@@ -1,33 +1,13 @@
|
|
|
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 { YOUTUBE_QUERY_MAX_LENGTH } from "../consts.js";
|
|
5
|
-
import {
|
|
5
|
+
import { 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
10
|
export default c.router({
|
|
11
|
-
getLink: {
|
|
12
|
-
method: "GET",
|
|
13
|
-
path: "/youtube/audio-link/:videoId",
|
|
14
|
-
description: "Get direct audio link from a YouTube video URL",
|
|
15
|
-
query: z.object({
|
|
16
|
-
quality: youTubeQualitySchema.optional(),
|
|
17
|
-
filter: youTubeFilterSchema.optional(),
|
|
18
|
-
}),
|
|
19
|
-
responses: {
|
|
20
|
-
200: apiSuccess(z.object({
|
|
21
|
-
url: z.string().url(),
|
|
22
|
-
})),
|
|
23
|
-
400: z.union([
|
|
24
|
-
ZodErrorSchema,
|
|
25
|
-
apiError(z.literal("INVALID_VIDEO_ID"), z.literal("The provided video ID is invalid")),
|
|
26
|
-
]),
|
|
27
|
-
// 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
|
|
28
|
-
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
11
|
search: {
|
|
32
12
|
method: "GET",
|
|
33
13
|
path: "/youtube/search",
|
|
@@ -38,6 +18,7 @@ export default c.router({
|
|
|
38
18
|
results: z.array(youTubeSearchResultSchema),
|
|
39
19
|
})),
|
|
40
20
|
400: ZodErrorSchema,
|
|
21
|
+
...authResponses,
|
|
41
22
|
429: apiError(z.literal("TOO_MANY_SEARCHES"), z.literal("Too many searches are running")),
|
|
42
23
|
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
43
24
|
},
|
|
@@ -52,6 +33,7 @@ export default c.router({
|
|
|
52
33
|
suggestions: z.array(z.string()),
|
|
53
34
|
})),
|
|
54
35
|
400: ZodErrorSchema,
|
|
36
|
+
...authResponses,
|
|
55
37
|
500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
|
|
56
38
|
},
|
|
57
39
|
},
|
package/dist/types/youtube.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const youTubeQualitySchema: z.ZodEnum<["highest", "highestaudio", "highestvideo", "lowest", "lowestaudio", "lowestvideo"]>;
|
|
3
|
-
export type YouTubeQuality = z.infer<typeof youTubeQualitySchema>;
|
|
4
|
-
export declare const youTubeFilterSchema: z.ZodEnum<["audio", "audioandvideo", "audioonly", "video", "videoandaudio", "videoonly"]>;
|
|
5
|
-
export type YouTubeFilter = z.infer<typeof youTubeFilterSchema>;
|
|
6
2
|
export declare const youTubeSearchResultSchema: z.ZodObject<{
|
|
7
3
|
videoId: z.ZodString;
|
|
8
4
|
title: z.ZodString;
|
package/dist/types/youtube.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export const youTubeQualitySchema = z.enum([
|
|
3
|
-
"highest",
|
|
4
|
-
"highestaudio",
|
|
5
|
-
"highestvideo",
|
|
6
|
-
"lowest",
|
|
7
|
-
"lowestaudio",
|
|
8
|
-
"lowestvideo",
|
|
9
|
-
]);
|
|
10
|
-
export const youTubeFilterSchema = z.enum([
|
|
11
|
-
"audio",
|
|
12
|
-
"audioandvideo",
|
|
13
|
-
"audioonly",
|
|
14
|
-
"video",
|
|
15
|
-
"videoandaudio",
|
|
16
|
-
"videoonly",
|
|
17
|
-
]);
|
|
18
2
|
export const youTubeSearchResultSchema = z.object({
|
|
19
3
|
videoId: z.string(),
|
|
20
4
|
title: z.string(),
|
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
|
+
};
|