@aviaryhq/cloudglue-js 0.3.1 → 0.3.3

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.
@@ -0,0 +1,309 @@
1
+ import { type ZodiosOptions } from "@zodios/core";
2
+ import { z } from "zod";
3
+ import { FaceBoundingBox } from "./common";
4
+ import { FrameExtractionConfig } from "./common";
5
+ type FaceDetection = {
6
+ face_detection_id: string;
7
+ frame_extraction_id?: string | undefined;
8
+ file_id?: string | undefined;
9
+ status: "pending" | "processing" | "completed" | "failed";
10
+ created_at: number;
11
+ data?: Partial<{
12
+ object: "list";
13
+ total: number;
14
+ limit: number;
15
+ offset: number;
16
+ faces: Array<DetectedFace>;
17
+ }> | undefined;
18
+ };
19
+ type FaceDetectionRequest = {
20
+ url: string;
21
+ frame_extraction_id?: string | undefined;
22
+ frame_extraction_config?: FrameExtractionConfig | undefined;
23
+ };
24
+ type DetectedFace = {
25
+ id: string;
26
+ face_bounding_box: FaceBoundingBox;
27
+ frame_id: string;
28
+ timestamp: number;
29
+ thumbnail_url?: string | undefined;
30
+ };
31
+ declare const FaceDetectionRequest: z.ZodType<FaceDetectionRequest>;
32
+ declare const DetectedFace: z.ZodType<DetectedFace>;
33
+ declare const FaceDetection: z.ZodType<FaceDetection>;
34
+ export declare const schemas: {
35
+ FaceDetectionRequest: z.ZodType<FaceDetectionRequest, z.ZodTypeDef, FaceDetectionRequest>;
36
+ DetectedFace: z.ZodType<DetectedFace, z.ZodTypeDef, DetectedFace>;
37
+ FaceDetection: z.ZodType<FaceDetection, z.ZodTypeDef, FaceDetection>;
38
+ };
39
+ export declare const Face_DetectionApi: import("@zodios/core").ZodiosInstance<[{
40
+ method: "post";
41
+ path: "/face-detect";
42
+ alias: "createFaceDetection";
43
+ description: "Analyze video to detect all faces";
44
+ requestFormat: "json";
45
+ parameters: [{
46
+ name: "body";
47
+ description: string;
48
+ type: "Body";
49
+ schema: z.ZodType<FaceDetectionRequest, z.ZodTypeDef, FaceDetectionRequest>;
50
+ }];
51
+ response: z.ZodType<FaceDetection, z.ZodTypeDef, FaceDetection>;
52
+ errors: [{
53
+ status: 400;
54
+ description: string;
55
+ schema: z.ZodObject<{
56
+ error: z.ZodString;
57
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
58
+ error: z.ZodString;
59
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
60
+ error: z.ZodString;
61
+ }, z.ZodTypeAny, "passthrough">>;
62
+ }, {
63
+ status: 404;
64
+ description: string;
65
+ schema: z.ZodObject<{
66
+ error: z.ZodString;
67
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
68
+ error: z.ZodString;
69
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
70
+ error: z.ZodString;
71
+ }, z.ZodTypeAny, "passthrough">>;
72
+ }, {
73
+ status: 429;
74
+ description: string;
75
+ schema: z.ZodObject<{
76
+ error: z.ZodString;
77
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
78
+ error: z.ZodString;
79
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
80
+ error: z.ZodString;
81
+ }, z.ZodTypeAny, "passthrough">>;
82
+ }, {
83
+ status: 500;
84
+ description: string;
85
+ schema: z.ZodObject<{
86
+ error: z.ZodString;
87
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
88
+ error: z.ZodString;
89
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
90
+ error: z.ZodString;
91
+ }, z.ZodTypeAny, "passthrough">>;
92
+ }];
93
+ }, {
94
+ method: "get";
95
+ path: "/face-detect/:face_detection_id";
96
+ alias: "getFaceDetection";
97
+ description: "Retrieve face detection results including all detected faces";
98
+ requestFormat: "json";
99
+ parameters: [{
100
+ name: "face_detection_id";
101
+ type: "Path";
102
+ schema: z.ZodString;
103
+ }, {
104
+ name: "limit";
105
+ type: "Query";
106
+ schema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
107
+ }, {
108
+ name: "offset";
109
+ type: "Query";
110
+ schema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
111
+ }];
112
+ response: z.ZodType<FaceDetection, z.ZodTypeDef, FaceDetection>;
113
+ errors: [{
114
+ status: 404;
115
+ description: string;
116
+ schema: z.ZodObject<{
117
+ error: z.ZodString;
118
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
119
+ error: z.ZodString;
120
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
121
+ error: z.ZodString;
122
+ }, z.ZodTypeAny, "passthrough">>;
123
+ }, {
124
+ status: 500;
125
+ description: string;
126
+ schema: z.ZodObject<{
127
+ error: z.ZodString;
128
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
129
+ error: z.ZodString;
130
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
131
+ error: z.ZodString;
132
+ }, z.ZodTypeAny, "passthrough">>;
133
+ }];
134
+ }, {
135
+ method: "delete";
136
+ path: "/face-detect/:face_detection_id";
137
+ alias: "deleteFaceDetection";
138
+ description: "Delete a specific face detection analysis";
139
+ requestFormat: "json";
140
+ parameters: [{
141
+ name: "face_detection_id";
142
+ type: "Path";
143
+ schema: z.ZodString;
144
+ }];
145
+ response: z.ZodObject<{
146
+ id: z.ZodString;
147
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
148
+ id: z.ZodString;
149
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
150
+ id: z.ZodString;
151
+ }, z.ZodTypeAny, "passthrough">>;
152
+ errors: [{
153
+ status: 404;
154
+ description: string;
155
+ schema: z.ZodObject<{
156
+ error: z.ZodString;
157
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
158
+ error: z.ZodString;
159
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
160
+ error: z.ZodString;
161
+ }, z.ZodTypeAny, "passthrough">>;
162
+ }, {
163
+ status: 500;
164
+ description: string;
165
+ schema: z.ZodObject<{
166
+ error: z.ZodString;
167
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
168
+ error: z.ZodString;
169
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
170
+ error: z.ZodString;
171
+ }, z.ZodTypeAny, "passthrough">>;
172
+ }];
173
+ }]>;
174
+ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions): import("@zodios/core").ZodiosInstance<[{
175
+ method: "post";
176
+ path: "/face-detect";
177
+ alias: "createFaceDetection";
178
+ description: "Analyze video to detect all faces";
179
+ requestFormat: "json";
180
+ parameters: [{
181
+ name: "body";
182
+ description: string;
183
+ type: "Body";
184
+ schema: z.ZodType<FaceDetectionRequest, z.ZodTypeDef, FaceDetectionRequest>;
185
+ }];
186
+ response: z.ZodType<FaceDetection, z.ZodTypeDef, FaceDetection>;
187
+ errors: [{
188
+ status: 400;
189
+ description: string;
190
+ schema: z.ZodObject<{
191
+ error: z.ZodString;
192
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
193
+ error: z.ZodString;
194
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
195
+ error: z.ZodString;
196
+ }, z.ZodTypeAny, "passthrough">>;
197
+ }, {
198
+ status: 404;
199
+ description: string;
200
+ schema: z.ZodObject<{
201
+ error: z.ZodString;
202
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
203
+ error: z.ZodString;
204
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
205
+ error: z.ZodString;
206
+ }, z.ZodTypeAny, "passthrough">>;
207
+ }, {
208
+ status: 429;
209
+ description: string;
210
+ schema: z.ZodObject<{
211
+ error: z.ZodString;
212
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
213
+ error: z.ZodString;
214
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
215
+ error: z.ZodString;
216
+ }, z.ZodTypeAny, "passthrough">>;
217
+ }, {
218
+ status: 500;
219
+ description: string;
220
+ schema: z.ZodObject<{
221
+ error: z.ZodString;
222
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
223
+ error: z.ZodString;
224
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
225
+ error: z.ZodString;
226
+ }, z.ZodTypeAny, "passthrough">>;
227
+ }];
228
+ }, {
229
+ method: "get";
230
+ path: "/face-detect/:face_detection_id";
231
+ alias: "getFaceDetection";
232
+ description: "Retrieve face detection results including all detected faces";
233
+ requestFormat: "json";
234
+ parameters: [{
235
+ name: "face_detection_id";
236
+ type: "Path";
237
+ schema: z.ZodString;
238
+ }, {
239
+ name: "limit";
240
+ type: "Query";
241
+ schema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
242
+ }, {
243
+ name: "offset";
244
+ type: "Query";
245
+ schema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
246
+ }];
247
+ response: z.ZodType<FaceDetection, z.ZodTypeDef, FaceDetection>;
248
+ errors: [{
249
+ status: 404;
250
+ description: string;
251
+ schema: z.ZodObject<{
252
+ error: z.ZodString;
253
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
254
+ error: z.ZodString;
255
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
256
+ error: z.ZodString;
257
+ }, z.ZodTypeAny, "passthrough">>;
258
+ }, {
259
+ status: 500;
260
+ description: string;
261
+ schema: z.ZodObject<{
262
+ error: z.ZodString;
263
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
264
+ error: z.ZodString;
265
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
266
+ error: z.ZodString;
267
+ }, z.ZodTypeAny, "passthrough">>;
268
+ }];
269
+ }, {
270
+ method: "delete";
271
+ path: "/face-detect/:face_detection_id";
272
+ alias: "deleteFaceDetection";
273
+ description: "Delete a specific face detection analysis";
274
+ requestFormat: "json";
275
+ parameters: [{
276
+ name: "face_detection_id";
277
+ type: "Path";
278
+ schema: z.ZodString;
279
+ }];
280
+ response: z.ZodObject<{
281
+ id: z.ZodString;
282
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
283
+ id: z.ZodString;
284
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
285
+ id: z.ZodString;
286
+ }, z.ZodTypeAny, "passthrough">>;
287
+ errors: [{
288
+ status: 404;
289
+ description: string;
290
+ schema: z.ZodObject<{
291
+ error: z.ZodString;
292
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
293
+ error: z.ZodString;
294
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
295
+ error: z.ZodString;
296
+ }, z.ZodTypeAny, "passthrough">>;
297
+ }, {
298
+ status: 500;
299
+ description: string;
300
+ schema: z.ZodObject<{
301
+ error: z.ZodString;
302
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
303
+ error: z.ZodString;
304
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
305
+ error: z.ZodString;
306
+ }, z.ZodTypeAny, "passthrough">>;
307
+ }];
308
+ }]>;
309
+ export {};
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Face_DetectionApi = exports.schemas = void 0;
4
+ exports.createApiClient = createApiClient;
5
+ const core_1 = require("@zodios/core");
6
+ const zod_1 = require("zod");
7
+ const common_1 = require("./common");
8
+ const common_2 = require("./common");
9
+ const FaceDetectionRequest = zod_1.z
10
+ .object({
11
+ url: zod_1.z.string(),
12
+ frame_extraction_id: zod_1.z.string().uuid().optional(),
13
+ frame_extraction_config: common_2.FrameExtractionConfig.optional(),
14
+ })
15
+ .strict()
16
+ .passthrough();
17
+ const DetectedFace = zod_1.z
18
+ .object({
19
+ id: zod_1.z.string().uuid(),
20
+ face_bounding_box: common_1.FaceBoundingBox,
21
+ frame_id: zod_1.z.string().uuid(),
22
+ timestamp: zod_1.z.number(),
23
+ thumbnail_url: zod_1.z.string().optional(),
24
+ })
25
+ .strict()
26
+ .passthrough();
27
+ const FaceDetection = zod_1.z
28
+ .object({
29
+ face_detection_id: zod_1.z.string().uuid(),
30
+ frame_extraction_id: zod_1.z.string().uuid().optional(),
31
+ file_id: zod_1.z.string().uuid().optional(),
32
+ status: zod_1.z.enum(["pending", "processing", "completed", "failed"]),
33
+ created_at: zod_1.z.number(),
34
+ data: zod_1.z
35
+ .object({
36
+ object: zod_1.z.literal("list"),
37
+ total: zod_1.z.number().int(),
38
+ limit: zod_1.z.number().int().gte(1).lte(100),
39
+ offset: zod_1.z.number().int().gte(0),
40
+ faces: zod_1.z.array(DetectedFace),
41
+ })
42
+ .partial()
43
+ .strict()
44
+ .passthrough()
45
+ .optional(),
46
+ })
47
+ .strict()
48
+ .passthrough();
49
+ exports.schemas = {
50
+ FaceDetectionRequest,
51
+ DetectedFace,
52
+ FaceDetection,
53
+ };
54
+ const endpoints = (0, core_1.makeApi)([
55
+ {
56
+ method: "post",
57
+ path: "/face-detect",
58
+ alias: "createFaceDetection",
59
+ description: `Analyze video to detect all faces`,
60
+ requestFormat: "json",
61
+ parameters: [
62
+ {
63
+ name: "body",
64
+ description: `Face detection request parameters`,
65
+ type: "Body",
66
+ schema: FaceDetectionRequest,
67
+ },
68
+ ],
69
+ response: FaceDetection,
70
+ errors: [
71
+ {
72
+ status: 400,
73
+ description: `Invalid request parameters or configuration`,
74
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
75
+ },
76
+ {
77
+ status: 404,
78
+ description: `Target video file not found`,
79
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
80
+ },
81
+ {
82
+ status: 429,
83
+ description: `Monthly face detection jobs limit reached`,
84
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
85
+ },
86
+ {
87
+ status: 500,
88
+ description: `An unexpected error occurred on the server`,
89
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ method: "get",
95
+ path: "/face-detect/:face_detection_id",
96
+ alias: "getFaceDetection",
97
+ description: `Retrieve face detection results including all detected faces`,
98
+ requestFormat: "json",
99
+ parameters: [
100
+ {
101
+ name: "face_detection_id",
102
+ type: "Path",
103
+ schema: zod_1.z.string().uuid(),
104
+ },
105
+ {
106
+ name: "limit",
107
+ type: "Query",
108
+ schema: zod_1.z.number().int().gte(1).lte(100).optional().default(50),
109
+ },
110
+ {
111
+ name: "offset",
112
+ type: "Query",
113
+ schema: zod_1.z.number().int().gte(0).optional().default(0),
114
+ },
115
+ ],
116
+ response: FaceDetection,
117
+ errors: [
118
+ {
119
+ status: 404,
120
+ description: `Face detection job not found`,
121
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
122
+ },
123
+ {
124
+ status: 500,
125
+ description: `An unexpected error occurred on the server`,
126
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
127
+ },
128
+ ],
129
+ },
130
+ {
131
+ method: "delete",
132
+ path: "/face-detect/:face_detection_id",
133
+ alias: "deleteFaceDetection",
134
+ description: `Delete a specific face detection analysis`,
135
+ requestFormat: "json",
136
+ parameters: [
137
+ {
138
+ name: "face_detection_id",
139
+ type: "Path",
140
+ schema: zod_1.z.string().uuid(),
141
+ },
142
+ ],
143
+ response: zod_1.z.object({ id: zod_1.z.string().uuid() }).strict().passthrough(),
144
+ errors: [
145
+ {
146
+ status: 404,
147
+ description: `Face detection job not found`,
148
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
149
+ },
150
+ {
151
+ status: 500,
152
+ description: `An unexpected error occurred on the server`,
153
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
154
+ },
155
+ ],
156
+ },
157
+ ]);
158
+ exports.Face_DetectionApi = new core_1.Zodios("https://api.cloudglue.dev/v1", endpoints);
159
+ function createApiClient(baseUrl, options) {
160
+ return new core_1.Zodios(baseUrl, endpoints, options);
161
+ }