@unityclaw/sdk 1.0.1 → 1.0.2

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.d.ts CHANGED
@@ -335,14 +335,16 @@ declare class ImageAPI {
335
335
  * prompt: 'A beautiful sunset over mountains',
336
336
  * size: { value: '2K', label: '2K' }
337
337
  * });
338
+ * console.log('Task folder:', result.taskFolder);
339
+ * console.log('Local path:', result.response.data?.[0]?.localPath);
338
340
  * ```
339
341
  */
340
- gemini(params: GeminiImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
342
+ gemini(params: GeminiImageRequestParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
341
343
  /**
342
344
  * Generate image using Gemini API v2
343
345
  * @see /api/gemini/image/v2
344
346
  */
345
- geminiV2(params: GeminiImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
347
+ geminiV2(params: GeminiImageRequestParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
346
348
  /**
347
349
  * Generate image using JiMeng (Doubao) API
348
350
  * @see /api/jimeng/image
@@ -353,14 +355,15 @@ declare class ImageAPI {
353
355
  * prompt: '一只可爱的猫咪',
354
356
  * size: { value: '1024x1024', label: '1:1' }
355
357
  * });
358
+ * console.log('Task folder:', result.taskFolder);
356
359
  * ```
357
360
  */
358
- jimeng(params: JiMengImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
361
+ jimeng(params: JiMengImageRequestParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
359
362
  /**
360
363
  * Generate image using JiMeng V3 API
361
364
  * @see /api/jimeng/image/v3
362
365
  */
363
- jimengV3(params: JiMengImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
366
+ jimengV3(params: JiMengImageRequestParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
364
367
  /**
365
368
  * Compress image
366
369
  * @see /api/image/compress
@@ -372,7 +375,7 @@ declare class ImageAPI {
372
375
  type?: string;
373
376
  }>;
374
377
  quality?: number;
375
- }): Promise<APIResponse<AttachmentResult[]>>;
378
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
376
379
  }
377
380
 
378
381
  /**
@@ -396,13 +399,14 @@ declare class VideoAPI {
396
399
  * prompt: 'A cat playing piano',
397
400
  * orientation: { value: 'landscape', label: 'Landscape' }
398
401
  * });
402
+ * console.log('Task folder:', result.taskFolder);
399
403
  * ```
400
404
  */
401
405
  sora(params: {
402
406
  attachment?: SoraVideoParams['attachment'];
403
407
  prompt?: string | TextFieldItem[];
404
408
  orientation: LabelFieldItem | string;
405
- }): Promise<APIResponse<AttachmentResult[]>>;
409
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
406
410
  /**
407
411
  * Generate video using Sora Stable API
408
412
  * @see /api/sora/video/stable
@@ -416,7 +420,7 @@ declare class VideoAPI {
416
420
  prompt?: string | TextFieldItem[];
417
421
  size?: LabelFieldItem | string;
418
422
  seconds?: LabelFieldItem | string;
419
- }): Promise<APIResponse<AttachmentResult[]>>;
423
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
420
424
  /**
421
425
  * Generate video using Veo API
422
426
  * @see /api/veo/video
@@ -438,7 +442,7 @@ declare class VideoAPI {
438
442
  aspect_ratio?: LabelFieldItem | string;
439
443
  resolution?: LabelFieldItem | string;
440
444
  duration?: LabelFieldItem | string;
441
- }): Promise<APIResponse<AttachmentResult[]>>;
445
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
442
446
  /**
443
447
  * Generate video using Kling API
444
448
  * @see /api/kling/video
@@ -459,7 +463,7 @@ declare class VideoAPI {
459
463
  aspect_ratio?: LabelFieldItem | string;
460
464
  duration?: LabelFieldItem | string;
461
465
  model?: LabelFieldItem | string;
462
- }): Promise<APIResponse<AttachmentResult[]>>;
466
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
463
467
  /**
464
468
  * Generate video using JiMeng API
465
469
  * @see /api/jimeng/video
@@ -478,7 +482,7 @@ declare class VideoAPI {
478
482
  attachment?: JiMengVideoParams['attachment'];
479
483
  prompt?: string | TextFieldItem[];
480
484
  aspect_ratio: LabelFieldItem | string;
481
- }): Promise<APIResponse<AttachmentResult[]>>;
485
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
482
486
  /**
483
487
  * Generate video using Doubao API
484
488
  * @see /api/doubao/video
@@ -499,7 +503,7 @@ declare class VideoAPI {
499
503
  resolution: LabelFieldItem | string;
500
504
  ratio: LabelFieldItem | string;
501
505
  duration?: LabelFieldItem | string;
502
- }): Promise<APIResponse<AttachmentResult[]>>;
506
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
503
507
  /**
504
508
  * Generate video using Wan API (Alibaba)
505
509
  * @see /api/wan/video
@@ -521,7 +525,7 @@ declare class VideoAPI {
521
525
  duration?: LabelFieldItem | string;
522
526
  model?: LabelFieldItem | string;
523
527
  shot_type?: LabelFieldItem | string;
524
- }): Promise<APIResponse<AttachmentResult[]>>;
528
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
525
529
  /**
526
530
  * Generate video using MiniMax API
527
531
  * @see /api/minimax/video
@@ -541,7 +545,7 @@ declare class VideoAPI {
541
545
  size?: LabelFieldItem | string;
542
546
  duration?: LabelFieldItem | string;
543
547
  model?: LabelFieldItem | string;
544
- }): Promise<APIResponse<AttachmentResult[]>>;
548
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
545
549
  }
546
550
 
547
551
  /**
@@ -566,69 +570,70 @@ declare class DocumentAPI {
566
570
  * source_language: { value: 'en', label: 'English' },
567
571
  * target_language: { value: 'zh', label: 'Chinese' }
568
572
  * });
573
+ * console.log('Task folder:', result.taskFolder);
569
574
  * ```
570
575
  */
571
576
  translate(params: {
572
577
  attachment: DocTranslateParams['attachment'];
573
578
  source_language: LabelFieldItem | string;
574
579
  target_language: LabelFieldItem | string;
575
- }): Promise<APIResponse<AttachmentResult[]>>;
580
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
576
581
  /**
577
582
  * Convert image to Word document
578
583
  * @see /api/doc_convert/image2word
579
584
  */
580
585
  image2Word(params: {
581
586
  attachment: DocConvertParams['attachment'];
582
- }): Promise<APIResponse<AttachmentResult[]>>;
587
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
583
588
  /**
584
589
  * Convert image to PowerPoint
585
590
  * @see /api/doc_convert/image2ppt
586
591
  */
587
592
  image2Ppt(params: {
588
593
  attachment: DocConvertParams['attachment'];
589
- }): Promise<APIResponse<AttachmentResult[]>>;
594
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
590
595
  /**
591
596
  * Convert image to Excel
592
597
  * @see /api/doc_convert/image2excel
593
598
  */
594
599
  image2Excel(params: {
595
600
  attachment: DocConvertParams['attachment'];
596
- }): Promise<APIResponse<AttachmentResult[]>>;
601
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
597
602
  /**
598
603
  * Convert image to PDF
599
604
  * @see /api/doc_convert/image2pdf
600
605
  */
601
606
  image2Pdf(params: {
602
607
  attachment: DocConvertParams['attachment'];
603
- }): Promise<APIResponse<AttachmentResult[]>>;
608
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
604
609
  /**
605
610
  * Convert PDF to Word document
606
611
  * @see /api/doc_convert/pdf2word
607
612
  */
608
613
  pdf2Word(params: {
609
614
  attachment: DocConvertParams['attachment'];
610
- }): Promise<APIResponse<AttachmentResult[]>>;
615
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
611
616
  /**
612
617
  * Convert PDF to PowerPoint
613
618
  * @see /api/doc_convert/pdf2ppt
614
619
  */
615
620
  pdf2Ppt(params: {
616
621
  attachment: DocConvertParams['attachment'];
617
- }): Promise<APIResponse<AttachmentResult[]>>;
622
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
618
623
  /**
619
624
  * Convert PDF to Excel
620
625
  * @see /api/doc_convert/pdf2excel
621
626
  */
622
627
  pdf2Excel(params: {
623
628
  attachment: DocConvertParams['attachment'];
624
- }): Promise<APIResponse<AttachmentResult[]>>;
629
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
625
630
  /**
626
631
  * Convert PDF to image
627
632
  * @see /api/doc_convert/pdf2image
628
633
  */
629
634
  pdf2Image(params: {
630
635
  attachment: DocConvertParams['attachment'];
631
- }): Promise<APIResponse<AttachmentResult[]>>;
636
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
632
637
  /**
633
638
  * Generic document conversion
634
639
  * @see /api/doc_convert/image
@@ -638,7 +643,7 @@ declare class DocumentAPI {
638
643
  attachment: DocConvertParams['attachment'];
639
644
  input_format?: string;
640
645
  output_format: string;
641
- }): Promise<APIResponse<AttachmentResult[]>>;
646
+ }): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
642
647
  }
643
648
 
644
649
  /**
@@ -667,9 +672,12 @@ declare class MediaAPI {
667
672
  * const result = await client.media.analyze({
668
673
  * url: [{ tmp_url: 'https://...', type: 'video/mp4', name: 'video.mp4' }]
669
674
  * });
675
+ *
676
+ * console.log('Task folder:', result.taskFolder);
677
+ * console.log('Summary:', result.response.data?.summary);
670
678
  * ```
671
679
  */
672
- analyze(params: MediaAnalysisParams): Promise<APIResponse<MediaAnalysisResult>>;
680
+ analyze(params: MediaAnalysisParams): Promise<TaskResult<APIResponse<MediaAnalysisResult>>>;
673
681
  /**
674
682
  * Analyze video file directly
675
683
  * @see /api/video_analysis (internal)
@@ -690,7 +698,7 @@ declare class MediaAPI {
690
698
  size?: number;
691
699
  };
692
700
  prompt?: string;
693
- }): Promise<APIResponse<MediaAnalysisResult>>;
701
+ }): Promise<TaskResult<APIResponse<MediaAnalysisResult>>>;
694
702
  /**
695
703
  * Analyze social media video (TikTok, YouTube, etc.)
696
704
  * @see /api/media_analysis
@@ -704,7 +712,7 @@ declare class MediaAPI {
704
712
  */
705
713
  analyzeSocialVideo(params: {
706
714
  url: string;
707
- }): Promise<APIResponse<MediaAnalysisResult>>;
715
+ }): Promise<TaskResult<APIResponse<MediaAnalysisResult>>>;
708
716
  }
709
717
 
710
718
  /**
@@ -763,37 +771,37 @@ declare class UnityClawClient {
763
771
  * Generate image using Gemini API
764
772
  * @deprecated Use client.image.gemini() instead
765
773
  */
766
- generateImage(params: GeminiImageParams): Promise<APIResponse<AttachmentResult[]>>;
774
+ generateImage(params: GeminiImageParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
767
775
  /**
768
776
  * Generate image using JiMeng API
769
777
  * @deprecated Use client.image.jimeng() instead
770
778
  */
771
- generateJiMengImage(params: JiMengImageParams): Promise<APIResponse<AttachmentResult[]>>;
779
+ generateJiMengImage(params: JiMengImageParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
772
780
  /**
773
781
  * Generate video using Sora API
774
782
  * @deprecated Use client.video.sora() instead
775
783
  */
776
- generateSoraVideo(params: SoraVideoParams): Promise<APIResponse<AttachmentResult[]>>;
784
+ generateSoraVideo(params: SoraVideoParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
777
785
  /**
778
786
  * Generate video using Veo API
779
787
  * @deprecated Use client.video.veo() instead
780
788
  */
781
- generateVeoVideo(params: VeoVideoParams): Promise<APIResponse<AttachmentResult[]>>;
789
+ generateVeoVideo(params: VeoVideoParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
782
790
  /**
783
791
  * Generate video using Kling API
784
792
  * @deprecated Use client.video.kling() instead
785
793
  */
786
- generateKlingVideo(params: KlingVideoParams): Promise<APIResponse<AttachmentResult[]>>;
794
+ generateKlingVideo(params: KlingVideoParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
787
795
  /**
788
796
  * Translate document
789
797
  * @deprecated Use client.document.translate() instead
790
798
  */
791
- translateDocument(params: DocTranslateParams): Promise<APIResponse<AttachmentResult[]>>;
799
+ translateDocument(params: DocTranslateParams): Promise<TaskResult<APIResponse<AttachmentResult[]>>>;
792
800
  /**
793
801
  * Analyze media (video/audio from URL)
794
802
  * @deprecated Use client.media.analyze() instead
795
803
  */
796
- analyzeMedia(params: MediaAnalysisParams): Promise<APIResponse<MediaAnalysisResult>>;
804
+ analyzeMedia(params: MediaAnalysisParams): Promise<TaskResult<APIResponse<MediaAnalysisResult>>>;
797
805
  }
798
806
 
799
807
  export { type APIResponse, type AttachmentFieldItem, type AttachmentResult, type BitableContext, type Context, type DeepPartial, type DocConvertParams, type DocTranslateParams, DocumentAPI, type DoubaoVideoParams, type GeminiImageParams, ImageAPI, type ImageGenParams, type JiMengImageParams, type JiMengVideoParams, type KlingVideoParams, type LabelFieldItem, type LabelValue, MediaAPI, type MediaAnalysisParams, type MediaAnalysisResult, type MiniMaxVideoParams, type OpenClawShortcutParams, type SDKContext, type SoraVideoParams, type TaskFolderContext, TaskFolderManager, type TaskFolderOptions, type TaskLog, type TaskResult, type TextFieldItem, type TextInput, UnityClawClient, type UnityClawClientConfig, type UrlFieldItem, type VeoVideoParams, VideoAPI, type WanVideoParams };
package/dist/index.js CHANGED
@@ -201,31 +201,31 @@ var ImageAPI = class {
201
201
  * prompt: 'A beautiful sunset over mountains',
202
202
  * size: { value: '2K', label: '2K' }
203
203
  * });
204
+ * console.log('Task folder:', result.taskFolder);
205
+ * console.log('Local path:', result.response.data?.[0]?.localPath);
204
206
  * ```
205
207
  */
206
208
  async gemini(params) {
207
- const taskResult = await this.client.request("/api/gemini/image", {
209
+ return this.client.request("/api/gemini/image", {
208
210
  prompt: params.prompt,
209
211
  attachment: params.attachment,
210
212
  model: params.model,
211
213
  aspect_ratio: params.aspect_ratio,
212
214
  size: params.size
213
215
  });
214
- return taskResult.response;
215
216
  }
216
217
  /**
217
218
  * Generate image using Gemini API v2
218
219
  * @see /api/gemini/image/v2
219
220
  */
220
221
  async geminiV2(params) {
221
- const taskResult = await this.client.request("/api/gemini/image/v2", {
222
+ return this.client.request("/api/gemini/image/v2", {
222
223
  prompt: params.prompt,
223
224
  attachment: params.attachment,
224
225
  model: params.model,
225
226
  aspect_ratio: params.aspect_ratio,
226
227
  size: params.size
227
228
  });
228
- return taskResult.response;
229
229
  }
230
230
  /**
231
231
  * Generate image using JiMeng (Doubao) API
@@ -237,10 +237,11 @@ var ImageAPI = class {
237
237
  * prompt: '一只可爱的猫咪',
238
238
  * size: { value: '1024x1024', label: '1:1' }
239
239
  * });
240
+ * console.log('Task folder:', result.taskFolder);
240
241
  * ```
241
242
  */
242
243
  async jimeng(params) {
243
- const taskResult = await this.client.request("/api/jimeng/image", {
244
+ return this.client.request("/api/jimeng/image", {
244
245
  prompt: params.prompt,
245
246
  attachment: params.attachment,
246
247
  size: params.size,
@@ -249,14 +250,13 @@ var ImageAPI = class {
249
250
  image_count: params.image_count,
250
251
  model: params.model
251
252
  });
252
- return taskResult.response;
253
253
  }
254
254
  /**
255
255
  * Generate image using JiMeng V3 API
256
256
  * @see /api/jimeng/image/v3
257
257
  */
258
258
  async jimengV3(params) {
259
- const taskResult = await this.client.request("/api/jimeng/image/v3", {
259
+ return this.client.request("/api/jimeng/image/v3", {
260
260
  prompt: params.prompt,
261
261
  attachment: params.attachment,
262
262
  size: params.size,
@@ -265,18 +265,16 @@ var ImageAPI = class {
265
265
  image_count: params.image_count,
266
266
  model: params.model
267
267
  });
268
- return taskResult.response;
269
268
  }
270
269
  /**
271
270
  * Compress image
272
271
  * @see /api/image/compress
273
272
  */
274
273
  async compress(params) {
275
- const taskResult = await this.client.request("/api/image/compress", {
274
+ return this.client.request("/api/image/compress", {
276
275
  attachment: params.attachment,
277
276
  quality: params.quality
278
277
  });
279
- return taskResult.response;
280
278
  }
281
279
  };
282
280
 
@@ -295,28 +293,27 @@ var VideoAPI = class {
295
293
  * prompt: 'A cat playing piano',
296
294
  * orientation: { value: 'landscape', label: 'Landscape' }
297
295
  * });
296
+ * console.log('Task folder:', result.taskFolder);
298
297
  * ```
299
298
  */
300
299
  async sora(params) {
301
- const taskResult = await this.client.request("/api/sora/video", {
300
+ return this.client.request("/api/sora/video", {
302
301
  attachment: params.attachment,
303
302
  prompt: params.prompt,
304
303
  orientation: params.orientation
305
304
  });
306
- return taskResult.response;
307
305
  }
308
306
  /**
309
307
  * Generate video using Sora Stable API
310
308
  * @see /api/sora/video/stable
311
309
  */
312
310
  async soraStable(params) {
313
- const taskResult = await this.client.request("/api/sora/video/stable", {
311
+ return this.client.request("/api/sora/video/stable", {
314
312
  attachment: params.attachment,
315
313
  prompt: params.prompt,
316
314
  size: params.size,
317
315
  seconds: params.seconds
318
316
  });
319
- return taskResult.response;
320
317
  }
321
318
  /**
322
319
  * Generate video using Veo API
@@ -332,7 +329,7 @@ var VideoAPI = class {
332
329
  * ```
333
330
  */
334
331
  async veo(params) {
335
- const taskResult = await this.client.request("/api/veo/video", {
332
+ return this.client.request("/api/veo/video", {
336
333
  prompt: params.prompt,
337
334
  attachment: params.attachment,
338
335
  first_frame: params.first_frame,
@@ -341,7 +338,6 @@ var VideoAPI = class {
341
338
  resolution: params.resolution,
342
339
  duration: params.duration
343
340
  });
344
- return taskResult.response;
345
341
  }
346
342
  /**
347
343
  * Generate video using Kling API
@@ -358,14 +354,13 @@ var VideoAPI = class {
358
354
  * ```
359
355
  */
360
356
  async kling(params) {
361
- const taskResult = await this.client.request("/api/kling/video", {
357
+ return this.client.request("/api/kling/video", {
362
358
  attachment: params.attachment,
363
359
  prompt: params.prompt,
364
360
  aspect_ratio: params.aspect_ratio,
365
361
  duration: params.duration,
366
362
  model: params.model
367
363
  });
368
- return taskResult.response;
369
364
  }
370
365
  /**
371
366
  * Generate video using JiMeng API
@@ -381,13 +376,12 @@ var VideoAPI = class {
381
376
  * ```
382
377
  */
383
378
  async jimeng(params) {
384
- const taskResult = await this.client.request("/api/jimeng/video", {
379
+ return this.client.request("/api/jimeng/video", {
385
380
  action: params.action,
386
381
  attachment: params.attachment,
387
382
  prompt: params.prompt,
388
383
  aspect_ratio: params.aspect_ratio
389
384
  });
390
- return taskResult.response;
391
385
  }
392
386
  /**
393
387
  * Generate video using Doubao API
@@ -403,7 +397,7 @@ var VideoAPI = class {
403
397
  * ```
404
398
  */
405
399
  async doubao(params) {
406
- const taskResult = await this.client.request("/api/doubao/video", {
400
+ return this.client.request("/api/doubao/video", {
407
401
  action: params.action,
408
402
  attachment: params.attachment,
409
403
  prompt: params.prompt,
@@ -411,7 +405,6 @@ var VideoAPI = class {
411
405
  ratio: params.ratio,
412
406
  duration: params.duration
413
407
  });
414
- return taskResult.response;
415
408
  }
416
409
  /**
417
410
  * Generate video using Wan API (Alibaba)
@@ -428,7 +421,7 @@ var VideoAPI = class {
428
421
  * ```
429
422
  */
430
423
  async wan(params) {
431
- const taskResult = await this.client.request("/api/wan/video", {
424
+ return this.client.request("/api/wan/video", {
432
425
  attachment: params.attachment,
433
426
  prompt: params.prompt,
434
427
  size: params.size,
@@ -436,7 +429,6 @@ var VideoAPI = class {
436
429
  model: params.model,
437
430
  shot_type: params.shot_type
438
431
  });
439
- return taskResult.response;
440
432
  }
441
433
  /**
442
434
  * Generate video using MiniMax API
@@ -452,14 +444,13 @@ var VideoAPI = class {
452
444
  * ```
453
445
  */
454
446
  async minimax(params) {
455
- const taskResult = await this.client.request("/api/minimax/video", {
447
+ return this.client.request("/api/minimax/video", {
456
448
  attachment: params.attachment,
457
449
  prompt: params.prompt,
458
450
  size: params.size,
459
451
  duration: params.duration,
460
452
  model: params.model
461
453
  });
462
- return taskResult.response;
463
454
  }
464
455
  };
465
456
 
@@ -479,119 +470,111 @@ var DocumentAPI = class {
479
470
  * source_language: { value: 'en', label: 'English' },
480
471
  * target_language: { value: 'zh', label: 'Chinese' }
481
472
  * });
473
+ * console.log('Task folder:', result.taskFolder);
482
474
  * ```
483
475
  */
484
476
  async translate(params) {
485
- const taskResult = await this.client.request("/api/doc/translate", {
477
+ return this.client.request("/api/doc/translate", {
486
478
  attachment: params.attachment,
487
479
  source_language: params.source_language,
488
480
  target_language: params.target_language
489
481
  });
490
- return taskResult.response;
491
482
  }
492
483
  /**
493
484
  * Convert image to Word document
494
485
  * @see /api/doc_convert/image2word
495
486
  */
496
487
  async image2Word(params) {
497
- const taskResult = await this.client.request(
488
+ return this.client.request(
498
489
  "/api/doc_convert/image2word",
499
490
  {
500
491
  attachment: params.attachment
501
492
  }
502
493
  );
503
- return taskResult.response;
504
494
  }
505
495
  /**
506
496
  * Convert image to PowerPoint
507
497
  * @see /api/doc_convert/image2ppt
508
498
  */
509
499
  async image2Ppt(params) {
510
- const taskResult = await this.client.request(
500
+ return this.client.request(
511
501
  "/api/doc_convert/image2ppt",
512
502
  {
513
503
  attachment: params.attachment
514
504
  }
515
505
  );
516
- return taskResult.response;
517
506
  }
518
507
  /**
519
508
  * Convert image to Excel
520
509
  * @see /api/doc_convert/image2excel
521
510
  */
522
511
  async image2Excel(params) {
523
- const taskResult = await this.client.request(
512
+ return this.client.request(
524
513
  "/api/doc_convert/image2excel",
525
514
  {
526
515
  attachment: params.attachment
527
516
  }
528
517
  );
529
- return taskResult.response;
530
518
  }
531
519
  /**
532
520
  * Convert image to PDF
533
521
  * @see /api/doc_convert/image2pdf
534
522
  */
535
523
  async image2Pdf(params) {
536
- const taskResult = await this.client.request(
524
+ return this.client.request(
537
525
  "/api/doc_convert/image2pdf",
538
526
  {
539
527
  attachment: params.attachment
540
528
  }
541
529
  );
542
- return taskResult.response;
543
530
  }
544
531
  /**
545
532
  * Convert PDF to Word document
546
533
  * @see /api/doc_convert/pdf2word
547
534
  */
548
535
  async pdf2Word(params) {
549
- const taskResult = await this.client.request(
536
+ return this.client.request(
550
537
  "/api/doc_convert/pdf2word",
551
538
  {
552
539
  attachment: params.attachment
553
540
  }
554
541
  );
555
- return taskResult.response;
556
542
  }
557
543
  /**
558
544
  * Convert PDF to PowerPoint
559
545
  * @see /api/doc_convert/pdf2ppt
560
546
  */
561
547
  async pdf2Ppt(params) {
562
- const taskResult = await this.client.request(
548
+ return this.client.request(
563
549
  "/api/doc_convert/pdf2ppt",
564
550
  {
565
551
  attachment: params.attachment
566
552
  }
567
553
  );
568
- return taskResult.response;
569
554
  }
570
555
  /**
571
556
  * Convert PDF to Excel
572
557
  * @see /api/doc_convert/pdf2excel
573
558
  */
574
559
  async pdf2Excel(params) {
575
- const taskResult = await this.client.request(
560
+ return this.client.request(
576
561
  "/api/doc_convert/pdf2excel",
577
562
  {
578
563
  attachment: params.attachment
579
564
  }
580
565
  );
581
- return taskResult.response;
582
566
  }
583
567
  /**
584
568
  * Convert PDF to image
585
569
  * @see /api/doc_convert/pdf2image
586
570
  */
587
571
  async pdf2Image(params) {
588
- const taskResult = await this.client.request(
572
+ return this.client.request(
589
573
  "/api/doc_convert/pdf2image",
590
574
  {
591
575
  attachment: params.attachment
592
576
  }
593
577
  );
594
- return taskResult.response;
595
578
  }
596
579
  /**
597
580
  * Generic document conversion
@@ -601,12 +584,11 @@ var DocumentAPI = class {
601
584
  async convert(params) {
602
585
  const isImage = params.input_format === "image" || !params.input_format;
603
586
  const endpoint = isImage ? "/api/doc_convert/image" : "/api/doc_convert/pdf";
604
- const taskResult = await this.client.request(endpoint, {
587
+ return this.client.request(endpoint, {
605
588
  attachment: params.attachment,
606
589
  input_format: params.input_format,
607
590
  output_format: params.output_format
608
591
  });
609
- return taskResult.response;
610
592
  }
611
593
  };
612
594
 
@@ -630,13 +612,15 @@ var MediaAPI = class {
630
612
  * const result = await client.media.analyze({
631
613
  * url: [{ tmp_url: 'https://...', type: 'video/mp4', name: 'video.mp4' }]
632
614
  * });
615
+ *
616
+ * console.log('Task folder:', result.taskFolder);
617
+ * console.log('Summary:', result.response.data?.summary);
633
618
  * ```
634
619
  */
635
620
  async analyze(params) {
636
- const taskResult = await this.client.request("/api/media_analysis", {
621
+ return this.client.request("/api/media_analysis", {
637
622
  url: params.url
638
623
  });
639
- return taskResult.response;
640
624
  }
641
625
  /**
642
626
  * Analyze video file directly
@@ -651,7 +635,7 @@ var MediaAPI = class {
651
635
  * ```
652
636
  */
653
637
  async analyzeVideo(params) {
654
- const taskResult = await this.client.request("/api/media_analysis", {
638
+ return this.client.request("/api/media_analysis", {
655
639
  url: [
656
640
  {
657
641
  tmp_url: params.file.tmp_url,
@@ -661,7 +645,6 @@ var MediaAPI = class {
661
645
  }
662
646
  ]
663
647
  });
664
- return taskResult.response;
665
648
  }
666
649
  /**
667
650
  * Analyze social media video (TikTok, YouTube, etc.)
@@ -675,10 +658,9 @@ var MediaAPI = class {
675
658
  * ```
676
659
  */
677
660
  async analyzeSocialVideo(params) {
678
- const taskResult = await this.client.request("/api/media_analysis", {
661
+ return this.client.request("/api/media_analysis", {
679
662
  url: [{ link: params.url, type: "url" }]
680
663
  });
681
- return taskResult.response;
682
664
  }
683
665
  };
684
666