161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 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 ArkData 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport Context from './application/Context'; 2361847f8eSopenharmony_ciimport DataShareResultSet from './@ohos.data.DataShareResultSet'; 2461847f8eSopenharmony_ciimport dataSharePredicates from './@ohos.data.dataSharePredicates'; 2561847f8eSopenharmony_ciimport { ValuesBucket } from './@ohos.data.ValuesBucket'; 2661847f8eSopenharmony_ci 2761847f8eSopenharmony_ci/** 2861847f8eSopenharmony_ci * This module provides the dataShare capability for consumer. 2961847f8eSopenharmony_ci * 3061847f8eSopenharmony_ci * @namespace dataShare 3161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 3261847f8eSopenharmony_ci * @systemapi 3361847f8eSopenharmony_ci * @stagemodelonly 3461847f8eSopenharmony_ci * @since 9 3561847f8eSopenharmony_ci */ 3661847f8eSopenharmony_cideclare namespace dataShare { 3761847f8eSopenharmony_ci /** 3861847f8eSopenharmony_ci * Manages create datashare helper options. 3961847f8eSopenharmony_ci * 4061847f8eSopenharmony_ci * @interface DataShareHelperOptions 4161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 4261847f8eSopenharmony_ci * @systemapi 4361847f8eSopenharmony_ci * @stagemodelonly 4461847f8eSopenharmony_ci * @since 10 4561847f8eSopenharmony_ci */ 4661847f8eSopenharmony_ci interface DataShareHelperOptions { 4761847f8eSopenharmony_ci /** 4861847f8eSopenharmony_ci * Specifies whether the {@link DataShareHelper} in proxy mode. 4961847f8eSopenharmony_ci * If value is true, the {@link DataShareHelper} to be created is in proxy mode, and all operations will not open provider APP as possible 5061847f8eSopenharmony_ci * 5161847f8eSopenharmony_ci * @type { ?boolean } 5261847f8eSopenharmony_ci * @default false 5361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 5461847f8eSopenharmony_ci * @systemapi 5561847f8eSopenharmony_ci * @stagemodelonly 5661847f8eSopenharmony_ci * @since 10 5761847f8eSopenharmony_ci */ 5861847f8eSopenharmony_ci isProxy?: boolean; 5961847f8eSopenharmony_ci } 6061847f8eSopenharmony_ci 6161847f8eSopenharmony_ci /** 6261847f8eSopenharmony_ci * Obtains the dataShareHelper. 6361847f8eSopenharmony_ci * 6461847f8eSopenharmony_ci * @param { Context } context - Indicates the application context. 6561847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the file to open. 6661847f8eSopenharmony_ci * @param { AsyncCallback<DataShareHelper> } callback - {DataShareHelper}: The dataShareHelper for consumer. 6761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 6861847f8eSopenharmony_ci * 2. Incorrect parameters types. 6961847f8eSopenharmony_ci * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully. 7061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 7161847f8eSopenharmony_ci * @systemapi 7261847f8eSopenharmony_ci * @stagemodelonly 7361847f8eSopenharmony_ci * @since 9 7461847f8eSopenharmony_ci */ 7561847f8eSopenharmony_ci function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void; 7661847f8eSopenharmony_ci /** 7761847f8eSopenharmony_ci * Obtains the dataShareHelper. 7861847f8eSopenharmony_ci * 7961847f8eSopenharmony_ci * @param { Context } context - Indicates the application context. 8061847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the file to open. 8161847f8eSopenharmony_ci * @param { DataShareHelperOptions } options - Indicates the optional config. 8261847f8eSopenharmony_ci * @param { AsyncCallback<DataShareHelper> } callback - {DataShareHelper}: The dataShareHelper for consumer. 8361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 8461847f8eSopenharmony_ci * 2. Incorrect parameters types. 8561847f8eSopenharmony_ci * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully. 8661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 8761847f8eSopenharmony_ci * @systemapi 8861847f8eSopenharmony_ci * @stagemodelonly 8961847f8eSopenharmony_ci * @since 10 9061847f8eSopenharmony_ci */ 9161847f8eSopenharmony_ci function createDataShareHelper( 9261847f8eSopenharmony_ci context: Context, 9361847f8eSopenharmony_ci uri: string, 9461847f8eSopenharmony_ci options: DataShareHelperOptions, 9561847f8eSopenharmony_ci callback: AsyncCallback<DataShareHelper> 9661847f8eSopenharmony_ci ): void; 9761847f8eSopenharmony_ci 9861847f8eSopenharmony_ci /** 9961847f8eSopenharmony_ci * Obtains the dataShareHelper. 10061847f8eSopenharmony_ci * 10161847f8eSopenharmony_ci * @param { Context } context - Indicates the application context. 10261847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the file to open. 10361847f8eSopenharmony_ci * @returns { Promise<DataShareHelper> } {DataShareHelper}: The dataShareHelper for consumer. 10461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 10561847f8eSopenharmony_ci * 2. Incorrect parameters types. 10661847f8eSopenharmony_ci * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully. 10761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 10861847f8eSopenharmony_ci * @systemapi 10961847f8eSopenharmony_ci * @stagemodelonly 11061847f8eSopenharmony_ci * @since 9 11161847f8eSopenharmony_ci */ 11261847f8eSopenharmony_ci /** 11361847f8eSopenharmony_ci * Obtains the dataShareHelper. 11461847f8eSopenharmony_ci * 11561847f8eSopenharmony_ci * @param { Context } context - Indicates the application context. 11661847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the file to open. 11761847f8eSopenharmony_ci * @param { DataShareHelperOptions } options - Indicates the optional config. 11861847f8eSopenharmony_ci * @returns { Promise<DataShareHelper> } {DataShareHelper}: The dataShareHelper for consumer. 11961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 12061847f8eSopenharmony_ci * 2. Incorrect parameters types. 12161847f8eSopenharmony_ci * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully. 12261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 12361847f8eSopenharmony_ci * @systemapi 12461847f8eSopenharmony_ci * @stagemodelonly 12561847f8eSopenharmony_ci * @since 10 12661847f8eSopenharmony_ci */ 12761847f8eSopenharmony_ci function createDataShareHelper( 12861847f8eSopenharmony_ci context: Context, 12961847f8eSopenharmony_ci uri: string, 13061847f8eSopenharmony_ci options?: DataShareHelperOptions 13161847f8eSopenharmony_ci ): Promise<DataShareHelper>; 13261847f8eSopenharmony_ci 13361847f8eSopenharmony_ci /** 13461847f8eSopenharmony_ci * Enables silent access dynamically. 13561847f8eSopenharmony_ci * 13661847f8eSopenharmony_ci * @param { Context } context - Indicates the application context. 13761847f8eSopenharmony_ci * @param { string } uri - Indicates the uri of the data share silent proxy resource. 13861847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 13961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 14061847f8eSopenharmony_ci * 2. Incorrect parameters types. 14161847f8eSopenharmony_ci * @throws { BusinessError } 15700011 - The URI is not exist. 14261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 14361847f8eSopenharmony_ci * @systemapi 14461847f8eSopenharmony_ci * @stagemodelonly 14561847f8eSopenharmony_ci * @since 11 14661847f8eSopenharmony_ci */ 14761847f8eSopenharmony_ci function enableSilentProxy(context: Context, uri?: string): Promise<void>; 14861847f8eSopenharmony_ci 14961847f8eSopenharmony_ci /** 15061847f8eSopenharmony_ci * Disables silent access dynamically. 15161847f8eSopenharmony_ci * 15261847f8eSopenharmony_ci * @param { Context } context - Indicates the application context. 15361847f8eSopenharmony_ci * @param { string } uri - Indicates the uri of the data share silent proxy resource. 15461847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 15561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 15661847f8eSopenharmony_ci * 2. Incorrect parameters types. 15761847f8eSopenharmony_ci * @throws { BusinessError } 15700011 - The URI is not exist. 15861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 15961847f8eSopenharmony_ci * @systemapi 16061847f8eSopenharmony_ci * @stagemodelonly 16161847f8eSopenharmony_ci * @since 11 16261847f8eSopenharmony_ci */ 16361847f8eSopenharmony_ci function disableSilentProxy(context: Context, uri?: string): Promise<void>; 16461847f8eSopenharmony_ci 16561847f8eSopenharmony_ci /** 16661847f8eSopenharmony_ci * Specifies the {@link Template} id structure. 16761847f8eSopenharmony_ci * A template is marked by the template id. Note that the template id is auto generated in {@link DataShareHelper#addTemplate}. 16861847f8eSopenharmony_ci * After {@link DataShareHelper#addTemplate}, can use the template id to direct a template. 16961847f8eSopenharmony_ci * 17061847f8eSopenharmony_ci * @interface TemplateId 17161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 17261847f8eSopenharmony_ci * @systemapi 17361847f8eSopenharmony_ci * @stagemodelonly 17461847f8eSopenharmony_ci * @since 10 17561847f8eSopenharmony_ci */ 17661847f8eSopenharmony_ci interface TemplateId { 17761847f8eSopenharmony_ci /** 17861847f8eSopenharmony_ci * Specifies the id of subscriber, who process the callback 17961847f8eSopenharmony_ci * Same as subscriberId in {@link DataShareHelper#addTemplate} 18061847f8eSopenharmony_ci * 18161847f8eSopenharmony_ci * @type { string } 18261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 18361847f8eSopenharmony_ci * @systemapi 18461847f8eSopenharmony_ci * @stagemodelonly 18561847f8eSopenharmony_ci * @since 10 18661847f8eSopenharmony_ci */ 18761847f8eSopenharmony_ci subscriberId: string; 18861847f8eSopenharmony_ci /** 18961847f8eSopenharmony_ci * Specifies the bundleName of template owner, who create the template 19061847f8eSopenharmony_ci * Same as the caller's bundleName of {@link DataShareHelper#addTemplate} 19161847f8eSopenharmony_ci * 19261847f8eSopenharmony_ci * @type { string } 19361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 19461847f8eSopenharmony_ci * @systemapi 19561847f8eSopenharmony_ci * @stagemodelonly 19661847f8eSopenharmony_ci * @since 10 19761847f8eSopenharmony_ci */ 19861847f8eSopenharmony_ci bundleNameOfOwner: string; 19961847f8eSopenharmony_ci } 20061847f8eSopenharmony_ci 20161847f8eSopenharmony_ci /** 20261847f8eSopenharmony_ci * Specifies the published item structure. 20361847f8eSopenharmony_ci * 20461847f8eSopenharmony_ci * @interface PublishedItem 20561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 20661847f8eSopenharmony_ci * @systemapi 20761847f8eSopenharmony_ci * @stagemodelonly 20861847f8eSopenharmony_ci * @since 10 20961847f8eSopenharmony_ci */ 21061847f8eSopenharmony_ci interface PublishedItem { 21161847f8eSopenharmony_ci /** 21261847f8eSopenharmony_ci * Specifies the key of the published data 21361847f8eSopenharmony_ci * 21461847f8eSopenharmony_ci * @type { string } 21561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 21661847f8eSopenharmony_ci * @systemapi 21761847f8eSopenharmony_ci * @stagemodelonly 21861847f8eSopenharmony_ci * @since 10 21961847f8eSopenharmony_ci */ 22061847f8eSopenharmony_ci key: string; 22161847f8eSopenharmony_ci /** 22261847f8eSopenharmony_ci * Specifies the published data 22361847f8eSopenharmony_ci * If the data is large, use ArrayBuffer. 22461847f8eSopenharmony_ci * 22561847f8eSopenharmony_ci * @type { string | ArrayBuffer } 22661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 22761847f8eSopenharmony_ci * @systemapi 22861847f8eSopenharmony_ci * @stagemodelonly 22961847f8eSopenharmony_ci * @since 10 23061847f8eSopenharmony_ci */ 23161847f8eSopenharmony_ci data: string | ArrayBuffer; 23261847f8eSopenharmony_ci /** 23361847f8eSopenharmony_ci * Specifies the subscriber id 23461847f8eSopenharmony_ci * 23561847f8eSopenharmony_ci * @type { string } 23661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 23761847f8eSopenharmony_ci * @systemapi 23861847f8eSopenharmony_ci * @stagemodelonly 23961847f8eSopenharmony_ci * @since 10 24061847f8eSopenharmony_ci */ 24161847f8eSopenharmony_ci subscriberId: string; 24261847f8eSopenharmony_ci } 24361847f8eSopenharmony_ci 24461847f8eSopenharmony_ci /** 24561847f8eSopenharmony_ci * Specifies the change node structure of rdb store data in callback. 24661847f8eSopenharmony_ci * 24761847f8eSopenharmony_ci * @interface RdbDataChangeNode 24861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 24961847f8eSopenharmony_ci * @systemapi 25061847f8eSopenharmony_ci * @stagemodelonly 25161847f8eSopenharmony_ci * @since 10 25261847f8eSopenharmony_ci */ 25361847f8eSopenharmony_ci interface RdbDataChangeNode { 25461847f8eSopenharmony_ci /** 25561847f8eSopenharmony_ci * Specifies the uri of the callback. 25661847f8eSopenharmony_ci * 25761847f8eSopenharmony_ci * @type { string } 25861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 25961847f8eSopenharmony_ci * @systemapi 26061847f8eSopenharmony_ci * @stagemodelonly 26161847f8eSopenharmony_ci * @since 10 26261847f8eSopenharmony_ci */ 26361847f8eSopenharmony_ci uri: string; 26461847f8eSopenharmony_ci /** 26561847f8eSopenharmony_ci * Specifies the templateId of the callback. 26661847f8eSopenharmony_ci * 26761847f8eSopenharmony_ci * @type { TemplateId } 26861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 26961847f8eSopenharmony_ci * @systemapi 27061847f8eSopenharmony_ci * @stagemodelonly 27161847f8eSopenharmony_ci * @since 10 27261847f8eSopenharmony_ci */ 27361847f8eSopenharmony_ci templateId: TemplateId; 27461847f8eSopenharmony_ci /** 27561847f8eSopenharmony_ci * Specifies the datas of the callback. 27661847f8eSopenharmony_ci * every node is a json, json's key is [key of {@link Template#predicates} 27761847f8eSopenharmony_ci * and value is the query result from rdb store query by value of{@link Template#predicates}]. 27861847f8eSopenharmony_ci * 27961847f8eSopenharmony_ci * @type { Array<string> } 28061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 28161847f8eSopenharmony_ci * @systemapi 28261847f8eSopenharmony_ci * @stagemodelonly 28361847f8eSopenharmony_ci * @since 10 28461847f8eSopenharmony_ci */ 28561847f8eSopenharmony_ci data: Array<string>; 28661847f8eSopenharmony_ci } 28761847f8eSopenharmony_ci 28861847f8eSopenharmony_ci /** 28961847f8eSopenharmony_ci * Specifies the change node structure of published data in callback. 29061847f8eSopenharmony_ci * 29161847f8eSopenharmony_ci * @interface PublishedDataChangeNode 29261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 29361847f8eSopenharmony_ci * @systemapi 29461847f8eSopenharmony_ci * @stagemodelonly 29561847f8eSopenharmony_ci * @since 10 29661847f8eSopenharmony_ci */ 29761847f8eSopenharmony_ci interface PublishedDataChangeNode { 29861847f8eSopenharmony_ci /** 29961847f8eSopenharmony_ci * Specifies the bundleName of the callback. 30061847f8eSopenharmony_ci * 30161847f8eSopenharmony_ci * @type { string } 30261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 30361847f8eSopenharmony_ci * @systemapi 30461847f8eSopenharmony_ci * @stagemodelonly 30561847f8eSopenharmony_ci * @since 10 30661847f8eSopenharmony_ci */ 30761847f8eSopenharmony_ci bundleName: string; 30861847f8eSopenharmony_ci /** 30961847f8eSopenharmony_ci * Specifies the datas of the callback. 31061847f8eSopenharmony_ci * 31161847f8eSopenharmony_ci * @type { Array<PublishedItem> } 31261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 31361847f8eSopenharmony_ci * @systemapi 31461847f8eSopenharmony_ci * @stagemodelonly 31561847f8eSopenharmony_ci * @since 10 31661847f8eSopenharmony_ci */ 31761847f8eSopenharmony_ci data: Array<PublishedItem>; 31861847f8eSopenharmony_ci } 31961847f8eSopenharmony_ci 32061847f8eSopenharmony_ci /** 32161847f8eSopenharmony_ci * Specifies the template structure in subscribe. 32261847f8eSopenharmony_ci * 32361847f8eSopenharmony_ci * @interface Template 32461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 32561847f8eSopenharmony_ci * @systemapi 32661847f8eSopenharmony_ci * @stagemodelonly 32761847f8eSopenharmony_ci * @since 10 32861847f8eSopenharmony_ci */ 32961847f8eSopenharmony_ci interface Template { 33061847f8eSopenharmony_ci /** 33161847f8eSopenharmony_ci * Specifies the predicates of the template. 33261847f8eSopenharmony_ci * When the callback in {@link DataShareHelper#on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)} 33361847f8eSopenharmony_ci * is called, the predicates is used to generate data in {@link ChangeNode}. Only for rdb store data. 33461847f8eSopenharmony_ci * 33561847f8eSopenharmony_ci * @type { [key: string]: string } 33661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 33761847f8eSopenharmony_ci * @systemapi 33861847f8eSopenharmony_ci * @stagemodelonly 33961847f8eSopenharmony_ci * @since 10 34061847f8eSopenharmony_ci */ 34161847f8eSopenharmony_ci /** 34261847f8eSopenharmony_ci * Specifies the predicates of the template. 34361847f8eSopenharmony_ci * When the callback in {@link DataShareHelper#on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)} 34461847f8eSopenharmony_ci * is called, the predicates is used to generate data in {@link ChangeNode}. Only for rdb store data. 34561847f8eSopenharmony_ci * 34661847f8eSopenharmony_ci * @type { Record<string, string> } 34761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 34861847f8eSopenharmony_ci * @systemapi 34961847f8eSopenharmony_ci * @stagemodelonly 35061847f8eSopenharmony_ci * @since 11 35161847f8eSopenharmony_ci */ 35261847f8eSopenharmony_ci predicates: Record<string, string>; 35361847f8eSopenharmony_ci 35461847f8eSopenharmony_ci /** 35561847f8eSopenharmony_ci * Specifies the scheduler sql of the template. 35661847f8eSopenharmony_ci * When modify the subscribed uri's data, scheduler is auto called. 35761847f8eSopenharmony_ci * 35861847f8eSopenharmony_ci * @type { string } 35961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 36061847f8eSopenharmony_ci * @systemapi 36161847f8eSopenharmony_ci * @stagemodelonly 36261847f8eSopenharmony_ci * @since 10 36361847f8eSopenharmony_ci */ 36461847f8eSopenharmony_ci scheduler: string; 36561847f8eSopenharmony_ci } 36661847f8eSopenharmony_ci /** 36761847f8eSopenharmony_ci * Specifies the operation result structure. 36861847f8eSopenharmony_ci * 36961847f8eSopenharmony_ci * @interface OperationResult 37061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 37161847f8eSopenharmony_ci * @systemapi 37261847f8eSopenharmony_ci * @stagemodelonly 37361847f8eSopenharmony_ci * @since 10 37461847f8eSopenharmony_ci */ 37561847f8eSopenharmony_ci interface OperationResult { 37661847f8eSopenharmony_ci /** 37761847f8eSopenharmony_ci * Specifies the key of the operation result. 37861847f8eSopenharmony_ci * 37961847f8eSopenharmony_ci * @type { string } 38061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 38161847f8eSopenharmony_ci * @systemapi 38261847f8eSopenharmony_ci * @stagemodelonly 38361847f8eSopenharmony_ci * @since 10 38461847f8eSopenharmony_ci */ 38561847f8eSopenharmony_ci key: string; 38661847f8eSopenharmony_ci 38761847f8eSopenharmony_ci /** 38861847f8eSopenharmony_ci * Specifies the operation result. 38961847f8eSopenharmony_ci * 39061847f8eSopenharmony_ci * @type { number } 39161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 39261847f8eSopenharmony_ci * @systemapi 39361847f8eSopenharmony_ci * @stagemodelonly 39461847f8eSopenharmony_ci * @since 10 39561847f8eSopenharmony_ci */ 39661847f8eSopenharmony_ci result: number; 39761847f8eSopenharmony_ci } 39861847f8eSopenharmony_ci 39961847f8eSopenharmony_ci /** 40061847f8eSopenharmony_ci * Struct for a batch update operation. 40161847f8eSopenharmony_ci * 40261847f8eSopenharmony_ci * @interface UpdateOperation 40361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 40461847f8eSopenharmony_ci * @systemapi 40561847f8eSopenharmony_ci * @stagemodelonly 40661847f8eSopenharmony_ci * @since 12 40761847f8eSopenharmony_ci */ 40861847f8eSopenharmony_ci interface UpdateOperation { 40961847f8eSopenharmony_ci /** 41061847f8eSopenharmony_ci * Indicates the data to update. 41161847f8eSopenharmony_ci * 41261847f8eSopenharmony_ci * @type { ValuesBucket } 41361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 41461847f8eSopenharmony_ci * @systemapi 41561847f8eSopenharmony_ci * @stagemodelonly 41661847f8eSopenharmony_ci * @since 12 41761847f8eSopenharmony_ci */ 41861847f8eSopenharmony_ci values: ValuesBucket; 41961847f8eSopenharmony_ci 42061847f8eSopenharmony_ci /** 42161847f8eSopenharmony_ci * Indicates filter criteria. 42261847f8eSopenharmony_ci * 42361847f8eSopenharmony_ci * @type { dataSharePredicates.DataSharePredicates } 42461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 42561847f8eSopenharmony_ci * @systemapi 42661847f8eSopenharmony_ci * @stagemodelonly 42761847f8eSopenharmony_ci * @since 12 42861847f8eSopenharmony_ci */ 42961847f8eSopenharmony_ci predicates: dataSharePredicates.DataSharePredicates; 43061847f8eSopenharmony_ci } 43161847f8eSopenharmony_ci 43261847f8eSopenharmony_ci /** 43361847f8eSopenharmony_ci * Enumerates the data change types. 43461847f8eSopenharmony_ci * 43561847f8eSopenharmony_ci * @enum { number } 43661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 43761847f8eSopenharmony_ci * @systemapi 43861847f8eSopenharmony_ci * @stagemodelonly 43961847f8eSopenharmony_ci * @since 12 44061847f8eSopenharmony_ci */ 44161847f8eSopenharmony_ci enum ChangeType { 44261847f8eSopenharmony_ci /** 44361847f8eSopenharmony_ci * Data inserted. 44461847f8eSopenharmony_ci * 44561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 44661847f8eSopenharmony_ci * @systemapi 44761847f8eSopenharmony_ci * @stagemodelonly 44861847f8eSopenharmony_ci * @since 12 44961847f8eSopenharmony_ci */ 45061847f8eSopenharmony_ci INSERT = 0, 45161847f8eSopenharmony_ci 45261847f8eSopenharmony_ci /** 45361847f8eSopenharmony_ci * Data deleted. 45461847f8eSopenharmony_ci * 45561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 45661847f8eSopenharmony_ci * @systemapi 45761847f8eSopenharmony_ci * @stagemodelonly 45861847f8eSopenharmony_ci * @since 12 45961847f8eSopenharmony_ci */ 46061847f8eSopenharmony_ci DELETE, 46161847f8eSopenharmony_ci /** 46261847f8eSopenharmony_ci * Data updated. 46361847f8eSopenharmony_ci * 46461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 46561847f8eSopenharmony_ci * @systemapi 46661847f8eSopenharmony_ci * @stagemodelonly 46761847f8eSopenharmony_ci * @since 12 46861847f8eSopenharmony_ci */ 46961847f8eSopenharmony_ci UPDATE 47061847f8eSopenharmony_ci } 47161847f8eSopenharmony_ci /** 47261847f8eSopenharmony_ci * Enumerates the subscription types. 47361847f8eSopenharmony_ci * 47461847f8eSopenharmony_ci * @enum { number } 47561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 47661847f8eSopenharmony_ci * @systemapi 47761847f8eSopenharmony_ci * @stagemodelonly 47861847f8eSopenharmony_ci * @since 12 47961847f8eSopenharmony_ci */ 48061847f8eSopenharmony_ci enum SubscriptionType { 48161847f8eSopenharmony_ci /** 48261847f8eSopenharmony_ci * Subscribe to the change of the data with the specified URI. 48361847f8eSopenharmony_ci * 48461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 48561847f8eSopenharmony_ci * @systemapi 48661847f8eSopenharmony_ci * @stagemodelonly 48761847f8eSopenharmony_ci * @since 12 48861847f8eSopenharmony_ci */ 48961847f8eSopenharmony_ci SUBSCRIPTION_TYPE_EXACT_URI = 0, 49061847f8eSopenharmony_ci } 49161847f8eSopenharmony_ci 49261847f8eSopenharmony_ci /** 49361847f8eSopenharmony_ci * Struct for the data change. 49461847f8eSopenharmony_ci * 49561847f8eSopenharmony_ci * @interface ChangeInfo 49661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 49761847f8eSopenharmony_ci * @systemapi 49861847f8eSopenharmony_ci * @stagemodelonly 49961847f8eSopenharmony_ci * @since 12 50061847f8eSopenharmony_ci */ 50161847f8eSopenharmony_ci interface ChangeInfo { 50261847f8eSopenharmony_ci /** 50361847f8eSopenharmony_ci * Type of the data change. 50461847f8eSopenharmony_ci * 50561847f8eSopenharmony_ci * @type { ChangeType } 50661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 50761847f8eSopenharmony_ci * @systemapi 50861847f8eSopenharmony_ci * @stagemodelonly 50961847f8eSopenharmony_ci * @since 12 51061847f8eSopenharmony_ci */ 51161847f8eSopenharmony_ci type: ChangeType; 51261847f8eSopenharmony_ci 51361847f8eSopenharmony_ci /** 51461847f8eSopenharmony_ci * URI of the data changed. 51561847f8eSopenharmony_ci * 51661847f8eSopenharmony_ci * @type { string } 51761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 51861847f8eSopenharmony_ci * @systemapi 51961847f8eSopenharmony_ci * @stagemodelonly 52061847f8eSopenharmony_ci * @since 12 52161847f8eSopenharmony_ci */ 52261847f8eSopenharmony_ci uri: string; 52361847f8eSopenharmony_ci /** 52461847f8eSopenharmony_ci * Data changed. 52561847f8eSopenharmony_ci * 52661847f8eSopenharmony_ci * @type { Array<ValuesBucket> } 52761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 52861847f8eSopenharmony_ci * @systemapi 52961847f8eSopenharmony_ci * @stagemodelonly 53061847f8eSopenharmony_ci * @since 12 53161847f8eSopenharmony_ci */ 53261847f8eSopenharmony_ci values: Array<ValuesBucket>; 53361847f8eSopenharmony_ci } 53461847f8eSopenharmony_ci 53561847f8eSopenharmony_ci /** 53661847f8eSopenharmony_ci * DataShareHelper 53761847f8eSopenharmony_ci * 53861847f8eSopenharmony_ci * @interface DataShareHelper 53961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 54061847f8eSopenharmony_ci * @systemapi 54161847f8eSopenharmony_ci * @stagemodelonly 54261847f8eSopenharmony_ci * @since 9 54361847f8eSopenharmony_ci */ 54461847f8eSopenharmony_ci interface DataShareHelper { 54561847f8eSopenharmony_ci /** 54661847f8eSopenharmony_ci * Registers an observer to observe data specified by the given uri. 54761847f8eSopenharmony_ci * 54861847f8eSopenharmony_ci * @param { 'dataChange' } type - Type must be 'dataChange'. 54961847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 55061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of on. 55161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 55261847f8eSopenharmony_ci * @systemapi 55361847f8eSopenharmony_ci * @stagemodelonly 55461847f8eSopenharmony_ci * @since 9 55561847f8eSopenharmony_ci */ 55661847f8eSopenharmony_ci /** 55761847f8eSopenharmony_ci * Registers an observer to observe data specified by the given uri. 55861847f8eSopenharmony_ci * 55961847f8eSopenharmony_ci * @param { 'dataChange' } type - Type must be 'dataChange'. 56061847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 56161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of on. 56261847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 56361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 56461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 56561847f8eSopenharmony_ci * 2. Incorrect parameters types. 56661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 56761847f8eSopenharmony_ci * @systemapi 56861847f8eSopenharmony_ci * @stagemodelonly 56961847f8eSopenharmony_ci * @since 12 57061847f8eSopenharmony_ci */ 57161847f8eSopenharmony_ci on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void; 57261847f8eSopenharmony_ci 57361847f8eSopenharmony_ci /** 57461847f8eSopenharmony_ci * Deregisters an observer used for monitoring data specified by the given uri. 57561847f8eSopenharmony_ci * 57661847f8eSopenharmony_ci * @param { 'dataChange' } type - Type must be 'dataChange'. 57761847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 57861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of off. 57961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 58061847f8eSopenharmony_ci * @systemapi 58161847f8eSopenharmony_ci * @stagemodelonly 58261847f8eSopenharmony_ci * @since 9 58361847f8eSopenharmony_ci */ 58461847f8eSopenharmony_ci /** 58561847f8eSopenharmony_ci * Deregisters an observer used for monitoring data specified by the given uri. 58661847f8eSopenharmony_ci * 58761847f8eSopenharmony_ci * @param { 'dataChange' } type - Type must be 'dataChange'. 58861847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 58961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of off. 59061847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 59161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 59261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 59361847f8eSopenharmony_ci * 2. Incorrect parameters types. 59461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 59561847f8eSopenharmony_ci * @systemapi 59661847f8eSopenharmony_ci * @stagemodelonly 59761847f8eSopenharmony_ci * @since 12 59861847f8eSopenharmony_ci */ 59961847f8eSopenharmony_ci off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void; 60061847f8eSopenharmony_ci /** 60161847f8eSopenharmony_ci * Subscribes to the change of the data specified by the given URI. 60261847f8eSopenharmony_ci * 60361847f8eSopenharmony_ci * @param { 'dataChange' } type - Indicates the event type, which must be 'dataChange'. 60461847f8eSopenharmony_ci * @param { SubscriptionType } type - Indicates the subscription type, which is defined in {@link SubscriptionType}. 60561847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to subscribe. 60661847f8eSopenharmony_ci * @param { AsyncCallback<ChangeInfo> } callback - Indicates the callback used to return the data change. 60761847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 60861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 60961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 61061847f8eSopenharmony_ci * 2. Incorrect parameters types. 61161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 61261847f8eSopenharmony_ci * @systemapi 61361847f8eSopenharmony_ci * @stagemodelonly 61461847f8eSopenharmony_ci * @since 12 61561847f8eSopenharmony_ci */ 61661847f8eSopenharmony_ci on(event: 'dataChange', type:SubscriptionType, uri: string, callback: AsyncCallback<ChangeInfo>): void; 61761847f8eSopenharmony_ci 61861847f8eSopenharmony_ci /** 61961847f8eSopenharmony_ci * Unsubscribes from the change of the data specified by the given URI. 62061847f8eSopenharmony_ci * 62161847f8eSopenharmony_ci * @param { 'dataChange' } type - Indicates the event type, which must be 'dataChange'. 62261847f8eSopenharmony_ci * @param { SubscriptionType } type - Indicates the subscription type, which is defined in {@link SubscriptionType}. 62361847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to unsubscribe. 62461847f8eSopenharmony_ci * @param { AsyncCallback<ChangeInfo> } callback - Indicates the callback to unsubscribe. 62561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 62661847f8eSopenharmony_ci * 2. Incorrect parameters types. 62761847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 62861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 62961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 63061847f8eSopenharmony_ci * @systemapi 63161847f8eSopenharmony_ci * @stagemodelonly 63261847f8eSopenharmony_ci * @since 12 63361847f8eSopenharmony_ci */ 63461847f8eSopenharmony_ci off(event: 'dataChange', type:SubscriptionType, uri: string, callback?: AsyncCallback<ChangeInfo>): void; 63561847f8eSopenharmony_ci 63661847f8eSopenharmony_ci /** 63761847f8eSopenharmony_ci * Adds a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}. 63861847f8eSopenharmony_ci * 63961847f8eSopenharmony_ci * @param { string } uri - Indicates the uri to add. 64061847f8eSopenharmony_ci * @param { string } subscriberId - The subscribe id to add.. 64161847f8eSopenharmony_ci * @param { Template } template - The template to add. 64261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 64361847f8eSopenharmony_ci * 2. Incorrect parameters types. 64461847f8eSopenharmony_ci * @throws { BusinessError } 15700011 - The URI is not exist. 64561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 64661847f8eSopenharmony_ci * @systemapi 64761847f8eSopenharmony_ci * @stagemodelonly 64861847f8eSopenharmony_ci * @since 10 64961847f8eSopenharmony_ci */ 65061847f8eSopenharmony_ci /** 65161847f8eSopenharmony_ci * Adds a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}. 65261847f8eSopenharmony_ci * 65361847f8eSopenharmony_ci * @param { string } uri - Indicates the uri to add. 65461847f8eSopenharmony_ci * @param { string } subscriberId - The subscribe id to add.. 65561847f8eSopenharmony_ci * @param { Template } template - The template to add. 65661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 65761847f8eSopenharmony_ci * 2. Incorrect parameters types. 65861847f8eSopenharmony_ci * @throws { BusinessError } 15700011 - The URI is not exist. 65961847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 66061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 66161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 66261847f8eSopenharmony_ci * @systemapi 66361847f8eSopenharmony_ci * @stagemodelonly 66461847f8eSopenharmony_ci * @since 12 66561847f8eSopenharmony_ci */ 66661847f8eSopenharmony_ci addTemplate(uri: string, subscriberId: string, template: Template): void; 66761847f8eSopenharmony_ci 66861847f8eSopenharmony_ci /** 66961847f8eSopenharmony_ci * Deletes a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}. 67061847f8eSopenharmony_ci * 67161847f8eSopenharmony_ci * @param { string } uri - Indicates the uri to delete. 67261847f8eSopenharmony_ci * @param { string } subscriberId - The subscribe id. 67361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 67461847f8eSopenharmony_ci * 2. Incorrect parameters types. 67561847f8eSopenharmony_ci * @throws { BusinessError } 15700011 - The URI is not exist. 67661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 67761847f8eSopenharmony_ci * @systemapi 67861847f8eSopenharmony_ci * @stagemodelonly 67961847f8eSopenharmony_ci * @since 10 68061847f8eSopenharmony_ci */ 68161847f8eSopenharmony_ci /** 68261847f8eSopenharmony_ci * Deletes a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}. 68361847f8eSopenharmony_ci * 68461847f8eSopenharmony_ci * @param { string } uri - Indicates the uri to delete. 68561847f8eSopenharmony_ci * @param { string } subscriberId - The subscribe id. 68661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 68761847f8eSopenharmony_ci * 2. Incorrect parameters types. 68861847f8eSopenharmony_ci * @throws { BusinessError } 15700011 - The URI is not exist. 68961847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 69061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 69161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 69261847f8eSopenharmony_ci * @systemapi 69361847f8eSopenharmony_ci * @stagemodelonly 69461847f8eSopenharmony_ci * @since 12 69561847f8eSopenharmony_ci */ 69661847f8eSopenharmony_ci delTemplate(uri: string, subscriberId: string): void; 69761847f8eSopenharmony_ci 69861847f8eSopenharmony_ci /** 69961847f8eSopenharmony_ci * Registers observers to observe rdb data specified by the given uri and template. 70061847f8eSopenharmony_ci * 70161847f8eSopenharmony_ci * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'. 70261847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the paths of the data to operate. 70361847f8eSopenharmony_ci * @param { TemplateId } templateId - The template of on. 70461847f8eSopenharmony_ci * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of on. 70561847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 70661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 70761847f8eSopenharmony_ci * 2. Incorrect parameters types. 70861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 70961847f8eSopenharmony_ci * @systemapi 71061847f8eSopenharmony_ci * @stagemodelonly 71161847f8eSopenharmony_ci * @since 10 71261847f8eSopenharmony_ci */ 71361847f8eSopenharmony_ci /** 71461847f8eSopenharmony_ci * Registers observers to observe rdb data specified by the given uri and template. 71561847f8eSopenharmony_ci * 71661847f8eSopenharmony_ci * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'. 71761847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the paths of the data to operate. 71861847f8eSopenharmony_ci * @param { TemplateId } templateId - The template of on. 71961847f8eSopenharmony_ci * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of on. 72061847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 72161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 72261847f8eSopenharmony_ci * 2. Incorrect parameters types. 72361847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 72461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 72561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 72661847f8eSopenharmony_ci * @systemapi 72761847f8eSopenharmony_ci * @stagemodelonly 72861847f8eSopenharmony_ci * @since 12 72961847f8eSopenharmony_ci */ 73061847f8eSopenharmony_ci on( 73161847f8eSopenharmony_ci type: 'rdbDataChange', 73261847f8eSopenharmony_ci uris: Array<string>, 73361847f8eSopenharmony_ci templateId: TemplateId, 73461847f8eSopenharmony_ci callback: AsyncCallback<RdbDataChangeNode> 73561847f8eSopenharmony_ci ): Array<OperationResult>; 73661847f8eSopenharmony_ci 73761847f8eSopenharmony_ci /** 73861847f8eSopenharmony_ci * Deregisters observers used for monitoring data specified by the given uri and template. 73961847f8eSopenharmony_ci * 74061847f8eSopenharmony_ci * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'. 74161847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the paths of the data to operate. 74261847f8eSopenharmony_ci * @param { TemplateId } templateId - The template of off. 74361847f8eSopenharmony_ci * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of off. 74461847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 74561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 74661847f8eSopenharmony_ci * 2. Incorrect parameters types. 74761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 74861847f8eSopenharmony_ci * @systemapi 74961847f8eSopenharmony_ci * @stagemodelonly 75061847f8eSopenharmony_ci * @since 10 75161847f8eSopenharmony_ci */ 75261847f8eSopenharmony_ci /** 75361847f8eSopenharmony_ci * Deregisters observers used for monitoring data specified by the given uri and template. 75461847f8eSopenharmony_ci * 75561847f8eSopenharmony_ci * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'. 75661847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the paths of the data to operate. 75761847f8eSopenharmony_ci * @param { TemplateId } templateId - The template of off. 75861847f8eSopenharmony_ci * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of off. 75961847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 76061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 76161847f8eSopenharmony_ci * 2. Incorrect parameters types. 76261847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 76361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 76461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 76561847f8eSopenharmony_ci * @systemapi 76661847f8eSopenharmony_ci * @stagemodelonly 76761847f8eSopenharmony_ci * @since 12 76861847f8eSopenharmony_ci */ 76961847f8eSopenharmony_ci off( 77061847f8eSopenharmony_ci type: 'rdbDataChange', 77161847f8eSopenharmony_ci uris: Array<string>, 77261847f8eSopenharmony_ci templateId: TemplateId, 77361847f8eSopenharmony_ci callback?: AsyncCallback<RdbDataChangeNode> 77461847f8eSopenharmony_ci ): Array<OperationResult>; 77561847f8eSopenharmony_ci 77661847f8eSopenharmony_ci /** 77761847f8eSopenharmony_ci * Registers observers to observe published data specified by the given key and subscriberId. 77861847f8eSopenharmony_ci * 77961847f8eSopenharmony_ci * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'. 78061847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the uris of the data to operate. 78161847f8eSopenharmony_ci * @param { string } subscriberId - The subscriberId of on. 78261847f8eSopenharmony_ci * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of on. 78361847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 78461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 78561847f8eSopenharmony_ci * 2. Incorrect parameters types. 78661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 78761847f8eSopenharmony_ci * @systemapi 78861847f8eSopenharmony_ci * @stagemodelonly 78961847f8eSopenharmony_ci * @since 10 79061847f8eSopenharmony_ci */ 79161847f8eSopenharmony_ci /** 79261847f8eSopenharmony_ci * Registers observers to observe published data specified by the given key and subscriberId. 79361847f8eSopenharmony_ci * 79461847f8eSopenharmony_ci * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'. 79561847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the uris of the data to operate. 79661847f8eSopenharmony_ci * @param { string } subscriberId - The subscriberId of on. 79761847f8eSopenharmony_ci * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of on. 79861847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 79961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 80061847f8eSopenharmony_ci * 2. Incorrect parameters types. 80161847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 80261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 80361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 80461847f8eSopenharmony_ci * @systemapi 80561847f8eSopenharmony_ci * @stagemodelonly 80661847f8eSopenharmony_ci * @since 12 80761847f8eSopenharmony_ci */ 80861847f8eSopenharmony_ci on( 80961847f8eSopenharmony_ci type: 'publishedDataChange', 81061847f8eSopenharmony_ci uris: Array<string>, 81161847f8eSopenharmony_ci subscriberId: string, 81261847f8eSopenharmony_ci callback: AsyncCallback<PublishedDataChangeNode> 81361847f8eSopenharmony_ci ): Array<OperationResult>; 81461847f8eSopenharmony_ci 81561847f8eSopenharmony_ci /** 81661847f8eSopenharmony_ci * Deregisters observers used for monitoring data specified by the given key and subscriberId. 81761847f8eSopenharmony_ci * 81861847f8eSopenharmony_ci * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'. 81961847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the uris of the data to operate. 82061847f8eSopenharmony_ci * @param { string } subscriberId - The subscriberId of off. 82161847f8eSopenharmony_ci * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of off. 82261847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 82361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 82461847f8eSopenharmony_ci * 2. Incorrect parameters types. 82561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 82661847f8eSopenharmony_ci * @systemapi 82761847f8eSopenharmony_ci * @stagemodelonly 82861847f8eSopenharmony_ci * @since 10 82961847f8eSopenharmony_ci */ 83061847f8eSopenharmony_ci /** 83161847f8eSopenharmony_ci * Deregisters observers used for monitoring data specified by the given key and subscriberId. 83261847f8eSopenharmony_ci * 83361847f8eSopenharmony_ci * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'. 83461847f8eSopenharmony_ci * @param { Array<string> } uris - Indicates the uris of the data to operate. 83561847f8eSopenharmony_ci * @param { string } subscriberId - The subscriberId of off. 83661847f8eSopenharmony_ci * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of off. 83761847f8eSopenharmony_ci * @returns { Array<OperationResult> } : The operation result. 83861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 83961847f8eSopenharmony_ci * 2. Incorrect parameters types. 84061847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 84161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 84261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 84361847f8eSopenharmony_ci * @systemapi 84461847f8eSopenharmony_ci * @stagemodelonly 84561847f8eSopenharmony_ci * @since 12 84661847f8eSopenharmony_ci */ 84761847f8eSopenharmony_ci off( 84861847f8eSopenharmony_ci type: 'publishedDataChange', 84961847f8eSopenharmony_ci uris: Array<string>, 85061847f8eSopenharmony_ci subscriberId: string, 85161847f8eSopenharmony_ci callback?: AsyncCallback<PublishedDataChangeNode> 85261847f8eSopenharmony_ci ): Array<OperationResult>; 85361847f8eSopenharmony_ci 85461847f8eSopenharmony_ci /** 85561847f8eSopenharmony_ci * Update a single data into host data area. 85661847f8eSopenharmony_ci * 85761847f8eSopenharmony_ci * @param { Array<PublishedItem> } data - Indicates the data to publish. 85861847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 85961847f8eSopenharmony_ci * @param { number } version - Indicates the version of data to publish, larger is newer. 86061847f8eSopenharmony_ci * @param { AsyncCallback<Array<OperationResult>> } callback 86161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 86261847f8eSopenharmony_ci * 2. Incorrect parameters types. 86361847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 86461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 86561847f8eSopenharmony_ci * @systemapi 86661847f8eSopenharmony_ci * @stagemodelonly 86761847f8eSopenharmony_ci * @since 10 86861847f8eSopenharmony_ci */ 86961847f8eSopenharmony_ci /** 87061847f8eSopenharmony_ci * Update a single data into host data area. 87161847f8eSopenharmony_ci * 87261847f8eSopenharmony_ci * @param { Array<PublishedItem> } data - Indicates the data to publish. 87361847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 87461847f8eSopenharmony_ci * @param { number } version - Indicates the version of data to publish, larger is newer. 87561847f8eSopenharmony_ci * @param { AsyncCallback<Array<OperationResult>> } callback 87661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 87761847f8eSopenharmony_ci * 2. Incorrect parameters types. 87861847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 87961847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 88061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 88161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 88261847f8eSopenharmony_ci * @systemapi 88361847f8eSopenharmony_ci * @stagemodelonly 88461847f8eSopenharmony_ci * @since 12 88561847f8eSopenharmony_ci */ 88661847f8eSopenharmony_ci publish( 88761847f8eSopenharmony_ci data: Array<PublishedItem>, 88861847f8eSopenharmony_ci bundleName: string, 88961847f8eSopenharmony_ci version: number, 89061847f8eSopenharmony_ci callback: AsyncCallback<Array<OperationResult>> 89161847f8eSopenharmony_ci ): void; 89261847f8eSopenharmony_ci 89361847f8eSopenharmony_ci /** 89461847f8eSopenharmony_ci * Update a single data into host data area. 89561847f8eSopenharmony_ci * 89661847f8eSopenharmony_ci * @param { Array<PublishedItem> } data - Indicates the data to publish. 89761847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 89861847f8eSopenharmony_ci * @param { AsyncCallback<Array<OperationResult>> } callback 89961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 90061847f8eSopenharmony_ci * 2. Incorrect parameters types. 90161847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 90261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 90361847f8eSopenharmony_ci * @systemapi 90461847f8eSopenharmony_ci * @stagemodelonly 90561847f8eSopenharmony_ci * @since 10 90661847f8eSopenharmony_ci */ 90761847f8eSopenharmony_ci /** 90861847f8eSopenharmony_ci * Update a single data into host data area. 90961847f8eSopenharmony_ci * 91061847f8eSopenharmony_ci * @param { Array<PublishedItem> } data - Indicates the data to publish. 91161847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 91261847f8eSopenharmony_ci * @param { AsyncCallback<Array<OperationResult>> } callback 91361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 91461847f8eSopenharmony_ci * 2. Incorrect parameters types. 91561847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 91661847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 91761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 91861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 91961847f8eSopenharmony_ci * @systemapi 92061847f8eSopenharmony_ci * @stagemodelonly 92161847f8eSopenharmony_ci * @since 12 92261847f8eSopenharmony_ci */ 92361847f8eSopenharmony_ci publish( 92461847f8eSopenharmony_ci data: Array<PublishedItem>, 92561847f8eSopenharmony_ci bundleName: string, 92661847f8eSopenharmony_ci callback: AsyncCallback<Array<OperationResult>> 92761847f8eSopenharmony_ci ): void; 92861847f8eSopenharmony_ci 92961847f8eSopenharmony_ci /** 93061847f8eSopenharmony_ci * Update a single data into host data area. 93161847f8eSopenharmony_ci * 93261847f8eSopenharmony_ci * @param { Array<PublishedItem> } data - Indicates the data to publish. 93361847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 93461847f8eSopenharmony_ci * @param { number } version - Indicates the version of data to publish, larger is newer. 93561847f8eSopenharmony_ci * @returns { Promise<Array<OperationResult>> } 93661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 93761847f8eSopenharmony_ci * 2. Incorrect parameters types. 93861847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 93961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 94061847f8eSopenharmony_ci * @systemapi 94161847f8eSopenharmony_ci * @stagemodelonly 94261847f8eSopenharmony_ci * @since 10 94361847f8eSopenharmony_ci */ 94461847f8eSopenharmony_ci /** 94561847f8eSopenharmony_ci * Update a single data into host data area. 94661847f8eSopenharmony_ci * 94761847f8eSopenharmony_ci * @param { Array<PublishedItem> } data - Indicates the data to publish. 94861847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 94961847f8eSopenharmony_ci * @param { number } version - Indicates the version of data to publish, larger is newer. 95061847f8eSopenharmony_ci * @returns { Promise<Array<OperationResult>> } 95161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 95261847f8eSopenharmony_ci * 2. Incorrect parameters types. 95361847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 95461847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 95561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 95661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 95761847f8eSopenharmony_ci * @systemapi 95861847f8eSopenharmony_ci * @stagemodelonly 95961847f8eSopenharmony_ci * @since 12 96061847f8eSopenharmony_ci */ 96161847f8eSopenharmony_ci publish(data: Array<PublishedItem>, bundleName: string, version?: number): Promise<Array<OperationResult>>; 96261847f8eSopenharmony_ci 96361847f8eSopenharmony_ci /** 96461847f8eSopenharmony_ci * Registers a one-time observer to observe data specified by the given uri and template. 96561847f8eSopenharmony_ci * 96661847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 96761847f8eSopenharmony_ci * @param { AsyncCallback<Array<PublishedItem>> } callback 96861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 96961847f8eSopenharmony_ci * 2. Incorrect parameters types. 97061847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 97161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 97261847f8eSopenharmony_ci * @systemapi 97361847f8eSopenharmony_ci * @stagemodelonly 97461847f8eSopenharmony_ci * @since 10 97561847f8eSopenharmony_ci */ 97661847f8eSopenharmony_ci /** 97761847f8eSopenharmony_ci * Registers a one-time observer to observe data specified by the given uri and template. 97861847f8eSopenharmony_ci * 97961847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 98061847f8eSopenharmony_ci * @param { AsyncCallback<Array<PublishedItem>> } callback 98161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 98261847f8eSopenharmony_ci * 2. Incorrect parameters types. 98361847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 98461847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 98561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 98661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 98761847f8eSopenharmony_ci * @systemapi 98861847f8eSopenharmony_ci * @stagemodelonly 98961847f8eSopenharmony_ci * @since 12 99061847f8eSopenharmony_ci */ 99161847f8eSopenharmony_ci getPublishedData(bundleName: string, callback: AsyncCallback<Array<PublishedItem>>): void; 99261847f8eSopenharmony_ci 99361847f8eSopenharmony_ci /** 99461847f8eSopenharmony_ci * Registers a one-time observer to observe data specified by the given uri and template. 99561847f8eSopenharmony_ci * 99661847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 99761847f8eSopenharmony_ci * @returns { Promise<Array<PublishedItem>> } 99861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 99961847f8eSopenharmony_ci * 2. Incorrect parameters types. 100061847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 100161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 100261847f8eSopenharmony_ci * @systemapi 100361847f8eSopenharmony_ci * @stagemodelonly 100461847f8eSopenharmony_ci * @since 10 100561847f8eSopenharmony_ci */ 100661847f8eSopenharmony_ci /** 100761847f8eSopenharmony_ci * Registers a one-time observer to observe data specified by the given uri and template. 100861847f8eSopenharmony_ci * 100961847f8eSopenharmony_ci * @param { string } bundleName - Indicates the bundleName of data to publish. 101061847f8eSopenharmony_ci * @returns { Promise<Array<PublishedItem>> } 101161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 101261847f8eSopenharmony_ci * 2. Incorrect parameters types. 101361847f8eSopenharmony_ci * @throws { BusinessError } 15700012 - The data area is not exist. 101461847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 101561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 101661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 101761847f8eSopenharmony_ci * @systemapi 101861847f8eSopenharmony_ci * @stagemodelonly 101961847f8eSopenharmony_ci * @since 12 102061847f8eSopenharmony_ci */ 102161847f8eSopenharmony_ci getPublishedData(bundleName: string): Promise<Array<PublishedItem>>; 102261847f8eSopenharmony_ci 102361847f8eSopenharmony_ci /** 102461847f8eSopenharmony_ci * Inserts a single data record into the database. 102561847f8eSopenharmony_ci * 102661847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 102761847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null, 102861847f8eSopenharmony_ci * a blank row will be inserted. 102961847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the index of the inserted data record. 103061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 103161847f8eSopenharmony_ci * 2. Incorrect parameters types. 103261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 103361847f8eSopenharmony_ci * @systemapi 103461847f8eSopenharmony_ci * @stagemodelonly 103561847f8eSopenharmony_ci * @since 9 103661847f8eSopenharmony_ci */ 103761847f8eSopenharmony_ci /** 103861847f8eSopenharmony_ci * Inserts a single data record into the database. 103961847f8eSopenharmony_ci * 104061847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 104161847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null, 104261847f8eSopenharmony_ci * a blank row will be inserted. 104361847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the index of the inserted data record. 104461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 104561847f8eSopenharmony_ci * 2. Incorrect parameters types. 104661847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 104761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 104861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 104961847f8eSopenharmony_ci * @systemapi 105061847f8eSopenharmony_ci * @stagemodelonly 105161847f8eSopenharmony_ci * @since 12 105261847f8eSopenharmony_ci */ 105361847f8eSopenharmony_ci insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void; 105461847f8eSopenharmony_ci 105561847f8eSopenharmony_ci /** 105661847f8eSopenharmony_ci * Inserts a single data record into the database. 105761847f8eSopenharmony_ci * 105861847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 105961847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null, 106061847f8eSopenharmony_ci * a blank row will be inserted. 106161847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the index of the inserted data record. 106261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 106361847f8eSopenharmony_ci * 2. Incorrect parameters types. 106461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 106561847f8eSopenharmony_ci * @systemapi 106661847f8eSopenharmony_ci * @stagemodelonly 106761847f8eSopenharmony_ci * @since 9 106861847f8eSopenharmony_ci */ 106961847f8eSopenharmony_ci /** 107061847f8eSopenharmony_ci * Inserts a single data record into the database. 107161847f8eSopenharmony_ci * 107261847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 107361847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null, 107461847f8eSopenharmony_ci * a blank row will be inserted. 107561847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the index of the inserted data record. 107661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 107761847f8eSopenharmony_ci * 2. Incorrect parameters types. 107861847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 107961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 108061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 108161847f8eSopenharmony_ci * @systemapi 108261847f8eSopenharmony_ci * @stagemodelonly 108361847f8eSopenharmony_ci * @since 12 108461847f8eSopenharmony_ci */ 108561847f8eSopenharmony_ci insert(uri: string, value: ValuesBucket): Promise<number>; 108661847f8eSopenharmony_ci 108761847f8eSopenharmony_ci /** 108861847f8eSopenharmony_ci * Deletes one or more data records from the database. 108961847f8eSopenharmony_ci * 109061847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 109161847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 109261847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 109361847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of data records deleted. 109461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 109561847f8eSopenharmony_ci * 2. Incorrect parameters types. 109661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 109761847f8eSopenharmony_ci * @systemapi 109861847f8eSopenharmony_ci * @stagemodelonly 109961847f8eSopenharmony_ci * @since 9 110061847f8eSopenharmony_ci */ 110161847f8eSopenharmony_ci /** 110261847f8eSopenharmony_ci * Deletes one or more data records from the database. 110361847f8eSopenharmony_ci * 110461847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 110561847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 110661847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 110761847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of data records deleted. 110861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 110961847f8eSopenharmony_ci * 2. Incorrect parameters types. 111061847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 111161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 111261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 111361847f8eSopenharmony_ci * @systemapi 111461847f8eSopenharmony_ci * @stagemodelonly 111561847f8eSopenharmony_ci * @since 12 111661847f8eSopenharmony_ci */ 111761847f8eSopenharmony_ci delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void; 111861847f8eSopenharmony_ci 111961847f8eSopenharmony_ci /** 112061847f8eSopenharmony_ci * Deletes one or more data records from the database. 112161847f8eSopenharmony_ci * 112261847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 112361847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 112461847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 112561847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of data records deleted. 112661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 112761847f8eSopenharmony_ci * 2. Incorrect parameters types. 112861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 112961847f8eSopenharmony_ci * @systemapi 113061847f8eSopenharmony_ci * @stagemodelonly 113161847f8eSopenharmony_ci * @since 9 113261847f8eSopenharmony_ci */ 113361847f8eSopenharmony_ci /** 113461847f8eSopenharmony_ci * Deletes one or more data records from the database. 113561847f8eSopenharmony_ci * 113661847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 113761847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 113861847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 113961847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of data records deleted. 114061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 114161847f8eSopenharmony_ci * 2. Incorrect parameters types. 114261847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 114361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 114461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 114561847f8eSopenharmony_ci * @systemapi 114661847f8eSopenharmony_ci * @stagemodelonly 114761847f8eSopenharmony_ci * @since 12 114861847f8eSopenharmony_ci */ 114961847f8eSopenharmony_ci delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number>; 115061847f8eSopenharmony_ci 115161847f8eSopenharmony_ci /** 115261847f8eSopenharmony_ci * Queries data in the database. 115361847f8eSopenharmony_ci * 115461847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to query. 115561847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 115661847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 115761847f8eSopenharmony_ci * @param { Array<string> } columns - Indicates the columns to query. 115861847f8eSopenharmony_ci * If this parameter is null, all columns are queried. 115961847f8eSopenharmony_ci * @param { AsyncCallback<DataShareResultSet> } callback - {DataShareResultSet}: the query result. 116061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 116161847f8eSopenharmony_ci * 2. Incorrect parameters types. 116261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 116361847f8eSopenharmony_ci * @systemapi 116461847f8eSopenharmony_ci * @stagemodelonly 116561847f8eSopenharmony_ci * @since 9 116661847f8eSopenharmony_ci */ 116761847f8eSopenharmony_ci /** 116861847f8eSopenharmony_ci * Queries data in the database. 116961847f8eSopenharmony_ci * 117061847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to query. 117161847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 117261847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 117361847f8eSopenharmony_ci * @param { Array<string> } columns - Indicates the columns to query. 117461847f8eSopenharmony_ci * If this parameter is null, all columns are queried. 117561847f8eSopenharmony_ci * @param { AsyncCallback<DataShareResultSet> } callback - {DataShareResultSet}: the query result. 117661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 117761847f8eSopenharmony_ci * 2. Incorrect parameters types. 117861847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 117961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 118061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 118161847f8eSopenharmony_ci * @systemapi 118261847f8eSopenharmony_ci * @stagemodelonly 118361847f8eSopenharmony_ci * @since 12 118461847f8eSopenharmony_ci */ 118561847f8eSopenharmony_ci query( 118661847f8eSopenharmony_ci uri: string, 118761847f8eSopenharmony_ci predicates: dataSharePredicates.DataSharePredicates, 118861847f8eSopenharmony_ci columns: Array<string>, 118961847f8eSopenharmony_ci callback: AsyncCallback<DataShareResultSet> 119061847f8eSopenharmony_ci ): void; 119161847f8eSopenharmony_ci 119261847f8eSopenharmony_ci /** 119361847f8eSopenharmony_ci * Queries data in the database. 119461847f8eSopenharmony_ci * 119561847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to query. 119661847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 119761847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 119861847f8eSopenharmony_ci * @param { Array<string> } columns - Indicates the columns to query. 119961847f8eSopenharmony_ci * If this parameter is null, all columns are queried. 120061847f8eSopenharmony_ci * @returns { Promise<DataShareResultSet> } {DataShareResultSet}: the query result. 120161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 120261847f8eSopenharmony_ci * 2. Incorrect parameters types. 120361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 120461847f8eSopenharmony_ci * @systemapi 120561847f8eSopenharmony_ci * @stagemodelonly 120661847f8eSopenharmony_ci * @since 9 120761847f8eSopenharmony_ci */ 120861847f8eSopenharmony_ci /** 120961847f8eSopenharmony_ci * Queries data in the database. 121061847f8eSopenharmony_ci * 121161847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to query. 121261847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 121361847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 121461847f8eSopenharmony_ci * @param { Array<string> } columns - Indicates the columns to query. 121561847f8eSopenharmony_ci * If this parameter is null, all columns are queried. 121661847f8eSopenharmony_ci * @returns { Promise<DataShareResultSet> } {DataShareResultSet}: the query result. 121761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 121861847f8eSopenharmony_ci * 2. Incorrect parameters types. 121961847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 122061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 122161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 122261847f8eSopenharmony_ci * @systemapi 122361847f8eSopenharmony_ci * @stagemodelonly 122461847f8eSopenharmony_ci * @since 12 122561847f8eSopenharmony_ci */ 122661847f8eSopenharmony_ci query( 122761847f8eSopenharmony_ci uri: string, 122861847f8eSopenharmony_ci predicates: dataSharePredicates.DataSharePredicates, 122961847f8eSopenharmony_ci columns: Array<string> 123061847f8eSopenharmony_ci ): Promise<DataShareResultSet>; 123161847f8eSopenharmony_ci 123261847f8eSopenharmony_ci /** 123361847f8eSopenharmony_ci * Updates data records in the database. 123461847f8eSopenharmony_ci * 123561847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to update. 123661847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 123761847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 123861847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null. 123961847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of data records updated. 124061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 124161847f8eSopenharmony_ci * 2. Incorrect parameters types. 124261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 124361847f8eSopenharmony_ci * @systemapi 124461847f8eSopenharmony_ci * @stagemodelonly 124561847f8eSopenharmony_ci * @since 9 124661847f8eSopenharmony_ci */ 124761847f8eSopenharmony_ci /** 124861847f8eSopenharmony_ci * Updates data records in the database. 124961847f8eSopenharmony_ci * 125061847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to update. 125161847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 125261847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 125361847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null. 125461847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of data records updated. 125561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 125661847f8eSopenharmony_ci * 2. Incorrect parameters types. 125761847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 125861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 125961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 126061847f8eSopenharmony_ci * @systemapi 126161847f8eSopenharmony_ci * @stagemodelonly 126261847f8eSopenharmony_ci * @since 12 126361847f8eSopenharmony_ci */ 126461847f8eSopenharmony_ci update( 126561847f8eSopenharmony_ci uri: string, 126661847f8eSopenharmony_ci predicates: dataSharePredicates.DataSharePredicates, 126761847f8eSopenharmony_ci value: ValuesBucket, 126861847f8eSopenharmony_ci callback: AsyncCallback<number> 126961847f8eSopenharmony_ci ): void; 127061847f8eSopenharmony_ci 127161847f8eSopenharmony_ci /** 127261847f8eSopenharmony_ci * Updates data records in the database. 127361847f8eSopenharmony_ci * 127461847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to update. 127561847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 127661847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 127761847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null. 127861847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of data records updated. 127961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 128061847f8eSopenharmony_ci * 2. Incorrect parameters types. 128161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 128261847f8eSopenharmony_ci * @systemapi 128361847f8eSopenharmony_ci * @stagemodelonly 128461847f8eSopenharmony_ci * @since 9 128561847f8eSopenharmony_ci */ 128661847f8eSopenharmony_ci /** 128761847f8eSopenharmony_ci * Updates data records in the database. 128861847f8eSopenharmony_ci * 128961847f8eSopenharmony_ci * @param { string } uri - Indicates the path of data to update. 129061847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. 129161847f8eSopenharmony_ci * You should define the processing logic when this parameter is null. 129261847f8eSopenharmony_ci * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null. 129361847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of data records updated. 129461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 129561847f8eSopenharmony_ci * 2. Incorrect parameters types. 129661847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 129761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 129861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 129961847f8eSopenharmony_ci * @systemapi 130061847f8eSopenharmony_ci * @stagemodelonly 130161847f8eSopenharmony_ci * @since 12 130261847f8eSopenharmony_ci */ 130361847f8eSopenharmony_ci update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number>; 130461847f8eSopenharmony_ci 130561847f8eSopenharmony_ci /** 130661847f8eSopenharmony_ci * Updates data records in the database. 130761847f8eSopenharmony_ci * 130861847f8eSopenharmony_ci * @param { Record<string, Array<UpdateOperation>> } operations - Indicates the data to update. 130961847f8eSopenharmony_ci * @returns {Promise<Record<string, Array<number>>>} {Record<string, Array<number>>}: The result set of batch operations. 131061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 131161847f8eSopenharmony_ci * 2. Incorrect parameters types. 131261847f8eSopenharmony_ci * @throws { BusinessError } 15700000 - Inner error. 131361847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 131461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 131561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 131661847f8eSopenharmony_ci * @systemapi 131761847f8eSopenharmony_ci * @stagemodelonly 131861847f8eSopenharmony_ci * @since 12 131961847f8eSopenharmony_ci */ 132061847f8eSopenharmony_ci batchUpdate(operations: Record<string, Array<UpdateOperation>>): Promise<Record<string, Array<number>>>; 132161847f8eSopenharmony_ci 132261847f8eSopenharmony_ci /** 132361847f8eSopenharmony_ci * Inserts multiple data records into the database. 132461847f8eSopenharmony_ci * 132561847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 132661847f8eSopenharmony_ci * @param { Array<ValuesBucket> } values - Indicates the data records to insert. 132761847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of data records inserted. 132861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 132961847f8eSopenharmony_ci * 2. Incorrect parameters types. 133061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 133161847f8eSopenharmony_ci * @systemapi 133261847f8eSopenharmony_ci * @stagemodelonly 133361847f8eSopenharmony_ci * @since 9 133461847f8eSopenharmony_ci */ 133561847f8eSopenharmony_ci /** 133661847f8eSopenharmony_ci * Inserts multiple data records into the database. 133761847f8eSopenharmony_ci * 133861847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 133961847f8eSopenharmony_ci * @param { Array<ValuesBucket> } values - Indicates the data records to insert. 134061847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of data records inserted. 134161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 134261847f8eSopenharmony_ci * 2. Incorrect parameters types. 134361847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 134461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 134561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 134661847f8eSopenharmony_ci * @systemapi 134761847f8eSopenharmony_ci * @stagemodelonly 134861847f8eSopenharmony_ci * @since 12 134961847f8eSopenharmony_ci */ 135061847f8eSopenharmony_ci batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void; 135161847f8eSopenharmony_ci 135261847f8eSopenharmony_ci /** 135361847f8eSopenharmony_ci * Inserts multiple data records into the database. 135461847f8eSopenharmony_ci * 135561847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 135661847f8eSopenharmony_ci * @param { Array<ValuesBucket> } values - Indicates the data records to insert. 135761847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of data records inserted. 135861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 135961847f8eSopenharmony_ci * 2. Incorrect parameters types. 136061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 136161847f8eSopenharmony_ci * @systemapi 136261847f8eSopenharmony_ci * @stagemodelonly 136361847f8eSopenharmony_ci * @since 9 136461847f8eSopenharmony_ci */ 136561847f8eSopenharmony_ci /** 136661847f8eSopenharmony_ci * Inserts multiple data records into the database. 136761847f8eSopenharmony_ci * 136861847f8eSopenharmony_ci * @param { string } uri - Indicates the path of the data to operate. 136961847f8eSopenharmony_ci * @param { Array<ValuesBucket> } values - Indicates the data records to insert. 137061847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of data records inserted. 137161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 137261847f8eSopenharmony_ci * 2. Incorrect parameters types. 137361847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 137461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 137561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 137661847f8eSopenharmony_ci * @systemapi 137761847f8eSopenharmony_ci * @stagemodelonly 137861847f8eSopenharmony_ci * @since 12 137961847f8eSopenharmony_ci */ 138061847f8eSopenharmony_ci batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number>; 138161847f8eSopenharmony_ci 138261847f8eSopenharmony_ci /** 138361847f8eSopenharmony_ci * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}. 138461847f8eSopenharmony_ci * A normalized uri can be used across devices, persisted, backed up, and restored. 138561847f8eSopenharmony_ci * <p>To transfer a normalized uri from another environment to the current environment, you should call this 138661847f8eSopenharmony_ci * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} 138761847f8eSopenharmony_ci * to convert it to a denormalized uri that can be used only in the current environment. 138861847f8eSopenharmony_ci * 138961847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize. 139061847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - {string}: the normalized Uri, 139161847f8eSopenharmony_ci * if the DataShare supports uri normalization. 139261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 139361847f8eSopenharmony_ci * @systemapi 139461847f8eSopenharmony_ci * @stagemodelonly 139561847f8eSopenharmony_ci * @since 9 139661847f8eSopenharmony_ci */ 139761847f8eSopenharmony_ci /** 139861847f8eSopenharmony_ci * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}. 139961847f8eSopenharmony_ci * A normalized uri can be used across devices, persisted, backed up, and restored. 140061847f8eSopenharmony_ci * <p>To transfer a normalized uri from another environment to the current environment, you should call this 140161847f8eSopenharmony_ci * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} 140261847f8eSopenharmony_ci * to convert it to a denormalized uri that can be used only in the current environment. 140361847f8eSopenharmony_ci * 140461847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize. 140561847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - {string}: the normalized Uri, 140661847f8eSopenharmony_ci * if the DataShare supports uri normalization. 140761847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 140861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 140961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 141061847f8eSopenharmony_ci * 2. Incorrect parameters types. 141161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 141261847f8eSopenharmony_ci * @systemapi 141361847f8eSopenharmony_ci * @stagemodelonly 141461847f8eSopenharmony_ci * @since 12 141561847f8eSopenharmony_ci */ 141661847f8eSopenharmony_ci normalizeUri(uri: string, callback: AsyncCallback<string>): void; 141761847f8eSopenharmony_ci 141861847f8eSopenharmony_ci /** 141961847f8eSopenharmony_ci * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}. 142061847f8eSopenharmony_ci * A normalized uri can be used across devices, persisted, backed up, and restored. 142161847f8eSopenharmony_ci * <p>To transfer a normalized uri from another environment to the current environment, you should call this 142261847f8eSopenharmony_ci * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} 142361847f8eSopenharmony_ci * to convert it to a denormalized uri that can be used only in the current environment. 142461847f8eSopenharmony_ci * 142561847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize. 142661847f8eSopenharmony_ci * @returns { Promise<string> } {string}: the normalized Uri if the DataShare supports uri normalization; 142761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 142861847f8eSopenharmony_ci * @systemapi 142961847f8eSopenharmony_ci * @stagemodelonly 143061847f8eSopenharmony_ci * @since 9 143161847f8eSopenharmony_ci */ 143261847f8eSopenharmony_ci /** 143361847f8eSopenharmony_ci * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}. 143461847f8eSopenharmony_ci * A normalized uri can be used across devices, persisted, backed up, and restored. 143561847f8eSopenharmony_ci * <p>To transfer a normalized uri from another environment to the current environment, you should call this 143661847f8eSopenharmony_ci * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} 143761847f8eSopenharmony_ci * to convert it to a denormalized uri that can be used only in the current environment. 143861847f8eSopenharmony_ci * 143961847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize. 144061847f8eSopenharmony_ci * @returns { Promise<string> } {string}: the normalized Uri if the DataShare supports uri normalization; 144161847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 144261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 144361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 144461847f8eSopenharmony_ci * 2. Incorrect parameters types. 144561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 144661847f8eSopenharmony_ci * @systemapi 144761847f8eSopenharmony_ci * @stagemodelonly 144861847f8eSopenharmony_ci * @since 12 144961847f8eSopenharmony_ci */ 145061847f8eSopenharmony_ci normalizeUri(uri: string): Promise<string>; 145161847f8eSopenharmony_ci 145261847f8eSopenharmony_ci /** 145361847f8eSopenharmony_ci * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. 145461847f8eSopenharmony_ci * 145561847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize. 145661847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - {string}: the denormalized {@code Uri} object if 145761847f8eSopenharmony_ci * the denormalization is successful; returns the original {@code Uri} passed to this method if 145861847f8eSopenharmony_ci * there is nothing to do; returns {@code null} if the data identified by the normalized {@code Uri} 145961847f8eSopenharmony_ci * cannot be found in the current environment. 146061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 146161847f8eSopenharmony_ci * @systemapi 146261847f8eSopenharmony_ci * @stagemodelonly 146361847f8eSopenharmony_ci * @since 9 146461847f8eSopenharmony_ci */ 146561847f8eSopenharmony_ci /** 146661847f8eSopenharmony_ci * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. 146761847f8eSopenharmony_ci * 146861847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize. 146961847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - {string}: the denormalized {@code Uri} object if 147061847f8eSopenharmony_ci * the denormalization is successful; returns the original {@code Uri} passed to this method if 147161847f8eSopenharmony_ci * there is nothing to do; returns {@code null} if the data identified by the normalized {@code Uri} 147261847f8eSopenharmony_ci * cannot be found in the current environment. 147361847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 147461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 147561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 147661847f8eSopenharmony_ci * 2. Incorrect parameters types. 147761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 147861847f8eSopenharmony_ci * @systemapi 147961847f8eSopenharmony_ci * @stagemodelonly 148061847f8eSopenharmony_ci * @since 12 148161847f8eSopenharmony_ci */ 148261847f8eSopenharmony_ci denormalizeUri(uri: string, callback: AsyncCallback<string>): void; 148361847f8eSopenharmony_ci 148461847f8eSopenharmony_ci /** 148561847f8eSopenharmony_ci * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. 148661847f8eSopenharmony_ci * 148761847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize. 148861847f8eSopenharmony_ci * @returns { Promise<string> } {string}: the denormalized {@code Uri} object if the denormalization 148961847f8eSopenharmony_ci * is successful; returns the original {@code Uri} passed to this method if there is nothing to do; 149061847f8eSopenharmony_ci * returns {@code null} if the data identified by the normalized {@code Uri} cannot be found in the 149161847f8eSopenharmony_ci * current environment. 149261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 149361847f8eSopenharmony_ci * @systemapi 149461847f8eSopenharmony_ci * @stagemodelonly 149561847f8eSopenharmony_ci * @since 9 149661847f8eSopenharmony_ci */ 149761847f8eSopenharmony_ci /** 149861847f8eSopenharmony_ci * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. 149961847f8eSopenharmony_ci * 150061847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize. 150161847f8eSopenharmony_ci * @returns { Promise<string> } {string}: the denormalized {@code Uri} object if the denormalization 150261847f8eSopenharmony_ci * is successful; returns the original {@code Uri} passed to this method if there is nothing to do; 150361847f8eSopenharmony_ci * returns {@code null} if the data identified by the normalized {@code Uri} cannot be found in the 150461847f8eSopenharmony_ci * current environment. 150561847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 150661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 150761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 150861847f8eSopenharmony_ci * 2. Incorrect parameters types. 150961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 151061847f8eSopenharmony_ci * @systemapi 151161847f8eSopenharmony_ci * @stagemodelonly 151261847f8eSopenharmony_ci * @since 12 151361847f8eSopenharmony_ci */ 151461847f8eSopenharmony_ci denormalizeUri(uri: string): Promise<string>; 151561847f8eSopenharmony_ci 151661847f8eSopenharmony_ci /** 151761847f8eSopenharmony_ci * Notifies the registered observers of a change to the data resource specified by Uri. 151861847f8eSopenharmony_ci * 151961847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange. 152061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of notifyChange. 152161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 152261847f8eSopenharmony_ci * @systemapi 152361847f8eSopenharmony_ci * @stagemodelonly 152461847f8eSopenharmony_ci * @since 9 152561847f8eSopenharmony_ci */ 152661847f8eSopenharmony_ci /** 152761847f8eSopenharmony_ci * Notifies the registered observers of a change to the data resource specified by Uri. 152861847f8eSopenharmony_ci * 152961847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange. 153061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of notifyChange. 153161847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 153261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 153361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Mandatory parameters are left unspecified. 153461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 153561847f8eSopenharmony_ci * @systemapi 153661847f8eSopenharmony_ci * @stagemodelonly 153761847f8eSopenharmony_ci * @since 12 153861847f8eSopenharmony_ci */ 153961847f8eSopenharmony_ci notifyChange(uri: string, callback: AsyncCallback<void>): void; 154061847f8eSopenharmony_ci 154161847f8eSopenharmony_ci /** 154261847f8eSopenharmony_ci * Notifies the registered observers of a change to the data resource specified by Uri. 154361847f8eSopenharmony_ci * 154461847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange. 154561847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 154661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 154761847f8eSopenharmony_ci * @systemapi 154861847f8eSopenharmony_ci * @stagemodelonly 154961847f8eSopenharmony_ci * @since 9 155061847f8eSopenharmony_ci */ 155161847f8eSopenharmony_ci /** 155261847f8eSopenharmony_ci * Notifies the registered observers of a change to the data resource specified by Uri. 155361847f8eSopenharmony_ci * 155461847f8eSopenharmony_ci * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange. 155561847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 155661847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 155761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 155861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Mandatory parameters are left unspecified. 155961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 156061847f8eSopenharmony_ci * @systemapi 156161847f8eSopenharmony_ci * @stagemodelonly 156261847f8eSopenharmony_ci * @since 12 156361847f8eSopenharmony_ci */ 156461847f8eSopenharmony_ci notifyChange(uri: string): Promise<void>; 156561847f8eSopenharmony_ci 156661847f8eSopenharmony_ci /** 156761847f8eSopenharmony_ci * Notifies the registered observers of the data change. 156861847f8eSopenharmony_ci * 156961847f8eSopenharmony_ci * @param { ChangeInfo } data - Indicates the data change information. 157061847f8eSopenharmony_ci * @returns { Promise<void> } Promise that returns no value. 157161847f8eSopenharmony_ci * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed. 157261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not System Application. 157361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified; 157461847f8eSopenharmony_ci * 2. Incorrect parameters types. 157561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 157661847f8eSopenharmony_ci * @systemapi 157761847f8eSopenharmony_ci * @stagemodelonly 157861847f8eSopenharmony_ci * @since 12 157961847f8eSopenharmony_ci */ 158061847f8eSopenharmony_ci notifyChange(data: ChangeInfo): Promise<void>; 158161847f8eSopenharmony_ci 158261847f8eSopenharmony_ci /** 158361847f8eSopenharmony_ci * Close the connection between datashare and extension. 158461847f8eSopenharmony_ci * 158561847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 158661847f8eSopenharmony_ci * @throws { BusinessError } 15700000 - Inner error. 158761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer 158861847f8eSopenharmony_ci * @systemapi 158961847f8eSopenharmony_ci * @stagemodelonly 159061847f8eSopenharmony_ci * @since 12 159161847f8eSopenharmony_ci */ 159261847f8eSopenharmony_ci close(): Promise<void>; 159361847f8eSopenharmony_ci } 159461847f8eSopenharmony_ci} 159561847f8eSopenharmony_ci 159661847f8eSopenharmony_ciexport default dataShare; 1597