@indreamai/client 0.3.0 → 0.4.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/index.cjs +163 -0
- package/dist/index.d.cts +511 -74
- package/dist/index.d.ts +511 -74
- package/dist/index.js +161 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -203,6 +203,163 @@ var EditorResource = class {
|
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
+
// src/resources/materials.ts
|
|
207
|
+
var MaterialsResource = class {
|
|
208
|
+
constructor(client) {
|
|
209
|
+
this.client = client;
|
|
210
|
+
}
|
|
211
|
+
async searchIllustrations(params) {
|
|
212
|
+
var _a;
|
|
213
|
+
const q = params.q.trim();
|
|
214
|
+
if (!q) {
|
|
215
|
+
throw new Error("q is required");
|
|
216
|
+
}
|
|
217
|
+
const search = new URLSearchParams({ q });
|
|
218
|
+
if (params.pageSize) {
|
|
219
|
+
search.set("pageSize", String(params.pageSize));
|
|
220
|
+
}
|
|
221
|
+
if (params.pageCursor) {
|
|
222
|
+
search.set("pageCursor", params.pageCursor);
|
|
223
|
+
}
|
|
224
|
+
const envelope = await this.client.requestEnvelope(
|
|
225
|
+
`/v1/illustrations?${search.toString()}`,
|
|
226
|
+
{
|
|
227
|
+
method: "GET",
|
|
228
|
+
signal: params.signal
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
return {
|
|
232
|
+
items: envelope.data || [],
|
|
233
|
+
nextPageCursor: typeof ((_a = envelope.meta) == null ? void 0 : _a.nextPageCursor) === "string" ? envelope.meta.nextPageCursor : null
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
async searchVoices(params = {}) {
|
|
237
|
+
var _a;
|
|
238
|
+
const search = new URLSearchParams();
|
|
239
|
+
const q = (_a = params.q) == null ? void 0 : _a.trim();
|
|
240
|
+
if (q) {
|
|
241
|
+
search.set("q", q);
|
|
242
|
+
}
|
|
243
|
+
if (params.pageSize) {
|
|
244
|
+
search.set("pageSize", String(params.pageSize));
|
|
245
|
+
}
|
|
246
|
+
if (params.scope) {
|
|
247
|
+
search.set("scope", params.scope);
|
|
248
|
+
}
|
|
249
|
+
const query = search.toString();
|
|
250
|
+
return await this.client.request(`/v1/voices${query ? `?${query}` : ""}`, {
|
|
251
|
+
method: "GET",
|
|
252
|
+
signal: params.signal
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// src/resources/media.ts
|
|
258
|
+
var MediaResource = class {
|
|
259
|
+
constructor(client) {
|
|
260
|
+
this.client = client;
|
|
261
|
+
}
|
|
262
|
+
async listMediaModels(params) {
|
|
263
|
+
var _a, _b;
|
|
264
|
+
const search = new URLSearchParams({ type: params.type });
|
|
265
|
+
if (params.assetMode) {
|
|
266
|
+
search.set("assetMode", params.assetMode);
|
|
267
|
+
}
|
|
268
|
+
const q = (_a = params.q) == null ? void 0 : _a.trim();
|
|
269
|
+
if (q) {
|
|
270
|
+
search.set("q", q);
|
|
271
|
+
}
|
|
272
|
+
if (params.pageSize) {
|
|
273
|
+
search.set("pageSize", String(params.pageSize));
|
|
274
|
+
}
|
|
275
|
+
if (params.pageCursor) {
|
|
276
|
+
search.set("pageCursor", params.pageCursor);
|
|
277
|
+
}
|
|
278
|
+
const envelope = await this.client.requestEnvelope(
|
|
279
|
+
`/v1/media/models?${search.toString()}`,
|
|
280
|
+
{
|
|
281
|
+
method: "GET",
|
|
282
|
+
signal: params.signal
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
return {
|
|
286
|
+
items: envelope.data || [],
|
|
287
|
+
nextPageCursor: typeof ((_b = envelope.meta) == null ? void 0 : _b.nextPageCursor) === "string" ? envelope.meta.nextPageCursor : null
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
async getMediaModel(capabilityKey, options = {}) {
|
|
291
|
+
const key = capabilityKey.trim();
|
|
292
|
+
if (!key) {
|
|
293
|
+
throw new Error("capabilityKey is required");
|
|
294
|
+
}
|
|
295
|
+
return await this.client.request(
|
|
296
|
+
`/v1/media/models/${encodeURIComponent(key)}`,
|
|
297
|
+
{
|
|
298
|
+
method: "GET",
|
|
299
|
+
signal: options.signal
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
async recommendMediaModels(payload, options = {}) {
|
|
304
|
+
return await this.client.request(
|
|
305
|
+
"/v1/media/models/operations/recommend",
|
|
306
|
+
{
|
|
307
|
+
method: "POST",
|
|
308
|
+
body: payload,
|
|
309
|
+
signal: options.signal
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
async generateImage(payload, options = {}) {
|
|
314
|
+
var _a;
|
|
315
|
+
return await this.client.request("/v1/media/images/operations/generate", {
|
|
316
|
+
method: "POST",
|
|
317
|
+
body: payload,
|
|
318
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
319
|
+
signal: options.signal
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
async generateVideo(payload, options = {}) {
|
|
323
|
+
var _a;
|
|
324
|
+
return await this.client.request("/v1/media/videos/operations/generate", {
|
|
325
|
+
method: "POST",
|
|
326
|
+
body: payload,
|
|
327
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
328
|
+
signal: options.signal
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
async generateMusic(payload, options = {}) {
|
|
332
|
+
var _a;
|
|
333
|
+
return await this.client.request("/v1/media/musics/operations/generate", {
|
|
334
|
+
method: "POST",
|
|
335
|
+
body: payload,
|
|
336
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
337
|
+
signal: options.signal
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
async createTts(payload, options = {}) {
|
|
341
|
+
var _a;
|
|
342
|
+
return await this.client.request("/v1/media/audios/operations/tts", {
|
|
343
|
+
method: "POST",
|
|
344
|
+
body: payload,
|
|
345
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
346
|
+
signal: options.signal
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async createAutoCaptions(payload, options = {}) {
|
|
350
|
+
var _a;
|
|
351
|
+
return await this.client.request(
|
|
352
|
+
"/v1/media/audios/operations/auto-captions",
|
|
353
|
+
{
|
|
354
|
+
method: "POST",
|
|
355
|
+
body: payload,
|
|
356
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
357
|
+
signal: options.signal
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
206
363
|
// src/resources/projects.ts
|
|
207
364
|
var ProjectsResource = class {
|
|
208
365
|
constructor(client) {
|
|
@@ -416,6 +573,8 @@ var IndreamClient = class {
|
|
|
416
573
|
this.fetchImpl = options.fetch || fetch;
|
|
417
574
|
this.exports = new ExportsResource(this);
|
|
418
575
|
this.editor = new EditorResource(this);
|
|
576
|
+
this.materials = new MaterialsResource(this);
|
|
577
|
+
this.media = new MediaResource(this);
|
|
419
578
|
this.projects = new ProjectsResource(this);
|
|
420
579
|
this.uploads = new UploadsResource(this);
|
|
421
580
|
this.assets = new AssetsResource(this);
|
|
@@ -681,6 +840,8 @@ export {
|
|
|
681
840
|
EditorResource,
|
|
682
841
|
ExportsResource,
|
|
683
842
|
IndreamClient,
|
|
843
|
+
MaterialsResource,
|
|
844
|
+
MediaResource,
|
|
684
845
|
ProjectsResource,
|
|
685
846
|
RateLimitError,
|
|
686
847
|
UploadsResource,
|