diff --git a/interface_sdk/api/@ohos.data.cloudData.d.ts b/interface_sdk/api/@ohos.data.cloudData.d.ts index 52224dbe4ad229aa1cadb55cdb2ac8ac9ef45239..3aff00650cc7940400d35d32cd65a055f37c3ad1 100644 --- a/interface_sdk/api/@ohos.data.cloudData.d.ts +++ b/interface_sdk/api/@ohos.data.cloudData.d.ts @@ -14,10 +14,11 @@ */ import { AsyncCallback } from './@ohos.base'; +import relationalStore from "./@ohos.data.relationalStore"; declare namespace cloudData { /** - * Describes the clear action type. + * Enumerates the types of the clear action. * * @enum { number } * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -26,7 +27,8 @@ declare namespace cloudData { */ enum ClearAction { /** - * Indicates clearing cloud-related data only, which includes cloud meta data and cloud-related local data. + * Clear cloud-related data only, which includes the cloud meta data and + * local cloud-related data. * * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi @@ -35,7 +37,7 @@ declare namespace cloudData { CLEAR_CLOUD_INFO, /** - * Indicates clearing all cloud-related file data,which synchronized with the cloud. + * Clear all cloud-related file data, which is synchronized with the cloud. * * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi @@ -45,7 +47,7 @@ declare namespace cloudData { } /** - * Provides methods to set CloudSync config. + * Provides methods to set cloud-device synchronization. * * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi @@ -56,13 +58,19 @@ declare namespace cloudData { * 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. + * @param { string } accountId - Indicates the account ID, which is + * a value obtained by hashing the cloud account ID. + * @param { { [bundleName:string]:boolean } } switches - Indicates switches + * of all applications. It overwrites the saved application switch information. + * If an application switch changes, the {@link changeAppCloudSwitch + * (accountId: string, bundleName: string, status: boolean)} method will be + * called to notify the data manager service. + * @param { AsyncCallback } callback - Indicates the callback invoked + * to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -79,13 +87,18 @@ declare namespace cloudData { * 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. + * @param { string } accountId - Indicates the account ID, which is + * a value obtained by hashing the cloud account ID. + * @param { { [bundleName:string]:boolean } } switches - Indicates switches + * of all applications. It overwrites the saved application switch information. + * If an application switch changes, the {@link changeAppCloudSwitch + * (accountId: string, bundleName: string, status: boolean)} method will be + * called to notify the data manager service. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -98,10 +111,14 @@ declare namespace cloudData { * 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. + * @param { string } accountId - Indicates the account ID, which is + * a value obtained by hashing the cloud account ID. + * @param { AsyncCallback } callback - Indicates the callback invoked + * to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -114,10 +131,13 @@ declare namespace cloudData { * 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. + * @param { string } accountId - Indicates the account ID, which is + * a value obtained by hashing the cloud account ID. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -130,12 +150,18 @@ declare namespace cloudData { * 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 } accountId - Indicates the account ID, which is a value + * obtained by hashing the cloud account ID. * @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. + * @param { boolean } status - Indicates whether to enable cloud-device + * synchronization. The value true means to enable cloud-device + * synchronization; the value false means the opposite. + * @param { AsyncCallback } callback - Indicates the callback invoked + * to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -153,12 +179,17 @@ declare namespace cloudData { * 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 } accountId - Indicates the account ID, which is a value + * obtained by hashing the cloud account ID. * @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. + * @param { boolean } status - Indicates whether to enable cloud-device + * synchronization. The value true means to enable cloud-device + * synchronization; the value false means the opposite. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -168,48 +199,60 @@ declare namespace cloudData { static changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise; /** - * notifies changes of the cloud records + * 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 } accountId - Indicates the account ID, which is a value + * obtained by hashing the cloud account ID. * @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. + * @param { AsyncCallback } callback - Indicates the callback invoked + * to report the data changes. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi * @since 10 */ static notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback): void; /** - * notifies changes of the cloud records + * 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 } accountId - Indicates the account ID, which is a value + * obtained by hashing the cloud account ID. * @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. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi * @since 10 */ static notifyDataChange(accountId: string, bundleName: string): Promise; /** - * deletes cloud information from local data. + * Clears cloud information from the local device. * * @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. + * @param { string } accountId - Indicates the account ID, which is a value + * obtained by hashing the cloud account ID. + * @param { { [bundleName: string]: ClearAction } } appActions - Indicates + * the clear operation to perform. + * @param { AsyncCallback } callback - Indicates the callback invoked + * to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -223,14 +266,18 @@ declare namespace cloudData { ): void; /** - * deletes cloud information from local data. + * Clears cloud information from a local device. * * @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. + * @param { string } accountId - Indicates the account ID, which is a value + * obtained by hashing the cloud account ID. + * @param { { [bundleName: string]: ClearAction } } appActions - Indicates + * the clear operation to perform. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.DistributedDataManager.CloudSync.Config @@ -239,6 +286,632 @@ declare namespace cloudData { */ static clear(accountId: string, appActions: { [bundleName: string]: ClearAction }): Promise; } + + /** + * Provides methods to implement cloud sharing. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + export namespace Sharing { + /** + * Enumerates the roles. + * + * @enum { number } + * @syscap systemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + enum Role { + /** + * Inviter of cloud sharing. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + ROLE_INVITER, + + /** + * Invitee of cloud sharing. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + ROLE_INVITEE + } + + /** + * Enumerates the statuses of sharing invitation. + * + * @enum { number } + * @syscap systemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + enum Status { + /** + * Unknown status. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + STATUS_UNKNOWN, + + /** + * Accept the sharing invitation. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + STATUS_ACCEPTED, + + /** + * Reject the sharing invitation. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + STATUS_REJECTED, + + /** + * Suspend the sharing process. + * + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + STATUS_SUSPENDED, + } + + /** + * Result interface. + * + * @interface Result + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @StageModelOnly + * @since 11 + */ + export interface Result { + /** + * Error code. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + code: number; + + /** + * The result value. + * + * @type { T } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + value: T; + } + + /** + * Privilege for the shared data. + * + * @interface Privilege + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + export interface Privilege { + /** + * Whether the participants can write the shared data. The value true + * means the participants can write the shared data; the value false + * means the opposite. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + writeable?: boolean; + + /** + * Whether the participants can read the shared data. The value true + * means the participants can read the shared data; the value false + * means the opposite. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + readable?: boolean; + + /** + * Whether the participants can create data. The value true + * means the participants can create data; the value false + * means the opposite. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + creatable?: boolean; + + /** + * Whether the participants can delete the shared data. The value true + * means the participants can delete the shared data; the value false + * means the opposite. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + deletable?: boolean; + + /** + * Whether the participants can share the data. The value true + * means the participants can share the data; the value false + * means the opposite. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + shareable?: boolean; + } + + /** + * Participants in cloud sharing. + * + * @interface Participant + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + export interface Participant { + /** + * Identity of participant. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + identity: string; + + /** + * Role of the participant, which can be inviter or invitee. + * + * @type { ?Role } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + role?: Role; + + /** + * Status of the sharing invitation. + * + * @type { ?Status } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + status?: Status; + + /** + * Permissions for the shared data. + * + * @type { ?Privilege } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + privilege?: Privilege; + } + + /** + * Allocates shared resources based on conditions, + * and shares data with the specified privilege to participants. + * + * @param { string } storeId - Indicates relational store name. + * @param { relationalStore.RdbPredicates } predicates - See {@link relationalStore.RdbPredicates}. + * @param { Array } participants - Participants to share. + * @param { AsyncCallback } callback - Indicates the + * callback invoked to return the {@link relationalStore.ResultSet}. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function allocResourceAndShare( + storeId: string, + predicates: relationalStore.RdbPredicates, + participants: Array, + callback: AsyncCallback + ): void; + + /** + * Allocates shared resources based on conditions, + * and shares data with the specified privilege to participants. + * + * @param { string } storeId - Indicates relational store name. + * @param { relationalStore.RdbPredicates } predicates - See {@link relationalStore.RdbPredicates}. + * @param { Array } columns - Columns to be shared. + * @param { Array } participants - Participants to share. + * @param { AsyncCallback } callback - Indicates the + * callback invoked to return the {@link relationalStore.ResultSet}. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function allocResourceAndShare( + storeId: string, + predicates: relationalStore.RdbPredicates, + participants: Array, + columns: Array, + callback: AsyncCallback + ): void; + + /** + * Allocates shared resources based on conditions, + * and shares data with the specified privilege to participants. + * + * @param { string } storeId - Indicates relational store name. + * @param { relationalStore.RdbPredicates } predicates - See {@link relationalStore.RdbPredicates}. + * @param { Array } participants - Participants to share. + * @param { Array } [columns] - Columns to be shared. + * @param { Promise } - Promise used to return {@link relationalStore.ResultSet}. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function allocResourceAndShare( + storeId: string, + predicates: relationalStore.RdbPredicates, + participants: Array, + columns?: Array + ): Promise; + + /** + * Shares data with the specified privilege to participants. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the participants + * involved in the data sharing. + * @param { AsyncCallback>> } callback - Indicates the + * callback invoked to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function share( + sharingRes: string, + participants: Array, + callback: AsyncCallback>> + ): void; + + /** + * Shares data with the specified privilege to participants. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the participants + * involved in the data sharing. + * @Returns { Promise>> } - Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function share(sharingRes: string, participants: Array): Promise>>; + + /** + * Unshares data. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the participants + * involved. + * @param { AsyncCallback>> } callback - Indicates the callback invoked + * to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function unshare( + sharingRes: string, + participants: Array, + callback: AsyncCallback>> + ): void; + + /** + * Unshares data. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the participants + * involved. + * @Returns { Promise>> } - Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function unshare(sharingRes: string, participants: Array): Promise>>; + + /** + * Exit sharing. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { AsyncCallback } callback - The callback of exit. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function exit(sharingRes: string, callback: AsyncCallback): void; + + /** + * Exit sharing. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @Returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function exit(sharingRes: string): Promise; + + /** + * Changes the permissions for the shared data. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the participants + * whose permissions are to be changed. + * @param { AsyncCallback>> } callback - Indicates the + * callback invoked to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function changePrivilege( + sharingRes: string, + participants: Array, + callback: AsyncCallback>> + ): void; + + /** + * Changes the permissions for the shared data. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the participants + * whose permissions are to be changed. + * @Returns { Promise>> } - Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function changePrivilege( + sharingRes: string, + participants: Array + ): Promise>>; + + /** + * Queries the participants based on the specified shared data. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { AsyncCallback>> } callback - Indicates the + * callback invoked to return the participants obtained. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function queryParticipants(sharingRes: string, callback: AsyncCallback>>): void; + + /** + * Queries the participants based on the specified shared data. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @Returns { Promise>> } - Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function queryParticipants(sharingRes: string): Promise>>; + + /** + * Queries the participants based on the specified invitation code. + * + * @param { string } InvitationCode - Indicates the invitation code. + * @param { AsyncCallback>> } callback - Indicates the + * callback invoked to return the participants obtained. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function queryParticipantsByInvitation( + InvitationCode: string, + callback: AsyncCallback>> + ): void; + + /** + * Queries the participants based on the specified invitation code. + * + * @param { string } InvitationCode - Indicates the invitation code. + * @Returns { Promise>> } - Promise used to return the result. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function queryParticipantsByInvitation(InvitationCode: string): Promise>>; + + /** + * Confirms the invitation of cloud sharing. + * + * @param { string } invitationCode - Indicates the invitation code. + * @param { Status } status - Indicates the status of invitation. + * @param { AsyncCallback> } callback - Indicates the callback + * invoked to return the sharing resource. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function confirmInvitation(invitationCode: string, status: Status, callback: AsyncCallback>): void; + + /** + * Confirms the invitation of cloud sharing. + * + * @param { string } invitationCode - Indicates the invitation code. + * @param { Status } status - Indicates the status of invitation. + * @Returns { Promise> } - Promise used to return the sharing resource. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function confirmInvitation(invitationCode: string, status: Status): Promise>; + + /** + * Changes confirmation of shared record. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Status } status - Indicates the status of invitation. + * @param { AsyncCallback } callback - Indicates the callback. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function changeConfirmation(sharingRes: string, status: Status, callback: AsyncCallback): void; + + /** + * Changes confirmation of shared record. + * + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Status } status - Indicates the status of invitation. + * @Returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, which + * is usually returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed, which is + * returned when the system API is not called by a system application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi + * @since 11 + */ + function changeConfirmation(sharingRes: string, status: Status): Promise; + } } export default cloudData; diff --git a/interface_sdk/api/@ohos.data.cloudExtension.d.ts b/interface_sdk/api/@ohos.data.cloudExtension.d.ts index 58f04a3b8609689f5e67b518d3fc4f385e2b6884..cca2371c329aa145b6518926d3c2ad6948ae6432 100644 --- a/interface_sdk/api/@ohos.data.cloudExtension.d.ts +++ b/interface_sdk/api/@ohos.data.cloudExtension.d.ts @@ -13,801 +13,40 @@ * limitations under the License. */ -import relationalStore from './@ohos.data.relationalStore'; import rpc from './@ohos.rpc'; import cloudData from "./@ohos.data.cloudData"; +import Result = cloudData.Sharing.Result; /** * Provides interfaces to implement extended cloud capabilities. * * @namespace cloudExtension - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @since 11 */ declare namespace cloudExtension { /** - * Defines valuesBucket, see {@link relationalStore.ValuesBucket}. + * Defines participant. * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - type ValuesBucket = relationalStore.ValuesBucket; - - type Participant = cloudData.Sharing.Participant; - type ParticipantStatus = cloudData.Sharing.Status; - - /** - * Defines cloud information. - * - * @interface CloudInfo - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface CloudInfo { - /** - * Cloud information. For details, see {@link ServiceInfo}. - * - * @type { ServiceInfo } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - cloudInfo: ServiceInfo; - - /** - * Defines brief application information. - * - * @type { object } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - apps: { [bundleName: string]: AppBriefInfo }; - } - - /** - * Defines cloud service information. - * - * @interface ServiceInfo - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface ServiceInfo { - /** - * Whether cloud is enabled. The value true means cloud is enabled; - * the value false means the opposite. - * - * @type { boolean } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - enableCloud: boolean; - - /** - * ID of the cloud account generated by using SHA-256. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - id: string; - - /** - * Total space (in KB) of the account on the server. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - totalSpace: number; - - /** - * Available space (in KB) of the account on the server. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - remainSpace: number; - - /** - * Current user of the device. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - user: number; - } - - /** - * Defines the brief application information. - * - * @interface AppBriefInfo - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface AppBriefInfo { - /** - * ID of the application. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - appId: string; - - /** - * Bundle name. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - bundleName: string; - - /** - * Whether cloud is enabled for the application. - * The value true means the cloud is enabled; the false means - * the opposite. - * - * @type { boolean } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - cloudSwitch: boolean; - - /** - * Application instance ID. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - instanceId: number; - } - - /** - * Enumerates the field types. - * - * @enum { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export enum FieldType { - /** - * NULL. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - NULL = 0, - - /** - * Number. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - NUMBER, - - /** - * Real. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - REAL, - - /** - * Text. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - TEXT, - - /** - * Boolean. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - BOOL, - - /** - * BLOB. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - BLOB, - - /** - * Asset. For details, see {@link relationalStore.Asset}. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - ASSET, - - /** - * Assets. For details, see {@link relationalStore.Assets}. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - ASSETS - } - - /** - * Defines the fields. - * - * @interface Field - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface Field { - /** - * Alias of the field on the server. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - alias: string; - - /** - * Column name. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - colName: string; - - /** - * Type of the field. For details, see {@link FieldType}. - * - * @type { FieldType } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - type: FieldType; - - /** - * Whether the current column holds the primary key. - * - * @type { boolean } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - primary: boolean; - - /** - * Whether the current column is nullable. - * - * @type { boolean } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - nullable: boolean; - } - - /** - * Defines a table. - * - * @interface Table - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface Table { - /** - * Alias of the table on the server. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - alias: string; - - /** - * Name of the table. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - name: string; - - /** - * Fields in the table. For details, see {@link Field}. - * - * @type { Field[] } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - fields: Field[]; - } - - /** - * Defines a database. - * - * @interface Database - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface Database { - /** - * Name of the database. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - name: string; - - /** - * Alias of the database on the server. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - alias: string; - - /** - * Tables in the database. For details, see {@link Table}. - * - * @type { Table[] } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - tables: Table[]; - } - - /** - * Defines the application schema. - * - * @interface AppSchema - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface AppSchema { - /** - * Bundle name of the application. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - bundleName: string; - - /** - * Schema version. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - version: number; - - /** - * Databases {@link Database} of the application. - * - * @type { Array } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - databases: Array; - } - - /** - * Defines the data in the cloud. - * - * @interface CloudData - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface CloudData { - /** - * Next cursor for query. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - nextCursor: string; - - /** - * Whether the server has more data to query {@link CloudDB.query()}. - * - * @type { boolean } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - hasMore: boolean; - - /** - * Array of data queried, including the data values and extension - * values {@link ExtensionValue}. - * - * @type { Array } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - values: Array; - } - - /** - * Defines the subscription information. - * - * @interface SubscribeInfo - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface SubscribeInfo { - /** - * Subscription expiration time, in milliseconds. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - expirationTime: number; - - /** - * Data to be observed. - * - * @type { object } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - subscribe: { [bundleName: string]: Array }; - } - - /** - * Defines the subscription ID. - * - * @interface SubscribeId - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface SubscribeId { - /** - * Alias of the database on the server. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - databaseAlias: string; - - /** - * Subscription ID generated by {@link CloudService.subscribe()}. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - id: string; - } - - /** - * Enumerates the operations that can be performed on the database. - * - * @enum { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export enum Flag { - /** - * Insert data. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - INSERT, - - /** - * Update data. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - UPDATE, - - /** - * Delete data. - * - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - DELETE - } - - /** - * Defines the extension values. - * - * @interface ExtensionValue - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface ExtensionValue { - /** - * ID generated by {@link CloudDB.insert()}. - * An ID is generated for each row when data is first inserted to the cloud. - * The ID must be unique for each table. - * - * @type { string } - * @readonly - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - readonly id: string; - - /** - * Time when the row data was created. - * - * @type { number } - * @readonly - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - readonly createTime: number; - - /** - * Time when the row data was last modified. - * - * @type { number } - * @readonly - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - readonly modifiedTime: number; - - /** - * Database operation. - * - * @type { Flag } - * @readonly - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - readonly operation: Flag; - } - - /** - * Defines the lock information. - * - * @interface LockInfo - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface LockInfo { - /** - * Duration for which the cloud database is locked, in seconds. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - interval: number; - - /** - * Session ID for locking the cloud database. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - sessionId: number; - } - - /** - * Enumerates the error codes. - * - * @enum { number } - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - export enum ErrorCode { - /** - * Successful. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - SUCCESS, - - /** - * Unknown error. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - UNKNOWN_ERROR, - - /** - * Network error. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - NETWORK_ERROR, - - /** - * Cloud is disabled. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - CLOUD_DISABLED, - - /** - * The cloud database is locked by others. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - LOCKED_BY_OTHERS, - - /** - * The number of records exceeds the limit. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - RECORD_LIMIT_EXCEEDED, - - /** - * The cloud has no space for the asset. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @since 11 - */ - NO_SPACE_FOR_ASSET - } - - /** - * Defines the result. - * - * @interface Result - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface Result { - /** - * Error code {@link ErrorCode}. - * - * @type { number } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - code: number; - - /** - * Result value. - * - * @type { T } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - value: T; - } - - /** - * Creates a cloud service stub with the specified instance. - * - * @param { CloudService } instance - Indicates the CloudService instance. - * @returns { Promise } Returns the remote object. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - function createCloudServiceStub(instance: CloudService): Promise; - - /** - * Creates a cloud database stub with the specified instance. - * - * @param { CloudDB } instance - Indicates the CloudDB instance. - * @returns { Promise } Returns the remote object. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @since 11 */ - function createCloudDBStub(instance: CloudDB): Promise; + type Participant = cloudData.Sharing.Participant; /** - * Creates an asset loader stub with the specified instance. + * Defines participantStatus. * - * @param { AssetLoader } instance - Indicates the AssetLoader instance. - * @returns { Promise } Returns remote object. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @since 11 */ - function createAssetLoaderStub(instance: AssetLoader): Promise; + type ParticipantStatus = cloudData.Sharing.Status; /** * Creates a share service stub with the specified instance. * * @param { ShareService } instance - Indicates the ShareService instance. * @returns { Promise } Returns remote object. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ @@ -817,11 +56,23 @@ declare namespace cloudExtension { * Provides interfaces for implementing ShareService. * * @interface ShareService - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ export interface ShareService { + /** + * Share data with specific participants. + * + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the {@link Participant}. + * @returns { Promise>>> } Returns the sharing result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ share( userId: number, bundleName: string, @@ -829,6 +80,18 @@ declare namespace cloudExtension { participants: Array ): Promise>>>; + /** + * Unshare data with specific participants. + * + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the {@link Participant}. + * @returns { Promise>>> } Returns the sharing result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ unshare( userId: number, bundleName: string, @@ -836,322 +99,132 @@ declare namespace cloudExtension { participants: Array ): Promise>>>; - exit(userId: number, bundleName: string, sharingRes: string): Promise; - - changePrivilege( - userId: number, - bundleName: string, - sharingRes: string, - participants: Array - ): Promise>>>; - - queryParticipants( - userId: number, - bundleName: string, - sharingRes: string - ): Promise>>; - - confirmInvitation( - userId: number, - bundleName: string, - invitationCode: string, - status: ParticipantStatus - ): Promise; - - changeConfirmation(userId: number, bundleName: string, sharingRes: string, status: ParticipantStatus): Promise; - } - - /** - * Provides interfaces for implementing CloudService. - * - * @interface CloudService - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface CloudService { - /** - * Obtains the service information. - * - * @returns { Promise } Returns the service information obtained. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - getServiceInfo(): Promise; - - /** - * Obtains the brief application information. - * - * @returns { Promise<{ [bundleName: string]: AppBriefInfo }> } - * Returns the key-value pairs corresponding to bundle and - * AppBriefInfo. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - getAppBriefInfo(): Promise<{ [bundleName: string]: AppBriefInfo }>; - - /** - * Obtains the application schema information. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @returns { Promise> } Returns AppSchema. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - getAppSchema(bundleName: string): Promise>; - - /** - * Subscribes to data changes in the cloud. - * When the cloud server data is changed, the server notifies the device of - * the data change. - * - * @param { object } subInfo - Indicates - * the data to be subscribed to, that is, the key-value pairs corresponding - * to an array of bundle names and databases. - * @param { number } expirationTime - Indicates the subscription expiration - * time. - * @returns { Promise> } Returns SubscribeInfo. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - subscribe( - subInfo: { [bundleName: string]: Array }, - expirationTime: number - ): Promise>; - - /** - * Unsubscribes from the data changes in the cloud. - * - * @param { object } unsubscribeInfo - Indicates - * the data to be unsubscribe from, that is, the key-value pairs - * corresponding to an array of bundle names and databases. - * @returns { Promise } Returns unsubscribeInfo result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - unsubscribe(unsubscribeInfo: { [bundleName: string]: Array }): Promise; - - /** - * Connects to a database. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { Database } database - Indicates the database to connect. - * @returns { Promise } Returns connectDB RemoteObject. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - connectDB(bundleName: string, database: Database): Promise; - - /** - * Connects to an assetLoader. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { Database } database - Indicates the database of bundle. - * @returns { Promise } Returns connectAssetLoader RemoteObject. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - connectAssetLoader(bundleName: string, database: Database): Promise; - - /** - * Connects to a share service. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @returns { Promise } Returns connectAssetLoader RemoteObject. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - connectShareService(bundleName: string): Promise; - } - - /** - * Provides interfaces for the operations on the cloud database. - * - * @interface CloudDB - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - export interface CloudDB { - /** - * Generates the IDs of the rows of data to be inserted to the cloud. - * The IDs must be unique for each table. - * - * @param { number } count - Indicates the number of IDs to generate. - * @returns { Promise> } Returns the IDs generated. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - generateId(count: number): Promise>; - - /** - * Inserts data to the cloud. - * - * @param { string } table - Indicates the table name. - * @param { ValuesBucket[] } values - Indicates the data to insert. - * @param { ValuesBucket[] } extValues - Indicates the extension - * values {@link ExtensionValue}. - * @returns { Promise> } Returns the insert result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - insert(table: string, values: ValuesBucket[], extValues: ValuesBucket[]): Promise>; - /** - * Updates data in the cloud. + * Exit the sharing. * - * @param { string } table - Indicates the table name. - * @param { ValuesBucket[] } values - Indicates the new data. - * @param { ValuesBucket[] } extValues - Indicates the extension - * values {@link ExtensionValue}. - * @returns { Promise> } Returns the update result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } sharingRes - Indicates the sharing resource. + * @returns { Promise> } Returns the exit result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - update(table: string, values: ValuesBucket[], extValues: ValuesBucket[]): Promise>; + exit(userId: number, bundleName: string, sharingRes: string): Promise>; /** - * Deletes data. + * Changes privilege of the specific participants. * - * @param { string } table - Indicates the table name. - * @param { ValuesBucket[] } extValues - Indicates the extension - * values {@link ExtensionValue}. - * @returns { Promise> } Returns the delete result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } sharingRes - Indicates the sharing resource. + * @param { Array } participants - Indicates the {@link Participant}. + * @returns { Promise>>> } Returns the changing result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - delete(table: string, extValues: ValuesBucket[]): Promise>; + changePrivilege( + userId: number, + bundleName: string, + sharingRes: string, + participants: Array + ): Promise>>>; /** - * Queries data. + * Query participants of the specific sharing resource. * - * @param { string } table - Indicates the table name. - * @param { string[] } fields - Indicates the columns to query. - * @param { number } queryCount - Indicates the number of data records - * to query. - * @param { string } queryCursor - Indicates the cursor. - * @returns { Promise> } Returns the query result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } sharingRes - Indicates the sharing resource. + * @returns { Promise>> } Returns the query result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - query(table: string, fields: string[], queryCount: number, queryCursor: string): Promise>; + queryParticipants( + userId: number, + bundleName: string, + sharingRes: string + ): Promise>>; /** - * Locks the cloud database. - * The cloud database will be unlocked when the lock interval has expired. - * When the cloud database is locked, other devices cannot synchronize data - * with the cloud. + * Query participants based on the specified invitation code. * - * @returns { Promise> } Returns the locked information. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } invitationCode - Indicates the invitation code. + * @returns { Promise>> } Returns the query result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - lock(): Promise>; + queryParticipantsByInvitation( + userId: number, + bundleName: string, + invitationCode: string + ): Promise>>; /** - * Uses the heartbeat to extend the lock interval if it is not enough. + * Confirms invitation. * - * @param { number } sessionId - Indicates the session ID of the heartbeat. - * @returns { Promise> } Returns the time. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } invitationCode - Indicates the invitation code. + * @param { ParticipantStatus } status - Indicates the {@link ParticipantStatus}. + * @returns { Promise> } Returns the sharing resource. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - heartbeat(sessionId: number): Promise>; + confirmInvitation( + userId: number, + bundleName: string, + invitationCode: string, + status: ParticipantStatus + ): Promise>; /** - * Unlocks the cloud database. + * Changes confirmation. * - * @param { number } sessionId - Indicates the session ID. - * @returns { Promise> } Returns the unlock result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } sharingRes - Indicates the sharing resource. + * @param { ParticipantStatus } status - Indicates the {@link ParticipantStatus}. + * @returns { Promise> } Returns the change result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - unlock(sessionId: number): Promise>; + changeConfirmation( + userId: number, + bundleName: string, + sharingRes: string, + status: ParticipantStatus + ): Promise>; } /** - * Provides interface for managing cloud assets. + * Provides interfaces for implementing CloudService. * - * @interface CloudAsset - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @interface CloudService + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - export interface CloudAsset extends relationalStore.Asset { - /** - * Asset ID. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - assetId: string; - - /** - * Asset hash value. - * - * @type { string } - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - hash: string; - } - + export interface CloudService { /** - * Provides interfaces for implementing the asset loader. + * Connects to a share center. * - * @interface AssetLoader - * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @returns { Promise } Returns connectAssetLoader RemoteObject. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - export interface AssetLoader { - - /** - * Downloads assets. - * - * @param { string } table - Indicates the name of the table. - * @param { string } gid - Indicates the GID. - * @param { string } prefix - Indicates the prefix information. - * @param { CloudAsset[] } assets - Indicates the assets to download. - * @returns { Promise[]> } Returns the asset download result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - download(table: string, gid: string, prefix: string, assets: CloudAsset[]): Promise[]>; - - /** - * Uploads assets. - * - * @param { string } table - Indicates the name of the table. - * @param { string } gid - Indicates the GID. - * @param { CloudAsset[] } assets - Indicates the assets to upload. - * @returns { Promise[]> } Returns the asset upload result. - * @syscap systemCapability.DistributedDataManager.CloudData.Extension - * @systemapi - * @since 11 - */ - upload(table: string, gid: string, assets: CloudAsset[]): Promise[]>; + connectShareCenter(userId: number, bundleName: string): Promise; } } -export default cloudExtension; \ No newline at end of file +export default cloudExtension; diff --git a/interface_sdk/api/@ohos.data.relationalStore.d.ts b/interface_sdk/api/@ohos.data.relationalStore.d.ts index 559ca21cec53f5476dd77a1206dd0b3b57171372..a3f2e3630230181dc73a5acb1e0d143dc4737b85 100644 --- a/interface_sdk/api/@ohos.data.relationalStore.d.ts +++ b/interface_sdk/api/@ohos.data.relationalStore.d.ts @@ -2748,6 +2748,76 @@ declare namespace relationalStore { primaryKeys: PRIKeyType[], callback: AsyncCallback ): void; + + /** + * SHARING_RESOURCE_FIELD. + * + * @readonly + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @systemapi + * @since 11 + */ + readonly SHARING_RESOURCE_FIELD: string; + + /** + * SHARING_RESULT_FIELD. + * + * @readonly + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @systemapi + * @since 11 + */ + readonly SHARING_RESULT_FIELD: string; + + /** + * Obtains sharing resource of rows corresponding to the predicates. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The callback of querySharingResource. + * {@link ResultSet} is query result. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @systemapi + * @since 11 + + */ + querySharingResource(predicates: RdbPredicates, callback: AsyncCallback): void; + + /** + * Obtains sharing resource of rows corresponding to the predicates. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The specified columns to query. + * @param { AsyncCallback } callback - The callback of querySharingResource. + * {@link ResultSet} is query result. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @systemapi + * @since 11 + */ + querySharingResource(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; + + /** + * Obtains sharing resource of rows corresponding to the predicates. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns? - The specified columns to query. + * @returns { Promise } -The promise returned by the function. + * {@link ResultSet} is query result. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @systemapi + * @since 11 + + */ + querySharingResource(predicates: RdbPredicates, columns?: Array): Promise; + /** * Executes a SQL statement that contains specified parameters but returns no value. *