• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit BasicServicesKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import { Callback } from './@ohos.base';
23import BaseContext from './application/BaseContext';
24
25/**
26 * upload and download
27 *
28 * @namespace request
29 * @since 6
30 */
31/**
32 * upload and download
33 *
34 * @namespace request
35 * @syscap SystemCapability.Request.FileTransferAgent
36 * @crossplatform
37 * @since 10
38 */
39/**
40 * upload and download
41 *
42 * @namespace request
43 * @syscap SystemCapability.Request.FileTransferAgent
44 * @crossplatform
45 * @atomicservice
46 * @since 11
47 */
48declare namespace request {
49  /**
50   * Error code 201 - the permissions check fails.
51   *
52   * @syscap SystemCapability.MiscServices.Download
53   * @since 9
54   */
55  /**
56   * Error code 201 - the permissions check fails.
57   *
58   * @syscap SystemCapability.MiscServices.Download
59   * @crossplatform
60   * @since 10
61   */
62  const EXCEPTION_PERMISSION: number;
63  /**
64   * Error code 401 - the parameters check fails.
65   *
66   * @syscap SystemCapability.MiscServices.Download
67   * @since 9
68   */
69  /**
70   * Error code 401 - the parameters check fails.
71   *
72   * @syscap SystemCapability.MiscServices.Download
73   * @crossplatform
74   * @since 10
75   */
76  const EXCEPTION_PARAMCHECK: number;
77  /**
78   * Error code 801 - call unsupported api.
79   *
80   * @syscap SystemCapability.MiscServices.Download
81   * @since 9
82   */
83  /**
84   * Error code 801 - call unsupported api.
85   *
86   * @syscap SystemCapability.MiscServices.Download
87   * @crossplatform
88   * @since 10
89   */
90  const EXCEPTION_UNSUPPORTED: number;
91  /**
92   * Error code 13400001 - file operation error.
93   *
94   * @syscap SystemCapability.MiscServices.Download
95   * @since 9
96   */
97  /**
98   * Error code 13400001 - file operation error.
99   *
100   * @syscap SystemCapability.MiscServices.Download
101   * @crossplatform
102   * @since 10
103   */
104  const EXCEPTION_FILEIO: number;
105  /**
106   * Error code 13400002 - bad file path.
107   *
108   * @syscap SystemCapability.MiscServices.Download
109   * @since 9
110   */
111  /**
112   * Error code 13400002 - bad file path.
113   *
114   * @syscap SystemCapability.MiscServices.Download
115   * @crossplatform
116   * @since 10
117   */
118  const EXCEPTION_FILEPATH: number;
119  /**
120   * Error code 13400003 - task service ability error.
121   *
122   * @syscap SystemCapability.MiscServices.Download
123   * @since 9
124   */
125  /**
126   * Error code 13400003 - task service ability error.
127   *
128   * @syscap SystemCapability.MiscServices.Download
129   * @crossplatform
130   * @since 10
131   */
132  const EXCEPTION_SERVICE: number;
133  /**
134   * Error code 13499999 - others error.
135   *
136   * @syscap SystemCapability.MiscServices.Download
137   * @since 9
138   */
139  /**
140   * Error code 13499999 - others error.
141   *
142   * @syscap SystemCapability.MiscServices.Download
143   * @crossplatform
144   * @since 10
145   */
146  const EXCEPTION_OTHERS: number;
147
148  /**
149   * Code 0x00000001 - Bit flag indicating download is allowed when using the cellular network.
150   *
151   * @syscap SystemCapability.MiscServices.Download
152   * @since 6
153   */
154  /**
155   * Code 0x00000001 - Bit flag indicating download is allowed when using the cellular network.
156   *
157   * @syscap SystemCapability.MiscServices.Download
158   * @crossplatform
159   * @since 10
160   */
161  const NETWORK_MOBILE: number;
162
163  /**
164   * Code 0x00010000 - Bit flag indicating download is allowed when using the WLAN.
165   *
166   * @syscap SystemCapability.MiscServices.Download
167   * @since 6
168   */
169  /**
170   * Code 0x00010000 - Bit flag indicating download is allowed when using the WLAN.
171   *
172   * @syscap SystemCapability.MiscServices.Download
173   * @crossplatform
174   * @since 10
175   */
176  const NETWORK_WIFI: number;
177
178  /**
179   * Error code 0 - Indicates that the download cannot be resumed for network reasons.
180   *
181   * @syscap SystemCapability.MiscServices.Download
182   * @since 7
183   */
184  /**
185   * Error code 0 - Indicates that the download cannot be resumed for network reasons.
186   *
187   * @syscap SystemCapability.MiscServices.Download
188   * @crossplatform
189   * @since 10
190   */
191  const ERROR_CANNOT_RESUME: number;
192
193  /**
194   * Error code 1 - Indicates that no storage device, such as an SD card, is found.
195   *
196   * @syscap SystemCapability.MiscServices.Download
197   * @since 7
198   */
199  /**
200   * Error code 1 - Indicates that no storage device, such as an SD card, is found.
201   *
202   * @syscap SystemCapability.MiscServices.Download
203   * @crossplatform
204   * @since 10
205   */
206  const ERROR_DEVICE_NOT_FOUND: number;
207
208  /**
209   * Error code 2 - Indicates that files to be downloaded already exist, and that the download session cannot overwrite the existing files.
210   *
211   * @syscap SystemCapability.MiscServices.Download
212   * @since 7
213   */
214  /**
215   * Error code 2 - Indicates that files to be downloaded already exist, and that the download session cannot overwrite the existing files.
216   *
217   * @syscap SystemCapability.MiscServices.Download
218   * @crossplatform
219   * @since 10
220   */
221  const ERROR_FILE_ALREADY_EXISTS: number;
222
223  /**
224   * Error code 3 - Indicates that a file operation fails.
225   *
226   * @syscap SystemCapability.MiscServices.Download
227   * @since 7
228   */
229  /**
230   * Error code 3 - Indicates that a file operation fails.
231   *
232   * @syscap SystemCapability.MiscServices.Download
233   * @crossplatform
234   * @since 10
235   */
236  const ERROR_FILE_ERROR: number;
237
238  /**
239   * Error code 4 - Indicates that the HTTP transmission fails.
240   *
241   * @syscap SystemCapability.MiscServices.Download
242   * @since 7
243   */
244  /**
245   * Error code 4 - Indicates that the HTTP transmission fails.
246   *
247   * @syscap SystemCapability.MiscServices.Download
248   * @crossplatform
249   * @since 10
250   */
251  const ERROR_HTTP_DATA_ERROR: number;
252
253  /**
254   * Error code 5 - Indicates insufficient storage space.
255   *
256   * @syscap SystemCapability.MiscServices.Download
257   * @since 7
258   */
259  /**
260   * Error code 5 - Indicates insufficient storage space.
261   *
262   * @syscap SystemCapability.MiscServices.Download
263   * @crossplatform
264   * @since 10
265   */
266  const ERROR_INSUFFICIENT_SPACE: number;
267
268  /**
269   * Error code 6 - Indicates an error caused by too many network redirections.
270   *
271   * @syscap SystemCapability.MiscServices.Download
272   * @since 7
273   */
274  /**
275   * Error code 6 - Indicates an error caused by too many network redirections.
276   *
277   * @syscap SystemCapability.MiscServices.Download
278   * @crossplatform
279   * @since 10
280   */
281  const ERROR_TOO_MANY_REDIRECTS: number;
282
283  /**
284   * Error code 7 - Indicates an HTTP code that cannot be identified.
285   *
286   * @syscap SystemCapability.MiscServices.Download
287   * @since 7
288   */
289  /**
290   * Error code 7 - Indicates an HTTP code that cannot be identified.
291   *
292   * @syscap SystemCapability.MiscServices.Download
293   * @crossplatform
294   * @since 10
295   */
296  const ERROR_UNHANDLED_HTTP_CODE: number;
297
298  /**
299   * Error code 8 - Indicates an undefined error.
300   *
301   * @syscap SystemCapability.MiscServices.Download
302   * @since 7
303   */
304  /**
305   * Error code 8 - Indicates an undefined error.
306   *
307   * @syscap SystemCapability.MiscServices.Download
308   * @crossplatform
309   * @since 10
310   */
311  const ERROR_UNKNOWN: number;
312
313  /**
314   * Error code 9 - Indicates network offline.
315   *
316   * @syscap SystemCapability.MiscServices.Download
317   * @since 9
318   */
319  /**
320   * Error code 9 - Indicates network offline.
321   *
322   * @syscap SystemCapability.MiscServices.Download
323   * @crossplatform
324   * @since 10
325   */
326  const ERROR_OFFLINE: number;
327
328  /**
329   * Error code 10 - Indicates network type configuration error.
330   *
331   * @syscap SystemCapability.MiscServices.Download
332   * @since 9
333   */
334  /**
335   * Error code 10 - Indicates network type configuration error.
336   *
337   * @syscap SystemCapability.MiscServices.Download
338   * @crossplatform
339   * @since 10
340   */
341  const ERROR_UNSUPPORTED_NETWORK_TYPE: number;
342
343  /**
344   * Paused code 0 - Indicates that the download is paused and waiting for a WLAN connection,
345   * because the file size exceeds the maximum allowed for a session using the cellular network.
346   *
347   * @syscap SystemCapability.MiscServices.Download
348   * @since 7
349   */
350  /**
351   * Paused code 0 - Indicates that the download is paused and waiting for a WLAN connection,
352   * because the file size exceeds the maximum allowed for a session using the cellular network.
353   *
354   * @syscap SystemCapability.MiscServices.Download
355   * @crossplatform
356   * @since 10
357   */
358  const PAUSED_QUEUED_FOR_WIFI: number;
359
360  /**
361   * Paused code 1 - Indicates that the download is paused due to a network problem, for example, network disconnection.
362   *
363   * @syscap SystemCapability.MiscServices.Download
364   * @since 7
365   */
366  /**
367   * Paused code 1 - Indicates that the download is paused due to a network problem, for example, network disconnection.
368   *
369   * @syscap SystemCapability.MiscServices.Download
370   * @crossplatform
371   * @since 10
372   */
373  const PAUSED_WAITING_FOR_NETWORK: number;
374
375  /**
376   * Paused code 2 - Indicates that a network error occurs, and the download session will be retried.
377   *
378   * @syscap SystemCapability.MiscServices.Download
379   * @since 7
380   */
381  /**
382   * Paused code 2 - Indicates that a network error occurs, and the download session will be retried.
383   *
384   * @syscap SystemCapability.MiscServices.Download
385   * @crossplatform
386   * @since 10
387   */
388  const PAUSED_WAITING_TO_RETRY: number;
389
390  /**
391   * Paused code 3 - Indicates that the download is paused due to the user.
392   *
393   * @syscap SystemCapability.MiscServices.Download
394   * @since 9
395   */
396  /**
397   * Paused code 3 - Indicates that the download is paused due to the user.
398   *
399   * @syscap SystemCapability.MiscServices.Download
400   * @crossplatform
401   * @since 10
402   */
403  const PAUSED_BY_USER: number;
404
405  /**
406   * Paused code 4 - Indicates that the download is paused for some reasons.
407   *
408   * @syscap SystemCapability.MiscServices.Download
409   * @since 7
410   */
411  /**
412   * Paused code 4 - Indicates that the download is paused for some reasons.
413   *
414   * @syscap SystemCapability.MiscServices.Download
415   * @crossplatform
416   * @since 10
417   */
418  const PAUSED_UNKNOWN: number;
419
420  /**
421   * Session status code 0 - Indicates that the download session is completed.
422   *
423   * @syscap SystemCapability.MiscServices.Download
424   * @since 7
425   */
426  /**
427   * Session status code 0 - Indicates that the download session is completed.
428   *
429   * @syscap SystemCapability.MiscServices.Download
430   * @crossplatform
431   * @since 10
432   */
433  const SESSION_SUCCESSFUL: number;
434
435  /**
436   * Session status code 1 - Indicates that the download session is in progress.
437   *
438   * @syscap SystemCapability.MiscServices.Download
439   * @since 7
440   */
441  /**
442   * Session status code 1 - Indicates that the download session is in progress.
443   *
444   * @syscap SystemCapability.MiscServices.Download
445   * @crossplatform
446   * @since 10
447   */
448  const SESSION_RUNNING: number;
449
450  /**
451   * Session status code 2 - Indicates that the download session is being scheduled.
452   *
453   * @syscap SystemCapability.MiscServices.Download
454   * @since 7
455   */
456  /**
457   * Session status code 2 - Indicates that the download session is being scheduled.
458   *
459   * @syscap SystemCapability.MiscServices.Download
460   * @crossplatform
461   * @since 10
462   */
463  const SESSION_PENDING: number;
464
465  /**
466   * Session status code 3 - Indicates that the download session has been paused.
467   *
468   * @syscap SystemCapability.MiscServices.Download
469   * @since 7
470   */
471  /**
472   * Session status code 3 - Indicates that the download session has been paused.
473   *
474   * @syscap SystemCapability.MiscServices.Download
475   * @crossplatform
476   * @since 10
477   */
478  const SESSION_PAUSED: number;
479
480  /**
481   * Session status code 4 - Indicates that the download session has failed and will not be retried.
482   *
483   * @syscap SystemCapability.MiscServices.Download
484   * @since 7
485   */
486  /**
487   * Session status code 4 - Indicates that the download session has failed and will not be retried.
488   *
489   * @syscap SystemCapability.MiscServices.Download
490   * @crossplatform
491   * @since 10
492   */
493  const SESSION_FAILED: number;
494
495  /**
496   * Starts a download task.
497   *
498   * @permission ohos.permission.INTERNET
499   * @param { DownloadConfig } config Download config
500   * @param { AsyncCallback<DownloadTask> } callback Indicate the callback function to receive DownloadTask.
501   * @throws { BusinessError } 201 - the permissions check fails
502   * @syscap SystemCapability.MiscServices.Download
503   * @FAModelOnly
504   * @since 6
505   * @deprecated since 9
506   * @useinstead ohos.request.downloadFile
507   */
508  function download(config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;
509
510  /**
511   * Starts a download task.
512   *
513   * @permission ohos.permission.INTERNET
514   * @param { BaseContext } context Indicates the application BaseContext.
515   * @param { DownloadConfig } config Download config
516   * @param { AsyncCallback<DownloadTask> } callback Indicate the callback function to receive DownloadTask.
517   * @throws { BusinessError } 201 - the permissions check fails
518   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
519   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
520   * @throws { BusinessError } 13400001 - file operation error
521   * @throws { BusinessError } 13400002 - bad file path
522   * @throws { BusinessError } 13400003 - task service ability error
523   * @syscap SystemCapability.MiscServices.Download
524   * @since 9
525   */
526  /**
527   * Starts a download task.
528   *
529   * @permission ohos.permission.INTERNET
530   * @param { BaseContext } context Indicates the application BaseContext.
531   * @param { DownloadConfig } config Download config
532   * @param { AsyncCallback<DownloadTask> } callback Indicate the callback function to receive DownloadTask.
533   * @throws { BusinessError } 201 - the permissions check fails
534   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
535   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
536   * @throws { BusinessError } 13400001 - file operation error
537   * @throws { BusinessError } 13400002 - bad file path
538   * @throws { BusinessError } 13400003 - task service ability error
539   * @syscap SystemCapability.MiscServices.Download
540   * @crossplatform
541   * @since 10
542   */
543  function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;
544
545  /**
546   * Starts a download task.
547   *
548   * @permission ohos.permission.INTERNET
549   * @param { DownloadConfig } config Download config
550   * @returns { Promise<DownloadTask> } the promise returned by the function.
551   * @throws { BusinessError } 201 - the permissions check fails
552   * @syscap SystemCapability.MiscServices.Download
553   * @FAModelOnly
554   * @since 6
555   * @deprecated since 9
556   * @useinstead ohos.request.downloadFile
557   */
558  function download(config: DownloadConfig): Promise<DownloadTask>;
559
560  /**
561   * Starts a download task.
562   *
563   * @permission ohos.permission.INTERNET
564   * @param { BaseContext } context Indicates the application BaseContext.
565   * @param { DownloadConfig } config Download config
566   * @returns { Promise<DownloadTask> } the promise returned by the function.
567   * @throws { BusinessError } 201 - the permissions check fails
568   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
569   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
570   * @throws { BusinessError } 13400001 - file operation error
571   * @throws { BusinessError } 13400002 - bad file path
572   * @throws { BusinessError } 13400003 - task service ability error
573   * @syscap SystemCapability.MiscServices.Download
574   * @since 9
575   */
576  /**
577   * Starts a download task.
578   *
579   * @permission ohos.permission.INTERNET
580   * @param { BaseContext } context Indicates the application BaseContext.
581   * @param { DownloadConfig } config Download config
582   * @returns { Promise<DownloadTask> } the promise returned by the function.
583   * @throws { BusinessError } 201 - the permissions check fails
584   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
585   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
586   * @throws { BusinessError } 13400001 - file operation error
587   * @throws { BusinessError } 13400002 - bad file path
588   * @throws { BusinessError } 13400003 - task service ability error
589   * @syscap SystemCapability.MiscServices.Download
590   * @crossplatform
591   * @since 10
592   */
593  function downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>;
594
595  /**
596   * Starts an upload task.
597   *
598   * @permission ohos.permission.INTERNET
599   * @param { UploadConfig } config Upload config
600   * @param { AsyncCallback<UploadTask> } callback Indicate the callback function to receive UploadTask.
601   * @throws { BusinessError } 201 - the permissions check fails
602   * @syscap SystemCapability.MiscServices.Upload
603   * @FAModelOnly
604   * @since 6
605   * @deprecated since 9
606   * @useinstead ohos.request.uploadFile
607   */
608  function upload(config: UploadConfig, callback: AsyncCallback<UploadTask>): void;
609
610  /**
611   * Starts an upload task.
612   *
613   * @permission ohos.permission.INTERNET
614   * @param { BaseContext } context Indicates the application BaseContext.
615   * @param { UploadConfig } config Upload config
616   * @param { AsyncCallback<UploadTask> } callback Indicate the callback function to receive UploadTask.
617   * @throws { BusinessError } 201 - the permissions check fails
618   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
619   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
620   * @throws { BusinessError } 13400002 - bad file path
621   * @syscap SystemCapability.MiscServices.Upload
622   * @since 9
623   */
624  /**
625   * Starts an upload task.
626   *
627   * @permission ohos.permission.INTERNET
628   * @param { BaseContext } context Indicates the application BaseContext.
629   * @param { UploadConfig } config Upload config
630   * @param { AsyncCallback<UploadTask> } callback Indicate the callback function to receive UploadTask.
631   * @throws { BusinessError } 201 - the permissions check fails
632   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
633   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
634   * @throws { BusinessError } 13400002 - bad file path
635   * @syscap SystemCapability.MiscServices.Upload
636   * @crossplatform
637   * @since 10
638   */
639  function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void;
640
641  /**
642   * Starts an upload task.
643   *
644   * @permission ohos.permission.INTERNET
645   * @param { UploadConfig } config Upload config
646   * @returns { Promise<UploadTask> } the promise returned by the function.
647   * @throws { BusinessError } 201 - the permissions check fails
648   * @syscap SystemCapability.MiscServices.Upload
649   * @FAModelOnly
650   * @since 6
651   * @deprecated since 9
652   * @useinstead ohos.request.uploadFile
653   */
654  function upload(config: UploadConfig): Promise<UploadTask>;
655
656  /**
657   * Starts an upload task.
658   *
659   * @permission ohos.permission.INTERNET
660   * @param { BaseContext } context Indicates the application BaseContext.
661   * @param { UploadConfig } config Upload config
662   * @returns { Promise<UploadTask> } the promise returned by the function.
663   * @throws { BusinessError } 201 - the permissions check fails
664   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
665   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
666   * @throws { BusinessError } 13400002 - bad file path
667   * @syscap SystemCapability.MiscServices.Upload
668   * @since 9
669   */
670  /**
671   * Starts an upload task.
672   *
673   * @permission ohos.permission.INTERNET
674   * @param { BaseContext } context Indicates the application BaseContext.
675   * @param { UploadConfig } config Upload config
676   * @returns { Promise<UploadTask> } the promise returned by the function.
677   * @throws { BusinessError } 201 - the permissions check fails
678   * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
679   * <br>2. Incorrect parameter type. 3. Parameter verification failed.
680   * @throws { BusinessError } 13400002 - bad file path
681   * @syscap SystemCapability.MiscServices.Upload
682   * @crossplatform
683   * @since 10
684   */
685  function uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask>;
686
687  /**
688   * DownloadConfig data Structure
689   *
690   * @interface DownloadConfig
691   * @syscap SystemCapability.MiscServices.Download
692   * @since 6
693   * @name DownloadConfig
694   */
695  /**
696   * DownloadConfig data Structure
697   *
698   * @typedef DownloadConfig
699   * @syscap SystemCapability.MiscServices.Download
700   * @crossplatform
701   * @since 10
702   * @name DownloadConfig
703   */
704  interface DownloadConfig {
705    /**
706     * Resource address.
707     * Verification rule: Starting with http (s)://and with a length not exceeding 2048 characters.
708     *
709     * @syscap SystemCapability.MiscServices.Download
710     * @since 6
711     */
712    /**
713     * Resource address.
714     * Verification rule: Starting with http (s)://and with a length not exceeding 2048 characters.
715     *
716     * @type { string }
717     * @syscap SystemCapability.MiscServices.Download
718     * @crossplatform
719     * @since 10
720     */
721    url: string;
722    /**
723     * Adds an HTTP or HTTPS header to be included with the download request.
724     *
725     * @syscap SystemCapability.MiscServices.Download
726     * @since 6
727     */
728    /**
729     * Adds an HTTP or HTTPS header to be included with the download request.
730     *
731     * @type { ?Object }
732     * @syscap SystemCapability.MiscServices.Download
733     * @crossplatform
734     * @since 10
735     */
736    header?: Object;
737    /**
738     * Allows download under a metered connection.
739     *
740     * @syscap SystemCapability.MiscServices.Download
741     * @since 6
742     */
743    /**
744     * Allows download under a metered connection.
745     *
746     * @type { ?boolean }
747     * @syscap SystemCapability.MiscServices.Download
748     * @crossplatform
749     * @since 10
750     */
751    enableMetered?: boolean;
752    /**
753     * Allows download in a roaming network.
754     *
755     * @syscap SystemCapability.MiscServices.Download
756     * @since 6
757     */
758    /**
759     * Allows download in a roaming network.
760     *
761     * @type { ?boolean }
762     * @syscap SystemCapability.MiscServices.Download
763     * @crossplatform
764     * @since 10
765     */
766    enableRoaming?: boolean;
767    /**
768     * Sets the description of a download session.
769     *
770     * @syscap SystemCapability.MiscServices.Download
771     * @since 6
772     */
773    /**
774     * Sets the description of a download session.
775     *
776     * @type { ?string }
777     * @syscap SystemCapability.MiscServices.Download
778     * @crossplatform
779     * @since 10
780     */
781    description?: string;
782    /**
783     * Sets the network type allowed for download.
784     *
785     * @syscap SystemCapability.MiscServices.Download
786     * @since 6
787     */
788    /**
789     * Sets the network type allowed for download.
790     *
791     * @type { ?number }
792     * @syscap SystemCapability.MiscServices.Download
793     * @crossplatform
794     * @since 10
795     */
796    networkType?: number;
797    /**
798     * Sets the path for downloads.
799     *
800     * @syscap SystemCapability.MiscServices.Download
801     * @since 7
802     */
803    /**
804     * Sets the path for downloads.
805     *
806     * @type { ?string }
807     * @syscap SystemCapability.MiscServices.Download
808     * @crossplatform
809     * @since 10
810     */
811    filePath?: string;
812    /**
813     * Sets a download session title.
814     *
815     * @syscap SystemCapability.MiscServices.Download
816     * @since 6
817     */
818    /**
819     * Sets a download session title.
820     *
821     * @type { ?string }
822     * @syscap SystemCapability.MiscServices.Download
823     * @crossplatform
824     * @since 10
825     */
826    title?: string;
827    /**
828     * Allow download background task notifications.
829     *
830     * @syscap SystemCapability.MiscServices.Download
831     * @since 9
832     */
833    /**
834     * Allow download background task notifications.
835     *
836     * @type { ?boolean }
837     * @syscap SystemCapability.MiscServices.Download
838     * @crossplatform
839     * @since 10
840     */
841    background?: boolean;
842  }
843
844  /**
845   * DownloadInfo data Structure
846   *
847   * @interface DownloadInfo
848   * @syscap SystemCapability.MiscServices.Download
849   * @since 7
850   * @name DownloadInfo
851   */
852  /**
853   * DownloadInfo data Structure
854   *
855   * @typedef DownloadInfo
856   * @syscap SystemCapability.MiscServices.Download
857   * @crossplatform
858   * @since 10
859   */
860  interface DownloadInfo {
861    /**
862     * the description of a file to be downloaded.
863     *
864     * @syscap SystemCapability.MiscServices.Download
865     * @since 7
866     */
867    /**
868     * the description of a file to be downloaded.
869     *
870     * @type { string }
871     * @syscap SystemCapability.MiscServices.Download
872     * @crossplatform
873     * @since 10
874     */
875    description: string;
876    /**
877     * the real-time downloads size (in bytes).
878     *
879     * @syscap SystemCapability.MiscServices.Download
880     * @since 7
881     */
882    /**
883     * the real-time downloads size (in bytes).
884     *
885     * @type { number }
886     * @syscap SystemCapability.MiscServices.Download
887     * @crossplatform
888     * @since 10
889     */
890    downloadedBytes: number;
891    /**
892     * the ID of a file to be downloaded.
893     *
894     * @syscap SystemCapability.MiscServices.Download
895     * @since 7
896     */
897    /**
898     * the ID of a file to be downloaded.
899     *
900     * @type { number }
901     * @syscap SystemCapability.MiscServices.Download
902     * @crossplatform
903     * @since 10
904     */
905    downloadId: number;
906    /**
907     * a download failure cause, which can be any DownloadSession.ERROR_* constant.
908     *
909     * @syscap SystemCapability.MiscServices.Download
910     * @since 7
911     */
912    /**
913     * a download failure cause, which can be any DownloadSession.ERROR_* constant.
914     *
915     * @type { number }
916     * @syscap SystemCapability.MiscServices.Download
917     * @crossplatform
918     * @since 10
919     */
920    failedReason: number;
921    /**
922     * the name of a file to be downloaded.
923     *
924     * @syscap SystemCapability.MiscServices.Download
925     * @since 7
926     */
927    /**
928     * the name of a file to be downloaded.
929     *
930     * @type { string }
931     * @syscap SystemCapability.MiscServices.Download
932     * @crossplatform
933     * @since 10
934     */
935    fileName: string;
936    /**
937     * the URI of a stored file.
938     *
939     * @syscap SystemCapability.MiscServices.Download
940     * @since 7
941     */
942    /**
943     * the URI of a stored file.
944     *
945     * @type { string }
946     * @syscap SystemCapability.MiscServices.Download
947     * @crossplatform
948     * @since 10
949     */
950    filePath: string;
951    /**
952     * the reason why a session is paused, which can be any DownloadSession.PAUSED_* constant.
953     *
954     * @syscap SystemCapability.MiscServices.Download
955     * @since 7
956     */
957    /**
958     * the reason why a session is paused, which can be any DownloadSession.PAUSED_* constant.
959     *
960     * @type { number }
961     * @syscap SystemCapability.MiscServices.Download
962     * @crossplatform
963     * @since 10
964     */
965    pausedReason: number;
966    /**
967     * the download status code, which can be any DownloadSession.SESSION_* constant.
968     *
969     * @syscap SystemCapability.MiscServices.Download
970     * @since 7
971     */
972    /**
973     * the download status code, which can be any DownloadSession.SESSION_* constant.
974     *
975     * @type { number }
976     * @syscap SystemCapability.MiscServices.Download
977     * @crossplatform
978     * @since 10
979     */
980    status: number;
981    /**
982     * the URI of files to be downloaded.
983     *
984     * @syscap SystemCapability.MiscServices.Download
985     * @since 7
986     */
987    /**
988     * the URI of files to be downloaded.
989     *
990     * @type { string }
991     * @syscap SystemCapability.MiscServices.Download
992     * @crossplatform
993     * @since 10
994     */
995    targetURI: string;
996    /**
997     * the title of a file to be downloaded.
998     *
999     * @syscap SystemCapability.MiscServices.Download
1000     * @since 7
1001     */
1002    /**
1003     * the title of a file to be downloaded.
1004     *
1005     * @type { string }
1006     * @syscap SystemCapability.MiscServices.Download
1007     * @crossplatform
1008     * @since 10
1009     */
1010    downloadTitle: string;
1011    /**
1012     * the total size of files to be downloaded (in bytes).
1013     *
1014     * @syscap SystemCapability.MiscServices.Download
1015     * @since 7
1016     */
1017    /**
1018     * the total size of files to be downloaded (in bytes).
1019     *
1020     * @type { number }
1021     * @syscap SystemCapability.MiscServices.Download
1022     * @crossplatform
1023     * @since 10
1024     */
1025    downloadTotalBytes: number;
1026  }
1027
1028  /**
1029   * Download task interface
1030   *
1031   * @interface DownloadTask
1032   * @syscap SystemCapability.MiscServices.Download
1033   * @since 6
1034   */
1035  /**
1036   * Download task interface
1037   *
1038   * @typedef DownloadTask
1039   * @syscap SystemCapability.MiscServices.Download
1040   * @crossplatform
1041   * @since 10
1042   */
1043  interface DownloadTask {
1044    /**
1045     * Called when the current download session is in process.
1046     *
1047     * @param { 'progress' } type progress Indicates the download task progress.
1048     * @param { function } callback
1049     *        The callback function for the download progress change event
1050     *        receivedSize the length of downloaded data, in bytes
1051     *        totalSize the length of data expected to be downloaded, in bytes.
1052     * @syscap SystemCapability.MiscServices.Download
1053     * @since 6
1054     */
1055    /**
1056     * Called when the current download session is in process.
1057     *
1058     * @param { 'progress' } type progress Indicates the download task progress.
1059     * @param { function } callback
1060     *        The callback function for the download progress change event
1061     *        receivedSize the length of downloaded data, in bytes
1062     *        totalSize the length of data expected to be downloaded, in bytes.
1063     * @syscap SystemCapability.MiscServices.Download
1064     * @crossplatform
1065     * @since 10
1066     */
1067    /**
1068     * Called when the current download session is in process.
1069     *
1070     * @param { 'progress' } type progress Indicates the download task progress.
1071     * @param { function } callback
1072     * <br>The callback function for the download progress change event
1073     * <br>receivedSize the length of downloaded data, in bytes
1074     * <br>totalSize the length of data expected to be downloaded, in bytes.
1075     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
1076     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
1077     * @syscap SystemCapability.MiscServices.Download
1078     * @crossplatform
1079     * @since 12
1080     */
1081    on(type: 'progress', callback: (receivedSize: number, totalSize: number) => void): void;
1082
1083    /**
1084     * Called when the current download session is in process.
1085     *
1086     * @param { 'progress' } type progress Indicates the download task progress.
1087     * @param { function } [callback]
1088     *        The callback function for the download progress change event
1089     *        receivedSize the length of downloaded data, in bytes
1090     *        totalSize the length of data expected to be downloaded, in bytes.
1091     * @syscap SystemCapability.MiscServices.Download
1092     * @since 6
1093     */
1094    /**
1095     * Called when the current download session is in process.
1096     *
1097     * @param { 'progress' } type progress Indicates the download task progress.
1098     * @param { function } [callback]
1099     *        The callback function for the download progress change event
1100     *        receivedSize the length of downloaded data, in bytes
1101     *        totalSize the length of data expected to be downloaded, in bytes.
1102     * @syscap SystemCapability.MiscServices.Download
1103     * @crossplatform
1104     * @since 10
1105     */
1106    /**
1107     * Called when the current download session is in process.
1108     *
1109     * @param { 'progress' } type progress Indicates the download task progress.
1110     * @param { function } [callback]
1111     * <br>The callback function for the download progress change event
1112     * <br>receivedSize the length of downloaded data, in bytes
1113     * <br>totalSize the length of data expected to be downloaded, in bytes.
1114     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
1115     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
1116     * @syscap SystemCapability.MiscServices.Download
1117     * @crossplatform
1118     * @since 12
1119     */
1120    off(type: 'progress', callback?: (receivedSize: number, totalSize: number) => void): void;
1121
1122    /**
1123     * Called when the current download session complete pause or remove.
1124     *
1125     * @param { 'complete' | 'pause' | 'remove' } type Indicates the download session event type
1126     *        complete: download task completed,
1127     *        pause: download task stopped,
1128     *        remove: download task deleted.
1129     * @param { function } callback The callback function for the download complete pause or remove change event.
1130     * @syscap SystemCapability.MiscServices.Download
1131     * @since 7
1132     */
1133    /**
1134     * Called when the current download session complete pause or remove.
1135     *
1136     * @param { 'complete' | 'pause' | 'remove' } type Indicates the download session event type
1137     *        complete: download task completed,
1138     *        pause: download task stopped,
1139     *        remove: download task deleted.
1140     * @param { function } callback The callback function for the download complete pause or remove change event.
1141     * @syscap SystemCapability.MiscServices.Download
1142     * @crossplatform
1143     * @since 10
1144     */
1145    /**
1146     * Called when the current download session complete pause or remove.
1147     *
1148     * @param { 'complete' | 'pause' | 'remove' } type Indicates the download session event type
1149     * <br>complete: download task completed,
1150     * <br>pause: download task stopped,
1151     * <br>remove: download task deleted.
1152     * @param { function } callback The callback function for the download complete pause or remove change event.
1153     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
1154     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
1155     * @syscap SystemCapability.MiscServices.Download
1156     * @crossplatform
1157     * @since 12
1158     */
1159    on(type: 'complete' | 'pause' | 'remove', callback: () => void): void;
1160
1161    /**
1162     * Called when the current download session complete pause or remove.
1163     *
1164     * @param { 'complete' | 'pause' | 'remove' } type Indicates the download session event type
1165     *        complete: download task completed,
1166     *        pause: download task stopped,
1167     *        remove: download task deleted.
1168     * @param { function } [callback] The callback function for the download complete pause or remove change event.
1169     * @syscap SystemCapability.MiscServices.Download
1170     * @since 7
1171     */
1172    /**
1173     * Called when the current download session complete pause or remove.
1174     *
1175     * @param { 'complete' | 'pause' | 'remove' } type Indicates the download session event type
1176     *        complete: download task completed,
1177     *        pause: download task stopped,
1178     *        remove: download task deleted.
1179     * @param { function } [callback] The callback function for the download complete pause or remove change event.
1180     * @syscap SystemCapability.MiscServices.Download
1181     * @crossplatform
1182     * @since 10
1183     */
1184    /**
1185     * Called when the current download session complete pause or remove.
1186     *
1187     * @param { 'complete' | 'pause' | 'remove' } type Indicates the download session event type
1188     * <br>complete: download task completed,
1189     * <br>pause: download task stopped,
1190     * <br>remove: download task deleted.
1191     * @param { function } [callback] The callback function for the download complete pause or remove change event.
1192     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
1193     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
1194     * @syscap SystemCapability.MiscServices.Download
1195     * @crossplatform
1196     * @since 12
1197     */
1198    off(type: 'complete' | 'pause' | 'remove', callback?: () => void): void;
1199
1200    /**
1201     * Called when the current download session fails.
1202     *
1203     * @param { 'fail' } type Indicates the download session type, fail: download task has failed.
1204     * @param { function } callback The callback function for the download fail change event
1205     *        err The error code for download task.
1206     * @syscap SystemCapability.MiscServices.Download
1207     * @since 7
1208     */
1209    /**
1210     * Called when the current download session fails.
1211     *
1212     * @param { 'fail' } type Indicates the download session type, fail: download task has failed.
1213     * @param { function } callback The callback function for the download fail change event
1214     *        err The error code for download task.
1215     * @syscap SystemCapability.MiscServices.Download
1216     * @crossplatform
1217     * @since 10
1218     */
1219    /**
1220     * Called when the current download session fails.
1221     *
1222     * @param { 'fail' } type Indicates the download session type, fail: download task has failed.
1223     * @param { function } callback The callback function for the download fail change event
1224     * <br>err The error code for download task.
1225     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
1226     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
1227     * @syscap SystemCapability.MiscServices.Download
1228     * @crossplatform
1229     * @since 12
1230     */
1231    on(type: 'fail', callback: (err: number) => void): void;
1232
1233    /**
1234     * Called when the current download session fails.
1235     *
1236     * @param { 'fail' } type Indicates the download session type, fail: download task has failed.
1237     * @param { function } [callback] Indicate the callback function to receive err.
1238     *        err The error code for download task.
1239     * @syscap SystemCapability.MiscServices.Download
1240     * @since 7
1241     */
1242    /**
1243     * Called when the current download session fails.
1244     *
1245     * @param { 'fail' } type Indicates the download session type, fail: download task has failed.
1246     * @param { function } [callback] Indicate the callback function to receive err.
1247     *        err The error code for download task.
1248     * @syscap SystemCapability.MiscServices.Download
1249     * @crossplatform
1250     * @since 10
1251     */
1252    /**
1253     * Called when the current download session fails.
1254     *
1255     * @param { 'fail' } type Indicates the download session type, fail: download task has failed.
1256     * @param { function } [callback] Indicate the callback function to receive err.
1257     * <br>err The error code for download task.
1258     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
1259     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
1260     * @syscap SystemCapability.MiscServices.Download
1261     * @crossplatform
1262     * @since 12
1263     */
1264    off(type: 'fail', callback?: (err: number) => void): void;
1265
1266    /**
1267     * Deletes a download session and the downloaded files.
1268     *
1269     * @permission ohos.permission.INTERNET
1270     * @param { AsyncCallback<boolean> } callback Indicates asynchronous invoking Result.
1271     * @throws { BusinessError } 201 - the permissions check fails
1272     * @syscap SystemCapability.MiscServices.Download
1273     * @since 6
1274     * @deprecated since 9
1275     * @useinstead ohos.request.delete
1276     */
1277    remove(callback: AsyncCallback<boolean>): void;
1278
1279    /**
1280     * Deletes a download session and the downloaded files.
1281     *
1282     * @permission ohos.permission.INTERNET
1283     * @returns { Promise<boolean> } the promise returned by the function.
1284     * @throws { BusinessError } 201 - the permissions check fails
1285     * @syscap SystemCapability.MiscServices.Download
1286     * @since 6
1287     * @deprecated since 9
1288     * @useinstead ohos.request.delete
1289     */
1290    remove(): Promise<boolean>;
1291
1292    /**
1293     * Pause a download session.
1294     *
1295     * @permission ohos.permission.INTERNET
1296     * @param { AsyncCallback<void> } callback Indicates asynchronous invoking Result.
1297     * @throws { BusinessError } 201 - the permissions check fails
1298     * @syscap SystemCapability.MiscServices.Download
1299     * @since 7
1300     * @deprecated since 9
1301     * @useinstead ohos.request.suspend
1302     */
1303    pause(callback: AsyncCallback<void>): void;
1304
1305    /**
1306     * Pause a download session.
1307     *
1308     * @permission ohos.permission.INTERNET
1309     * @returns { Promise<void> } the promise returned by the function.
1310     * @throws { BusinessError } 201 - the permissions check fails
1311     * @syscap SystemCapability.MiscServices.Download
1312     * @since 7
1313     * @deprecated since 9
1314     * @useinstead ohos.request.suspend
1315     */
1316    pause(): Promise<void>;
1317
1318    /**
1319     * Resume a paused download session.
1320     *
1321     * @permission ohos.permission.INTERNET
1322     * @param { AsyncCallback<void> } callback Indicates asynchronous invoking Result.
1323     * @throws { BusinessError } 201 - the permissions check fails
1324     * @syscap SystemCapability.MiscServices.Download
1325     * @since 7
1326     * @deprecated since 9
1327     * @useinstead ohos.request.restore
1328     */
1329    resume(callback: AsyncCallback<void>): void;
1330
1331    /**
1332     * Resume a paused download session.
1333     *
1334     * @permission ohos.permission.INTERNET
1335     * @returns { Promise<void> } the promise returned by the function.
1336     * @throws { BusinessError } 201 - the permissions check fails
1337     * @syscap SystemCapability.MiscServices.Download
1338     * @since 7
1339     * @deprecated since 9
1340     * @useinstead ohos.request.restore
1341     */
1342    resume(): Promise<void>;
1343
1344    /**
1345     * Queries download information of a session, which is defined in DownloadSession.DownloadInfo.
1346     *
1347     * @permission ohos.permission.INTERNET
1348     * @param { AsyncCallback<DownloadInfo> } callback Indicate the callback function to receive download info.
1349     * @throws { BusinessError } 201 - the permissions check fails
1350     * @syscap SystemCapability.MiscServices.Download
1351     * @since 7
1352     * @deprecated since 9
1353     * @useinstead ohos.request.getTaskInfo
1354     */
1355    query(callback: AsyncCallback<DownloadInfo>): void;
1356
1357    /**
1358     * Queries download information of a session, which is defined in DownloadSession.DownloadInfo.
1359     *
1360     * @permission ohos.permission.INTERNET
1361     * @returns { Promise<DownloadInfo> } the promise returned by the function.
1362     * @throws { BusinessError } 201 - the permissions check fails
1363     * @syscap SystemCapability.MiscServices.Download
1364     * @since 7
1365     * @deprecated since 9
1366     * @useinstead ohos.request.getTaskInfo
1367     */
1368    query(): Promise<DownloadInfo>;
1369
1370    /**
1371     * Queries the MIME type of the download file.
1372     *
1373     * @permission ohos.permission.INTERNET
1374     * @param { AsyncCallback<string> } callback Indicate the callback function to receive download file MIME type.
1375     * @throws { BusinessError } 201 - the permissions check fails
1376     * @syscap SystemCapability.MiscServices.Download
1377     * @since 7
1378     * @deprecated since 9
1379     * @useinstead ohos.request.getTaskMimeType
1380     */
1381    queryMimeType(callback: AsyncCallback<string>): void;
1382
1383    /**
1384     * Queries the MIME type of the download file.
1385     *
1386     * @permission ohos.permission.INTERNET
1387     * @returns { Promise<string> } the promise returned by the function.
1388     * @throws { BusinessError } 201 - the permissions check fails
1389     * @syscap SystemCapability.MiscServices.Download
1390     * @since 7
1391     * @deprecated since 9
1392     * @useinstead ohos.request.getTaskMimeType
1393     */
1394    queryMimeType(): Promise<string>;
1395
1396    /**
1397     * Delete the download task
1398     *
1399     * @permission ohos.permission.INTERNET
1400     * @param { AsyncCallback<boolean> } callback
1401     * @throws { BusinessError } 201 - the permissions check fails
1402     * @throws { BusinessError } 401 - the parameters check fails
1403     * @syscap SystemCapability.MiscServices.Download
1404     * @since 9
1405     */
1406    /**
1407     * Delete the download task
1408     *
1409     * @permission ohos.permission.INTERNET
1410     * @param { AsyncCallback<boolean> } callback
1411     * @throws { BusinessError } 201 - the permissions check fails
1412     * @throws { BusinessError } 401 - the parameters check fails
1413     * @syscap SystemCapability.MiscServices.Download
1414     * @crossplatform
1415     * @since 10
1416     */
1417    /**
1418     * Delete the download task
1419     *
1420     * @permission ohos.permission.INTERNET
1421     * @param { AsyncCallback<boolean> } callback
1422     * @throws { BusinessError } 201 - the permissions check fails
1423     * @syscap SystemCapability.MiscServices.Download
1424     * @crossplatform
1425     * @since 12
1426     */
1427    delete(callback: AsyncCallback<boolean>): void;
1428
1429    /**
1430     * Delete the download task
1431     *
1432     * @permission ohos.permission.INTERNET
1433     * @returns { Promise<boolean> } the promise returned by the function.
1434     * @throws { BusinessError } 201 - the permissions check fails
1435     * @throws { BusinessError } 401 - the parameters check fails
1436     * @syscap SystemCapability.MiscServices.Download
1437     * @since 9
1438     */
1439    /**
1440     * Delete the download task
1441     *
1442     * @permission ohos.permission.INTERNET
1443     * @returns { Promise<boolean> } the promise returned by the function.
1444     * @throws { BusinessError } 201 - the permissions check fails
1445     * @throws { BusinessError } 401 - the parameters check fails
1446     * @syscap SystemCapability.MiscServices.Download
1447     * @crossplatform
1448     * @since 10
1449     */
1450    /**
1451     * Delete the download task
1452     *
1453     * @permission ohos.permission.INTERNET
1454     * @returns { Promise<boolean> } the promise returned by the function.
1455     * @throws { BusinessError } 201 - the permissions check fails
1456     * @syscap SystemCapability.MiscServices.Download
1457     * @crossplatform
1458     * @since 12
1459     */
1460    delete(): Promise<boolean>;
1461
1462    /**
1463     * Suspend the download task
1464     *
1465     * @permission ohos.permission.INTERNET
1466     * @param { AsyncCallback<boolean> } callback
1467     * @throws { BusinessError } 201 - the permissions check fails
1468     * @throws { BusinessError } 401 - the parameters check fails
1469     * @syscap SystemCapability.MiscServices.Download
1470     * @since 9
1471     */
1472    /**
1473     * Suspend the download task
1474     *
1475     * @permission ohos.permission.INTERNET
1476     * @param { AsyncCallback<boolean> } callback
1477     * @throws { BusinessError } 201 - the permissions check fails
1478     * @throws { BusinessError } 401 - the parameters check fails
1479     * @syscap SystemCapability.MiscServices.Download
1480     * @crossplatform
1481     * @since 10
1482     */
1483    /**
1484     * Suspend the download task
1485     *
1486     * @permission ohos.permission.INTERNET
1487     * @param { AsyncCallback<boolean> } callback
1488     * @throws { BusinessError } 201 - the permissions check fails
1489     * @syscap SystemCapability.MiscServices.Download
1490     * @crossplatform
1491     * @since 12
1492     */
1493    suspend(callback: AsyncCallback<boolean>): void;
1494
1495    /**
1496     * Suspend the download task
1497     *
1498     * @permission ohos.permission.INTERNET
1499     * @returns { Promise<boolean> } the promise returned by the function.
1500     * @throws { BusinessError } 201 - the permissions check fails
1501     * @throws { BusinessError } 401 - the parameters check fails
1502     * @syscap SystemCapability.MiscServices.Download
1503     * @since 9
1504     */
1505    /**
1506     * Suspend the download task
1507     *
1508     * @permission ohos.permission.INTERNET
1509     * @returns { Promise<boolean> } the promise returned by the function.
1510     * @throws { BusinessError } 201 - the permissions check fails
1511     * @throws { BusinessError } 401 - the parameters check fails
1512     * @syscap SystemCapability.MiscServices.Download
1513     * @crossplatform
1514     * @since 10
1515     */
1516    /**
1517     * Suspend the download task
1518     *
1519     * @permission ohos.permission.INTERNET
1520     * @returns { Promise<boolean> } the promise returned by the function.
1521     * @throws { BusinessError } 201 - the permissions check fails
1522     * @syscap SystemCapability.MiscServices.Download
1523     * @crossplatform
1524     * @since 12
1525     */
1526    suspend(): Promise<boolean>;
1527
1528    /**
1529     * Restore the download task
1530     *
1531     * @permission ohos.permission.INTERNET
1532     * @param { AsyncCallback<boolean> } callback
1533     * @throws { BusinessError } 201 - the permissions check fails
1534     * @throws { BusinessError } 401 - the parameters check fails
1535     * @syscap SystemCapability.MiscServices.Download
1536     * @since 9
1537     */
1538    /**
1539     * Restore the download task
1540     *
1541     * @permission ohos.permission.INTERNET
1542     * @param { AsyncCallback<boolean> } callback
1543     * @throws { BusinessError } 201 - the permissions check fails
1544     * @throws { BusinessError } 401 - the parameters check fails
1545     * @syscap SystemCapability.MiscServices.Download
1546     * @crossplatform
1547     * @since 10
1548     */
1549    /**
1550     * Restore the download task
1551     *
1552     * @permission ohos.permission.INTERNET
1553     * @param { AsyncCallback<boolean> } callback
1554     * @throws { BusinessError } 201 - the permissions check fails
1555     * @syscap SystemCapability.MiscServices.Download
1556     * @crossplatform
1557     * @since 12
1558     */
1559    restore(callback: AsyncCallback<boolean>): void;
1560
1561    /**
1562     * Restore the download task
1563     *
1564     * @permission ohos.permission.INTERNET
1565     * @returns { Promise<boolean> } the promise returned by the function.
1566     * @throws { BusinessError } 201 - the permissions check fails
1567     * @throws { BusinessError } 401 - the parameters check fails
1568     * @syscap SystemCapability.MiscServices.Download
1569     * @since 9
1570     */
1571    /**
1572     * Restore the download task
1573     *
1574     * @permission ohos.permission.INTERNET
1575     * @returns { Promise<boolean> } the promise returned by the function.
1576     * @throws { BusinessError } 201 - the permissions check fails
1577     * @throws { BusinessError } 401 - the parameters check fails
1578     * @syscap SystemCapability.MiscServices.Download
1579     * @crossplatform
1580     * @since 10
1581     */
1582    /**
1583     * Restore the download task
1584     *
1585     * @permission ohos.permission.INTERNET
1586     * @returns { Promise<boolean> } the promise returned by the function.
1587     * @throws { BusinessError } 201 - the permissions check fails
1588     * @syscap SystemCapability.MiscServices.Download
1589     * @crossplatform
1590     * @since 12
1591     */
1592    restore(): Promise<boolean>;
1593
1594    /**
1595     * Get the download task info
1596     *
1597     * @permission ohos.permission.INTERNET
1598     * @param { AsyncCallback<DownloadInfo> } callback
1599     * @throws { BusinessError } 201 - the permissions check fails
1600     * @throws { BusinessError } 401 - the parameters check fails
1601     * @syscap SystemCapability.MiscServices.Download
1602     * @since 9
1603     */
1604    /**
1605     * Get the download task info
1606     *
1607     * @permission ohos.permission.INTERNET
1608     * @param { AsyncCallback<DownloadInfo> } callback
1609     * @throws { BusinessError } 201 - the permissions check fails
1610     * @throws { BusinessError } 401 - the parameters check fails
1611     * @syscap SystemCapability.MiscServices.Download
1612     * @crossplatform
1613     * @since 10
1614     */
1615    /**
1616     * Get the download task info
1617     *
1618     * @permission ohos.permission.INTERNET
1619     * @param { AsyncCallback<DownloadInfo> } callback
1620     * @throws { BusinessError } 201 - the permissions check fails
1621     * @syscap SystemCapability.MiscServices.Download
1622     * @crossplatform
1623     * @since 12
1624     */
1625    getTaskInfo(callback: AsyncCallback<DownloadInfo>): void;
1626
1627    /**
1628     * Get the download task info
1629     *
1630     * @permission ohos.permission.INTERNET
1631     * @returns { Promise<DownloadInfo> } the promise returned by the function.
1632     * @throws { BusinessError } 201 - the permissions check fails
1633     * @throws { BusinessError } 401 - the parameters check fails
1634     * @syscap SystemCapability.MiscServices.Download
1635     * @since 9
1636     */
1637    /**
1638     * Get the download task info
1639     *
1640     * @permission ohos.permission.INTERNET
1641     * @returns { Promise<DownloadInfo> } the promise returned by the function.
1642     * @throws { BusinessError } 201 - the permissions check fails
1643     * @throws { BusinessError } 401 - the parameters check fails
1644     * @syscap SystemCapability.MiscServices.Download
1645     * @crossplatform
1646     * @since 10
1647     */
1648    /**
1649     * Get the download task info
1650     *
1651     * @permission ohos.permission.INTERNET
1652     * @returns { Promise<DownloadInfo> } the promise returned by the function.
1653     * @throws { BusinessError } 201 - the permissions check fails
1654     * @syscap SystemCapability.MiscServices.Download
1655     * @crossplatform
1656     * @since 12
1657     */
1658    getTaskInfo(): Promise<DownloadInfo>;
1659
1660    /**
1661     * Get mimetype of the download task
1662     *
1663     * @permission ohos.permission.INTERNET
1664     * @param { AsyncCallback<string> } callback
1665     * @throws { BusinessError } 201 - the permissions check fails
1666     * @throws { BusinessError } 401 - the parameters check fails
1667     * @syscap SystemCapability.MiscServices.Download
1668     * @since 9
1669     */
1670    /**
1671     * Get mimetype of the download task
1672     *
1673     * @permission ohos.permission.INTERNET
1674     * @param { AsyncCallback<string> } callback
1675     * @throws { BusinessError } 201 - the permissions check fails
1676     * @throws { BusinessError } 401 - the parameters check fails
1677     * @syscap SystemCapability.MiscServices.Download
1678     * @crossplatform
1679     * @since 10
1680     */
1681    /**
1682     * Get mimetype of the download task
1683     *
1684     * @permission ohos.permission.INTERNET
1685     * @param { AsyncCallback<string> } callback
1686     * @throws { BusinessError } 201 - the permissions check fails
1687     * @syscap SystemCapability.MiscServices.Download
1688     * @crossplatform
1689     * @since 12
1690     */
1691    getTaskMimeType(callback: AsyncCallback<string>): void;
1692
1693    /**
1694     * Get mimetype of the download task
1695     *
1696     * @permission ohos.permission.INTERNET
1697     * @returns { Promise<string> } the promise returned by the function.
1698     * @throws { BusinessError } 201 - the permissions check fails
1699     * @throws { BusinessError } 401 - the parameters check fails
1700     * @syscap SystemCapability.MiscServices.Download
1701     * @since 9
1702     */
1703    /**
1704     * Get mimetype of the download task
1705     *
1706     * @permission ohos.permission.INTERNET
1707     * @returns { Promise<string> } the promise returned by the function.
1708     * @throws { BusinessError } 201 - the permissions check fails
1709     * @throws { BusinessError } 401 - the parameters check fails
1710     * @syscap SystemCapability.MiscServices.Download
1711     * @crossplatform
1712     * @since 10
1713     */
1714    /**
1715     * Get mimetype of the download task
1716     *
1717     * @permission ohos.permission.INTERNET
1718     * @returns { Promise<string> } the promise returned by the function.
1719     * @throws { BusinessError } 201 - the permissions check fails
1720     * @syscap SystemCapability.MiscServices.Download
1721     * @crossplatform
1722     * @since 12
1723     */
1724    getTaskMimeType(): Promise<string>;
1725  }
1726
1727  /**
1728   * File data Structure
1729   *
1730   * @interface File
1731   * @syscap SystemCapability.MiscServices.Download
1732   * @since 6
1733   * @name File
1734   */
1735  /**
1736   * File data Structure
1737   *
1738   * @typedef File
1739   * @syscap SystemCapability.MiscServices.Download
1740   * @crossplatform
1741   * @since 10
1742   */
1743  interface File {
1744    /**
1745     * When multipart is submitted, the file name in the request header.
1746     *
1747     * @syscap SystemCapability.MiscServices.Download
1748     * @since 6
1749     */
1750    /**
1751     * When multipart is submitted, the file name in the request header.
1752     *
1753     * @type { string }
1754     * @syscap SystemCapability.MiscServices.Download
1755     * @crossplatform
1756     * @since 10
1757     */
1758    filename: string;
1759    /**
1760     * When multipart is submitted, the name of the form item. The default is file.
1761     *
1762     * @syscap SystemCapability.MiscServices.Download
1763     * @since 6
1764     */
1765    /**
1766     * When multipart is submitted, the name of the form item. The default is file.
1767     *
1768     * @type { string }
1769     * @syscap SystemCapability.MiscServices.Download
1770     * @crossplatform
1771     * @since 10
1772     */
1773    name: string;
1774    /**
1775     * The local storage path of the file (please refer to the storage directory definition for path usage).
1776     *
1777     * @syscap SystemCapability.MiscServices.Download
1778     * @since 6
1779     */
1780    /**
1781     * The local storage path of the file (please refer to the storage directory definition for path usage).
1782     *
1783     * @type { string }
1784     * @syscap SystemCapability.MiscServices.Download
1785     * @crossplatform
1786     * @since 10
1787     */
1788    uri: string;
1789    /**
1790     * The content type of the file is obtained by default according to the suffix of the file name or path.
1791     *
1792     * @syscap SystemCapability.MiscServices.Download
1793     * @since 6
1794     */
1795    /**
1796     * The content type of the file is obtained by default according to the suffix of the file name or path.
1797     *
1798     * @type { string }
1799     * @syscap SystemCapability.MiscServices.Download
1800     * @crossplatform
1801     * @since 10
1802     */
1803    type: string;
1804  }
1805
1806  /**
1807   * RequestData data Structure
1808   *
1809   * @interface RequestData
1810   * @syscap SystemCapability.MiscServices.Download
1811   * @since 6
1812   * @name RequestData
1813   */
1814  /**
1815   * RequestData data Structure
1816   *
1817   * @typedef RequestData
1818   * @syscap SystemCapability.MiscServices.Download
1819   * @crossplatform
1820   * @since 10
1821   */
1822  interface RequestData {
1823    /**
1824     * Represents the name of the form element.
1825     *
1826     * @syscap SystemCapability.MiscServices.Download
1827     * @since 6
1828     */
1829    /**
1830     * Represents the name of the form element.
1831     *
1832     * @type { string }
1833     * @syscap SystemCapability.MiscServices.Download
1834     * @crossplatform
1835     * @since 10
1836     */
1837    name: string;
1838    /**
1839     * Represents the value of the form element.
1840     *
1841     * @syscap SystemCapability.MiscServices.Download
1842     * @since 6
1843     */
1844    /**
1845     * Represents the value of the form element.
1846     *
1847     * @type { string }
1848     * @syscap SystemCapability.MiscServices.Download
1849     * @crossplatform
1850     * @since 10
1851     */
1852    value: string;
1853  }
1854
1855  /**
1856   * UploadConfig data Structure
1857   *
1858   * @interface UploadConfig
1859   * @syscap SystemCapability.MiscServices.Upload
1860   * @since 6
1861   * @name UploadConfig
1862   */
1863  /**
1864   * UploadConfig data Structure
1865   *
1866   * @typedef UploadConfig
1867   * @syscap SystemCapability.MiscServices.Upload
1868   * @crossplatform
1869   * @since 10
1870   */
1871  interface UploadConfig {
1872    /**
1873     * Resource address.
1874     * Verification rule: Starting with http (s)://and with a length not exceeding 2048 characters.
1875     *
1876     * @syscap SystemCapability.MiscServices.Upload
1877     * @since 6
1878     */
1879    /**
1880     * Resource address.
1881     * Verification rule: Starting with http (s)://and with a length not exceeding 2048 characters.
1882     *
1883     * @type { string }
1884     * @syscap SystemCapability.MiscServices.Upload
1885     * @crossplatform
1886     * @since 10
1887     */
1888    url: string;
1889    /**
1890     * Adds an HTTP or HTTPS header to be included with the upload request.
1891     *
1892     * @syscap SystemCapability.MiscServices.Upload
1893     * @since 6
1894     */
1895    /**
1896     * Adds an HTTP or HTTPS header to be included with the upload request.
1897     *
1898     * @type { Object }
1899     * @syscap SystemCapability.MiscServices.Upload
1900     * @crossplatform
1901     * @since 10
1902     */
1903    header: Object;
1904    /**
1905     * Request method: POST, PUT. The default POST.
1906     *
1907     * @syscap SystemCapability.MiscServices.Upload
1908     * @since 6
1909     */
1910    /**
1911     * Request method: POST, PUT. The default POST.
1912     *
1913     * @type { string }
1914     * @syscap SystemCapability.MiscServices.Upload
1915     * @crossplatform
1916     * @since 10
1917     */
1918    method: string;
1919    /**
1920     * The index of paths for a task.
1921     * Usually used for a continuous job.
1922     * The default is 0.
1923     *
1924     * @type { ?number }
1925     * @syscap SystemCapability.MiscServices.Upload
1926     * @since 11
1927     */
1928    index?: number;
1929    /**
1930     * The start point of a file.
1931     * Usually used for a continuous job.
1932     * It will start read at the point in upload.
1933     * The default is 0.
1934     *
1935     * @type { ?number }
1936     * @syscap SystemCapability.MiscServices.Upload
1937     * @since 11
1938     */
1939    begins?: number;
1940    /**
1941     * The end point of a file.
1942     * Usually used for a continuous job.
1943     * It will end read at the point in upload.
1944     * The default is -1 indicating the end of the data for upload.
1945     *
1946     * @type { ?number }
1947     * @syscap SystemCapability.MiscServices.Upload
1948     * @since 11
1949     */
1950    ends?: number;
1951    /**
1952     * A list of files to be uploaded. Please use multipart/form-data to submit.
1953     *
1954     * @syscap SystemCapability.MiscServices.Upload
1955     * @since 6
1956     */
1957    /**
1958     * A list of files to be uploaded. Please use multipart/form-data to submit.
1959     *
1960     * @type { Array<File> }
1961     * @syscap SystemCapability.MiscServices.Upload
1962     * @crossplatform
1963     * @since 10
1964     */
1965    files: Array<File>;
1966    /**
1967     * The requested form data.
1968     *
1969     * @syscap SystemCapability.MiscServices.Upload
1970     * @since 6
1971     */
1972    /**
1973     * The requested form data.
1974     *
1975     * @type { Array<RequestData> }
1976     * @syscap SystemCapability.MiscServices.Upload
1977     * @crossplatform
1978     * @since 10
1979     */
1980    data: Array<RequestData>;
1981  }
1982
1983  /**
1984   * TaskState data Structure
1985   *
1986   * @interface TaskState
1987   * @syscap SystemCapability.MiscServices.Upload
1988   * @since 9
1989   * @name TaskState
1990   */
1991  /**
1992   * TaskState data Structure
1993   *
1994   * @typedef TaskState
1995   * @syscap SystemCapability.MiscServices.Upload
1996   * @crossplatform
1997   * @since 10
1998   */
1999  interface TaskState {
2000    /**
2001     * Upload file path.
2002     *
2003     * @syscap SystemCapability.MiscServices.Upload
2004     * @since 9
2005     */
2006    /**
2007     * Upload file path.
2008     *
2009     * @type { string }
2010     * @syscap SystemCapability.MiscServices.Upload
2011     * @crossplatform
2012     * @since 10
2013     */
2014    path: string;
2015    /**
2016     * Upload task return value.
2017     *
2018     * @syscap SystemCapability.MiscServices.Upload
2019     * @since 9
2020     */
2021    /**
2022     * Upload task return value.
2023     *
2024     * @type { number }
2025     * @syscap SystemCapability.MiscServices.Upload
2026     * @crossplatform
2027     * @since 10
2028     */
2029    responseCode: number;
2030    /**
2031     * Upload task information.
2032     *
2033     * @syscap SystemCapability.MiscServices.Upload
2034     * @since 9
2035     */
2036    /**
2037     * Upload task information.
2038     *
2039     * @type { string }
2040     * @syscap SystemCapability.MiscServices.Upload
2041     * @crossplatform
2042     * @since 10
2043     */
2044    message: string;
2045  }
2046
2047  /**
2048   * Upload task interface
2049   *
2050   * @interface UploadTask
2051   * @syscap SystemCapability.MiscServices.Download
2052   * @since 6
2053   */
2054  /**
2055   * Upload task interface
2056   *
2057   * @typedef UploadTask
2058   * @syscap SystemCapability.MiscServices.Download
2059   * @crossplatform
2060   * @since 10
2061   */
2062  interface UploadTask {
2063    /**
2064     * Called when the current upload session is in process.
2065     *
2066     * @param { 'progress' } type progress Indicates the upload task progress.
2067     * @param { function } callback
2068     *        The callback function for the upload progress change event
2069     *        uploadedSize The length of uploaded data, in bytes
2070     *        totalSize The length of data expected to be uploaded, in bytes.
2071     * @syscap SystemCapability.MiscServices.Upload
2072     * @since 6
2073     */
2074    /**
2075     * Called when the current upload session is in process.
2076     *
2077     * @param { 'progress' } type progress Indicates the upload task progress.
2078     * @param { function } callback
2079     *        The callback function for the upload progress change event
2080     *        uploadedSize The length of uploaded data, in bytes
2081     *        totalSize The length of data expected to be uploaded, in bytes.
2082     * @syscap SystemCapability.MiscServices.Upload
2083     * @crossplatform
2084     * @since 10
2085     */
2086    /**
2087     * Called when the current upload session is in process.
2088     *
2089     * @param { 'progress' } type progress Indicates the upload task progress.
2090     * @param { function } callback
2091     * <br>The callback function for the upload progress change event
2092     * <br>uploadedSize The length of uploaded data, in bytes
2093     * <br>totalSize The length of data expected to be uploaded, in bytes.
2094     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
2095     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
2096     * @syscap SystemCapability.MiscServices.Upload
2097     * @crossplatform
2098     * @since 12
2099     */
2100    on(type: 'progress', callback: (uploadedSize: number, totalSize: number) => void): void;
2101
2102    /**
2103     * Called when the current upload session is in process.
2104     *
2105     * @param { 'progress' } type progress Indicates the upload task progress.
2106     * @param { function } [callback]
2107     *        The callback function for the upload progress change event
2108     *        uploadedSize The length of uploaded data, in bytes
2109     *        totalSize The length of data expected to be uploaded, in bytes.
2110     * @syscap SystemCapability.MiscServices.Upload
2111     * @since 6
2112     */
2113    /**
2114     * Called when the current upload session is in process.
2115     *
2116     * @param { 'progress' } type progress Indicates the upload task progress.
2117     * @param { function } [callback]
2118     *        The callback function for the upload progress change event
2119     *        uploadedSize The length of uploaded data, in bytes
2120     *        totalSize The length of data expected to be uploaded, in bytes.
2121     * @syscap SystemCapability.MiscServices.Upload
2122     * @crossplatform
2123     * @since 10
2124     */
2125    /**
2126     * Called when the current upload session is in process.
2127     *
2128     * @param { 'progress' } type progress Indicates the upload task progress.
2129     * @param { function } [callback]
2130     * <br>The callback function for the upload progress change event
2131     * <br>uploadedSize The length of uploaded data, in bytes
2132     * <br>totalSize The length of data expected to be uploaded, in bytes.
2133     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
2134     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
2135     * @syscap SystemCapability.MiscServices.Upload
2136     * @crossplatform
2137     * @since 12
2138     */
2139    off(type: 'progress', callback?: (uploadedSize: number, totalSize: number) => void): void;
2140
2141    /**
2142     * Called when the header of the current upload session has been received.
2143     *
2144     * @param { 'headerReceive' } type headerReceive Indicates the upload task headed receive.
2145     * @param { function } callback The callback function for the HTTP Response Header event
2146     *        header HTTP Response Header returned by the developer server.
2147     * @syscap SystemCapability.MiscServices.Upload
2148     * @since 7
2149     */
2150    /**
2151     * Called when the header of the current upload session has been received.
2152     *
2153     * @param { 'headerReceive' } type headerReceive Indicates the upload task headed receive.
2154     * @param { function } callback The callback function for the HTTP Response Header event
2155     *        header HTTP Response Header returned by the developer server.
2156     * @syscap SystemCapability.MiscServices.Upload
2157     * @crossplatform
2158     * @since 10
2159     */
2160    /**
2161     * Called when the header of the current upload session has been received.
2162     *
2163     * @param { 'headerReceive' } type headerReceive Indicates the upload task headed receive.
2164     * @param { function } callback The callback function for the HTTP Response Header event
2165     * <br>header HTTP Response Header returned by the developer server.
2166     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
2167     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
2168     * @syscap SystemCapability.MiscServices.Upload
2169     * @crossplatform
2170     * @since 12
2171     */
2172    on(type: 'headerReceive', callback: (header: object) => void): void;
2173
2174    /**
2175     * Called when the header of the current upload session has been received.
2176     *
2177     * @param { 'headerReceive' } type headerReceive Indicates the upload task headed receive.
2178     * @param { function } [callback] The callback function for the HTTP Response Header event
2179     *        header HTTP Response Header returned by the developer server.
2180     * @syscap SystemCapability.MiscServices.Upload
2181     * @since 7
2182     */
2183    /**
2184     * Called when the header of the current upload session has been received.
2185     *
2186     * @param { 'headerReceive' } type headerReceive Indicates the upload task headed receive.
2187     * @param { function } [callback] The callback function for the HTTP Response Header event
2188     *        header HTTP Response Header returned by the developer server.
2189     * @syscap SystemCapability.MiscServices.Upload
2190     * @crossplatform
2191     * @since 10
2192     */
2193    /**
2194     * Called when the header of the current upload session has been received.
2195     *
2196     * @param { 'headerReceive' } type headerReceive Indicates the upload task headed receive.
2197     * @param { function } [callback] The callback function for the HTTP Response Header event
2198     * <br>header HTTP Response Header returned by the developer server.
2199     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
2200     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
2201     * @syscap SystemCapability.MiscServices.Upload
2202     * @crossplatform
2203     * @since 12
2204     */
2205    off(type: 'headerReceive', callback?: (header: object) => void): void;
2206
2207    /**
2208     * Called when the current upload session complete or fail.
2209     *
2210     * @param { 'complete' | 'fail' } type Indicates the upload session event type
2211     *        complete: upload task completed
2212     *        fail: upload task failed
2213     * @param { Callback<Array<TaskState>> } callback The callback function for the upload complete or fail change event.
2214     * @syscap SystemCapability.MiscServices.Upload
2215     * @since 9
2216     */
2217    /**
2218     * Called when the current upload session complete or fail.
2219     *
2220     * @param { 'complete' | 'fail' } type Indicates the upload session event type
2221     *        complete: upload task completed
2222     *        fail: upload task failed
2223     * @param { Callback<Array<TaskState>> } callback The callback function for the upload complete or fail change event.
2224     * @syscap SystemCapability.MiscServices.Upload
2225     * @crossplatform
2226     * @since 10
2227     */
2228    /**
2229     * Called when the current upload session complete or fail.
2230     *
2231     * @param { 'complete' | 'fail' } type Indicates the upload session event type
2232     * <br>complete: upload task completed
2233     * <br>fail: upload task failed
2234     * @param { Callback<Array<TaskState>> } callback The callback function for the upload complete or fail change event.
2235     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
2236     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
2237     * @syscap SystemCapability.MiscServices.Upload
2238     * @crossplatform
2239     * @since 12
2240     */
2241    on(type: 'complete' | 'fail', callback: Callback<Array<TaskState>>): void;
2242
2243    /**
2244     * Called when the current upload session complete or fail.
2245     *
2246     * @param { 'complete' | 'fail' } type Indicates the upload session event type
2247     *        complete: upload task completed
2248     *         fail: upload task failed
2249     * @param { Callback<Array<TaskState>> } [callback]
2250     * @syscap SystemCapability.MiscServices.Upload
2251     * @since 9
2252     */
2253    /**
2254     * Called when the current upload session complete or fail.
2255     *
2256     * @param { 'complete' | 'fail' } type Indicates the upload session event type
2257     *        complete: upload task completed
2258     *         fail: upload task failed
2259     * @param { Callback<Array<TaskState>> } [callback]
2260     * @syscap SystemCapability.MiscServices.Upload
2261     * @crossplatform
2262     * @since 10
2263     */
2264    /**
2265     * Called when the current upload session complete or fail.
2266     *
2267     * @param { 'complete' | 'fail' } type Indicates the upload session event type
2268     * <br>complete: upload task completed
2269     * <br>fail: upload task failed
2270     * @param { Callback<Array<TaskState>> } [callback]
2271     * @throws { BusinessError } 401 - the parameters check fails. Possible causes: 1. Missing mandatory parameters.
2272     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
2273     * @syscap SystemCapability.MiscServices.Upload
2274     * @crossplatform
2275     * @since 12
2276     */
2277    off(type: 'complete' | 'fail', callback?: Callback<Array<TaskState>>): void;
2278
2279    /**
2280     * Deletes an upload session.
2281     *
2282     * @permission ohos.permission.INTERNET
2283     * @param { AsyncCallback<boolean> } callback Indicates asynchronous invoking Result.
2284     * @throws { BusinessError } 201 - the permissions check fails
2285     * @syscap SystemCapability.MiscServices.Upload
2286     * @since 6
2287     * @deprecated since 9
2288     * @useinstead ohos.request.delete
2289     */
2290    remove(callback: AsyncCallback<boolean>): void;
2291
2292    /**
2293     * Deletes an upload session.
2294     *
2295     * @permission ohos.permission.INTERNET
2296     * @returns { Promise<boolean> } the promise returned by the function.
2297     * @throws { BusinessError } 201 - the permissions check fails
2298     * @syscap SystemCapability.MiscServices.Upload
2299     * @since 6
2300     * @deprecated since 9
2301     * @useinstead ohos.request.delete
2302     */
2303    remove(): Promise<boolean>;
2304
2305    /**
2306     * Delete the upload task
2307     *
2308     * @permission ohos.permission.INTERNET
2309     * @param { AsyncCallback<boolean> } callback
2310     * @throws { BusinessError } 201 - the permissions check fails
2311     * @throws { BusinessError } 401 - the parameters check fails
2312     * @syscap SystemCapability.MiscServices.Upload
2313     * @since 9
2314     */
2315    /**
2316     * Delete the upload task
2317     *
2318     * @permission ohos.permission.INTERNET
2319     * @param { AsyncCallback<boolean> } callback
2320     * @throws { BusinessError } 201 - the permissions check fails
2321     * @throws { BusinessError } 401 - the parameters check fails
2322     * @syscap SystemCapability.MiscServices.Upload
2323     * @crossplatform
2324     * @since 10
2325     */
2326    /**
2327     * Delete the upload task
2328     *
2329     * @permission ohos.permission.INTERNET
2330     * @param { AsyncCallback<boolean> } callback
2331     * @throws { BusinessError } 201 - the permissions check fails
2332     * @syscap SystemCapability.MiscServices.Upload
2333     * @crossplatform
2334     * @since 12
2335     */
2336    delete(callback: AsyncCallback<boolean>): void;
2337
2338    /**
2339     * Delete the upload task
2340     *
2341     * @permission ohos.permission.INTERNET
2342     * @returns { Promise<boolean> } the promise returned by the function.
2343     * @throws { BusinessError } 201 - the permissions check fails
2344     * @throws { BusinessError } 401 - the parameters check fails
2345     * @syscap SystemCapability.MiscServices.Upload
2346     * @since 9
2347     */
2348    /**
2349     * Delete the upload task
2350     *
2351     * @permission ohos.permission.INTERNET
2352     * @returns { Promise<boolean> } the promise returned by the function.
2353     * @throws { BusinessError } 201 - the permissions check fails
2354     * @throws { BusinessError } 401 - the parameters check fails
2355     * @syscap SystemCapability.MiscServices.Upload
2356     * @crossplatform
2357     * @since 10
2358     */
2359    /**
2360     * Delete the upload task
2361     *
2362     * @permission ohos.permission.INTERNET
2363     * @returns { Promise<boolean> } the promise returned by the function.
2364     * @throws { BusinessError } 201 - the permissions check fails
2365     * @syscap SystemCapability.MiscServices.Upload
2366     * @crossplatform
2367     * @since 12
2368     */
2369    delete(): Promise<boolean>;
2370  }
2371
2372  /**
2373   * The request agent api.
2374   * Supports "background" and "frontend" tasks as while.
2375   * Though "background" and "frontend" here do not the same with process's concept.
2376   * All tasks will be executed at request manager service and recorded.
2377   * Background tasks is for concurrent transfer, such as caching videos for a later play.
2378   * Frontend tasks is for instant transfer, such as submitting forms for a consumption bill.
2379   * Background tasks use notification to tell user tasks' status information.
2380   * Frontend tasks use callback to tell caller tasks' status information.
2381   * Background has some automatically restore mechanism.
2382   * Frontend tasks controlled by caller.
2383   * Uses `multipart/form-data` in client request for upload.
2384   * A `Content-Disposition: attachment; filename=<filename>` response from server leads to download.
2385   * More details, please see the architecture documents of the request subsystem.
2386   *
2387   * @namespace agent
2388   * @syscap SystemCapability.Request.FileTransferAgent
2389   * @since 10
2390   */
2391  /**
2392   * The request agent api.
2393   * Supports "background" and "frontend" tasks as while.
2394   * Though "background" and "frontend" here do not the same with process's concept.
2395   * All tasks will be executed at request manager service and recorded.
2396   * Background tasks is for concurrent transfer, such as caching videos for a later play.
2397   * Frontend tasks is for instant transfer, such as submitting forms for a consumption bill.
2398   * Background tasks use notification to tell user tasks' status information.
2399   * Frontend tasks use callback to tell caller tasks' status information.
2400   * Background has some automatically restore mechanism.
2401   * Frontend tasks controlled by caller.
2402   * Uses `multipart/form-data` in client request for upload.
2403   * A `Content-Disposition: attachment; filename=<filename>` response from server leads to download.
2404   * More details, please see the architecture documents of the request subsystem.
2405   * Only front-end mode is supported in cross-platform scenarios.
2406   *
2407   * @namespace agent
2408   * @syscap SystemCapability.Request.FileTransferAgent
2409   * @crossplatform
2410   * @atomicservice
2411   * @since 11
2412   */
2413  namespace agent {
2414    /**
2415     * The action options.
2416     *
2417     * @enum { number } Action
2418     * @syscap SystemCapability.Request.FileTransferAgent
2419     * @since 10
2420     */
2421    /**
2422     * The action options.
2423     *
2424     * @enum { number } Action
2425     * @syscap SystemCapability.Request.FileTransferAgent
2426     * @crossplatform
2427     * @atomicservice
2428     * @since 11
2429     */
2430    enum Action {
2431      /**
2432       * Indicates download task.
2433       *
2434       * @syscap SystemCapability.Request.FileTransferAgent
2435       * @since 10
2436       */
2437      /**
2438       * Indicates download task.
2439       *
2440       * @syscap SystemCapability.Request.FileTransferAgent
2441       * @crossplatform
2442       * @atomicservice
2443       * @since 11
2444       */
2445      DOWNLOAD,
2446      /**
2447       * Indicates upload task.
2448       *
2449       * @syscap SystemCapability.Request.FileTransferAgent
2450       * @since 10
2451       */
2452      /**
2453       * Indicates upload task.
2454       *
2455       * @syscap SystemCapability.Request.FileTransferAgent
2456       * @crossplatform
2457       * @atomicservice
2458       * @since 11
2459       */
2460      UPLOAD
2461    }
2462
2463    /**
2464     * The mode options.
2465     *
2466     * @enum { number } Mode
2467     * @syscap SystemCapability.Request.FileTransferAgent
2468     * @since 10
2469     */
2470    /**
2471     * The mode options.
2472     *
2473     * @enum { number } Mode
2474     * @syscap SystemCapability.Request.FileTransferAgent
2475     * @crossplatform
2476     * @atomicservice
2477     * @since 11
2478     */
2479    enum Mode {
2480      /**
2481       * Indicates background task.
2482       *
2483       * @syscap SystemCapability.Request.FileTransferAgent
2484       * @since 10
2485       */
2486      /**
2487       * Indicates background task.
2488       *
2489       * @syscap SystemCapability.Request.FileTransferAgent
2490       * @atomicservice
2491       * @since 11
2492       */
2493      BACKGROUND,
2494      /**
2495       * Indicates foreground task.
2496       *
2497       * @syscap SystemCapability.Request.FileTransferAgent
2498       * @since 10
2499       */
2500      /**
2501       * Indicates foreground task.
2502       *
2503       * @syscap SystemCapability.Request.FileTransferAgent
2504       * @crossplatform
2505       * @atomicservice
2506       * @since 11
2507       */
2508      FOREGROUND
2509    }
2510
2511    /**
2512     * The network options.
2513     *
2514     * @enum { number } Network
2515     * @syscap SystemCapability.Request.FileTransferAgent
2516     * @since 10
2517     */
2518    /**
2519     * The network options.
2520     *
2521     * @enum { number } Network
2522     * @syscap SystemCapability.Request.FileTransferAgent
2523     * @crossplatform
2524     * @atomicservice
2525     * @since 11
2526     */
2527    enum Network {
2528      /**
2529       * Indicates no restriction on network type.
2530       *
2531       * @syscap SystemCapability.Request.FileTransferAgent
2532       * @since 10
2533       */
2534      /**
2535       * Indicates no restriction on network type.
2536       *
2537       * @syscap SystemCapability.Request.FileTransferAgent
2538       * @crossplatform
2539       * @atomicservice
2540       * @since 11
2541       */
2542      ANY,
2543      /**
2544       * Indicates Wi-Fi only.
2545       *
2546       * @syscap SystemCapability.Request.FileTransferAgent
2547       * @since 10
2548       */
2549      /**
2550       * Indicates Wi-Fi only.
2551       *
2552       * @syscap SystemCapability.Request.FileTransferAgent
2553       * @crossplatform
2554       * @atomicservice
2555       * @since 11
2556       */
2557      WIFI,
2558      /**
2559       * Indicates cellular only.
2560       *
2561       * @syscap SystemCapability.Request.FileTransferAgent
2562       * @since 10
2563       */
2564      /**
2565       * Indicates cellular only.
2566       *
2567       * @syscap SystemCapability.Request.FileTransferAgent
2568       * @crossplatform
2569       * @atomicservice
2570       * @since 11
2571       */
2572      CELLULAR
2573    }
2574
2575    /**
2576     * Broadcast events for the request.
2577     *
2578     * @enum { string } BroadcastEvent
2579     * @syscap SystemCapability.Request.FileTransferAgent
2580     * @since 11
2581     */
2582    enum BroadcastEvent {
2583      /**
2584       * Completion event for the task.
2585       * The code in the commonEventData can only be "0x40"(COMPLETE) or "0x41"(FAILED), same as "State".
2586       * The data in the commonEventData contains the id of the task.
2587       *
2588       * @syscap SystemCapability.Request.FileTransferAgent
2589       * @since 11
2590       */
2591      COMPLETE = 'ohos.request.event.COMPLETE'
2592    }
2593
2594    /**
2595     * The file information for a form item.
2596     *
2597     * @typedef FileSpec
2598     * @syscap SystemCapability.Request.FileTransferAgent
2599     * @since 10
2600     */
2601    /**
2602     * The file information for a form item.
2603     *
2604     * @typedef FileSpec
2605     * @syscap SystemCapability.Request.FileTransferAgent
2606     * @crossplatform
2607     * @atomicservice
2608     * @since 11
2609     */
2610    interface FileSpec {
2611      /**
2612       * A relative path string, like "./xxx/yyy/zzz.html", "xxx/yyy/zzz.html", in the caller's cache directory.
2613       *
2614       * @type { string }
2615       * @syscap SystemCapability.Request.FileTransferAgent
2616       * @since 10
2617       */
2618      /**
2619       * A relative path string, like "./xxx/yyy/zzz.html", "xxx/yyy/zzz.html", in the caller's cache directory.
2620       *
2621       * @type { string }
2622       * @syscap SystemCapability.Request.FileTransferAgent
2623       * @crossplatform
2624       * @atomicservice
2625       * @since 11
2626       */
2627      /**
2628       * The path to save the uploaded file.
2629       * Currently support:
2630       * 1: relative path, like "./xxx/yyy/zzz.html", "xxx/yyy/zzz.html", under caller's cache folder.
2631       * 2: internal protocol path, starting with "internal://", like "internal://cache/path/to/file.txt".
2632       * 3: application storage path, only the base directory and its subdirectories are supported, like "/data/storage/el1/base/path/to/file.txt".
2633       * 4: file protocol path with self bundle name, only the base directory and its subdirectories are supported, like "file://com.example.test/data/storage/el2/base/file.txt".
2634       * 5: user file url, like "file://media/Photo/path/to/file.png".
2635       *
2636       * @type { string }
2637       * @syscap SystemCapability.Request.FileTransferAgent
2638       * @crossplatform
2639       * @atomicservice
2640       * @since 12
2641       */
2642      path: string;
2643      /**
2644       * The MIME type of the file.
2645       * The default is obtained by the suffix of the filename.
2646       *
2647       * @type { ?string }
2648       * @syscap SystemCapability.Request.FileTransferAgent
2649       * @since 10
2650       */
2651      /**
2652       * The MIME type of the file.
2653       * The default is obtained by the suffix of the filename.
2654       *
2655       * @type { ?string }
2656       * @syscap SystemCapability.Request.FileTransferAgent
2657       * @crossplatform
2658       * @atomicservice
2659       * @since 11
2660       */
2661      mimeType?: string;
2662      /**
2663       * The filename, the default is obtained by path.
2664       *
2665       * @type { ?string }
2666       * @syscap SystemCapability.Request.FileTransferAgent
2667       * @since 10
2668       */
2669      /**
2670       * The filename, the default is obtained by path.
2671       *
2672       * @type { ?string }
2673       * @syscap SystemCapability.Request.FileTransferAgent
2674       * @crossplatform
2675       * @atomicservice
2676       * @since 11
2677       */
2678      filename?: string;
2679      /**
2680       * The extras for the file information.
2681       *
2682       * @type { ?object }
2683       * @syscap SystemCapability.Request.FileTransferAgent
2684       * @since 10
2685       */
2686      /**
2687       * The extras for the file information.
2688       *
2689       * @type { ?object }
2690       * @syscap SystemCapability.Request.FileTransferAgent
2691       * @crossplatform
2692       * @atomicservice
2693       * @since 11
2694       */
2695      extras?: object;
2696    }
2697
2698    /**
2699     * The form item information for a task.
2700     *
2701     * @typedef FormItem
2702     * @syscap SystemCapability.Request.FileTransferAgent
2703     * @since 10
2704     */
2705    /**
2706     * The form item information for a task.
2707     *
2708     * @typedef FormItem
2709     * @syscap SystemCapability.Request.FileTransferAgent
2710     * @crossplatform
2711     * @atomicservice
2712     * @since 11
2713     */
2714    interface FormItem {
2715      /**
2716       * The item's name.
2717       *
2718       * @type { string }
2719       * @syscap SystemCapability.Request.FileTransferAgent
2720       * @since 10
2721       */
2722      /**
2723       * The item's name.
2724       *
2725       * @type { string }
2726       * @syscap SystemCapability.Request.FileTransferAgent
2727       * @crossplatform
2728       * @atomicservice
2729       * @since 11
2730       */
2731      name: string;
2732      /**
2733       * The item's value.
2734       *
2735       * @type { string | FileSpec | Array<FileSpec> }
2736       * @syscap SystemCapability.Request.FileTransferAgent
2737       * @since 10
2738       */
2739      /**
2740       * The item's value.
2741       *
2742       * @type { string | FileSpec | Array<FileSpec> }
2743       * @syscap SystemCapability.Request.FileTransferAgent
2744       * @crossplatform
2745       * @atomicservice
2746       * @since 11
2747       */
2748      value: string | FileSpec | Array<FileSpec>;
2749    }
2750
2751    /**
2752     * The configurations for a task.
2753     * Using a flexible configuration for clear upload and download functions.
2754     * If without emphasis, an option is for any task.
2755     *
2756     * @typedef Config
2757     * @syscap SystemCapability.Request.FileTransferAgent
2758     * @since 10
2759     */
2760    /**
2761     * The configurations for a task.
2762     * Using a flexible configuration for clear upload and download functions.
2763     * If without emphasis, an option is for any task.
2764     *
2765     * @typedef Config
2766     * @syscap SystemCapability.Request.FileTransferAgent
2767     * @crossplatform
2768     * @atomicservice
2769     * @since 11
2770     */
2771    interface Config {
2772      /**
2773       * The task action, upload or download.
2774       *
2775       * @type { Action }
2776       * @syscap SystemCapability.Request.FileTransferAgent
2777       * @since 10
2778       */
2779      /**
2780       * The task action, upload or download.
2781       *
2782       * @type { Action }
2783       * @syscap SystemCapability.Request.FileTransferAgent
2784       * @crossplatform
2785       * @atomicservice
2786       * @since 11
2787       */
2788      action: Action;
2789      /**
2790       * The Universal Resource Locator for a task.
2791       * Starting with http(s)://
2792       * The maximum length is 2048 characters.
2793       * Using raw `url` option, even url parameters in it.
2794       *
2795       * @type { string }
2796       * @syscap SystemCapability.Request.FileTransferAgent
2797       * @since 10
2798       */
2799      /**
2800       * The Universal Resource Locator for a task.
2801       * The maximum length is 2048 characters.
2802       * Using raw `url` option, even url parameters in it.
2803       *
2804       * @type { string }
2805       * @syscap SystemCapability.Request.FileTransferAgent
2806       * @crossplatform
2807       * @atomicservice
2808       * @since 11
2809       */
2810      url: string;
2811      /**
2812       * The title for a task, give a meaningful title please.
2813       * The maximum length is 256 characters.
2814       * The default is the same with its action.
2815       *
2816       * @type { ?string }
2817       * @syscap SystemCapability.Request.FileTransferAgent
2818       * @since 10
2819       */
2820      /**
2821       * The title for a task, give a meaningful title please.
2822       * The maximum length is 256 characters.
2823       * The default is upload or download, consistent with its action.
2824       *
2825       * @type { ?string }
2826       * @syscap SystemCapability.Request.FileTransferAgent
2827       * @crossplatform
2828       * @atomicservice
2829       * @since 11
2830       */
2831      title?: string;
2832      /**
2833       * The details for a task.
2834       * The maximum length is 1024 characters.
2835       * The default is empty string.
2836       *
2837       * @type { ?string }
2838       * @syscap SystemCapability.Request.FileTransferAgent
2839       * @since 10
2840       */
2841      /**
2842       * The details for a task.
2843       * The maximum length is 1024 characters.
2844       * The default is empty string.
2845       *
2846       * @type { ?string }
2847       * @syscap SystemCapability.Request.FileTransferAgent
2848       * @crossplatform
2849       * @atomicservice
2850       * @since 11
2851       */
2852      description?: string;
2853      /**
2854       * Indicates task's mode.
2855       * The default is background.
2856       * For frontend task, it has callbacks.
2857       * For background task, it has notifications and fallback.
2858       *
2859       * @type { ?Mode }
2860       * @syscap SystemCapability.Request.FileTransferAgent
2861       * @since 10
2862       */
2863      /**
2864       * Indicates task's mode.
2865       * The default is BACKGROUND.
2866       * For frontend task, it has callbacks.
2867       * For background task, it has notifications and fallback.
2868       * The cross-platform default is FOREGROUND.
2869       *
2870       * @type { ?Mode }
2871       * @syscap SystemCapability.Request.FileTransferAgent
2872       * @crossplatform
2873       * @atomicservice
2874       * @since 11
2875       */
2876
2877      mode?: Mode;
2878      /**
2879       * The solution choice when path already exists during download.
2880       * Currently support:
2881       * true, rewrite the existed file.
2882       * false, go to fail.
2883       *
2884       * @type { ?boolean }
2885       * @syscap SystemCapability.Request.FileTransferAgent
2886       * @since 10
2887       */
2888      /**
2889       * The solution choice when path already exists during download.
2890       * The default is false.
2891       * Currently support:
2892       * true, rewrite the existed file.
2893       * false, go to fail.
2894       *
2895       * @type { ?boolean }
2896       * @syscap SystemCapability.Request.FileTransferAgent
2897       * @crossplatform
2898       * @atomicservice
2899       * @since 11
2900       */
2901      overwrite?: boolean;
2902      /**
2903       * The HTTP standard method for upload or download: GET/POST/PUT.
2904       * Case insensitive.
2905       * For upload, use PUT/POST, the default is PUT.
2906       * For download, use GET/POST, the default is GET.
2907       *
2908       * @type { ?string }
2909       * @syscap SystemCapability.Request.FileTransferAgent
2910       * @since 10
2911       */
2912      /**
2913       * The HTTP standard method for upload or download: GET/POST/PUT.
2914       * Case insensitive.
2915       * For upload, use PUT/POST, the default is PUT.
2916       * For download, use GET/POST, the default is GET.
2917       *
2918       * @type { ?string }
2919       * @syscap SystemCapability.Request.FileTransferAgent
2920       * @crossplatform
2921       * @atomicservice
2922       * @since 11
2923       */
2924      method?: string;
2925      /**
2926       * The HTTP headers.
2927       * For upload request, the `Content-Type` is forced to `multipart/form-data`.
2928       * For download request, the default `Content-Type` is `application/json`.
2929       *
2930       * @type { ?object }
2931       * @syscap SystemCapability.Request.FileTransferAgent
2932       * @since 10
2933       */
2934      /**
2935       * The HTTP headers.
2936       * For upload request, the `Content-Type` is forced to `multipart/form-data`.
2937       * For download request, the default `Content-Type` is `application/json`.
2938       *
2939       * @type { ?object }
2940       * @syscap SystemCapability.Request.FileTransferAgent
2941       * @crossplatform
2942       * @atomicservice
2943       * @since 11
2944       */
2945      headers?: object;
2946      /**
2947       * The arguments, it can be any text, uses json usually.
2948       * For download, it can be raw string, the default is empty string.
2949       * For upload, it can be form items, the default is a empty form.
2950       * there must be one `FileSpec` item at least or will be a parameter error.
2951       *
2952       * @type { ?(string | Array<FormItem>) }
2953       * @syscap SystemCapability.Request.FileTransferAgent
2954       * @since 10
2955       */
2956      /**
2957       * The arguments, it can be any text, uses json usually.
2958       * For download, it can be raw string, the default is empty string.
2959       * For upload, it can be form items, the default is a empty form.
2960       * there must be one `FileSpec` item at least or will be a parameter error.
2961       *
2962       * @type { ?(string | Array<FormItem>) }
2963       * @syscap SystemCapability.Request.FileTransferAgent
2964       * @crossplatform
2965       * @atomicservice
2966       * @since 11
2967       */
2968      data?: string | Array<FormItem>;
2969      /**
2970       * The path to save the downloaded file, the default is "./".
2971       * Currently support:
2972       * 1: relative path, like "./xxx/yyy/zzz.html", "xxx/yyy/zzz.html", under caller's cache folder.
2973       * 2: uri path, like "datashare://bundle/xxx/yyy/zzz.html", the data provider must allow the caller's access.
2974       *
2975       * @type { ?string }
2976       * @default ./
2977       * @syscap SystemCapability.Request.FileTransferAgent
2978       * @since 10
2979       */
2980      /**
2981       * The path to save the downloaded file, the default is "./".
2982       * Currently support:
2983       * 1: relative path, like "./xxx/yyy/zzz.html", "xxx/yyy/zzz.html", under caller's cache folder.
2984       * 2: uri path, like "datashare://bundle/xxx/yyy/zzz.html", the data provider must allow the caller's access.
2985       *
2986       * @type { ?string }
2987       * @default ./
2988       * @syscap SystemCapability.Request.FileTransferAgent
2989       * @crossplatform
2990       * @atomicservice
2991       * @since 11
2992       */
2993      /**
2994       * The path to save the downloaded file, the default is "./".
2995       * Currently support:
2996       * 1: relative path, like "./xxx/yyy/zzz.html", "xxx/yyy/zzz.html", under caller's cache folder.
2997       * 2: internal protocol path, starting with "internal://", like "internal://cache/path/to/file.txt".
2998       * 3: application storage path, only the base directory and its subdirectories are supported, like "/data/storage/el1/base/path/to/file.txt".
2999       * 4: file protocol path with self bundle name, only the base directory and its subdirectories are supported, like "file://com.example.test/data/storage/el2/base/file.txt".
3000       *
3001       * @type { ?string }
3002       * @default ./
3003       * @syscap SystemCapability.Request.FileTransferAgent
3004       * @crossplatform
3005       * @atomicservice
3006       * @since 12
3007       */
3008      saveas?: string;
3009      /**
3010       * The network.
3011       *
3012       * @type { ?Network }
3013       * @default Network.ANY
3014       * @syscap SystemCapability.Request.FileTransferAgent
3015       * @since 10
3016       */
3017      /**
3018       * The network.
3019       *
3020       * @type { ?Network }
3021       * @default Network.ANY
3022       * @syscap SystemCapability.Request.FileTransferAgent
3023       * @crossplatform
3024       * @atomicservice
3025       * @since 11
3026       */
3027      network?: Network;
3028      /**
3029       * Allows work in metered network or not.
3030       * The default is false.
3031       *
3032       * @type { ?boolean }
3033       * @default false
3034       * @syscap SystemCapability.Request.FileTransferAgent
3035       * @since 10
3036       */
3037      /**
3038       * Allows work in metered network or not.
3039       * The default is false.
3040       *
3041       * @type { ?boolean }
3042       * @default false
3043       * @syscap SystemCapability.Request.FileTransferAgent
3044       * @crossplatform
3045       * @atomicservice
3046       * @since 11
3047       */
3048      metered?: boolean;
3049      /**
3050       * Allows work in roaming network or not.
3051       * The default is true.
3052       *
3053       * @type { ?boolean }
3054       * @syscap SystemCapability.Request.FileTransferAgent
3055       * @since 10
3056       */
3057      /**
3058       * Allows work in roaming network or not.
3059       * The default is true.
3060       *
3061       * @type { ?boolean }
3062       * @syscap SystemCapability.Request.FileTransferAgent
3063       * @crossplatform
3064       * @atomicservice
3065       * @since 11
3066       */
3067      roaming?: boolean;
3068      /**
3069       * Enable automatic retry or not for the background task.
3070       * The frontend task is always fast-fail.
3071       *
3072       * @type { ?boolean }
3073       * @syscap SystemCapability.Request.FileTransferAgent
3074       * @since 10
3075       */
3076      /**
3077       * Enable automatic retry or not for the background task.
3078       * The frontend task is always fast-fail.
3079       *
3080       * @type { ?boolean }
3081       * @syscap SystemCapability.Request.FileTransferAgent
3082       * @atomicservice
3083       * @since 11
3084       */
3085      retry?: boolean;
3086      /**
3087       * Allows redirect or not.
3088       * The default is yes.
3089       *
3090       * @type { ?boolean }
3091       * @syscap SystemCapability.Request.FileTransferAgent
3092       * @since 10
3093       */
3094      /**
3095       * Allows redirect or not.
3096       * The default is true.
3097       *
3098       * @type { ?boolean }
3099       * @syscap SystemCapability.Request.FileTransferAgent
3100       * @crossplatform
3101       * @atomicservice
3102       * @since 11
3103       */
3104      redirect?: boolean;
3105      /**
3106       * The proxy url for the task.
3107       * Only this format is supported: http://<domain or IP-address>:<port>
3108       * Username and password are not supported.
3109       *
3110       * @type { ?string }
3111       * @syscap SystemCapability.Request.FileTransferAgent
3112       * @since 12
3113       */
3114      proxy?: string;
3115      /**
3116       * The index of paths for a task.
3117       * Usually used for a continuous job.
3118       * The default is 0.
3119       *
3120       * @type { ?number }
3121       * @syscap SystemCapability.Request.FileTransferAgent
3122       * @since 10
3123       */
3124      /**
3125       * The index of paths for a task.
3126       * Usually used for a continuous job.
3127       * The default is 0.
3128       *
3129       * @type { ?number }
3130       * @syscap SystemCapability.Request.FileTransferAgent
3131       * @crossplatform
3132       * @atomicservice
3133       * @since 11
3134       */
3135      index?: number;
3136      /**
3137       * The start point of a file.
3138       * Usually used for a continuous job.
3139       * It will set the "Range" header in download.
3140       * It will start read at the point in upload.
3141       * The default is 0.
3142       *
3143       * @type { ?number }
3144       * @syscap SystemCapability.Request.FileTransferAgent
3145       * @since 10
3146       */
3147      /**
3148       * The start point of a file.
3149       * Usually used for a continuous job.
3150       * It will set the "Range" header in download.
3151       * It will start read at the point in upload.
3152       * The default is 0.
3153       *
3154       * @type { ?number }
3155       * @syscap SystemCapability.Request.FileTransferAgent
3156       * @crossplatform
3157       * @atomicservice
3158       * @since 11
3159       */
3160      begins?: number;
3161      /**
3162       * The end point of a file.
3163       * Usually used for a continuous job.
3164       * It will set The "Range" header in download.
3165       * It will end read at the point in upload.
3166       * The default is -1 indicating the end of the data for upload or download.
3167       *
3168       * @type { ?number }
3169       * @syscap SystemCapability.Request.FileTransferAgent
3170       * @since 10
3171       */
3172      /**
3173       * The end point of a file.
3174       * Usually used for a continuous job.
3175       * It will set The "Range" header in download.
3176       * It will end read at the point in upload.
3177       * The default is -1 indicating the end of the data for upload or download.
3178       *
3179       * @type { ?number }
3180       * @syscap SystemCapability.Request.FileTransferAgent
3181       * @crossplatform
3182       * @atomicservice
3183       * @since 11
3184       */
3185      ends?: number;
3186      /**
3187       * The policy of the progress notification for background task.
3188       * If false: only completed or failed notification, the default.
3189       * If true, emits every progress, completed or failed notifications.
3190       *
3191       * @type { ?boolean }
3192       * @syscap SystemCapability.Request.FileTransferAgent
3193       * @since 10
3194       */
3195      /**
3196       * The policy of the progress notification for background task.
3197       * If false: only completed or failed notification, the default.
3198       * If true, emits every progress, completed or failed notifications.
3199       *
3200       * @type { ?boolean }
3201       * @syscap SystemCapability.Request.FileTransferAgent
3202       * @atomicservice
3203       * @since 11
3204       */
3205      gauge?: boolean;
3206      /**
3207       * Breaks when fail to fetch filesize before upload/download or not.
3208       * Uses filesize for a precise gauge.
3209       * The default is not, set size as -1 indicating the case.
3210       *
3211       * @type { ?boolean }
3212       * @syscap SystemCapability.Request.FileTransferAgent
3213       * @since 10
3214       */
3215      /**
3216       * Breaks when fail to fetch filesize before upload/download or not.
3217       * Uses filesize for a precise gauge.
3218       * The default is false, set size as -1 indicating the case.
3219       *
3220       * @type { ?boolean }
3221       * @syscap SystemCapability.Request.FileTransferAgent
3222       * @crossplatform
3223       * @atomicservice
3224       * @since 11
3225       */
3226      precise?: boolean;
3227      /**
3228       * For in-application layer isolation.
3229       * If given:
3230       *   the minimum is 8 bytes.
3231       *   the maximum is 2048 bytes.
3232       * Creates a task with token, then must provide it during normal query.
3233       * So saves the token carefully, it can not be retrieved by query.
3234       * Or leave it empty.
3235       *
3236       * @type { ?string }
3237       * @syscap SystemCapability.Request.FileTransferAgent
3238       * @since 10
3239       */
3240      /**
3241       * For in-application layer isolation.
3242       * If given:
3243       *   the minimum is 8 bytes.
3244       *   the maximum is 2048 bytes.
3245       * Creates a task with token, then must provide it during normal query.
3246       * So saves the token carefully, it can not be retrieved by query.
3247       * Or leave it empty.
3248       *
3249       * @type { ?string }
3250       * @syscap SystemCapability.Request.FileTransferAgent
3251       * @crossplatform
3252       * @atomicservice
3253       * @since 11
3254       */
3255      token?: string;
3256      /**
3257       * The priority of this task.
3258       * Front-end tasks have higher priority than back-end tasks.
3259       * In tasks of the same mode, the smaller the number, the higher the priority.
3260       * The default is 0.
3261       *
3262       * @type { ?number }
3263       * @syscap SystemCapability.Request.FileTransferAgent
3264       * @since 11
3265       */
3266      priority?: number;
3267      /**
3268       * The extras for the configuration.
3269       *
3270       * @type { ?object }
3271       * @syscap SystemCapability.Request.FileTransferAgent
3272       * @since 10
3273       */
3274      /**
3275       * The extras for the configuration.
3276       *
3277       * @type { ?object }
3278       * @syscap SystemCapability.Request.FileTransferAgent
3279       * @crossplatform
3280       * @atomicservice
3281       * @since 11
3282       */
3283      extras?: object;
3284    }
3285
3286    /**
3287     * Indicate the current state of the task.
3288     *
3289     * @enum { number } State
3290     * @syscap SystemCapability.Request.FileTransferAgent
3291     * @since 10
3292     */
3293    /**
3294     * Indicate the current state of the task.
3295     *
3296     * @enum { number } State
3297     * @syscap SystemCapability.Request.FileTransferAgent
3298     * @crossplatform
3299     * @atomicservice
3300     * @since 11
3301     */
3302    enum State {
3303      /**
3304       * Indicates a task created by `new Task(Config)`.
3305       *
3306       * @syscap SystemCapability.Request.FileTransferAgent
3307       * @since 10
3308       */
3309      /**
3310       * Indicates a task created by `new Task(Config)`.
3311       *
3312       * @syscap SystemCapability.Request.FileTransferAgent
3313       * @crossplatform
3314       * @atomicservice
3315       * @since 11
3316       */
3317      INITIALIZED = 0x00,
3318      /**
3319       * Indicates a task lack of resources or conditions to run or retry.
3320       *
3321       * @syscap SystemCapability.Request.FileTransferAgent
3322       * @since 10
3323       */
3324      /**
3325       * Indicates a task lack of resources or conditions to run or retry.
3326       *
3327       * @syscap SystemCapability.Request.FileTransferAgent
3328       * @crossplatform
3329       * @atomicservice
3330       * @since 11
3331       */
3332      WAITING = 0x10,
3333      /**
3334       * Indicates a task in processing now.
3335       *
3336       * @syscap SystemCapability.Request.FileTransferAgent
3337       * @since 10
3338       */
3339      /**
3340       * Indicates a task in processing now.
3341       *
3342       * @syscap SystemCapability.Request.FileTransferAgent
3343       * @crossplatform
3344       * @atomicservice
3345       * @since 11
3346       */
3347      RUNNING = 0x20,
3348      /**
3349       * Indicates a task failed once at least and in processing again now.
3350       *
3351       * @syscap SystemCapability.Request.FileTransferAgent
3352       * @since 10
3353       */
3354      /**
3355       * Indicates a task failed once at least and in processing again now.
3356       *
3357       * @syscap SystemCapability.Request.FileTransferAgent
3358       * @crossplatform
3359       * @atomicservice
3360       * @since 11
3361       */
3362      RETRYING = 0x21,
3363      /**
3364       * Indicates a paused task which tends to be resumed for continuous work.
3365       *
3366       * @syscap SystemCapability.Request.FileTransferAgent
3367       * @since 10
3368       */
3369      /**
3370       * Indicates a paused task which tends to be resumed for continuous work.
3371       *
3372       * @syscap SystemCapability.Request.FileTransferAgent
3373       * @crossplatform
3374       * @atomicservice
3375       * @since 11
3376       */
3377      PAUSED = 0x30,
3378      /**
3379       * Indicates a stopped task which must be started again.
3380       *
3381       * @syscap SystemCapability.Request.FileTransferAgent
3382       * @since 10
3383       */
3384      /**
3385       * Indicates a stopped task which must be started again.
3386       *
3387       * @syscap SystemCapability.Request.FileTransferAgent
3388       * @crossplatform
3389       * @atomicservice
3390       * @since 11
3391       */
3392      STOPPED = 0x31,
3393      /**
3394       * Indicates a completed task which finish its data transfer.
3395       *
3396       * @syscap SystemCapability.Request.FileTransferAgent
3397       * @since 10
3398       */
3399      /**
3400       * Indicates a completed task which finish its data transfer.
3401       *
3402       * @syscap SystemCapability.Request.FileTransferAgent
3403       * @crossplatform
3404       * @atomicservice
3405       * @since 11
3406       */
3407      COMPLETED = 0x40,
3408      /**
3409       * Indicates a failed task which interrupted by some error.
3410       *
3411       * @syscap SystemCapability.Request.FileTransferAgent
3412       * @since 10
3413       */
3414      /**
3415       * Indicates a failed task which interrupted by some error.
3416       *
3417       * @syscap SystemCapability.Request.FileTransferAgent
3418       * @crossplatform
3419       * @atomicservice
3420       * @since 11
3421       */
3422      FAILED = 0x41,
3423      /**
3424       * Indicates a removed task which can not be processed again.
3425       *
3426       * @syscap SystemCapability.Request.FileTransferAgent
3427       * @since 10
3428       */
3429      /**
3430       * Indicates a removed task which can not be processed again.
3431       *
3432       * @syscap SystemCapability.Request.FileTransferAgent
3433       * @crossplatform
3434       * @atomicservice
3435       * @since 11
3436       */
3437      REMOVED = 0x50
3438    }
3439
3440    /**
3441     * The progress data structure.
3442     * Upload allows multiple files per upload task.
3443     * Only one file in a download task.
3444     * So using a unified data structure for progress.
3445     * Generally:
3446     * 1: sum(sizes) is total files size of the task.
3447     * 2: float(processed)/sizes[counter] is the progress for the current processing file.
3448     * 3: float(sum(sizes[:index])+processed)/sum(sizes) is the summary progress for a task.
3449     * If fetch file size in failure, the size of the file in sizes will be set as -1.
3450     *
3451     * @typedef Progress
3452     * @syscap SystemCapability.Request.FileTransferAgent
3453     * @since 10
3454     */
3455    /**
3456     * The progress data structure.
3457     * Upload allows multiple files per upload task.
3458     * Only one file in a download task.
3459     * So using a unified data structure for progress.
3460     * Generally:
3461     * 1: sum(sizes) is total files size of the task.
3462     * 2: float(processed)/sizes[counter] is the progress for the current processing file.
3463     * 3: float(sum(sizes[:index])+processed)/sum(sizes) is the summary progress for a task.
3464     * If fetch file size in failure, the size of the file in sizes will be set as -1.
3465     *
3466     * @typedef Progress
3467     * @syscap SystemCapability.Request.FileTransferAgent
3468     * @crossplatform
3469     * @atomicservice
3470     * @since 11
3471     */
3472    interface Progress {
3473      /**
3474       * The current state of the task.
3475       *
3476       * @type { State }
3477       * @readonly
3478       * @syscap SystemCapability.Request.FileTransferAgent
3479       * @since 10
3480       */
3481      /**
3482       * The current state of the task.
3483       *
3484       * @type { State }
3485       * @readonly
3486       * @syscap SystemCapability.Request.FileTransferAgent
3487       * @crossplatform
3488       * @atomicservice
3489       * @since 11
3490       */
3491      readonly state: State;
3492      /**
3493       * The current processing file index in a task.
3494       *
3495       * @type { number }
3496       * @readonly
3497       * @syscap SystemCapability.Request.FileTransferAgent
3498       * @since 10
3499       */
3500      /**
3501       * The current processing file index in a task.
3502       *
3503       * @type { number }
3504       * @readonly
3505       * @syscap SystemCapability.Request.FileTransferAgent
3506       * @crossplatform
3507       * @atomicservice
3508       * @since 11
3509       */
3510      readonly index: number;
3511      /**
3512       * The processed data size for the current file in a task.
3513       *
3514       * @type { number }
3515       * @readonly
3516       * @syscap SystemCapability.Request.FileTransferAgent
3517       * @since 10
3518       */
3519      /**
3520       * The processed data size for the current file in a task.
3521       *
3522       * @type { number }
3523       * @readonly
3524       * @syscap SystemCapability.Request.FileTransferAgent
3525       * @crossplatform
3526       * @atomicservice
3527       * @since 11
3528       */
3529      readonly processed: number;
3530      /**
3531       * The sizes of files in a task.
3532       *
3533       * @type { Array<number> }
3534       * @readonly
3535       * @syscap SystemCapability.Request.FileTransferAgent
3536       * @since 10
3537       */
3538      /**
3539       * The sizes of files in a task.
3540       *
3541       * @type { Array<number> }
3542       * @readonly
3543       * @syscap SystemCapability.Request.FileTransferAgent
3544       * @crossplatform
3545       * @atomicservice
3546       * @since 11
3547       */
3548      readonly sizes: Array<number>;
3549      /**
3550       * The extras for an interaction.
3551       * Such as headers and body of response from server.
3552       * But when the Content-Disposition header responded, the body will be into the uri of its attachment only, the body here is empty.
3553       * {"headers": {"key": v}, "body": "contents"}.
3554       *
3555       * @type { ?object }
3556       * @readonly
3557       * @syscap SystemCapability.Request.FileTransferAgent
3558       * @since 10
3559       */
3560      /**
3561       * The extras for an interaction.
3562       * Such as headers and body of response from server.
3563       * But when the Content-Disposition header responded, the body will be into the uri of its attachment only, the body here is empty.
3564       * {"headers": {"key": v}, "body": "contents"}.
3565       * The "body" field is not supported in cross-platform scenarios.
3566       *
3567       * @type { ?object }
3568       * @readonly
3569       * @syscap SystemCapability.Request.FileTransferAgent
3570       * @crossplatform
3571       * @atomicservice
3572       * @since 11
3573       */
3574      readonly extras?: object;
3575    }
3576
3577    /**
3578     * Indicates the reason for the failure.
3579     *
3580     * @enum { number }
3581     * @syscap SystemCapability.Request.FileTransferAgent
3582     * @since 10
3583     */
3584    /**
3585     * Indicates the reason for the failure.
3586     *
3587     * @enum { number }
3588     * @syscap SystemCapability.Request.FileTransferAgent
3589     * @crossplatform
3590     * @atomicservice
3591     * @since 11
3592     */
3593    enum Faults {
3594      /**
3595       * Indicates others failure.
3596       *
3597       * @syscap SystemCapability.Request.FileTransferAgent
3598       * @since 10
3599       */
3600      /**
3601       * Indicates others failure.
3602       *
3603       * @syscap SystemCapability.Request.FileTransferAgent
3604       * @crossplatform
3605       * @atomicservice
3606       * @since 11
3607       */
3608      OTHERS = 0xFF,
3609      /**
3610       * Indicates network disconnection.
3611       *
3612       * @syscap SystemCapability.Request.FileTransferAgent
3613       * @since 10
3614       */
3615      /**
3616       * Indicates network disconnection.
3617       *
3618       * @syscap SystemCapability.Request.FileTransferAgent
3619       * @crossplatform
3620       * @atomicservice
3621       * @since 11
3622       */
3623      DISCONNECTED = 0x00,
3624      /**
3625       * Indicates task timeout.
3626       *
3627       * @syscap SystemCapability.Request.FileTransferAgent
3628       * @since 10
3629       */
3630      /**
3631       * Indicates task timeout.
3632       *
3633       * @syscap SystemCapability.Request.FileTransferAgent
3634       * @crossplatform
3635       * @atomicservice
3636       * @since 11
3637       */
3638      TIMEOUT = 0x10,
3639      /**
3640       * Indicates protocol error, such as 5xx response from server.
3641       *
3642       * @syscap SystemCapability.Request.FileTransferAgent
3643       * @since 10
3644       */
3645      /**
3646       * Indicates protocol error, such as 5xx response from server.
3647       *
3648       * @syscap SystemCapability.Request.FileTransferAgent
3649       * @crossplatform
3650       * @atomicservice
3651       * @since 11
3652       */
3653      PROTOCOL = 0x20,
3654      /**
3655       * Indicates parameter error, such as url format error.
3656       *
3657       * @syscap SystemCapability.Request.FileTransferAgent
3658       * @crossplatform
3659       * @atomicservice
3660       * @since 12
3661       */
3662      PARAM = 0x30,
3663      /**
3664       * Indicates filesystem io error, such as open/seek/read/write/close.
3665       *
3666       * @syscap SystemCapability.Request.FileTransferAgent
3667       * @since 10
3668       */
3669      /**
3670       * Indicates filesystem io error, such as open/seek/read/write/close.
3671       *
3672       * @syscap SystemCapability.Request.FileTransferAgent
3673       * @crossplatform
3674       * @atomicservice
3675       * @since 11
3676       */
3677      FSIO = 0x40,
3678      /**
3679       * Indicates DNS resolution error.
3680       *
3681       * @syscap SystemCapability.Request.FileTransferAgent
3682       * @crossplatform
3683       * @atomicservice
3684       * @since 12
3685       */
3686      DNS = 0x50,
3687      /**
3688       * Indicates TCP connection error.
3689       *
3690       * @syscap SystemCapability.Request.FileTransferAgent
3691       * @crossplatform
3692       * @atomicservice
3693       * @since 12
3694       */
3695      TCP = 0x60,
3696      /**
3697       * Indicates SSL connection error, such as a certificate error or certificate verification failure.
3698       *
3699       * @syscap SystemCapability.Request.FileTransferAgent
3700       * @crossplatform
3701       * @atomicservice
3702       * @since 12
3703       */
3704      SSL = 0x70,
3705      /**
3706       * Indicates redirect error.
3707       *
3708       * @syscap SystemCapability.Request.FileTransferAgent
3709       * @crossplatform
3710       * @atomicservice
3711       * @since 12
3712       */
3713      REDIRECT = 0x80
3714    }
3715
3716    /**
3717     * The filter data structure.
3718     * Used for search, given fields works as **LOGICAL AND**.
3719     * Invalid value may cause a parameter error.
3720     *
3721     * @typedef Filter
3722     * @syscap SystemCapability.Request.FileTransferAgent
3723     * @since 10
3724     */
3725    /**
3726     * The filter data structure.
3727     * Used for search, given fields works as **LOGICAL AND**.
3728     * Invalid value may cause a parameter error.
3729     *
3730     * @typedef Filter
3731     * @syscap SystemCapability.Request.FileTransferAgent
3732     * @crossplatform
3733     * @since 11
3734     */
3735    interface Filter {
3736      /**
3737       * Specify the package name of an application.
3738       * Only for advanced search, common search will be fixed to the caller.
3739       * A "*" means any bundle.
3740       *
3741       * @type { ?string }
3742       * @syscap SystemCapability.Request.FileTransferAgent
3743       * @systemapi Hide this for inner system use.
3744       * @since 10
3745       */
3746      bundle?: string;
3747      /**
3748       * Specify the end Unix timestamp.
3749       * The default is the moment of calling.
3750       *
3751       * @type { ?number }
3752       * @syscap SystemCapability.Request.FileTransferAgent
3753       * @since 10
3754       */
3755      /**
3756       * Specify the end Unix timestamp.
3757       * The default is the moment of calling.
3758       *
3759       * @type { ?number }
3760       * @syscap SystemCapability.Request.FileTransferAgent
3761       * @crossplatform
3762       * @since 11
3763       */
3764      before?: number;
3765      /**
3766       * Specify the start Unix timestamp.
3767       * The default is "`before` - 24 hours".
3768       *
3769       * @type { ?number }
3770       * @syscap SystemCapability.Request.FileTransferAgent
3771       * @since 10
3772       */
3773      /**
3774       * Specify the start Unix timestamp.
3775       * The default is "`before` - 24 hours".
3776       *
3777       * @type { ?number }
3778       * @syscap SystemCapability.Request.FileTransferAgent
3779       * @crossplatform
3780       * @since 11
3781       */
3782      after?: number;
3783      /**
3784       * Specify the state of tasks.
3785       * The default is any state.
3786       *
3787       * @type { ?State }
3788       * @syscap SystemCapability.Request.FileTransferAgent
3789       * @since 10
3790       */
3791      /**
3792       * Specify the state of tasks.
3793       * The default is any state.
3794       *
3795       * @type { ?State }
3796       * @syscap SystemCapability.Request.FileTransferAgent
3797       * @crossplatform
3798       * @since 11
3799       */
3800      state?: State;
3801      /**
3802       * Specify the action of tasks, "upload" or "download", case insensitive.
3803       * The default is upload and download.
3804       *
3805       * @type { ?Action }
3806       * @syscap SystemCapability.Request.FileTransferAgent
3807       * @since 10
3808       */
3809      /**
3810       * Specify the action of tasks, "upload" or "download", case insensitive.
3811       * The default is upload and download.
3812       *
3813       * @type { ?Action }
3814       * @syscap SystemCapability.Request.FileTransferAgent
3815       * @crossplatform
3816       * @since 11
3817       */
3818      action?: Action;
3819      /**
3820       * Specify task's mode.
3821       * The default is frontend and background.
3822       *
3823       * @type { ?Mode }
3824       * @syscap SystemCapability.Request.FileTransferAgent
3825       * @since 10
3826       */
3827      /**
3828       * Specify task's mode.
3829       * The default is FOREGROUND and BACKGROUND.
3830       *
3831       * @type { ?Mode }
3832       * @syscap SystemCapability.Request.FileTransferAgent
3833       * @crossplatform
3834       * @since 11
3835       */
3836      mode?: Mode;
3837    }
3838
3839    /**
3840     * The task information data structure for query results.
3841     * Provides common query and advanced query, visible range of fields is different.
3842     *
3843     * @typedef TaskInfo
3844     * @syscap SystemCapability.Request.FileTransferAgent
3845     * @since 10
3846     */
3847    /**
3848     * The task information data structure for query results.
3849     * Provides common query and advanced query, visible range of fields is different.
3850     *
3851     * @typedef TaskInfo
3852     * @syscap SystemCapability.Request.FileTransferAgent
3853     * @crossplatform
3854     * @since 11
3855     */
3856    interface TaskInfo {
3857      /**
3858       * The UID of an application.
3859       * For system query only.
3860       *
3861       * @type { ?string }
3862       * @readonly
3863       * @syscap SystemCapability.Request.FileTransferAgent
3864       * @systemapi Hide this for inner system use.
3865       * @since 10
3866       */
3867      readonly uid?: string;
3868      /**
3869       * The bundle name.
3870       * For system query only.
3871       *
3872       * @type { ?string }
3873       * @readonly
3874       * @syscap SystemCapability.Request.FileTransferAgent
3875       * @systemapi Hide this for inner system use.
3876       * @since 10
3877       */
3878      readonly bundle?: string;
3879      /**
3880       * The path to save the downloaded file.
3881       *
3882       * @type { ?string }
3883       * @syscap SystemCapability.Request.FileTransferAgent
3884       * @since 10
3885       */
3886      /**
3887       * The path to save the downloaded file.
3888       *
3889       * @type { ?string }
3890       * @readonly
3891       * @syscap SystemCapability.Request.FileTransferAgent
3892       * @crossplatform
3893       * @since 11
3894       */
3895      readonly saveas?: string;
3896      /**
3897       * The url of a task.
3898       * For `${ show }` and `${ touch }`.
3899       * It is empty string in `${ query }`.
3900       *
3901       * @type { ?string }
3902       * @readonly
3903       * @syscap SystemCapability.Request.FileTransferAgent
3904       * @since 10
3905       */
3906      /**
3907       * The url of a task.
3908       * For `${ show }` and `${ touch }`.
3909       *
3910       * @type { ?string }
3911       * @readonly
3912       * @syscap SystemCapability.Request.FileTransferAgent
3913       * @crossplatform
3914       * @since 11
3915       */
3916      readonly url?: string;
3917      /**
3918       * The arguments.
3919       * For `${ show }` and `${ touch }`.
3920       * It is empty string in `${ query }`.
3921       *
3922       * @type { ?(string | Array<FormItem>) }
3923       * @syscap SystemCapability.Request.FileTransferAgent
3924       * @since 10
3925       */
3926      /**
3927       * The arguments.
3928       * For `${ show }` and `${ touch }`.
3929       *
3930       * @type { ?(string | Array<FormItem>) }
3931       * @readonly
3932       * @syscap SystemCapability.Request.FileTransferAgent
3933       * @crossplatform
3934       * @since 11
3935       */
3936      readonly data?: string | Array<FormItem>;
3937      /**
3938       * The task id.
3939       *
3940       * @type { string }
3941       * @readonly
3942       * @syscap SystemCapability.Request.FileTransferAgent
3943       * @since 10
3944       */
3945      /**
3946       * The task id.
3947       *
3948       * @type { string }
3949       * @readonly
3950       * @syscap SystemCapability.Request.FileTransferAgent
3951       * @crossplatform
3952       * @since 11
3953       */
3954      readonly tid: string;
3955      /**
3956       * The task title.
3957       *
3958       * @type { string }
3959       * @readonly
3960       * @syscap SystemCapability.Request.FileTransferAgent
3961       * @since 10
3962       */
3963      /**
3964       * The task title.
3965       *
3966       * @type { string }
3967       * @readonly
3968       * @syscap SystemCapability.Request.FileTransferAgent
3969       * @crossplatform
3970       * @since 11
3971       */
3972      readonly title: string;
3973      /**
3974       * The task details.
3975       *
3976       * @type { string }
3977       * @readonly
3978       * @syscap SystemCapability.Request.FileTransferAgent
3979       * @since 10
3980       */
3981      /**
3982       * The task details.
3983       *
3984       * @type { string }
3985       * @readonly
3986       * @syscap SystemCapability.Request.FileTransferAgent
3987       * @crossplatform
3988       * @since 11
3989       */
3990      readonly description: string;
3991      /**
3992       * The task action.
3993       *
3994       * @type { Action }
3995       * @readonly
3996       * @syscap SystemCapability.Request.FileTransferAgent
3997       * @since 10
3998       */
3999      /**
4000       * The task action.
4001       *
4002       * @type { Action }
4003       * @readonly
4004       * @syscap SystemCapability.Request.FileTransferAgent
4005       * @crossplatform
4006       * @since 11
4007       */
4008      readonly action: Action;
4009      /**
4010       * Specify task mode.
4011       * The default is frontend and background.
4012       *
4013       * @type { Mode }
4014       * @syscap SystemCapability.Request.FileTransferAgent
4015       * @since 10
4016       */
4017      /**
4018       * Specify task mode.
4019       * The default is frontend.
4020       *
4021       * @type { Mode }
4022       * @readonly
4023       * @syscap SystemCapability.Request.FileTransferAgent
4024       * @crossplatform
4025       * @since 11
4026       */
4027      readonly mode: Mode;
4028      /**
4029       * The priority of this task.
4030       * Front-end tasks have higher priority than back-end tasks.
4031       * In tasks of the same mode, the smaller the number, the higher the priority.
4032       * The default is 0.
4033       *
4034       * @type { number }
4035       * @readonly
4036       * @syscap SystemCapability.Request.FileTransferAgent
4037       * @since 11
4038       */
4039      readonly priority: number;
4040      /**
4041       * The MIME type in the configuration of the task.
4042       *
4043       * @type { string }
4044       * @readonly
4045       * @syscap SystemCapability.Request.FileTransferAgent
4046       * @since 10
4047       */
4048      /**
4049       * The MIME type in the configuration of the task.
4050       *
4051       * @type { string }
4052       * @readonly
4053       * @syscap SystemCapability.Request.FileTransferAgent
4054       * @crossplatform
4055       * @since 11
4056       */
4057      readonly mimeType: string;
4058      /**
4059       * An instance of `Progress` for a task.
4060       *
4061       * @type { Progress }
4062       * @readonly
4063       * @syscap SystemCapability.Request.FileTransferAgent
4064       * @since 10
4065       */
4066      /**
4067       * An instance of `Progress` for a task.
4068       *
4069       * @type { Progress }
4070       * @readonly
4071       * @syscap SystemCapability.Request.FileTransferAgent
4072       * @crossplatform
4073       * @since 11
4074       */
4075      readonly progress: Progress;
4076      /**
4077       * The progress notification policy of a background task.
4078       *
4079       * @type { boolean }
4080       * @readonly
4081       * @syscap SystemCapability.Request.FileTransferAgent
4082       * @since 10
4083       */
4084      readonly gauge: boolean;
4085      /**
4086       * The creating date and time of a task in Unix timestamp.
4087       * It is generated by system of current device.
4088       *
4089       * @type { number }
4090       * @readonly
4091       * @syscap SystemCapability.Request.FileTransferAgent
4092       * @since 10
4093       */
4094      /**
4095       * The creating date and time of a task in Unix timestamp.
4096       * It is generated by system of current device.
4097       *
4098       * @type { number }
4099       * @readonly
4100       * @syscap SystemCapability.Request.FileTransferAgent
4101       * @crossplatform
4102       * @since 11
4103       */
4104      readonly ctime: number;
4105      /**
4106       * The modified date and time of a task in Unix timestamp.
4107       * It is generated by system of current device.
4108       *
4109       * @type { number }
4110       * @readonly
4111       * @syscap SystemCapability.Request.FileTransferAgent
4112       * @since 10
4113       */
4114      /**
4115       * The modified date and time of a task in Unix timestamp.
4116       * It is generated by system of current device.
4117       *
4118       * @type { number }
4119       * @readonly
4120       * @syscap SystemCapability.Request.FileTransferAgent
4121       * @crossplatform
4122       * @since 11
4123       */
4124      readonly mtime: number;
4125      /**
4126       * The retry switch of a task.
4127       * Just for background, frontend always disabled.
4128       *
4129       * @type { boolean }
4130       * @readonly
4131       * @syscap SystemCapability.Request.FileTransferAgent
4132       * @since 10
4133       */
4134      readonly retry: boolean;
4135      /**
4136       * The tried times of a task.
4137       *
4138       * @type { number }
4139       * @readonly
4140       * @syscap SystemCapability.Request.FileTransferAgent
4141       * @since 10
4142       */
4143      readonly tries: number;
4144      /**
4145       * The faults case of a task.
4146       *
4147       * @type { Faults }
4148       * @readonly
4149       * @syscap SystemCapability.Request.FileTransferAgent
4150       * @since 10
4151       */
4152      /**
4153       * The faults case of a task.
4154       *
4155       * @type { Faults }
4156       * @readonly
4157       * @syscap SystemCapability.Request.FileTransferAgent
4158       * @crossplatform
4159       * @since 11
4160       */
4161      readonly faults: Faults;
4162      /**
4163       * The reason of a waiting/failed/stopped/paused task.
4164       *
4165       * @type { string }
4166       * @readonly
4167       * @syscap SystemCapability.Request.FileTransferAgent
4168       * @since 10
4169       */
4170      /**
4171       * The reason of a waiting/failed/stopped/paused task.
4172       *
4173       * @type { string }
4174       * @readonly
4175       * @syscap SystemCapability.Request.FileTransferAgent
4176       * @crossplatform
4177       * @since 11
4178       */
4179      readonly reason: string;
4180      /**
4181       * The extras of a task.
4182       * For background, the last response from server.
4183       * For frontend, nothing now.
4184       *
4185       * @type { ?object }
4186       * @readonly
4187       * @syscap SystemCapability.Request.FileTransferAgent
4188       * @since 10
4189       */
4190      /**
4191       * The extras of a task.
4192       * For frontend, nothing now.
4193       *
4194       * @type { ?object }
4195       * @readonly
4196       * @syscap SystemCapability.Request.FileTransferAgent
4197       * @crossplatform
4198       * @since 11
4199       */
4200      readonly extras?: object;
4201    }
4202
4203    /**
4204     * The HTTP response.
4205     *
4206     * @interface HttpResponse
4207     * @syscap SystemCapability.Request.FileTransferAgent
4208     * @atomicservice
4209     * @since 12
4210     */
4211    interface HttpResponse {
4212      /**
4213       * The version of the HTTP response.
4214       *
4215       * @type { string }
4216       * @readonly
4217       * @syscap SystemCapability.Request.FileTransferAgent
4218       * @atomicservice
4219       * @since 12
4220       */
4221      readonly version: string,
4222      /**
4223       * The status code of the HTTP response.
4224       *
4225       * @type { number }
4226       * @readonly
4227       * @syscap SystemCapability.Request.FileTransferAgent
4228       * @atomicservice
4229       * @since 12
4230       */
4231      readonly statusCode: number,
4232      /**
4233       * The reason of the HTTP response.
4234       *
4235       * @type { string }
4236       * @readonly
4237       * @syscap SystemCapability.Request.FileTransferAgent
4238       * @atomicservice
4239       * @since 12
4240       */
4241      readonly reason: string,
4242      /**
4243       * The headers of the HTTP response.
4244       *
4245       * @type { Map<string, Array<string>> }
4246       * @readonly
4247       * @syscap SystemCapability.Request.FileTransferAgent
4248       * @atomicservice
4249       * @since 12
4250       */
4251      readonly headers: Map<string, Array<string>>,
4252    }
4253
4254    /**
4255     * The task entry.
4256     * New task' status is "initialized" and enqueue.
4257     * Can `start` a initialized task.
4258     * Can `pause` a waiting/running/retrying background task.
4259     * Can `resume` a paused background task.
4260     * Can `stop` a running/waiting/retrying task and dequeue it.
4261     *
4262     * @typedef Task
4263     * @syscap SystemCapability.Request.FileTransferAgent
4264     * @since 10
4265     */
4266    /**
4267     * The task entry.
4268     * New task' status is "initialized" and enqueue.
4269     * Can `start` a initialized task.
4270     * Can `pause` a waiting/running/retrying background task.
4271     * Can `resume` a paused background task.
4272     * Can `stop` a running/waiting/retrying task and dequeue it.
4273     *
4274     * @typedef Task
4275     * @syscap SystemCapability.Request.FileTransferAgent
4276     * @crossplatform
4277     * @atomicservice
4278     * @since 11
4279     */
4280    interface Task {
4281      /**
4282       * The task id, unique on system.
4283       * Generated automatically by system.
4284       *
4285       * @type { string }
4286       * @readonly
4287       * @syscap SystemCapability.Request.FileTransferAgent
4288       * @since 10
4289       */
4290      /**
4291       * The task id, unique on system.
4292       * Generated automatically by system.
4293       *
4294       * @type { string }
4295       * @readonly
4296       * @syscap SystemCapability.Request.FileTransferAgent
4297       * @crossplatform
4298       * @atomicservice
4299       * @since 11
4300       */
4301      readonly tid: string;
4302      /**
4303       * The configurations for the task.
4304       *
4305       * @type { Config }
4306       * @syscap SystemCapability.Request.FileTransferAgent
4307       * @since 10
4308       */
4309      /**
4310       * The configurations for the task.
4311       *
4312       * @type { Config }
4313       * @syscap SystemCapability.Request.FileTransferAgent
4314       * @crossplatform
4315       * @atomicservice
4316       * @since 11
4317       */
4318      config: Config;
4319      /**
4320       * Enable the specified callback for a frontend task.
4321       *
4322       * @param { 'progress' } event event types.
4323       * @param { function } callback callback function with a `Progress` argument.
4324       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4325       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4326       * @throws { BusinessError } 21900005 - task mode error.
4327       * @syscap SystemCapability.Request.FileTransferAgent
4328       * @since 10
4329       */
4330      /**
4331       * Enables the specified callback.
4332       *
4333       * @param { 'progress' } event - event types.
4334       * @param { function } callback - callback function with a `Progress` argument.
4335       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4336       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4337       * @syscap SystemCapability.Request.FileTransferAgent
4338       * @crossplatform
4339       * @atomicservice
4340       * @since 11
4341       */
4342      on(event: 'progress', callback: (progress: Progress) => void): void;
4343      /**
4344       * Disable the specified callback for a frontend task.
4345       *
4346       * @param { 'progress' } event event types.
4347       * @param { function } callback callback function with a `Progress` argument.
4348       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4349       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4350       * @throws { BusinessError } 21900005 - task mode error.
4351       * @syscap SystemCapability.Request.FileTransferAgent
4352       * @since 10
4353       */
4354      /**
4355       * Disables the specified callback.
4356       *
4357       * @param { 'progress' } event - event types.
4358       * @param { function } callback - callback function with a `Progress` argument.
4359       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4360       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4361       * @syscap SystemCapability.Request.FileTransferAgent
4362       * @crossplatform
4363       * @atomicservice
4364       * @since 11
4365       */
4366      off(event: 'progress', callback?: (progress: Progress) => void): void;
4367      /**
4368       * Enable the specified callback for a frontend task.
4369       *
4370       * @param { 'completed' } event event types.
4371       * @param { function } callback callback function with a `Progress` argument.
4372       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4373       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4374       * @throws { BusinessError } 21900005 - task mode error.
4375       * @syscap SystemCapability.Request.FileTransferAgent
4376       * @since 10
4377       */
4378      /**
4379       * Enables the specified callback.
4380       *
4381       * @param { 'completed' } event - event types.
4382       * @param { function } callback - callback function with a `Progress` argument.
4383       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4384       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4385       * @syscap SystemCapability.Request.FileTransferAgent
4386       * @crossplatform
4387       * @atomicservice
4388       * @since 11
4389       */
4390      on(event: 'completed', callback: (progress: Progress) => void): void;
4391      /**
4392       * Disable the specified callback for a frontend task.
4393       *
4394       * @param { 'completed' } event event types.
4395       * @param { function } callback callback function with a `Progress` argument.
4396       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4397       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4398       * @throws { BusinessError } 21900005 - task mode error.
4399       * @syscap SystemCapability.Request.FileTransferAgent
4400       * @since 10
4401       */
4402      /**
4403       * Disables the specified callback.
4404       *
4405       * @param { 'completed' } event - event types.
4406       * @param { function } callback - callback function with a `Progress` argument.
4407       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4408       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4409       * @syscap SystemCapability.Request.FileTransferAgent
4410       * @crossplatform
4411       * @atomicservice
4412       * @since 11
4413       */
4414      off(event: 'completed', callback?: (progress: Progress) => void): void;
4415      /**
4416       * Enable the specified callback for a frontend task.
4417       *
4418       * @param { 'failed' } event event types.
4419       * @param { function } callback callback function with a `Progress` argument.
4420       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4421       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4422       * @throws { BusinessError } 21900005 - task mode error.
4423       * @syscap SystemCapability.Request.FileTransferAgent
4424       * @since 10
4425       */
4426      /**
4427       * Enables the specified callback.
4428       *
4429       * @param { 'failed' } event - event types.
4430       * @param { function } callback - callback function with a `Progress` argument.
4431       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4432       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4433       * @syscap SystemCapability.Request.FileTransferAgent
4434       * @crossplatform
4435       * @atomicservice
4436       * @since 11
4437       */
4438      on(event: 'failed', callback: (progress: Progress) => void): void;
4439      /**
4440       * Disable the specified callback for a frontend task.
4441       *
4442       * @param { 'failed' } event event types.
4443       * @param { function } callback callback function with a `Progress` argument.
4444       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4445       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4446       * @throws { BusinessError } 21900005 - task mode error.
4447       * @syscap SystemCapability.Request.FileTransferAgent
4448       * @since 10
4449       */
4450      /**
4451       * Disables the specified callback.
4452       *
4453       * @param { 'failed' } event - event types.
4454       * @param { function } callback - callback function with a `Progress` argument.
4455       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4456       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4457       * @syscap SystemCapability.Request.FileTransferAgent
4458       * @crossplatform
4459       * @atomicservice
4460       * @since 11
4461       */
4462      off(event: 'failed', callback?: (progress: Progress) => void): void;
4463      /**
4464       * Enables the specified callback.
4465       *
4466       * @param { 'pause' } event - event types.
4467       * @param { function } callback - callback function with a `Progress` argument.
4468       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4469       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4470       * @syscap SystemCapability.Request.FileTransferAgent
4471       * @since 11
4472       */
4473      on(event: 'pause', callback: (progress: Progress) => void): void;
4474      /**
4475       * Disables the specified callback.
4476       *
4477       * @param { 'pause' } event - event types.
4478       * @param { function } callback - callback function with a `Progress` argument.
4479       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4480       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4481       * @syscap SystemCapability.Request.FileTransferAgent
4482       * @since 11
4483       */
4484      off(event: 'pause', callback?: (progress: Progress) => void): void;
4485      /**
4486       * Enables the specified callback.
4487       *
4488       * @param { 'resume' } event - event types.
4489       * @param { function } callback - callback function with a `Progress` argument.
4490       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4491       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4492       * @syscap SystemCapability.Request.FileTransferAgent
4493       * @since 11
4494       */
4495      on(event: 'resume', callback: (progress: Progress) => void): void;
4496      /**
4497       * Disables the specified callback.
4498       *
4499       * @param { 'resume' } event - event types.
4500       * @param { function } callback - callback function with a `Progress` argument.
4501       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4502       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4503       * @syscap SystemCapability.Request.FileTransferAgent
4504       * @since 11
4505       */
4506      off(event: 'resume', callback?: (progress: Progress) => void): void;
4507      /**
4508       * Enables the specified callback.
4509       *
4510       * @param { 'remove' } event - event types.
4511       * @param { function } callback - callback function with a `Progress` argument.
4512       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4513       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4514       * @syscap SystemCapability.Request.FileTransferAgent
4515       * @since 11
4516       */
4517      on(event: 'remove', callback: (progress: Progress) => void): void;
4518      /**
4519       * Disables the specified callback.
4520       *
4521       * @param { 'remove' } event - event types.
4522       * @param { function } callback - callback function with a `Progress` argument.
4523       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4524       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4525       * @syscap SystemCapability.Request.FileTransferAgent
4526       * @since 11
4527       */
4528      off(event: 'remove', callback?: (progress: Progress) => void): void;
4529      /**
4530       * Enables the response callback.
4531       *
4532       * @param { 'response' } event - event types.
4533       * @param { Callback<HttpResponse> } callback - callback function with an `HttpResponse` argument.
4534       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4535       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4536       * @syscap SystemCapability.Request.FileTransferAgent
4537       * @atomicservice
4538       * @since 12
4539       */
4540      on(event: 'response', callback: Callback<HttpResponse>): void;
4541      /**
4542       * Disables the response callback.
4543       *
4544       * @param { 'response' } event - event types.
4545       * @param { Callback<HttpResponse> } callback - callback function with an `HttpResponse` argument.
4546       * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing mandatory parameters.
4547       * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4548       * @syscap SystemCapability.Request.FileTransferAgent
4549       * @atomicservice
4550       * @since 12
4551       */
4552      off(event: 'response', callback?: Callback<HttpResponse>): void;
4553      /**
4554       * Starts the task.
4555       *
4556       * @permission ohos.permission.INTERNET
4557       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4558       * @throws { BusinessError } 201 - Permission denied.
4559       * @throws { BusinessError } 13400003 - task service ability error.
4560       * @throws { BusinessError } 21900007 - task state error.
4561       * @syscap SystemCapability.Request.FileTransferAgent
4562       * @since 10
4563       */
4564      /**
4565       * Starts the task.
4566       *
4567       * @permission ohos.permission.INTERNET
4568       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4569       * @throws { BusinessError } 201 - Permission denied.
4570       * @throws { BusinessError } 13400003 - task service ability error.
4571       * @throws { BusinessError } 21900007 - task state error.
4572       * @syscap SystemCapability.Request.FileTransferAgent
4573       * @crossplatform
4574       * @atomicservice
4575       * @since 11
4576       */
4577      /**
4578       * Starts the task. The following tasks can be started:
4579       * 1. Tasks just created.
4580       * 2. Download tasks that are stopped or become FAILED.
4581       *
4582       * @permission ohos.permission.INTERNET
4583       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4584       * @throws { BusinessError } 201 - Permission denied.
4585       * @throws { BusinessError } 13400003 - task service ability error.
4586       * @throws { BusinessError } 21900007 - task state error.
4587       * @syscap SystemCapability.Request.FileTransferAgent
4588       * @crossplatform
4589       * @atomicservice
4590       * @since 12
4591       */
4592      start(callback: AsyncCallback<void>): void;
4593      /**
4594       * Starts the task.
4595       *
4596       * @permission ohos.permission.INTERNET
4597       * @returns { Promise<void> } the promise returned by the function.
4598       * @throws { BusinessError } 201 - Permission denied.
4599       * @throws { BusinessError } 13400003 - task service ability error.
4600       * @throws { BusinessError } 21900007 - task state error.
4601       * @syscap SystemCapability.Request.FileTransferAgent
4602       * @since 10
4603       */
4604      /**
4605       * Starts the task.
4606       *
4607       * @permission ohos.permission.INTERNET
4608       * @returns { Promise<void> } the promise returned by the function.
4609       * @throws { BusinessError } 201 - Permission denied.
4610       * @throws { BusinessError } 13400003 - task service ability error.
4611       * @throws { BusinessError } 21900007 - task state error.
4612       * @syscap SystemCapability.Request.FileTransferAgent
4613       * @crossplatform
4614       * @atomicservice
4615       * @since 11
4616       */
4617      /**
4618       * Starts the task. The following tasks can be started:
4619       * 1. Tasks just created.
4620       * 2. Download tasks that are stopped or become FAILED.
4621       *
4622       * @permission ohos.permission.INTERNET
4623       * @returns { Promise<void> } the promise returned by the function.
4624       * @throws { BusinessError } 201 - Permission denied.
4625       * @throws { BusinessError } 13400003 - task service ability error.
4626       * @throws { BusinessError } 21900007 - task state error.
4627       * @syscap SystemCapability.Request.FileTransferAgent
4628       * @crossplatform
4629       * @atomicservice
4630       * @since 12
4631       */
4632      start(): Promise<void>;
4633      /**
4634       * Pauses the background task.
4635       *
4636       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4637       * @throws { BusinessError } 13400003 - task service ability error.
4638       * @throws { BusinessError } 21900005 - task mode error.
4639       * @throws { BusinessError } 21900007 - task state error.
4640       * @syscap SystemCapability.Request.FileTransferAgent
4641       * @since 10
4642       */
4643      /**
4644       * Pauses the task.
4645       *
4646       * @param { AsyncCallback<void> } callback - callback function with a boolean argument indicating the calling result.
4647       * @throws { BusinessError } 13400003 - task service ability error.
4648       * @throws { BusinessError } 21900007 - task state error.
4649       * @syscap SystemCapability.Request.FileTransferAgent
4650       * @since 11
4651       */
4652      pause(callback: AsyncCallback<void>): void;
4653      /**
4654       * Pauses the background task.
4655       *
4656       * @returns { Promise<void> } the promise returned by the function.
4657       * @throws { BusinessError } 13400003 - task service ability error.
4658       * @throws { BusinessError } 21900005 - task mode error.
4659       * @throws { BusinessError } 21900007 - task state error.
4660       * @syscap SystemCapability.Request.FileTransferAgent
4661       * @since 10
4662       */
4663      /**
4664       * Pauses the task.
4665       *
4666       * @returns { Promise<void> } the promise returned by the function.
4667       * @throws { BusinessError } 13400003 - task service ability error.
4668       * @throws { BusinessError } 21900007 - task state error.
4669       * @syscap SystemCapability.Request.FileTransferAgent
4670       * @since 11
4671       */
4672      pause(): Promise<void>;
4673      /**
4674       * Resumes the background task.
4675       *
4676       * @permission ohos.permission.INTERNET
4677       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4678       * @throws { BusinessError } 201 - Permission denied.
4679       * @throws { BusinessError } 13400003 - task service ability error.
4680       * @throws { BusinessError } 21900005 - task mode error.
4681       * @throws { BusinessError } 21900007 - task state error.
4682       * @syscap SystemCapability.Request.FileTransferAgent
4683       * @since 10
4684       */
4685      /**
4686       * Resumes the task.
4687       *
4688       * @permission ohos.permission.INTERNET
4689       * @param { AsyncCallback<void> } callback - callback function with a boolean argument indicating the calling result.
4690       * @throws { BusinessError } 201 - Permission denied.
4691       * @throws { BusinessError } 13400003 - task service ability error.
4692       * @throws { BusinessError } 21900007 - task state error.
4693       * @syscap SystemCapability.Request.FileTransferAgent
4694       * @since 11
4695       */
4696      resume(callback: AsyncCallback<void>): void;
4697      /**
4698       * Resumes the background task.
4699       *
4700       * @permission ohos.permission.INTERNET
4701       * @returns { Promise<void> } the promise returned by the function.
4702       * @throws { BusinessError } 201 - Permission denied.
4703       * @throws { BusinessError } 13400003 - task service ability error.
4704       * @throws { BusinessError } 21900005 - task mode error.
4705       * @throws { BusinessError } 21900007 - task state error.
4706       * @syscap SystemCapability.Request.FileTransferAgent
4707       * @since 10
4708       */
4709      /**
4710       * Resumes the task.
4711       *
4712       * @permission ohos.permission.INTERNET
4713       * @returns { Promise<void> } the promise returned by the function.
4714       * @throws { BusinessError } 201 - Permission denied.
4715       * @throws { BusinessError } 13400003 - task service ability error.
4716       * @throws { BusinessError } 21900007 - task state error.
4717       * @syscap SystemCapability.Request.FileTransferAgent
4718       * @since 11
4719       */
4720      resume(): Promise<void>;
4721      /**
4722       * Stops the task.
4723       *
4724       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4725       * @throws { BusinessError } 13400003 - task service ability error.
4726       * @throws { BusinessError } 21900007 - task state error.
4727       * @syscap SystemCapability.Request.FileTransferAgent
4728       * @since 10
4729       */
4730      /**
4731       * Stops the task.
4732       *
4733       * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating the calling result.
4734       * @throws { BusinessError } 13400003 - task service ability error.
4735       * @throws { BusinessError } 21900007 - task state error.
4736       * @syscap SystemCapability.Request.FileTransferAgent
4737       * @crossplatform
4738       * @atomicservice
4739       * @since 11
4740       */
4741      stop(callback: AsyncCallback<void>): void;
4742      /**
4743       * Stops the task.
4744       *
4745       * @returns { Promise<void> } the promise returned by the function.
4746       * @throws { BusinessError } 13400003 - task service ability error.
4747       * @throws { BusinessError } 21900007 - task state error.
4748       * @syscap SystemCapability.Request.FileTransferAgent
4749       * @since 10
4750       */
4751      /**
4752       * Stops the task.
4753       *
4754       * @returns { Promise<void> } the promise returned by the function.
4755       * @throws { BusinessError } 13400003 - task service ability error.
4756       * @throws { BusinessError } 21900007 - task state error.
4757       * @syscap SystemCapability.Request.FileTransferAgent
4758       * @crossplatform
4759       * @atomicservice
4760       * @since 11
4761       */
4762      stop(): Promise<void>;
4763    }
4764
4765    /**
4766     * Creates a task for upload or download and enqueue it.
4767     * Only foreground application can create the frontend task.
4768     * It can deal only one frontend task at a time.
4769     * A in processing frontend task will be forced to stop when its application had switched to background.
4770     * A new frontend task will interrupt a existed in processing frontend task.
4771     * The background task is highly recommended.
4772     *
4773     * @permission ohos.permission.INTERNET
4774     * @param { BaseContext } context context of the caller.
4775     * @param { Config } config configurations for a task.
4776     * @param { AsyncCallback<Task> } callback indicate the callback function to receive Task.
4777     * @throws { BusinessError } 201 - permission denied.
4778     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4779     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4780     * @throws { BusinessError } 13400001 - file operation error.
4781     * @throws { BusinessError } 13400003 - task service ability error.
4782     * @throws { BusinessError } 21900004 - the application task queue is full.
4783     * @throws { BusinessError } 21900005 - task mode error.
4784     * @syscap SystemCapability.Request.FileTransferAgent
4785     * @since 10
4786     */
4787    /**
4788     * Creates a task for upload or download and enqueue it.
4789     * When an application enters the background, the frontend tasks associated
4790     * with it will gradually be paused until the application returns to the foreground.
4791     *
4792     * @permission ohos.permission.INTERNET
4793     * @param { BaseContext } context context of the caller.
4794     * @param { Config } config configurations for a task.
4795     * @param { AsyncCallback<Task> } callback indicate the callback function to receive Task.
4796     * @throws { BusinessError } 201 - permission denied.
4797     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4798     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4799     * @throws { BusinessError } 13400001 - file operation error.
4800     * @throws { BusinessError } 13400003 - task service ability error.
4801     * @throws { BusinessError } 21900004 - the application task queue is full.
4802     * @throws { BusinessError } 21900005 - task mode error.
4803     * @syscap SystemCapability.Request.FileTransferAgent
4804     * @crossplatform
4805     * @atomicservice
4806     * @since 11
4807     */
4808    function create(context: BaseContext, config: Config, callback: AsyncCallback<Task>): void;
4809
4810    /**
4811     * Creates a task for upload or download and enqueue it.
4812     * Only foreground application can create the frontend task.
4813     * It can deal only one frontend task at a time.
4814     * A in processing frontend task will be forced to stop when its application had switched to background.
4815     * A new frontend task will interrupt a existed in processing frontend task.
4816     * The background task is highly recommended.
4817     *
4818     * @permission ohos.permission.INTERNET
4819     * @param { BaseContext } context context of the caller.
4820     * @param { Config } config configurations for a task.
4821     * @returns { Promise<Task> } the promise returned by the function.
4822     * @throws { BusinessError } 201 - permission denied.
4823     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4824     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4825     * @throws { BusinessError } 13400001 - file operation error.
4826     * @throws { BusinessError } 13400003 - task service ability error.
4827     * @throws { BusinessError } 21900004 - the application task queue is full.
4828     * @throws { BusinessError } 21900005 - task mode error.
4829     * @syscap SystemCapability.Request.FileTransferAgent
4830     * @since 10
4831     */
4832    /**
4833     * Creates a task for upload or download and enqueue it.
4834     * When an application enters the background, the frontend tasks associated.
4835     * with it will gradually be paused until the application returns to the foreground.
4836     *
4837     * @permission ohos.permission.INTERNET
4838     * @param { BaseContext } context context of the caller.
4839     * @param { Config } config configurations for a task.
4840     * @returns { Promise<Task> } the promise returned by the function.
4841     * @throws { BusinessError } 201 - permission denied.
4842     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4843     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4844     * @throws { BusinessError } 13400001 - file operation error.
4845     * @throws { BusinessError } 13400003 - task service ability error.
4846     * @throws { BusinessError } 21900004 - the application task queue is full.
4847     * @throws { BusinessError } 21900005 - task mode error.
4848     * @syscap SystemCapability.Request.FileTransferAgent
4849     * @crossplatform
4850     * @atomicservice
4851     * @since 11
4852     */
4853    function create(context: BaseContext, config: Config): Promise<Task>;
4854
4855    /**
4856     * Gets the task with the specified id.
4857     *
4858     * @param { BaseContext } context - context of the caller.
4859     * @param { string } id - the id of the task.
4860     * @param { string } token - the token of the task, length between 8 and 2048 bytes.
4861     * @returns { Promise<Task> } the promise returned by the function.
4862     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4863     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4864     * @throws { BusinessError } 13400003 - task service ability error.
4865     * @throws { BusinessError } 21900006 - task not found.
4866     * @syscap SystemCapability.Request.FileTransferAgent
4867     * @since 11
4868     */
4869    function getTask(context: BaseContext, id: string, token?: string): Promise<Task>;
4870
4871    /**
4872     * Removes specified task belongs to the caller.
4873     * The task will be forced to stop if in processing.
4874     *
4875     * @param { string } id the task id.
4876     * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating success or not.
4877     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4878     * <br>2. Incorrect parameter type.
4879     * @throws { BusinessError } 13400003 - task service ability error.
4880     * @throws { BusinessError } 21900006 - task not found.
4881     * @syscap SystemCapability.Request.FileTransferAgent
4882     * @since 10
4883     */
4884    /**
4885     * Removes specified task belongs to the caller.
4886     * The task will be forced to stop if in processing.
4887     *
4888     * @param { string } id the task id.
4889     * @param { AsyncCallback<void> } callback callback function with a boolean argument indicating success or not.
4890     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4891     * <br>2. Incorrect parameter type.
4892     * @throws { BusinessError } 13400003 - task service ability error.
4893     * @throws { BusinessError } 21900006 - task not found.
4894     * @syscap SystemCapability.Request.FileTransferAgent
4895     * @crossplatform
4896     * @atomicservice
4897     * @since 11
4898     */
4899    function remove(id: string, callback: AsyncCallback<void>): void;
4900
4901    /**
4902     * Removes specified task belongs to the caller.
4903     * The task will be forced to stop if in processing.
4904     *
4905     * @param { string } id the task id.
4906     * @returns { Promise<void> } the promise returned by the function.
4907     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4908     * <br>2. Incorrect parameter type.
4909     * @throws { BusinessError } 13400003 - task service ability error.
4910     * @throws { BusinessError } 21900006 - task not found.
4911     * @syscap SystemCapability.Request.FileTransferAgent
4912     * @since 10
4913     */
4914    /**
4915     * Removes specified task belongs to the caller.
4916     * The task will be forced to stop if in processing.
4917     *
4918     * @param { string } id the task id.
4919     * @returns { Promise<void> } the promise returned by the function.
4920     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4921     * <br>2. Incorrect parameter type.
4922     * @throws { BusinessError } 13400003 - task service ability error.
4923     * @throws { BusinessError } 21900006 - task not found.
4924     * @syscap SystemCapability.Request.FileTransferAgent
4925     * @crossplatform
4926     * @atomicservice
4927     * @since 11
4928     */
4929    function remove(id: string): Promise<void>;
4930
4931    /**
4932     * Shows specified task details belongs to the caller.
4933     *
4934     * @param { string } id the task id.
4935     * @param { AsyncCallback<TaskInfo> } callback callback function with a `TaskInfo` argument for informations of the current task.
4936     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4937     * <br>2. Incorrect parameter type.
4938     * @throws { BusinessError } 13400003 - task service ability error.
4939     * @throws { BusinessError } 21900006 - task not found.
4940     * @syscap SystemCapability.Request.FileTransferAgent
4941     * @since 10
4942     */
4943    /**
4944     * Shows specified task details belongs to the caller.
4945     *
4946     * @param { string } id the task id.
4947     * @param { AsyncCallback<TaskInfo> } callback callback function with a `TaskInfo` argument for informations of the current task.
4948     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4949     * <br>2. Incorrect parameter type.
4950     * @throws { BusinessError } 13400003 - task service ability error.
4951     * @throws { BusinessError } 21900006 - task not found.
4952     * @syscap SystemCapability.Request.FileTransferAgent
4953     * @crossplatform
4954     * @since 11
4955     */
4956    function show(id: string, callback: AsyncCallback<TaskInfo>): void;
4957
4958    /**
4959     * Shows specified task details belongs to the caller.
4960     *
4961     * @param { string } id the task id.
4962     * @returns { Promise<TaskInfo> } the promise returned by the function.
4963     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4964     * <br>2. Incorrect parameter type.
4965     * @throws { BusinessError } 13400003 - task service ability error.
4966     * @throws { BusinessError } 21900006 - task not found.
4967     * @syscap SystemCapability.Request.FileTransferAgent
4968     * @since 10
4969     */
4970    /**
4971     * Shows specified task details belongs to the caller.
4972     *
4973     * @param { string } id the task id.
4974     * @returns { Promise<TaskInfo> } the promise returned by the function.
4975     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4976     * <br>2. Incorrect parameter type.
4977     * @throws { BusinessError } 13400003 - task service ability error.
4978     * @throws { BusinessError } 21900006 - task not found.
4979     * @syscap SystemCapability.Request.FileTransferAgent
4980     * @crossplatform
4981     * @since 11
4982     */
4983    function show(id: string): Promise<TaskInfo>;
4984
4985    /**
4986     * Touches specified task with token.
4987     *
4988     * @param { string } id the task id.
4989     * @param { string } token the in-application isolation key.
4990     * @param { AsyncCallback<TaskInfo> } callback callback function with a `TaskInfo` argument for informations of the current task.
4991     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
4992     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
4993     * @throws { BusinessError } 13400003 - task service ability error.
4994     * @throws { BusinessError } 21900006 - task not found.
4995     * @syscap SystemCapability.Request.FileTransferAgent
4996     * @since 10
4997     */
4998    /**
4999     * Touches specified task with token.
5000     *
5001     * @param { string } id the task id.
5002     * @param { string } token the in-application isolation key, length between 8 and 2048 bytes.
5003     * @param { AsyncCallback<TaskInfo> } callback callback function with a `TaskInfo` argument for informations of the current task.
5004     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
5005     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
5006     * @throws { BusinessError } 13400003 - task service ability error.
5007     * @throws { BusinessError } 21900006 - task not found.
5008     * @syscap SystemCapability.Request.FileTransferAgent
5009     * @crossplatform
5010     * @since 11
5011     */
5012    function touch(id: string, token: string, callback: AsyncCallback<TaskInfo>): void;
5013
5014    /**
5015     * Touches specified task with token.
5016     *
5017     * @param { string } id the task id.
5018     * @param { string } token the in-application isolation key, length between 8 and 2048 bytes.
5019     * @returns { Promise<TaskInfo> } the promise returned by the function.
5020     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
5021     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
5022     * @throws { BusinessError } 13400003 - task service ability error.
5023     * @throws { BusinessError } 21900006 - task not found.
5024     * @syscap SystemCapability.Request.FileTransferAgent
5025     * @since 10
5026     */
5027    /**
5028     * Touches specified task with token.
5029     *
5030     * @param { string } id the task id.
5031     * @param { string } token the in-application isolation key, length between 8 and 2048 bytes.
5032     * @returns { Promise<TaskInfo> } the promise returned by the function.
5033     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
5034     * <br>2. Incorrect parameter type. 3. Parameter verification failed.
5035     * @throws { BusinessError } 13400003 - task service ability error.
5036     * @throws { BusinessError } 21900006 - task not found.
5037     * @syscap SystemCapability.Request.FileTransferAgent
5038     * @crossplatform
5039     * @since 11
5040     */
5041    function touch(id: string, token: string): Promise<TaskInfo>;
5042
5043    /**
5044     * Searches tasks, for system.
5045     *
5046     * @param { AsyncCallback<Array<string>> } callback callback function with a `Array<string>` argument contains task ids match filter.
5047     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter type.
5048     * <br>2. Parameter verification failed.
5049     * @throws { BusinessError } 13400003 - task service ability error.
5050     * @syscap SystemCapability.Request.FileTransferAgent
5051     * @since 10
5052     */
5053    /**
5054     * Searches tasks, for system.
5055     *
5056     * @param { AsyncCallback<Array<string>> } callback callback function with a `Array<string>` argument contains task ids match filter.
5057     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter type.
5058     * <br>2. Parameter verification failed.
5059     * @throws { BusinessError } 13400003 - task service ability error.
5060     * @syscap SystemCapability.Request.FileTransferAgent
5061     * @crossplatform
5062     * @since 11
5063     */
5064    function search(callback: AsyncCallback<Array<string>>): void;
5065
5066    /**
5067     * Searches tasks, for system.
5068     *
5069     * @param { Filter } filter an instance of `Filter`.
5070     * @param { AsyncCallback<Array<string>> } callback callback function with a `Array<string>` argument contains task ids match filter.
5071     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter type.
5072     * <br>2. Parameter verification failed.
5073     * @throws { BusinessError } 13400003 - task service ability error.
5074     * @syscap SystemCapability.Request.FileTransferAgent
5075     * @since 10
5076     */
5077    /**
5078     * Searches tasks, for system.
5079     *
5080     * @param { Filter } filter an instance of `Filter`.
5081     * @param { AsyncCallback<Array<string>> } callback callback function with a `Array<string>` argument contains task ids match filter.
5082     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter type.
5083     * <br>2. Parameter verification failed.
5084     * @throws { BusinessError } 13400003 - task service ability error.
5085     * @syscap SystemCapability.Request.FileTransferAgent
5086     * @crossplatform
5087     * @since 11
5088     */
5089    function search(filter: Filter, callback: AsyncCallback<Array<string>>): void;
5090
5091    /**
5092     * Searches tasks, for system.
5093     *
5094     * @param { Filter } filter an instance of `Filter`.
5095     * @returns { Promise<Array<string>> } the promise returned by the function.
5096     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter type.
5097     * <br>2. Parameter verification failed.
5098     * @throws { BusinessError } 13400003 - task service ability error.
5099     * @syscap SystemCapability.Request.FileTransferAgent
5100     * @since 10
5101     */
5102    /**
5103     * Searches tasks, for system.
5104     *
5105     * @param { Filter } filter an instance of `Filter`.
5106     * @returns { Promise<Array<string>> } the promise returned by the function.
5107     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter type.
5108     * <br>2. Parameter verification failed.
5109     * @throws { BusinessError } 13400003 - task service ability error.
5110     * @syscap SystemCapability.Request.FileTransferAgent
5111     * @crossplatform
5112     * @since 11
5113     */
5114    function search(filter?: Filter): Promise<Array<string>>;
5115
5116    /**
5117     * Queries specified task details.
5118     *
5119     * @permission ohos.permission.DOWNLOAD_SESSION_MANAGER or ohos.permission.UPLOAD_SESSION_MANAGER
5120     * @param { string } id the task id.
5121     * @param { AsyncCallback<TaskInfo> } callback callback function with a `TaskInfo` argument for informations of the current task.
5122     * @throws { BusinessError } 201 - permission denied.
5123     * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
5124     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
5125     * <br>2. Incorrect parameter type.
5126     * @throws { BusinessError } 13400003 - task service ability error.
5127     * @throws { BusinessError } 21900006 - task not found.
5128     * @syscap SystemCapability.Request.FileTransferAgent
5129     * @systemapi Hide this for inner system use.
5130     * @since 10
5131     */
5132    function query(id: string, callback: AsyncCallback<TaskInfo>): void;
5133
5134    /**
5135     * Queries specified task details.
5136     *
5137     * @permission ohos.permission.DOWNLOAD_SESSION_MANAGER or ohos.permission.UPLOAD_SESSION_MANAGER
5138     * @param { string } id the task id.
5139     * @returns { Promise<TaskInfo> } the promise returned by the function.
5140     * @throws { BusinessError } 201 - permission denied.
5141     * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
5142     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Missing mandatory parameters.
5143     * <br>2. Incorrect parameter type.
5144     * @throws { BusinessError } 13400003 - task service ability error.
5145     * @throws { BusinessError } 21900006 - task not found.
5146     * @syscap SystemCapability.Request.FileTransferAgent
5147     * @systemapi Hide this for inner system use.
5148     * @since 10
5149     */
5150    function query(id: string): Promise<TaskInfo>;
5151  }
5152}
5153
5154export default request;
5155