From 2bb1339bfde771282fac497b3cda2a72867c3131 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Tue, 26 Sep 2023 15:33:08 +0800 Subject: [PATCH] update Signed-off-by: zuojiangjiang --- interface_sdk/api/@ohos.data.cloudData.d.ts | 897 +++++++++++++----- .../api/@ohos.data.officeCloudExtension.d.ts | 38 +- 2 files changed, 681 insertions(+), 254 deletions(-) diff --git a/interface_sdk/api/@ohos.data.cloudData.d.ts b/interface_sdk/api/@ohos.data.cloudData.d.ts index d2c672e5..75a1ae7d 100644 --- a/interface_sdk/api/@ohos.data.cloudData.d.ts +++ b/interface_sdk/api/@ohos.data.cloudData.d.ts @@ -13,40 +13,65 @@ * limitations under the License. */ -import {AsyncCallback} from './@ohos.base'; +import { AsyncCallback } from './@ohos.base'; +import relationalStore from "./@ohos.data.relationalStore"; declare namespace cloudData { + /** + * Describes the clear action type. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + enum ClearAction { /** - * Describes the clear action type. + * Indicates clearing cloud-related data only, which includes cloud meta data and cloud-related local data. * - * @enum { number } * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi * @since 10 */ - enum ClearAction { - /** - * Indicates clearing cloud-related data only, which includes cloud meta data and cloud-related local data. - * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - CLEAR_CLOUD_INFO, - - /** - * Indicates clearing all cloud-related file data,which synchronized with the cloud. - * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - CLEAR_CLOUD_DATA_AND_INFO - } + CLEAR_CLOUD_INFO, + + /** + * Indicates clearing all cloud-related file data,which synchronized with the cloud. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + CLEAR_CLOUD_DATA_AND_INFO + } - const DATA_CHANGE_EVENT_ID = "cloud_data_change"; + /** + * Event ID indicates that data in the cloud has changed. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + const DATA_CHANGE_EVENT_ID = "cloud_data_change"; + + /** + * Extra data for data change notification. + * + * @interface ExtraData + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + interface ExtraData { + /** + * Event identity. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + eventId: string; /** + * Json string, contains the following optional fields. * { * "accountId": "aaa", * "bundleName": "com.bbb.xxx", @@ -59,249 +84,625 @@ declare namespace cloudData { * "keyId": "", * "signV3": "" * } - * */ - interface ExtraData { - eventId: string; - extraData: string; - } + * The accountId and bundleName are required among these. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + extraData: string; + } + + /** + * Provides methods to set CloudSync config. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + class Config { + /** + * Enables the cloud function. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { { [bundleName:string]:boolean } } switches - Indicates switches information of all applications. + * switches will overwrite the saved application switch information.If the specific application switch changes, + * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service. + * @param { AsyncCallback } callback - the callback of enableCloud. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static enableCloud( + accountId: string, + switches: { [bundleName: string]: boolean }, + callback: AsyncCallback + ): void; + + /** + * Enables the cloud function. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { { [bundleName:string]:boolean } } switches - Indicates switches information of all applications. + * switches will overwrite the saved application switch information.If the specific application switch changes, + * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static enableCloud(accountId: string, switches: { [bundleName: string]: boolean }): Promise; + + /** + * Disables the cloud function. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { AsyncCallback } callback - the callback of disableCloud. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static disableCloud(accountId: string, callback: AsyncCallback): void; + + /** + * Disables the cloud function. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static disableCloud(accountId: string): Promise; /** - * Provides methods to set CloudSync config. + * Changes the cloud switch of a single application. * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { string } bundleName - Indicates the name of application. + * @param { boolean } status - Indicates the condition of cloud sync switch.true means the switch is on,false means switch is off. + * @param { AsyncCallback } callback - the callback of changeAppCloudSwitch. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi * @since 10 */ - class Config { - /** - * Enables the cloud function. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { { [bundleName:string]:boolean } } switches - Indicates switches information of all applications. - * switches will overwrite the saved application switch information.If the specific application switch changes, - * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service. - * @param { AsyncCallback } callback - the callback of enableCloud. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static enableCloud( - accountId: string, - switches: { [bundleName: string]: boolean }, - callback: AsyncCallback - ): void; - - /** - * Enables the cloud function. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { { [bundleName:string]:boolean } } switches - Indicates switches information of all applications. - * switches will overwrite the saved application switch information.If the specific application switch changes, - * the {@link changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean)} method will notify the data manager service. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static enableCloud(accountId: string, switches: { [bundleName: string]: boolean }): Promise; - - /** - * Disables the cloud function. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { AsyncCallback } callback - the callback of disableCloud. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static disableCloud(accountId: string, callback: AsyncCallback): void; - - /** - * Disables the cloud function. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static disableCloud(accountId: string): Promise; - - /** - * Changes the cloud switch of a single application. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { string } bundleName - Indicates the name of application. - * @param { boolean } status - Indicates the condition of cloud sync switch.true means the switch is on,false means switch is off. - * @param { AsyncCallback } callback - the callback of changeAppCloudSwitch. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static changeAppCloudSwitch( - accountId: string, - bundleName: string, - status: boolean, - callback: AsyncCallback - ): void; - - /** - * Changes the cloud switch of a single application. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { string } bundleName - Indicates the name of application. - * @param { boolean } status - Indicates the condition of cloud sync switch.true means the switch is on,false means switch is off. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise; - - /** - * notifies changes of the cloud records - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { string } bundleName - Indicates the name of application. - * @param { AsyncCallback } callback - the callback of notifyDataChange. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Server - * @systemapi - * @since 10 - */ - static notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback): void; - - /** - * notifies changes of the cloud records - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { string } bundleName - Indicates the name of application. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Server - * @systemapi - * @since 10 - */ - static notifyDataChange(accountId: string, bundleName: string): Promise; - - static notifyDataChange(extInfo: ExtraData): Promise; - static notifyDataChange(extInfo: ExtraData, callback: AsyncCallback): Promise; - - /** - * deletes cloud information from local data. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. - * @param { { [bundleName: string]: ClearAction } } appActions - Indicates the way in which the application data is to be cleared. - * @param { AsyncCallback } callback - the callback of clear. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static clear( - accountId: string, - appActions: { [bundleName: string]: ClearAction }, - callback: AsyncCallback - ): void; - - /** - * deletes cloud information from local data. - * - * @permission ohos.permission.CLOUDDATA_CONFIG - * @param { string } accountId - Indicates the account ID. The account ID is required by hashing the information of specific opened cloud. - * @param { { [bundleName: string]: ClearAction } } appActions - Indicates the way in which the application data is to be cleared. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. - * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config - * @systemapi - * @since 10 - */ - static clear(accountId: string, appActions: { [bundleName: string]: ClearAction }): Promise; + static changeAppCloudSwitch( + accountId: string, + bundleName: string, + status: boolean, + callback: AsyncCallback + ): void; + + /** + * Changes the cloud switch of a single application. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { string } bundleName - Indicates the name of application. + * @param { boolean } status - Indicates the condition of cloud sync switch.true means the switch is on,false means switch is off. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise; + + /** + * Notifies changes of the cloud records + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { string } bundleName - Indicates the name of application. + * @param { AsyncCallback } callback - the callback of notifyDataChange. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback): void; + + /** + * Notifies changes of the cloud records + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { string } bundleName - Indicates the name of application. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static notifyDataChange(accountId: string, bundleName: string): Promise; + + /** + * Notifies changes of the cloud records + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { ExtraData } extInfo - Extra data for notification {@link ExtraData}. + * @param { AsyncCallback } callback - the callback of notifyDataChange. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + static notifyDataChange(extInfo: ExtraData, callback: AsyncCallback): void; + + /** + * Notifies changes of the cloud records + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { ExtraData } extInfo - Extra data for notification {@link ExtraData}. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * + * @since 11 + */ + static notifyDataChange(extInfo: ExtraData): Promise; + + /** + * Deletes cloud information from local data. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing cloud account. + * @param { { [bundleName: string]: ClearAction } } appActions - Indicates the way in which the application data is to be cleared. + * @param { AsyncCallback } callback - the callback of clear. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static clear( + accountId: string, + appActions: { [bundleName: string]: ClearAction }, + callback: AsyncCallback + ): void; + + /** + * Deletes cloud information from local data. + * + * @permission ohos.permission.CLOUDDATA_CONFIG + * @param { string } accountId - Indicates the account ID. The account ID is required by hashing the information of specific opened cloud. + * @param { { [bundleName: string]: ClearAction } } appActions - Indicates the way in which the application data is to be cleared. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 10 + */ + static clear(accountId: string, appActions: { [bundleName: string]: ClearAction }): Promise; + } + + /** + * Provides methods to cloud sharing. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + export namespace Sharing { + /** + * Enumerates the role. + * + * @enum { number } + * @syscap systemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + enum Role { + /** + * Inviter of cloud sharing. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + ROLE_INVITER, + + /** + * Invitee of cloud sharing. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + ROLE_INVITEES } - export namespace Sharing { - enum Role { - ROLE_INVITER, - ROLE_INVITEES - } + /** + * Enumerates the status of sharing invitation. + * + * @enum { number } + * @syscap systemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + enum Status { + /** + * Unknown status. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + STATUS_UNKNOWN, - enum Status { - STATUS_UNKNOWN, - STATUS_ACCEPTED, - STATUS_REJECTED, - STATUS_SUSPENDED, - } + /** + * Accept the sharing invitation. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + STATUS_ACCEPTED, - interface Privilege { - writeable?: boolean; - readable?: boolean; - creatable?: boolean; - deletable?: boolean; - shareable?: boolean; - } + /** + * Reject the sharing invitation. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + STATUS_REJECTED, - interface Participant { - identity: string; - role?: Role; - status?: Status; - privilege?: Privilege; - } + /** + * Suspends the sharing process. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + STATUS_SUSPENDED, + } - function share(sharingRes: string, participants: Array): Promise>; + /** + * Privilege for shared record. + * + * @interface Privilege + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + export interface Privilege { + /** + * True means allow participants to write the shared record, otherwise not. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + writeable?: boolean; - function unshare(sharingRes: string, participants: Array): Promise; + /** + * True means allow participants to read the shared record, otherwise not. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + readable?: boolean; - function changePrivilege(sharingRes: string, participants: Array): Promise>; + /** + * True means allow participants to create new record, otherwise not. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + creatable?: boolean; - function queryParticipants(sharingRes: string): Promise>; + /** + * True means allow participants to delete the shared record, otherwise not. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + deletable?: boolean; - function confirmInvitation(invitationCode: string, status: Status): Promise; + /** + * True means allow participants to share with others, otherwise not. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + shareable?: boolean; } + + /** + * Participants in cloud sharing. + * + * @interface Participant + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + export interface Participant { + /** + * The identity of participant. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + identity: string; + + /** + * Inviter or Invitee. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + role?: Role; + + /** + * The confirmation status of the sharing invitation. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + status?: Status; + + /** + * Permission to share records. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + privilege?: Privilege; + } + + /** + * Event ID indicates that data in the cloud has changed. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 11 + */ + const RESULT_FIELD = "sharing_result"; + const RESOURCE_FIELD = "sharing_resource"; + + function allocResourceAndshare( + storeId: string, + predicates: relationalStore.RdbPredicates, + participants: Array, + callback: AsyncCallback + ): void; + + function allocResourceAndshare( + storeId: string, + predicates: relationalStore.RdbPredicates, + participants: Array, + columns: Array, + callback: AsyncCallback + ): void; + + function allocResourceAndshare( + storeId: string, + predicates: relationalStore.RdbPredicates, + participants: Array, + columns?: Array + ): Promise; + + /** + * Share record with specified privilege to participants. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { Array } participants - Participants to be shared. + * @param { AsyncCallback> } callback - The callback of share. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function share( + sharingRes: string, + participants: Array, + callback: AsyncCallback> + ): void; + + /** + * Share record with specified privilege to participants. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { Array } participants - Participants to be shared. + * @Returns { Promise> } - the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function share(sharingRes: string, participants: Array): Promise>; + + /** + * Unshare with participants. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { Array } participants - Participants to be unshared. + * @param { AsyncCallback } callback - The callback of unshare. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function unshare(sharingRes: string, participants: Array, callback: AsyncCallback): void; + + /** + * Unshare with participants. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { Array } participants - Participants to be unshared. + * @Returns { Promise } - the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function unshare(sharingRes: string, participants: Array): Promise; + + function exit(sharingRes: string, callback: AsyncCallback): void; + function exit(sharingRes: string): Promise; + + /** + * Change privilege for shared record. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { Array } participants - Participants to be changed privilege. + * @param { AsyncCallback> } callback - The callback of changePrivilege. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported..0 + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function changePrivilege( + sharingRes: string, + participants: Array, + callback: AsyncCallback> + ): void; + + /** + * Change privilege for shared record. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { Array } participants - Participants to be unshared. + * @Returns { Promise> } - the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function changePrivilege(sharingRes: string, participants: Array): Promise>; + + /** + * Query the participants by specified shared record. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @param { AsyncCallback> } callback - The callback of queryParticipants. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function queryParticipants(sharingRes: string, callback: AsyncCallback>): void; + + /** + * Query the participants by specified shared record. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } sharingRes - The record uniform resource identifier. + * @Returns { Promise> } - the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function queryParticipants(sharingRes: string): Promise>; + + /** + * Confirm the invitation of cloud sharing. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } invitationCode - + * @param { Status } status - The status of invitation. + * @param { AsyncCallback } callback - The callback of confirmInvitation. + * the string value is record uniform resource identifier. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi + * @since 11 + */ + function confirmInvitation(invitationCode: string, status: Status, callback: AsyncCallback): void; + + /** + * Confirm the invitation of cloud sharing. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @param { string } invitationCode - + * @param { Status } status - The status of invitation. + * @Returns { Promise } - the promise returned by the function. + * the string value is record uniform resource identifier. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.. + * .CloudSync.Config + * @systemapi + * @since 11 + */ + function confirmInvitation(invitationCode: string, status: Status): Promise; + + function changeConfirmation(sharingRes: string, status: Status, callback: AsyncCallback): void; + function changeConfirmation(sharingRes: string, status: Status): Promise; + } } export default cloudData; diff --git a/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts b/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts index 06eda77b..57d7e881 100644 --- a/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts +++ b/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts @@ -14,7 +14,7 @@ */ import ExtensionContext from './application/ExtensionContext'; import ipc from './@ohos.rpc' -import cloudData from "./@ohos.data.cloudData"; +import cloudData, {Status} from "./@ohos.data.cloudData"; type Participant = cloudData.Sharing.Participant; type ParticipantStatus = cloudData.Sharing.Status; @@ -25,15 +25,41 @@ interface Result { } export default class OfficeCloud { - share(tokenId: number, sharingRes: string, participants: Array): Promise>>>; + share( + userId: number, + bundleName: string, + sharingRes: string, + participants: Array + ): Promise>>>; - unshare(tokenId: number, sharingRes: string, participants: Array): Promise>>>; + unshare( + userId: number, + bundleName: string, + sharingRes: string, + participants: Array + ): Promise>>>; - modifyPrivilege(tokenId: number, sharingRes: string, participants: Array): Promise>>>; + modifyPrivilege( + userId: number, + bundleName: string, + sharingRes: string, + participants: Array + ): Promise>>>; - queryParticipants(tokenId: number, sharingRes: string): Promise>>; + queryParticipants( + userId: number, + bundleName: string, + sharingRes: string + ): Promise>>; - confirmInvitation(userId: number, bundleName: string, invitationCode: string, status: ParticipantStatus): Promise; + confirmInvitation( + userId: number, + bundleName: string, + invitationCode: string, + status: ParticipantStatus + ): Promise; + + changeConfirmation(userId: number, bundleName: string, sharingRes: string, status: ParticipantStatus): Promise; } declare namespace OfficeCloudExtension { -- Gitee