@ray-js/api 1.6.6 → 1.6.8

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.
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * BaseKit
3
3
  *
4
- * @version 3.14.3
4
+ * @version 3.17.7
5
5
  */
6
6
  declare namespace ty {
7
7
  /**
8
- * 停止监听加速度数据
9
- */
8
+ *@description 停止监听加速度数据
9
+ *@error {10001: 'Sensor initialization fail'}*/
10
10
  export function stopAccelerometer(params?: {
11
- complete?: () => void
12
11
  success?: (params: null) => void
13
12
  fail?: (params: {
14
13
  errorMsg: string
@@ -18,15 +17,15 @@ declare namespace ty {
18
17
  errorMsg: string
19
18
  }
20
19
  }) => void
20
+ complete?: () => void
21
21
  }): void
22
22
 
23
23
  /**
24
- * 开始监听加速度数据
25
- */
24
+ *@description 开始监听加速度数据,初始化事件回调方法
25
+ *@error {10001: 'Sensor initialization fail'}*/
26
26
  export function startAccelerometer(params?: {
27
27
  /** 监听加速度数据回调函数的执行频率 */
28
28
  interval?: AccelerometerInterval
29
- complete?: () => void
30
29
  success?: (params: null) => void
31
30
  fail?: (params: {
32
31
  errorMsg: string
@@ -36,17 +35,17 @@ declare namespace ty {
36
35
  errorMsg: string
37
36
  }
38
37
  }) => void
38
+ complete?: () => void
39
39
  }): void
40
40
 
41
41
  /**
42
- * 获取音频文件时长信息
43
- */
42
+ *@description 获取音频文件时长信息
43
+ *@error {5: 'The necessary parameters are missing'} | {10011: 'file not exist'}*/
44
44
  export function getAudioFileDuration(params: {
45
45
  /** 音频文件路径 */
46
46
  path: string
47
- complete?: () => void
48
47
  success?: (params: {
49
- /** 音频时长 */
48
+ /** 音频时长, 单位 ms */
50
49
  duration: number
51
50
  }) => void
52
51
  fail?: (params: {
@@ -57,26 +56,15 @@ declare namespace ty {
57
56
  errorMsg: string
58
57
  }
59
58
  }) => void
59
+ complete?: () => void
60
60
  }): void
61
61
 
62
62
  /**
63
- * 权限请求方法
64
- */
65
- export function authorize(params: {
66
- /**
67
- * scope 权限名称
68
- * 举例子:
69
- * scope.bluetooth 蓝牙权限
70
- * scope.writePhotosAlbum 写入相册权限
71
- * scope.userLocationBackground 后台定位权限
72
- * scope.record 麦克风权限
73
- * scope.camera 摄像头权限
74
- * scope.userLocation 低精度定位权限
75
- * scope.userPreciseLocation 高精度定位权限
76
- * scope.userInfo 用户信息
77
- */
78
- scope: string
79
- complete?: () => void
63
+ *@description 权限请求方法
64
+ *@error {9001: 'Activity is invalid'} | {9003: 'can‘t find scope permission'} | {9004: 'app no permission'}*/
65
+ export function authorize(params?: {
66
+ /** scope 权限名称 */
67
+ scope?: ScopeBean
80
68
  success?: (params: null) => void
81
69
  fail?: (params: {
82
70
  errorMsg: string
@@ -86,26 +74,15 @@ declare namespace ty {
86
74
  errorMsg: string
87
75
  }
88
76
  }) => void
77
+ complete?: () => void
89
78
  }): void
90
79
 
91
80
  /**
92
- * 查询权限状态
93
- */
94
- export function authorizeStatus(params: {
95
- /**
96
- * scope 权限名称
97
- * 举例子:
98
- * scope.bluetooth 蓝牙权限
99
- * scope.writePhotosAlbum 写入相册权限
100
- * scope.userLocationBackground 后台定位权限
101
- * scope.record 麦克风权限
102
- * scope.camera 摄像头权限
103
- * scope.userLocation 低精度定位权限
104
- * scope.userPreciseLocation 高精度定位权限
105
- * scope.userInfo 用户信息
106
- */
107
- scope: string
108
- complete?: () => void
81
+ *@description 查询权限状态
82
+ *@error {9001: 'Activity is invalid'} | {9003: 'can‘t find scope permission'} | {9004: 'app no permission'} | {9005: 'can‘t find service'}*/
83
+ export function authorizeStatus(params?: {
84
+ /** scope 权限名称 */
85
+ scope?: ScopeBean
109
86
  success?: (params: null) => void
110
87
  fail?: (params: {
111
88
  errorMsg: string
@@ -115,14 +92,70 @@ declare namespace ty {
115
92
  errorMsg: string
116
93
  }
117
94
  }) => void
95
+ complete?: () => void
118
96
  }): void
119
97
 
120
98
  /**
121
- * 获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限
122
- */
99
+ *@description 获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限*/
123
100
  export function getSetting(params?: {
101
+ success?: (params: {
102
+ /** 用户授权结果 */
103
+ authSetting: any
104
+ }) => void
105
+ fail?: (params: {
106
+ errorMsg: string
107
+ errorCode: string | number
108
+ innerError: {
109
+ errorCode: string | number
110
+ errorMsg: string
111
+ }
112
+ }) => void
124
113
  complete?: () => void
125
- success?: (params: { authSetting: Record<string, boolean> }) => void
114
+ }): void
115
+
116
+ /**
117
+ *@description 授权某个协议*/
118
+ export function authorizePolicy(params: {
119
+ /** 当前授权的协议类型,不同协议可以独立授权.例如:ai_algorithm 表示AI算法协议 */
120
+ type: string
121
+ /** 协议的版本 */
122
+ version: string
123
+ /** 协议授权操作 /1 同意 2 不同意 */
124
+ status: number
125
+ success?: (params: {
126
+ /** 是否同意 */
127
+ agreed: boolean
128
+ }) => void
129
+ fail?: (params: {
130
+ errorMsg: string
131
+ errorCode: string | number
132
+ innerError: {
133
+ errorCode: string | number
134
+ errorMsg: string
135
+ }
136
+ }) => void
137
+ complete?: () => void
138
+ }): void
139
+
140
+ /**
141
+ *@description 查询协议的授权状态*/
142
+ export function authorizePolicyStatus(params: {
143
+ /** 当前授权的协议类型,不同协议可以独立授权. 例如:ai_algorithm 表示AI算法协议 */
144
+ type: string
145
+ success?: (params: {
146
+ /** 标题 */
147
+ title: string
148
+ /** 协议名称 */
149
+ agreementName: string
150
+ /** 协议描述 */
151
+ agreementDesc: string
152
+ /** 协议链接 */
153
+ link: string
154
+ /** 协议版本 */
155
+ version: string
156
+ /** 0 未签署(首次)1 未签署(更新)2 已签署 */
157
+ sign: number
158
+ }) => void
126
159
  fail?: (params: {
127
160
  errorMsg: string
128
161
  errorCode: string | number
@@ -131,11 +164,12 @@ declare namespace ty {
131
164
  errorMsg: string
132
165
  }
133
166
  }) => void
167
+ complete?: () => void
134
168
  }): void
135
169
 
136
170
  /**
137
- * 打开另一个小程序
138
- */
171
+ *@description 打开另一个小程序
172
+ *@error {9005: 'can‘t find service'} | {40009: 'miniapp already been open, cannot be open again'}*/
139
173
  export function navigateToMiniProgram(params?: {
140
174
  /** 要打开的小程序appId */
141
175
  appId?: string
@@ -152,7 +186,7 @@ declare namespace ty {
152
186
  /** 打开小程序的转场方式,分为right|bottom,指代水平和竖直方向 */
153
187
  position?: string
154
188
  /** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
155
- extraData?: Record<string, any>
189
+ extraData?: any
156
190
  /**
157
191
  * 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版
158
192
  * trial:体验版
@@ -161,7 +195,6 @@ declare namespace ty {
161
195
  envVersion?: string
162
196
  /** 小程序链接,当传递该参数后,可以不传 appId 和 path */
163
197
  shortLink?: string
164
- complete?: () => void
165
198
  success?: (params: null) => void
166
199
  fail?: (params: {
167
200
  errorMsg: string
@@ -171,11 +204,40 @@ declare namespace ty {
171
204
  errorMsg: string
172
205
  }
173
206
  }) => void
207
+ complete?: () => void
208
+ }): void
209
+
210
+ /**
211
+ *@description 判断API,回调,参数等是否在当前版本可用。
212
+ *@error {5: 'The necessary parameters are missing'}*/
213
+ export function canIUse(params: {
214
+ /** 使用 ${API}.${method}.${param}.${option}方式来调用 */
215
+ schema: string
216
+ success?: (params: {
217
+ /** 当前版本是否可用 */
218
+ result: boolean
219
+ }) => void
220
+ fail?: (params: {
221
+ errorMsg: string
222
+ errorCode: string | number
223
+ innerError: {
224
+ errorCode: string | number
225
+ errorMsg: string
226
+ }
227
+ }) => void
228
+ complete?: () => void
174
229
  }): void
175
230
 
176
231
  /**
177
- * 获取视频缩略图
178
- */
232
+ *@description 判断API,回调,参数等是否在当前版本可用。
233
+ *@error {5: 'The necessary parameters are missing'}*/
234
+ export function canIUseSync(schemaBean?: SchemaBean): {
235
+ /** 当前版本是否可用 */
236
+ result: boolean
237
+ }
238
+
239
+ /**
240
+ *@description 获取视频缩略图*/
179
241
  export function fetchVideoThumbnails(params: {
180
242
  /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
181
243
  filePath: string
@@ -189,7 +251,6 @@ declare namespace ty {
189
251
  thumbnailWidth: number
190
252
  /** 缩略图高,期望值 */
191
253
  thumbnailHeight: number
192
- complete?: () => void
193
254
  success?: (params: {
194
255
  /** 缩略图路径 */
195
256
  thumbnailsPath?: string[]
@@ -202,15 +263,14 @@ declare namespace ty {
202
263
  errorMsg: string
203
264
  }
204
265
  }) => void
266
+ complete?: () => void
205
267
  }): void
206
268
 
207
269
  /**
208
- * 清空视频缩略图
209
- */
270
+ *@description 清空视频缩略图*/
210
271
  export function clearVideoThumbnails(params: {
211
272
  /** 对应视频文件名称 */
212
273
  videoName: string
213
- complete?: () => void
214
274
  success?: (params: null) => void
215
275
  fail?: (params: {
216
276
  errorMsg: string
@@ -220,11 +280,11 @@ declare namespace ty {
220
280
  errorMsg: string
221
281
  }
222
282
  }) => void
283
+ complete?: () => void
223
284
  }): void
224
285
 
225
286
  /**
226
- * 裁剪视频
227
- */
287
+ *@description 裁剪视频*/
228
288
  export function clipVideo(params: {
229
289
  /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
230
290
  filePath: string
@@ -240,7 +300,6 @@ declare namespace ty {
240
300
  * 4 - 1080*1920 码率:3500*1000
241
301
  */
242
302
  level: number
243
- complete?: () => void
244
303
  success?: (params: {
245
304
  /** 裁剪视频路径 */
246
305
  videoClipPath?: string
@@ -253,13 +312,13 @@ declare namespace ty {
253
312
  errorMsg: string
254
313
  }
255
314
  }) => void
315
+ complete?: () => void
256
316
  }): void
257
317
 
258
318
  /**
259
- * 开始监听罗盘数据
260
- */
319
+ *@description 开始监听罗盘数据
320
+ *@error {10001: 'Sensor initialization fail'}*/
261
321
  export function startCompass(params?: {
262
- complete?: () => void
263
322
  success?: (params: null) => void
264
323
  fail?: (params: {
265
324
  errorMsg: string
@@ -269,13 +328,13 @@ declare namespace ty {
269
328
  errorMsg: string
270
329
  }
271
330
  }) => void
331
+ complete?: () => void
272
332
  }): void
273
333
 
274
334
  /**
275
- * 停止监听罗盘数据
276
- */
335
+ *@description 停止监听罗盘数据
336
+ *@error {10001: 'Sensor initialization fail'}*/
277
337
  export function stopCompass(params?: {
278
- complete?: () => void
279
338
  success?: (params: null) => void
280
339
  fail?: (params: {
281
340
  errorMsg: string
@@ -285,15 +344,15 @@ declare namespace ty {
285
344
  errorMsg: string
286
345
  }
287
346
  }) => void
347
+ complete?: () => void
288
348
  }): void
289
349
 
290
350
  /**
291
- * 开始监听设备方向的变化。
292
- */
351
+ *@description 开始监听设备方向的变化。
352
+ *@error {10001: 'Sensor initialization fail'}*/
293
353
  export function startDeviceMotionListening(params?: {
294
354
  /** 监听加速度数据回调函数的执行频率 */
295
355
  interval?: DeviceMotionInterval
296
- complete?: () => void
297
356
  success?: (params: null) => void
298
357
  fail?: (params: {
299
358
  errorMsg: string
@@ -303,13 +362,13 @@ declare namespace ty {
303
362
  errorMsg: string
304
363
  }
305
364
  }) => void
365
+ complete?: () => void
306
366
  }): void
307
367
 
308
368
  /**
309
- * 停止监听设备方向的变化。
310
- */
369
+ *@description 停止监听设备方向的变化。
370
+ *@error {10001: 'Sensor initialization fail'}*/
311
371
  export function stopDeviceMotionListening(params?: {
312
- complete?: () => void
313
372
  success?: (params: null) => void
314
373
  fail?: (params: {
315
374
  errorMsg: string
@@ -319,13 +378,13 @@ declare namespace ty {
319
378
  errorMsg: string
320
379
  }
321
380
  }) => void
381
+ complete?: () => void
322
382
  }): void
323
383
 
324
384
  /**
325
- * 获取通用缓存路径
326
- */
385
+ *@description 获取通用缓存路径
386
+ *@error {9002: 'Context is invalid'}*/
327
387
  export function getTempDirectory(params?: {
328
- complete?: () => void
329
388
  success?: (params: {
330
389
  /** 【待废弃, 不建议使用】临时文件夹路径 */
331
390
  tempDirectory: string
@@ -338,11 +397,12 @@ declare namespace ty {
338
397
  errorMsg: string
339
398
  }
340
399
  }) => void
400
+ complete?: () => void
341
401
  }): void
342
402
 
343
403
  /**
344
- * 写日志文件,需要APP配套使用检测设备网络功能进行日志上传查看。
345
- */
404
+ *@description 写日志文件,需要APP配套使用检测设备网络功能进行日志上传查看。
405
+ *@error {5: 'The necessary parameters are missing'} | {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10019: 'write file error'} | {10020: 'sdcard not mounted error'}*/
346
406
  export function writeLogFile(params: {
347
407
  /** 标识信息,传入devId或groupId */
348
408
  resId: string
@@ -350,7 +410,6 @@ declare namespace ty {
350
410
  data: string
351
411
  /** 内容添加形式,true为追加在文件尾部,false为覆写文件 */
352
412
  append?: boolean
353
- complete?: () => void
354
413
  success?: (params: null) => void
355
414
  fail?: (params: {
356
415
  errorMsg: string
@@ -360,17 +419,17 @@ declare namespace ty {
360
419
  errorMsg: string
361
420
  }
362
421
  }) => void
422
+ complete?: () => void
363
423
  }): void
364
424
 
365
425
  /**
366
- * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息
367
- */
426
+ *@description 获取该小程序下的 本地临时文件 或 本地缓存文件 信息
427
+ *@error {5: 'The necessary parameters are missing'} | {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10026: 'get file info error'}*/
368
428
  export function getFileInfo(params: {
369
429
  /** 要读取的文件路径 */
370
430
  filePath: string
371
431
  /** 计算文件摘要的算法, md5/sha1/sha256 默认MD5 */
372
432
  digestAlgorithm: string
373
- complete?: () => void
374
433
  success?: (params: {
375
434
  /** 文件大小,字节 */
376
435
  size: number
@@ -385,15 +444,15 @@ declare namespace ty {
385
444
  errorMsg: string
386
445
  }
387
446
  }) => void
447
+ complete?: () => void
388
448
  }): void
389
449
 
390
450
  /**
391
- * 开始监听陀螺仪数据。
392
- */
451
+ *@description 开始监听陀螺仪数据。
452
+ *@error {7: 'API Internal processing failed'} | {10001: 'Sensor initialization fail'}*/
393
453
  export function startGyroscope(params?: {
394
454
  /** 监听陀螺仪数据回调函数的执行频率 */
395
455
  interval?: GyroscopeInterval
396
- complete?: () => void
397
456
  success?: (params: null) => void
398
457
  fail?: (params: {
399
458
  errorMsg: string
@@ -403,13 +462,13 @@ declare namespace ty {
403
462
  errorMsg: string
404
463
  }
405
464
  }) => void
465
+ complete?: () => void
406
466
  }): void
407
467
 
408
468
  /**
409
- * 停止监听陀螺仪数据。
410
- */
469
+ *@description 停止监听陀螺仪数据。
470
+ *@error {10001: 'Sensor initialization fail'}*/
411
471
  export function stopGyroscope(params?: {
412
- complete?: () => void
413
472
  success?: (params: null) => void
414
473
  fail?: (params: {
415
474
  errorMsg: string
@@ -419,15 +478,14 @@ declare namespace ty {
419
478
  errorMsg: string
420
479
  }
421
480
  }) => void
481
+ complete?: () => void
422
482
  }): void
423
483
 
424
484
  /**
425
- * 初始化
426
- */
485
+ *@description 初始化*/
427
486
  export function initializeUploadFile(params: {
428
487
  /** 设备id */
429
488
  deviceId: string
430
- complete?: () => void
431
489
  success?: (params: null) => void
432
490
  fail?: (params: {
433
491
  errorMsg: string
@@ -437,11 +495,11 @@ declare namespace ty {
437
495
  errorMsg: string
438
496
  }
439
497
  }) => void
498
+ complete?: () => void
440
499
  }): void
441
500
 
442
501
  /**
443
- * 上传文件
444
- */
502
+ *@description 上传文件*/
445
503
  export function uploadFileToDevice(params: {
446
504
  /** 设备id */
447
505
  deviceId: string
@@ -451,7 +509,6 @@ declare namespace ty {
451
509
  fileList?: string[]
452
510
  /** 扩展字段 */
453
511
  extData?: Object
454
- complete?: () => void
455
512
  success?: (params: {
456
513
  /** 任务id */
457
514
  taskId: string
@@ -464,15 +521,14 @@ declare namespace ty {
464
521
  errorMsg: string
465
522
  }
466
523
  }) => void
524
+ complete?: () => void
467
525
  }): void
468
526
 
469
527
  /**
470
- * 取消上传
471
- */
528
+ *@description 取消上传*/
472
529
  export function cancelUploadFileToDevice(params: {
473
530
  /** 任务id */
474
531
  taskId: string
475
- complete?: () => void
476
532
  success?: (params: null) => void
477
533
  fail?: (params: {
478
534
  errorMsg: string
@@ -482,11 +538,11 @@ declare namespace ty {
482
538
  errorMsg: string
483
539
  }
484
540
  }) => void
541
+ complete?: () => void
485
542
  }): void
486
543
 
487
544
  /**
488
- * 压缩图片
489
- */
545
+ *@description 压缩图片*/
490
546
  export function compressImage(params: {
491
547
  /** 压缩图片路径列表 */
492
548
  fileList?: string[]
@@ -494,7 +550,6 @@ declare namespace ty {
494
550
  dstWidth: number
495
551
  /** 压缩图片的目标高 */
496
552
  dstHeight: number
497
- complete?: () => void
498
553
  success?: (params: {
499
554
  /** 压缩完成的图片路径列表 */
500
555
  fileList?: string[]
@@ -507,15 +562,14 @@ declare namespace ty {
507
562
  errorMsg: string
508
563
  }
509
564
  }) => void
565
+ complete?: () => void
510
566
  }): void
511
567
 
512
568
  /**
513
- * 图片裁剪
514
- */
569
+ *@description 图片裁剪*/
515
570
  export function cropImages(params?: {
516
571
  /** 裁剪图片的地址 */
517
572
  cropFileList?: CropImageItemBean[]
518
- complete?: () => void
519
573
  success?: (params: {
520
574
  /** 裁剪完成的图片路径列表 */
521
575
  fileList?: string[]
@@ -528,16 +582,20 @@ declare namespace ty {
528
582
  errorMsg: string
529
583
  }
530
584
  }) => void
585
+ complete?: () => void
531
586
  }): void
532
587
 
533
588
  /**
534
- * 从本地相册选择图片或使用相机拍照, 可用chooseMedia替代此方法
589
+ *@description 从本地相册选择图片或使用相机拍照, 可用chooseMedia替代此方法
535
590
  *
536
591
  *权限:[scope.camera, scope.writePhotosAlbum]
537
592
  *关联API:[chooseMedia]
538
- */
593
+ *@error {7: 'API Internal processing failed'} | {10002: 'Image picker error'}*/
539
594
  export function chooseImage(params?: {
540
- /** 最多可以选择的图片张数 */
595
+ /**
596
+ * 最多可以选择的图片张数
597
+ * 注意:Android13以上的版本,使用的是系统图片选择器,该字段不生效
598
+ */
541
599
  count?: number
542
600
  /** sizeType ['original', 'compressed'] */
543
601
  sizeType?: string[]
@@ -545,7 +603,6 @@ declare namespace ty {
545
603
  sourceType?: string[]
546
604
  /** 是否取消选择图片后关闭界面的动画效果 */
547
605
  disableDismissAnimationAfterSelect?: boolean
548
- complete?: () => void
549
606
  success?: (params: {
550
607
  /** 图片的本地临时文件路径列表 (本地路径) */
551
608
  tempFilePaths: string[]
@@ -560,15 +617,19 @@ declare namespace ty {
560
617
  errorMsg: string
561
618
  }
562
619
  }) => void
620
+ complete?: () => void
563
621
  }): void
564
622
 
565
623
  /**
566
- * 拍摄或从手机相册中选择图片或视频
624
+ *@description 拍摄或从手机相册中选择图片或视频
567
625
  *
568
626
  *权限:[scope.camera, scope.writePhotosAlbum]
569
- */
627
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {8: 'Method Unauthorized access'} | {10002: 'Image picker error'}*/
570
628
  export function chooseMedia(params?: {
571
- /** 最多可以选择的文件数 */
629
+ /**
630
+ * 最多可以选择的文件数。
631
+ * 注意:Android13以上的版本,使用的是系统图片选择器,该字段不生效
632
+ */
572
633
  count?: number
573
634
  /**
574
635
  * 选择类型, 默认图片
@@ -602,6 +663,7 @@ declare namespace ty {
602
663
  isClipVideo?: boolean
603
664
  /**
604
665
  * 视频最长剪辑时间,单位秒。默认60s
666
+ * 需要设置isClipVideo为true才生效
605
667
  * 时间范围为 60s 至 600 之间。 选择视频的时长小于15s不裁剪
606
668
  */
607
669
  maxClipDuration?: number
@@ -611,7 +673,6 @@ declare namespace ty {
611
673
  * 默认为false, 使用每次文件名称唯一
612
674
  */
613
675
  isGetAlbumFileName?: boolean
614
- complete?: () => void
615
676
  success?: (params: {
616
677
  /**
617
678
  * 文件类型
@@ -630,15 +691,15 @@ declare namespace ty {
630
691
  errorMsg: string
631
692
  }
632
693
  }) => void
694
+ complete?: () => void
633
695
  }): void
634
696
 
635
697
  /**
636
- * 从本地相册选择图片或使用相机拍照(可裁剪)
637
- */
698
+ *@description 从本地相册选择图片或使用相机拍照(可裁剪)
699
+ *@error {7: 'API Internal processing failed'} | {9: 'Method UnKnown error'} | {9001: 'Activity is invalid'} | {9004: 'app no permission'} | {9005: 'can‘t find service'} | {10002: 'Image picker error'}*/
638
700
  export function chooseCropImage(params?: {
639
701
  /** 选择图片的来源 ['album', 'camera'],默认都支持 */
640
702
  sourceType?: string[]
641
- complete?: () => void
642
703
  success?: (params: {
643
704
  /** 文件路径 */
644
705
  path: string
@@ -651,17 +712,17 @@ declare namespace ty {
651
712
  errorMsg: string
652
713
  }
653
714
  }) => void
715
+ complete?: () => void
654
716
  }): void
655
717
 
656
718
  /**
657
- * 在新页面中全屏预览图片。
658
- */
719
+ *@description 在新页面中全屏预览图片。
720
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {9001: 'Activity is invalid'} | {10002: 'Image picker error'}*/
659
721
  export function previewImage(params: {
660
722
  /** 需要预览的图片链接列表 */
661
723
  urls: string[]
662
724
  /** 当前显示图片的链接 */
663
725
  current: number
664
- complete?: () => void
665
726
  success?: (params: null) => void
666
727
  fail?: (params: {
667
728
  errorMsg: string
@@ -671,15 +732,15 @@ declare namespace ty {
671
732
  errorMsg: string
672
733
  }
673
734
  }) => void
735
+ complete?: () => void
674
736
  }): void
675
737
 
676
738
  /**
677
- * 获取图片信息
678
- */
739
+ *@description 获取图片信息
740
+ *@error {6: 'The parameter format is incorrect'} | {10022: 'media info parse error'} | {10023: 'nvalid params when parse media info'}*/
679
741
  export function getImageInfo(params: {
680
742
  /** 图片的路径,支持网络路径、本地路径 */
681
743
  src: string
682
- complete?: () => void
683
744
  success?: (params: {
684
745
  /** 图片原始宽度,单位px。不考虑旋转。 */
685
746
  width: number
@@ -717,15 +778,15 @@ declare namespace ty {
717
778
  errorMsg: string
718
779
  }
719
780
  }) => void
781
+ complete?: () => void
720
782
  }): void
721
783
 
722
784
  /**
723
- * 获取视频信息
724
- */
785
+ *@description 获取视频信息
786
+ *@error {6: 'The parameter format is incorrect'} | {10022: 'media info parse error'} | {10023: 'nvalid params when parse media info'}*/
725
787
  export function getVideoInfo(params: {
726
788
  /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
727
789
  src: string
728
- complete?: () => void
729
790
  success?: (params: {
730
791
  /** 图片原始宽度,单位px。不考虑旋转。 */
731
792
  width: number
@@ -763,15 +824,20 @@ declare namespace ty {
763
824
  errorMsg: string
764
825
  }
765
826
  }) => void
827
+ complete?: () => void
766
828
  }): void
767
829
 
768
830
  /**
769
- * 保存视频到系统相册,支持mp4视频格式
770
- */
831
+ *@description 保存视频到系统相册,支持mp4视频格式,需要相册权限
832
+ *@error {8: 'Method Unauthorized access'} | {10023: 'nvalid params when parse media info'} | {10024: 'invalid params when save video'} | {10025: 'save video error'}*/
771
833
  export function saveVideoToPhotosAlbum(params: {
772
834
  /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
773
835
  filePath: string
774
- complete?: () => void
836
+ /**
837
+ * 是否修改视频的创建日期
838
+ * 默认false,不修改视频的创建日期。ture,修改视频的创建日期为当前保存时间
839
+ */
840
+ modifyCreationDate?: boolean
775
841
  success?: (params: {
776
842
  /** 相册视频标识符 */
777
843
  localIdentifier: string
@@ -784,15 +850,20 @@ declare namespace ty {
784
850
  errorMsg: string
785
851
  }
786
852
  }) => void
853
+ complete?: () => void
787
854
  }): void
788
855
 
789
856
  /**
790
- * 保存图片到系统相册
791
- */
857
+ *@description 保存图片到系统相册
858
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {8: 'Method Unauthorized access'} | {10023: 'nvalid params when parse media info'}*/
792
859
  export function saveImageToPhotosAlbum(params: {
793
860
  /** 图片文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
794
861
  filePath: string
795
- complete?: () => void
862
+ /**
863
+ * 是否修改视频的创建日期
864
+ * 默认false,不修改视频的创建日期。ture,修改视频的创建日期为当前保存时间
865
+ */
866
+ modifyCreationDate?: boolean
796
867
  success?: (params: null) => void
797
868
  fail?: (params: {
798
869
  errorMsg: string
@@ -802,11 +873,12 @@ declare namespace ty {
802
873
  errorMsg: string
803
874
  }
804
875
  }) => void
876
+ complete?: () => void
805
877
  }): void
806
878
 
807
879
  /**
808
- * 裁剪图片选择
809
- */
880
+ *@description 裁剪图片选择
881
+ *@error {5: 'The necessary parameters are missing'} | {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {10002: 'Image picker error'}*/
810
882
  export function cropImage(params: {
811
883
  /** 图片路径 */
812
884
  path: string
@@ -816,7 +888,6 @@ declare namespace ty {
816
888
  height: number
817
889
  /** 裁剪后的图片类型, 0:jpg 1:png */
818
890
  type: number
819
- complete?: () => void
820
891
  success?: (params: {
821
892
  /** 裁剪后图片路径 */
822
893
  cropPath: string
@@ -829,11 +900,12 @@ declare namespace ty {
829
900
  errorMsg: string
830
901
  }
831
902
  }) => void
903
+ complete?: () => void
832
904
  }): void
833
905
 
834
906
  /**
835
- * 获取图片的缩略图
836
- */
907
+ *@description 获取图片的缩略图
908
+ *@error {5: 'The necessary parameters are missing'} | {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'}*/
837
909
  export function fetchImageThumbnail(params: {
838
910
  /** 资源原始地址 */
839
911
  originPath: string
@@ -841,7 +913,6 @@ declare namespace ty {
841
913
  thumbWidth: number
842
914
  /** 缩略图高度 px */
843
915
  thumbHeight: number
844
- complete?: () => void
845
916
  success?: (params: {
846
917
  /** 缩略图地址 */
847
918
  thumbnailPath: string
@@ -854,11 +925,12 @@ declare namespace ty {
854
925
  errorMsg: string
855
926
  }
856
927
  }) => void
928
+ complete?: () => void
857
929
  }): void
858
930
 
859
931
  /**
860
- * 显示消息提示框
861
- */
932
+ *@description 显示消息提示框
933
+ *@error {9001: 'Activity is invalid'}*/
862
934
  export function showToast(params: {
863
935
  /** 提示的内容 */
864
936
  title: string
@@ -866,11 +938,10 @@ declare namespace ty {
866
938
  icon?: string
867
939
  /** 自定义图标的本地路径,image 的优先级高于 icon */
868
940
  image?: string
869
- /** 提示的延迟时间 */
941
+ /** 提示的延迟时间(仅iOS生效) */
870
942
  duration?: number
871
943
  /** 是否显示透明蒙层,防止触摸穿透 */
872
944
  mask?: boolean
873
- complete?: () => void
874
945
  success?: (params: null) => void
875
946
  fail?: (params: {
876
947
  errorMsg: string
@@ -880,11 +951,12 @@ declare namespace ty {
880
951
  errorMsg: string
881
952
  }
882
953
  }) => void
954
+ complete?: () => void
883
955
  }): void
884
956
 
885
957
  /**
886
- * 显示模态对话框
887
- */
958
+ *@description 显示模态对话框
959
+ *@error {9001: 'Activity is invalid'}*/
888
960
  export function showModal(params: {
889
961
  /** 提示的标题 */
890
962
  title: string
@@ -895,14 +967,13 @@ declare namespace ty {
895
967
  /** 取消按钮的文字,最多 4 个字符 */
896
968
  cancelText?: string
897
969
  /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
898
- cancelColor?: string
970
+ cancelColor: string
899
971
  /** 确认按钮的文字,最多 4 个字符 */
900
972
  confirmText?: string
901
973
  /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
902
- confirmColor?: string
974
+ confirmColor: string
903
975
  /** 是否全局弹窗,若为全局弹窗,弹在最顶上 */
904
976
  isShowGlobal?: boolean
905
- complete?: () => void
906
977
  success?: (params: {
907
978
  /** 为 true 时,表示用户点击了确定按钮 */
908
979
  confirm: boolean
@@ -917,17 +988,16 @@ declare namespace ty {
917
988
  errorMsg: string
918
989
  }
919
990
  }) => void
991
+ complete?: () => void
920
992
  }): void
921
993
 
922
994
  /**
923
- * 显示 loading 提示框。需主动调用 thing.hideLoading 才能关闭提示框
924
- */
995
+ *@description 显示 loading 提示框。需主动调用 thing.hideLoading 才能关闭提示框*/
925
996
  export function showLoading(params: {
926
997
  /** 提示的内容 */
927
998
  title: string
928
999
  /** 是否显示透明蒙层,防止触摸穿透 */
929
1000
  mask?: boolean
930
- complete?: () => void
931
1001
  success?: (params: null) => void
932
1002
  fail?: (params: {
933
1003
  errorMsg: string
@@ -937,11 +1007,12 @@ declare namespace ty {
937
1007
  errorMsg: string
938
1008
  }
939
1009
  }) => void
1010
+ complete?: () => void
940
1011
  }): void
941
1012
 
942
1013
  /**
943
- * 显示操作菜单
944
- */
1014
+ *@description 显示操作菜单
1015
+ *@error {6: 'The parameter format is incorrect'} | {9001: 'Activity is invalid'}*/
945
1016
  export function showActionSheet(params: {
946
1017
  /** 警示文案 */
947
1018
  alertText?: string
@@ -951,7 +1022,6 @@ declare namespace ty {
951
1022
  itemColor?: string
952
1023
  /** 按钮的文字颜色 */
953
1024
  itemColors?: string[]
954
- complete?: () => void
955
1025
  success?: (params: {
956
1026
  /** 用户点击的按钮序号,从上到下的顺序,从0开始 */
957
1027
  tapIndex: number
@@ -964,13 +1034,12 @@ declare namespace ty {
964
1034
  errorMsg: string
965
1035
  }
966
1036
  }) => void
1037
+ complete?: () => void
967
1038
  }): void
968
1039
 
969
1040
  /**
970
- * 隐藏消息提示框
971
- */
1041
+ *@description 隐藏消息提示框*/
972
1042
  export function hideToast(params?: {
973
- complete?: () => void
974
1043
  success?: (params: null) => void
975
1044
  fail?: (params: {
976
1045
  errorMsg: string
@@ -980,13 +1049,12 @@ declare namespace ty {
980
1049
  errorMsg: string
981
1050
  }
982
1051
  }) => void
1052
+ complete?: () => void
983
1053
  }): void
984
1054
 
985
1055
  /**
986
- * 隐藏 loading 提示框
987
- */
1056
+ *@description 隐藏 loading 提示框*/
988
1057
  export function hideLoading(params?: {
989
- complete?: () => void
990
1058
  success?: (params: null) => void
991
1059
  fail?: (params: {
992
1060
  errorMsg: string
@@ -996,15 +1064,14 @@ declare namespace ty {
996
1064
  errorMsg: string
997
1065
  }
998
1066
  }) => void
1067
+ complete?: () => void
999
1068
  }): void
1000
1069
 
1001
1070
  /**
1002
- * 拨打电话
1003
- */
1071
+ *@description 拨打电话*/
1004
1072
  export function makePhoneCall(params: {
1005
1073
  /** 需要拨打的电话号码 */
1006
1074
  phoneNumber: string
1007
- complete?: () => void
1008
1075
  success?: (params: null) => void
1009
1076
  fail?: (params: {
1010
1077
  errorMsg: string
@@ -1014,11 +1081,12 @@ declare namespace ty {
1014
1081
  errorMsg: string
1015
1082
  }
1016
1083
  }) => void
1084
+ complete?: () => void
1017
1085
  }): void
1018
1086
 
1019
1087
  /**
1020
- * 设置系统剪贴板的内容
1021
- */
1088
+ *@description 设置系统剪贴板的内容
1089
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'}*/
1022
1090
  export function setClipboardData(params: {
1023
1091
  /**
1024
1092
  * 是否敏感信息
@@ -1029,7 +1097,6 @@ declare namespace ty {
1029
1097
  isSensitive?: boolean
1030
1098
  /** 剪贴板的内容 */
1031
1099
  data: string
1032
- complete?: () => void
1033
1100
  success?: (params: null) => void
1034
1101
  fail?: (params: {
1035
1102
  errorMsg: string
@@ -1039,13 +1106,13 @@ declare namespace ty {
1039
1106
  errorMsg: string
1040
1107
  }
1041
1108
  }) => void
1109
+ complete?: () => void
1042
1110
  }): void
1043
1111
 
1044
1112
  /**
1045
- * 获取系统剪贴板的内容
1046
- */
1113
+ *@description 获取系统剪贴板的内容
1114
+ *@error {7: 'API Internal processing failed'}*/
1047
1115
  export function getClipboardData(params?: {
1048
- complete?: () => void
1049
1116
  success?: (params: {
1050
1117
  /** 剪贴板的内容 */
1051
1118
  data: string
@@ -1058,27 +1125,26 @@ declare namespace ty {
1058
1125
  errorMsg: string
1059
1126
  }
1060
1127
  }) => void
1128
+ complete?: () => void
1061
1129
  }): void
1062
1130
 
1063
1131
  /**
1064
- * 设置系统音量
1065
- *
1066
- *错误码标注
1067
- *入参值范围超出 errorCode = 6, The volume value is invalid, it should be [0 - 1]
1068
- */
1132
+ *@description 设置系统音量
1133
+ *@error {6: 'The parameter format is incorrect'}*/
1069
1134
  export function updateVolume(params: {
1070
1135
  /** 音量,阈值【0 - 1】 */
1071
1136
  value: number
1072
1137
  /**
1073
1138
  * 音量类型(仅Android生效)
1074
1139
  * 0:语音电话的声音
1140
+ * 1:手机系统声音
1075
1141
  * 2:响铃,通知,系统默认音等
1076
1142
  * 3:手机音乐的声音
1077
1143
  * 4:手机闹铃的声音
1144
+ * 5:手机通知的声音
1078
1145
  * 6:蓝牙音量
1079
1146
  */
1080
1147
  volumeMode?: number[]
1081
- complete?: () => void
1082
1148
  success?: (params: null) => void
1083
1149
  fail?: (params: {
1084
1150
  errorMsg: string
@@ -1088,25 +1154,16 @@ declare namespace ty {
1088
1154
  errorMsg: string
1089
1155
  }
1090
1156
  }) => void
1157
+ complete?: () => void
1091
1158
  }): void
1092
1159
 
1093
1160
  /**
1094
- * 获取当前系统音量
1095
- */
1161
+ *@description 获取当前系统音量
1162
+ *注意:Android是系统的音量是有区分的,该接口获取的是系统电话铃声的音量值。如需要获取其他系统音量值,请使用getCurrentVolumeByMode接口*/
1096
1163
  export function getCurrentVolume(params?: {
1097
- complete?: () => void
1098
1164
  success?: (params: {
1099
1165
  /** 音量,阈值【0 - 1】 */
1100
1166
  value: number
1101
- /**
1102
- * 音量类型(仅Android生效)
1103
- * 0:语音电话的声音
1104
- * 2:响铃,通知,系统默认音等
1105
- * 3:手机音乐的声音
1106
- * 4:手机闹铃的声音
1107
- * 6:蓝牙音量
1108
- */
1109
- volumeMode: number
1110
1167
  }) => void
1111
1168
  fail?: (params: {
1112
1169
  errorMsg: string
@@ -1116,34 +1173,27 @@ declare namespace ty {
1116
1173
  errorMsg: string
1117
1174
  }
1118
1175
  }) => void
1176
+ complete?: () => void
1119
1177
  }): void
1120
1178
 
1121
1179
  /**
1122
- * 获取不同模式的系统音量
1123
- */
1180
+ *@description 获取不同模式的系统音量
1181
+ *注意:Android支持通过volumeMode参数获取不同系统声音的音量值。iOS仅有一个系统音量值,volumeMode不生效。*/
1124
1182
  export function getCurrentVolumeByMode(params?: {
1125
1183
  /**
1126
1184
  * 音量类型(仅Android生效)
1127
1185
  * 0:语音电话的声音
1186
+ * 1:手机系统声音
1128
1187
  * 2:响铃,通知,系统默认音等
1129
1188
  * 3:手机音乐的声音
1130
1189
  * 4:手机闹铃的声音
1190
+ * 5:手机通知的声音
1131
1191
  * 6:蓝牙音量
1132
1192
  */
1133
1193
  volumeMode?: number
1134
- complete?: () => void
1135
1194
  success?: (params: {
1136
1195
  /** 音量,阈值【0 - 1】 */
1137
1196
  value: number
1138
- /**
1139
- * 音量类型(仅Android生效)
1140
- * 0:语音电话的声音
1141
- * 2:响铃,通知,系统默认音等
1142
- * 3:手机音乐的声音
1143
- * 4:手机闹铃的声音
1144
- * 6:蓝牙音量
1145
- */
1146
- volumeMode: number
1147
1197
  }) => void
1148
1198
  fail?: (params: {
1149
1199
  errorMsg: string
@@ -1153,15 +1203,14 @@ declare namespace ty {
1153
1203
  errorMsg: string
1154
1204
  }
1155
1205
  }) => void
1206
+ complete?: () => void
1156
1207
  }): void
1157
1208
 
1158
1209
  /**
1159
- * 注册系统音量监听
1210
+ *@description 注册系统音量监听
1160
1211
  *
1161
- *关联API:[onSystemVolumeChangeEvent, unRegisterSystemVolumeChange]
1162
- */
1212
+ *关联API:[onSystemVolumeChangeEvent, unRegisterSystemVolumeChange]*/
1163
1213
  export function registerSystemVolumeChange(params?: {
1164
- complete?: () => void
1165
1214
  success?: (params: null) => void
1166
1215
  fail?: (params: {
1167
1216
  errorMsg: string
@@ -1171,15 +1220,14 @@ declare namespace ty {
1171
1220
  errorMsg: string
1172
1221
  }
1173
1222
  }) => void
1223
+ complete?: () => void
1174
1224
  }): void
1175
1225
 
1176
1226
  /**
1177
- * 取消注册系统音量监听
1227
+ *@description 取消注册系统音量监听
1178
1228
  *
1179
- *关联API:[onSystemVolumeChangeEvent, registerSystemVolumeChange]
1180
- */
1229
+ *关联API:[onSystemVolumeChangeEvent, registerSystemVolumeChange]*/
1181
1230
  export function unRegisterSystemVolumeChange(params?: {
1182
- complete?: () => void
1183
1231
  success?: (params: null) => void
1184
1232
  fail?: (params: {
1185
1233
  errorMsg: string
@@ -1189,13 +1237,12 @@ declare namespace ty {
1189
1237
  errorMsg: string
1190
1238
  }
1191
1239
  }) => void
1240
+ complete?: () => void
1192
1241
  }): void
1193
1242
 
1194
1243
  /**
1195
- * 获取设备设置
1196
- */
1244
+ *@description 获取设备设置*/
1197
1245
  export function getSystemSetting(params?: {
1198
- complete?: () => void
1199
1246
  success?: (params: {
1200
1247
  /** 蓝牙的系统开关,默认false */
1201
1248
  bluetoothEnabled?: boolean
@@ -1217,13 +1264,12 @@ declare namespace ty {
1217
1264
  errorMsg: string
1218
1265
  }
1219
1266
  }) => void
1267
+ complete?: () => void
1220
1268
  }): void
1221
1269
 
1222
1270
  /**
1223
- * 获取设备基础信息
1224
- */
1225
- export function getMobileDeviceInfo(params?: {
1226
- complete?: () => void
1271
+ *@description 获取设备基础信息*/
1272
+ export function getDeviceInfo(params?: {
1227
1273
  success?: (params: {
1228
1274
  /** 应用二进制接口类型(仅 Android 支持) */
1229
1275
  abi: string
@@ -1244,13 +1290,13 @@ declare namespace ty {
1244
1290
  errorMsg: string
1245
1291
  }
1246
1292
  }) => void
1293
+ complete?: () => void
1247
1294
  }): void
1248
1295
 
1249
1296
  /**
1250
- * 获取系统信息
1251
- */
1297
+ *@description 获取系统信息
1298
+ *@error {9002: 'Context is invalid'}*/
1252
1299
  export function getSystemInfo(params?: {
1253
- complete?: () => void
1254
1300
  success?: (params: {
1255
1301
  is24Hour: boolean
1256
1302
  system: string
@@ -1302,11 +1348,12 @@ declare namespace ty {
1302
1348
  errorMsg: string
1303
1349
  }
1304
1350
  }) => void
1351
+ complete?: () => void
1305
1352
  }): void
1306
1353
 
1307
1354
  /**
1308
- * 获取系统信息
1309
- */
1355
+ *@description 获取系统信息
1356
+ *@error {9002: 'Context is invalid'}*/
1310
1357
  export function getSystemInfoSync(): {
1311
1358
  is24Hour: boolean
1312
1359
  system: string
@@ -1352,10 +1399,10 @@ declare namespace ty {
1352
1399
  }
1353
1400
 
1354
1401
  /**
1355
- * 获取手机附近的Wi-Fi列表;列表数据通过onGetWifiList事件发送
1356
- */
1402
+ *@description 获取手机附近的Wi-Fi列表;列表数据通过onGetWifiList事件发送
1403
+ *注意:Android需要申请手机的位置权限、Wi-Fi状态权限、网络权限;iOS上不可用
1404
+ *@error {9004: 'app no permission'} | {9005: 'can‘t find service'}*/
1357
1405
  export function getWifiList(params?: {
1358
- complete?: () => void
1359
1406
  success?: (params: null) => void
1360
1407
  fail?: (params: {
1361
1408
  errorMsg: string
@@ -1365,21 +1412,21 @@ declare namespace ty {
1365
1412
  errorMsg: string
1366
1413
  }
1367
1414
  }) => void
1415
+ complete?: () => void
1368
1416
  }): void
1369
1417
 
1370
1418
  /**
1371
- * 获取当前连接的wifi信息
1372
- *iOS: 返回SSID和BSSID
1373
- */
1419
+ *@description 获取当前连接的wifi信息
1420
+ *注意:Android需要申请手机的位置权限、Wi-Fi状态权限、网络权限;iOS上不可用
1421
+ *@error {9004: 'app no permission'} | {9005: 'can‘t find service'} | {10021: 'SSID nil error'}*/
1374
1422
  export function getConnectedWifi(params?: {
1375
1423
  /**
1376
1424
  * 是否需要返回部分 Wi-Fi 信息
1377
1425
  * 安卓 thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID 属性的 WifiInfo 对象。
1378
- * iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
1426
+ * iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象。
1379
1427
  * 默认值:false
1380
1428
  */
1381
1429
  partialInfo?: boolean
1382
- complete?: () => void
1383
1430
  success?: (params: {
1384
1431
  /** wifi的SSID */
1385
1432
  SSID: string
@@ -1403,13 +1450,13 @@ declare namespace ty {
1403
1450
  errorMsg: string
1404
1451
  }
1405
1452
  }) => void
1453
+ complete?: () => void
1406
1454
  }): void
1407
1455
 
1408
1456
  /**
1409
- * 跳转系统蓝牙设置页 (仅Android)
1410
- */
1457
+ *@description 跳转系统蓝牙设置页 (仅Android支持)
1458
+ *@error {9002: 'Context is invalid'}*/
1411
1459
  export function openSystemBluetoothSetting(params?: {
1412
- complete?: () => void
1413
1460
  success?: (params: null) => void
1414
1461
  fail?: (params: {
1415
1462
  errorMsg: string
@@ -1419,13 +1466,12 @@ declare namespace ty {
1419
1466
  errorMsg: string
1420
1467
  }
1421
1468
  }) => void
1469
+ complete?: () => void
1422
1470
  }): void
1423
1471
 
1424
1472
  /**
1425
- * 获取当前APP授权设置
1426
- */
1473
+ *@description 获取当前APP授权设置*/
1427
1474
  export function getAppAuthorizeSetting(params?: {
1428
- complete?: () => void
1429
1475
  success?: (params: {
1430
1476
  /** 允许使用相册的开关(仅 iOS 有效)authorized'/'denied'/'not determined */
1431
1477
  albumAuthorized: string
@@ -1456,17 +1502,20 @@ declare namespace ty {
1456
1502
  errorMsg: string
1457
1503
  }
1458
1504
  }) => void
1505
+ complete?: () => void
1459
1506
  }): void
1460
1507
 
1461
1508
  /**
1462
- * 获取网络类型
1463
- */
1509
+ *@description 获取网络类型
1510
+ *@error {7: 'API Internal processing failed'} | {9001: 'Activity is invalid'}*/
1464
1511
  export function getNetworkType(params?: {
1465
- complete?: () => void
1466
1512
  success?: (params: {
1467
1513
  /** 网络类型 */
1468
1514
  networkType: string
1469
- /** 信号强弱,单位 dbm */
1515
+ /**
1516
+ * 信号强弱,单位 dbm
1517
+ * 注意: iOS不支持
1518
+ */
1470
1519
  signalStrength: number
1471
1520
  }) => void
1472
1521
  fail?: (params: {
@@ -1477,15 +1526,15 @@ declare namespace ty {
1477
1526
  errorMsg: string
1478
1527
  }
1479
1528
  }) => void
1529
+ complete?: () => void
1480
1530
  }): void
1481
1531
 
1482
1532
  /**
1483
- * 设置屏幕亮度
1484
- */
1533
+ *@description 设置屏幕亮度
1534
+ *@error {6: 'The parameter format is incorrect'} | {9001: 'Activity is invalid'}*/
1485
1535
  export function setScreenBrightness(params: {
1486
1536
  /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */
1487
1537
  value: number
1488
- complete?: () => void
1489
1538
  success?: (params: null) => void
1490
1539
  fail?: (params: {
1491
1540
  errorMsg: string
@@ -1495,13 +1544,13 @@ declare namespace ty {
1495
1544
  errorMsg: string
1496
1545
  }
1497
1546
  }) => void
1547
+ complete?: () => void
1498
1548
  }): void
1499
1549
 
1500
1550
  /**
1501
- * 获取屏幕亮度
1502
- */
1551
+ *@description 获取屏幕亮度
1552
+ *@error {9001: 'Activity is invalid'}*/
1503
1553
  export function getScreenBrightness(params?: {
1504
- complete?: () => void
1505
1554
  success?: (params: {
1506
1555
  /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */
1507
1556
  value: number
@@ -1514,15 +1563,15 @@ declare namespace ty {
1514
1563
  errorMsg: string
1515
1564
  }
1516
1565
  }) => void
1566
+ complete?: () => void
1517
1567
  }): void
1518
1568
 
1519
1569
  /**
1520
- * 设置是否保持常亮状态
1521
- */
1570
+ *@description 设置是否保持常亮状态
1571
+ *@error {9001: 'Activity is invalid'}*/
1522
1572
  export function setKeepScreenOn(params: {
1523
1573
  /** 是否保持屏幕常亮 */
1524
1574
  keepScreenOn: boolean
1525
- complete?: () => void
1526
1575
  success?: (params: null) => void
1527
1576
  fail?: (params: {
1528
1577
  errorMsg: string
@@ -1532,15 +1581,15 @@ declare namespace ty {
1532
1581
  errorMsg: string
1533
1582
  }
1534
1583
  }) => void
1584
+ complete?: () => void
1535
1585
  }): void
1536
1586
 
1537
1587
  /**
1538
- * 使手机发生较短时间的振动(30 ms)。仅在 iPhone 7 / 7 Plus 以上及 Android 机型生效
1539
- */
1588
+ *@description 使手机发生较短时间的振动(30 ms)。仅在 iPhone 7 / 7 Plus 以上及 Android 机型生效
1589
+ *@error {9002: 'Context is invalid'}*/
1540
1590
  export function vibrateShort(params: {
1541
1591
  /** 震动强度类型,有效值为:heavy、medium、light */
1542
1592
  type: string
1543
- complete?: () => void
1544
1593
  success?: (params: null) => void
1545
1594
  fail?: (params: {
1546
1595
  errorMsg: string
@@ -1550,13 +1599,13 @@ declare namespace ty {
1550
1599
  errorMsg: string
1551
1600
  }
1552
1601
  }) => void
1602
+ complete?: () => void
1553
1603
  }): void
1554
1604
 
1555
1605
  /**
1556
- * 使手机发生较长时间的振动(400 ms)
1557
- */
1606
+ *@description 使手机发生较长时间的振动(400 ms)
1607
+ *@error {9002: 'Context is invalid'}*/
1558
1608
  export function vibrateLong(params?: {
1559
- complete?: () => void
1560
1609
  success?: (params: null) => void
1561
1610
  fail?: (params: {
1562
1611
  errorMsg: string
@@ -1566,11 +1615,13 @@ declare namespace ty {
1566
1615
  errorMsg: string
1567
1616
  }
1568
1617
  }) => void
1618
+ complete?: () => void
1569
1619
  }): void
1570
1620
 
1571
1621
  /**
1572
- * 调起客户端扫码界面进行扫码
1573
- */
1622
+ *@description 调起客户端扫码界面进行扫码
1623
+ *注意:Android返回的数据中,只有result字段可用,其他字段无意义。
1624
+ *@error {7: 'API Internal processing failed'} | {9001: 'Activity is invalid'} | {9005: 'can‘t find service'}*/
1574
1625
  export function scanCode(params?: {
1575
1626
  /** 是否只能从相机扫码,不允许从相册选择图片 */
1576
1627
  onlyFromCamera?: boolean
@@ -1586,7 +1637,6 @@ declare namespace ty {
1586
1637
  customTips?: string
1587
1638
  /** 扫码类型 */
1588
1639
  scanType?: string[]
1589
- complete?: () => void
1590
1640
  success?: (params: {
1591
1641
  /** 所扫码的内容 */
1592
1642
  result: string
@@ -1607,17 +1657,40 @@ declare namespace ty {
1607
1657
  errorMsg: string
1608
1658
  }
1609
1659
  }) => void
1660
+ complete?: () => void
1661
+ }): void
1662
+
1663
+ /**
1664
+ *@description 调起客户端确认登录页面
1665
+ *@error {7: 'API Internal processing failed'}*/
1666
+ export function showScanLogin(params: {
1667
+ /** 扫码内容 */
1668
+ content: string
1669
+ success?: (params: {
1670
+ /** 扫码登录结果 0:确认登录成功 1:取消/返回 2:确认登录失败 */
1671
+ code: number
1672
+ /** 扫码登录失败错误描述 */
1673
+ msg: string
1674
+ }) => void
1675
+ fail?: (params: {
1676
+ errorMsg: string
1677
+ errorCode: string | number
1678
+ innerError: {
1679
+ errorCode: string | number
1680
+ errorMsg: string
1681
+ }
1682
+ }) => void
1683
+ complete?: () => void
1610
1684
  }): void
1611
1685
 
1612
1686
  /**
1613
- * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
1614
- */
1687
+ *@description 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
1688
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {10010: 'storage json syntax error'}*/
1615
1689
  export function setStorage(params: {
1616
1690
  /** 本地缓存中指定的 key */
1617
1691
  key: string
1618
1692
  /** key对应的内容 */
1619
1693
  data: string
1620
- complete?: () => void
1621
1694
  success?: (params: null) => void
1622
1695
  fail?: (params: {
1623
1696
  errorMsg: string
@@ -1627,20 +1700,20 @@ declare namespace ty {
1627
1700
  errorMsg: string
1628
1701
  }
1629
1702
  }) => void
1703
+ complete?: () => void
1630
1704
  }): void
1631
1705
 
1632
1706
  /**
1633
- * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
1634
- */
1707
+ *@description 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
1708
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {10010: 'storage json syntax error'}*/
1635
1709
  export function setStorageSync(storageDataBean?: StorageDataBean): null
1636
1710
 
1637
1711
  /**
1638
- * 从本地缓存中异步获取指定 key 的内容
1639
- */
1712
+ *@description 从本地缓存中异步获取指定 key 的内容
1713
+ *@error {6: 'The parameter format is incorrect'}*/
1640
1714
  export function getStorage(params: {
1641
1715
  /** 本地缓存中指定的 key */
1642
1716
  key: string
1643
- complete?: () => void
1644
1717
  success?: (params: {
1645
1718
  /** key对应的内容 */
1646
1719
  data?: string
@@ -1653,23 +1726,23 @@ declare namespace ty {
1653
1726
  errorMsg: string
1654
1727
  }
1655
1728
  }) => void
1729
+ complete?: () => void
1656
1730
  }): void
1657
1731
 
1658
1732
  /**
1659
- * 从本地缓存中异步获取指定 key 的内容
1660
- */
1733
+ *@description 从本地缓存中异步获取指定 key 的内容
1734
+ *@error {6: 'The parameter format is incorrect'}*/
1661
1735
  export function getStorageSync(storageKeyBean?: StorageKeyBean): {
1662
1736
  /** key对应的内容 */
1663
1737
  data?: string
1664
1738
  }
1665
1739
 
1666
1740
  /**
1667
- * 清理本地数据缓存
1668
- */
1741
+ *@description 清理本地数据缓存
1742
+ *@error {6: 'The parameter format is incorrect'}*/
1669
1743
  export function removeStorage(params: {
1670
1744
  /** 本地缓存中指定的 key */
1671
1745
  key: string
1672
- complete?: () => void
1673
1746
  success?: (params: null) => void
1674
1747
  fail?: (params: {
1675
1748
  errorMsg: string
@@ -1679,18 +1752,17 @@ declare namespace ty {
1679
1752
  errorMsg: string
1680
1753
  }
1681
1754
  }) => void
1755
+ complete?: () => void
1682
1756
  }): void
1683
1757
 
1684
1758
  /**
1685
- * 清理本地数据缓存
1686
- */
1759
+ *@description 清理本地数据缓存
1760
+ *@error {6: 'The parameter format is incorrect'}*/
1687
1761
  export function removeStorageSync(storageKeyBean?: StorageKeyBean): null
1688
1762
 
1689
1763
  /**
1690
- * 清理本地数据缓存
1691
- */
1764
+ *@description 清理本地数据缓存*/
1692
1765
  export function clearStorage(params?: {
1693
- complete?: () => void
1694
1766
  success?: (params: null) => void
1695
1767
  fail?: (params: {
1696
1768
  errorMsg: string
@@ -1700,152 +1772,112 @@ declare namespace ty {
1700
1772
  errorMsg: string
1701
1773
  }
1702
1774
  }) => void
1775
+ complete?: () => void
1703
1776
  }): void
1704
1777
 
1705
1778
  /**
1706
- * 清理本地数据缓存
1707
- */
1779
+ *@description 清理本地数据缓存*/
1708
1780
  export function clearStorageSync(): null
1709
1781
 
1710
1782
  /**
1711
- * 开始文件上传
1712
- */
1713
- export function onUploadFileToDeviceStart(
1714
- listener: (params: UploadStartEvent) => void
1715
- ): void
1783
+ *@description 开始文件上传*/
1784
+ export function onUploadFileToDeviceStart(listener: (params: UploadStartEvent) => void): void
1716
1785
 
1717
1786
  /**
1718
- * 取消监听:开始文件上传
1719
- */
1720
- export function offUploadFileToDeviceStart(
1721
- listener: (params: UploadStartEvent) => void
1722
- ): void
1787
+ *@description 移除监听:开始文件上传*/
1788
+ export function offUploadFileToDeviceStart(listener: (params: UploadStartEvent) => void): void
1723
1789
 
1724
1790
  /**
1725
- * 上传文件进度回调
1726
- */
1791
+ *@description 上传文件进度回调*/
1727
1792
  export function onUploadFileToDeviceProgress(
1728
1793
  listener: (params: UploadProgressEvent) => void
1729
1794
  ): void
1730
1795
 
1731
1796
  /**
1732
- * 取消监听:上传文件进度回调
1733
- */
1797
+ *@description 移除监听:上传文件进度回调*/
1734
1798
  export function offUploadFileToDeviceProgress(
1735
1799
  listener: (params: UploadProgressEvent) => void
1736
1800
  ): void
1737
1801
 
1738
1802
  /**
1739
- * 批量文件上传完成回调
1740
- */
1803
+ *@description 批量文件上传完成回调*/
1741
1804
  export function onUploadFileToDeviceComplete(
1742
1805
  listener: (params: UploadCompleteEvent) => void
1743
1806
  ): void
1744
1807
 
1745
1808
  /**
1746
- * 取消监听:批量文件上传完成回调
1747
- */
1809
+ *@description 移除监听:批量文件上传完成回调*/
1748
1810
  export function offUploadFileToDeviceComplete(
1749
1811
  listener: (params: UploadCompleteEvent) => void
1750
1812
  ): void
1751
1813
 
1752
1814
  /**
1753
- * 分片上传进度回调
1754
- */
1815
+ *@description 分片上传进度回调*/
1755
1816
  export function onUploadFileFragToDeviceProgress(
1756
1817
  listener: (params: UploadFragProgressEvent) => void
1757
1818
  ): void
1758
1819
 
1759
1820
  /**
1760
- * 取消监听:分片上传进度回调
1761
- */
1821
+ *@description 移除监听:分片上传进度回调*/
1762
1822
  export function offUploadFileFragToDeviceProgress(
1763
1823
  listener: (params: UploadFragProgressEvent) => void
1764
1824
  ): void
1765
1825
 
1766
1826
  /**
1767
- * onKeyboardHeightChange 发送键盘事件给js
1768
- */
1769
- export function onKeyboardHeightChange(
1770
- listener: (params: BeanRes) => void
1771
- ): void
1827
+ *@description onKeyboardHeightChange 发送键盘事件给js*/
1828
+ export function onKeyboardHeightChange(listener: (params: BeanRes) => void): void
1772
1829
 
1773
1830
  /**
1774
- * 取消监听:onKeyboardHeightChange 发送键盘事件给js
1775
- */
1776
- export function offKeyboardHeightChange(
1777
- listener: (params: BeanRes) => void
1778
- ): void
1831
+ *@description 移除监听:onKeyboardHeightChange 发送键盘事件给js*/
1832
+ export function offKeyboardHeightChange(listener: (params: BeanRes) => void): void
1779
1833
 
1780
1834
  /**
1781
- * 键盘弹出
1782
- */
1835
+ *@description 键盘弹出*/
1783
1836
  export function onKeyboardWillShow(listener: (params: BeanRes) => void): void
1784
1837
 
1785
1838
  /**
1786
- * 取消监听:键盘弹出
1787
- */
1839
+ *@description 移除监听:键盘弹出*/
1788
1840
  export function offKeyboardWillShow(listener: (params: BeanRes) => void): void
1789
1841
 
1790
1842
  /**
1791
- * 键盘消息
1792
- */
1843
+ *@description 键盘消息*/
1793
1844
  export function onKeyboardWillHide(listener: (params: BeanRes) => void): void
1794
1845
 
1795
1846
  /**
1796
- * 取消监听:键盘消息
1797
- */
1847
+ *@description 移除监听:键盘消息*/
1798
1848
  export function offKeyboardWillHide(listener: (params: BeanRes) => void): void
1799
1849
 
1800
1850
  /**
1801
- * 系统音量监听通知事件
1851
+ *@description 系统音量监听通知事件
1802
1852
  *
1803
- *关联API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]
1804
- */
1805
- export function onSystemVolumeChangeEvent(
1806
- listener: (params: CurrentVolumeResponse) => void
1807
- ): void
1853
+ *关联API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]*/
1854
+ export function onSystemVolumeChangeEvent(listener: (params: VolumeResponse) => void): void
1808
1855
 
1809
1856
  /**
1810
- * 取消监听:系统音量监听通知事件
1857
+ *@description 移除监听:系统音量监听通知事件
1811
1858
  *
1812
- *关联API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]
1813
- */
1814
- export function offSystemVolumeChangeEvent(
1815
- listener: (params: CurrentVolumeResponse) => void
1816
- ): void
1859
+ *关联API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]*/
1860
+ export function offSystemVolumeChangeEvent(listener: (params: VolumeResponse) => void): void
1817
1861
 
1818
1862
  /**
1819
- * 监听获取到 Wi-Fi 列表数据事件
1820
- */
1821
- export function onGetWifiList(
1822
- listener: (params: WifiListResponse) => void
1823
- ): void
1863
+ *@description 监听获取到 Wi-Fi 列表数据事件*/
1864
+ export function onGetWifiList(listener: (params: WifiListResponse) => void): void
1824
1865
 
1825
1866
  /**
1826
- * 取消监听:监听获取到 Wi-Fi 列表数据事件
1827
- */
1828
- export function offGetWifiList(
1829
- listener: (params: WifiListResponse) => void
1830
- ): void
1867
+ *@description 移除监听:监听获取到 Wi-Fi 列表数据事件*/
1868
+ export function offGetWifiList(listener: (params: WifiListResponse) => void): void
1831
1869
 
1832
1870
  /**
1833
- * 持续录音事件
1834
- */
1835
- export function onRecordingEvent(
1836
- listener: (params: AudioRecordBufferBean) => void
1837
- ): void
1871
+ *@description 持续录音事件*/
1872
+ export function onRecordingEvent(listener: (params: AudioRecordBufferBean) => void): void
1838
1873
 
1839
1874
  /**
1840
- * 取消监听:持续录音事件
1841
- */
1842
- export function offRecordingEvent(
1843
- listener: (params: AudioRecordBufferBean) => void
1844
- ): void
1875
+ *@description 移除监听:持续录音事件*/
1876
+ export function offRecordingEvent(listener: (params: AudioRecordBufferBean) => void): void
1845
1877
 
1846
1878
  /**
1847
- * 监听加速度数据事件
1848
- */
1879
+ *@description 监听加速度数据事件(精度为系统返回,双端可能不一致)
1880
+ *@error {10001: 'Sensor initialization fail'}*/
1849
1881
  export function onAccelerometerChange(
1850
1882
  listener: (params: {
1851
1883
  /** X 轴 */
@@ -1858,8 +1890,7 @@ declare namespace ty {
1858
1890
  ): void
1859
1891
 
1860
1892
  /**
1861
- * 取消监听加速度数据事件,参数为空,则取消所有的事件监听
1862
- */
1893
+ *@description 取消监听加速度数据事件,参数为空,则取消所有的事件监听*/
1863
1894
  export function offAccelerometerChange(
1864
1895
  listener: (params: {
1865
1896
  /** X 轴 */
@@ -1872,48 +1903,51 @@ declare namespace ty {
1872
1903
  ): void
1873
1904
 
1874
1905
  /**
1875
- * 监听罗盘数据变化事件
1876
- */
1906
+ *@description 监听罗盘数据变化事件*/
1877
1907
  export function onCompassChange(
1878
1908
  listener: (params: {
1879
1909
  /** 面对的方向度数 */
1880
1910
  direction: number
1881
1911
  /**
1882
- * 精度
1883
- * high 高精度
1884
- * medium 中等精度
1885
- * low 低精度
1886
- * no-contact 不可信,传感器失去连接
1887
- * unreliable 不可信,原因未知
1888
- * unknow ${value} 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值
1912
+ * 精度(iOS与Android平台差异原因,返回有差异)
1913
+ * Android:
1914
+ * high 高精度
1915
+ * medium 中等精度
1916
+ * low 低精度
1917
+ * no-contact 不可信,传感器失去连接
1918
+ * unreliable 不可信,原因未知
1919
+ * unknow ${value} 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值
1920
+ * iOS:
1921
+ * double类型精度
1889
1922
  */
1890
1923
  accuracy: string
1891
1924
  }) => void
1892
1925
  ): void
1893
1926
 
1894
1927
  /**
1895
- * 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听
1896
- */
1928
+ *@description 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听*/
1897
1929
  export function offCompassChange(
1898
1930
  listener: (params: {
1899
1931
  /** 面对的方向度数 */
1900
1932
  direction: number
1901
1933
  /**
1902
- * 精度
1903
- * high 高精度
1904
- * medium 中等精度
1905
- * low 低精度
1906
- * no-contact 不可信,传感器失去连接
1907
- * unreliable 不可信,原因未知
1908
- * unknow ${value} 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值
1934
+ * 精度(iOS与Android平台差异原因,返回有差异)
1935
+ * Android:
1936
+ * high 高精度
1937
+ * medium 中等精度
1938
+ * low 低精度
1939
+ * no-contact 不可信,传感器失去连接
1940
+ * unreliable 不可信,原因未知
1941
+ * unknow ${value} 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值
1942
+ * iOS:
1943
+ * double类型精度
1909
1944
  */
1910
1945
  accuracy: string
1911
1946
  }) => void
1912
1947
  ): void
1913
1948
 
1914
1949
  /**
1915
- * 监听设备方向变化事件
1916
- */
1950
+ *@description 监听设备方向变化事件(数据为系统返回,双端精度可能不一致)*/
1917
1951
  export function onDeviceMotionChange(
1918
1952
  listener: (params: {
1919
1953
  /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
@@ -1926,8 +1960,7 @@ declare namespace ty {
1926
1960
  ): void
1927
1961
 
1928
1962
  /**
1929
- * 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
1930
- */
1963
+ *@description 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。*/
1931
1964
  export function offDeviceMotionChange(
1932
1965
  listener: (params: {
1933
1966
  /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
@@ -1940,8 +1973,7 @@ declare namespace ty {
1940
1973
  ): void
1941
1974
 
1942
1975
  /**
1943
- * 监听陀螺仪数据变化事件
1944
- */
1976
+ *@description 监听陀螺仪数据变化事件(数据为系统返回,双端精度可能不一致)*/
1945
1977
  export function onGyroscopeChange(
1946
1978
  listener: (params: {
1947
1979
  /** X 轴 */
@@ -1954,8 +1986,7 @@ declare namespace ty {
1954
1986
  ): void
1955
1987
 
1956
1988
  /**
1957
- * 取消监听陀螺仪数据变化事件。
1958
- */
1989
+ *@description 取消监听陀螺仪数据变化事件。*/
1959
1990
  export function offGyroscopeChange(
1960
1991
  listener: (params: {
1961
1992
  /** X 轴 */
@@ -1968,9 +1999,8 @@ declare namespace ty {
1968
1999
  ): void
1969
2000
 
1970
2001
  /**
1971
- * 监听内存不足告警事件。
1972
- *当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
1973
- */
2002
+ *@description 监听内存不足告警事件。
2003
+ *当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。*/
1974
2004
  export function onMemoryWarning(
1975
2005
  listener: (params: {
1976
2006
  /** 内存告警等级,只有 Android 才有,对应系统宏定义 */
@@ -1979,8 +2009,7 @@ declare namespace ty {
1979
2009
  ): void
1980
2010
 
1981
2011
  /**
1982
- * 取消监听内存不足告警事件。
1983
- */
2012
+ *@description 取消监听内存不足告警事件。*/
1984
2013
  export function offMemoryWarning(
1985
2014
  listener: (params: {
1986
2015
  /** 内存告警等级,只有 Android 才有,对应系统宏定义 */
@@ -1989,8 +2018,8 @@ declare namespace ty {
1989
2018
  ): void
1990
2019
 
1991
2020
  /**
1992
- * 监听蓝牙适配器状态变化事件
1993
- */
2021
+ *@description 监听蓝牙适配器状态变化事件,需要申请蓝牙权限
2022
+ *@error {9002: 'Context is invalid'} | {9004: 'app no permission'} | {9005: 'can‘t find service'}*/
1994
2023
  export function onBluetoothAdapterStateChange(
1995
2024
  listener: (params: {
1996
2025
  /** 蓝牙适配器是否可用 */
@@ -1999,8 +2028,8 @@ declare namespace ty {
1999
2028
  ): void
2000
2029
 
2001
2030
  /**
2002
- * 取消监听蓝牙适配器状态变化事件
2003
- */
2031
+ *@description 取消监听蓝牙适配器状态变化事件
2032
+ *@error {9002: 'Context is invalid'}*/
2004
2033
  export function offBluetoothAdapterStateChange(
2005
2034
  listener: (params: {
2006
2035
  /** 蓝牙适配器是否可用 */
@@ -2009,8 +2038,10 @@ declare namespace ty {
2009
2038
  ): void
2010
2039
 
2011
2040
  /**
2012
- * 监听网络状态变化事件
2013
- */
2041
+ *@description 监听网络状态变化事件
2042
+ *注意:在Android上,该事件只通知网络状态的变化。如需获取最新的网络状态信息,请重新调用getNetworkType接口。
2043
+ *注意:在Android上,网络状态发生改变时,系统并不一定立马变更网络状态信息,存在一定的延迟。因此触发该事件时,业务上可能需要延迟调用getNetworkType接口,以便获取最新的信息。
2044
+ *@error {9002: 'Context is invalid'}*/
2014
2045
  export function onNetworkStatusChange(
2015
2046
  listener: (params: {
2016
2047
  /** 当前是否有网络连接 */
@@ -2021,8 +2052,8 @@ declare namespace ty {
2021
2052
  ): void
2022
2053
 
2023
2054
  /**
2024
- * 取消监听网络状态变化事件
2025
- */
2055
+ *@description 取消监听网络状态变化事件
2056
+ *@error {9002: 'Context is invalid'}*/
2026
2057
  export function offNetworkStatusChange(
2027
2058
  listener: (params: {
2028
2059
  /** 当前是否有网络连接 */
@@ -2034,21 +2065,21 @@ declare namespace ty {
2034
2065
 
2035
2066
  export enum WidgetVersionType {
2036
2067
  /** 线上版本 */
2037
- release = "release",
2068
+ release = 'release',
2038
2069
 
2039
2070
  /** 预发版本 */
2040
- preview = "preview",
2071
+ preview = 'preview',
2041
2072
  }
2042
2073
 
2043
2074
  export enum WidgetPosition {
2044
2075
  /** 居底展示 */
2045
- bottom = "bottom",
2076
+ bottom = 'bottom',
2046
2077
 
2047
2078
  /** 居顶展示 */
2048
- top = "top",
2079
+ top = 'top',
2049
2080
 
2050
2081
  /** 居中展示 */
2051
- center = "center",
2082
+ center = 'center',
2052
2083
  }
2053
2084
 
2054
2085
  export type Profile = {
@@ -2119,9 +2150,9 @@ declare namespace ty {
2119
2150
  export type SaveFileSyncParams = {
2120
2151
  /** taskId */
2121
2152
  fileId: string
2122
- /** 临时存储文件路径 */
2153
+ /** 需要存储的文件的临时路径 */
2123
2154
  tempFilePath: string
2124
- /** 要存储的文件路径 */
2155
+ /** 要存储的文件的目标路径 */
2125
2156
  filePath: string
2126
2157
  }
2127
2158
 
@@ -2191,61 +2222,146 @@ declare namespace ty {
2191
2222
 
2192
2223
  export enum HTTPMethod {
2193
2224
  /** HTTP 请求 OPTIONS */
2194
- OPTIONS = "OPTIONS",
2225
+ OPTIONS = 'OPTIONS',
2195
2226
 
2196
2227
  /** HTTP 请求 GET */
2197
- GET = "GET",
2228
+ GET = 'GET',
2198
2229
 
2199
2230
  /** HTTP 请求 HEAD */
2200
- HEAD = "HEAD",
2231
+ HEAD = 'HEAD',
2201
2232
 
2202
2233
  /** HTTP 请求 POST */
2203
- POST = "POST",
2234
+ POST = 'POST',
2204
2235
 
2205
2236
  /** HTTP 请求 PUT */
2206
- PUT = "PUT",
2237
+ PUT = 'PUT',
2207
2238
 
2208
2239
  /** HTTP 请求 DELETE */
2209
- DELETE = "DELETE",
2240
+ DELETE = 'DELETE',
2210
2241
 
2211
2242
  /** HTTP 请求 TRACE */
2212
- TRACE = "TRACE",
2243
+ TRACE = 'TRACE',
2213
2244
 
2214
2245
  /** HTTP 请求 TRACE */
2215
- CONNECT = "CONNECT",
2246
+ CONNECT = 'CONNECT',
2247
+ }
2248
+
2249
+ export enum AudioSampleRate {
2250
+ /** 8000 采样率 */
2251
+ RATE_8000 = 8000,
2252
+
2253
+ /** 11025 采样率 */
2254
+ RATE_11025 = 11025,
2255
+
2256
+ /** 12000 采样率 */
2257
+ RATE_12000 = 12000,
2258
+
2259
+ /** 16000 采样率 */
2260
+ RATE_16000 = 16000,
2261
+
2262
+ /** 22050 采样率 */
2263
+ RATE_22050 = 22050,
2264
+
2265
+ /** 24000 采样率 */
2266
+ RATE_24000 = 24000,
2267
+
2268
+ /** 32000 采样率 */
2269
+ RATE_32000 = 32000,
2270
+
2271
+ /** 44100 采样率 */
2272
+ RATE_44100 = 44100,
2273
+
2274
+ /** 48000 采样率 */
2275
+ RATE_48000 = 48000,
2276
+ }
2277
+
2278
+ export enum AudioNumChannel {
2279
+ /** 单通道 */
2280
+ SINGLE = 1,
2281
+
2282
+ /** 双通道 */
2283
+ DOUBLE = 2,
2284
+ }
2285
+
2286
+ export enum AudioFormat {
2287
+ /** mp3 格式(iOS暂不支持) */
2288
+ MP3 = 'mp3',
2289
+
2290
+ /** aac 格式 */
2291
+ AAC = 'aac',
2292
+
2293
+ /** wav 格式 */
2294
+ WAV = 'wav',
2295
+
2296
+ /** PCM 格式 */
2297
+ PCM = 'PCM',
2216
2298
  }
2217
2299
 
2218
2300
  export enum AccelerometerInterval {
2219
2301
  /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
2220
- game = "game",
2302
+ game = 'game',
2221
2303
 
2222
2304
  /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
2223
- ui = "ui",
2305
+ ui = 'ui',
2224
2306
 
2225
2307
  /** 普通的回调频率,在 200ms/次 左右 */
2226
- normal = "normal",
2308
+ normal = 'normal',
2309
+ }
2310
+
2311
+ export enum ScopeBean {
2312
+ /** 蓝牙权限 */
2313
+ BLUETOOTH = 'scope.bluetooth',
2314
+
2315
+ /** 麦克风权限 */
2316
+ RECORD = 'scope.record',
2317
+
2318
+ /** 写入权限 */
2319
+ WRITEPHOTOSALBUM = 'scope.writePhotosAlbum',
2320
+
2321
+ /** 摄像头权限 */
2322
+ CAMERA = 'scope.camera',
2323
+
2324
+ /** 低精度定位权限 */
2325
+ USERLOCATION = 'scope.userLocation',
2326
+
2327
+ /** 高精度定位权限 */
2328
+ USERPRECISELOCATION = 'scope.userPreciseLocation',
2329
+
2330
+ /**
2331
+ * 后台定位权限
2332
+ * 注意: iOS需要将TARGETS->Capabilities->Background Modes->Location updates打开
2333
+ */
2334
+ USERLOCATIONBACKGROUND = 'scope.userLocationBackground',
2335
+
2336
+ /** 用户信息 */
2337
+ USERINFO = 'scope.userInfo',
2338
+ }
2339
+
2340
+ export type SchemaBean = {
2341
+ /** 使用 ${API}.${method}.${param}.${option}方式来调用 */
2342
+ schema: string
2227
2343
  }
2228
2344
 
2229
2345
  export enum DeviceMotionInterval {
2230
2346
  /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
2231
- game = "game",
2347
+ game = 'game',
2232
2348
 
2233
2349
  /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
2234
- ui = "ui",
2350
+ ui = 'ui',
2235
2351
 
2236
2352
  /** 普通的回调频率,在 200ms/次 左右 */
2237
- normal = "normal",
2353
+ normal = 'normal',
2238
2354
  }
2239
2355
 
2240
2356
  export enum GyroscopeInterval {
2241
2357
  /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
2242
- game = "game",
2358
+ game = 'game',
2243
2359
 
2244
2360
  /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
2245
- ui = "ui",
2361
+ ui = 'ui',
2246
2362
 
2247
2363
  /** 普通的回调频率,在 200ms/次 左右 */
2248
- normal = "normal",
2364
+ normal = 'normal',
2249
2365
  }
2250
2366
 
2251
2367
  export type Object = {}
@@ -2303,15 +2419,19 @@ declare namespace ty {
2303
2419
  }
2304
2420
 
2305
2421
  export enum Themes {
2306
- dark = "dark",
2422
+ /** 暗黑模式 */
2423
+ dark = 'dark',
2307
2424
 
2308
- light = "light",
2425
+ /** 亮色模式 */
2426
+ light = 'light',
2309
2427
  }
2310
2428
 
2311
2429
  export enum Orientation {
2312
- portrait = "portrait",
2430
+ /** 竖屏 */
2431
+ portrait = 'portrait',
2313
2432
 
2314
- landscape = "landscape",
2433
+ /** 横屏 */
2434
+ landscape = 'landscape',
2315
2435
  }
2316
2436
 
2317
2437
  export type KeyboardBean = {
@@ -2401,6 +2521,8 @@ declare namespace ty {
2401
2521
  prefix: string
2402
2522
  /** 完整文件的路径 */
2403
2523
  filePath: string
2524
+ /** 文件大小 */
2525
+ fileSize?: number
2404
2526
  /**
2405
2527
  * 分片名称,
2406
2528
  * 上传的分片名称,非本地分片
@@ -2418,6 +2540,14 @@ declare namespace ty {
2418
2540
  code: string
2419
2541
  /** 错误信息 */
2420
2542
  error?: string
2543
+ /** 分片序号 */
2544
+ fragIndex?: number
2545
+ /** 总分片数 */
2546
+ fragCount?: number
2547
+ /** 分片大小 */
2548
+ fragSize?: number
2549
+ /** 分片在文件中的偏移量 */
2550
+ fragPos?: number
2421
2551
  /** 扩展字段 */
2422
2552
  extData?: Object
2423
2553
  }
@@ -2427,18 +2557,20 @@ declare namespace ty {
2427
2557
  height: number
2428
2558
  }
2429
2559
 
2430
- export type CurrentVolumeResponse = {
2560
+ export type VolumeResponse = {
2431
2561
  /** 音量,阈值【0 - 1】 */
2432
2562
  value: number
2433
2563
  /**
2434
2564
  * 音量类型(仅Android生效)
2435
2565
  * 0:语音电话的声音
2566
+ * 1:手机系统声音
2436
2567
  * 2:响铃,通知,系统默认音等
2437
2568
  * 3:手机音乐的声音
2438
2569
  * 4:手机闹铃的声音
2570
+ * 5:手机通知的声音
2439
2571
  * 6:蓝牙音量
2440
2572
  */
2441
- volumeMode: number
2573
+ volumeMode?: number
2442
2574
  }
2443
2575
 
2444
2576
  export type WifiListResponse = {
@@ -2451,7 +2583,7 @@ declare namespace ty {
2451
2583
  buffer: number[]
2452
2584
  }
2453
2585
 
2454
- export type InnerAudioContext = {
2586
+ export type InnerAudioContextBean = {
2455
2587
  /** InnerAudioContext 对象 ContextId */
2456
2588
  contextId: string
2457
2589
  }
@@ -2462,7 +2594,7 @@ declare namespace ty {
2462
2594
  }
2463
2595
 
2464
2596
  export type AudioFileResponse = {
2465
- /** 音频时长 */
2597
+ /** 音频时长, 单位 ms */
2466
2598
  duration: number
2467
2599
  }
2468
2600
 
@@ -2474,7 +2606,7 @@ declare namespace ty {
2474
2606
  contextId: string
2475
2607
  /** src 音频资源的地址 */
2476
2608
  src: string
2477
- /** startTime 开始播放的位置 */
2609
+ /** startTime 开始播放的位置, 单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
2478
2610
  startTime?: number
2479
2611
  /** autoplay 是否自动开始播放 */
2480
2612
  autoplay?: boolean
@@ -2494,23 +2626,47 @@ declare namespace ty {
2494
2626
  }
2495
2627
 
2496
2628
  export type AuthorizeBean = {
2497
- /**
2498
- * scope 权限名称
2499
- * 举例子:
2500
- * scope.bluetooth 蓝牙权限
2501
- * scope.writePhotosAlbum 写入相册权限
2502
- * scope.userLocationBackground 后台定位权限
2503
- * scope.record 麦克风权限
2504
- * scope.camera 摄像头权限
2505
- * scope.userLocation 低精度定位权限
2506
- * scope.userPreciseLocation 高精度定位权限
2507
- * scope.userInfo 用户信息
2508
- */
2509
- scope: string
2629
+ /** scope 权限名称 */
2630
+ scope?: ScopeBean
2510
2631
  }
2511
2632
 
2512
2633
  export type SettingBean = {
2513
- authSetting: Record<string, boolean>
2634
+ /** 用户授权结果 */
2635
+ authSetting: any
2636
+ }
2637
+
2638
+ export type AuthorizePolicyReqBean = {
2639
+ /** 当前授权的协议类型,不同协议可以独立授权.例如:ai_algorithm 表示AI算法协议 */
2640
+ type: string
2641
+ /** 协议的版本 */
2642
+ version: string
2643
+ /** 协议授权操作 /1 同意 2 不同意 */
2644
+ status: number
2645
+ }
2646
+
2647
+ export type AuthorizePolicyRespBean = {
2648
+ /** 是否同意 */
2649
+ agreed: boolean
2650
+ }
2651
+
2652
+ export type AuthorizePolicyStatusReqBean = {
2653
+ /** 当前授权的协议类型,不同协议可以独立授权. 例如:ai_algorithm 表示AI算法协议 */
2654
+ type: string
2655
+ }
2656
+
2657
+ export type AuthorizePolicyStatusRespBean = {
2658
+ /** 标题 */
2659
+ title: string
2660
+ /** 协议名称 */
2661
+ agreementName: string
2662
+ /** 协议描述 */
2663
+ agreementDesc: string
2664
+ /** 协议链接 */
2665
+ link: string
2666
+ /** 协议版本 */
2667
+ version: string
2668
+ /** 0 未签署(首次)1 未签署(更新)2 已签署 */
2669
+ sign: number
2514
2670
  }
2515
2671
 
2516
2672
  export type ToMiniProgramBean = {
@@ -2529,7 +2685,7 @@ declare namespace ty {
2529
2685
  /** 打开小程序的转场方式,分为right|bottom,指代水平和竖直方向 */
2530
2686
  position?: string
2531
2687
  /** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
2532
- extraData?: Record<string, any>
2688
+ extraData?: any
2533
2689
  /**
2534
2690
  * 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版
2535
2691
  * trial:体验版
@@ -2570,9 +2726,11 @@ declare namespace ty {
2570
2726
  supportDark?: boolean
2571
2727
  }
2572
2728
 
2573
- export type MiniWidgetDialogBean = {
2574
- /** widget弹窗id */
2575
- dialogId: string
2729
+ export type MiniWidgetDialogBean = {}
2730
+
2731
+ export type SuccessResult = {
2732
+ /** 当前版本是否可用 */
2733
+ result: boolean
2576
2734
  }
2577
2735
 
2578
2736
  export type VideoThumbnailsBean = {
@@ -2633,7 +2791,7 @@ declare namespace ty {
2633
2791
  /** 下载资源的 url */
2634
2792
  url: string
2635
2793
  /** HTTP 请求的 Header,Header 中不能设置 Referer */
2636
- header?: Record<string, string>
2794
+ header?: any
2637
2795
  /** 超时时间,单位为毫秒 */
2638
2796
  timeout?: number
2639
2797
  /** 指定文件下载后存储的路径 (本地路径) */
@@ -2787,7 +2945,10 @@ declare namespace ty {
2787
2945
  }
2788
2946
 
2789
2947
  export type ChooseImageBean = {
2790
- /** 最多可以选择的图片张数 */
2948
+ /**
2949
+ * 最多可以选择的图片张数
2950
+ * 注意:Android13以上的版本,使用的是系统图片选择器,该字段不生效
2951
+ */
2791
2952
  count?: number
2792
2953
  /** sizeType ['original', 'compressed'] */
2793
2954
  sizeType?: string[]
@@ -2805,7 +2966,10 @@ declare namespace ty {
2805
2966
  }
2806
2967
 
2807
2968
  export type ChooseMediaBean = {
2808
- /** 最多可以选择的文件数 */
2969
+ /**
2970
+ * 最多可以选择的文件数。
2971
+ * 注意:Android13以上的版本,使用的是系统图片选择器,该字段不生效
2972
+ */
2809
2973
  count?: number
2810
2974
  /**
2811
2975
  * 选择类型, 默认图片
@@ -2839,6 +3003,7 @@ declare namespace ty {
2839
3003
  isClipVideo?: boolean
2840
3004
  /**
2841
3005
  * 视频最长剪辑时间,单位秒。默认60s
3006
+ * 需要设置isClipVideo为true才生效
2842
3007
  * 时间范围为 60s 至 600 之间。 选择视频的时长小于15s不裁剪
2843
3008
  */
2844
3009
  maxClipDuration?: number
@@ -2951,6 +3116,11 @@ declare namespace ty {
2951
3116
  export type SaveVideoParams = {
2952
3117
  /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
2953
3118
  filePath: string
3119
+ /**
3120
+ * 是否修改视频的创建日期
3121
+ * 默认false,不修改视频的创建日期。ture,修改视频的创建日期为当前保存时间
3122
+ */
3123
+ modifyCreationDate?: boolean
2954
3124
  }
2955
3125
 
2956
3126
  export type VideoSaveAlbumResponse = {
@@ -2961,9 +3131,14 @@ declare namespace ty {
2961
3131
  export type SaveImageParams = {
2962
3132
  /** 图片文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
2963
3133
  filePath: string
3134
+ /**
3135
+ * 是否修改视频的创建日期
3136
+ * 默认false,不修改视频的创建日期。ture,修改视频的创建日期为当前保存时间
3137
+ */
3138
+ modifyCreationDate?: boolean
2964
3139
  }
2965
3140
 
2966
- export type CropImageBean_8zIFMW = {
3141
+ export type CropImageBean_MJdDy6 = {
2967
3142
  /** 图片路径 */
2968
3143
  path: string
2969
3144
  /** 裁剪的宽度 */
@@ -3000,7 +3175,7 @@ declare namespace ty {
3000
3175
  icon?: string
3001
3176
  /** 自定义图标的本地路径,image 的优先级高于 icon */
3002
3177
  image?: string
3003
- /** 提示的延迟时间 */
3178
+ /** 提示的延迟时间(仅iOS生效) */
3004
3179
  duration?: number
3005
3180
  /** 是否显示透明蒙层,防止触摸穿透 */
3006
3181
  mask?: boolean
@@ -3016,11 +3191,11 @@ declare namespace ty {
3016
3191
  /** 取消按钮的文字,最多 4 个字符 */
3017
3192
  cancelText?: string
3018
3193
  /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
3019
- cancelColor?: string
3194
+ cancelColor: string
3020
3195
  /** 确认按钮的文字,最多 4 个字符 */
3021
3196
  confirmText?: string
3022
3197
  /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
3023
- confirmColor?: string
3198
+ confirmColor: string
3024
3199
  /** 是否全局弹窗,若为全局弹窗,弹在最顶上 */
3025
3200
  isShowGlobal?: boolean
3026
3201
  }
@@ -3063,13 +3238,13 @@ declare namespace ty {
3063
3238
  /** 请求的参数 */
3064
3239
  data?: string
3065
3240
  /** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
3066
- header?: Record<string, string>
3241
+ header?: any
3067
3242
  /** 超时时间,单位为毫秒 */
3068
3243
  timeout?: number
3069
3244
  /** HTTP 请求方法 */
3070
3245
  method?: HTTPMethod
3071
- /** 返回的数据格式 */
3072
- dataType?: any
3246
+ /** 请求体里的数据类型(仅Android,且请求方式不为GET时生效) */
3247
+ dataType?: string
3073
3248
  /** 返回的数据类型 */
3074
3249
  responseType?: string
3075
3250
  /** enableHttp2 */
@@ -3080,13 +3255,13 @@ declare namespace ty {
3080
3255
  enableCache?: boolean
3081
3256
  }
3082
3257
 
3083
- export type SuccessResult = {
3258
+ export type SuccessResult_bvZBQy = {
3084
3259
  /** 开发者服务器返回的数据 */
3085
3260
  data: string
3086
3261
  /** 开发者服务器返回的 HTTP 状态码 */
3087
3262
  statusCode: number
3088
3263
  /** 开发者服务器返回的 HTTP Response Header */
3089
- header: Record<string, string>
3264
+ header: any
3090
3265
  /** 开发者服务器返回的 cookies,格式为字符串数组 */
3091
3266
  cookies: string[]
3092
3267
  /** 网络请求过程中一些调试信息 */
@@ -3144,21 +3319,30 @@ declare namespace ty {
3144
3319
  /**
3145
3320
  * 音量类型(仅Android生效)
3146
3321
  * 0:语音电话的声音
3322
+ * 1:手机系统声音
3147
3323
  * 2:响铃,通知,系统默认音等
3148
3324
  * 3:手机音乐的声音
3149
3325
  * 4:手机闹铃的声音
3326
+ * 5:手机通知的声音
3150
3327
  * 6:蓝牙音量
3151
3328
  */
3152
3329
  volumeMode?: number[]
3153
3330
  }
3154
3331
 
3332
+ export type CurrentVolumeResponse = {
3333
+ /** 音量,阈值【0 - 1】 */
3334
+ value: number
3335
+ }
3336
+
3155
3337
  export type CurrentVolumeParams = {
3156
3338
  /**
3157
3339
  * 音量类型(仅Android生效)
3158
3340
  * 0:语音电话的声音
3341
+ * 1:手机系统声音
3159
3342
  * 2:响铃,通知,系统默认音等
3160
3343
  * 3:手机音乐的声音
3161
3344
  * 4:手机闹铃的声音
3345
+ * 5:手机通知的声音
3162
3346
  * 6:蓝牙音量
3163
3347
  */
3164
3348
  volumeMode?: number
@@ -3239,7 +3423,7 @@ declare namespace ty {
3239
3423
  /**
3240
3424
  * 是否需要返回部分 Wi-Fi 信息
3241
3425
  * 安卓 thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID 属性的 WifiInfo 对象。
3242
- * iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
3426
+ * iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象。
3243
3427
  * 默认值:false
3244
3428
  */
3245
3429
  partialInfo?: boolean
@@ -3271,7 +3455,10 @@ declare namespace ty {
3271
3455
  export type NetworkTypeCB = {
3272
3456
  /** 网络类型 */
3273
3457
  networkType: string
3274
- /** 信号强弱,单位 dbm */
3458
+ /**
3459
+ * 信号强弱,单位 dbm
3460
+ * 注意: iOS不支持
3461
+ */
3275
3462
  signalStrength: number
3276
3463
  }
3277
3464
 
@@ -3294,13 +3481,13 @@ declare namespace ty {
3294
3481
  /** 录音的时长,单位 ms,最大值 600000(10 分钟) */
3295
3482
  duration?: number
3296
3483
  /** 采样率 */
3297
- sampleRate?: number
3484
+ sampleRate?: AudioSampleRate
3298
3485
  /** 录音通道数 */
3299
- numberOfChannels?: number
3486
+ numberOfChannels?: AudioNumChannel
3300
3487
  /** 编码码率,有效值见下表格 */
3301
3488
  encodeBitRate?: number
3302
3489
  /** 音频格式 */
3303
- format?: string
3490
+ format?: AudioFormat
3304
3491
  /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
3305
3492
  frameSize: number
3306
3493
  /** 指定录音的音频输入源 */
@@ -3362,6 +3549,18 @@ declare namespace ty {
3362
3549
  rawData: string
3363
3550
  }
3364
3551
 
3552
+ export type ScanLoginBean = {
3553
+ /** 扫码内容 */
3554
+ content: string
3555
+ }
3556
+
3557
+ export type ScanLoginResult = {
3558
+ /** 扫码登录结果 0:确认登录成功 1:取消/返回 2:确认登录失败 */
3559
+ code: number
3560
+ /** 扫码登录失败错误描述 */
3561
+ msg: string
3562
+ }
3563
+
3365
3564
  export type StorageCallback = {
3366
3565
  /** key对应的内容 */
3367
3566
  data?: string
@@ -3377,9 +3576,9 @@ declare namespace ty {
3377
3576
  /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
3378
3577
  name: string
3379
3578
  /** HTTP 请求的 Header,Header 中不能设置 Referer */
3380
- header?: Record<string, string>
3579
+ header?: any
3381
3580
  /** HTTP 请求中其他额外的 form data */
3382
- formData?: Record<string, string>
3581
+ formData?: any
3383
3582
  /** 超时时间,单位为毫秒 */
3384
3583
  timeout?: number
3385
3584
  }
@@ -3392,14 +3591,12 @@ declare namespace ty {
3392
3591
  }
3393
3592
 
3394
3593
  /**
3395
- * 创建内部audio上下文InnerAudioContext对象
3396
- */
3397
- interface CreateInnerAudioContextTask {
3594
+ *@description 创建内部audio上下文InnerAudioContext对象*/
3595
+ interface InnerAudioContext {
3398
3596
  /**
3399
- * 暂停
3400
- */
3597
+ *@description 暂停
3598
+ *@error {6: 'The parameter format is incorrect'}*/
3401
3599
  pause(params: {
3402
- complete?: () => void
3403
3600
  success?: (params: null) => void
3404
3601
  fail?: (params: {
3405
3602
  errorMsg: string
@@ -3409,13 +3606,13 @@ declare namespace ty {
3409
3606
  errorMsg: string
3410
3607
  }
3411
3608
  }) => void
3609
+ complete?: () => void
3412
3610
  }): void
3413
3611
 
3414
3612
  /**
3415
- * 恢复
3416
- */
3613
+ *@description 恢复
3614
+ *@error {6: 'The parameter format is incorrect'}*/
3417
3615
  resume(params: {
3418
- complete?: () => void
3419
3616
  success?: (params: null) => void
3420
3617
  fail?: (params: {
3421
3618
  errorMsg: string
@@ -3425,15 +3622,16 @@ declare namespace ty {
3425
3622
  errorMsg: string
3426
3623
  }
3427
3624
  }) => void
3625
+ complete?: () => void
3428
3626
  }): void
3429
3627
 
3430
3628
  /**
3431
- * 播放
3432
- */
3629
+ *@description 播放
3630
+ *@error {6: 'The parameter format is incorrect'} | {9002: 'Context is invalid'} | {10004: 'audio play error'}*/
3433
3631
  play(params: {
3434
3632
  /** src 音频资源的地址 */
3435
3633
  src: string
3436
- /** startTime 开始播放的位置 */
3634
+ /** startTime 开始播放的位置, 单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
3437
3635
  startTime?: number
3438
3636
  /** autoplay 是否自动开始播放 */
3439
3637
  autoplay?: boolean
@@ -3443,7 +3641,6 @@ declare namespace ty {
3443
3641
  volume?: number
3444
3642
  /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
3445
3643
  playbackRate?: number
3446
- complete?: () => void
3447
3644
  success?: (params: null) => void
3448
3645
  fail?: (params: {
3449
3646
  errorMsg: string
@@ -3453,15 +3650,15 @@ declare namespace ty {
3453
3650
  errorMsg: string
3454
3651
  }
3455
3652
  }) => void
3653
+ complete?: () => void
3456
3654
  }): void
3457
3655
 
3458
3656
  /**
3459
- * 跳转到指定位置
3460
- */
3657
+ *@description 跳转到指定位置
3658
+ *@error {6: 'The parameter format is incorrect'} | {10005: 'audio seek error'}*/
3461
3659
  seek(params: {
3462
3660
  /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
3463
3661
  position?: number
3464
- complete?: () => void
3465
3662
  success?: (params: null) => void
3466
3663
  fail?: (params: {
3467
3664
  errorMsg: string
@@ -3471,13 +3668,13 @@ declare namespace ty {
3471
3668
  errorMsg: string
3472
3669
  }
3473
3670
  }) => void
3671
+ complete?: () => void
3474
3672
  }): void
3475
3673
 
3476
3674
  /**
3477
- * 停止。停止后的音频再播放会从头开始播放
3478
- */
3675
+ *@description 停止。停止后的音频再播放会从头开始播放
3676
+ *@error {6: 'The parameter format is incorrect'} | {10006: 'audio stop error'}*/
3479
3677
  stop(params: {
3480
- complete?: () => void
3481
3678
  success?: (params: null) => void
3482
3679
  fail?: (params: {
3483
3680
  errorMsg: string
@@ -3487,13 +3684,30 @@ declare namespace ty {
3487
3684
  errorMsg: string
3488
3685
  }
3489
3686
  }) => void
3687
+ complete?: () => void
3490
3688
  }): void
3491
3689
 
3492
3690
  /**
3493
- * 销毁当前实例
3494
- */
3691
+ *@description 销毁当前实例
3692
+ *@deprecated 方法已停止维护,请谨慎使用,推荐使用destroyPlayer代替。
3693
+ *@error {6: 'The parameter format is incorrect'}*/
3495
3694
  destroy(params: {
3695
+ success?: (params: null) => void
3696
+ fail?: (params: {
3697
+ errorMsg: string
3698
+ errorCode: string | number
3699
+ innerError: {
3700
+ errorCode: string | number
3701
+ errorMsg: string
3702
+ }
3703
+ }) => void
3496
3704
  complete?: () => void
3705
+ }): void
3706
+
3707
+ /**
3708
+ *@description 销毁当前实例
3709
+ *@error {6: 'The parameter format is incorrect'}*/
3710
+ destroyPlayer(params: {
3497
3711
  success?: (params: null) => void
3498
3712
  fail?: (params: {
3499
3713
  errorMsg: string
@@ -3503,22 +3717,21 @@ declare namespace ty {
3503
3717
  errorMsg: string
3504
3718
  }
3505
3719
  }) => void
3720
+ complete?: () => void
3506
3721
  }): void
3507
3722
 
3508
3723
  /**
3509
- * 监听音频播放进度更新事件
3510
- */
3724
+ *@description 监听音频播放进度更新事件(进度为系统返回,双端可能不一致)*/
3511
3725
  onTimeUpdate(
3512
3726
  listener: (params: {
3513
- /** InnerAudioContext 对象 ContextId */
3514
- contextId: string
3515
3727
  /** 播放进度 【0 - 1】 */
3516
3728
  time: number
3517
3729
  }) => void
3518
3730
  ): void
3519
3731
  }
3732
+ /**
3733
+ *@description 创建内部audio上下文InnerAudioContext对象*/
3520
3734
  export function createInnerAudioContext(params?: {
3521
- complete?: () => void
3522
3735
  success?: (params: null) => void
3523
3736
  fail?: (params: {
3524
3737
  errorMsg: string
@@ -3528,17 +3741,16 @@ declare namespace ty {
3528
3741
  errorMsg: string
3529
3742
  }
3530
3743
  }) => void
3531
- }): CreateInnerAudioContextTask
3744
+ complete?: () => void
3745
+ }): InnerAudioContext
3532
3746
 
3533
3747
  /**
3534
- * 一个用来控制小部件弹窗显示和关闭的对象
3535
- */
3536
- interface MiniWidgetDialogTask {
3748
+ *@description 一个用来控制小部件弹窗显示和关闭的对象*/
3749
+ interface MiniWidgetDialog {
3537
3750
  /**
3538
- * 关闭小部件弹窗
3539
- */
3751
+ *@description 关闭小部件弹窗
3752
+ *@error {5: 'The necessary parameters are missing'} | {7: 'API Internal processing failed'}*/
3540
3753
  dismissMiniWidget(params: {
3541
- complete?: () => void
3542
3754
  success?: (params: null) => void
3543
3755
  fail?: (params: {
3544
3756
  errorMsg: string
@@ -3548,28 +3760,22 @@ declare namespace ty {
3548
3760
  errorMsg: string
3549
3761
  }
3550
3762
  }) => void
3763
+ complete?: () => void
3551
3764
  }): void
3552
3765
 
3553
3766
  /**
3554
- * 监听widget关闭事件
3555
- */
3556
- onWidgetDismiss(
3557
- listener: (params: {
3558
- /** widget弹窗id */
3559
- dialogId: string
3560
- }) => void
3561
- ): void
3767
+ *@description 监听widget关闭事件
3768
+ *@error {5: 'The necessary parameters are missing'} | {7: 'API Internal processing failed'}*/
3769
+ onWidgetDismiss(listener: (params: {}) => void): void
3562
3770
 
3563
3771
  /**
3564
- * 取消监听widget关闭事件
3565
- */
3566
- offWidgetDismiss(
3567
- listener: (params: {
3568
- /** widget弹窗id */
3569
- dialogId: string
3570
- }) => void
3571
- ): void
3772
+ *@description 取消监听widget关闭事件
3773
+ *@error {5: 'The necessary parameters are missing'} | {7: 'API Internal processing failed'}*/
3774
+ offWidgetDismiss(listener: (params: {}) => void): void
3572
3775
  }
3776
+ /**
3777
+ *@description 打开小部件弹窗
3778
+ *@error {5: 'The necessary parameters are missing'}*/
3573
3779
  export function openMiniWidget(params: {
3574
3780
  /** 要打开的小部件appid */
3575
3781
  appId: string
@@ -3596,7 +3802,6 @@ declare namespace ty {
3596
3802
  autoCache?: boolean
3597
3803
  /** 是否支持深色模式 */
3598
3804
  supportDark?: boolean
3599
- complete?: () => void
3600
3805
  success?: (params: null) => void
3601
3806
  fail?: (params: {
3602
3807
  errorMsg: string
@@ -3606,17 +3811,16 @@ declare namespace ty {
3606
3811
  errorMsg: string
3607
3812
  }
3608
3813
  }) => void
3609
- }): MiniWidgetDialogTask
3814
+ complete?: () => void
3815
+ }): MiniWidgetDialog
3610
3816
 
3611
3817
  /**
3612
- * 一个可以监听下载进度变化事件,以及取消下载任务的对象
3613
- */
3614
- interface DownloadFileTask {
3818
+ *@description 一个可以监听下载进度变化事件,以及取消下载任务的对象*/
3819
+ interface DownloadTask {
3615
3820
  /**
3616
- * 中断下载任务
3617
- */
3821
+ *@description 中断下载任务
3822
+ *@error {7: 'API Internal processing failed'}*/
3618
3823
  abort(params: {
3619
- complete?: () => void
3620
3824
  success?: (params: null) => void
3621
3825
  fail?: (params: {
3622
3826
  errorMsg: string
@@ -3626,35 +3830,32 @@ declare namespace ty {
3626
3830
  errorMsg: string
3627
3831
  }
3628
3832
  }) => void
3833
+ complete?: () => void
3629
3834
  }): void
3630
3835
 
3631
3836
  /**
3632
- * 监听 HTTP Response Header 事件。会比请求完成事件更早
3633
- */
3837
+ *@description 监听 HTTP Response Header 事件。会比请求完成事件更早
3838
+ *@error {7: 'API Internal processing failed'}*/
3634
3839
  onHeadersReceived(
3635
3840
  listener: (params: {
3636
3841
  /** 开发者服务器返回的 HTTP Response Header */
3637
- header: Record<string, string>
3638
- /** 网络请求id */
3639
- requestId: string
3842
+ header: any
3640
3843
  }) => void
3641
3844
  ): void
3642
3845
 
3643
3846
  /**
3644
- * 取消监听 HTTP Response Header 事件
3645
- */
3847
+ *@description 取消监听 HTTP Response Header 事件
3848
+ *@error {7: 'API Internal processing failed'}*/
3646
3849
  offHeadersReceived(
3647
3850
  listener: (params: {
3648
3851
  /** 开发者服务器返回的 HTTP Response Header */
3649
- header: Record<string, string>
3650
- /** 网络请求id */
3651
- requestId: string
3852
+ header: any
3652
3853
  }) => void
3653
3854
  ): void
3654
3855
 
3655
3856
  /**
3656
- * 监听下载进度变化事件
3657
- */
3857
+ *@description 监听下载进度变化事件
3858
+ *@error {7: 'API Internal processing failed'}*/
3658
3859
  onProgressUpdate(
3659
3860
  listener: (params: {
3660
3861
  /** 下载进度百分比 */
@@ -3663,14 +3864,12 @@ declare namespace ty {
3663
3864
  totalBytesSent: number
3664
3865
  /** 预期需要下载的数据总长度,单位 Bytes */
3665
3866
  totalBytesExpectedToSend: number
3666
- /** 网络请求id */
3667
- requestId: string
3668
3867
  }) => void
3669
3868
  ): void
3670
3869
 
3671
3870
  /**
3672
- * 取消监听下载进度变化事件
3673
- */
3871
+ *@description 取消监听下载进度变化事件
3872
+ *@error {7: 'API Internal processing failed'}*/
3674
3873
  offProgressUpdate(
3675
3874
  listener: (params: {
3676
3875
  /** 下载进度百分比 */
@@ -3679,21 +3878,22 @@ declare namespace ty {
3679
3878
  totalBytesSent: number
3680
3879
  /** 预期需要下载的数据总长度,单位 Bytes */
3681
3880
  totalBytesExpectedToSend: number
3682
- /** 网络请求id */
3683
- requestId: string
3684
3881
  }) => void
3685
3882
  ): void
3686
3883
  }
3884
+ /**
3885
+ *@description 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径 (本地路径),单次下载允许的最大文件为 200MB。使用前请注意阅读相关说明。
3886
+ *注意:请在服务端响应的 header 中指定合理的 Content-Type 字段,以保证客户端正确处理文件类型。
3887
+ *@error {5: 'The necessary parameters are missing'} | {10007: 'download file error'}*/
3687
3888
  export function downloadFile(params: {
3688
3889
  /** 下载资源的 url */
3689
3890
  url: string
3690
3891
  /** HTTP 请求的 Header,Header 中不能设置 Referer */
3691
- header?: Record<string, string>
3892
+ header?: any
3692
3893
  /** 超时时间,单位为毫秒 */
3693
3894
  timeout?: number
3694
3895
  /** 指定文件下载后存储的路径 (本地路径) */
3695
3896
  filePath?: string
3696
- complete?: () => void
3697
3897
  success?: (params: {
3698
3898
  /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
3699
3899
  tempFilePath: string
@@ -3712,19 +3912,18 @@ declare namespace ty {
3712
3912
  errorMsg: string
3713
3913
  }
3714
3914
  }) => void
3715
- }): DownloadFileTask
3915
+ complete?: () => void
3916
+ }): DownloadTask
3716
3917
 
3717
3918
  /**
3718
- * 文件管理器
3719
- */
3720
- interface GetFileSystemManagerTask {
3919
+ *@description 文件管理器*/
3920
+ interface FileSystemManager {
3721
3921
  /**
3722
- * 判断文件/目录是否存在
3723
- */
3922
+ *@description 判断文件/目录是否存在
3923
+ *@error {5: 'The necessary parameters are missing'} | {10011: 'file not exist'} | {10020: 'sdcard not mounted error'}*/
3724
3924
  access(params: {
3725
3925
  /** 要判断是否存在的文件/目录路径 (本地路径) */
3726
3926
  path: string
3727
- complete?: () => void
3728
3927
  success?: (params: null) => void
3729
3928
  fail?: (params: {
3730
3929
  errorMsg: string
@@ -3734,11 +3933,12 @@ declare namespace ty {
3734
3933
  errorMsg: string
3735
3934
  }
3736
3935
  }) => void
3936
+ complete?: () => void
3737
3937
  }): void
3738
3938
 
3739
3939
  /**
3740
- * 读取本地文件内容
3741
- */
3940
+ *@description 读取本地文件内容
3941
+ *@error {5: 'The necessary parameters are missing'} | {10011: 'file not exist'} | {10012: 'read file encoding invalid'} | {10013: 'read file error'}*/
3742
3942
  readFile(params: {
3743
3943
  /** 要写入的文件路径 (本地路径) */
3744
3944
  filePath: string
@@ -3751,7 +3951,6 @@ declare namespace ty {
3751
3951
  position?: number
3752
3952
  /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
3753
3953
  length?: number
3754
- complete?: () => void
3755
3954
  success?: (params: {
3756
3955
  /** 文件内容 */
3757
3956
  data: string
@@ -3764,25 +3963,25 @@ declare namespace ty {
3764
3963
  errorMsg: string
3765
3964
  }
3766
3965
  }) => void
3966
+ complete?: () => void
3767
3967
  }): void
3768
3968
 
3769
3969
  /**
3770
- * 读取本地文件内容
3771
- */
3970
+ *@description 读取本地文件内容
3971
+ *@error {5: 'The necessary parameters are missing'} | {10011: 'file not exist'} | {10012: 'read file encoding invalid'} | {10013: 'read file error'}*/
3772
3972
  readFileSync(req?: FileReadFileReqBean): {
3773
3973
  /** 文件内容 */
3774
3974
  data: string
3775
3975
  }
3776
3976
 
3777
3977
  /**
3778
- * 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
3779
- */
3978
+ *@description 将文件另存一份到目标路径中。
3979
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {10020: 'sdcard not mounted error'}*/
3780
3980
  saveFile(params: {
3781
- /** 临时存储文件路径 */
3981
+ /** 需要存储的文件的临时路径 */
3782
3982
  tempFilePath: string
3783
- /** 要存储的文件路径 */
3983
+ /** 要存储的文件的目标路径 */
3784
3984
  filePath: string
3785
- complete?: () => void
3786
3985
  success?: (params: {
3787
3986
  /** 【待废弃, 不建议使用】存储后的文件路径 */
3788
3987
  savedFilePath: string
@@ -3795,19 +3994,20 @@ declare namespace ty {
3795
3994
  errorMsg: string
3796
3995
  }
3797
3996
  }) => void
3997
+ complete?: () => void
3798
3998
  }): void
3799
3999
 
3800
4000
  /**
3801
- * 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
3802
- */
4001
+ *@description 将文件另存一份到目标路径中。
4002
+ *@error {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'} | {10020: 'sdcard not mounted error'}*/
3803
4003
  saveFileSync(params?: SaveFileSyncParams): {
3804
4004
  /** 【待废弃, 不建议使用】存储后的文件路径 */
3805
4005
  savedFilePath: string
3806
4006
  }
3807
4007
 
3808
4008
  /**
3809
- * 获取文件Stats对象,需要文件读写权限
3810
- */
4009
+ *@description 获取文件Stats对象,需要文件读写权限
4010
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10015: 'get file stats error'} | {10020: 'sdcard not mounted error'}*/
3811
4011
  stat(params: {
3812
4012
  /** 文件/目录路径 (本地路径) */
3813
4013
  path: string
@@ -3816,7 +4016,6 @@ declare namespace ty {
3816
4016
  * 默认值:false
3817
4017
  */
3818
4018
  recursive?: boolean
3819
- complete?: () => void
3820
4019
  success?: (params: {
3821
4020
  /** 文件列表 */
3822
4021
  fileStatsList: FileStats[]
@@ -3829,19 +4028,20 @@ declare namespace ty {
3829
4028
  errorMsg: string
3830
4029
  }
3831
4030
  }) => void
4031
+ complete?: () => void
3832
4032
  }): void
3833
4033
 
3834
4034
  /**
3835
- * 获取文件Stats对象,需要文件读写权限
3836
- */
4035
+ *@description 获取文件Stats对象,需要文件读写权限
4036
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10015: 'get file stats error'} | {10020: 'sdcard not mounted error'}*/
3837
4037
  statSync(params?: FileStatsParams): {
3838
4038
  /** 文件列表 */
3839
4039
  fileStatsList: FileStats[]
3840
4040
  }
3841
4041
 
3842
4042
  /**
3843
- * 创建目录,需要文件读写权限
3844
- */
4043
+ *@description 创建目录,需要文件读写权限
4044
+ *@error {6: 'The parameter format is incorrect'} | {9004: 'app no permission'} | {10016: 'create dir error'} | {10020: 'sdcard not mounted error'}*/
3845
4045
  mkdir(params: {
3846
4046
  /** 创建的目录路径 (本地路径) */
3847
4047
  dirPath: string
@@ -3852,7 +4052,6 @@ declare namespace ty {
3852
4052
  * 默认值:false
3853
4053
  */
3854
4054
  recursive?: boolean
3855
- complete?: () => void
3856
4055
  success?: (params: null) => void
3857
4056
  fail?: (params: {
3858
4057
  errorMsg: string
@@ -3862,16 +4061,17 @@ declare namespace ty {
3862
4061
  errorMsg: string
3863
4062
  }
3864
4063
  }) => void
4064
+ complete?: () => void
3865
4065
  }): void
3866
4066
 
3867
4067
  /**
3868
- * 创建目录,需要文件读写权限
3869
- */
4068
+ *@description 创建目录,需要文件读写权限
4069
+ *@error {6: 'The parameter format is incorrect'} | {9004: 'app no permission'} | {10016: 'create dir error'} | {10020: 'sdcard not mounted error'}*/
3870
4070
  mkdirSync(params?: MakeDirParams): null
3871
4071
 
3872
4072
  /**
3873
- * 删除目录,需要文件读写权限
3874
- */
4073
+ *@description 删除目录,需要文件读写权限
4074
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10017: 'delete dir error'} | {10020: 'sdcard not mounted error'}*/
3875
4075
  rmdir(params: {
3876
4076
  /** 要删除的目录路径 (本地路径) */
3877
4077
  dirPath: string
@@ -3880,7 +4080,6 @@ declare namespace ty {
3880
4080
  * 默认值:false
3881
4081
  */
3882
4082
  recursive?: boolean
3883
- complete?: () => void
3884
4083
  success?: (params: null) => void
3885
4084
  fail?: (params: {
3886
4085
  errorMsg: string
@@ -3890,16 +4089,17 @@ declare namespace ty {
3890
4089
  errorMsg: string
3891
4090
  }
3892
4091
  }) => void
4092
+ complete?: () => void
3893
4093
  }): void
3894
4094
 
3895
4095
  /**
3896
- * 删除目录,需要文件读写权限
3897
- */
4096
+ *@description 删除目录,需要文件读写权限
4097
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10017: 'delete dir error'} | {10020: 'sdcard not mounted error'}*/
3898
4098
  rmdirSync(params?: RemoveDirParams): null
3899
4099
 
3900
4100
  /**
3901
- * 写文件,需要文件读写权限
3902
- */
4101
+ *@description 写文件,需要文件读写权限
4102
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10019: 'write file error'} | {10020: 'sdcard not mounted error'}*/
3903
4103
  writeFile(params: {
3904
4104
  /** 要写入的文件路径 (本地路径) */
3905
4105
  filePath: string
@@ -3907,7 +4107,6 @@ declare namespace ty {
3907
4107
  data: string
3908
4108
  /** 指定写入文件的字符编码,目前支持【utf8、ascii、base64】, 默认utf8 */
3909
4109
  encoding?: string
3910
- complete?: () => void
3911
4110
  success?: (params: null) => void
3912
4111
  fail?: (params: {
3913
4112
  errorMsg: string
@@ -3917,20 +4116,20 @@ declare namespace ty {
3917
4116
  errorMsg: string
3918
4117
  }
3919
4118
  }) => void
4119
+ complete?: () => void
3920
4120
  }): void
3921
4121
 
3922
4122
  /**
3923
- * 写文件,需要文件读写权限
3924
- */
4123
+ *@description 写文件,需要文件读写权限
4124
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10019: 'write file error'} | {10020: 'sdcard not mounted error'}*/
3925
4125
  writeFileSync(params?: WriteFileParams): null
3926
4126
 
3927
4127
  /**
3928
- * 删除已保存的本地缓存文件,需要文件读写权限
3929
- */
4128
+ *@description 删除已保存的本地缓存文件,需要文件读写权限
4129
+ *@error {6: 'The parameter format is incorrect'} | {10011: 'file not exist'} | {10018: 'remove saved file error'} | {10020: 'sdcard not mounted error'}*/
3930
4130
  removeSavedFile(params: {
3931
4131
  /** 需要删除的文件路径 (本地路径) */
3932
4132
  filePath: string
3933
- complete?: () => void
3934
4133
  success?: (params: null) => void
3935
4134
  fail?: (params: {
3936
4135
  errorMsg: string
@@ -3940,10 +4139,13 @@ declare namespace ty {
3940
4139
  errorMsg: string
3941
4140
  }
3942
4141
  }) => void
4142
+ complete?: () => void
3943
4143
  }): void
3944
4144
  }
4145
+ /**
4146
+ *@description 获取文件管理器,仅支持操作App内的文件。
4147
+ *如若文件操作的需要权,需另外调用权限接口申请。*/
3945
4148
  export function getFileSystemManager(params?: {
3946
- complete?: () => void
3947
4149
  success?: (params: null) => void
3948
4150
  fail?: (params: {
3949
4151
  errorMsg: string
@@ -3953,17 +4155,16 @@ declare namespace ty {
3953
4155
  errorMsg: string
3954
4156
  }
3955
4157
  }) => void
3956
- }): GetFileSystemManagerTask
4158
+ complete?: () => void
4159
+ }): FileSystemManager
3957
4160
 
3958
4161
  /**
3959
- * 获取网络请求任务对象RequestTask
3960
- */
4162
+ *@description 获取网络请求任务对象RequestTask*/
3961
4163
  interface RequestTask {
3962
4164
  /**
3963
- * 中断请求任务
3964
- */
4165
+ *@description 中断请求任务
4166
+ *@error {7: 'API Internal processing failed'}*/
3965
4167
  abort(params: {
3966
- complete?: () => void
3967
4168
  success?: (params: null) => void
3968
4169
  fail?: (params: {
3969
4170
  errorMsg: string
@@ -3973,45 +4174,43 @@ declare namespace ty {
3973
4174
  errorMsg: string
3974
4175
  }
3975
4176
  }) => void
4177
+ complete?: () => void
3976
4178
  }): void
3977
4179
 
3978
4180
  /**
3979
- * 监听 HTTP Response Header 事件。会比请求完成事件更早
3980
- */
4181
+ *@description 监听 HTTP Response Header 事件。会比请求完成事件更早*/
3981
4182
  onHeadersReceived(
3982
4183
  listener: (params: {
3983
4184
  /** 开发者服务器返回的 HTTP Response Header */
3984
- header: Record<string, string>
3985
- /** 网络请求id */
3986
- requestId: string
4185
+ header: any
3987
4186
  }) => void
3988
4187
  ): void
3989
4188
 
3990
4189
  /**
3991
- * 取消监听 HTTP Response Header 事件
3992
- */
4190
+ *@description 取消监听 HTTP Response Header 事件*/
3993
4191
  offHeadersReceived(
3994
4192
  listener: (params: {
3995
4193
  /** 开发者服务器返回的 HTTP Response Header */
3996
- header: Record<string, string>
3997
- /** 网络请求id */
3998
- requestId: string
4194
+ header: any
3999
4195
  }) => void
4000
4196
  ): void
4001
4197
  }
4198
+ /**
4199
+ *@description 发起 HTTPS 网络请求
4200
+ *@error {10003: 'network request error'}*/
4002
4201
  export function request(params: {
4003
4202
  /** 开发者服务器接口地址 */
4004
4203
  url: string
4005
4204
  /** 请求的参数 */
4006
4205
  data?: string
4007
4206
  /** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
4008
- header?: Record<string, string>
4207
+ header?: any
4009
4208
  /** 超时时间,单位为毫秒 */
4010
4209
  timeout?: number
4011
4210
  /** HTTP 请求方法 */
4012
4211
  method?: HTTPMethod
4013
- /** 返回的数据格式 */
4014
- dataType?: any
4212
+ /** 请求体里的数据类型(仅Android,且请求方式不为GET时生效) */
4213
+ dataType?: string
4015
4214
  /** 返回的数据类型 */
4016
4215
  responseType?: string
4017
4216
  /** enableHttp2 */
@@ -4020,14 +4219,13 @@ declare namespace ty {
4020
4219
  enableQuic?: boolean
4021
4220
  /** enableCache */
4022
4221
  enableCache?: boolean
4023
- complete?: () => void
4024
4222
  success?: (params: {
4025
4223
  /** 开发者服务器返回的数据 */
4026
4224
  data: string
4027
4225
  /** 开发者服务器返回的 HTTP 状态码 */
4028
4226
  statusCode: number
4029
4227
  /** 开发者服务器返回的 HTTP Response Header */
4030
- header: Record<string, string>
4228
+ header: any
4031
4229
  /** 开发者服务器返回的 cookies,格式为字符串数组 */
4032
4230
  cookies: string[]
4033
4231
  /** 网络请求过程中一些调试信息 */
@@ -4043,31 +4241,30 @@ declare namespace ty {
4043
4241
  errorMsg: string
4044
4242
  }
4045
4243
  }) => void
4244
+ complete?: () => void
4046
4245
  }): RequestTask
4047
4246
 
4048
4247
  /**
4049
- * 获取全局唯一的录音管理器
4050
- */
4051
- interface GetRecorderManagerTask {
4248
+ *@description 获取全局唯一的录音管理器*/
4249
+ interface RecorderManager {
4052
4250
  /**
4053
- * 开始录音
4054
- */
4251
+ *@description 开始录音
4252
+ *@error {7: 'API Internal processing failed'} | {9004: 'app no permission'}*/
4055
4253
  start(params: {
4056
4254
  /** 录音的时长,单位 ms,最大值 600000(10 分钟) */
4057
4255
  duration?: number
4058
4256
  /** 采样率 */
4059
- sampleRate?: number
4257
+ sampleRate?: AudioSampleRate
4060
4258
  /** 录音通道数 */
4061
- numberOfChannels?: number
4259
+ numberOfChannels?: AudioNumChannel
4062
4260
  /** 编码码率,有效值见下表格 */
4063
4261
  encodeBitRate?: number
4064
4262
  /** 音频格式 */
4065
- format?: string
4263
+ format?: AudioFormat
4066
4264
  /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
4067
4265
  frameSize: number
4068
4266
  /** 指定录音的音频输入源 */
4069
4267
  audioSource?: string
4070
- complete?: () => void
4071
4268
  success?: (params: {
4072
4269
  /** 录音文件的临时路径 (本地路径) */
4073
4270
  tempFilePath: string
@@ -4080,13 +4277,13 @@ declare namespace ty {
4080
4277
  errorMsg: string
4081
4278
  }
4082
4279
  }) => void
4280
+ complete?: () => void
4083
4281
  }): void
4084
4282
 
4085
4283
  /**
4086
- * 继续录音
4087
- */
4284
+ *@description 继续录音
4285
+ *@error {7: 'API Internal processing failed'}*/
4088
4286
  resume(params: {
4089
- complete?: () => void
4090
4287
  success?: (params: {
4091
4288
  /** 录音文件的临时路径 (本地路径) */
4092
4289
  tempFilePath: string
@@ -4099,13 +4296,13 @@ declare namespace ty {
4099
4296
  errorMsg: string
4100
4297
  }
4101
4298
  }) => void
4299
+ complete?: () => void
4102
4300
  }): void
4103
4301
 
4104
4302
  /**
4105
- * 暂停录音
4106
- */
4303
+ *@description 暂停录音
4304
+ *@error {7: 'API Internal processing failed'}*/
4107
4305
  pause(params: {
4108
- complete?: () => void
4109
4306
  success?: (params: {
4110
4307
  /** 录音文件的临时路径 (本地路径) */
4111
4308
  tempFilePath: string
@@ -4118,13 +4315,12 @@ declare namespace ty {
4118
4315
  errorMsg: string
4119
4316
  }
4120
4317
  }) => void
4318
+ complete?: () => void
4121
4319
  }): void
4122
4320
 
4123
4321
  /**
4124
- * 停止录音
4125
- */
4322
+ *@description 停止录音*/
4126
4323
  stop(params: {
4127
- complete?: () => void
4128
4324
  success?: (params: {
4129
4325
  /** 录音文件的临时路径 (本地路径) */
4130
4326
  tempFilePath: string
@@ -4137,11 +4333,12 @@ declare namespace ty {
4137
4333
  errorMsg: string
4138
4334
  }
4139
4335
  }) => void
4336
+ complete?: () => void
4140
4337
  }): void
4141
4338
 
4142
4339
  /**
4143
- * 开始持续录音
4144
- */
4340
+ *@description 开始持续录音
4341
+ *@error {6: 'The parameter format is incorrect'} | {9004: 'app no permission'}*/
4145
4342
  startRecording(params: {
4146
4343
  /** 间隔时间 ms */
4147
4344
  period: number
@@ -4151,7 +4348,6 @@ declare namespace ty {
4151
4348
  * default true
4152
4349
  */
4153
4350
  pcm16IOS?: boolean
4154
- complete?: () => void
4155
4351
  success?: (params: null) => void
4156
4352
  fail?: (params: {
4157
4353
  errorMsg: string
@@ -4161,13 +4357,13 @@ declare namespace ty {
4161
4357
  errorMsg: string
4162
4358
  }
4163
4359
  }) => void
4360
+ complete?: () => void
4164
4361
  }): void
4165
4362
 
4166
4363
  /**
4167
- * 停止持续录音
4168
- */
4364
+ *@description 停止持续录音
4365
+ *@error {6: 'The parameter format is incorrect'}*/
4169
4366
  stopRecording(params: {
4170
- complete?: () => void
4171
4367
  success?: (params: null) => void
4172
4368
  fail?: (params: {
4173
4369
  errorMsg: string
@@ -4177,10 +4373,12 @@ declare namespace ty {
4177
4373
  errorMsg: string
4178
4374
  }
4179
4375
  }) => void
4376
+ complete?: () => void
4180
4377
  }): void
4181
4378
  }
4379
+ /**
4380
+ *@description 获取全局唯一的录音管理器*/
4182
4381
  export function getRecorderManager(params?: {
4183
- complete?: () => void
4184
4382
  success?: (params: null) => void
4185
4383
  fail?: (params: {
4186
4384
  errorMsg: string
@@ -4190,17 +4388,16 @@ declare namespace ty {
4190
4388
  errorMsg: string
4191
4389
  }
4192
4390
  }) => void
4193
- }): GetRecorderManagerTask
4391
+ complete?: () => void
4392
+ }): RecorderManager
4194
4393
 
4195
4394
  /**
4196
- * 获取网络请求任务对象RequestTask
4197
- */
4198
- interface UploadFileTask {
4395
+ *@description 获取网络请求任务对象RequestTask*/
4396
+ interface UploadTask {
4199
4397
  /**
4200
- * 中断上传任务
4201
- */
4398
+ *@description 中断上传任务
4399
+ *@error {7: 'API Internal processing failed'}*/
4202
4400
  abort(params: {
4203
- complete?: () => void
4204
4401
  success?: (params: null) => void
4205
4402
  fail?: (params: {
4206
4403
  errorMsg: string
@@ -4210,35 +4407,32 @@ declare namespace ty {
4210
4407
  errorMsg: string
4211
4408
  }
4212
4409
  }) => void
4410
+ complete?: () => void
4213
4411
  }): void
4214
4412
 
4215
4413
  /**
4216
- * 监听 HTTP Response Header 事件。会比请求完成事件更早
4217
- */
4414
+ *@description 监听 HTTP Response Header 事件。会比请求完成事件更早
4415
+ *@error {7: 'API Internal processing failed'}*/
4218
4416
  onHeadersReceived(
4219
4417
  listener: (params: {
4220
4418
  /** 开发者服务器返回的 HTTP Response Header */
4221
- header: Record<string, string>
4222
- /** 网络请求id */
4223
- requestId: string
4419
+ header: any
4224
4420
  }) => void
4225
4421
  ): void
4226
4422
 
4227
4423
  /**
4228
- * 取消监听 HTTP Response Header 事件
4229
- */
4424
+ *@description 取消监听 HTTP Response Header 事件
4425
+ *@error {7: 'API Internal processing failed'}*/
4230
4426
  offHeadersReceived(
4231
4427
  listener: (params: {
4232
4428
  /** 开发者服务器返回的 HTTP Response Header */
4233
- header: Record<string, string>
4234
- /** 网络请求id */
4235
- requestId: string
4429
+ header: any
4236
4430
  }) => void
4237
4431
  ): void
4238
4432
 
4239
4433
  /**
4240
- * 监听上传进度变化事件
4241
- */
4434
+ *@description 监听上传进度变化事件
4435
+ *@error {7: 'API Internal processing failed'}*/
4242
4436
  onProgressUpdate(
4243
4437
  listener: (params: {
4244
4438
  /** 下载进度百分比 */
@@ -4247,14 +4441,12 @@ declare namespace ty {
4247
4441
  totalBytesSent: number
4248
4442
  /** 预期需要下载的数据总长度,单位 Bytes */
4249
4443
  totalBytesExpectedToSend: number
4250
- /** 网络请求id */
4251
- requestId: string
4252
4444
  }) => void
4253
4445
  ): void
4254
4446
 
4255
4447
  /**
4256
- * 取消监听上传进度变化事件
4257
- */
4448
+ *@description 取消监听上传进度变化事件
4449
+ *@error {7: 'API Internal processing failed'}*/
4258
4450
  offProgressUpdate(
4259
4451
  listener: (params: {
4260
4452
  /** 下载进度百分比 */
@@ -4263,11 +4455,12 @@ declare namespace ty {
4263
4455
  totalBytesSent: number
4264
4456
  /** 预期需要下载的数据总长度,单位 Bytes */
4265
4457
  totalBytesExpectedToSend: number
4266
- /** 网络请求id */
4267
- requestId: string
4268
4458
  }) => void
4269
4459
  ): void
4270
4460
  }
4461
+ /**
4462
+ *@description 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data
4463
+ *@error {6: 'The parameter format is incorrect'} | {10008: 'upload file error'}*/
4271
4464
  export function uploadFile(params: {
4272
4465
  /** 开发者服务器地址 */
4273
4466
  url: string
@@ -4276,12 +4469,11 @@ declare namespace ty {
4276
4469
  /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
4277
4470
  name: string
4278
4471
  /** HTTP 请求的 Header,Header 中不能设置 Referer */
4279
- header?: Record<string, string>
4472
+ header?: any
4280
4473
  /** HTTP 请求中其他额外的 form data */
4281
- formData?: Record<string, string>
4474
+ formData?: any
4282
4475
  /** 超时时间,单位为毫秒 */
4283
4476
  timeout?: number
4284
- complete?: () => void
4285
4477
  success?: (params: {
4286
4478
  /** 开发者服务器返回的数据 */
4287
4479
  data: string
@@ -4296,5 +4488,6 @@ declare namespace ty {
4296
4488
  errorMsg: string
4297
4489
  }
4298
4490
  }) => void
4299
- }): UploadFileTask
4491
+ complete?: () => void
4492
+ }): UploadTask
4300
4493
  }