• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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 ArkData
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import type relationalStore from './@ohos.data.relationalStore';
23import commonType from './@ohos.data.commonType';
24
25/**
26 * Provides methods for cloud capabilities.
27 *
28 * @namespace cloudData
29 * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
30 * @since 10
31 */
32declare namespace cloudData {
33  /**
34   * Describes the clear action type.
35   *
36   * @enum { number }
37   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
38   * @systemapi
39   * @since 10
40   */
41  enum ClearAction {
42    /**
43     * Indicates clearing cloud-related data only, which includes cloud meta data and cloud-related local data.
44     *
45     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
46     * @systemapi
47     * @since 10
48     */
49    CLEAR_CLOUD_INFO,
50
51    /**
52     * Indicates clearing all cloud-related file data,which synchronized with the cloud.
53     *
54     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
55     * @systemapi
56     * @since 10
57     */
58    CLEAR_CLOUD_DATA_AND_INFO
59  }
60
61  /**
62   * ID of the event, which indicates the change of the data in the cloud.
63   *
64   * @constant
65   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
66   * @systemapi
67   * @since 11
68   */
69  const DATA_CHANGE_EVENT_ID = 'cloud_data_change';
70
71  /**
72   * Extra data for data change notification.
73   *
74   * @interface ExtraData
75   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
76   * @systemapi
77   * @since 11
78   */
79  interface ExtraData {
80    /**
81     * Event ID.
82     *
83     * @type { string }
84     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
85     * @systemapi
86     * @since 11
87     */
88    eventId: string;
89
90    /**
91     * Extra data, which contains the following fields.
92     * '{
93     *   "data": "{
94     *     "accountId": "aaa",
95     *     "bundleName": "com.bbb.xxx",
96     *     "containerName": "alias",
97     *     "databaseScopes": ["private", "shared"],
98     *     "recordTypes": ["xxx", "yyy", "zzz"]
99     *   }"
100     * }'
101     * All fields are mandatory.
102     *
103     * @type { string }
104     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
105     * @systemapi
106     * @since 11
107     */
108    extraData: string;
109  }
110
111  /**
112   * Additional data for querying data statistics information.
113   *
114   * @interface StatisticInfo
115   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
116   * @systemapi
117   * @since 12
118   */
119  interface StatisticInfo {
120    /**
121     * Cloud table name.
122     *
123     * @type { string }
124     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
125     * @systemapi
126     * @since 12
127     */
128    table: string;
129
130    /**
131     * Number of records to be inserted to the cloud.
132     *
133     * @type { number }
134     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
135     * @systemapi
136     * @since 12
137     */
138    inserted: number;
139
140    /**
141     * Number of inconsistent records between the local device and the cloud.
142     *
143     * @type { number }
144     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
145     * @systemapi
146     * @since 12
147     */
148    updated: number;
149
150    /**
151     * Number of consistent records between the local device and the cloud.
152     *
153     * @type { number }
154     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
155     * @systemapi
156     * @since 12
157     */
158    normal: number;
159  }
160
161  /**
162   * Describes sync status.
163   *
164   * @enum { number }
165   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
166   * @systemapi
167   * @since 18
168   */
169  enum SyncStatus {
170    /**
171     * Indicates cloud sync status is running.
172     *
173     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
174     * @systemapi
175     * @since 18
176     */
177    RUNNING = 0,
178
179    /**
180     * Indicates cloud sync status was finished.
181     *
182     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
183     * @systemapi
184     * @since 18
185     */
186    FINISHED = 1
187  }
188
189  /**
190   * Sync information.
191   *
192   * @interface SyncInfo
193   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
194   * @systemapi
195   * @since 12
196   */
197  interface SyncInfo {
198    /**
199     * Sync start time.
200     *
201     * @type { Date }
202     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
203     * @systemapi
204     * @since 12
205     */
206    startTime: Date;
207
208    /**
209     * Sync finish time.
210     *
211     * @type { Date }
212     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
213     * @systemapi
214     * @since 12
215     */
216    finishTime: Date;
217
218    /**
219     * Sync progress.
220     *
221     * @type { relationalStore.ProgressCode }
222     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
223     * @systemapi
224     * @since 12
225     */
226    code: relationalStore.ProgressCode;
227
228    /**
229     * Sync status.
230     *
231     * @type { ?SyncStatus }
232     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
233     * @systemapi
234     * @since 18
235     */
236    syncStatus?: SyncStatus;
237  }
238
239  /**
240   * Provides methods to set CloudSync config.
241   *
242   * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
243   * @systemapi
244   * @since 10
245   */
246  class Config {
247    /**
248     * Enables the cloud function.
249     *
250     * @permission ohos.permission.CLOUDDATA_CONFIG
251     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
252     * @param { object } switches - Indicates switches information of all applications.
253     * switches will overwrite the saved application switch information.If the specific application switch changes,
254     * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service.
255     * @param { AsyncCallback<void> } callback - the callback of enableCloud.
256     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
257     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
258     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
259     * 3. Parameter verification failed.
260     * @throws { BusinessError } 801 - Capability not supported.
261     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
262     * @systemapi
263     * @since 10
264     */
265    /**
266     * Enables the cloud function.
267     *
268     * @permission ohos.permission.CLOUDDATA_CONFIG
269     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
270     * @param { Record<string, boolean> } switches - Indicates switches information of all applications.
271     * switches will overwrite the saved application switch information.If the specific application switch changes,
272     * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service.
273     * @param { AsyncCallback<void> } callback - the callback of enableCloud.
274     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
275     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
276     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
277     * 3. Parameter verification failed.
278     * @throws { BusinessError } 801 - Capability not supported.
279     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
280     * @systemapi
281     * @since 11
282     */
283    static enableCloud(
284      accountId: string,
285      switches: Record<string, boolean>,
286      callback: AsyncCallback<void>
287    ): void;
288
289    /**
290     * Enables the cloud function.
291     *
292     * @permission ohos.permission.CLOUDDATA_CONFIG
293     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
294     * @param { object } switches - Indicates switches information of all applications.
295     * switches will overwrite the saved application switch information.If the specific application switch changes,
296     * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service.
297     * @returns { Promise<void> } the promise returned by the function.
298     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
299     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
300     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
301     * 3. Parameter verification failed.
302     * @throws { BusinessError } 801 - Capability not supported.
303     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
304     * @systemapi
305     * @since 10
306     */
307    /**
308     * Enables the cloud function.
309     *
310     * @permission ohos.permission.CLOUDDATA_CONFIG
311     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
312     * @param { Record<string, boolean> } switches - Indicates switches information of all applications.
313     * switches will overwrite the saved application switch information.If the specific application switch changes,
314     * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service.
315     * @returns { Promise<void> } the promise returned by the function.
316     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
317     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
318     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
319     * 3. Parameter verification failed.
320     * @throws { BusinessError } 801 - Capability not supported.
321     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
322     * @systemapi
323     * @since 11
324     */
325    static enableCloud(accountId: string, switches: Record<string, boolean>): Promise<void>;
326
327    /**
328     * Disables the cloud function.
329     *
330     * @permission ohos.permission.CLOUDDATA_CONFIG
331     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
332     * @param { AsyncCallback<void> } callback - the callback of disableCloud.
333     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
334     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
335     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
336     * 3. Parameter verification failed.
337     * @throws { BusinessError } 801 - Capability not supported.
338     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
339     * @systemapi
340     * @since 10
341     */
342    static disableCloud(accountId: string, callback: AsyncCallback<void>): void;
343
344    /**
345     * Disables the cloud function.
346     *
347     * @permission ohos.permission.CLOUDDATA_CONFIG
348     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
349     * @returns { Promise<void> } the promise returned by the function.
350     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
351     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
352     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
353     * 3. Parameter verification failed.
354     * @throws { BusinessError } 801 - Capability not supported.
355     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
356     * @systemapi
357     * @since 10
358     */
359    static disableCloud(accountId: string): Promise<void>;
360
361    /**
362     * Changes the cloud switch of a single application.
363     *
364     * @permission ohos.permission.CLOUDDATA_CONFIG
365     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
366     * @param { string } bundleName -  Indicates the name of application.
367     * @param { boolean } status - Indicates the condition of cloud sync switch.true means the switch is on,false means switch is off.
368     * @param { AsyncCallback<void> } callback - the callback of changeAppCloudSwitch.
369     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
370     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
371     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
372     * 3. Parameter verification failed.
373     * @throws { BusinessError } 801 - Capability not supported.
374     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
375     * @systemapi
376     * @since 10
377     */
378    static changeAppCloudSwitch(
379      accountId: string,
380      bundleName: string,
381      status: boolean,
382      callback: AsyncCallback<void>
383    ): void;
384
385    /**
386     * Changes the cloud switch of a single application.
387     *
388     * @permission ohos.permission.CLOUDDATA_CONFIG
389     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
390     * @param { string } bundleName -  Indicates the name of application.
391     * @param { boolean } status - Indicates the condition of cloud sync switch.true means the switch is on,false means switch is off.
392     * @returns { Promise<void> } the promise returned by the function.
393     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
394     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
395     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
396     * 3. Parameter verification failed.
397     * @throws { BusinessError } 801 - Capability not supported.
398     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
399     * @systemapi
400     * @since 10
401     */
402    static changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise<void>;
403
404    /**
405     * Notifies changes of the cloud records.
406     *
407     * @permission ohos.permission.CLOUDDATA_CONFIG
408     * @param { ExtraData } extInfo - Indicates the extra data for
409     * notification {@link ExtraData}.
410     * @param { number } [userId] - Indicates the user ID.
411     * @returns { Promise<void> } Promise used to return the result.
412     * @throws { BusinessError } 201 - Permission verification failed, which
413     * is usually returned by <b>VerifyAccessToken</b>.
414     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
415     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
416     * 3. Parameter verification failed.
417     * @throws { BusinessError } 801 - Capability not supported.
418     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
419     * @systemapi
420     * @since 11
421     */
422    static notifyDataChange(extInfo: ExtraData, userId?: number): Promise<void>;
423
424    /**
425     * Notifies changes of the cloud records.
426     *
427     * @permission ohos.permission.CLOUDDATA_CONFIG
428     * @param { ExtraData } extInfo - Indicates the extra data for
429     * notification {@link ExtraData}.
430     * @param { AsyncCallback<void> } callback - Indicates the callback invoked
431     * to return the data changes.
432     * @throws { BusinessError } 201 - Permission verification failed, which
433     * is usually returned by <b>VerifyAccessToken</b>.
434     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
435     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
436     * 3. Parameter verification failed.
437     * @throws { BusinessError } 801 - Capability not supported.
438     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
439     * @systemapi
440     * @since 11
441     */
442    static notifyDataChange(extInfo: ExtraData, callback: AsyncCallback<void>): void;
443
444    /**
445     * Notifies changes of the cloud records.
446     *
447     * @permission ohos.permission.CLOUDDATA_CONFIG
448     * @param { ExtraData } extInfo - Indicates the extra data for
449     * notification {@link ExtraData}.
450     * @param { number } userId - Indicates the user ID.
451     * @param { AsyncCallback<void> } callback - Indicates the callback invoked
452     * to return the data changes.
453     * @throws { BusinessError } 201 - Permission verification failed, which
454     * is usually returned by <b>VerifyAccessToken</b>.
455     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
456     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
457     * 3. Parameter verification failed.
458     * @throws { BusinessError } 801 - Capability not supported.
459     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
460     * @systemapi
461     * @since 11
462     */
463    static notifyDataChange(extInfo: ExtraData, userId: number, callback: AsyncCallback<void>): void;
464
465    /**
466     * notifies changes of the cloud records
467     *
468     * @permission ohos.permission.CLOUDDATA_CONFIG
469     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
470     * @param { string } bundleName - Indicates the name of application.
471     * @returns { Promise<void> } the promise returned by the function.
472     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
473     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
474     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
475     * 3. Parameter verification failed.
476     * @throws { BusinessError } 801 - Capability not supported.
477     * @syscap SystemCapability.DistributedDataManager.CloudSync.Server
478     * @systemapi
479     * @since 10
480     */
481    static notifyDataChange(accountId: string, bundleName: string): Promise<void>;
482
483    /**
484     * notifies changes of the cloud records
485     *
486     * @permission ohos.permission.CLOUDDATA_CONFIG
487     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
488     * @param { string } bundleName - Indicates the name of application.
489     * @param { AsyncCallback<void> } callback - the callback of notifyDataChange.
490     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
491     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
492     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
493     * 3. Parameter verification failed.
494     * @throws { BusinessError } 801 - Capability not supported.
495     * @syscap SystemCapability.DistributedDataManager.CloudSync.Server
496     * @systemapi
497     * @since 10
498     */
499    static notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback<void>): void;
500
501    /**
502     * Queries statistics of the cloud records.
503     *
504     * @permission ohos.permission.CLOUDDATA_CONFIG
505     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
506     * @param { string } bundleName - Indicates the name of application.
507     * @param { string } [storeId] - Indicates the store ID.
508     * @returns { Promise<Record<string, Array<StatisticInfo>>> } Promise used to return the result.
509     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
510     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
511     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
512     * 3. Parameter verification failed.
513     * @throws { BusinessError } 801 - Capability not supported.
514     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
515     * @systemapi
516     * @since 12
517     */
518    static queryStatistics(
519        accountId: string,
520        bundleName: string,
521        storeId?: string
522    ): Promise<Record<string, Array<StatisticInfo>>>;
523
524    /**
525     * Queries last sync information.
526     *
527     * @permission ohos.permission.CLOUDDATA_CONFIG
528     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
529     * @param { string } bundleName - Indicates the name of application.
530     * @param { string } [storeId] - Indicates the store ID.
531     * @returns { Promise<Record<string, SyncInfo>> } Promise used to return the result.
532     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
533     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
534     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
535     * 3. Parameter verification failed.
536     * @throws { BusinessError } 801 - Capability not supported.
537     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
538     * @systemapi
539     * @since 12
540     */
541    static queryLastSyncInfo(
542        accountId: string,
543        bundleName: string,
544        storeId?: string
545    ): Promise<Record<string, SyncInfo>>;
546
547    /**
548     * deletes cloud information from local data.
549     *
550     * @permission ohos.permission.CLOUDDATA_CONFIG
551     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
552     * @param { object } appActions - Indicates the way in which the application data is to be cleared.
553     * @param { AsyncCallback<void> } callback - the callback of clear.
554     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
555     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
556     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
557     * 3. Parameter verification failed.
558     * @throws { BusinessError } 801 - Capability not supported.
559     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
560     * @systemapi
561     * @since 10
562     */
563    /**
564     * deletes cloud information from local data.
565     *
566     * @permission ohos.permission.CLOUDDATA_CONFIG
567     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account.
568     * @param { Record<string, ClearAction> } appActions - Indicates the way in which the application data is to be cleared.
569     * @param { AsyncCallback<void> } callback - the callback of clear.
570     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
571     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
572     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
573     * 3. Parameter verification failed.
574     * @throws { BusinessError } 801 - Capability not supported.
575     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
576     * @systemapi
577     * @since 11
578     */
579    static clear(
580      accountId: string,
581      appActions: Record<string, ClearAction>,
582      callback: AsyncCallback<void>
583    ): void;
584
585    /**
586     * deletes cloud information from local data.
587     *
588     * @permission ohos.permission.CLOUDDATA_CONFIG
589     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing the information of specific opened cloud.
590     * @param { object } appActions - Indicates the way in which the application data is to be cleared.
591     * @returns { Promise<void> } the promise returned by the function.
592     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
593     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
594     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
595     * 3. Parameter verification failed.
596     * @throws { BusinessError } 801 - Capability not supported.
597     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
598     * @systemapi
599     * @since 10
600     */
601    /**
602     * deletes cloud information from local data.
603     *
604     * @permission ohos.permission.CLOUDDATA_CONFIG
605     * @param { string } accountId - Indicates the account ID. The account ID is required by hashing the information of specific opened cloud.
606     * @param { Record<string, ClearAction> } appActions - Indicates the way in which the application data is to be cleared.
607     * @returns { Promise<void> } the promise returned by the function.
608     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
609     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
610     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
611     * 3. Parameter verification failed.
612     * @throws { BusinessError } 801 - Capability not supported.
613     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
614     * @systemapi
615     * @since 11
616     */
617    static clear(accountId: string, appActions: Record<string, ClearAction>): Promise<void>;
618
619    /**
620     * Sets global cloud strategy.
621     *
622     * @permission ohos.permission.CLOUDDATA_CONFIG
623     * @param { StrategyType } strategy - Indicates the strategy type of the cloud sync.
624     * @param { Array<commonType.ValueType> } param - Indicates specific strategy of the cloud sync.
625     * @returns { Promise<void> } Promise used to return the result.
626     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
627     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
628     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
629     * 3. Parameter verification failed.
630     * @throws { BusinessError } 801 - Capability not supported.
631     * @syscap SystemCapability.DistributedDataManager.CloudSync.Config
632     * @systemapi
633     * @since 12
634     */
635    static setGlobalCloudStrategy(strategy: StrategyType, param?: Array<commonType.ValueType>): Promise<void>;
636  }
637
638  /**
639   * Enumerates the strategy types of cloud sync.
640   *
641   * @enum { number }
642   * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
643   * @since 12
644   */
645  enum StrategyType {
646
647    /**
648     * Sync via the network.
649     *
650     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
651     * @since 12
652     */
653    NETWORK
654  }
655
656  /**
657   * Enumerates the types of cloud sync via the network.
658   *
659   * @enum { number }
660   * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
661   * @since 12
662   */
663  enum NetWorkStrategy {
664
665    /**
666     * Sync using WiFi.
667     *
668     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
669     * @since 12
670     */
671    WIFI = 1,
672
673    /**
674     * Sync using the cellular network.
675     *
676     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
677     * @since 12
678     */
679    CELLULAR = 2,
680  }
681
682  /**
683   * Sets cloud strategy.
684   *
685   * @param { StrategyType } strategy - Indicates the strategy type of the cloud sync.
686   * @param { Array<commonType.ValueType> } param - Indicates specific strategy of the cloud sync.
687   * @returns { Promise<void> } Promise used to return the result.
688   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
689     * 3. Parameter verification failed.
690   * @throws { BusinessError } 801 - Capability not supported.
691   * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
692   * @since 12
693   */
694  function setCloudStrategy(strategy: StrategyType, param?: Array<commonType.ValueType>): Promise<void>;
695
696  /**
697   * Provides methods to implement cloud sharing.
698   *
699   * @namespace sharing
700   * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
701   * @systemapi
702   * @since 11
703   */
704  export namespace sharing {
705    /**
706     * Enumerates the roles.
707     *
708     * @enum { number }
709     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
710     * @systemapi
711     * @since 11
712     */
713    enum Role {
714      /**
715       * ROLE_INVITER: means inviter of cloud sharing.
716       *
717       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
718       * @systemapi
719       * @since 11
720       */
721      ROLE_INVITER = 0,
722
723      /**
724       * ROLE_INVITEE: means invitee of cloud sharing.
725       *
726       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
727       * @systemapi
728       * @since 11
729       */
730      ROLE_INVITEE = 1,
731    }
732
733    /**
734     * Enumerates the states of sharing invitation.
735     *
736     * @enum { number }
737     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
738     * @systemapi
739     * @since 11
740     */
741    enum State {
742      /**
743       * STATE_UNKNOWN: Unknown state.
744       *
745       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
746       * @systemapi
747       * @since 11
748       */
749      STATE_UNKNOWN = 0,
750
751      /**
752       * STATE_ACCEPTED: Accept the sharing invitation.
753       *
754       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
755       * @systemapi
756       * @since 11
757       */
758      STATE_ACCEPTED = 1,
759
760      /**
761       * STATE_REJECTED: Reject the sharing invitation.
762       *
763       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
764       * @systemapi
765       * @since 11
766       */
767      STATE_REJECTED = 2,
768
769      /**
770       * STATE_SUSPENDED: Suspend the sharing process.
771       *
772       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
773       * @systemapi
774       * @since 11
775       */
776      STATE_SUSPENDED = 3,
777
778      /**
779       * STATE_UNAVAILABLE: The sharing process unavailable.
780       *
781       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
782       * @systemapi
783       * @since 12
784       */
785      STATE_UNAVAILABLE = 4,
786    }
787
788    /**
789     * Enumerates the error code of sharing invitation.
790     *
791     * @enum { number }
792     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
793     * @systemapi
794     * @since 11
795     */
796    enum SharingCode {
797      /**
798       * SUCCESS: means sharing success.
799       *
800       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
801       * @systemapi
802       * @since 11
803       */
804      SUCCESS = 0,
805
806      /**
807       * REPEATED_REQUEST: means the user has been invited.
808       *
809       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
810       * @systemapi
811       * @since 11
812       */
813      REPEATED_REQUEST = 1,
814
815      /**
816       * NOT_INVITER: means the participant is not inviter.
817       *
818       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
819       * @systemapi
820       * @since 11
821       */
822      NOT_INVITER = 2,
823
824      /**
825       * NOT_INVITER_OR_INVITEE: means the participant is not inviter or invitee.
826       *
827       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
828       * @systemapi
829       * @since 11
830       */
831      NOT_INVITER_OR_INVITEE = 3,
832
833      /**
834       * OVER_QUOTA: means the number of sharing times today of current user has reached maximum.
835       *
836       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
837       * @systemapi
838       * @since 11
839       */
840      OVER_QUOTA = 4,
841
842      /**
843       * TOO_MANY_PARTICIPANTS: means the number of participants reaches the maximum.
844       *
845       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
846       * @systemapi
847       * @since 11
848       */
849      TOO_MANY_PARTICIPANTS = 5,
850
851      /**
852       * INVALID_ARGS: means invalid arguments.
853       *
854       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
855       * @systemapi
856       * @since 11
857       */
858      INVALID_ARGS = 6,
859
860      /**
861       * NETWORK_ERROR: means the network is unavailable.
862       *
863       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
864       * @systemapi
865       * @since 11
866       */
867      NETWORK_ERROR = 7,
868
869      /**
870       * CLOUD_DISABLED: means cloud is disabled.
871       *
872       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
873       * @systemapi
874       * @since 11
875       */
876      CLOUD_DISABLED = 8,
877
878      /**
879       * SERVER_ERROR: means invoke cloud space failed.
880       *
881       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
882       * @systemapi
883       * @since 11
884       */
885      SERVER_ERROR = 9,
886
887      /**
888       * INNER_ERROR: means an unknown error has occurred.
889       *
890       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
891       * @systemapi
892       * @since 11
893       */
894      INNER_ERROR = 10,
895
896      /**
897       * INVALID_INVITATION: means the invitation has expired or does not exist.
898       *
899       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
900       * @systemapi
901       * @since 11
902       */
903      INVALID_INVITATION = 11,
904
905      /**
906       * RATE_LIMIT: means the data transfer is rate-limited.
907       *
908       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
909       * @systemapi
910       * @since 11
911       */
912      RATE_LIMIT = 12,
913
914      /**
915       * CUSTOM_ERROR: means error codes that exceed this enumerated value are custom error codes.
916       *
917       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
918       * @systemapi
919       * @since 11
920       */
921      CUSTOM_ERROR = 1000,
922    }
923
924    /**
925     * Result interface.
926     *
927     * @interface Result
928     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
929     * @systemapi
930     * @since 11
931     */
932    interface Result<T> {
933      /**
934       * Error code.
935       *
936       * @type { number }
937       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
938       * @systemapi
939       * @since 11
940       */
941      code: number;
942
943      /**
944       * Error code description.
945       *
946       * @type { ?string }
947       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
948       * @systemapi
949       * @since 11
950       */
951      description?: string;
952
953      /**
954       * The result value.
955       *
956       * @type { ?T }
957       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
958       * @systemapi
959       * @since 11
960       */
961      value?: T;
962    }
963
964    /**
965     * Privilege for the shared data.
966     *
967     * @interface Privilege
968     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
969     * @systemapi
970     * @since 11
971     */
972    interface Privilege {
973      /**
974       * Whether the participants can write the shared data. The value <b>true</b>
975       * means the participants can write the shared data; the value <b>false</b>
976       * means the opposite.
977       *
978       * @type { ?boolean }
979       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
980       * @systemapi
981       * @since 11
982       */
983      writable?: boolean;
984
985      /**
986       * Whether the participants can read the shared data. The value <b>true</b>
987       * means the participants can read the shared data; the value <b>false</b>
988       * means the opposite.
989       *
990       * @type { ?boolean }
991       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
992       * @systemapi
993       * @since 11
994       */
995      readable?: boolean;
996
997      /**
998       * Whether the participants can create data. The value <b>true</b>
999       * means the participants can create data; the value <b>false</b>
1000       * means the opposite.
1001       *
1002       * @type { ?boolean }
1003       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1004       * @systemapi
1005       * @since 11
1006       */
1007      creatable?: boolean;
1008
1009      /**
1010       * Whether the participants can delete the shared data. The value <b>true</b>
1011       * means the participants can delete the shared data; the value <b>false</b>
1012       * means the opposite.
1013       *
1014       * @type { ?boolean }
1015       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1016       * @systemapi
1017       * @since 11
1018       */
1019      deletable?: boolean;
1020
1021      /**
1022       * Whether the participants can share the data. The value <b>true</b>
1023       * means the participants can share the data; the value <b>false</b>
1024       * means the opposite.
1025       *
1026       * @type { ?boolean }
1027       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1028       * @systemapi
1029       * @since 11
1030       */
1031      shareable?: boolean;
1032    }
1033
1034    /**
1035     * Participants in cloud sharing.
1036     *
1037     * @interface Participant
1038     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1039     * @systemapi
1040     * @since 11
1041     */
1042    interface Participant {
1043      /**
1044       * Identity of participant.
1045       *
1046       * @type { string }
1047       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1048       * @systemapi
1049       * @since 11
1050       */
1051      identity: string;
1052
1053      /**
1054       * Role of the participant, which can be inviter or invitee.
1055       *
1056       * @type { ?Role }
1057       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1058       * @systemapi
1059       * @since 11
1060       */
1061      role?: Role;
1062
1063      /**
1064       * State of the sharing invitation.
1065       *
1066       * @type { ?State }
1067       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1068       * @systemapi
1069       * @since 11
1070       */
1071      state?: State;
1072
1073      /**
1074       * Permissions for the shared data.
1075       *
1076       * @type { ?Privilege }
1077       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1078       * @systemapi
1079       * @since 11
1080       */
1081      privilege?: Privilege;
1082
1083      /**
1084       * Attach information.
1085       *
1086       * @type { ?string }
1087       * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1088       * @systemapi
1089       * @since 11
1090       */
1091      attachInfo?: string;
1092    }
1093
1094    /**
1095     * Allocates shared resources based on conditions,
1096     * and shares data with the specified privilege to participants.
1097     *
1098     * @param { string } storeId - Indicates relational store name.
1099     * @param { relationalStore.RdbPredicates } predicates - See {@link relationalStore.RdbPredicates}.
1100     * @param { Array<Participant> } participants - Participants to share.
1101     * @param { Array<string> } [columns] - Columns to be shared.
1102     * @returns { Promise<relationalStore.ResultSet> } - Promise used to return {@link relationalStore.ResultSet}.
1103     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1104     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1105     * 3. Parameter verification failed.
1106     * @throws { BusinessError } 801 - Capability not supported.
1107     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1108     * @systemapi
1109     * @since 11
1110     */
1111    function allocResourceAndShare(
1112      storeId: string,
1113      predicates: relationalStore.RdbPredicates,
1114      participants: Array<Participant>,
1115      columns?: Array<string>
1116    ): Promise<relationalStore.ResultSet>;
1117
1118    /**
1119     * Allocates shared resources based on conditions,
1120     * and shares data with the specified privilege to participants.
1121     *
1122     * @param { string } storeId - Indicates relational store name.
1123     * @param { relationalStore.RdbPredicates } predicates - See {@link relationalStore.RdbPredicates}.
1124     * @param { Array<Participant> } participants - Participants to share.
1125     * @param { AsyncCallback<relationalStore.ResultSet> } callback - Indicates the
1126     * callback invoked to return the {@link relationalStore.ResultSet}.
1127     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1128     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1129     * 3. Parameter verification failed.
1130     * @throws { BusinessError } 801 - Capability not supported.
1131     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1132     * @systemapi
1133     * @since 11
1134     */
1135    function allocResourceAndShare(
1136      storeId: string,
1137      predicates: relationalStore.RdbPredicates,
1138      participants: Array<Participant>,
1139      callback: AsyncCallback<relationalStore.ResultSet>
1140    ): void;
1141
1142    /**
1143     * Allocates shared resources based on conditions,
1144     * and shares data with the specified privilege to participants.
1145     *
1146     * @param { string } storeId - Indicates relational store name.
1147     * @param { relationalStore.RdbPredicates } predicates - See {@link relationalStore.RdbPredicates}.
1148     * @param { Array<Participant> } participants - Participants to share.
1149     * @param { Array<string> } columns - Columns to be shared.
1150     * @param { AsyncCallback<relationalStore.ResultSet> } callback - Indicates the
1151     * callback invoked to return the {@link relationalStore.ResultSet}.
1152     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1153     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1154     * 3. Parameter verification failed.
1155     * @throws { BusinessError } 801 - Capability not supported.
1156     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1157     * @systemapi
1158     * @since 11
1159     */
1160    function allocResourceAndShare(
1161      storeId: string,
1162      predicates: relationalStore.RdbPredicates,
1163      participants: Array<Participant>,
1164      columns: Array<string>,
1165      callback: AsyncCallback<relationalStore.ResultSet>
1166    ): void;
1167
1168    /**
1169     * Shares data with the specified privilege to participants.
1170     *
1171     * @param { string } sharingResource - Indicates the sharing resource.
1172     * @param { Array<Participant> } participants - Indicates the participants
1173     * involved in the data sharing.
1174     * @param { AsyncCallback<Result<Array<Result<Participant>>>> } callback - Indicates the
1175     * callback invoked to return the result.
1176     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1177     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1178     * 3. Parameter verification failed.
1179     * @throws { BusinessError } 801 - Capability not supported.
1180     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1181     * @systemapi
1182     * @since 11
1183     */
1184    function share(
1185      sharingResource: string,
1186      participants: Array<Participant>,
1187      callback: AsyncCallback<Result<Array<Result<Participant>>>>
1188    ): void;
1189
1190    /**
1191     * Shares data with the specified privilege to participants.
1192     *
1193     * @param { string } sharingResource - Indicates the sharing resource.
1194     * @param { Array<Participant> } participants - Indicates the participants
1195     * involved in the data sharing.
1196     * @returns { Promise<Result<Array<Result<Participant>>>> } - Promise used to return the result.
1197     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1198     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1199     * 3. Parameter verification failed.
1200     * @throws { BusinessError } 801 - Capability not supported.
1201     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1202     * @systemapi
1203     * @since 11
1204     */
1205    function share(
1206      sharingResource: string,
1207      participants: Array<Participant>
1208    ): Promise<Result<Array<Result<Participant>>>>;
1209
1210    /**
1211     * UnShares data.
1212     *
1213     * @param { string } sharingResource - Indicates the sharing resource.
1214     * @param { Array<Participant> } participants - Indicates the participants
1215     * involved.
1216     * @param { AsyncCallback<Result<Array<Result<Participant>>>> } callback - Indicates the callback invoked
1217     * to return the result.
1218     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1219     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1220     * 3. Parameter verification failed.
1221     * @throws { BusinessError } 801 - Capability not supported.
1222     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1223     * @systemapi
1224     * @since 11
1225     */
1226    function unshare(
1227      sharingResource: string,
1228      participants: Array<Participant>,
1229      callback: AsyncCallback<Result<Array<Result<Participant>>>>
1230    ): void;
1231
1232    /**
1233     * UnShares data.
1234     *
1235     * @param { string } sharingResource - Indicates the sharing resource.
1236     * @param { Array<Participant> } participants - Indicates the participants
1237     * involved.
1238     * @returns { Promise<Result<Array<Result<Participant>>>> } - Promise used to return the result.
1239     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1240     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1241     * 3. Parameter verification failed.
1242     * @throws { BusinessError } 801 - Capability not supported.
1243     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1244     * @systemapi
1245     * @since 11
1246     */
1247    function unshare(
1248      sharingResource: string,
1249      participants: Array<Participant>
1250    ): Promise<Result<Array<Result<Participant>>>>;
1251
1252    /**
1253     * Exit sharing.
1254     *
1255     * @param { string } sharingResource - Indicates the sharing resource.
1256     * @param { AsyncCallback<Result<void>> } callback - The callback of exit.
1257     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1258     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1259     * 3. Parameter verification failed.
1260     * @throws { BusinessError } 801 - Capability not supported.
1261     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1262     * @systemapi
1263     * @since 11
1264     */
1265    function exit(sharingResource: string, callback: AsyncCallback<Result<void>>): void;
1266
1267    /**
1268     * Exit sharing.
1269     *
1270     * @param { string } sharingResource - Indicates the sharing resource.
1271     * @returns { Promise<Result<void>> } - The promise returned by the function.
1272     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1273     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1274     * 3. Parameter verification failed.
1275     * @throws { BusinessError } 801 - Capability not supported.
1276     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1277     * @systemapi
1278     * @since 11
1279     */
1280    function exit(sharingResource: string): Promise<Result<void>>;
1281
1282    /**
1283     * Changes the permissions for the shared data.
1284     *
1285     * @param { string } sharingResource - Indicates the sharing resource.
1286     * @param { Array<Participant> } participants - Indicates the participants
1287     * whose permissions are to be changed.
1288     * @param { AsyncCallback<Result<Array<Result<Participant>>>> } callback - Indicates the
1289     * callback invoked to return the result.
1290     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1291     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1292     * 3. Parameter verification failed.
1293     * @throws { BusinessError } 801 - Capability not supported.
1294     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1295     * @systemapi
1296     * @since 11
1297     */
1298    function changePrivilege(
1299      sharingResource: string,
1300      participants: Array<Participant>,
1301      callback: AsyncCallback<Result<Array<Result<Participant>>>>
1302    ): void;
1303
1304    /**
1305     * Changes the permissions for the shared data.
1306     *
1307     * @param { string } sharingResource - Indicates the sharing resource.
1308     * @param { Array<Participant> } participants - Indicates the participants
1309     * whose permissions are to be changed.
1310     * @returns { Promise<Result<Array<Result<Participant>>>> } - Promise used to return the result.
1311     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1312     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1313     * 3. Parameter verification failed.
1314     * @throws { BusinessError } 801 - Capability not supported.
1315     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1316     * @systemapi
1317     * @since 11
1318     */
1319    function changePrivilege(
1320      sharingResource: string,
1321      participants: Array<Participant>
1322    ): Promise<Result<Array<Result<Participant>>>>;
1323
1324    /**
1325     * Queries the participants based on the specified shared data.
1326     *
1327     * @param { string } sharingResource - Indicates the sharing resource.
1328     * @param { AsyncCallback<Result<Array<Participant>>> } callback - Indicates the
1329     * callback invoked to return the participants obtained.
1330     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1331     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1332     * 3. Parameter verification failed.
1333     * @throws { BusinessError } 801 - Capability not supported.
1334     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1335     * @systemapi
1336     * @since 11
1337     */
1338    function queryParticipants(sharingResource: string, callback: AsyncCallback<Result<Array<Participant>>>): void;
1339
1340    /**
1341     * Queries the participants based on the specified shared data.
1342     *
1343     * @param { string } sharingResource - Indicates the sharing resource.
1344     * @returns { Promise<Result<Array<Participant>>> } - Promise used to return the result.
1345     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1346     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1347     * 3. Parameter verification failed.
1348     * @throws { BusinessError } 801 - Capability not supported.
1349     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1350     * @systemapi
1351     * @since 11
1352     */
1353    function queryParticipants(sharingResource: string): Promise<Result<Array<Participant>>>;
1354
1355    /**
1356     * Queries the participants based on the specified invitation code.
1357     *
1358     * @param { string } invitationCode - Indicates the invitation code.
1359     * @param { AsyncCallback<Result<Array<Participant>>> } callback - Indicates the
1360     * callback invoked to return the participants obtained.
1361     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1362     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1363     * 3. Parameter verification failed.
1364     * @throws { BusinessError } 801 - Capability not supported.
1365     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1366     * @systemapi
1367     * @since 11
1368     */
1369    function queryParticipantsByInvitation(
1370      invitationCode: string,
1371      callback: AsyncCallback<Result<Array<Participant>>>
1372    ): void;
1373
1374    /**
1375     * Queries the participants based on the specified invitation code.
1376     *
1377     * @param { string } invitationCode - Indicates the invitation code.
1378     * @returns { Promise<Result<Array<Participant>>> } - Promise used to return the result.
1379     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1380     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1381     * 3. Parameter verification failed.
1382     * @throws { BusinessError } 801 - Capability not supported.
1383     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1384     * @systemapi
1385     * @since 11
1386     */
1387    function queryParticipantsByInvitation(invitationCode: string): Promise<Result<Array<Participant>>>;
1388
1389    /**
1390     * Confirms the invitation of cloud sharing.
1391     *
1392     * @param { string } invitationCode - Indicates the invitation code.
1393     * @param { State } state - Indicates the state of invitation.
1394     * @param { AsyncCallback<Result<string>> } callback - Indicates the callback
1395     * invoked to return the sharing resource.
1396     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1397     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1398     * 3. Parameter verification failed.
1399     * @throws { BusinessError } 801 - Capability not supported.
1400     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1401     * @systemapi
1402     * @since 11
1403     */
1404    function confirmInvitation(invitationCode: string, state: State, callback: AsyncCallback<Result<string>>): void;
1405
1406    /**
1407     * Confirms the invitation of cloud sharing.
1408     *
1409     * @param { string } invitationCode - Indicates the invitation code.
1410     * @param { State } state - Indicates the state of invitation.
1411     * @returns { Promise<Result<string>> } - Promise used to return the sharing resource.
1412     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1413     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1414     * 3. Parameter verification failed.
1415     * @throws { BusinessError } 801 - Capability not supported.
1416     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1417     * @systemapi
1418     * @since 11
1419     */
1420    function confirmInvitation(invitationCode: string, state: State): Promise<Result<string>>;
1421
1422    /**
1423     * Changes confirmation of shared record.
1424     *
1425     * @param { string } sharingResource - Indicates the sharing resource.
1426     * @param { State } state - Indicates the state of invitation.
1427     * @param { AsyncCallback<Result<void>> } callback - Indicates the callback.
1428     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1429     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1430     * 3. Parameter verification failed.
1431     * @throws { BusinessError } 801 - Capability not supported.
1432     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1433     * @systemapi
1434     * @since 11
1435     */
1436    function changeConfirmation(sharingResource: string, state: State, callback: AsyncCallback<Result<void>>): void;
1437
1438    /**
1439     * Changes confirmation of shared record.
1440     *
1441     * @param { string } sharingResource - Indicates the sharing resource.
1442     * @param { State } state - Indicates the state of invitation.
1443     * @returns { Promise<Result<void>> } - The promise returned by the function.
1444     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1445     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
1446     * 3. Parameter verification failed.
1447     * @throws { BusinessError } 801 - Capability not supported.
1448     * @syscap SystemCapability.DistributedDataManager.CloudSync.Client
1449     * @systemapi
1450     * @since 11
1451     */
1452    function changeConfirmation(sharingResource: string, state: State): Promise<Result<void>>;
1453  }
1454}
1455
1456export default cloudData;
1457