diff --git a/api/@ohos.application.DataShareExtensionAbility.d.ts b/api/@ohos.application.DataShareExtensionAbility.d.ts index fe778a801ce1d9f2eaf942ff605c9c333cbcfe82..177444235a8ba5937c47d633a39bc6fcd262bd7b 100644 --- a/api/@ohos.application.DataShareExtensionAbility.d.ts +++ b/api/@ohos.application.DataShareExtensionAbility.d.ts @@ -26,126 +26,16 @@ import { ValuesBucket } from './@ohos.data.ValuesBucket'; import dataShare from './@ohos.data.dataShare'; /** - * Struct for a batch update operation. - * - * @typedef { dataShare.UpdateOperation } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @stagemodelonly - * @since 12 - */ + * Struct for a batch update operation. + * + * @typedef { dataShare.UpdateOperation } + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @stagemodelonly + * @since 12 + */ type UpdateOperation = dataShare.UpdateOperation; -/** - * Called back when a datashare extension ability is started for initialization. - * - * @typedef { function } - * @param { Want } want - Indicates connection information about the datashare extension ability. - * @param { AsyncCallback } callback - callback function, no return value. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type OnCreateFn = (want: Want, callback: AsyncCallback) => void; - -/** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the position where the data is to insert. - * @param { ValuesBucket } valueBucket - Indicates the data to insert. - * @param { AsyncCallback } callback - Returns the index of the newly inserted data record. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type InsertFn = (uri: string, valueBucket: ValuesBucket, callback: AsyncCallback) => void; - -/** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the database table storing the data to update. - * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. If this parameter is - * null, all data records will be updated by default. - * @param { ValuesBucket } valueBucket - Indicates the data to update. This parameter can be null. - * @param { AsyncCallback } callback - Returns the number of data records updated. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type UpdateFn = ( - uri: string, - predicates: dataSharePredicates.DataSharePredicates, - valueBucket: ValuesBucket, - callback: AsyncCallback -) => void; - -/** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the database table storing the data to delete. - * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. If this parameter is - * null, all data records will be deleted by default. - * @param { AsyncCallback } callback - Returns the number of data records deleted. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type DeleteFn = ( - uri: string, - predicates: dataSharePredicates.DataSharePredicates, - callback: AsyncCallback -) => void; - -/** - * Queries one or more data records in the database. This method should be implemented by a data share. - * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. - * - * @typedef { function } - * @param { string } uri - Indicates the database table storing the data to query. - * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. If this parameter is - * null, all data records will be queried by default. - * @param { Array } columns - Indicates the columns to be queried, in array, for example, {"name","age"}. - * You should define the processing logic when this parameter is null. - * @param { AsyncCallback } callback - Returns the queried data, only support result set of rdb or kvstore. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type QueryFn = ( - uri: string, - predicates: dataSharePredicates.DataSharePredicates, - columns: Array, - callback: AsyncCallback -) => void; - -/** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the position where the data is to insert. - * @param { Array } valueBuckets - Indicates the data to insert. - * @param { AsyncCallback } callback - Returns the number of data records inserted. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type BatchInsertFn = (uri: string, valueBuckets: Array, callback: AsyncCallback) => void; - /** * This module provides data sharing and expansion capabilities. * @@ -155,7 +45,7 @@ type BatchInsertFn = (uri: string, valueBuckets: Array, callback: * @since arkts {'1.1':'9', '1.2':'20'} * @arkts 1.1&1.2 */ -declare class DataShareExtensionAbility { +export default class DataShareExtensionAbility { /** * Indicates datashare extension ability context. * @@ -176,22 +66,11 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ onCreate?(want: Want, callback: AsyncCallback): void; - /** - * Called back when a datashare extension ability is started for initialization. - * - * @type { ?OnCreateFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - onCreate?: OnCreateFn; - /** * Inserts a data record into the database. This method should be implemented by a data share. * @@ -205,18 +84,6 @@ declare class DataShareExtensionAbility { */ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback): void; - /** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @type { ?InsertFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - insert?: InsertFn; - /** * Updates one or more data records in the database. This method should be implemented by a data share. * @@ -228,7 +95,8 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ update?( uri: string, @@ -237,18 +105,6 @@ declare class DataShareExtensionAbility { callback: AsyncCallback ): void; - /** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @type { ?UpdateFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - update?: UpdateFn; - /** * Updates data records in the database. * @@ -274,22 +130,11 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - /** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @type { ?DeleteFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - delete?: DeleteFn; - /** * Queries one or more data records in the database. This method should be implemented by a data share. * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. @@ -303,7 +148,8 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ query?( uri: string, @@ -312,19 +158,6 @@ declare class DataShareExtensionAbility { callback: AsyncCallback ): void; - /** - * Queries one or more data records in the database. This method should be implemented by a data share. - * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. - * - * @type { ?QueryFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - query?: QueryFn; - /** * Inserts multiple data records into the database. This method should be implemented by a data share. * @@ -334,22 +167,11 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; - /** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @type { ?BatchInsertFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - batchInsert?: BatchInsertFn; - /** * Converts the given {@code uri} that refer to the data share into a normalized URI. A normalized URI can be * used across devices, persisted, backed up, and restored. It can refer to the same item in the data share @@ -380,5 +202,3 @@ declare class DataShareExtensionAbility { */ denormalizeUri?(uri: string, callback: AsyncCallback): void; } - -export default DataShareExtensionAbility;