@aviaryhq/cloudglue-js 0.1.2 → 0.1.4

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.
@@ -5,6 +5,7 @@ exports.createApiClient = createApiClient;
5
5
  const core_1 = require("@zodios/core");
6
6
  const zod_1 = require("zod");
7
7
  const common_1 = require("./common");
8
+ const common_2 = require("./common");
8
9
  const FileList = zod_1.z
9
10
  .object({
10
11
  object: zod_1.z.literal("list"),
@@ -15,6 +16,16 @@ const FileList = zod_1.z
15
16
  })
16
17
  .strict()
17
18
  .passthrough();
19
+ const SegmentationList = zod_1.z
20
+ .object({
21
+ object: zod_1.z.literal("list"),
22
+ data: zod_1.z.array(common_2.Segmentation),
23
+ total: zod_1.z.number().int(),
24
+ limit: zod_1.z.number().int(),
25
+ offset: zod_1.z.number().int(),
26
+ })
27
+ .strict()
28
+ .passthrough();
18
29
  const FileUpload = zod_1.z
19
30
  .object({
20
31
  file: zod_1.z.instanceof(File),
@@ -36,6 +47,7 @@ const FileUpdate = zod_1.z
36
47
  .passthrough();
37
48
  exports.schemas = {
38
49
  FileList,
50
+ SegmentationList,
39
51
  FileUpload,
40
52
  FileDelete,
41
53
  FileUpdate,
@@ -224,6 +236,81 @@ const endpoints = (0, core_1.makeApi)([
224
236
  },
225
237
  ],
226
238
  },
239
+ {
240
+ method: "post",
241
+ path: "/files/:file_id/segmentations",
242
+ alias: "createFileSegmentation",
243
+ description: `Create a new segmentation for a file using the specified segmentation configuration`,
244
+ requestFormat: "json",
245
+ parameters: [
246
+ {
247
+ name: "body",
248
+ description: `Segmentation configuration`,
249
+ type: "Body",
250
+ schema: common_2.SegmentationConfig,
251
+ },
252
+ {
253
+ name: "file_id",
254
+ type: "Path",
255
+ schema: zod_1.z.string().uuid(),
256
+ },
257
+ ],
258
+ response: common_2.Segmentation,
259
+ errors: [
260
+ {
261
+ status: 400,
262
+ description: `Invalid request or file duration is less than window size`,
263
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
264
+ },
265
+ {
266
+ status: 404,
267
+ description: `File not found`,
268
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
269
+ },
270
+ {
271
+ status: 500,
272
+ description: `An unexpected error occurred on the server`,
273
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
274
+ },
275
+ ],
276
+ },
277
+ {
278
+ method: "get",
279
+ path: "/files/:file_id/segmentations",
280
+ alias: "listFileSegmentations",
281
+ description: `List all segmentations for a specific file`,
282
+ requestFormat: "json",
283
+ parameters: [
284
+ {
285
+ name: "file_id",
286
+ type: "Path",
287
+ schema: zod_1.z.string().uuid(),
288
+ },
289
+ {
290
+ name: "limit",
291
+ type: "Query",
292
+ schema: zod_1.z.number().int().gte(1).lte(100).optional().default(50),
293
+ },
294
+ {
295
+ name: "offset",
296
+ type: "Query",
297
+ schema: zod_1.z.number().int().gte(0).optional().default(0),
298
+ },
299
+ ],
300
+ response: SegmentationList,
301
+ errors: [
302
+ {
303
+ status: 404,
304
+ description: `File not found`,
305
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
306
+ },
307
+ {
308
+ status: 500,
309
+ description: `An unexpected error occurred on the server`,
310
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
311
+ },
312
+ ],
313
+ },
227
314
  ]);
228
315
  exports.FilesApi = new core_1.Zodios("https://api.cloudglue.dev/v1", endpoints);
229
316
  function createApiClient(baseUrl, options) {
@@ -0,0 +1,190 @@
1
+ import { type ZodiosOptions } from "@zodios/core";
2
+ import { z } from "zod";
3
+ type SearchResponse = {
4
+ object: "search";
5
+ query: string;
6
+ scope: "file" | "segment";
7
+ results: Array<FileSearchResult | SegmentSearchResult>;
8
+ total: number;
9
+ limit: number;
10
+ };
11
+ type SearchRequest = {
12
+ scope: "file" | "segment";
13
+ collections: Array<string>;
14
+ query: string;
15
+ limit?: number | undefined;
16
+ filter?: SearchFilter | undefined;
17
+ };
18
+ type FileSearchResult = {
19
+ type: "file";
20
+ file_id: string;
21
+ collection_id: string;
22
+ id: string;
23
+ score: number;
24
+ filename?: (string | null) | undefined;
25
+ summary?: (string | null) | undefined;
26
+ generated_title?: (string | null) | undefined;
27
+ };
28
+ type SegmentSearchResult = {
29
+ type: "segment";
30
+ file_id: string;
31
+ collection_id: string;
32
+ segment_id: string;
33
+ id: string;
34
+ score: number;
35
+ start_time: number;
36
+ end_time: number;
37
+ title?: (string | null) | undefined;
38
+ filename?: (string | null) | undefined;
39
+ visual_description?: Array<Partial<{
40
+ text: string;
41
+ start_time: number;
42
+ end_time: number;
43
+ }>> | undefined;
44
+ scene_text?: Array<Partial<{
45
+ text: string;
46
+ start_time: number;
47
+ end_time: number;
48
+ }>> | undefined;
49
+ speech?: Array<Partial<{
50
+ text: string;
51
+ start_time: number;
52
+ end_time: number;
53
+ }>> | undefined;
54
+ };
55
+ type SearchFilter = Partial<{
56
+ metadata: Array<SearchFilterCriteria>;
57
+ video_info: Array<SearchFilterCriteria & Partial<{
58
+ path: "duration_seconds" | "has_audio";
59
+ }>>;
60
+ file: Array<SearchFilterCriteria & Partial<{
61
+ path: "bytes" | "filename" | "uri" | "created_at" | "id";
62
+ }>>;
63
+ }>;
64
+ type SearchFilterCriteria = {
65
+ path: string;
66
+ operator: "NotEqual" | "Equal" | "LessThan" | "GreaterThan" | "ContainsAny" | "ContainsAll" | "In";
67
+ valueText?: string | undefined;
68
+ valueTextArray?: Array<string> | undefined;
69
+ };
70
+ declare const SearchFilterCriteria: z.ZodType<SearchFilterCriteria>;
71
+ declare const SearchFilter: z.ZodType<SearchFilter>;
72
+ declare const SearchRequest: z.ZodType<SearchRequest>;
73
+ declare const FileSearchResult: z.ZodType<FileSearchResult>;
74
+ declare const SegmentSearchResult: z.ZodType<SegmentSearchResult>;
75
+ declare const SearchResponse: z.ZodType<SearchResponse>;
76
+ export declare const schemas: {
77
+ SearchFilterCriteria: z.ZodType<SearchFilterCriteria, z.ZodTypeDef, SearchFilterCriteria>;
78
+ SearchFilter: z.ZodType<Partial<{
79
+ metadata: Array<SearchFilterCriteria>;
80
+ video_info: Array<SearchFilterCriteria & Partial<{
81
+ path: "duration_seconds" | "has_audio";
82
+ }>>;
83
+ file: Array<SearchFilterCriteria & Partial<{
84
+ path: "bytes" | "filename" | "uri" | "created_at" | "id";
85
+ }>>;
86
+ }>, z.ZodTypeDef, Partial<{
87
+ metadata: Array<SearchFilterCriteria>;
88
+ video_info: Array<SearchFilterCriteria & Partial<{
89
+ path: "duration_seconds" | "has_audio";
90
+ }>>;
91
+ file: Array<SearchFilterCriteria & Partial<{
92
+ path: "bytes" | "filename" | "uri" | "created_at" | "id";
93
+ }>>;
94
+ }>>;
95
+ SearchRequest: z.ZodType<SearchRequest, z.ZodTypeDef, SearchRequest>;
96
+ FileSearchResult: z.ZodType<FileSearchResult, z.ZodTypeDef, FileSearchResult>;
97
+ SegmentSearchResult: z.ZodType<SegmentSearchResult, z.ZodTypeDef, SegmentSearchResult>;
98
+ SearchResponse: z.ZodType<SearchResponse, z.ZodTypeDef, SearchResponse>;
99
+ };
100
+ export declare const SearchApi: import("@zodios/core").ZodiosInstance<[{
101
+ method: "post";
102
+ path: "/search";
103
+ alias: "searchContent";
104
+ description: "Search for videos or video segments in collections to find relevant videos or moments/clips in a video. Supports filtering by metadata, video info, and file properties.\n\n**Important:** Currently only rich-transcript collections support search. For file-level search (scope&#x3D;&#x27;file&#x27;), the collection must be configured with &#x27;enable_summary: true&#x27; in the transcribe_config.";
105
+ requestFormat: "json";
106
+ parameters: [{
107
+ name: "body";
108
+ description: string;
109
+ type: "Body";
110
+ schema: z.ZodType<SearchRequest, z.ZodTypeDef, SearchRequest>;
111
+ }];
112
+ response: z.ZodType<SearchResponse, z.ZodTypeDef, SearchResponse>;
113
+ errors: [{
114
+ status: 400;
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: 404;
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
+ status: 500;
135
+ description: string;
136
+ schema: z.ZodObject<{
137
+ error: z.ZodString;
138
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
139
+ error: z.ZodString;
140
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
141
+ error: z.ZodString;
142
+ }, z.ZodTypeAny, "passthrough">>;
143
+ }];
144
+ }]>;
145
+ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions): import("@zodios/core").ZodiosInstance<[{
146
+ method: "post";
147
+ path: "/search";
148
+ alias: "searchContent";
149
+ description: "Search for videos or video segments in collections to find relevant videos or moments/clips in a video. Supports filtering by metadata, video info, and file properties.\n\n**Important:** Currently only rich-transcript collections support search. For file-level search (scope&#x3D;&#x27;file&#x27;), the collection must be configured with &#x27;enable_summary: true&#x27; in the transcribe_config.";
150
+ requestFormat: "json";
151
+ parameters: [{
152
+ name: "body";
153
+ description: string;
154
+ type: "Body";
155
+ schema: z.ZodType<SearchRequest, z.ZodTypeDef, SearchRequest>;
156
+ }];
157
+ response: z.ZodType<SearchResponse, z.ZodTypeDef, SearchResponse>;
158
+ errors: [{
159
+ status: 400;
160
+ description: string;
161
+ schema: z.ZodObject<{
162
+ error: z.ZodString;
163
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
164
+ error: z.ZodString;
165
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
166
+ error: z.ZodString;
167
+ }, z.ZodTypeAny, "passthrough">>;
168
+ }, {
169
+ status: 404;
170
+ description: string;
171
+ schema: z.ZodObject<{
172
+ error: z.ZodString;
173
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
174
+ error: z.ZodString;
175
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
176
+ error: z.ZodString;
177
+ }, z.ZodTypeAny, "passthrough">>;
178
+ }, {
179
+ status: 500;
180
+ description: string;
181
+ schema: z.ZodObject<{
182
+ error: z.ZodString;
183
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
184
+ error: z.ZodString;
185
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
186
+ error: z.ZodString;
187
+ }, z.ZodTypeAny, "passthrough">>;
188
+ }];
189
+ }]>;
190
+ export {};
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchApi = exports.schemas = void 0;
4
+ exports.createApiClient = createApiClient;
5
+ const core_1 = require("@zodios/core");
6
+ const zod_1 = require("zod");
7
+ const SearchFilterCriteria = zod_1.z
8
+ .object({
9
+ path: zod_1.z.string(),
10
+ operator: zod_1.z.enum([
11
+ "NotEqual",
12
+ "Equal",
13
+ "LessThan",
14
+ "GreaterThan",
15
+ "ContainsAny",
16
+ "ContainsAll",
17
+ "In",
18
+ ]),
19
+ valueText: zod_1.z.string().optional(),
20
+ valueTextArray: zod_1.z.array(zod_1.z.string()).optional(),
21
+ })
22
+ .strict()
23
+ .passthrough();
24
+ const SearchFilter = zod_1.z
25
+ .object({
26
+ metadata: zod_1.z.array(SearchFilterCriteria),
27
+ video_info: zod_1.z.array(SearchFilterCriteria.and(zod_1.z
28
+ .object({ path: zod_1.z.enum(["duration_seconds", "has_audio"]) })
29
+ .partial()
30
+ .strict()
31
+ .passthrough())),
32
+ file: zod_1.z.array(SearchFilterCriteria.and(zod_1.z
33
+ .object({
34
+ path: zod_1.z.enum(["bytes", "filename", "uri", "created_at", "id"]),
35
+ })
36
+ .partial()
37
+ .strict()
38
+ .passthrough())),
39
+ })
40
+ .partial()
41
+ .strict()
42
+ .passthrough();
43
+ const SearchRequest = zod_1.z
44
+ .object({
45
+ scope: zod_1.z.enum(["file", "segment"]),
46
+ collections: zod_1.z.array(zod_1.z.string().uuid()).min(1),
47
+ query: zod_1.z.string().min(1),
48
+ limit: zod_1.z.number().int().gte(1).lte(100).optional().default(10),
49
+ filter: SearchFilter.optional(),
50
+ })
51
+ .strict()
52
+ .passthrough();
53
+ const FileSearchResult = zod_1.z
54
+ .object({
55
+ type: zod_1.z.literal("file"),
56
+ file_id: zod_1.z.string().uuid(),
57
+ collection_id: zod_1.z.string().uuid(),
58
+ id: zod_1.z.string().uuid(),
59
+ score: zod_1.z.number().gte(0).lte(1),
60
+ filename: zod_1.z.string().nullish(),
61
+ summary: zod_1.z.string().nullish(),
62
+ generated_title: zod_1.z.string().nullish(),
63
+ })
64
+ .strict()
65
+ .passthrough();
66
+ const SegmentSearchResult = zod_1.z
67
+ .object({
68
+ type: zod_1.z.literal("segment"),
69
+ file_id: zod_1.z.string().uuid(),
70
+ collection_id: zod_1.z.string().uuid(),
71
+ segment_id: zod_1.z.string().uuid(),
72
+ id: zod_1.z.string().uuid(),
73
+ score: zod_1.z.number().gte(0).lte(1),
74
+ start_time: zod_1.z.number(),
75
+ end_time: zod_1.z.number(),
76
+ title: zod_1.z.string().nullish(),
77
+ filename: zod_1.z.string().nullish(),
78
+ visual_description: zod_1.z
79
+ .array(zod_1.z
80
+ .object({
81
+ text: zod_1.z.string(),
82
+ start_time: zod_1.z.number(),
83
+ end_time: zod_1.z.number(),
84
+ })
85
+ .partial()
86
+ .strict()
87
+ .passthrough())
88
+ .optional(),
89
+ scene_text: zod_1.z
90
+ .array(zod_1.z
91
+ .object({
92
+ text: zod_1.z.string(),
93
+ start_time: zod_1.z.number(),
94
+ end_time: zod_1.z.number(),
95
+ })
96
+ .partial()
97
+ .strict()
98
+ .passthrough())
99
+ .optional(),
100
+ speech: zod_1.z
101
+ .array(zod_1.z
102
+ .object({
103
+ text: zod_1.z.string(),
104
+ start_time: zod_1.z.number(),
105
+ end_time: zod_1.z.number(),
106
+ })
107
+ .partial()
108
+ .strict()
109
+ .passthrough())
110
+ .optional(),
111
+ })
112
+ .strict()
113
+ .passthrough();
114
+ const SearchResponse = zod_1.z
115
+ .object({
116
+ object: zod_1.z.literal("search"),
117
+ query: zod_1.z.string(),
118
+ scope: zod_1.z.enum(["file", "segment"]),
119
+ results: zod_1.z.array(zod_1.z.union([FileSearchResult, SegmentSearchResult])),
120
+ total: zod_1.z.number().int(),
121
+ limit: zod_1.z.number().int(),
122
+ })
123
+ .strict()
124
+ .passthrough();
125
+ exports.schemas = {
126
+ SearchFilterCriteria,
127
+ SearchFilter,
128
+ SearchRequest,
129
+ FileSearchResult,
130
+ SegmentSearchResult,
131
+ SearchResponse,
132
+ };
133
+ const endpoints = (0, core_1.makeApi)([
134
+ {
135
+ method: "post",
136
+ path: "/search",
137
+ alias: "searchContent",
138
+ description: `Search for videos or video segments in collections to find relevant videos or moments/clips in a video. Supports filtering by metadata, video info, and file properties.
139
+
140
+ **Important:** Currently only rich-transcript collections support search. For file-level search (scope&#x3D;&#x27;file&#x27;), the collection must be configured with &#x27;enable_summary: true&#x27; in the transcribe_config.`,
141
+ requestFormat: "json",
142
+ parameters: [
143
+ {
144
+ name: "body",
145
+ description: `Search parameters`,
146
+ type: "Body",
147
+ schema: SearchRequest,
148
+ },
149
+ ],
150
+ response: SearchResponse,
151
+ errors: [
152
+ {
153
+ status: 400,
154
+ description: `Invalid request parameters`,
155
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
156
+ },
157
+ {
158
+ status: 404,
159
+ description: `Collection not found`,
160
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
161
+ },
162
+ {
163
+ status: 500,
164
+ description: `An unexpected error occurred on the server`,
165
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
166
+ },
167
+ ],
168
+ },
169
+ ]);
170
+ exports.SearchApi = new core_1.Zodios("https://api.cloudglue.dev/v1", endpoints);
171
+ function createApiClient(baseUrl, options) {
172
+ return new core_1.Zodios(baseUrl, endpoints, options);
173
+ }