@antchain/antdigital-creative 1.0.3
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/client.d.ts +380 -0
- package/dist/client.js +508 -0
- package/dist/client.js.map +1 -0
- package/package.json +32 -0
- package/src/client.ts +764 -0
package/src/client.ts
ADDED
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
// This file is auto-generated, don't edit it
|
|
2
|
+
import AntchainUtil from '@antchain/alipay-util';
|
|
3
|
+
import Util, * as $Util from '@alicloud/tea-util';
|
|
4
|
+
import RPCUtil from '@alicloud/rpc-util';
|
|
5
|
+
import * as $tea from '@alicloud/tea-typescript';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @remarks
|
|
9
|
+
* Model for initing client
|
|
10
|
+
*/
|
|
11
|
+
export class Config extends $tea.Model {
|
|
12
|
+
/**
|
|
13
|
+
* @remarks
|
|
14
|
+
* accesskey id
|
|
15
|
+
*/
|
|
16
|
+
accessKeyId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @remarks
|
|
19
|
+
* accesskey secret
|
|
20
|
+
*/
|
|
21
|
+
accessKeySecret?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @remarks
|
|
24
|
+
* security token
|
|
25
|
+
*/
|
|
26
|
+
securityToken?: string;
|
|
27
|
+
/**
|
|
28
|
+
* @remarks
|
|
29
|
+
* http protocol
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* http
|
|
33
|
+
*/
|
|
34
|
+
protocol?: string;
|
|
35
|
+
/**
|
|
36
|
+
* @remarks
|
|
37
|
+
* read timeout
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* 10
|
|
41
|
+
*/
|
|
42
|
+
readTimeout?: number;
|
|
43
|
+
/**
|
|
44
|
+
* @remarks
|
|
45
|
+
* connect timeout
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* 10
|
|
49
|
+
*/
|
|
50
|
+
connectTimeout?: number;
|
|
51
|
+
/**
|
|
52
|
+
* @remarks
|
|
53
|
+
* http proxy
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* http://localhost
|
|
57
|
+
*/
|
|
58
|
+
httpProxy?: string;
|
|
59
|
+
/**
|
|
60
|
+
* @remarks
|
|
61
|
+
* https proxy
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* https://localhost
|
|
65
|
+
*/
|
|
66
|
+
httpsProxy?: string;
|
|
67
|
+
/**
|
|
68
|
+
* @remarks
|
|
69
|
+
* endpoint
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* cs.aliyuncs.com
|
|
73
|
+
*/
|
|
74
|
+
endpoint?: string;
|
|
75
|
+
/**
|
|
76
|
+
* @remarks
|
|
77
|
+
* proxy white list
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* http://localhost
|
|
81
|
+
*/
|
|
82
|
+
noProxy?: string;
|
|
83
|
+
/**
|
|
84
|
+
* @remarks
|
|
85
|
+
* max idle conns
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* 3
|
|
89
|
+
*/
|
|
90
|
+
maxIdleConns?: number;
|
|
91
|
+
/**
|
|
92
|
+
* @remarks
|
|
93
|
+
* user agent
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* Alibabacloud/1
|
|
97
|
+
*/
|
|
98
|
+
userAgent?: string;
|
|
99
|
+
/**
|
|
100
|
+
* @remarks
|
|
101
|
+
* socks5 proxy
|
|
102
|
+
*/
|
|
103
|
+
socks5Proxy?: string;
|
|
104
|
+
/**
|
|
105
|
+
* @remarks
|
|
106
|
+
* socks5 network
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* TCP
|
|
110
|
+
*/
|
|
111
|
+
socks5NetWork?: string;
|
|
112
|
+
/**
|
|
113
|
+
* @remarks
|
|
114
|
+
* 长链接最大空闲时长
|
|
115
|
+
*/
|
|
116
|
+
maxIdleTimeMillis?: number;
|
|
117
|
+
/**
|
|
118
|
+
* @remarks
|
|
119
|
+
* 长链接最大连接时长
|
|
120
|
+
*/
|
|
121
|
+
keepAliveDurationMillis?: number;
|
|
122
|
+
/**
|
|
123
|
+
* @remarks
|
|
124
|
+
* 最大连接数(长链接最大总数)
|
|
125
|
+
*/
|
|
126
|
+
maxRequests?: number;
|
|
127
|
+
/**
|
|
128
|
+
* @remarks
|
|
129
|
+
* 每个目标主机的最大连接数(分主机域名的长链接最大总数
|
|
130
|
+
*/
|
|
131
|
+
maxRequestsPerHost?: number;
|
|
132
|
+
static names(): { [key: string]: string } {
|
|
133
|
+
return {
|
|
134
|
+
accessKeyId: 'accessKeyId',
|
|
135
|
+
accessKeySecret: 'accessKeySecret',
|
|
136
|
+
securityToken: 'securityToken',
|
|
137
|
+
protocol: 'protocol',
|
|
138
|
+
readTimeout: 'readTimeout',
|
|
139
|
+
connectTimeout: 'connectTimeout',
|
|
140
|
+
httpProxy: 'httpProxy',
|
|
141
|
+
httpsProxy: 'httpsProxy',
|
|
142
|
+
endpoint: 'endpoint',
|
|
143
|
+
noProxy: 'noProxy',
|
|
144
|
+
maxIdleConns: 'maxIdleConns',
|
|
145
|
+
userAgent: 'userAgent',
|
|
146
|
+
socks5Proxy: 'socks5Proxy',
|
|
147
|
+
socks5NetWork: 'socks5NetWork',
|
|
148
|
+
maxIdleTimeMillis: 'maxIdleTimeMillis',
|
|
149
|
+
keepAliveDurationMillis: 'keepAliveDurationMillis',
|
|
150
|
+
maxRequests: 'maxRequests',
|
|
151
|
+
maxRequestsPerHost: 'maxRequestsPerHost',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static types(): { [key: string]: any } {
|
|
156
|
+
return {
|
|
157
|
+
accessKeyId: 'string',
|
|
158
|
+
accessKeySecret: 'string',
|
|
159
|
+
securityToken: 'string',
|
|
160
|
+
protocol: 'string',
|
|
161
|
+
readTimeout: 'number',
|
|
162
|
+
connectTimeout: 'number',
|
|
163
|
+
httpProxy: 'string',
|
|
164
|
+
httpsProxy: 'string',
|
|
165
|
+
endpoint: 'string',
|
|
166
|
+
noProxy: 'string',
|
|
167
|
+
maxIdleConns: 'number',
|
|
168
|
+
userAgent: 'string',
|
|
169
|
+
socks5Proxy: 'string',
|
|
170
|
+
socks5NetWork: 'string',
|
|
171
|
+
maxIdleTimeMillis: 'number',
|
|
172
|
+
keepAliveDurationMillis: 'number',
|
|
173
|
+
maxRequests: 'number',
|
|
174
|
+
maxRequestsPerHost: 'number',
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
constructor(map?: { [key: string]: any }) {
|
|
179
|
+
super(map);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export class PushVideogenerationRequest extends $tea.Model {
|
|
184
|
+
// OAuth模式下的授权token
|
|
185
|
+
authToken?: string;
|
|
186
|
+
productInstanceId?: string;
|
|
187
|
+
// 模型标识,如 :doubao-seedance-2-0-260128
|
|
188
|
+
model: string;
|
|
189
|
+
// 文本提示词
|
|
190
|
+
prompt: string;
|
|
191
|
+
// 图生视频参考图片 URL
|
|
192
|
+
imageUrl?: string[];
|
|
193
|
+
// 视频参考/续写时传入视频 URL
|
|
194
|
+
videoUrl?: string[];
|
|
195
|
+
// 参考音频URL列表
|
|
196
|
+
audioUrl?: string[];
|
|
197
|
+
// 比例
|
|
198
|
+
ratio?: string;
|
|
199
|
+
// 视频时长(秒)
|
|
200
|
+
duration?: number;
|
|
201
|
+
// 请求追踪 ID,用于幂等去重
|
|
202
|
+
requestId?: string;
|
|
203
|
+
// 扩展JSON
|
|
204
|
+
ext?: string;
|
|
205
|
+
static names(): { [key: string]: string } {
|
|
206
|
+
return {
|
|
207
|
+
authToken: 'auth_token',
|
|
208
|
+
productInstanceId: 'product_instance_id',
|
|
209
|
+
model: 'model',
|
|
210
|
+
prompt: 'prompt',
|
|
211
|
+
imageUrl: 'image_url',
|
|
212
|
+
videoUrl: 'video_url',
|
|
213
|
+
audioUrl: 'audio_url',
|
|
214
|
+
ratio: 'ratio',
|
|
215
|
+
duration: 'duration',
|
|
216
|
+
requestId: 'request_id',
|
|
217
|
+
ext: 'ext',
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static types(): { [key: string]: any } {
|
|
222
|
+
return {
|
|
223
|
+
authToken: 'string',
|
|
224
|
+
productInstanceId: 'string',
|
|
225
|
+
model: 'string',
|
|
226
|
+
prompt: 'string',
|
|
227
|
+
imageUrl: { 'type': 'array', 'itemType': 'string' },
|
|
228
|
+
videoUrl: { 'type': 'array', 'itemType': 'string' },
|
|
229
|
+
audioUrl: { 'type': 'array', 'itemType': 'string' },
|
|
230
|
+
ratio: 'string',
|
|
231
|
+
duration: 'number',
|
|
232
|
+
requestId: 'string',
|
|
233
|
+
ext: 'string',
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
constructor(map?: { [key: string]: any }) {
|
|
238
|
+
super(map);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export class PushVideogenerationResponse extends $tea.Model {
|
|
243
|
+
// 请求唯一ID,用于链路跟踪和问题排查
|
|
244
|
+
reqMsgId?: string;
|
|
245
|
+
// 结果码,一般OK表示调用成功
|
|
246
|
+
resultCode?: string;
|
|
247
|
+
// 异常信息的文本描述
|
|
248
|
+
resultMsg?: string;
|
|
249
|
+
// 任务 ID,后续查询结果通过此参数获取
|
|
250
|
+
taskId?: string;
|
|
251
|
+
// 任务状态:pending(等待中)、processing(处理中)、succeeded(已成功)、failed(已失败)
|
|
252
|
+
status?: string;
|
|
253
|
+
// 模型名称
|
|
254
|
+
model?: string;
|
|
255
|
+
// 扩展JSON
|
|
256
|
+
ext?: string;
|
|
257
|
+
static names(): { [key: string]: string } {
|
|
258
|
+
return {
|
|
259
|
+
reqMsgId: 'req_msg_id',
|
|
260
|
+
resultCode: 'result_code',
|
|
261
|
+
resultMsg: 'result_msg',
|
|
262
|
+
taskId: 'task_id',
|
|
263
|
+
status: 'status',
|
|
264
|
+
model: 'model',
|
|
265
|
+
ext: 'ext',
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
static types(): { [key: string]: any } {
|
|
270
|
+
return {
|
|
271
|
+
reqMsgId: 'string',
|
|
272
|
+
resultCode: 'string',
|
|
273
|
+
resultMsg: 'string',
|
|
274
|
+
taskId: 'string',
|
|
275
|
+
status: 'string',
|
|
276
|
+
model: 'string',
|
|
277
|
+
ext: 'string',
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
constructor(map?: { [key: string]: any }) {
|
|
282
|
+
super(map);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export class QueryVideogenerationRequest extends $tea.Model {
|
|
287
|
+
// OAuth模式下的授权token
|
|
288
|
+
authToken?: string;
|
|
289
|
+
productInstanceId?: string;
|
|
290
|
+
// 查询的任务ID
|
|
291
|
+
taskId: string;
|
|
292
|
+
static names(): { [key: string]: string } {
|
|
293
|
+
return {
|
|
294
|
+
authToken: 'auth_token',
|
|
295
|
+
productInstanceId: 'product_instance_id',
|
|
296
|
+
taskId: 'task_id',
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
static types(): { [key: string]: any } {
|
|
301
|
+
return {
|
|
302
|
+
authToken: 'string',
|
|
303
|
+
productInstanceId: 'string',
|
|
304
|
+
taskId: 'string',
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
constructor(map?: { [key: string]: any }) {
|
|
309
|
+
super(map);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export class QueryVideogenerationResponse extends $tea.Model {
|
|
314
|
+
// 请求唯一ID,用于链路跟踪和问题排查
|
|
315
|
+
reqMsgId?: string;
|
|
316
|
+
// 结果码,一般OK表示调用成功
|
|
317
|
+
resultCode?: string;
|
|
318
|
+
// 异常信息的文本描述
|
|
319
|
+
resultMsg?: string;
|
|
320
|
+
// 任务ID
|
|
321
|
+
taskId?: string;
|
|
322
|
+
// 任务状态
|
|
323
|
+
status?: string;
|
|
324
|
+
// 视频输出URL
|
|
325
|
+
videoUrl?: string;
|
|
326
|
+
// 错误码
|
|
327
|
+
errorCode?: string;
|
|
328
|
+
// 错误信息
|
|
329
|
+
errorMessage?: string;
|
|
330
|
+
static names(): { [key: string]: string } {
|
|
331
|
+
return {
|
|
332
|
+
reqMsgId: 'req_msg_id',
|
|
333
|
+
resultCode: 'result_code',
|
|
334
|
+
resultMsg: 'result_msg',
|
|
335
|
+
taskId: 'task_id',
|
|
336
|
+
status: 'status',
|
|
337
|
+
videoUrl: 'video_url',
|
|
338
|
+
errorCode: 'error_code',
|
|
339
|
+
errorMessage: 'error_message',
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
static types(): { [key: string]: any } {
|
|
344
|
+
return {
|
|
345
|
+
reqMsgId: 'string',
|
|
346
|
+
resultCode: 'string',
|
|
347
|
+
resultMsg: 'string',
|
|
348
|
+
taskId: 'string',
|
|
349
|
+
status: 'string',
|
|
350
|
+
videoUrl: 'string',
|
|
351
|
+
errorCode: 'string',
|
|
352
|
+
errorMessage: 'string',
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
constructor(map?: { [key: string]: any }) {
|
|
357
|
+
super(map);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export class UploadAssetRequest extends $tea.Model {
|
|
362
|
+
// OAuth模式下的授权token
|
|
363
|
+
authToken?: string;
|
|
364
|
+
productInstanceId?: string;
|
|
365
|
+
// 资产类型
|
|
366
|
+
assetType: string;
|
|
367
|
+
// 公网可访问的文件URL
|
|
368
|
+
fileUrl: string;
|
|
369
|
+
// 资产名称
|
|
370
|
+
assetName: string;
|
|
371
|
+
static names(): { [key: string]: string } {
|
|
372
|
+
return {
|
|
373
|
+
authToken: 'auth_token',
|
|
374
|
+
productInstanceId: 'product_instance_id',
|
|
375
|
+
assetType: 'asset_type',
|
|
376
|
+
fileUrl: 'file_url',
|
|
377
|
+
assetName: 'asset_name',
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
static types(): { [key: string]: any } {
|
|
382
|
+
return {
|
|
383
|
+
authToken: 'string',
|
|
384
|
+
productInstanceId: 'string',
|
|
385
|
+
assetType: 'string',
|
|
386
|
+
fileUrl: 'string',
|
|
387
|
+
assetName: 'string',
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
constructor(map?: { [key: string]: any }) {
|
|
392
|
+
super(map);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export class UploadAssetResponse extends $tea.Model {
|
|
397
|
+
// 请求唯一ID,用于链路跟踪和问题排查
|
|
398
|
+
reqMsgId?: string;
|
|
399
|
+
// 结果码,一般OK表示调用成功
|
|
400
|
+
resultCode?: string;
|
|
401
|
+
// 异常信息的文本描述
|
|
402
|
+
resultMsg?: string;
|
|
403
|
+
// 资产ID
|
|
404
|
+
assetId?: string;
|
|
405
|
+
// 资产状态
|
|
406
|
+
status?: string;
|
|
407
|
+
// 资产类型
|
|
408
|
+
assetType?: string;
|
|
409
|
+
static names(): { [key: string]: string } {
|
|
410
|
+
return {
|
|
411
|
+
reqMsgId: 'req_msg_id',
|
|
412
|
+
resultCode: 'result_code',
|
|
413
|
+
resultMsg: 'result_msg',
|
|
414
|
+
assetId: 'asset_id',
|
|
415
|
+
status: 'status',
|
|
416
|
+
assetType: 'asset_type',
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
static types(): { [key: string]: any } {
|
|
421
|
+
return {
|
|
422
|
+
reqMsgId: 'string',
|
|
423
|
+
resultCode: 'string',
|
|
424
|
+
resultMsg: 'string',
|
|
425
|
+
assetId: 'string',
|
|
426
|
+
status: 'string',
|
|
427
|
+
assetType: 'string',
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
constructor(map?: { [key: string]: any }) {
|
|
432
|
+
super(map);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export class QueryAssetRequest extends $tea.Model {
|
|
437
|
+
// OAuth模式下的授权token
|
|
438
|
+
authToken?: string;
|
|
439
|
+
productInstanceId?: string;
|
|
440
|
+
// 资产ID
|
|
441
|
+
assetId: string;
|
|
442
|
+
static names(): { [key: string]: string } {
|
|
443
|
+
return {
|
|
444
|
+
authToken: 'auth_token',
|
|
445
|
+
productInstanceId: 'product_instance_id',
|
|
446
|
+
assetId: 'asset_id',
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
static types(): { [key: string]: any } {
|
|
451
|
+
return {
|
|
452
|
+
authToken: 'string',
|
|
453
|
+
productInstanceId: 'string',
|
|
454
|
+
assetId: 'string',
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
constructor(map?: { [key: string]: any }) {
|
|
459
|
+
super(map);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export class QueryAssetResponse extends $tea.Model {
|
|
464
|
+
// 请求唯一ID,用于链路跟踪和问题排查
|
|
465
|
+
reqMsgId?: string;
|
|
466
|
+
// 结果码,一般OK表示调用成功
|
|
467
|
+
resultCode?: string;
|
|
468
|
+
// 异常信息的文本描述
|
|
469
|
+
resultMsg?: string;
|
|
470
|
+
// 资产ID
|
|
471
|
+
assetId?: string;
|
|
472
|
+
// 资产状态
|
|
473
|
+
status?: string;
|
|
474
|
+
// 资产类型
|
|
475
|
+
assetType?: string;
|
|
476
|
+
// 资产类型
|
|
477
|
+
assetUrl?: string;
|
|
478
|
+
// 错误信息
|
|
479
|
+
errorMessage?: string;
|
|
480
|
+
// 错误码
|
|
481
|
+
errorCode?: string;
|
|
482
|
+
static names(): { [key: string]: string } {
|
|
483
|
+
return {
|
|
484
|
+
reqMsgId: 'req_msg_id',
|
|
485
|
+
resultCode: 'result_code',
|
|
486
|
+
resultMsg: 'result_msg',
|
|
487
|
+
assetId: 'asset_id',
|
|
488
|
+
status: 'status',
|
|
489
|
+
assetType: 'asset_type',
|
|
490
|
+
assetUrl: 'asset_url',
|
|
491
|
+
errorMessage: 'error_message',
|
|
492
|
+
errorCode: 'error_code',
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
static types(): { [key: string]: any } {
|
|
497
|
+
return {
|
|
498
|
+
reqMsgId: 'string',
|
|
499
|
+
resultCode: 'string',
|
|
500
|
+
resultMsg: 'string',
|
|
501
|
+
assetId: 'string',
|
|
502
|
+
status: 'string',
|
|
503
|
+
assetType: 'string',
|
|
504
|
+
assetUrl: 'string',
|
|
505
|
+
errorMessage: 'string',
|
|
506
|
+
errorCode: 'string',
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
constructor(map?: { [key: string]: any }) {
|
|
511
|
+
super(map);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
export default class Client {
|
|
517
|
+
_endpoint: string;
|
|
518
|
+
_regionId: string;
|
|
519
|
+
_accessKeyId: string;
|
|
520
|
+
_accessKeySecret: string;
|
|
521
|
+
_protocol: string;
|
|
522
|
+
_userAgent: string;
|
|
523
|
+
_readTimeout: number;
|
|
524
|
+
_connectTimeout: number;
|
|
525
|
+
_httpProxy: string;
|
|
526
|
+
_httpsProxy: string;
|
|
527
|
+
_socks5Proxy: string;
|
|
528
|
+
_socks5NetWork: string;
|
|
529
|
+
_noProxy: string;
|
|
530
|
+
_maxIdleConns: number;
|
|
531
|
+
_securityToken: string;
|
|
532
|
+
_maxIdleTimeMillis: number;
|
|
533
|
+
_keepAliveDurationMillis: number;
|
|
534
|
+
_maxRequests: number;
|
|
535
|
+
_maxRequestsPerHost: number;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @remarks
|
|
539
|
+
* Init client with Config
|
|
540
|
+
*
|
|
541
|
+
* @param config - config contains the necessary information to create a client
|
|
542
|
+
*/
|
|
543
|
+
constructor(config: Config) {
|
|
544
|
+
if (Util.isUnset(config)) {
|
|
545
|
+
throw $tea.newError({
|
|
546
|
+
code: "ParameterMissing",
|
|
547
|
+
message: "'config' can not be unset",
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
this._accessKeyId = config.accessKeyId;
|
|
552
|
+
this._accessKeySecret = config.accessKeySecret;
|
|
553
|
+
this._securityToken = config.securityToken;
|
|
554
|
+
this._endpoint = config.endpoint;
|
|
555
|
+
this._protocol = config.protocol;
|
|
556
|
+
this._userAgent = config.userAgent;
|
|
557
|
+
this._readTimeout = Util.defaultNumber(config.readTimeout, 20000);
|
|
558
|
+
this._connectTimeout = Util.defaultNumber(config.connectTimeout, 20000);
|
|
559
|
+
this._httpProxy = config.httpProxy;
|
|
560
|
+
this._httpsProxy = config.httpsProxy;
|
|
561
|
+
this._noProxy = config.noProxy;
|
|
562
|
+
this._socks5Proxy = config.socks5Proxy;
|
|
563
|
+
this._socks5NetWork = config.socks5NetWork;
|
|
564
|
+
this._maxIdleConns = Util.defaultNumber(config.maxIdleConns, 60000);
|
|
565
|
+
this._maxIdleTimeMillis = Util.defaultNumber(config.maxIdleTimeMillis, 5);
|
|
566
|
+
this._keepAliveDurationMillis = Util.defaultNumber(config.keepAliveDurationMillis, 5000);
|
|
567
|
+
this._maxRequests = Util.defaultNumber(config.maxRequests, 100);
|
|
568
|
+
this._maxRequestsPerHost = Util.defaultNumber(config.maxRequestsPerHost, 100);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* @remarks
|
|
573
|
+
* Encapsulate the request and invoke the network
|
|
574
|
+
*
|
|
575
|
+
* @param action - api name
|
|
576
|
+
* @param protocol - http or https
|
|
577
|
+
* @param method - e.g. GET
|
|
578
|
+
* @param pathname - pathname of every api
|
|
579
|
+
* @param request - which contains request params
|
|
580
|
+
* @param runtime - which controls some details of call api, such as retry times
|
|
581
|
+
* @returns the response
|
|
582
|
+
*/
|
|
583
|
+
async doRequest(version: string, action: string, protocol: string, method: string, pathname: string, request: {[key: string]: any}, headers: {[key: string ]: string}, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
584
|
+
let _runtime: { [key: string]: any } = {
|
|
585
|
+
timeouted: "retry",
|
|
586
|
+
readTimeout: Util.defaultNumber(runtime.readTimeout, this._readTimeout),
|
|
587
|
+
connectTimeout: Util.defaultNumber(runtime.connectTimeout, this._connectTimeout),
|
|
588
|
+
httpProxy: Util.defaultString(runtime.httpProxy, this._httpProxy),
|
|
589
|
+
httpsProxy: Util.defaultString(runtime.httpsProxy, this._httpsProxy),
|
|
590
|
+
noProxy: Util.defaultString(runtime.noProxy, this._noProxy),
|
|
591
|
+
maxIdleConns: Util.defaultNumber(runtime.maxIdleConns, this._maxIdleConns),
|
|
592
|
+
maxIdleTimeMillis: this._maxIdleTimeMillis,
|
|
593
|
+
keepAliveDuration: this._keepAliveDurationMillis,
|
|
594
|
+
maxRequests: this._maxRequests,
|
|
595
|
+
maxRequestsPerHost: this._maxRequestsPerHost,
|
|
596
|
+
retry: {
|
|
597
|
+
retryable: runtime.autoretry,
|
|
598
|
+
maxAttempts: Util.defaultNumber(runtime.maxAttempts, 3),
|
|
599
|
+
},
|
|
600
|
+
backoff: {
|
|
601
|
+
policy: Util.defaultString(runtime.backoffPolicy, "no"),
|
|
602
|
+
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
603
|
+
},
|
|
604
|
+
ignoreSSL: runtime.ignoreSSL,
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
let _lastRequest = null;
|
|
608
|
+
let _now = Date.now();
|
|
609
|
+
let _retryTimes = 0;
|
|
610
|
+
while ($tea.allowRetry(_runtime['retry'], _retryTimes, _now)) {
|
|
611
|
+
if (_retryTimes > 0) {
|
|
612
|
+
let _backoffTime = $tea.getBackoffTime(_runtime['backoff'], _retryTimes);
|
|
613
|
+
if (_backoffTime > 0) {
|
|
614
|
+
await $tea.sleep(_backoffTime);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
_retryTimes = _retryTimes + 1;
|
|
619
|
+
try {
|
|
620
|
+
let request_ = new $tea.Request();
|
|
621
|
+
request_.protocol = Util.defaultString(this._protocol, protocol);
|
|
622
|
+
request_.method = method;
|
|
623
|
+
request_.pathname = pathname;
|
|
624
|
+
request_.query = {
|
|
625
|
+
method: action,
|
|
626
|
+
version: version,
|
|
627
|
+
sign_type: "HmacSHA1",
|
|
628
|
+
req_time: AntchainUtil.getTimestamp(),
|
|
629
|
+
req_msg_id: AntchainUtil.getNonce(),
|
|
630
|
+
access_key: this._accessKeyId,
|
|
631
|
+
base_sdk_version: "TeaSDK-2.0",
|
|
632
|
+
sdk_version: "1.0.3",
|
|
633
|
+
_prod_code: "CREATIVE",
|
|
634
|
+
_prod_channel: "default",
|
|
635
|
+
};
|
|
636
|
+
if (!Util.empty(this._securityToken)) {
|
|
637
|
+
request_.query["security_token"] = this._securityToken;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
request_.headers = {
|
|
641
|
+
host: Util.defaultString(this._endpoint, "openapi.antchain.antgroup.com"),
|
|
642
|
+
'user-agent': Util.getUserAgent(this._userAgent),
|
|
643
|
+
...headers,
|
|
644
|
+
};
|
|
645
|
+
let tmp = Util.anyifyMapValue(RPCUtil.query(request));
|
|
646
|
+
request_.body = new $tea.BytesReadable(Util.toFormString(tmp));
|
|
647
|
+
request_.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
648
|
+
let signedParam = {
|
|
649
|
+
...request_.query,
|
|
650
|
+
...RPCUtil.query(request),
|
|
651
|
+
};
|
|
652
|
+
request_.query["sign"] = AntchainUtil.getSignature(signedParam, this._accessKeySecret);
|
|
653
|
+
_lastRequest = request_;
|
|
654
|
+
let response_ = await $tea.doAction(request_, _runtime);
|
|
655
|
+
|
|
656
|
+
let raw = await Util.readAsString(response_.body);
|
|
657
|
+
let obj = Util.parseJSON(raw);
|
|
658
|
+
let res = Util.assertAsMap(obj);
|
|
659
|
+
let resp = Util.assertAsMap(res["response"]);
|
|
660
|
+
if (AntchainUtil.hasError(raw, this._accessKeySecret)) {
|
|
661
|
+
throw $tea.newError({
|
|
662
|
+
message: resp["result_msg"],
|
|
663
|
+
data: resp,
|
|
664
|
+
code: resp["result_code"],
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
return resp;
|
|
669
|
+
} catch (ex) {
|
|
670
|
+
if ($tea.isRetryable(ex)) {
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
throw ex;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
throw $tea.newUnretryableError(_lastRequest);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* @remarks
|
|
682
|
+
* Description: 内容创作平台-视频生成-推送
|
|
683
|
+
* Summary: 内容创作平台-视频生成-推送
|
|
684
|
+
*/
|
|
685
|
+
async pushVideogeneration(request: PushVideogenerationRequest): Promise<PushVideogenerationResponse> {
|
|
686
|
+
let runtime = new $Util.RuntimeOptions({ });
|
|
687
|
+
let headers : {[key: string ]: string} = { };
|
|
688
|
+
return await this.pushVideogenerationEx(request, headers, runtime);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* @remarks
|
|
693
|
+
* Description: 内容创作平台-视频生成-推送
|
|
694
|
+
* Summary: 内容创作平台-视频生成-推送
|
|
695
|
+
*/
|
|
696
|
+
async pushVideogenerationEx(request: PushVideogenerationRequest, headers: {[key: string ]: string}, runtime: $Util.RuntimeOptions): Promise<PushVideogenerationResponse> {
|
|
697
|
+
Util.validateModel(request);
|
|
698
|
+
return $tea.cast<PushVideogenerationResponse>(await this.doRequest("1.0", "antdigital.creative.videogeneration.push", "HTTPS", "POST", `/gateway.do`, $tea.toMap(request), headers, runtime), new PushVideogenerationResponse({}));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* @remarks
|
|
703
|
+
* Description: 视频创作接口查询
|
|
704
|
+
* Summary: 视频创作接口查询
|
|
705
|
+
*/
|
|
706
|
+
async queryVideogeneration(request: QueryVideogenerationRequest): Promise<QueryVideogenerationResponse> {
|
|
707
|
+
let runtime = new $Util.RuntimeOptions({ });
|
|
708
|
+
let headers : {[key: string ]: string} = { };
|
|
709
|
+
return await this.queryVideogenerationEx(request, headers, runtime);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* @remarks
|
|
714
|
+
* Description: 视频创作接口查询
|
|
715
|
+
* Summary: 视频创作接口查询
|
|
716
|
+
*/
|
|
717
|
+
async queryVideogenerationEx(request: QueryVideogenerationRequest, headers: {[key: string ]: string}, runtime: $Util.RuntimeOptions): Promise<QueryVideogenerationResponse> {
|
|
718
|
+
Util.validateModel(request);
|
|
719
|
+
return $tea.cast<QueryVideogenerationResponse>(await this.doRequest("1.0", "antdigital.creative.videogeneration.query", "HTTPS", "POST", `/gateway.do`, $tea.toMap(request), headers, runtime), new QueryVideogenerationResponse({}));
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* @remarks
|
|
724
|
+
* Description: 资产上传接口
|
|
725
|
+
* Summary: 资产上传接口
|
|
726
|
+
*/
|
|
727
|
+
async uploadAsset(request: UploadAssetRequest): Promise<UploadAssetResponse> {
|
|
728
|
+
let runtime = new $Util.RuntimeOptions({ });
|
|
729
|
+
let headers : {[key: string ]: string} = { };
|
|
730
|
+
return await this.uploadAssetEx(request, headers, runtime);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* @remarks
|
|
735
|
+
* Description: 资产上传接口
|
|
736
|
+
* Summary: 资产上传接口
|
|
737
|
+
*/
|
|
738
|
+
async uploadAssetEx(request: UploadAssetRequest, headers: {[key: string ]: string}, runtime: $Util.RuntimeOptions): Promise<UploadAssetResponse> {
|
|
739
|
+
Util.validateModel(request);
|
|
740
|
+
return $tea.cast<UploadAssetResponse>(await this.doRequest("1.0", "antdigital.creative.asset.upload", "HTTPS", "POST", `/gateway.do`, $tea.toMap(request), headers, runtime), new UploadAssetResponse({}));
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* @remarks
|
|
745
|
+
* Description: 资产查询接口
|
|
746
|
+
* Summary: 资产查询接口
|
|
747
|
+
*/
|
|
748
|
+
async queryAsset(request: QueryAssetRequest): Promise<QueryAssetResponse> {
|
|
749
|
+
let runtime = new $Util.RuntimeOptions({ });
|
|
750
|
+
let headers : {[key: string ]: string} = { };
|
|
751
|
+
return await this.queryAssetEx(request, headers, runtime);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* @remarks
|
|
756
|
+
* Description: 资产查询接口
|
|
757
|
+
* Summary: 资产查询接口
|
|
758
|
+
*/
|
|
759
|
+
async queryAssetEx(request: QueryAssetRequest, headers: {[key: string ]: string}, runtime: $Util.RuntimeOptions): Promise<QueryAssetResponse> {
|
|
760
|
+
Util.validateModel(request);
|
|
761
|
+
return $tea.cast<QueryAssetResponse>(await this.doRequest("1.0", "antdigital.creative.asset.query", "HTTPS", "POST", `/gateway.do`, $tea.toMap(request), headers, runtime), new QueryAssetResponse({}));
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
}
|