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