@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.cjs
CHANGED
|
@@ -40,6 +40,8 @@ __export(index_exports, {
|
|
|
40
40
|
EditorResource: () => EditorResource,
|
|
41
41
|
ExportsResource: () => ExportsResource,
|
|
42
42
|
IndreamClient: () => IndreamClient,
|
|
43
|
+
MaterialsResource: () => MaterialsResource,
|
|
44
|
+
MediaResource: () => MediaResource,
|
|
43
45
|
ProjectsResource: () => ProjectsResource,
|
|
44
46
|
RateLimitError: () => RateLimitError,
|
|
45
47
|
UploadsResource: () => UploadsResource,
|
|
@@ -244,6 +246,163 @@ var EditorResource = class {
|
|
|
244
246
|
}
|
|
245
247
|
};
|
|
246
248
|
|
|
249
|
+
// src/resources/materials.ts
|
|
250
|
+
var MaterialsResource = class {
|
|
251
|
+
constructor(client) {
|
|
252
|
+
this.client = client;
|
|
253
|
+
}
|
|
254
|
+
async searchIllustrations(params) {
|
|
255
|
+
var _a;
|
|
256
|
+
const q = params.q.trim();
|
|
257
|
+
if (!q) {
|
|
258
|
+
throw new Error("q is required");
|
|
259
|
+
}
|
|
260
|
+
const search = new URLSearchParams({ q });
|
|
261
|
+
if (params.pageSize) {
|
|
262
|
+
search.set("pageSize", String(params.pageSize));
|
|
263
|
+
}
|
|
264
|
+
if (params.pageCursor) {
|
|
265
|
+
search.set("pageCursor", params.pageCursor);
|
|
266
|
+
}
|
|
267
|
+
const envelope = await this.client.requestEnvelope(
|
|
268
|
+
`/v1/illustrations?${search.toString()}`,
|
|
269
|
+
{
|
|
270
|
+
method: "GET",
|
|
271
|
+
signal: params.signal
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
return {
|
|
275
|
+
items: envelope.data || [],
|
|
276
|
+
nextPageCursor: typeof ((_a = envelope.meta) == null ? void 0 : _a.nextPageCursor) === "string" ? envelope.meta.nextPageCursor : null
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
async searchVoices(params = {}) {
|
|
280
|
+
var _a;
|
|
281
|
+
const search = new URLSearchParams();
|
|
282
|
+
const q = (_a = params.q) == null ? void 0 : _a.trim();
|
|
283
|
+
if (q) {
|
|
284
|
+
search.set("q", q);
|
|
285
|
+
}
|
|
286
|
+
if (params.pageSize) {
|
|
287
|
+
search.set("pageSize", String(params.pageSize));
|
|
288
|
+
}
|
|
289
|
+
if (params.scope) {
|
|
290
|
+
search.set("scope", params.scope);
|
|
291
|
+
}
|
|
292
|
+
const query = search.toString();
|
|
293
|
+
return await this.client.request(`/v1/voices${query ? `?${query}` : ""}`, {
|
|
294
|
+
method: "GET",
|
|
295
|
+
signal: params.signal
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// src/resources/media.ts
|
|
301
|
+
var MediaResource = class {
|
|
302
|
+
constructor(client) {
|
|
303
|
+
this.client = client;
|
|
304
|
+
}
|
|
305
|
+
async listMediaModels(params) {
|
|
306
|
+
var _a, _b;
|
|
307
|
+
const search = new URLSearchParams({ type: params.type });
|
|
308
|
+
if (params.assetMode) {
|
|
309
|
+
search.set("assetMode", params.assetMode);
|
|
310
|
+
}
|
|
311
|
+
const q = (_a = params.q) == null ? void 0 : _a.trim();
|
|
312
|
+
if (q) {
|
|
313
|
+
search.set("q", q);
|
|
314
|
+
}
|
|
315
|
+
if (params.pageSize) {
|
|
316
|
+
search.set("pageSize", String(params.pageSize));
|
|
317
|
+
}
|
|
318
|
+
if (params.pageCursor) {
|
|
319
|
+
search.set("pageCursor", params.pageCursor);
|
|
320
|
+
}
|
|
321
|
+
const envelope = await this.client.requestEnvelope(
|
|
322
|
+
`/v1/media/models?${search.toString()}`,
|
|
323
|
+
{
|
|
324
|
+
method: "GET",
|
|
325
|
+
signal: params.signal
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
return {
|
|
329
|
+
items: envelope.data || [],
|
|
330
|
+
nextPageCursor: typeof ((_b = envelope.meta) == null ? void 0 : _b.nextPageCursor) === "string" ? envelope.meta.nextPageCursor : null
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
async getMediaModel(capabilityKey, options = {}) {
|
|
334
|
+
const key = capabilityKey.trim();
|
|
335
|
+
if (!key) {
|
|
336
|
+
throw new Error("capabilityKey is required");
|
|
337
|
+
}
|
|
338
|
+
return await this.client.request(
|
|
339
|
+
`/v1/media/models/${encodeURIComponent(key)}`,
|
|
340
|
+
{
|
|
341
|
+
method: "GET",
|
|
342
|
+
signal: options.signal
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
async recommendMediaModels(payload, options = {}) {
|
|
347
|
+
return await this.client.request(
|
|
348
|
+
"/v1/media/models/operations/recommend",
|
|
349
|
+
{
|
|
350
|
+
method: "POST",
|
|
351
|
+
body: payload,
|
|
352
|
+
signal: options.signal
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
async generateImage(payload, options = {}) {
|
|
357
|
+
var _a;
|
|
358
|
+
return await this.client.request("/v1/media/images/operations/generate", {
|
|
359
|
+
method: "POST",
|
|
360
|
+
body: payload,
|
|
361
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
362
|
+
signal: options.signal
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
async generateVideo(payload, options = {}) {
|
|
366
|
+
var _a;
|
|
367
|
+
return await this.client.request("/v1/media/videos/operations/generate", {
|
|
368
|
+
method: "POST",
|
|
369
|
+
body: payload,
|
|
370
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
371
|
+
signal: options.signal
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
async generateMusic(payload, options = {}) {
|
|
375
|
+
var _a;
|
|
376
|
+
return await this.client.request("/v1/media/musics/operations/generate", {
|
|
377
|
+
method: "POST",
|
|
378
|
+
body: payload,
|
|
379
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
380
|
+
signal: options.signal
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
async createTts(payload, options = {}) {
|
|
384
|
+
var _a;
|
|
385
|
+
return await this.client.request("/v1/media/audios/operations/tts", {
|
|
386
|
+
method: "POST",
|
|
387
|
+
body: payload,
|
|
388
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
389
|
+
signal: options.signal
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
async createAutoCaptions(payload, options = {}) {
|
|
393
|
+
var _a;
|
|
394
|
+
return await this.client.request(
|
|
395
|
+
"/v1/media/audios/operations/auto-captions",
|
|
396
|
+
{
|
|
397
|
+
method: "POST",
|
|
398
|
+
body: payload,
|
|
399
|
+
idempotencyKey: ((_a = options.idempotencyKey) == null ? void 0 : _a.trim()) || void 0,
|
|
400
|
+
signal: options.signal
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
|
|
247
406
|
// src/resources/projects.ts
|
|
248
407
|
var ProjectsResource = class {
|
|
249
408
|
constructor(client) {
|
|
@@ -457,6 +616,8 @@ var IndreamClient = class {
|
|
|
457
616
|
this.fetchImpl = options.fetch || fetch;
|
|
458
617
|
this.exports = new ExportsResource(this);
|
|
459
618
|
this.editor = new EditorResource(this);
|
|
619
|
+
this.materials = new MaterialsResource(this);
|
|
620
|
+
this.media = new MediaResource(this);
|
|
460
621
|
this.projects = new ProjectsResource(this);
|
|
461
622
|
this.uploads = new UploadsResource(this);
|
|
462
623
|
this.assets = new AssetsResource(this);
|
|
@@ -723,6 +884,8 @@ var verifyExportWebhookRequest = async ({
|
|
|
723
884
|
EditorResource,
|
|
724
885
|
ExportsResource,
|
|
725
886
|
IndreamClient,
|
|
887
|
+
MaterialsResource,
|
|
888
|
+
MediaResource,
|
|
726
889
|
ProjectsResource,
|
|
727
890
|
RateLimitError,
|
|
728
891
|
UploadsResource,
|