@unityclaw/sdk 1.0.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.
@@ -0,0 +1,799 @@
1
+ import { AxiosInstance } from 'axios';
2
+
3
+ /**
4
+ * UnityClaw SDK Type Definitions
5
+ * AI-powered API types for image/video generation, media analysis, and more
6
+ */
7
+ /** Text field item with optional link and mention info */
8
+ interface TextFieldItem {
9
+ type: string;
10
+ text: string;
11
+ link?: string;
12
+ token?: string;
13
+ mentionType?: number;
14
+ name?: string;
15
+ }
16
+ /** URL field item */
17
+ interface UrlFieldItem {
18
+ text: string;
19
+ link: string;
20
+ }
21
+ /** Attachment field item from bitable */
22
+ interface AttachmentFieldItem {
23
+ tmp_url: string;
24
+ name?: string;
25
+ type?: string;
26
+ size?: number;
27
+ }
28
+ /** Label/option field item */
29
+ interface LabelFieldItem {
30
+ value: string | boolean | number;
31
+ label: string;
32
+ }
33
+ /** Bitable context */
34
+ interface BitableContext {
35
+ logID: string;
36
+ timeZone: string;
37
+ baseID: string;
38
+ tableID: string;
39
+ }
40
+ /** Request context */
41
+ interface Context {
42
+ logID: string;
43
+ timeZone: string;
44
+ baseID: string;
45
+ tableID: string;
46
+ bitable: BitableContext;
47
+ tenantKey: string;
48
+ userID: string;
49
+ packID: string;
50
+ extensionID: string;
51
+ baseSignature: string;
52
+ baseOwnerID: string;
53
+ isNeedPayPack?: boolean;
54
+ hasQuota?: boolean;
55
+ }
56
+ /** Minimal context for SDK usage */
57
+ interface SDKContext {
58
+ logID: string;
59
+ timeZone?: string;
60
+ baseID?: string;
61
+ tableID?: string;
62
+ userID?: string;
63
+ }
64
+ /** Standard API response wrapper */
65
+ interface APIResponse<T = unknown> {
66
+ code: number;
67
+ msg?: string;
68
+ data?: T;
69
+ }
70
+ /** Attachment result in API responses */
71
+ interface AttachmentResult {
72
+ name: string;
73
+ contentType: 'attachment/url';
74
+ content: string;
75
+ /** Local file path after download (only available when downloadAttachments is true) */
76
+ localPath?: string;
77
+ }
78
+ /** Image generation parameters */
79
+ interface ImageGenParams {
80
+ prompt: string | TextFieldItem[];
81
+ attachment?: AttachmentFieldItem[];
82
+ model?: LabelFieldItem | string;
83
+ aspect_ratio?: LabelFieldItem | string;
84
+ size?: LabelFieldItem | string;
85
+ model_selector?: LabelFieldItem;
86
+ web_search?: LabelFieldItem;
87
+ image_count?: LabelFieldItem | number;
88
+ }
89
+ /** Gemini image generation params */
90
+ interface GeminiImageParams {
91
+ prompt: string | TextFieldItem[];
92
+ attachment?: AttachmentFieldItem[];
93
+ model?: LabelFieldItem;
94
+ aspect_ratio?: LabelFieldItem;
95
+ size?: LabelFieldItem;
96
+ }
97
+ /** JiMeng image generation params */
98
+ interface JiMengImageParams {
99
+ prompt: string | TextFieldItem[];
100
+ attachment?: AttachmentFieldItem[];
101
+ size: LabelFieldItem;
102
+ model_selector?: LabelFieldItem;
103
+ web_search?: LabelFieldItem;
104
+ image_count?: LabelFieldItem | number;
105
+ model?: string;
106
+ }
107
+ /** Sora video generation params */
108
+ interface SoraVideoParams {
109
+ attachment?: AttachmentFieldItem[];
110
+ prompt?: string | TextFieldItem[];
111
+ orientation: LabelFieldItem;
112
+ }
113
+ /** Veo video generation params */
114
+ interface VeoVideoParams {
115
+ prompt?: string | TextFieldItem[];
116
+ attachment?: AttachmentFieldItem[];
117
+ first_frame?: AttachmentFieldItem[];
118
+ last_frame?: AttachmentFieldItem[];
119
+ aspect_ratio?: LabelFieldItem;
120
+ resolution?: LabelFieldItem;
121
+ duration?: LabelFieldItem;
122
+ }
123
+ /** Kling video generation params */
124
+ interface KlingVideoParams {
125
+ attachment?: AttachmentFieldItem[];
126
+ prompt?: string | TextFieldItem[];
127
+ aspect_ratio?: LabelFieldItem;
128
+ duration?: LabelFieldItem;
129
+ model?: LabelFieldItem;
130
+ }
131
+ /** JiMeng video generation params */
132
+ interface JiMengVideoParams {
133
+ action: LabelFieldItem;
134
+ attachment?: AttachmentFieldItem[];
135
+ prompt?: string | TextFieldItem[];
136
+ aspect_ratio: LabelFieldItem;
137
+ }
138
+ /** Doubao video generation params */
139
+ interface DoubaoVideoParams {
140
+ action?: LabelFieldItem;
141
+ attachment?: AttachmentFieldItem[];
142
+ prompt?: string | TextFieldItem[];
143
+ resolution: LabelFieldItem;
144
+ ratio: LabelFieldItem;
145
+ duration?: LabelFieldItem;
146
+ }
147
+ /** Wan video generation params */
148
+ interface WanVideoParams {
149
+ attachment?: AttachmentFieldItem[];
150
+ prompt?: string | TextFieldItem[];
151
+ size?: LabelFieldItem;
152
+ duration?: LabelFieldItem;
153
+ model?: LabelFieldItem;
154
+ shot_type?: LabelFieldItem;
155
+ }
156
+ /** MiniMax video generation params */
157
+ interface MiniMaxVideoParams {
158
+ attachment?: AttachmentFieldItem[];
159
+ prompt?: string | TextFieldItem[];
160
+ size?: LabelFieldItem;
161
+ duration?: LabelFieldItem;
162
+ model?: LabelFieldItem;
163
+ }
164
+ /** Document translation params */
165
+ interface DocTranslateParams {
166
+ attachment: AttachmentFieldItem[];
167
+ source_language: LabelFieldItem | string;
168
+ target_language: LabelFieldItem | string;
169
+ }
170
+ /** Document conversion params */
171
+ interface DocConvertParams {
172
+ attachment?: AttachmentFieldItem[];
173
+ input_format?: string;
174
+ output_format?: string;
175
+ }
176
+ /** Media analysis params */
177
+ interface MediaAnalysisParams {
178
+ url: Array<{
179
+ tmp_url?: string;
180
+ link?: string;
181
+ text?: string;
182
+ type?: string;
183
+ }>;
184
+ }
185
+ /** Media analysis result */
186
+ interface MediaAnalysisResult {
187
+ summary: string;
188
+ subtitle: string;
189
+ }
190
+ /** OpenClaw shortcut params */
191
+ interface OpenClawShortcutParams {
192
+ task: string;
193
+ isolate_session?: LabelFieldItem;
194
+ }
195
+ /** SDK client configuration */
196
+ interface UnityClawClientConfig {
197
+ /** API Key for authentication (can also set UNITYCLAW_API_KEY env var) */
198
+ apiKey?: string;
199
+ /** Base URL (default: https://unityclaw.com, or set UNITYCLAW_BASE_URL env var) */
200
+ baseUrl?: string;
201
+ /** Task folder directory (default: ./tasks) */
202
+ taskDir?: string;
203
+ /** Request timeout in ms (default: 300000 = 5min) */
204
+ timeout?: number;
205
+ /** Whether to download attachments to local (default: true) */
206
+ downloadAttachments?: boolean;
207
+ /** Custom context overrides */
208
+ context?: Partial<SDKContext>;
209
+ }
210
+ /** Task execution log */
211
+ interface TaskLog {
212
+ timestamp: string;
213
+ level: 'info' | 'error' | 'warn';
214
+ message: string;
215
+ data?: unknown;
216
+ }
217
+ /** Task execution result */
218
+ interface TaskResult<T = unknown> {
219
+ taskId: string;
220
+ success: boolean;
221
+ response: T;
222
+ duration: number;
223
+ taskFolder: string;
224
+ logs: TaskLog[];
225
+ attachments: string[];
226
+ }
227
+ /** Make all properties optional recursively */
228
+ type DeepPartial<T> = {
229
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
230
+ };
231
+ /** Extract value from LabelFieldItem or return primitive */
232
+ type LabelValue<T extends LabelFieldItem | string | number | boolean | undefined> = T extends LabelFieldItem ? T['value'] : T;
233
+ /** Union type for text input (string or TextFieldItem array) */
234
+ type TextInput = string | TextFieldItem[];
235
+
236
+ /**
237
+ * Task Folder Manager
238
+ * Creates timestamped folders for each execution, downloads attachments, and logs execution
239
+ */
240
+
241
+ /** Task folder manager options */
242
+ interface TaskFolderOptions {
243
+ /** Base directory for task folders */
244
+ taskDir: string;
245
+ /** Whether to download attachments */
246
+ downloadAttachments: boolean;
247
+ }
248
+ /** Active task folder context */
249
+ interface TaskFolderContext {
250
+ taskId: string;
251
+ folderPath: string;
252
+ attachmentsPath: string;
253
+ logsPath: string;
254
+ startTime: number;
255
+ logs: TaskLog[];
256
+ downloadedFiles: string[];
257
+ }
258
+ /**
259
+ * Creates and manages task folders for SDK executions
260
+ */
261
+ declare class TaskFolderManager {
262
+ private options;
263
+ constructor(options: TaskFolderOptions);
264
+ /**
265
+ * Create a new task folder with timestamp and unique ID
266
+ */
267
+ createTaskFolder(): Promise<TaskFolderContext>;
268
+ /**
269
+ * Log a message to the task folder
270
+ */
271
+ log(ctx: TaskFolderContext, level: TaskLog['level'], message: string, data?: unknown): Promise<void>;
272
+ /**
273
+ * Download an attachment from URL to local folder
274
+ * Important: Downloads attachments to avoid tmp_url expiration
275
+ */
276
+ downloadAttachment(ctx: TaskFolderContext, attachment: AttachmentFieldItem): Promise<string | undefined>;
277
+ /**
278
+ * Download multiple attachments
279
+ */
280
+ downloadAttachments(ctx: TaskFolderContext, attachments: AttachmentFieldItem[]): Promise<string[]>;
281
+ /**
282
+ * Write request details to task folder
283
+ */
284
+ writeRequest(ctx: TaskFolderContext, endpoint: string, params: unknown, context: unknown): Promise<void>;
285
+ /**
286
+ * Write response details to task folder
287
+ */
288
+ writeResponse(ctx: TaskFolderContext, response: unknown): Promise<void>;
289
+ /**
290
+ * Finalize task folder and return result
291
+ */
292
+ finalizeTaskFolder<T>(ctx: TaskFolderContext, response: T, success: boolean): Promise<TaskResult<T>>;
293
+ /**
294
+ * Clean up old task folders (optional utility)
295
+ */
296
+ cleanOldFolders(maxAge: number): Promise<number>;
297
+ }
298
+
299
+ /**
300
+ * Image Generation APIs
301
+ * Handles Gemini and JiMeng image generation endpoints
302
+ */
303
+
304
+ /** Gemini image generation parameters */
305
+ interface GeminiImageRequestParams {
306
+ prompt: string | TextFieldItem[];
307
+ attachment?: GeminiImageParams['attachment'];
308
+ model?: GeminiImageParams['model'];
309
+ aspect_ratio?: GeminiImageParams['aspect_ratio'];
310
+ size?: GeminiImageParams['size'];
311
+ }
312
+ /** JiMeng image generation parameters */
313
+ interface JiMengImageRequestParams {
314
+ prompt: string | TextFieldItem[];
315
+ attachment?: JiMengImageParams['attachment'];
316
+ size: LabelFieldItem | string;
317
+ model_selector?: JiMengImageParams['model_selector'];
318
+ web_search?: JiMengImageParams['web_search'];
319
+ image_count?: JiMengImageParams['image_count'];
320
+ model?: string;
321
+ }
322
+ /**
323
+ * Image API module
324
+ */
325
+ declare class ImageAPI {
326
+ private client;
327
+ constructor(client: UnityClawClient);
328
+ /**
329
+ * Generate image using Gemini API
330
+ * @see /api/gemini/image
331
+ *
332
+ * @example
333
+ * ```typescript
334
+ * const result = await client.image.gemini({
335
+ * prompt: 'A beautiful sunset over mountains',
336
+ * size: { value: '2K', label: '2K' }
337
+ * });
338
+ * ```
339
+ */
340
+ gemini(params: GeminiImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
341
+ /**
342
+ * Generate image using Gemini API v2
343
+ * @see /api/gemini/image/v2
344
+ */
345
+ geminiV2(params: GeminiImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
346
+ /**
347
+ * Generate image using JiMeng (Doubao) API
348
+ * @see /api/jimeng/image
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * const result = await client.image.jimeng({
353
+ * prompt: '一只可爱的猫咪',
354
+ * size: { value: '1024x1024', label: '1:1' }
355
+ * });
356
+ * ```
357
+ */
358
+ jimeng(params: JiMengImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
359
+ /**
360
+ * Generate image using JiMeng V3 API
361
+ * @see /api/jimeng/image/v3
362
+ */
363
+ jimengV3(params: JiMengImageRequestParams): Promise<APIResponse<AttachmentResult[]>>;
364
+ /**
365
+ * Compress image
366
+ * @see /api/image/compress
367
+ */
368
+ compress(params: {
369
+ attachment: Array<{
370
+ tmp_url: string;
371
+ name?: string;
372
+ type?: string;
373
+ }>;
374
+ quality?: number;
375
+ }): Promise<APIResponse<AttachmentResult[]>>;
376
+ }
377
+
378
+ /**
379
+ * Video Generation APIs
380
+ * Handles Sora, Veo, Kling, JiMeng, Doubao, Wan, MiniMax video generation endpoints
381
+ */
382
+
383
+ /**
384
+ * Video API module
385
+ */
386
+ declare class VideoAPI {
387
+ private client;
388
+ constructor(client: UnityClawClient);
389
+ /**
390
+ * Generate video using Sora API
391
+ * @see /api/sora/video
392
+ *
393
+ * @example
394
+ * ```typescript
395
+ * const result = await client.video.sora({
396
+ * prompt: 'A cat playing piano',
397
+ * orientation: { value: 'landscape', label: 'Landscape' }
398
+ * });
399
+ * ```
400
+ */
401
+ sora(params: {
402
+ attachment?: SoraVideoParams['attachment'];
403
+ prompt?: string | TextFieldItem[];
404
+ orientation: LabelFieldItem | string;
405
+ }): Promise<APIResponse<AttachmentResult[]>>;
406
+ /**
407
+ * Generate video using Sora Stable API
408
+ * @see /api/sora/video/stable
409
+ */
410
+ soraStable(params: {
411
+ attachment?: Array<{
412
+ tmp_url: string;
413
+ name?: string;
414
+ type?: string;
415
+ }>;
416
+ prompt?: string | TextFieldItem[];
417
+ size?: LabelFieldItem | string;
418
+ seconds?: LabelFieldItem | string;
419
+ }): Promise<APIResponse<AttachmentResult[]>>;
420
+ /**
421
+ * Generate video using Veo API
422
+ * @see /api/veo/video
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const result = await client.video.veo({
427
+ * prompt: 'A beautiful sunset over the ocean',
428
+ * aspect_ratio: { value: '16:9', label: '16:9' },
429
+ * duration: { value: '8', label: '8s' }
430
+ * });
431
+ * ```
432
+ */
433
+ veo(params: {
434
+ prompt?: string | TextFieldItem[];
435
+ attachment?: VeoVideoParams['attachment'];
436
+ first_frame?: VeoVideoParams['first_frame'];
437
+ last_frame?: VeoVideoParams['last_frame'];
438
+ aspect_ratio?: LabelFieldItem | string;
439
+ resolution?: LabelFieldItem | string;
440
+ duration?: LabelFieldItem | string;
441
+ }): Promise<APIResponse<AttachmentResult[]>>;
442
+ /**
443
+ * Generate video using Kling API
444
+ * @see /api/kling/video
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const result = await client.video.kling({
449
+ * prompt: 'A dog running in the park',
450
+ * aspect_ratio: { value: '16:9', label: '16:9' },
451
+ * duration: { value: '5', label: '5s' },
452
+ * model: { value: 'kling-v1', label: 'V1' }
453
+ * });
454
+ * ```
455
+ */
456
+ kling(params: {
457
+ attachment?: KlingVideoParams['attachment'];
458
+ prompt?: string | TextFieldItem[];
459
+ aspect_ratio?: LabelFieldItem | string;
460
+ duration?: LabelFieldItem | string;
461
+ model?: LabelFieldItem | string;
462
+ }): Promise<APIResponse<AttachmentResult[]>>;
463
+ /**
464
+ * Generate video using JiMeng API
465
+ * @see /api/jimeng/video
466
+ *
467
+ * @example
468
+ * ```typescript
469
+ * const result = await client.video.jimeng({
470
+ * action: { value: 't2v', label: 'Text to Video' },
471
+ * prompt: 'A beautiful landscape',
472
+ * aspect_ratio: { value: '16:9', label: '16:9' }
473
+ * });
474
+ * ```
475
+ */
476
+ jimeng(params: {
477
+ action: LabelFieldItem | string;
478
+ attachment?: JiMengVideoParams['attachment'];
479
+ prompt?: string | TextFieldItem[];
480
+ aspect_ratio: LabelFieldItem | string;
481
+ }): Promise<APIResponse<AttachmentResult[]>>;
482
+ /**
483
+ * Generate video using Doubao API
484
+ * @see /api/doubao/video
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const result = await client.video.doubao({
489
+ * prompt: 'A cinematic drone shot of mountains',
490
+ * resolution: { value: '1080p', label: '1080p' },
491
+ * ratio: { value: '16:9', label: '16:9' }
492
+ * });
493
+ * ```
494
+ */
495
+ doubao(params: {
496
+ action?: LabelFieldItem | string;
497
+ attachment?: DoubaoVideoParams['attachment'];
498
+ prompt?: string | TextFieldItem[];
499
+ resolution: LabelFieldItem | string;
500
+ ratio: LabelFieldItem | string;
501
+ duration?: LabelFieldItem | string;
502
+ }): Promise<APIResponse<AttachmentResult[]>>;
503
+ /**
504
+ * Generate video using Wan API (Alibaba)
505
+ * @see /api/wan/video
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * const result = await client.video.wan({
510
+ * prompt: 'A futuristic city at night',
511
+ * size: { value: '1280*720', label: '720p' },
512
+ * duration: { value: '5', label: '5s' },
513
+ * model: { value: 'wan2.6-t2v', label: 'Wan 2.6' }
514
+ * });
515
+ * ```
516
+ */
517
+ wan(params: {
518
+ attachment?: WanVideoParams['attachment'];
519
+ prompt?: string | TextFieldItem[];
520
+ size?: LabelFieldItem | string;
521
+ duration?: LabelFieldItem | string;
522
+ model?: LabelFieldItem | string;
523
+ shot_type?: LabelFieldItem | string;
524
+ }): Promise<APIResponse<AttachmentResult[]>>;
525
+ /**
526
+ * Generate video using MiniMax API
527
+ * @see /api/minimax/video
528
+ *
529
+ * @example
530
+ * ```typescript
531
+ * const result = await client.video.minimax({
532
+ * prompt: 'A person walking through a forest',
533
+ * size: { value: '1360*768', label: '768p' },
534
+ * model: { value: 'MiniMax-Hailuo-2.3', label: 'Hailuo 2.3' }
535
+ * });
536
+ * ```
537
+ */
538
+ minimax(params: {
539
+ attachment?: MiniMaxVideoParams['attachment'];
540
+ prompt?: string | TextFieldItem[];
541
+ size?: LabelFieldItem | string;
542
+ duration?: LabelFieldItem | string;
543
+ model?: LabelFieldItem | string;
544
+ }): Promise<APIResponse<AttachmentResult[]>>;
545
+ }
546
+
547
+ /**
548
+ * Document Processing APIs
549
+ * Handles document translation and conversion endpoints
550
+ */
551
+
552
+ /**
553
+ * Document API module
554
+ */
555
+ declare class DocumentAPI {
556
+ private client;
557
+ constructor(client: UnityClawClient);
558
+ /**
559
+ * Translate document
560
+ * @see /api/doc/translate
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const result = await client.document.translate({
565
+ * attachment: [{ tmp_url: 'https://...', name: 'document.pdf' }],
566
+ * source_language: { value: 'en', label: 'English' },
567
+ * target_language: { value: 'zh', label: 'Chinese' }
568
+ * });
569
+ * ```
570
+ */
571
+ translate(params: {
572
+ attachment: DocTranslateParams['attachment'];
573
+ source_language: LabelFieldItem | string;
574
+ target_language: LabelFieldItem | string;
575
+ }): Promise<APIResponse<AttachmentResult[]>>;
576
+ /**
577
+ * Convert image to Word document
578
+ * @see /api/doc_convert/image2word
579
+ */
580
+ image2Word(params: {
581
+ attachment: DocConvertParams['attachment'];
582
+ }): Promise<APIResponse<AttachmentResult[]>>;
583
+ /**
584
+ * Convert image to PowerPoint
585
+ * @see /api/doc_convert/image2ppt
586
+ */
587
+ image2Ppt(params: {
588
+ attachment: DocConvertParams['attachment'];
589
+ }): Promise<APIResponse<AttachmentResult[]>>;
590
+ /**
591
+ * Convert image to Excel
592
+ * @see /api/doc_convert/image2excel
593
+ */
594
+ image2Excel(params: {
595
+ attachment: DocConvertParams['attachment'];
596
+ }): Promise<APIResponse<AttachmentResult[]>>;
597
+ /**
598
+ * Convert image to PDF
599
+ * @see /api/doc_convert/image2pdf
600
+ */
601
+ image2Pdf(params: {
602
+ attachment: DocConvertParams['attachment'];
603
+ }): Promise<APIResponse<AttachmentResult[]>>;
604
+ /**
605
+ * Convert PDF to Word document
606
+ * @see /api/doc_convert/pdf2word
607
+ */
608
+ pdf2Word(params: {
609
+ attachment: DocConvertParams['attachment'];
610
+ }): Promise<APIResponse<AttachmentResult[]>>;
611
+ /**
612
+ * Convert PDF to PowerPoint
613
+ * @see /api/doc_convert/pdf2ppt
614
+ */
615
+ pdf2Ppt(params: {
616
+ attachment: DocConvertParams['attachment'];
617
+ }): Promise<APIResponse<AttachmentResult[]>>;
618
+ /**
619
+ * Convert PDF to Excel
620
+ * @see /api/doc_convert/pdf2excel
621
+ */
622
+ pdf2Excel(params: {
623
+ attachment: DocConvertParams['attachment'];
624
+ }): Promise<APIResponse<AttachmentResult[]>>;
625
+ /**
626
+ * Convert PDF to image
627
+ * @see /api/doc_convert/pdf2image
628
+ */
629
+ pdf2Image(params: {
630
+ attachment: DocConvertParams['attachment'];
631
+ }): Promise<APIResponse<AttachmentResult[]>>;
632
+ /**
633
+ * Generic document conversion
634
+ * @see /api/doc_convert/image
635
+ * @see /api/doc_convert/pdf
636
+ */
637
+ convert(params: {
638
+ attachment: DocConvertParams['attachment'];
639
+ input_format?: string;
640
+ output_format: string;
641
+ }): Promise<APIResponse<AttachmentResult[]>>;
642
+ }
643
+
644
+ /**
645
+ * Media Analysis APIs
646
+ * Handles video/audio analysis endpoints
647
+ */
648
+
649
+ /**
650
+ * Media API module
651
+ */
652
+ declare class MediaAPI {
653
+ private client;
654
+ constructor(client: UnityClawClient);
655
+ /**
656
+ * Analyze media (video/audio) from URL or file
657
+ * @see /api/media_analysis
658
+ *
659
+ * @example
660
+ * ```typescript
661
+ * // Analyze from URL
662
+ * const result = await client.media.analyze({
663
+ * url: [{ link: 'https://youtube.com/watch?v=...' }]
664
+ * });
665
+ *
666
+ * // Analyze from uploaded file
667
+ * const result = await client.media.analyze({
668
+ * url: [{ tmp_url: 'https://...', type: 'video/mp4', name: 'video.mp4' }]
669
+ * });
670
+ * ```
671
+ */
672
+ analyze(params: MediaAnalysisParams): Promise<APIResponse<MediaAnalysisResult>>;
673
+ /**
674
+ * Analyze video file directly
675
+ * @see /api/video_analysis (internal)
676
+ *
677
+ * @example
678
+ * ```typescript
679
+ * const result = await client.media.analyzeVideo({
680
+ * file: { tmp_url: 'https://...', type: 'video/mp4', name: 'video.mp4' },
681
+ * prompt: 'Summarize this video'
682
+ * });
683
+ * ```
684
+ */
685
+ analyzeVideo(params: {
686
+ file: {
687
+ tmp_url: string;
688
+ type?: string;
689
+ name?: string;
690
+ size?: number;
691
+ };
692
+ prompt?: string;
693
+ }): Promise<APIResponse<MediaAnalysisResult>>;
694
+ /**
695
+ * Analyze social media video (TikTok, YouTube, etc.)
696
+ * @see /api/media_analysis
697
+ *
698
+ * @example
699
+ * ```typescript
700
+ * const result = await client.media.analyzeSocialVideo({
701
+ * url: 'https://www.tiktok.com/@user/video/123456'
702
+ * });
703
+ * ```
704
+ */
705
+ analyzeSocialVideo(params: {
706
+ url: string;
707
+ }): Promise<APIResponse<MediaAnalysisResult>>;
708
+ }
709
+
710
+ /**
711
+ * UnityClaw SDK Client
712
+ * Main client class for interacting with UnityClaw API
713
+ */
714
+
715
+ /**
716
+ * UnityClaw SDK Client
717
+ *
718
+ * AI-powered API client for image/video generation, media analysis, and more.
719
+ * Each execution creates a local task folder, downloads attachments,
720
+ * and records execution logs.
721
+ *
722
+ * @example
723
+ * ```typescript
724
+ * const client = new UnityClawClient({ apiKey: 'your-api-key' });
725
+ *
726
+ * // Generate image
727
+ * const result = await client.image.gemini({
728
+ * prompt: 'A beautiful sunset over mountains'
729
+ * });
730
+ * ```
731
+ */
732
+ declare class UnityClawClient {
733
+ private readonly config;
734
+ private readonly httpClient;
735
+ private readonly taskFolderManager;
736
+ readonly image: ImageAPI;
737
+ readonly video: VideoAPI;
738
+ readonly document: DocumentAPI;
739
+ readonly media: MediaAPI;
740
+ constructor(config?: UnityClawClientConfig);
741
+ /**
742
+ * Get the underlying HTTP client for custom requests
743
+ */
744
+ getHttpClient(): AxiosInstance;
745
+ /**
746
+ * Get the task folder manager
747
+ */
748
+ getTaskFolderManager(): TaskFolderManager;
749
+ /**
750
+ * Get current configuration
751
+ */
752
+ getConfig(): Required<UnityClawClientConfig>;
753
+ /**
754
+ * Build context object from config defaults
755
+ */
756
+ private buildContext;
757
+ /**
758
+ * Make a request to the UnityClaw API
759
+ * This is the core method that handles task folder creation, logging, and error handling
760
+ */
761
+ request<T = unknown>(endpoint: string, params: Record<string, unknown>, contextOverrides?: Partial<SDKContext>): Promise<TaskResult<APIResponse<T>>>;
762
+ /**
763
+ * Generate image using Gemini API
764
+ * @deprecated Use client.image.gemini() instead
765
+ */
766
+ generateImage(params: GeminiImageParams): Promise<APIResponse<AttachmentResult[]>>;
767
+ /**
768
+ * Generate image using JiMeng API
769
+ * @deprecated Use client.image.jimeng() instead
770
+ */
771
+ generateJiMengImage(params: JiMengImageParams): Promise<APIResponse<AttachmentResult[]>>;
772
+ /**
773
+ * Generate video using Sora API
774
+ * @deprecated Use client.video.sora() instead
775
+ */
776
+ generateSoraVideo(params: SoraVideoParams): Promise<APIResponse<AttachmentResult[]>>;
777
+ /**
778
+ * Generate video using Veo API
779
+ * @deprecated Use client.video.veo() instead
780
+ */
781
+ generateVeoVideo(params: VeoVideoParams): Promise<APIResponse<AttachmentResult[]>>;
782
+ /**
783
+ * Generate video using Kling API
784
+ * @deprecated Use client.video.kling() instead
785
+ */
786
+ generateKlingVideo(params: KlingVideoParams): Promise<APIResponse<AttachmentResult[]>>;
787
+ /**
788
+ * Translate document
789
+ * @deprecated Use client.document.translate() instead
790
+ */
791
+ translateDocument(params: DocTranslateParams): Promise<APIResponse<AttachmentResult[]>>;
792
+ /**
793
+ * Analyze media (video/audio from URL)
794
+ * @deprecated Use client.media.analyze() instead
795
+ */
796
+ analyzeMedia(params: MediaAnalysisParams): Promise<APIResponse<MediaAnalysisResult>>;
797
+ }
798
+
799
+ 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 };