161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit AbilityKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback } from '../@ohos.base';
2261847f8eSopenharmony_ciimport { ResultSet } from '../data/rdb/resultSet';
2361847f8eSopenharmony_ciimport { DataAbilityOperation } from './dataAbilityOperation';
2461847f8eSopenharmony_ciimport { DataAbilityResult } from './dataAbilityResult';
2561847f8eSopenharmony_ciimport dataAbility from '../@ohos.data.dataAbility';
2661847f8eSopenharmony_ciimport rdb from '../@ohos.data.rdb';
2761847f8eSopenharmony_ci
2861847f8eSopenharmony_ci/**
2961847f8eSopenharmony_ci * DataAbilityHelper
3061847f8eSopenharmony_ci *
3161847f8eSopenharmony_ci * @interface DataAbilityHelper
3261847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
3361847f8eSopenharmony_ci * @FAModelOnly
3461847f8eSopenharmony_ci * @since 7
3561847f8eSopenharmony_ci */
3661847f8eSopenharmony_ciexport interface DataAbilityHelper {
3761847f8eSopenharmony_ci  /**
3861847f8eSopenharmony_ci   * Opens a file in a specified remote path.
3961847f8eSopenharmony_ci   *
4061847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the file to open.
4161847f8eSopenharmony_ci   * @param { string } mode - Indicates the file open mode, which can be "r" for read-only access, "w" for write-only
4261847f8eSopenharmony_ci   *                   access (erasing whatever data is currently in the file), "wt" for write access that truncates
4361847f8eSopenharmony_ci   *                   any existing file, "wa" for write-only access to append to any existing data, "rw" for read
4461847f8eSopenharmony_ci   *                   and write access on any existing data, or "rwt" for read and write access that truncates any
4561847f8eSopenharmony_ci   *                   existing file.
4661847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - Indicates the callback when openfile success
4761847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
4861847f8eSopenharmony_ci   * @FAModelOnly
4961847f8eSopenharmony_ci   * @since 7
5061847f8eSopenharmony_ci   */
5161847f8eSopenharmony_ci  openFile(uri: string, mode: string, callback: AsyncCallback<number>): void;
5261847f8eSopenharmony_ci
5361847f8eSopenharmony_ci  /**
5461847f8eSopenharmony_ci   * Opens a file in a specified remote path.
5561847f8eSopenharmony_ci   *
5661847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the file to open.
5761847f8eSopenharmony_ci   * @param { string } mode - Indicates the file open mode, which can be "r" for read-only access, "w" for write-only
5861847f8eSopenharmony_ci   *                   access (erasing whatever data is currently in the file), "wt" for write access that truncates
5961847f8eSopenharmony_ci   *                   any existing file, "wa" for write-only access to append to any existing data, "rw" for read and
6061847f8eSopenharmony_ci   *                   write access on any existing data, or "rwt" for read and write access that truncates any
6161847f8eSopenharmony_ci   *                   existing file.
6261847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the file descriptor.
6361847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
6461847f8eSopenharmony_ci   * @FAModelOnly
6561847f8eSopenharmony_ci   * @since 7
6661847f8eSopenharmony_ci   */
6761847f8eSopenharmony_ci  openFile(uri: string, mode: string): Promise<number>;
6861847f8eSopenharmony_ci
6961847f8eSopenharmony_ci  /**
7061847f8eSopenharmony_ci   * Registers an observer to observe data specified by the given uri.
7161847f8eSopenharmony_ci   *
7261847f8eSopenharmony_ci   * @param { 'dataChange' } type - dataChange.
7361847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to operate.
7461847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - Indicates the callback when dataChange.
7561847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
7661847f8eSopenharmony_ci   * @FAModelOnly
7761847f8eSopenharmony_ci   * @since 7
7861847f8eSopenharmony_ci   */
7961847f8eSopenharmony_ci  on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void;
8061847f8eSopenharmony_ci
8161847f8eSopenharmony_ci  /**
8261847f8eSopenharmony_ci   * Deregisters all observers used for monitoring data specified by the given uri.
8361847f8eSopenharmony_ci   *
8461847f8eSopenharmony_ci   * @param { 'dataChange' } type - dataChange.
8561847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to operate.
8661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } [callback] - Indicates the registered callback.
8761847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
8861847f8eSopenharmony_ci   * @FAModelOnly
8961847f8eSopenharmony_ci   * @since 7
9061847f8eSopenharmony_ci   */
9161847f8eSopenharmony_ci  off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void;
9261847f8eSopenharmony_ci
9361847f8eSopenharmony_ci  /**
9461847f8eSopenharmony_ci   * Obtains the MIME type of the date specified by the given URI.
9561847f8eSopenharmony_ci   *
9661847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to operate.
9761847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - Indicates the callback method for obtaining the type of media resource,
9861847f8eSopenharmony_ci   *                                             returning the media resource type that matches the uri pointing data.
9961847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
10061847f8eSopenharmony_ci   * @FAModelOnly
10161847f8eSopenharmony_ci   * @since 7
10261847f8eSopenharmony_ci   */
10361847f8eSopenharmony_ci  getType(uri: string, callback: AsyncCallback<string>): void;
10461847f8eSopenharmony_ci
10561847f8eSopenharmony_ci  /**
10661847f8eSopenharmony_ci   * Obtains the MIME type of the date specified by the given URI.
10761847f8eSopenharmony_ci   *
10861847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to operate.
10961847f8eSopenharmony_ci   * @returns { Promise<string> } Returns the MIME type that matches the data specified by uri.
11061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
11161847f8eSopenharmony_ci   * @FAModelOnly
11261847f8eSopenharmony_ci   * @since 7
11361847f8eSopenharmony_ci   */
11461847f8eSopenharmony_ci  getType(uri: string): Promise<string>;
11561847f8eSopenharmony_ci
11661847f8eSopenharmony_ci  /**
11761847f8eSopenharmony_ci   * Obtains the MIME types of files supported.
11861847f8eSopenharmony_ci   *
11961847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the files to obtain.
12061847f8eSopenharmony_ci   * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain.
12161847f8eSopenharmony_ci   * @param { AsyncCallback<Array<string>> } callback - Indicates the callback method for obtaining media resource
12261847f8eSopenharmony_ci   *                                                    types, returning an array of matching media resource types.
12361847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
12461847f8eSopenharmony_ci   * @FAModelOnly
12561847f8eSopenharmony_ci   * @since 7
12661847f8eSopenharmony_ci   */
12761847f8eSopenharmony_ci  getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void;
12861847f8eSopenharmony_ci
12961847f8eSopenharmony_ci  /**
13061847f8eSopenharmony_ci   * Obtains the MIME types of files supported.
13161847f8eSopenharmony_ci   *
13261847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the files to obtain.
13361847f8eSopenharmony_ci   * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain.
13461847f8eSopenharmony_ci   * @returns { Promise<Array<string>> } Returns the matched MIME types Array.
13561847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
13661847f8eSopenharmony_ci   * @FAModelOnly
13761847f8eSopenharmony_ci   * @since 7
13861847f8eSopenharmony_ci   */
13961847f8eSopenharmony_ci  getFileTypes(uri: string, mimeTypeFilter: string): Promise<Array<string>>;
14061847f8eSopenharmony_ci
14161847f8eSopenharmony_ci  /**
14261847f8eSopenharmony_ci   * Converts the given uri that refers to the Data ability into a normalized uri.
14361847f8eSopenharmony_ci   *
14461847f8eSopenharmony_ci   * @param { string } uri - Indicates the uri object to normalize.
14561847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - Indicates the callback method for uri normalization, and if the data
14661847f8eSopenharmony_ci   *                                             function supports uri normalization, returns the normalized uri object;
14761847f8eSopenharmony_ci   *                                             Otherwise return null.
14861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
14961847f8eSopenharmony_ci   * @FAModelOnly
15061847f8eSopenharmony_ci   * @since 7
15161847f8eSopenharmony_ci   */
15261847f8eSopenharmony_ci  normalizeUri(uri: string, callback: AsyncCallback<string>): void;
15361847f8eSopenharmony_ci
15461847f8eSopenharmony_ci  /**
15561847f8eSopenharmony_ci   * Converts the given uri that refers to the Data ability into a normalized uri.
15661847f8eSopenharmony_ci   *
15761847f8eSopenharmony_ci   * @param { string } uri - Indicates the uri object to normalize.
15861847f8eSopenharmony_ci   * @returns { Promise<string> } Returns normalized uri object if Data ability supports URI normalization or null.
15961847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
16061847f8eSopenharmony_ci   * @FAModelOnly
16161847f8eSopenharmony_ci   * @since 7
16261847f8eSopenharmony_ci   */
16361847f8eSopenharmony_ci  normalizeUri(uri: string): Promise<string>;
16461847f8eSopenharmony_ci
16561847f8eSopenharmony_ci  /**
16661847f8eSopenharmony_ci   * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one.
16761847f8eSopenharmony_ci   *
16861847f8eSopenharmony_ci   * @param { string } uri - Indicates the uri object to normalize.
16961847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - Indicates the callback method of denormalization uri.If
17061847f8eSopenharmony_ci   *                                             denormalization succeeds,the denormalization uri object is returned.
17161847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
17261847f8eSopenharmony_ci   * @FAModelOnly
17361847f8eSopenharmony_ci   * @since 7
17461847f8eSopenharmony_ci   */
17561847f8eSopenharmony_ci  denormalizeUri(uri: string, callback: AsyncCallback<string>): void;
17661847f8eSopenharmony_ci
17761847f8eSopenharmony_ci  /**
17861847f8eSopenharmony_ci   * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one.
17961847f8eSopenharmony_ci   *
18061847f8eSopenharmony_ci   * @param { string } uri - Indicates the uri object to normalize.
18161847f8eSopenharmony_ci   * @returns { Promise<string> } Returns the denormalized uri object if the denormalization is successful.
18261847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
18361847f8eSopenharmony_ci   * @FAModelOnly
18461847f8eSopenharmony_ci   * @since 7
18561847f8eSopenharmony_ci   */
18661847f8eSopenharmony_ci  denormalizeUri(uri: string): Promise<string>;
18761847f8eSopenharmony_ci
18861847f8eSopenharmony_ci  /**
18961847f8eSopenharmony_ci   * Notifies the registered observers of a change to the data resource specified by uri.
19061847f8eSopenharmony_ci   *
19161847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to operate.
19261847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - callback method.
19361847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
19461847f8eSopenharmony_ci   * @FAModelOnly
19561847f8eSopenharmony_ci   * @since 7
19661847f8eSopenharmony_ci   */
19761847f8eSopenharmony_ci  notifyChange(uri: string, callback: AsyncCallback<void>): void;
19861847f8eSopenharmony_ci
19961847f8eSopenharmony_ci  /**
20061847f8eSopenharmony_ci   * Notifies the registered observers of a change to the data resource specified by uri.
20161847f8eSopenharmony_ci   *
20261847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to operate.
20361847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
20461847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
20561847f8eSopenharmony_ci   * @FAModelOnly
20661847f8eSopenharmony_ci   * @since 7
20761847f8eSopenharmony_ci   */
20861847f8eSopenharmony_ci  notifyChange(uri: string): Promise<void>;
20961847f8eSopenharmony_ci
21061847f8eSopenharmony_ci  /**
21161847f8eSopenharmony_ci   * Inserts a single data record into the database.
21261847f8eSopenharmony_ci   *
21361847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to insert.
21461847f8eSopenharmony_ci   * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, a blank
21561847f8eSopenharmony_ci   *                                            row will be inserted.
21661847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - Indicates the callback method for data insertion, returning the index
21761847f8eSopenharmony_ci   *                                             of the inserted data record.
21861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
21961847f8eSopenharmony_ci   * @FAModelOnly
22061847f8eSopenharmony_ci   * @since 7
22161847f8eSopenharmony_ci   */
22261847f8eSopenharmony_ci  insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void;
22361847f8eSopenharmony_ci
22461847f8eSopenharmony_ci  /**
22561847f8eSopenharmony_ci   * Inserts a single data record into the database.
22661847f8eSopenharmony_ci   *
22761847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to insert.
22861847f8eSopenharmony_ci   * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null,
22961847f8eSopenharmony_ci   *                                            a blank row will be inserted.
23061847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the index of the inserted data record.
23161847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
23261847f8eSopenharmony_ci   * @FAModelOnly
23361847f8eSopenharmony_ci   * @since 7
23461847f8eSopenharmony_ci   */
23561847f8eSopenharmony_ci  insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise<number>;
23661847f8eSopenharmony_ci
23761847f8eSopenharmony_ci  /**
23861847f8eSopenharmony_ci   * Inserts multiple data records into the database.
23961847f8eSopenharmony_ci   *
24061847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to batchInsert.
24161847f8eSopenharmony_ci   * @param { Array<rdb.ValuesBucket> } valuesBuckets - Indicates the data records to insert.
24261847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - Callback method indicating batch data insertion, returning the number
24361847f8eSopenharmony_ci   *                                             of inserted data records.
24461847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
24561847f8eSopenharmony_ci   * @FAModelOnly
24661847f8eSopenharmony_ci   * @since 7
24761847f8eSopenharmony_ci   */
24861847f8eSopenharmony_ci  batchInsert(uri: string, valuesBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback<number>): void;
24961847f8eSopenharmony_ci
25061847f8eSopenharmony_ci  /**
25161847f8eSopenharmony_ci   * Inserts multiple data records into the database.
25261847f8eSopenharmony_ci   *
25361847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to batchInsert.
25461847f8eSopenharmony_ci   * @param { Array<rdb.ValuesBucket> } valuesBuckets - Indicates the data records to insert.
25561847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the number of data records inserted.
25661847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
25761847f8eSopenharmony_ci   * @FAModelOnly
25861847f8eSopenharmony_ci   * @since 7
25961847f8eSopenharmony_ci   */
26061847f8eSopenharmony_ci  batchInsert(uri: string, valuesBuckets: Array<rdb.ValuesBucket>): Promise<number>;
26161847f8eSopenharmony_ci
26261847f8eSopenharmony_ci  /**
26361847f8eSopenharmony_ci   * Deletes one or more data records from the database.
26461847f8eSopenharmony_ci   *
26561847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to delete.
26661847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the
26761847f8eSopenharmony_ci   *                                                           processing logic when this parameter is null.
26861847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - A callback method that indicates data deletion, returning the number of
26961847f8eSopenharmony_ci   *                                             deleted data records.
27061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
27161847f8eSopenharmony_ci   * @FAModelOnly
27261847f8eSopenharmony_ci   * @since 7
27361847f8eSopenharmony_ci   */
27461847f8eSopenharmony_ci  delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void;
27561847f8eSopenharmony_ci
27661847f8eSopenharmony_ci  /**
27761847f8eSopenharmony_ci   * Deletes one or more data records from the database.
27861847f8eSopenharmony_ci   *
27961847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to delete.
28061847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } [predicates] - Indicates filter criteria. You should define the
28161847f8eSopenharmony_ci   *                                                             processing logic when this parameter is null.
28261847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the number of data records deleted.
28361847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
28461847f8eSopenharmony_ci   * @FAModelOnly
28561847f8eSopenharmony_ci   * @since 7
28661847f8eSopenharmony_ci   */
28761847f8eSopenharmony_ci  delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise<number>;
28861847f8eSopenharmony_ci
28961847f8eSopenharmony_ci  /**
29061847f8eSopenharmony_ci   * Deletes one or more data records from the database.
29161847f8eSopenharmony_ci   *
29261847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of the data to delete.
29361847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - A callback method that indicates data deletion, returning
29461847f8eSopenharmony_ci   *                                             the number of deleted data records.
29561847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
29661847f8eSopenharmony_ci   * @FAModelOnly
29761847f8eSopenharmony_ci   * @since 7
29861847f8eSopenharmony_ci   */
29961847f8eSopenharmony_ci  delete(uri: string, callback: AsyncCallback<number>): void;
30061847f8eSopenharmony_ci
30161847f8eSopenharmony_ci  /**
30261847f8eSopenharmony_ci   * Updates data records in the database.
30361847f8eSopenharmony_ci   *
30461847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to update.
30561847f8eSopenharmony_ci   * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update.
30661847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the
30761847f8eSopenharmony_ci   *                                                           processing logic when this parameter is null.
30861847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - A callback method that indicates data updates, returning the number of
30961847f8eSopenharmony_ci   *                                             updated data records.
31061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
31161847f8eSopenharmony_ci   * @FAModelOnly
31261847f8eSopenharmony_ci   * @since 7
31361847f8eSopenharmony_ci   */
31461847f8eSopenharmony_ci  update(
31561847f8eSopenharmony_ci    uri: string,
31661847f8eSopenharmony_ci    valuesBucket: rdb.ValuesBucket,
31761847f8eSopenharmony_ci    predicates: dataAbility.DataAbilityPredicates,
31861847f8eSopenharmony_ci    callback: AsyncCallback<number>
31961847f8eSopenharmony_ci  ): void;
32061847f8eSopenharmony_ci
32161847f8eSopenharmony_ci  /**
32261847f8eSopenharmony_ci   * Updates data records in the database.
32361847f8eSopenharmony_ci   *
32461847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to update.
32561847f8eSopenharmony_ci   * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update.
32661847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } [predicates] - Indicates filter criteria. You should define the
32761847f8eSopenharmony_ci   *                                                             processing logic when this parameter is null.
32861847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the number of data records updated.
32961847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
33061847f8eSopenharmony_ci   * @FAModelOnly
33161847f8eSopenharmony_ci   * @since 7
33261847f8eSopenharmony_ci   */
33361847f8eSopenharmony_ci  update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise<number>;
33461847f8eSopenharmony_ci
33561847f8eSopenharmony_ci  /**
33661847f8eSopenharmony_ci   * Updates data records in the database.
33761847f8eSopenharmony_ci   *
33861847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to update.
33961847f8eSopenharmony_ci   * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update.
34061847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - A callback method that indicates data updates, returning the number of
34161847f8eSopenharmony_ci   *                                             updated data records.
34261847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
34361847f8eSopenharmony_ci   * @FAModelOnly
34461847f8eSopenharmony_ci   * @since 7
34561847f8eSopenharmony_ci   */
34661847f8eSopenharmony_ci  update(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void;
34761847f8eSopenharmony_ci
34861847f8eSopenharmony_ci  /**
34961847f8eSopenharmony_ci   * Queries data in the database.
35061847f8eSopenharmony_ci   *
35161847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
35261847f8eSopenharmony_ci   * @param { Array<string> } columns - Indicates columns to query. If this parameter is null, all columns are queried.
35361847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the
35461847f8eSopenharmony_ci   *                                                           processing logic when this parameter is null.
35561847f8eSopenharmony_ci   * @param { AsyncCallback<ResultSet> } callback - Indicates the callback method for data queries, returning the
35661847f8eSopenharmony_ci   *                                                number of queried data records.
35761847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
35861847f8eSopenharmony_ci   * @FAModelOnly
35961847f8eSopenharmony_ci   * @since 7
36061847f8eSopenharmony_ci   */
36161847f8eSopenharmony_ci  query(
36261847f8eSopenharmony_ci    uri: string,
36361847f8eSopenharmony_ci    columns: Array<string>,
36461847f8eSopenharmony_ci    predicates: dataAbility.DataAbilityPredicates,
36561847f8eSopenharmony_ci    callback: AsyncCallback<ResultSet>
36661847f8eSopenharmony_ci  ): void;
36761847f8eSopenharmony_ci
36861847f8eSopenharmony_ci  /**
36961847f8eSopenharmony_ci   * Queries data in the database.
37061847f8eSopenharmony_ci   *
37161847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
37261847f8eSopenharmony_ci   * @param { AsyncCallback<ResultSet> } callback - Indicates the callback method for data queries, returning the
37361847f8eSopenharmony_ci   *                                                number of queried data records.
37461847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
37561847f8eSopenharmony_ci   * @FAModelOnly
37661847f8eSopenharmony_ci   * @since 7
37761847f8eSopenharmony_ci   */
37861847f8eSopenharmony_ci  query(uri: string, callback: AsyncCallback<ResultSet>): void;
37961847f8eSopenharmony_ci
38061847f8eSopenharmony_ci  /**
38161847f8eSopenharmony_ci   * Queries data in the database.
38261847f8eSopenharmony_ci   *
38361847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
38461847f8eSopenharmony_ci   * @param { Array<string> } columns - Indicates columns to query. If this parameter is null, all columns are queried.
38561847f8eSopenharmony_ci   * @param { AsyncCallback<ResultSet> } callback - Indicates the callback method for data queries, returning the
38661847f8eSopenharmony_ci   *                                                number of queried data records.
38761847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
38861847f8eSopenharmony_ci   * @FAModelOnly
38961847f8eSopenharmony_ci   * @since 7
39061847f8eSopenharmony_ci   */
39161847f8eSopenharmony_ci  query(uri: string, columns: Array<string>, callback: AsyncCallback<ResultSet>): void;
39261847f8eSopenharmony_ci
39361847f8eSopenharmony_ci  /**
39461847f8eSopenharmony_ci   * Queries data in the database.
39561847f8eSopenharmony_ci   *
39661847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
39761847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the
39861847f8eSopenharmony_ci   *                                                           processing logic when this parameter is null.
39961847f8eSopenharmony_ci   * @param { AsyncCallback<ResultSet> } callback - Indicates the callback method for data queries, returning the
40061847f8eSopenharmony_ci   *                                                number of queried data records.
40161847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
40261847f8eSopenharmony_ci   * @FAModelOnly
40361847f8eSopenharmony_ci   * @since 7
40461847f8eSopenharmony_ci   */
40561847f8eSopenharmony_ci  query(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<ResultSet>): void;
40661847f8eSopenharmony_ci
40761847f8eSopenharmony_ci  /**
40861847f8eSopenharmony_ci   * Queries data in the database.
40961847f8eSopenharmony_ci   *
41061847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
41161847f8eSopenharmony_ci   * @param { Array<string> } [columns] - Indicates columns to query. If this parameter is null, all columns are queried.
41261847f8eSopenharmony_ci   * @param { dataAbility.DataAbilityPredicates } [predicates] - Indicates filter criteria. You should define the
41361847f8eSopenharmony_ci   *                                                             processing logic when this parameter is null.
41461847f8eSopenharmony_ci   * @returns { Promise<ResultSet> } Returns the query result {@link ResultSet}.
41561847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
41661847f8eSopenharmony_ci   * @FAModelOnly
41761847f8eSopenharmony_ci   * @since 7
41861847f8eSopenharmony_ci   */
41961847f8eSopenharmony_ci  query(uri: string, columns?: Array<string>, predicates?: dataAbility.DataAbilityPredicates): Promise<ResultSet>;
42061847f8eSopenharmony_ci
42161847f8eSopenharmony_ci  /**
42261847f8eSopenharmony_ci   * Calls the extended API of the DataAbility. This method uses a promise to return the result.
42361847f8eSopenharmony_ci   *
42461847f8eSopenharmony_ci   * @param { string } uri - URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx"
42561847f8eSopenharmony_ci   * @param { string } method - Indicates the method to call.
42661847f8eSopenharmony_ci   * @param { string } arg - Indicates the parameter of the String type.
42761847f8eSopenharmony_ci   * @param { PacMap } extras - Indicates the parameter of the PacMap type.
42861847f8eSopenharmony_ci   * @param { AsyncCallback<PacMap> } callback - A callback method that indicates a data operation and returns the
42961847f8eSopenharmony_ci   *                                             result of the operation.
43061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
43161847f8eSopenharmony_ci   * @FAModelOnly
43261847f8eSopenharmony_ci   * @since 7
43361847f8eSopenharmony_ci   */
43461847f8eSopenharmony_ci  call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback<PacMap>): void;
43561847f8eSopenharmony_ci
43661847f8eSopenharmony_ci  /**
43761847f8eSopenharmony_ci   * Calls the extended API of the DataAbility. This method uses a promise to return the result.
43861847f8eSopenharmony_ci   *
43961847f8eSopenharmony_ci   * @param { string } uri - URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx"
44061847f8eSopenharmony_ci   * @param { string } method - Indicates the method to call.
44161847f8eSopenharmony_ci   * @param { string } arg - Indicates the parameter of the String type.
44261847f8eSopenharmony_ci   * @param { PacMap } extras - Indicates the parameter of the PacMap type.
44361847f8eSopenharmony_ci   * @returns { Promise<PacMap> } Returns the query result {@link PacMap}.
44461847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
44561847f8eSopenharmony_ci   * @FAModelOnly
44661847f8eSopenharmony_ci   * @since 7
44761847f8eSopenharmony_ci   */
44861847f8eSopenharmony_ci  call(uri: string, method: string, arg: string, extras: PacMap): Promise<PacMap>;
44961847f8eSopenharmony_ci
45061847f8eSopenharmony_ci  /**
45161847f8eSopenharmony_ci   * Queries data in the database.
45261847f8eSopenharmony_ci   *
45361847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
45461847f8eSopenharmony_ci   * @param { Array<DataAbilityOperation> } operations - Indicates the data operation list, which can contain multiple
45561847f8eSopenharmony_ci   *                                                     operations on the database.
45661847f8eSopenharmony_ci   * @param { AsyncCallback<Array<DataAbilityResult>> } callback - Callback method indicating batch operations,
45761847f8eSopenharmony_ci   *                                                               returning the result of each operation in the
45861847f8eSopenharmony_ci   *                                                               DataAbilityResult array.
45961847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
46061847f8eSopenharmony_ci   * @FAModelOnly
46161847f8eSopenharmony_ci   * @since 7
46261847f8eSopenharmony_ci   */
46361847f8eSopenharmony_ci  executeBatch(
46461847f8eSopenharmony_ci    uri: string,
46561847f8eSopenharmony_ci    operations: Array<DataAbilityOperation>,
46661847f8eSopenharmony_ci    callback: AsyncCallback<Array<DataAbilityResult>>
46761847f8eSopenharmony_ci  ): void;
46861847f8eSopenharmony_ci
46961847f8eSopenharmony_ci  /**
47061847f8eSopenharmony_ci   * Queries data in the database.
47161847f8eSopenharmony_ci   *
47261847f8eSopenharmony_ci   * @param { string } uri - Indicates the path of data to query.
47361847f8eSopenharmony_ci   * @param { Array<DataAbilityOperation> } operations - Indicates the data operation list, which can contain multiple
47461847f8eSopenharmony_ci   *                                                     operations on the database.
47561847f8eSopenharmony_ci   * @returns { Promise<Array<DataAbilityResult>> } Returns the result of each operation,
47661847f8eSopenharmony_ci   *                                                in array {@link DataAbilityResult}.
47761847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
47861847f8eSopenharmony_ci   * @FAModelOnly
47961847f8eSopenharmony_ci   * @since 7
48061847f8eSopenharmony_ci   */
48161847f8eSopenharmony_ci  executeBatch(uri: string, operations: Array<DataAbilityOperation>): Promise<Array<DataAbilityResult>>;
48261847f8eSopenharmony_ci}
48361847f8eSopenharmony_ci
48461847f8eSopenharmony_ci/**
48561847f8eSopenharmony_ci * Defines a PacMap object for storing a series of values.
48661847f8eSopenharmony_ci *
48761847f8eSopenharmony_ci * @typedef PacMap
48861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
48961847f8eSopenharmony_ci * @FAModelOnly
49061847f8eSopenharmony_ci * @since 7
49161847f8eSopenharmony_ci */
49261847f8eSopenharmony_ci/**
49361847f8eSopenharmony_ci * Defines a PacMap object for storing a series of values.
49461847f8eSopenharmony_ci *
49561847f8eSopenharmony_ci * @typedef PacMap
49661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
49761847f8eSopenharmony_ci * @since 11
49861847f8eSopenharmony_ci */
49961847f8eSopenharmony_ciexport interface PacMap {
50061847f8eSopenharmony_ci  /**
50161847f8eSopenharmony_ci   * Indicates the parameter of the PacMap type.
50261847f8eSopenharmony_ci   * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes,
50361847f8eSopenharmony_ci   * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object.
50461847f8eSopenharmony_ci   * If the PacMap object is to be transferred to a non-OHOS process,
50561847f8eSopenharmony_ci   * values of primitive types are supported, but not custom Sequenceable objects.
50661847f8eSopenharmony_ci   *
50761847f8eSopenharmony_ci   * @type { number | string | boolean | Array<string | number | boolean> | null }
50861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
50961847f8eSopenharmony_ci   * @FAModelOnly
51061847f8eSopenharmony_ci   * @since 7
51161847f8eSopenharmony_ci   */
51261847f8eSopenharmony_ci  /**
51361847f8eSopenharmony_ci   * Indicates the parameter of the PacMap type.
51461847f8eSopenharmony_ci   * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes,
51561847f8eSopenharmony_ci   * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object.
51661847f8eSopenharmony_ci   * If the PacMap object is to be transferred to a non-OHOS process,
51761847f8eSopenharmony_ci   * values of primitive types are supported, but not custom Sequenceable objects.
51861847f8eSopenharmony_ci   *
51961847f8eSopenharmony_ci   * @type { number | string | boolean | Array<string | number | boolean> | null }
52061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
52161847f8eSopenharmony_ci   * @since 11
52261847f8eSopenharmony_ci   */
52361847f8eSopenharmony_ci  [key: string]: number | string | boolean | Array<string | number | boolean> | null;
52461847f8eSopenharmony_ci}
525