@aviaryhq/cloudglue-js 0.0.9

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,666 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionsApi = 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 Collection = zod_1.z
9
+ .object({
10
+ id: zod_1.z.string(),
11
+ object: zod_1.z.literal("collection"),
12
+ name: zod_1.z.string(),
13
+ description: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]).optional(),
14
+ describe_config: zod_1.z
15
+ .object({
16
+ enable_speech: zod_1.z.boolean().default(true),
17
+ enable_scene_text: zod_1.z.boolean().default(true),
18
+ enable_visual_scene_description: zod_1.z.boolean().default(true),
19
+ })
20
+ .partial()
21
+ .strict()
22
+ .passthrough()
23
+ .optional(),
24
+ extract_config: zod_1.z
25
+ .object({
26
+ prompt: zod_1.z.string(),
27
+ schema: zod_1.z.object({}).partial().strict().passthrough(),
28
+ })
29
+ .partial()
30
+ .strict()
31
+ .passthrough()
32
+ .optional(),
33
+ created_at: zod_1.z.number().int(),
34
+ file_count: zod_1.z.number().int(),
35
+ })
36
+ .strict()
37
+ .passthrough();
38
+ const CollectionList = zod_1.z
39
+ .object({
40
+ object: zod_1.z.literal("list"),
41
+ data: zod_1.z.array(Collection),
42
+ total: zod_1.z.number().int(),
43
+ limit: zod_1.z.number().int(),
44
+ offset: zod_1.z.number().int(),
45
+ })
46
+ .strict()
47
+ .passthrough();
48
+ const CollectionFile = zod_1.z
49
+ .object({
50
+ collection_id: zod_1.z.string(),
51
+ file_id: zod_1.z.string(),
52
+ object: zod_1.z.literal("collection_file"),
53
+ added_at: zod_1.z.number().int(),
54
+ status: zod_1.z.enum([
55
+ "pending",
56
+ "processing",
57
+ "ready",
58
+ "completed",
59
+ "failed",
60
+ "not_applicable",
61
+ ]),
62
+ describe_status: zod_1.z
63
+ .enum([
64
+ "pending",
65
+ "processing",
66
+ "ready",
67
+ "completed",
68
+ "failed",
69
+ "not_applicable",
70
+ ])
71
+ .optional(),
72
+ extract_status: zod_1.z
73
+ .enum([
74
+ "pending",
75
+ "processing",
76
+ "ready",
77
+ "completed",
78
+ "failed",
79
+ "not_applicable",
80
+ ])
81
+ .optional(),
82
+ searchable_status: zod_1.z
83
+ .enum([
84
+ "pending",
85
+ "processing",
86
+ "ready",
87
+ "completed",
88
+ "failed",
89
+ "not_applicable",
90
+ ])
91
+ .optional(),
92
+ file: common_1.File.optional(),
93
+ })
94
+ .strict()
95
+ .passthrough();
96
+ const CollectionFileList = zod_1.z
97
+ .object({
98
+ object: zod_1.z.literal("list"),
99
+ data: zod_1.z.array(CollectionFile),
100
+ total: zod_1.z.number().int(),
101
+ limit: zod_1.z.number().int(),
102
+ offset: zod_1.z.number().int(),
103
+ })
104
+ .strict()
105
+ .passthrough();
106
+ const NewCollection = zod_1.z
107
+ .object({
108
+ name: zod_1.z.string(),
109
+ description: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]).optional(),
110
+ describe_config: zod_1.z
111
+ .object({
112
+ enable_speech: zod_1.z.boolean().default(true),
113
+ enable_scene_text: zod_1.z.boolean().default(true),
114
+ enable_visual_scene_description: zod_1.z.boolean().default(true),
115
+ })
116
+ .partial()
117
+ .strict()
118
+ .passthrough()
119
+ .optional(),
120
+ extract_config: zod_1.z
121
+ .object({
122
+ prompt: zod_1.z.string(),
123
+ schema: zod_1.z.object({}).partial().strict().passthrough(),
124
+ })
125
+ .partial()
126
+ .strict()
127
+ .passthrough()
128
+ .optional(),
129
+ })
130
+ .strict()
131
+ .passthrough();
132
+ const CollectionDelete = zod_1.z
133
+ .object({ id: zod_1.z.string(), object: zod_1.z.literal("collection") })
134
+ .strict()
135
+ .passthrough();
136
+ const CollectionFileDelete = zod_1.z
137
+ .object({
138
+ collection_id: zod_1.z.string(),
139
+ file_id: zod_1.z.string(),
140
+ object: zod_1.z.literal("collection_file"),
141
+ })
142
+ .strict()
143
+ .passthrough();
144
+ const FileEntities = zod_1.z
145
+ .object({
146
+ collection_id: zod_1.z.string(),
147
+ file_id: zod_1.z.string(),
148
+ entities: zod_1.z.union([
149
+ zod_1.z.object({}).partial().strict().passthrough(),
150
+ zod_1.z.array(zod_1.z.any()),
151
+ ]),
152
+ segment_entities: zod_1.z
153
+ .array(zod_1.z
154
+ .object({
155
+ segment_id: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
156
+ start_time: zod_1.z.number(),
157
+ end_time: zod_1.z.number(),
158
+ entities: zod_1.z.object({}).partial().strict().passthrough(),
159
+ })
160
+ .partial()
161
+ .strict()
162
+ .passthrough())
163
+ .optional(),
164
+ total: zod_1.z.number().int(),
165
+ limit: zod_1.z.number().int(),
166
+ offset: zod_1.z.number().int(),
167
+ })
168
+ .strict()
169
+ .passthrough();
170
+ const FileDescription = zod_1.z
171
+ .object({
172
+ collection_id: zod_1.z.string(),
173
+ file_id: zod_1.z.string(),
174
+ title: zod_1.z.string().optional(),
175
+ summary: zod_1.z.string().optional(),
176
+ segment_docs: zod_1.z
177
+ .array(zod_1.z
178
+ .object({
179
+ segment_id: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
180
+ start_time: zod_1.z.number(),
181
+ end_time: zod_1.z.number(),
182
+ title: zod_1.z.string(),
183
+ summary: zod_1.z.string(),
184
+ visual_description: zod_1.z.array(zod_1.z
185
+ .object({
186
+ text: zod_1.z.string(),
187
+ start_time: zod_1.z.number(),
188
+ end_time: zod_1.z.number(),
189
+ })
190
+ .partial()
191
+ .strict()
192
+ .passthrough()),
193
+ scene_text: zod_1.z.array(zod_1.z
194
+ .object({
195
+ text: zod_1.z.string(),
196
+ start_time: zod_1.z.number(),
197
+ end_time: zod_1.z.number(),
198
+ })
199
+ .partial()
200
+ .strict()
201
+ .passthrough()),
202
+ speech: zod_1.z.array(zod_1.z
203
+ .object({
204
+ speaker: zod_1.z.string(),
205
+ text: zod_1.z.string(),
206
+ start_time: zod_1.z.number(),
207
+ end_time: zod_1.z.number(),
208
+ })
209
+ .partial()
210
+ .strict()
211
+ .passthrough()),
212
+ })
213
+ .partial()
214
+ .strict()
215
+ .passthrough())
216
+ .optional(),
217
+ total: zod_1.z.number().int().optional(),
218
+ limit: zod_1.z.number().int().optional(),
219
+ offset: zod_1.z.number().int().optional(),
220
+ })
221
+ .strict()
222
+ .passthrough();
223
+ const AddYouTubeCollectionFile = zod_1.z
224
+ .object({
225
+ url: zod_1.z.string(),
226
+ metadata: zod_1.z.object({}).partial().strict().passthrough().optional(),
227
+ })
228
+ .strict()
229
+ .passthrough();
230
+ exports.schemas = {
231
+ Collection,
232
+ CollectionList,
233
+ CollectionFile,
234
+ CollectionFileList,
235
+ NewCollection,
236
+ CollectionDelete,
237
+ CollectionFileDelete,
238
+ FileEntities,
239
+ FileDescription,
240
+ AddYouTubeCollectionFile,
241
+ };
242
+ const endpoints = (0, core_1.makeApi)([
243
+ {
244
+ method: "post",
245
+ path: "/collections",
246
+ alias: "createCollection",
247
+ description: `Create a new collection to organize and process video files`,
248
+ requestFormat: "json",
249
+ parameters: [
250
+ {
251
+ name: "body",
252
+ description: `Collection creation parameters`,
253
+ type: "Body",
254
+ schema: NewCollection,
255
+ },
256
+ ],
257
+ response: Collection,
258
+ errors: [
259
+ {
260
+ status: 400,
261
+ description: `Invalid request or malformed YouTube URL`,
262
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
263
+ },
264
+ {
265
+ status: 409,
266
+ description: `Collection name already exists for this account`,
267
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
268
+ },
269
+ {
270
+ status: 429,
271
+ description: `Too many requests`,
272
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
273
+ },
274
+ {
275
+ status: 500,
276
+ description: `An unexpected error occurred on the server`,
277
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
278
+ },
279
+ {
280
+ status: 509,
281
+ description: `Resource limits exceeded (total collections or files per collection)`,
282
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
283
+ },
284
+ ],
285
+ },
286
+ {
287
+ method: "get",
288
+ path: "/collections",
289
+ alias: "listCollections",
290
+ description: `List all collections`,
291
+ requestFormat: "json",
292
+ parameters: [
293
+ {
294
+ name: "limit",
295
+ type: "Query",
296
+ schema: zod_1.z.number().int().lte(100).optional().default(50),
297
+ },
298
+ {
299
+ name: "offset",
300
+ type: "Query",
301
+ schema: zod_1.z.number().int().optional().default(0),
302
+ },
303
+ {
304
+ name: "order",
305
+ type: "Query",
306
+ schema: zod_1.z.enum(["name", "created_at"]).optional().default("created_at"),
307
+ },
308
+ {
309
+ name: "sort",
310
+ type: "Query",
311
+ schema: zod_1.z.enum(["asc", "desc"]).optional().default("desc"),
312
+ },
313
+ ],
314
+ response: CollectionList,
315
+ errors: [
316
+ {
317
+ status: 500,
318
+ description: `An unexpected error occurred on the server`,
319
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
320
+ },
321
+ ],
322
+ },
323
+ {
324
+ method: "get",
325
+ path: "/collections/:collection_id",
326
+ alias: "getCollection",
327
+ description: `Retrieve details about a specific collection`,
328
+ requestFormat: "json",
329
+ parameters: [
330
+ {
331
+ name: "collection_id",
332
+ type: "Path",
333
+ schema: zod_1.z.string(),
334
+ },
335
+ ],
336
+ response: Collection,
337
+ errors: [
338
+ {
339
+ status: 404,
340
+ description: `Collection not found`,
341
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
342
+ },
343
+ {
344
+ status: 500,
345
+ description: `An unexpected error occurred on the server`,
346
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
347
+ },
348
+ ],
349
+ },
350
+ {
351
+ method: "delete",
352
+ path: "/collections/:collection_id",
353
+ alias: "deleteCollection",
354
+ description: `Delete a collection`,
355
+ requestFormat: "json",
356
+ parameters: [
357
+ {
358
+ name: "collection_id",
359
+ type: "Path",
360
+ schema: zod_1.z.string(),
361
+ },
362
+ ],
363
+ response: CollectionDelete,
364
+ errors: [
365
+ {
366
+ status: 404,
367
+ description: `Collection not found`,
368
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
369
+ },
370
+ {
371
+ status: 500,
372
+ description: `An unexpected error occurred on the server`,
373
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
374
+ },
375
+ ],
376
+ },
377
+ {
378
+ method: "post",
379
+ path: "/collections/:collection_id/videos",
380
+ alias: "addVideo",
381
+ description: `Add a video to a collection`,
382
+ requestFormat: "json",
383
+ parameters: [
384
+ {
385
+ name: "body",
386
+ description: `File association parameters`,
387
+ type: "Body",
388
+ schema: zod_1.z.object({ file_id: zod_1.z.string() }).strict().passthrough(),
389
+ },
390
+ {
391
+ name: "collection_id",
392
+ type: "Path",
393
+ schema: zod_1.z.string(),
394
+ },
395
+ ],
396
+ response: CollectionFile,
397
+ errors: [
398
+ {
399
+ status: 400,
400
+ description: `Invalid request`,
401
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
402
+ },
403
+ {
404
+ status: 404,
405
+ description: `Collection or file not found`,
406
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
407
+ },
408
+ {
409
+ status: 500,
410
+ description: `An unexpected error occurred on the server`,
411
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
412
+ },
413
+ ],
414
+ },
415
+ {
416
+ method: "get",
417
+ path: "/collections/:collection_id/videos",
418
+ alias: "listVideos",
419
+ description: `List all files in a collection`,
420
+ requestFormat: "json",
421
+ parameters: [
422
+ {
423
+ name: "collection_id",
424
+ type: "Path",
425
+ schema: zod_1.z.string(),
426
+ },
427
+ {
428
+ name: "limit",
429
+ type: "Query",
430
+ schema: zod_1.z.number().int().lte(100).optional().default(50),
431
+ },
432
+ {
433
+ name: "offset",
434
+ type: "Query",
435
+ schema: zod_1.z.number().int().optional().default(0),
436
+ },
437
+ {
438
+ name: "status",
439
+ type: "Query",
440
+ schema: zod_1.z
441
+ .enum([
442
+ "pending",
443
+ "processing",
444
+ "ready",
445
+ "completed",
446
+ "failed",
447
+ "not_applicable",
448
+ ])
449
+ .optional(),
450
+ },
451
+ {
452
+ name: "order",
453
+ type: "Query",
454
+ schema: zod_1.z.enum(["added_at", "filename"]).optional().default("added_at"),
455
+ },
456
+ {
457
+ name: "sort",
458
+ type: "Query",
459
+ schema: zod_1.z.enum(["asc", "desc"]).optional().default("desc"),
460
+ },
461
+ ],
462
+ response: CollectionFileList,
463
+ errors: [
464
+ {
465
+ status: 404,
466
+ description: `Collection not found`,
467
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
468
+ },
469
+ {
470
+ status: 500,
471
+ description: `An unexpected error occurred on the server`,
472
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
473
+ },
474
+ ],
475
+ },
476
+ {
477
+ method: "get",
478
+ path: "/collections/:collection_id/videos/:file_id",
479
+ alias: "getVideo",
480
+ description: `Retrieve information about a specific video file in a collection`,
481
+ requestFormat: "json",
482
+ parameters: [
483
+ {
484
+ name: "collection_id",
485
+ type: "Path",
486
+ schema: zod_1.z.string(),
487
+ },
488
+ {
489
+ name: "file_id",
490
+ type: "Path",
491
+ schema: zod_1.z.string(),
492
+ },
493
+ ],
494
+ response: CollectionFile,
495
+ errors: [
496
+ {
497
+ status: 404,
498
+ description: `Collection or file not found`,
499
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
500
+ },
501
+ {
502
+ status: 500,
503
+ description: `An unexpected error occurred on the server`,
504
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
505
+ },
506
+ ],
507
+ },
508
+ {
509
+ method: "delete",
510
+ path: "/collections/:collection_id/videos/:file_id",
511
+ alias: "deleteVideo",
512
+ description: `Remove a video file from a collection`,
513
+ requestFormat: "json",
514
+ parameters: [
515
+ {
516
+ name: "collection_id",
517
+ type: "Path",
518
+ schema: zod_1.z.string(),
519
+ },
520
+ {
521
+ name: "file_id",
522
+ type: "Path",
523
+ schema: zod_1.z.string(),
524
+ },
525
+ ],
526
+ response: CollectionFileDelete,
527
+ errors: [
528
+ {
529
+ status: 404,
530
+ description: `Collection or file not found`,
531
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
532
+ },
533
+ {
534
+ status: 500,
535
+ description: `An unexpected error occurred on the server`,
536
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
537
+ },
538
+ ],
539
+ },
540
+ {
541
+ method: "get",
542
+ path: "/collections/:collection_id/videos/:file_id/entities",
543
+ alias: "getEntities",
544
+ description: `Retrieve all extracted entities for a specific file in a collection`,
545
+ requestFormat: "json",
546
+ parameters: [
547
+ {
548
+ name: "collection_id",
549
+ type: "Path",
550
+ schema: zod_1.z.string(),
551
+ },
552
+ {
553
+ name: "file_id",
554
+ type: "Path",
555
+ schema: zod_1.z.string(),
556
+ },
557
+ {
558
+ name: "limit",
559
+ type: "Query",
560
+ schema: zod_1.z.number().int().lte(100).optional().default(50),
561
+ },
562
+ {
563
+ name: "offset",
564
+ type: "Query",
565
+ schema: zod_1.z.number().int().optional().default(0),
566
+ },
567
+ ],
568
+ response: FileEntities,
569
+ errors: [
570
+ {
571
+ status: 404,
572
+ description: `Collection or file not found`,
573
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
574
+ },
575
+ {
576
+ status: 500,
577
+ description: `An unexpected error occurred on the server`,
578
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
579
+ },
580
+ ],
581
+ },
582
+ {
583
+ method: "get",
584
+ path: "/collections/:collection_id/videos/:file_id/description",
585
+ alias: "getDescription",
586
+ description: `Retrieve the processed video summary description and segment documents for a file in a collection`,
587
+ requestFormat: "json",
588
+ parameters: [
589
+ {
590
+ name: "collection_id",
591
+ type: "Path",
592
+ schema: zod_1.z.string(),
593
+ },
594
+ {
595
+ name: "file_id",
596
+ type: "Path",
597
+ schema: zod_1.z.string(),
598
+ },
599
+ {
600
+ name: "limit",
601
+ type: "Query",
602
+ schema: zod_1.z.number().int().lte(100).optional().default(50),
603
+ },
604
+ {
605
+ name: "offset",
606
+ type: "Query",
607
+ schema: zod_1.z.number().int().optional().default(0),
608
+ },
609
+ ],
610
+ response: FileDescription,
611
+ errors: [
612
+ {
613
+ status: 404,
614
+ description: `Collection or file not found`,
615
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
616
+ },
617
+ {
618
+ status: 500,
619
+ description: `An unexpected error occurred on the server`,
620
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
621
+ },
622
+ ],
623
+ },
624
+ {
625
+ method: "post",
626
+ path: "/collections/:collection_id/youtube",
627
+ alias: "addYouTubeVideo",
628
+ description: `Add a YouTube video to a collection by URL`,
629
+ requestFormat: "json",
630
+ parameters: [
631
+ {
632
+ name: "body",
633
+ description: `YouTube video URL parameters`,
634
+ type: "Body",
635
+ schema: AddYouTubeCollectionFile,
636
+ },
637
+ {
638
+ name: "collection_id",
639
+ type: "Path",
640
+ schema: zod_1.z.string(),
641
+ },
642
+ ],
643
+ response: CollectionFile,
644
+ errors: [
645
+ {
646
+ status: 400,
647
+ description: `Invalid request or YouTube URL`,
648
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
649
+ },
650
+ {
651
+ status: 404,
652
+ description: `Collection not found`,
653
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
654
+ },
655
+ {
656
+ status: 500,
657
+ description: `An unexpected error occurred on the server`,
658
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
659
+ },
660
+ ],
661
+ },
662
+ ]);
663
+ exports.CollectionsApi = new core_1.Zodios("https://api.cloudglue.dev/v1", endpoints);
664
+ function createApiClient(baseUrl, options) {
665
+ return new core_1.Zodios(baseUrl, endpoints, options);
666
+ }