• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkData
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22import Context from './application/Context';
23import DataShareResultSet from './@ohos.data.DataShareResultSet';
24import dataSharePredicates from './@ohos.data.dataSharePredicates';
25import { ValuesBucket } from './@ohos.data.ValuesBucket';
26
27/**
28 * This module provides the dataShare capability for consumer.
29 *
30 * @namespace dataShare
31 * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
32 * @systemapi
33 * @stagemodelonly
34 * @since 9
35 */
36declare namespace dataShare {
37  /**
38   * Manages create datashare helper options.
39   *
40   * @interface DataShareHelperOptions
41   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
42   * @systemapi
43   * @stagemodelonly
44   * @since 10
45   */
46  interface DataShareHelperOptions {
47    /**
48     * Specifies whether the {@link DataShareHelper} in proxy mode.
49     * If value is true, the {@link DataShareHelper} to be created is in proxy mode, and all operations will not open provider APP as possible
50     *
51     * @default false
52     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
53     * @systemapi
54     * @stagemodelonly
55     * @since 10
56     */
57    isProxy?: boolean;
58  }
59
60  /**
61   * Obtains the dataShareHelper.
62   *
63   * @param { Context } context - Indicates the application context.
64   * @param { string } uri - Indicates the path of the file to open.
65   * @param { AsyncCallback<DataShareHelper> } callback - {DataShareHelper}: The dataShareHelper for consumer.
66   * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
67   *         2. Incorrect parameters types.
68   * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully.
69   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
70   * @systemapi
71   * @stagemodelonly
72   * @since 9
73   */
74  function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void;
75  /**
76   * Obtains the dataShareHelper.
77   *
78   * @param { Context } context - Indicates the application context.
79   * @param { string } uri - Indicates the path of the file to open.
80   * @param { DataShareHelperOptions } options - Indicates the optional config.
81   * @param { AsyncCallback<DataShareHelper> } callback - {DataShareHelper}: The dataShareHelper for consumer.
82   * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
83   *         2. Incorrect parameters types.
84   * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully.
85   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
86   * @systemapi
87   * @stagemodelonly
88   * @since 10
89   */
90  function createDataShareHelper(
91    context: Context,
92    uri: string,
93    options: DataShareHelperOptions,
94    callback: AsyncCallback<DataShareHelper>
95  ): void;
96
97  /**
98   * Obtains the dataShareHelper.
99   *
100   * @param { Context } context - Indicates the application context.
101   * @param { string } uri - Indicates the path of the file to open.
102   * @returns { Promise<DataShareHelper> } {DataShareHelper}: The dataShareHelper for consumer.
103   * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
104   *         2. Incorrect parameters types.
105   * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully.
106   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
107   * @systemapi
108   * @stagemodelonly
109   * @since 9
110   */
111  /**
112   * Obtains the dataShareHelper.
113   *
114   * @param { Context } context - Indicates the application context.
115   * @param { string } uri - Indicates the path of the file to open.
116   * @param { DataShareHelperOptions } options - Indicates the optional config.
117   * @returns { Promise<DataShareHelper> } {DataShareHelper}: The dataShareHelper for consumer.
118   * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
119   *         2. Incorrect parameters types.
120   * @throws { BusinessError } 15700010 - The DataShareHelper is not initialized successfully.
121   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
122   * @systemapi
123   * @stagemodelonly
124   * @since 10
125   */
126  function createDataShareHelper(
127    context: Context,
128    uri: string,
129    options?: DataShareHelperOptions
130  ): Promise<DataShareHelper>;
131
132  /**
133   * Enables silent access dynamically.
134   *
135   * @param { Context } context - Indicates the application context.
136   * @param { string } uri - Indicates the uri of the data share silent proxy resource.
137   * @returns { Promise<void> } The promise returned by the function.
138   * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
139   *         2. Incorrect parameters types.
140   * @throws { BusinessError } 15700011 - The URI is not exist.
141   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
142   * @systemapi
143   * @stagemodelonly
144   * @since 11
145   */
146  function enableSilentProxy(context: Context, uri?: string): Promise<void>;
147
148  /**
149   * Disables silent access dynamically.
150   *
151   * @param { Context } context - Indicates the application context.
152   * @param { string } uri - Indicates the uri of the data share silent proxy resource.
153   * @returns { Promise<void> } The promise returned by the function.
154   * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
155   *         2. Incorrect parameters types.
156   * @throws { BusinessError } 15700011 - The URI is not exist.
157   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
158   * @systemapi
159   * @stagemodelonly
160   * @since 11
161   */
162  function disableSilentProxy(context: Context, uri?: string): Promise<void>;
163
164  /**
165   * Specifies the {@link Template} id structure.
166   * A template is marked by the template id. Note that the template id is auto generated in {@link DataShareHelper#addTemplate}.
167   * After {@link DataShareHelper#addTemplate}, can use the template id to direct a template.
168   *
169   * @interface TemplateId
170   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
171   * @systemapi
172   * @stagemodelonly
173   * @since 10
174   */
175  interface TemplateId {
176    /**
177     * Specifies the id of subscriber, who process the callback
178     * Same as subscriberId in {@link DataShareHelper#addTemplate}
179     *
180     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
181     * @systemapi
182     * @stagemodelonly
183     * @since 10
184     */
185    subscriberId: string;
186    /**
187     * Specifies the bundleName of template owner, who create the template
188     * Same as the caller's bundleName of {@link DataShareHelper#addTemplate}
189     *
190     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
191     * @systemapi
192     * @stagemodelonly
193     * @since 10
194     */
195    bundleNameOfOwner: string;
196  }
197
198  /**
199   * Specifies the published item structure.
200   *
201   * @interface PublishedItem
202   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
203   * @systemapi
204   * @stagemodelonly
205   * @since 10
206   */
207  interface PublishedItem {
208    /**
209     * Specifies the key of the published data
210     *
211     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
212     * @systemapi
213     * @stagemodelonly
214     * @since 10
215     */
216    key: string;
217    /**
218     * Specifies the published data
219     * If the data is large, use ArrayBuffer.
220     *
221     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
222     * @systemapi
223     * @stagemodelonly
224     * @since 10
225     */
226    data: string | ArrayBuffer;
227    /**
228     * Specifies the subscriber id
229     *
230     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
231     * @systemapi
232     * @stagemodelonly
233     * @since 10
234     */
235    subscriberId: string;
236  }
237
238  /**
239   * Specifies the change node structure of rdb store data in callback.
240   *
241   * @interface RdbDataChangeNode
242   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
243   * @systemapi
244   * @stagemodelonly
245   * @since 10
246   */
247  interface RdbDataChangeNode {
248    /**
249     * Specifies the uri of the callback.
250     *
251     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
252     * @systemapi
253     * @stagemodelonly
254     * @since 10
255     */
256    uri: string;
257    /**
258     * Specifies the templateId of the callback.
259     *
260     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
261     * @systemapi
262     * @stagemodelonly
263     * @since 10
264     */
265    templateId: TemplateId;
266    /**
267     * Specifies the datas of the callback.
268     * every node is a json, json's key is [key of {@link Template#predicates}
269     * and value is the query result from rdb store query by value of{@link Template#predicates}].
270     *
271     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
272     * @systemapi
273     * @stagemodelonly
274     * @since 10
275     */
276    data: Array<string>;
277  }
278
279  /**
280   * Specifies the change node structure of published data in callback.
281   *
282   * @interface PublishedDataChangeNode
283   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
284   * @systemapi
285   * @stagemodelonly
286   * @since 10
287   */
288  interface PublishedDataChangeNode {
289    /**
290     * Specifies the bundleName of the callback.
291     *
292     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
293     * @systemapi
294     * @stagemodelonly
295     * @since 10
296     */
297    bundleName: string;
298    /**
299     * Specifies the datas of the callback.
300     *
301     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
302     * @systemapi
303     * @stagemodelonly
304     * @since 10
305     */
306    data: Array<PublishedItem>;
307  }
308
309  /**
310   * Specifies the template structure in subscribe.
311   *
312   * @interface Template
313   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
314   * @systemapi
315   * @stagemodelonly
316   * @since 10
317   */
318  interface Template {
319    /**
320     * Specifies the predicates of the template.
321     * When the callback in {@link DataShareHelper#on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}
322     * is called, the predicates is used to generate data in {@link ChangeNode}. Only for rdb store data.
323     *
324     * @type { [key: string]: string }
325     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
326     * @systemapi
327     * @stagemodelonly
328     * @since 10
329     */
330    /**
331     * Specifies the predicates of the template.
332     * When the callback in {@link DataShareHelper#on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}
333     * is called, the predicates is used to generate data in {@link ChangeNode}. Only for rdb store data.
334     *
335     * @type { Record<string, string> }
336     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
337     * @systemapi
338     * @stagemodelonly
339     * @since 11
340     */
341    predicates: Record<string, string>;
342
343    /**
344     * Specifies the scheduler sql of the template.
345     * When modify the subscribed uri's data, scheduler is auto called.
346     *
347     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
348     * @systemapi
349     * @stagemodelonly
350     * @since 10
351     */
352    scheduler: string;
353  }
354  /**
355   * Specifies the operation result structure.
356   *
357   * @interface OperationResult
358   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
359   * @systemapi
360   * @stagemodelonly
361   * @since 10
362   */
363  interface OperationResult {
364    /**
365     * Specifies the key of the operation result.
366     *
367     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
368     * @systemapi
369     * @stagemodelonly
370     * @since 10
371     */
372    key: string;
373
374    /**
375     * Specifies the operation result.
376     *
377     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
378     * @systemapi
379     * @stagemodelonly
380     * @since 10
381     */
382    result: number;
383  }
384
385  /**
386   * Struct for a batch update operation.
387   *
388   * @interface UpdateOperation
389   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
390   * @systemapi
391   * @stagemodelonly
392   * @since 12
393   */
394  interface UpdateOperation {
395    /**
396     * Indicates the data to update.
397     *
398     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
399     * @systemapi
400     * @stagemodelonly
401     * @since 12
402     */
403    values: ValuesBucket;
404
405    /**
406     * Indicates filter criteria.
407     *
408     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
409     * @systemapi
410     * @stagemodelonly
411     * @since 12
412     */
413    predicates: dataSharePredicates.DataSharePredicates;
414  }
415
416  /**
417  * Enumerates the data change types.
418  *
419  * @enum { number }
420  * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
421  * @systemapi
422  * @stagemodelonly
423  * @since 12
424  */
425  enum ChangeType {
426    /**
427     * Data inserted.
428     *
429     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
430     * @systemapi
431     * @stagemodelonly
432     * @since 12
433     */
434    INSERT = 0,
435
436    /**
437    * Data deleted.
438    *
439    * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
440    * @systemapi
441    * @stagemodelonly
442    * @since 12
443    */
444    DELETE,
445    /**
446    * Data updated.
447    *
448    * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
449    * @systemapi
450    * @stagemodelonly
451    * @since 12
452    */
453    UPDATE
454  }
455  /**
456   * Enumerates the subscription types.
457   *
458   * @enum { number }
459   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
460   * @systemapi
461   * @stagemodelonly
462   * @since 12
463   */
464  enum SubscriptionType {
465      /**
466       * Subscribe to the change of the data with the specified URI.
467       *
468       * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
469       * @systemapi
470       * @stagemodelonly
471       * @since 12
472       */
473      SUBSCRIPTION_TYPE_EXACT_URI = 0,
474  }
475
476  /**
477   * Struct for the data change.
478   *
479   * @interface ChangeInfo
480   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
481   * @systemapi
482   * @stagemodelonly
483   * @since 12
484   */
485  interface ChangeInfo {
486      /**
487       * Type of the data change.
488       *
489       * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
490       * @systemapi
491       * @stagemodelonly
492       * @since 12
493       */
494      type: ChangeType;
495
496      /**
497       * URI of the data changed.
498       *
499       * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
500       * @systemapi
501       * @stagemodelonly
502       * @since 12
503       */
504      uri: string;
505      /**
506        * Data changed.
507        *
508        * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
509        * @systemapi
510        * @stagemodelonly
511        * @since 12
512        */
513      values: Array<ValuesBucket>;
514  }
515
516  /**
517   * DataShareHelper
518   *
519   * @interface DataShareHelper
520   * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
521   * @systemapi
522   * @stagemodelonly
523   * @since 9
524   */
525  interface DataShareHelper {
526    /**
527     * Registers an observer to observe data specified by the given uri.
528     *
529     * @param { 'dataChange' } type - Type must be 'dataChange'.
530     * @param { string } uri - Indicates the path of the data to operate.
531     * @param { AsyncCallback<void> } callback - The callback of on.
532     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
533     * @systemapi
534     * @stagemodelonly
535     * @since 9
536     */
537    /**
538     * Registers an observer to observe data specified by the given uri.
539     *
540     * @param { 'dataChange' } type - Type must be 'dataChange'.
541     * @param { string } uri - Indicates the path of the data to operate.
542     * @param { AsyncCallback<void> } callback - The callback of on.
543     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
544     * @throws { BusinessError } 202 - Not System Application.
545     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
546     *         2. Incorrect parameters types.
547     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
548     * @systemapi
549     * @stagemodelonly
550     * @since 12
551     */
552    on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void;
553
554    /**
555     * Deregisters an observer used for monitoring data specified by the given uri.
556     *
557     * @param { 'dataChange' } type - Type must be 'dataChange'.
558     * @param { string } uri - Indicates the path of the data to operate.
559     * @param { AsyncCallback<void> } callback - The callback of off.
560     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
561     * @systemapi
562     * @stagemodelonly
563     * @since 9
564     */
565    /**
566     * Deregisters an observer used for monitoring data specified by the given uri.
567     *
568     * @param { 'dataChange' } type - Type must be 'dataChange'.
569     * @param { string } uri - Indicates the path of the data to operate.
570     * @param { AsyncCallback<void> } callback - The callback of off.
571     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
572     * @throws { BusinessError } 202 - Not System Application.
573     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
574     *         2. Incorrect parameters types.
575     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
576     * @systemapi
577     * @stagemodelonly
578     * @since 12
579     */
580    off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void;
581    /**
582     * Subscribes to the change of the data specified by the given URI.
583     *
584     * @param { 'dataChange' } type - Indicates the event type, which must be 'dataChange'.
585     * @param { SubscriptionType } type - Indicates the subscription type, which is defined in {@link SubscriptionType}.
586     * @param { string } uri - Indicates the path of the data to subscribe.
587     * @param { AsyncCallback<ChangeInfo> } callback - Indicates the callback used to return the data change.
588     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
589     * @throws { BusinessError } 202 - Not System Application.
590     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
591     *         2. Incorrect parameters types.
592     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
593     * @systemapi
594     * @stagemodelonly
595     * @since 12
596     */
597    on(event: 'dataChange', type:SubscriptionType, uri: string, callback: AsyncCallback<ChangeInfo>): void;
598
599    /**
600     * Unsubscribes from the change of the data specified by the given URI.
601     *
602     * @param { 'dataChange' } type - Indicates the event type, which must be 'dataChange'.
603     * @param { SubscriptionType } type - Indicates the subscription type, which is defined in {@link SubscriptionType}.
604     * @param { string } uri - Indicates the path of the data to unsubscribe.
605     * @param { AsyncCallback<ChangeInfo> } callback - Indicates the callback to unsubscribe.
606     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
607     *         2. Incorrect parameters types.
608     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
609     * @throws { BusinessError } 202 - Not System Application.
610     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
611     * @systemapi
612     * @stagemodelonly
613     * @since 12
614     */
615    off(event: 'dataChange', type:SubscriptionType, uri: string, callback?: AsyncCallback<ChangeInfo>): void;
616
617    /**
618     * Adds a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}.
619     *
620     * @param { string } uri - Indicates the uri to add.
621     * @param { string } subscriberId - The subscribe id to add..
622     * @param { Template } template - The template to add.
623     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
624     *         2. Incorrect parameters types.
625     * @throws { BusinessError } 15700011 - The URI is not exist.
626     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
627     * @systemapi
628     * @stagemodelonly
629     * @since 10
630     */
631    /**
632     * Adds a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}.
633     *
634     * @param { string } uri - Indicates the uri to add.
635     * @param { string } subscriberId - The subscribe id to add..
636     * @param { Template } template - The template to add.
637     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
638     *         2. Incorrect parameters types.
639     * @throws { BusinessError } 15700011 - The URI is not exist.
640     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
641     * @throws { BusinessError } 202 - Not System Application.
642     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
643     * @systemapi
644     * @stagemodelonly
645     * @since 12
646     */
647    addTemplate(uri: string, subscriberId: string, template: Template): void;
648
649    /**
650     * Deletes a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}.
651     *
652     * @param { string } uri - Indicates the uri to delete.
653     * @param { string } subscriberId - The subscribe id.
654     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
655     *         2. Incorrect parameters types.
656     * @throws { BusinessError } 15700011 - The URI is not exist.
657     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
658     * @systemapi
659     * @stagemodelonly
660     * @since 10
661     */
662    /**
663     * Deletes a template of {@link #on(string, Array<string>, TemplateId, AsyncCallback<ChangeNode>)}.
664     *
665     * @param { string } uri - Indicates the uri to delete.
666     * @param { string } subscriberId - The subscribe id.
667     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
668     *         2. Incorrect parameters types.
669     * @throws { BusinessError } 15700011 - The URI is not exist.
670     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
671     * @throws { BusinessError } 202 - Not System Application.
672     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
673     * @systemapi
674     * @stagemodelonly
675     * @since 12
676     */
677    delTemplate(uri: string, subscriberId: string): void;
678
679    /**
680     * Registers observers to observe rdb data specified by the given uri and template.
681     *
682     * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'.
683     * @param { Array<string> } uris - Indicates the paths of the data to operate.
684     * @param { TemplateId } templateId - The template of on.
685     * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of on.
686     * @returns { Array<OperationResult> } : The operation result.
687     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
688     *         2. Incorrect parameters types.
689     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
690     * @systemapi
691     * @stagemodelonly
692     * @since 10
693     */
694    /**
695     * Registers observers to observe rdb data specified by the given uri and template.
696     *
697     * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'.
698     * @param { Array<string> } uris - Indicates the paths of the data to operate.
699     * @param { TemplateId } templateId - The template of on.
700     * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of on.
701     * @returns { Array<OperationResult> } : The operation result.
702     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
703     *         2. Incorrect parameters types.
704     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
705     * @throws { BusinessError } 202 - Not System Application.
706     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
707     * @systemapi
708     * @stagemodelonly
709     * @since 12
710     */
711    on(
712      type: 'rdbDataChange',
713      uris: Array<string>,
714      templateId: TemplateId,
715      callback: AsyncCallback<RdbDataChangeNode>
716    ): Array<OperationResult>;
717
718    /**
719     * Deregisters observers used for monitoring data specified by the given uri and template.
720     *
721     * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'.
722     * @param { Array<string> } uris - Indicates the paths of the data to operate.
723     * @param { TemplateId } templateId - The template of off.
724     * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of off.
725     * @returns { Array<OperationResult> } : The operation result.
726     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
727     *         2. Incorrect parameters types.
728     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
729     * @systemapi
730     * @stagemodelonly
731     * @since 10
732     */
733    /**
734     * Deregisters observers used for monitoring data specified by the given uri and template.
735     *
736     * @param { 'rdbDataChange' } type - Type must be 'rdbDataChange'.
737     * @param { Array<string> } uris - Indicates the paths of the data to operate.
738     * @param { TemplateId } templateId - The template of off.
739     * @param { AsyncCallback<RdbDataChangeNode> } callback - The callback of off.
740     * @returns { Array<OperationResult> } : The operation result.
741     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
742     *         2. Incorrect parameters types.
743     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
744     * @throws { BusinessError } 202 - Not System Application.
745     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
746     * @systemapi
747     * @stagemodelonly
748     * @since 12
749     */
750    off(
751      type: 'rdbDataChange',
752      uris: Array<string>,
753      templateId: TemplateId,
754      callback?: AsyncCallback<RdbDataChangeNode>
755    ): Array<OperationResult>;
756
757    /**
758     * Registers observers to observe published data specified by the given key and subscriberId.
759     *
760     * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'.
761     * @param { Array<string> } uris - Indicates the uris of the data to operate.
762     * @param { string } subscriberId - The subscriberId of on.
763     * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of on.
764     * @returns { Array<OperationResult> } : The operation result.
765     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
766     *         2. Incorrect parameters types.
767     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
768     * @systemapi
769     * @stagemodelonly
770     * @since 10
771     */
772    /**
773     * Registers observers to observe published data specified by the given key and subscriberId.
774     *
775     * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'.
776     * @param { Array<string> } uris - Indicates the uris of the data to operate.
777     * @param { string } subscriberId - The subscriberId of on.
778     * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of on.
779     * @returns { Array<OperationResult> } : The operation result.
780     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
781     *         2. Incorrect parameters types.
782     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
783     * @throws { BusinessError } 202 - Not System Application.
784     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
785     * @systemapi
786     * @stagemodelonly
787     * @since 12
788     */
789    on(
790      type: 'publishedDataChange',
791      uris: Array<string>,
792      subscriberId: string,
793      callback: AsyncCallback<PublishedDataChangeNode>
794    ): Array<OperationResult>;
795
796    /**
797     * Deregisters observers used for monitoring data specified by the given key and subscriberId.
798     *
799     * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'.
800     * @param { Array<string> } uris - Indicates the uris of the data to operate.
801     * @param { string } subscriberId - The subscriberId of off.
802     * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of off.
803     * @returns { Array<OperationResult> } : The operation result.
804     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
805     *         2. Incorrect parameters types.
806     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
807     * @systemapi
808     * @stagemodelonly
809     * @since 10
810     */
811    /**
812     * Deregisters observers used for monitoring data specified by the given key and subscriberId.
813     *
814     * @param { 'publishedDataChange' } type - Type must be 'publishedDataChange'.
815     * @param { Array<string> } uris - Indicates the uris of the data to operate.
816     * @param { string } subscriberId - The subscriberId of off.
817     * @param { AsyncCallback<PublishedDataChangeNode> } callback - The callback of off.
818     * @returns { Array<OperationResult> } : The operation result.
819     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
820     *         2. Incorrect parameters types.
821     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
822     * @throws { BusinessError } 202 - Not System Application.
823     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
824     * @systemapi
825     * @stagemodelonly
826     * @since 12
827     */
828    off(
829      type: 'publishedDataChange',
830      uris: Array<string>,
831      subscriberId: string,
832      callback?: AsyncCallback<PublishedDataChangeNode>
833    ): Array<OperationResult>;
834
835    /**
836     * Update a single data into host data area.
837     *
838     * @param { Array<PublishedItem> } data - Indicates the data to publish.
839     * @param { string } bundleName - Indicates the bundleName of data to publish.
840     * @param { number } version - Indicates the version of data to publish, larger is newer.
841     * @param { AsyncCallback<Array<OperationResult>> } callback
842     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
843     *         2. Incorrect parameters types.
844     * @throws { BusinessError } 15700012 - The data area is not exist.
845     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
846     * @systemapi
847     * @stagemodelonly
848     * @since 10
849     */
850    /**
851     * Update a single data into host data area.
852     *
853     * @param { Array<PublishedItem> } data - Indicates the data to publish.
854     * @param { string } bundleName - Indicates the bundleName of data to publish.
855     * @param { number } version - Indicates the version of data to publish, larger is newer.
856     * @param { AsyncCallback<Array<OperationResult>> } callback
857     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
858     *         2. Incorrect parameters types.
859     * @throws { BusinessError } 15700012 - The data area is not exist.
860     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
861     * @throws { BusinessError } 202 - Not System Application.
862     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
863     * @systemapi
864     * @stagemodelonly
865     * @since 12
866     */
867    publish(
868      data: Array<PublishedItem>,
869      bundleName: string,
870      version: number,
871      callback: AsyncCallback<Array<OperationResult>>
872    ): void;
873
874    /**
875     * Update a single data into host data area.
876     *
877     * @param { Array<PublishedItem> } data - Indicates the data to publish.
878     * @param { string } bundleName - Indicates the bundleName of data to publish.
879     * @param { AsyncCallback<Array<OperationResult>> } callback
880     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
881     *         2. Incorrect parameters types.
882     * @throws { BusinessError } 15700012 - The data area is not exist.
883     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
884     * @systemapi
885     * @stagemodelonly
886     * @since 10
887     */
888    /**
889     * Update a single data into host data area.
890     *
891     * @param { Array<PublishedItem> } data - Indicates the data to publish.
892     * @param { string } bundleName - Indicates the bundleName of data to publish.
893     * @param { AsyncCallback<Array<OperationResult>> } callback
894     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
895     *         2. Incorrect parameters types.
896     * @throws { BusinessError } 15700012 - The data area is not exist.
897     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
898     * @throws { BusinessError } 202 - Not System Application.
899     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
900     * @systemapi
901     * @stagemodelonly
902     * @since 12
903     */
904    publish(
905      data: Array<PublishedItem>,
906      bundleName: string,
907      callback: AsyncCallback<Array<OperationResult>>
908    ): void;
909
910    /**
911     * Update a single data into host data area.
912     *
913     * @param { Array<PublishedItem> } data - Indicates the data to publish.
914     * @param { string } bundleName - Indicates the bundleName of data to publish.
915     * @param { number } version - Indicates the version of data to publish, larger is newer.
916     * @returns { Promise<Array<OperationResult>> }
917     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
918     *         2. Incorrect parameters types.
919     * @throws { BusinessError } 15700012 - The data area is not exist.
920     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
921     * @systemapi
922     * @stagemodelonly
923     * @since 10
924     */
925    /**
926     * Update a single data into host data area.
927     *
928     * @param { Array<PublishedItem> } data - Indicates the data to publish.
929     * @param { string } bundleName - Indicates the bundleName of data to publish.
930     * @param { number } version - Indicates the version of data to publish, larger is newer.
931     * @returns { Promise<Array<OperationResult>> }
932     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
933     *         2. Incorrect parameters types.
934     * @throws { BusinessError } 15700012 - The data area is not exist.
935     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
936     * @throws { BusinessError } 202 - Not System Application.
937     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
938     * @systemapi
939     * @stagemodelonly
940     * @since 12
941     */
942    publish(data: Array<PublishedItem>, bundleName: string, version?: number): Promise<Array<OperationResult>>;
943
944    /**
945     * Registers a one-time observer to observe data specified by the given uri and template.
946     *
947     * @param { string } bundleName - Indicates the bundleName of data to publish.
948     * @param { AsyncCallback<Array<PublishedItem>> } callback
949     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
950     *         2. Incorrect parameters types.
951     * @throws { BusinessError } 15700012 - The data area is not exist.
952     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
953     * @systemapi
954     * @stagemodelonly
955     * @since 10
956     */
957    /**
958     * Registers a one-time observer to observe data specified by the given uri and template.
959     *
960     * @param { string } bundleName - Indicates the bundleName of data to publish.
961     * @param { AsyncCallback<Array<PublishedItem>> } callback
962     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
963     *         2. Incorrect parameters types.
964     * @throws { BusinessError } 15700012 - The data area is not exist.
965     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
966     * @throws { BusinessError } 202 - Not System Application.
967     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
968     * @systemapi
969     * @stagemodelonly
970     * @since 12
971     */
972    getPublishedData(bundleName: string, callback: AsyncCallback<Array<PublishedItem>>): void;
973
974    /**
975     * Registers a one-time observer to observe data specified by the given uri and template.
976     *
977     * @param { string } bundleName - Indicates the bundleName of data to publish.
978     * @returns { Promise<Array<PublishedItem>> }
979     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
980     *         2. Incorrect parameters types.
981     * @throws { BusinessError } 15700012 - The data area is not exist.
982     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
983     * @systemapi
984     * @stagemodelonly
985     * @since 10
986     */
987    /**
988     * Registers a one-time observer to observe data specified by the given uri and template.
989     *
990     * @param { string } bundleName - Indicates the bundleName of data to publish.
991     * @returns { Promise<Array<PublishedItem>> }
992     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
993     *         2. Incorrect parameters types.
994     * @throws { BusinessError } 15700012 - The data area is not exist.
995     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
996     * @throws { BusinessError } 202 - Not System Application.
997     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
998     * @systemapi
999     * @stagemodelonly
1000     * @since 12
1001     */
1002    getPublishedData(bundleName: string): Promise<Array<PublishedItem>>;
1003
1004    /**
1005     * Inserts a single data record into the database.
1006     *
1007     * @param { string } uri - Indicates the path of the data to operate.
1008     * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null,
1009     * a blank row will be inserted.
1010     * @param { AsyncCallback<number> } callback - {number}: the index of the inserted data record.
1011     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1012     *         2. Incorrect parameters types.
1013     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1014     * @systemapi
1015     * @stagemodelonly
1016     * @since 9
1017     */
1018    /**
1019     * Inserts a single data record into the database.
1020     *
1021     * @param { string } uri - Indicates the path of the data to operate.
1022     * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null,
1023     * a blank row will be inserted.
1024     * @param { AsyncCallback<number> } callback - {number}: the index of the inserted data record.
1025     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1026     *         2. Incorrect parameters types.
1027     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1028     * @throws { BusinessError } 202 - Not System Application.
1029     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1030     * @systemapi
1031     * @stagemodelonly
1032     * @since 12
1033     */
1034    insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void;
1035
1036    /**
1037     * Inserts a single data record into the database.
1038     *
1039     * @param { string } uri - Indicates the path of the data to operate.
1040     * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null,
1041     * a blank row will be inserted.
1042     * @returns { Promise<number> } {number}: the index of the inserted data record.
1043     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1044     *         2. Incorrect parameters types.
1045     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1046     * @systemapi
1047     * @stagemodelonly
1048     * @since 9
1049     */
1050    /**
1051     * Inserts a single data record into the database.
1052     *
1053     * @param { string } uri - Indicates the path of the data to operate.
1054     * @param { ValuesBucket } value - Indicates the data record to insert. If this parameter is null,
1055     * a blank row will be inserted.
1056     * @returns { Promise<number> } {number}: the index of the inserted data record.
1057     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1058     *         2. Incorrect parameters types.
1059     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1060     * @throws { BusinessError } 202 - Not System Application.
1061     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1062     * @systemapi
1063     * @stagemodelonly
1064     * @since 12
1065     */
1066    insert(uri: string, value: ValuesBucket): Promise<number>;
1067
1068    /**
1069     * Deletes one or more data records from the database.
1070     *
1071     * @param { string } uri - Indicates the path of the data to operate.
1072     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1073     * You should define the processing logic when this parameter is null.
1074     * @param { AsyncCallback<number> } callback - {number}: the number of data records deleted.
1075     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1076     *         2. Incorrect parameters types.
1077     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1078     * @systemapi
1079     * @stagemodelonly
1080     * @since 9
1081     */
1082    /**
1083     * Deletes one or more data records from the database.
1084     *
1085     * @param { string } uri - Indicates the path of the data to operate.
1086     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1087     * You should define the processing logic when this parameter is null.
1088     * @param { AsyncCallback<number> } callback - {number}: the number of data records deleted.
1089     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1090     *         2. Incorrect parameters types.
1091     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1092     * @throws { BusinessError } 202 - Not System Application.
1093     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1094     * @systemapi
1095     * @stagemodelonly
1096     * @since 12
1097     */
1098    delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void;
1099
1100    /**
1101     * Deletes one or more data records from the database.
1102     *
1103     * @param { string } uri - Indicates the path of the data to operate.
1104     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1105     * You should define the processing logic when this parameter is null.
1106     * @returns { Promise<number> } {number}: the number of data records deleted.
1107     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1108     *         2. Incorrect parameters types.
1109     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1110     * @systemapi
1111     * @stagemodelonly
1112     * @since 9
1113     */
1114    /**
1115     * Deletes one or more data records from the database.
1116     *
1117     * @param { string } uri - Indicates the path of the data to operate.
1118     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1119     * You should define the processing logic when this parameter is null.
1120     * @returns { Promise<number> } {number}: the number of data records deleted.
1121     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1122     *         2. Incorrect parameters types.
1123     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1124     * @throws { BusinessError } 202 - Not System Application.
1125     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1126     * @systemapi
1127     * @stagemodelonly
1128     * @since 12
1129     */
1130    delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number>;
1131
1132    /**
1133     * Queries data in the database.
1134     *
1135     * @param { string } uri - Indicates the path of data to query.
1136     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1137     * You should define the processing logic when this parameter is null.
1138     * @param { Array<string> } columns - Indicates the columns to query.
1139     * If this parameter is null, all columns are queried.
1140     * @param { AsyncCallback<DataShareResultSet> } callback - {DataShareResultSet}: the query result.
1141     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1142     *         2. Incorrect parameters types.
1143     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1144     * @systemapi
1145     * @stagemodelonly
1146     * @since 9
1147     */
1148    /**
1149     * Queries data in the database.
1150     *
1151     * @param { string } uri - Indicates the path of data to query.
1152     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1153     * You should define the processing logic when this parameter is null.
1154     * @param { Array<string> } columns - Indicates the columns to query.
1155     * If this parameter is null, all columns are queried.
1156     * @param { AsyncCallback<DataShareResultSet> } callback - {DataShareResultSet}: the query result.
1157     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1158     *         2. Incorrect parameters types.
1159     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1160     * @throws { BusinessError } 202 - Not System Application.
1161     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1162     * @systemapi
1163     * @stagemodelonly
1164     * @since 12
1165     */
1166    query(
1167      uri: string,
1168      predicates: dataSharePredicates.DataSharePredicates,
1169      columns: Array<string>,
1170      callback: AsyncCallback<DataShareResultSet>
1171    ): void;
1172
1173    /**
1174     * Queries data in the database.
1175     *
1176     * @param { string } uri - Indicates the path of data to query.
1177     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1178     * You should define the processing logic when this parameter is null.
1179     * @param { Array<string> } columns - Indicates the columns to query.
1180     * If this parameter is null, all columns are queried.
1181     * @returns { Promise<DataShareResultSet> } {DataShareResultSet}: the query result.
1182     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1183     *         2. Incorrect parameters types.
1184     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1185     * @systemapi
1186     * @stagemodelonly
1187     * @since 9
1188     */
1189    /**
1190     * Queries data in the database.
1191     *
1192     * @param { string } uri - Indicates the path of data to query.
1193     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1194     * You should define the processing logic when this parameter is null.
1195     * @param { Array<string> } columns - Indicates the columns to query.
1196     * If this parameter is null, all columns are queried.
1197     * @returns { Promise<DataShareResultSet> } {DataShareResultSet}: the query result.
1198     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1199     *         2. Incorrect parameters types.
1200     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1201     * @throws { BusinessError } 202 - Not System Application.
1202     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1203     * @systemapi
1204     * @stagemodelonly
1205     * @since 12
1206     */
1207    query(
1208      uri: string,
1209      predicates: dataSharePredicates.DataSharePredicates,
1210      columns: Array<string>
1211    ): Promise<DataShareResultSet>;
1212
1213    /**
1214     * Updates data records in the database.
1215     *
1216     * @param { string } uri - Indicates the path of data to update.
1217     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1218     * You should define the processing logic when this parameter is null.
1219     * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null.
1220     * @param { AsyncCallback<number> } callback - {number}: the number of data records updated.
1221     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1222     *         2. Incorrect parameters types.
1223     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1224     * @systemapi
1225     * @stagemodelonly
1226     * @since 9
1227     */
1228    /**
1229     * Updates data records in the database.
1230     *
1231     * @param { string } uri - Indicates the path of data to update.
1232     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1233     * You should define the processing logic when this parameter is null.
1234     * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null.
1235     * @param { AsyncCallback<number> } callback - {number}: the number of data records updated.
1236     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1237     *         2. Incorrect parameters types.
1238     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1239     * @throws { BusinessError } 202 - Not System Application.
1240     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1241     * @systemapi
1242     * @stagemodelonly
1243     * @since 12
1244     */
1245    update(
1246      uri: string,
1247      predicates: dataSharePredicates.DataSharePredicates,
1248      value: ValuesBucket,
1249      callback: AsyncCallback<number>
1250    ): void;
1251
1252    /**
1253     * Updates data records in the database.
1254     *
1255     * @param { string } uri - Indicates the path of data to update.
1256     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1257     * You should define the processing logic when this parameter is null.
1258     * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null.
1259     * @returns { Promise<number> } {number}: the number of data records updated.
1260     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1261     *         2. Incorrect parameters types.
1262     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1263     * @systemapi
1264     * @stagemodelonly
1265     * @since 9
1266     */
1267    /**
1268     * Updates data records in the database.
1269     *
1270     * @param { string } uri - Indicates the path of data to update.
1271     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria.
1272     * You should define the processing logic when this parameter is null.
1273     * @param { ValuesBucket } value - Indicates the data to update. This parameter can be null.
1274     * @returns { Promise<number> } {number}: the number of data records updated.
1275     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1276     *         2. Incorrect parameters types.
1277     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1278     * @throws { BusinessError } 202 - Not System Application.
1279     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1280     * @systemapi
1281     * @stagemodelonly
1282     * @since 12
1283     */
1284    update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number>;
1285
1286    /**
1287     * Updates data records in the database.
1288     *
1289     * @param { Record<string, Array<UpdateOperation>> } operations - Indicates the data to update.
1290     * @returns {Promise<Record<string, Array<number>>>} {Record<string, Array<number>>}: The result set of batch operations.
1291     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1292     *         2. Incorrect parameters types.
1293     * @throws { BusinessError } 15700000 - Inner error.
1294     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1295     * @throws { BusinessError } 202 - Not System Application.
1296     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1297     * @systemapi
1298     * @stagemodelonly
1299     * @since 12
1300     */
1301    batchUpdate(operations: Record<string, Array<UpdateOperation>>): Promise<Record<string, Array<number>>>;
1302
1303    /**
1304     * Inserts multiple data records into the database.
1305     *
1306     * @param { string } uri - Indicates the path of the data to operate.
1307     * @param { Array<ValuesBucket> } values - Indicates the data records to insert.
1308     * @param { AsyncCallback<number> } callback - {number}: the number of data records inserted.
1309     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1310     *         2. Incorrect parameters types.
1311     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1312     * @systemapi
1313     * @stagemodelonly
1314     * @since 9
1315     */
1316    /**
1317     * Inserts multiple data records into the database.
1318     *
1319     * @param { string } uri - Indicates the path of the data to operate.
1320     * @param { Array<ValuesBucket> } values - Indicates the data records to insert.
1321     * @param { AsyncCallback<number> } callback - {number}: the number of data records inserted.
1322     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1323     *         2. Incorrect parameters types.
1324     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1325     * @throws { BusinessError } 202 - Not System Application.
1326     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1327     * @systemapi
1328     * @stagemodelonly
1329     * @since 12
1330     */
1331    batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void;
1332
1333    /**
1334     * Inserts multiple data records into the database.
1335     *
1336     * @param { string } uri - Indicates the path of the data to operate.
1337     * @param { Array<ValuesBucket> } values - Indicates the data records to insert.
1338     * @returns { Promise<number> } {number}: the number of data records inserted.
1339     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1340     *         2. Incorrect parameters types.
1341     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1342     * @systemapi
1343     * @stagemodelonly
1344     * @since 9
1345     */
1346    /**
1347     * Inserts multiple data records into the database.
1348     *
1349     * @param { string } uri - Indicates the path of the data to operate.
1350     * @param { Array<ValuesBucket> } values - Indicates the data records to insert.
1351     * @returns { Promise<number> } {number}: the number of data records inserted.
1352     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1353     *         2. Incorrect parameters types.
1354     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1355     * @throws { BusinessError } 202 - Not System Application.
1356     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1357     * @systemapi
1358     * @stagemodelonly
1359     * @since 12
1360     */
1361    batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number>;
1362
1363    /**
1364     * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}.
1365     * A normalized uri can be used across devices, persisted, backed up, and restored.
1366     * <p>To transfer a normalized uri from another environment to the current environment, you should call this
1367     * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)}
1368     * to convert it to a denormalized uri that can be used only in the current environment.
1369     *
1370     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize.
1371     * @param { AsyncCallback<string> } callback - {string}: the normalized Uri,
1372     * if the DataShare supports uri normalization.
1373     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1374     * @systemapi
1375     * @stagemodelonly
1376     * @since 9
1377     */
1378    /**
1379     * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}.
1380     * A normalized uri can be used across devices, persisted, backed up, and restored.
1381     * <p>To transfer a normalized uri from another environment to the current environment, you should call this
1382     * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)}
1383     * to convert it to a denormalized uri that can be used only in the current environment.
1384     *
1385     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize.
1386     * @param { AsyncCallback<string> } callback - {string}: the normalized Uri,
1387     * if the DataShare supports uri normalization.
1388     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1389     * @throws { BusinessError } 202 - Not System Application.
1390     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1391     *         2. Incorrect parameters types.
1392     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1393     * @systemapi
1394     * @stagemodelonly
1395     * @since 12
1396     */
1397    normalizeUri(uri: string, callback: AsyncCallback<string>): void;
1398
1399    /**
1400     * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}.
1401     * A normalized uri can be used across devices, persisted, backed up, and restored.
1402     * <p>To transfer a normalized uri from another environment to the current environment, you should call this
1403     * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)}
1404     * to convert it to a denormalized uri that can be used only in the current environment.
1405     *
1406     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize.
1407     * @returns { Promise<string> } {string}: the normalized Uri if the DataShare supports uri normalization;
1408     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1409     * @systemapi
1410     * @stagemodelonly
1411     * @since 9
1412     */
1413    /**
1414     * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}.
1415     * A normalized uri can be used across devices, persisted, backed up, and restored.
1416     * <p>To transfer a normalized uri from another environment to the current environment, you should call this
1417     * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)}
1418     * to convert it to a denormalized uri that can be used only in the current environment.
1419     *
1420     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to normalize.
1421     * @returns { Promise<string> } {string}: the normalized Uri if the DataShare supports uri normalization;
1422     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1423     * @throws { BusinessError } 202 - Not System Application.
1424     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1425     *         2. Incorrect parameters types.
1426     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1427     * @systemapi
1428     * @stagemodelonly
1429     * @since 12
1430     */
1431    normalizeUri(uri: string): Promise<string>;
1432
1433    /**
1434     * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one.
1435     *
1436     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize.
1437     * @param { AsyncCallback<string> } callback - {string}: the denormalized {@code Uri} object if
1438     * the denormalization is successful; returns the original {@code Uri} passed to this method if
1439     * there is nothing to do; returns {@code null} if the data identified by the normalized {@code Uri}
1440     * cannot be found in the current environment.
1441     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1442     * @systemapi
1443     * @stagemodelonly
1444     * @since 9
1445     */
1446    /**
1447     * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one.
1448     *
1449     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize.
1450     * @param { AsyncCallback<string> } callback - {string}: the denormalized {@code Uri} object if
1451     * the denormalization is successful; returns the original {@code Uri} passed to this method if
1452     * there is nothing to do; returns {@code null} if the data identified by the normalized {@code Uri}
1453     * cannot be found in the current environment.
1454     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1455     * @throws { BusinessError } 202 - Not System Application.
1456     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1457     *         2. Incorrect parameters types.
1458     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1459     * @systemapi
1460     * @stagemodelonly
1461     * @since 12
1462     */
1463    denormalizeUri(uri: string, callback: AsyncCallback<string>): void;
1464
1465    /**
1466     * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one.
1467     *
1468     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize.
1469     * @returns { Promise<string> } {string}: the denormalized {@code Uri} object if the denormalization
1470     * is successful; returns the original {@code Uri} passed to this method if there is nothing to do;
1471     * returns {@code null} if the data identified by the normalized {@code Uri} cannot be found in the
1472     * current environment.
1473     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1474     * @systemapi
1475     * @stagemodelonly
1476     * @since 9
1477     */
1478    /**
1479     * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one.
1480     *
1481     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize.
1482     * @returns { Promise<string> } {string}: the denormalized {@code Uri} object if the denormalization
1483     * is successful; returns the original {@code Uri} passed to this method if there is nothing to do;
1484     * returns {@code null} if the data identified by the normalized {@code Uri} cannot be found in the
1485     * current environment.
1486     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1487     * @throws { BusinessError } 202 - Not System Application.
1488     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1489     *         2. Incorrect parameters types.
1490     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1491     * @systemapi
1492     * @stagemodelonly
1493     * @since 12
1494     */
1495    denormalizeUri(uri: string): Promise<string>;
1496
1497    /**
1498     * Notifies the registered observers of a change to the data resource specified by Uri.
1499     *
1500     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange.
1501     * @param { AsyncCallback<void> } callback - The callback of notifyChange.
1502     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1503     * @systemapi
1504     * @stagemodelonly
1505     * @since 9
1506     */
1507    /**
1508     * Notifies the registered observers of a change to the data resource specified by Uri.
1509     *
1510     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange.
1511     * @param { AsyncCallback<void> } callback - The callback of notifyChange.
1512     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1513     * @throws { BusinessError } 202 - Not System Application.
1514     * @throws { BusinessError } 401 - Parameter error.Mandatory parameters are left unspecified.
1515     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1516     * @systemapi
1517     * @stagemodelonly
1518     * @since 12
1519     */
1520    notifyChange(uri: string, callback: AsyncCallback<void>): void;
1521
1522    /**
1523     * Notifies the registered observers of a change to the data resource specified by Uri.
1524     *
1525     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange.
1526     * @returns { Promise<void> } The promise returned by the function.
1527     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1528     * @systemapi
1529     * @stagemodelonly
1530     * @since 9
1531     */
1532    /**
1533     * Notifies the registered observers of a change to the data resource specified by Uri.
1534     *
1535     * @param { string } uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange.
1536     * @returns { Promise<void> } The promise returned by the function.
1537     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1538     * @throws { BusinessError } 202 - Not System Application.
1539     * @throws { BusinessError } 401 - Parameter error.Mandatory parameters are left unspecified.
1540     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1541     * @systemapi
1542     * @stagemodelonly
1543     * @since 12
1544     */
1545    notifyChange(uri: string): Promise<void>;
1546
1547    /**
1548     * Notifies the registered observers of the data change.
1549     *
1550     * @param { ChangeInfo } data - Indicates the data change information.
1551     * @returns { Promise<void> } Promise that returns no value.
1552     * @throws { BusinessError } 15700013 - The DataShareHelper instance is already closed.
1553     * @throws { BusinessError } 202 - Not System Application.
1554     * @throws { BusinessError } 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified;
1555     *         2. Incorrect parameters types.
1556     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1557     * @systemapi
1558     * @stagemodelonly
1559     * @since 12
1560     */
1561    notifyChange(data: ChangeInfo): Promise<void>;
1562
1563    /**
1564     * Close the connection between datashare and extension.
1565     *
1566     * @returns { Promise<void> } The promise returned by the function.
1567     * @throws { BusinessError } 15700000 - Inner error.
1568     * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
1569     * @systemapi
1570     * @stagemodelonly
1571     * @since 12
1572     */
1573    close(): Promise<void>;
1574  }
1575}
1576
1577export default dataShare;
1578