From 7fda629db2619479d91e85c6270302d462359ff1 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Mon, 9 Oct 2023 14:22:04 +0800 Subject: [PATCH 1/3] update Signed-off-by: zuojiangjiang --- interface_sdk/api/@ohos.data.cloudData.d.ts | 688 +++++++--- .../api/@ohos.data.cloudExtension.d.ts | 1157 +++++++++++++++++ .../api/@ohos.data.officeCloudExtension.d.ts | 70 - .../api/@ohos.data.relationalStore.d.ts | 159 ++- 4 files changed, 1778 insertions(+), 296 deletions(-) create mode 100644 interface_sdk/api/@ohos.data.cloudExtension.d.ts delete mode 100644 interface_sdk/api/@ohos.data.officeCloudExtension.d.ts diff --git a/interface_sdk/api/@ohos.data.cloudData.d.ts b/interface_sdk/api/@ohos.data.cloudData.d.ts index 1e16d973..d87363db 100644 --- a/interface_sdk/api/@ohos.data.cloudData.d.ts +++ b/interface_sdk/api/@ohos.data.cloudData.d.ts @@ -18,7 +18,7 @@ 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 @@ -27,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 @@ -36,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 @@ -46,8 +47,9 @@ declare namespace cloudData { } /** - * Event ID indicates that data in the cloud has changed. + * ID of the event, which indicates the change of the data in the cloud. * + * @constant * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @since 11 */ @@ -63,15 +65,16 @@ declare namespace cloudData { */ interface ExtraData { /** - * Event identity. + * Event ID. * * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi * @since 11 */ eventId: string; /** - * Json string, contains the following optional fields. + * Extra data, which contains the following fields. * { * "accountId": "aaa", * "bundleName": "com.bbb.xxx", @@ -84,16 +87,17 @@ declare namespace cloudData { * "keyId": "", * "signV3": "" * } - * The accountId and bundleName are required among these. + * accountId and bundleName are mandatory. * * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @systemapi * @since 11 */ extraData: string; } /** - * Provides methods to set CloudSync config. + * Provides methods to set cloud-device synchronization. * * @syscap SystemCapability.DistributedDataManager.CloudSync.Config * @systemapi @@ -104,13 +108,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 @@ -127,13 +137,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 @@ -146,10 +161,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 @@ -162,10 +181,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 @@ -178,12 +200,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 @@ -201,12 +229,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 @@ -216,14 +249,18 @@ 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.Config @@ -233,14 +270,17 @@ declare namespace cloudData { 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.Config @@ -250,13 +290,17 @@ declare namespace cloudData { static notifyDataChange(accountId: string, bundleName: string): Promise; /** - * Notifies changes of the cloud records + * 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. + * @param { ExtraData } extInfo - Indicates the extra data for + * notification {@link ExtraData}. + * @param { AsyncCallback } callback - Indicates the callback invoked + * to return 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.Config @@ -269,10 +313,13 @@ declare namespace cloudData { * 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. + * @param { ExtraData } extInfo - Indicates the extra data for + * notification {@link ExtraData}. + * @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 @@ -283,14 +330,19 @@ declare namespace cloudData { static notifyDataChange(extInfo: ExtraData): 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 @@ -304,14 +356,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 @@ -322,25 +378,27 @@ declare namespace cloudData { } /** - * Provides methods to cloud sharing. + * Provides methods to implement cloud sharing. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ export namespace Sharing { /** - * Enumerates the role. + * Enumerates the roles. * * @enum { number } - * @syscap systemCapability.DistributedDataManager.CloudSync.Config + * @syscap systemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ enum Role { /** * Inviter of cloud sharing. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ ROLE_INVITER, @@ -348,24 +406,27 @@ declare namespace cloudData { /** * Invitee of cloud sharing. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ - ROLE_INVITEES + ROLE_INVITEE } /** - * Enumerates the status of sharing invitation. + * Enumerates the statuses of sharing invitation. * * @enum { number } - * @syscap systemCapability.DistributedDataManager.CloudSync.Config + * @syscap systemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ enum Status { /** * Unknown status. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ STATUS_UNKNOWN, @@ -373,7 +434,8 @@ declare namespace cloudData { /** * Accept the sharing invitation. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ STATUS_ACCEPTED, @@ -381,65 +443,118 @@ declare namespace cloudData { /** * Reject the sharing invitation. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ STATUS_REJECTED, /** - * Suspends the sharing process. + * Suspend the sharing process. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ STATUS_SUSPENDED, } /** - * Privilege for shared record. + * 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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ export interface Privilege { /** - * True means allow participants to write the shared record, otherwise not. + * 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. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ writeable?: boolean; /** - * True means allow participants to read the shared record, otherwise not. + * 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. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ readable?: boolean; /** - * True means allow participants to create new record, otherwise not. + * Whether the participants can create data. The value true + * means the participants can create data; the value false + * means the opposite. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ creatable?: boolean; /** - * True means allow participants to delete the shared record, otherwise not. + * 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. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ deletable?: boolean; /** - * True means allow participants to share with others, otherwise not. + * Whether the participants can share the data. The value true + * means the participants can share the data; the value false + * means the opposite. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ shareable?: boolean; @@ -449,258 +564,421 @@ declare namespace cloudData { * Participants in cloud sharing. * * @interface Participant - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ export interface Participant { /** - * The identity of participant. + * Identity of participant. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ identity: string; /** - * Inviter or Invitee. + * Role of the participant, which can be inviter or invitee. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?Role } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ role?: Role; /** - * The confirmation status of the sharing invitation. + * Status of the sharing invitation. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?Status } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ status?: Status; /** - * Permission to share records. + * Permissions for the shared data. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @type { ?Privilege } + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing + * @systemapi * @since 11 */ privilege?: Privilege; } /** - * Event ID indicates that data in the cloud has changed. + * Allocates shared resources based on conditions, + * and shares data with the specified privilege to participants. * - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @permission ohos.permission.CLOUDDATA_SHARING + * @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 */ - const RESULT_FIELD = "sharing_result"; - const RESOURCE_FIELD = "sharing_resource"; - - function allocResourceAndshare( + 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 + /** + * Allocates shared resources based on conditions, + * and shares data with the specified privilege to participants. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @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; - function allocResourceAndshare( - storeId: string, - predicates: relationalStore.RdbPredicates, - participants: Array, - columns?: Array + /** + * Allocates shared resources based on conditions, + * and shares data with the specified privilege to participants. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @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; /** - * Share record with specified privilege to participants. + * Shares data with the 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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ function share( sharingRes: string, participants: Array, - callback: AsyncCallback> + callback: AsyncCallback>> ): void; /** - * Share record with specified privilege to participants. + * Shares data with the 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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function share(sharingRes: string, participants: Array): Promise>; + function share(sharingRes: string, participants: Array): Promise>>; /** - * Unshare with participants. + * Unshares data. * * @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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function unshare(sharingRes: string, participants: Array, callback: AsyncCallback>): void; + function unshare( + sharingRes: string, + participants: Array, + callback: AsyncCallback>> + ): void; /** - * Unshare with participants. + * Unshares data. * * @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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function unshare(sharingRes: string, participants: Array): Promise>; + function unshare(sharingRes: string, participants: Array): Promise>>; + /** + * Exit sharing. + * + * @permission ohos.permission.CLOUDDATA_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. + * + * @permission ohos.permission.CLOUDDATA_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; /** - * Change privilege for shared record. + * Changes the permissions for the shared data. * * @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. + * @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..0 - * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ function changePrivilege( sharingRes: string, participants: Array, - callback: AsyncCallback> + callback: AsyncCallback>> ): void; /** - * Change privilege for shared record. + * Changes the permissions for the shared data. * * @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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function changePrivilege(sharingRes: string, participants: Array): Promise>; + function changePrivilege( + sharingRes: string, + participants: Array + ): Promise>>; /** - * Query the participants by specified shared record. + * Queries the participants based on the specified shared data. * * @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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function queryParticipants(sharingRes: string, callback: AsyncCallback>): void; + function queryParticipants(sharingRes: string, callback: AsyncCallback>>): void; /** - * Query the participants by specified shared record. + * Queries the participants based on the specified shared data.. * * @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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function queryParticipants(sharingRes: string): Promise>; + function queryParticipants(sharingRes: string): Promise>>; /** - * Confirm the invitation of cloud sharing. + * Confirms 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. + * @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.CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function confirmInvitation(invitationCode: string, status: Status, callback: AsyncCallback): void; + function confirmInvitation(invitationCode: string, status: Status, callback: AsyncCallback>): void; /** - * Confirm the invitation of cloud sharing. + * Confirms 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. + * @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.. - * .CloudSync.Config + * @syscap SystemCapability.DistributedDataManager.CloudData.Sharing * @systemapi * @since 11 */ - function confirmInvitation(invitationCode: string, status: Status): Promise; + function confirmInvitation(invitationCode: string, status: Status): Promise>; + /** + * Changes confirmation of shared record. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @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. + * + * @permission ohos.permission.CLOUDDATA_SHARING + * @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; } } diff --git a/interface_sdk/api/@ohos.data.cloudExtension.d.ts b/interface_sdk/api/@ohos.data.cloudExtension.d.ts new file mode 100644 index 00000000..58f04a3b --- /dev/null +++ b/interface_sdk/api/@ohos.data.cloudExtension.d.ts @@ -0,0 +1,1157 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import relationalStore from './@ohos.data.relationalStore'; +import rpc from './@ohos.rpc'; +import cloudData from "./@ohos.data.cloudData"; + +/** + * Provides interfaces to implement extended cloud capabilities. + * + * @namespace cloudExtension + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @since 11 + */ +declare namespace cloudExtension { + /** + * Defines valuesBucket, see {@link relationalStore.ValuesBucket}. + * + * @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 + * @since 11 + */ + function createCloudDBStub(instance: CloudDB): Promise; + + /** + * Creates an asset loader stub with the specified instance. + * + * @param { AssetLoader } instance - Indicates the AssetLoader instance. + * @returns { Promise } Returns remote object. + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @systemapi + * @since 11 + */ + function createAssetLoaderStub(instance: AssetLoader): Promise; + + /** + * 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 + * @systemapi + * @since 11 + */ + function createShareServiceStub(instance: ShareService): Promise; + + /** + * Provides interfaces for implementing ShareService. + * + * @interface ShareService + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @systemapi + * @since 11 + */ + export interface ShareService { + share( + userId: number, + bundleName: string, + sharingRes: string, + participants: Array + ): Promise>>>; + + unshare( + userId: number, + bundleName: string, + sharingRes: string, + 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. + * + * @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 + * @systemapi + * @since 11 + */ + update(table: string, values: ValuesBucket[], extValues: ValuesBucket[]): Promise>; + + /** + * Deletes data. + * + * @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 + * @systemapi + * @since 11 + */ + delete(table: string, extValues: ValuesBucket[]): Promise>; + + /** + * Queries data. + * + * @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 + * @systemapi + * @since 11 + */ + query(table: string, fields: string[], queryCount: number, queryCursor: 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. + * + * @returns { Promise> } Returns the locked information. + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @systemapi + * @since 11 + */ + lock(): Promise>; + + /** + * Uses the heartbeat to extend the lock interval if it is not enough. + * + * @param { number } sessionId - Indicates the session ID of the heartbeat. + * @returns { Promise> } Returns the time. + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @systemapi + * @since 11 + */ + heartbeat(sessionId: number): Promise>; + + /** + * Unlocks the cloud database. + * + * @param { number } sessionId - Indicates the session ID. + * @returns { Promise> } Returns the unlock result. + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @systemapi + * @since 11 + */ + unlock(sessionId: number): Promise>; + } + + /** + * Provides interface for managing cloud assets. + * + * @interface CloudAsset + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @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; + } + + /** + * Provides interfaces for implementing the asset loader. + * + * @interface AssetLoader + * @syscap systemCapability.DistributedDataManager.CloudData.Extension + * @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[]>; + } +} + +export default cloudExtension; \ No newline at end of file diff --git a/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts b/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts deleted file mode 100644 index 080ad059..00000000 --- a/interface_sdk/api/@ohos.data.officeCloudExtension.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import ExtensionContext from './application/ExtensionContext'; -import ipc from './@ohos.rpc' -import cloudData from "./@ohos.data.cloudData"; - -type Participant = cloudData.Sharing.Participant; -type ParticipantStatus = cloudData.Sharing.Status; - -interface Result { - code: number; - value: T; -} - -export default class OfficeCloud { - share( - userId: number, - bundleName: string, - sharingRes: string, - participants: Array - ): Promise>>>; - - unshare( - userId: number, - bundleName: string, - sharingRes: string, - participants: Array - ): Promise>>>; - - exit(userId: number, bundleName: string, sharingRes: string): Promise; - - modifyPrivilege( - 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; -} - -declare namespace OfficeCloudExtension { - function createOfficeCloudStub(context: ExtensionContext, impl: OfficeCloud): Promise; -} - diff --git a/interface_sdk/api/@ohos.data.relationalStore.d.ts b/interface_sdk/api/@ohos.data.relationalStore.d.ts index 7daf768c..96035590 100644 --- a/interface_sdk/api/@ohos.data.relationalStore.d.ts +++ b/interface_sdk/api/@ohos.data.relationalStore.d.ts @@ -732,12 +732,6 @@ declare namespace relationalStore { DISTRIBUTED_CLOUD } - interface ColumnVector { - originTable: string; - endTable: string; - fields: { [origin: string]: string } - } - /** * Manages the distributed configuration of the table. * @@ -754,7 +748,13 @@ declare namespace relationalStore { */ autoSync: boolean; - references?: Array + /** + * Specifies whether retain data for cloud delete, default false. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + retainData?: boolean; } /** @@ -821,6 +821,39 @@ declare namespace relationalStore { ON_CONFLICT_REPLACE = 5 } + /** + * Describes the sources to modify data. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + enum Location { + /** + * Indicates local operation modify the data. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + LOCAL, + + /** + * Indicates cloud operation modify the data. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + CLOUD, + + /** + * Indicates remote operation modify the data. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + REMOTE, + } + /** * Manages relational database configurations. * @@ -835,16 +868,28 @@ declare namespace relationalStore { * @since 10 */ class RdbPredicates { - - // = "#_cursor" /** * The CURSOR field name {#_cursor}. * + * If not specify local field, cursor would acts on all {@link Location}. + * + * @readonly * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @crossplatform * @since 11 */ readonly CURSOR_FIELD: string; + + /** + * The LOCATION field name {#_location}. + * + * Location field for cursor query, value detail see {@link Location}. + * + * @readonly + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + readonly LOCATION_FIELD: string; + /** * A parameterized constructor used to create a RdbPredicates instance. * @@ -2758,25 +2803,97 @@ declare namespace relationalStore { ): void; /** - * Queries data in the database based on specified conditions. + * Cleans the retained data deleted in cloud. * - * @param { RdbPredicates } predicates - The specified the from table and the where condition - * by the instance object of {@link RdbPredicates}. - * @param { Array } columns - The selection columns except cloud resource. - * If it is null or undefined, the selection only has cloud resource. - * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @param { string } table - Indicates the name of the table to check. + * @param { AsyncCallback } callback - The callback of clean. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + clean(table: string, callback: AsyncCallback): void; + + /** + * Cleans the retained data deleted in cloud. + * + * @param { string } table - Indicates the name of the table to check. + * @returns { Promise } -The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + clean(table: string): Promise; + + /** + * 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 - * @crossplatform - * @since 10 + * @systemapi + * @since 11 */ - readonly SHARING_RESOURCE_FIELD: string 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; - // allocSharingResource(predicates: RdbPredicates, columns?: Array): Promise; - // releaseSharingResource(predicates: RdbPredicates): Promise; /** * Executes a SQL statement that contains specified parameters but returns no value. -- Gitee From da99dd984d42c8fcd38a6aefd1cc242428b4162f Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Mon, 9 Oct 2023 06:28:51 +0000 Subject: [PATCH 2/3] update interface_sdk/api/@ohos.data.relationalStore.d.ts. Signed-off-by: zuojiangjiang --- interface_sdk/api/@ohos.data.relationalStore.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface_sdk/api/@ohos.data.relationalStore.d.ts b/interface_sdk/api/@ohos.data.relationalStore.d.ts index 96035590..7e4a86e5 100644 --- a/interface_sdk/api/@ohos.data.relationalStore.d.ts +++ b/interface_sdk/api/@ohos.data.relationalStore.d.ts @@ -732,6 +732,12 @@ declare namespace relationalStore { DISTRIBUTED_CLOUD } + interface ColumnVector { + originTable: string; + endTable: string; + fields: { [origin: string]: string } + } + /** * Manages the distributed configuration of the table. * @@ -748,6 +754,8 @@ declare namespace relationalStore { */ autoSync: boolean; + reference?: Array; + /** * Specifies whether retain data for cloud delete, default false. * -- Gitee From f2b7ec8c959f8253939a51c91a7e06ee3217954f Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Mon, 9 Oct 2023 06:30:04 +0000 Subject: [PATCH 3/3] update interface_sdk/api/@ohos.data.relationalStore.d.ts. Signed-off-by: zuojiangjiang --- interface_sdk/api/@ohos.data.relationalStore.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface_sdk/api/@ohos.data.relationalStore.d.ts b/interface_sdk/api/@ohos.data.relationalStore.d.ts index 7e4a86e5..aa09336e 100644 --- a/interface_sdk/api/@ohos.data.relationalStore.d.ts +++ b/interface_sdk/api/@ohos.data.relationalStore.d.ts @@ -754,7 +754,7 @@ declare namespace relationalStore { */ autoSync: boolean; - reference?: Array; + references?: Array; /** * Specifies whether retain data for cloud delete, default false. -- Gitee