• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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 { AsyncCallback } from './@ohos.base';
22import image from "./@ohos.multimedia.image";
23import Want from "./@ohos.app.ability.Want";
24
25/**
26 * Provide methods for sharing data between different applications across unified data channels.
27 *
28 * @namespace unifiedDataChannel
29 * @syscap SystemCapability.DistributedDataManager.UDMF.Core
30 * @since 10
31 */
32/**
33 * Provide methods for sharing data between different applications across unified data channels.
34 *
35 * @namespace unifiedDataChannel
36 * @syscap SystemCapability.DistributedDataManager.UDMF.Core
37 * @atomicservice
38 * @since 11
39 */
40declare namespace unifiedDataChannel {
41  /**
42   * Types of scope that UnifiedData can be used.
43   * @enum { number }
44   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
45   * @atomicservice
46   * @since 12
47   */
48  enum ShareOptions {
49    /**
50     * IN_APP indicates that only use in the same app is allowed.
51     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
52     * @atomicservice
53     * @since 12
54     */
55    IN_APP,
56    /**
57     * CROSS_APP indicates that use in any app in this device is allowed.
58     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
59     * @atomicservice
60     * @since 12
61     */
62    CROSS_APP
63  }
64
65  /**
66   * Indicated delay get UnifiedData
67   *
68   * @typedef {function} GetDelayData
69   * @param { string } type - the type of UnifiedData required.
70   * @returns { UnifiedData } Return the UnifiedData required.
71   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
72   * @atomicservice
73   * @since 12
74   */
75  type GetDelayData = (type: string) => UnifiedData;
76
77  /**
78   * Indicates type of value.
79   * @typedef {number | string | image.PixelMap | Want | ArrayBuffer}
80   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
81   * @atomicservice
82   * @since 12
83   */
84  type ValueType = number | string | image.PixelMap | Want | ArrayBuffer;
85
86  /**
87   * Describe the unified data properties.
88   *
89   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
90   * @atomicservice
91   * @since 12
92   */
93  class UnifiedDataProperties {
94    /**
95     * extra property data. key-value pairs.
96     * @type { ?Record<string, object> }
97     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
98     * @atomicservice
99     * @since 12
100     */
101    extras?: Record<string, object>;
102
103    /**
104     * the user-defined tag of a UnifiedData object.
105     * @type { ?string }
106     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
107     * @atomicservice
108     * @since 12
109     */
110    tag?: string;
111    /**
112     * a timestamp, which indicates when data is written.
113     * @type { ?Date }
114     * @readonly
115     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
116     * @atomicservice
117     * @since 12
118     */
119    readonly timestamp?: Date;
120    /**
121     * Indicates the scope of clipboard data which can be used.
122     * If it is not set or is incorrectly set, The default value is CrossDevice.
123     * @type { ?ShareOptions }
124     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
125     * @atomicservice
126     * @since 12
127     */
128    shareOptions?: ShareOptions;
129
130    /**
131     * Indicated delay get UnifiedData.
132     * @type { ?GetDelayData }
133     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
134     * @atomicservice
135     * @since 12
136     */
137    getDelayData?: GetDelayData;
138  }
139
140  /**
141   * Describe the unified data.
142   *
143   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
144   * @since 10
145   */
146  /**
147   * Describe the unified data.
148   *
149   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
150   * @atomicservice
151   * @since 11
152   */
153  class UnifiedData {
154    /**
155     * Create unified data with a record
156     *
157     * @param { UnifiedRecord } record - Record will add into unified data.
158     * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
159     * <br>2.Incorrect Parameters types.
160     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
161     * @since 10
162     */
163    /**
164     * Create unified data with a record
165     *
166     * @param { UnifiedRecord } record - Record will add into unified data.
167     * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
168     * <br>2.Incorrect Parameters types.
169     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
170     * @atomicservice
171     * @since 11
172     */
173    constructor(record: UnifiedRecord);
174    /**
175     * Create a empty unified data.
176     *
177     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
178     * @atomicservice
179     * @since 12
180     */
181    constructor();
182    /**
183     * Add a record into unified data
184     *
185     * @param { UnifiedRecord } record - Record will add into unified data.
186     * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
187     * <br>2.Incorrect Parameters types.
188     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
189     * @since 10
190     */
191    /**
192     * Add a record into unified data
193     *
194     * @param { UnifiedRecord } record - Record will add into unified data.
195     * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
196     * <br>2.Incorrect Parameters types.
197     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
198     * @atomicservice
199     * @since 11
200     */
201    addRecord(record: UnifiedRecord): void;
202    /**
203     * Get all records of unified data
204     *
205     * @returns { Array<UnifiedRecord> } Return the records of unified data
206     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
207     * @since 10
208     */
209    /**
210     * Get all records of unified data
211     *
212     * @returns { Array<UnifiedRecord> } Return the records of unified data
213     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
214     * @atomicservice
215     * @since 11
216     */
217    getRecords(): Array<UnifiedRecord>;
218
219    /**
220     * Checks whether there is a specified type of data in DataProperties.
221     * @param { string } type - indicates to query data type.
222     * @returns { boolean } if having mimeType in UnifiedData returns true, else returns false.
223     * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
224     * <br>2.Incorrect Parameters types.
225     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
226     * @atomicservice
227     * @since 12
228     */
229    hasType(type: string): boolean;
230
231    /**
232     * UTD types of all content in the UnifiedData.
233     * @returns { Array<string> } type of array
234     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
235     * @atomicservice
236     * @since 12
237     */
238    getTypes(): Array<string>;
239
240    /**
241     * UnifiedData properties.
242     * @type { UnifiedDataProperties }
243     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
244     * @atomicservice
245     * @since 12
246     */
247    properties: UnifiedDataProperties;
248  }
249
250  /**
251   * The data abstract supported by unified data
252   *
253   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
254   * @since 10
255   */
256  /**
257   * The data abstract supported by unified data
258   *
259   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
260   * @atomicservice
261   * @since 11
262   */
263  class Summary {
264    /**
265     * A map for each type and data size, key is data type, value is the corresponding data size
266     *
267     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
268     * @since 10
269     */
270    /**
271     * A map for each type and data size, key is data type, value is the corresponding data size
272     *
273     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
274     * @atomicservice
275     * @since 11
276     */
277    summary: Record<string, number>;
278    /**
279     * Total data size of data in Bytes
280     *
281     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
282     * @since 10
283     */
284    /**
285     * Total data size of data in Bytes
286     *
287     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
288     * @atomicservice
289     * @since 11
290     */
291    totalSize: number;
292  }
293
294  /**
295   * Describe the unified record
296   *
297   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
298   * @since 10
299   */
300  /**
301   * Describe the unified record
302   *
303   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
304   * @atomicservice
305   * @since 11
306   */
307  class UnifiedRecord {
308    /**
309     * Get type of unified record
310     *
311     * @returns { string } Return the type of unified data
312     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
313     * @since 10
314     */
315    /**
316     * Get type of unified record
317     *
318     * @returns { string } Return the type of unified data
319     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
320     * @atomicservice
321     * @since 11
322     */
323    getType(): string;
324
325    /**
326     * Create unified record.
327     *
328     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
329     * @atomicservice
330     * @since 12
331     */
332    constructor();
333
334    /**
335     * Create unified record by type and value.
336     *
337     * @param { string } type - indicates to data type of unified record. It can not be empty. When type of value is object, parameter type must be pixel-map or want UTD type.
338     * @param { ValueType } value - indicates to value of unified record.
339     * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
340     * <br>2.Incorrect Parameters types;
341     * <br>3.Parameter verification failed.
342     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
343     * @atomicservice
344     * @since 12
345     */
346    constructor(type: string, value: ValueType);
347
348    /**
349     * Get the value of unified record.
350     *
351     * @returns { ValueType } Return the value of unified record.
352     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
353     * @atomicservice
354     * @since 12
355     */
356    getValue(): ValueType;
357  }
358
359  /**
360   * Describe the unified text data
361   *
362   * @extends UnifiedRecord
363   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
364   * @since 10
365   */
366  /**
367   * Describe the unified text data
368   *
369   * @extends UnifiedRecord
370   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
371   * @atomicservice
372   * @since 11
373   */
374  class Text extends UnifiedRecord {
375    /**
376     * Indicates the details of unified text
377     *
378     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
379     * @since 10
380     */
381    /**
382     * Indicates the details of unified text
383     *
384     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
385     * @atomicservice
386     * @since 11
387     */
388    details?: Record<string, string>;
389  }
390
391  /**
392   * Describe the unified plain text data
393   *
394   * @extends Text
395   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
396   * @since 10
397   */
398  /**
399   * Describe the unified plain text data
400   *
401   * @extends Text
402   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
403   * @atomicservice
404   * @since 11
405   */
406  class PlainText extends Text {
407    /**
408     * Indicates the content of text
409     *
410     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
411     * @since 10
412     */
413    /**
414     * Indicates the content of text
415     *
416     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
417     * @atomicservice
418     * @since 11
419     */
420    textContent: string;
421    /**
422     * Indicates the abstract of text
423     *
424     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
425     * @since 10
426     */
427    /**
428     * Indicates the abstract of text
429     *
430     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
431     * @atomicservice
432     * @since 11
433     */
434    abstract?: string;
435  }
436
437  /**
438   * Describe the unified link data
439   *
440   * @extends Text
441   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
442   * @since 10
443   */
444  /**
445   * Describe the unified link data
446   *
447   * @extends Text
448   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
449   * @atomicservice
450   * @since 11
451   */
452  class Hyperlink extends Text {
453    /**
454     * Indicates the url of a link
455     *
456     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
457     * @since 10
458     */
459    /**
460     * Indicates the url of a link
461     *
462     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
463     * @atomicservice
464     * @since 11
465     */
466    url: string;
467    /**
468     * Indicates the description of a link
469     *
470     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
471     * @since 10
472     */
473    /**
474     * Indicates the description of a link
475     *
476     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
477     * @atomicservice
478     * @since 11
479     */
480    description?: string;
481  }
482
483  /**
484   * Describe the unified html data
485   *
486   * @extends Text
487   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
488   * @since 10
489   */
490  /**
491   * Describe the unified html data
492   *
493   * @extends Text
494   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
495   * @atomicservice
496   * @since 11
497   */
498  class HTML extends Text {
499    /**
500     * Indicates the content of html, with html tags
501     *
502     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
503     * @since 10
504     */
505    /**
506     * Indicates the content of html, with html tags
507     *
508     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
509     * @atomicservice
510     * @since 11
511     */
512    htmlContent: string;
513    /**
514     * Indicates the plain content of html
515     *
516     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
517     * @since 10
518     */
519    /**
520     * Indicates the plain content of html
521     *
522     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
523     * @atomicservice
524     * @since 11
525     */
526    plainContent?: string;
527  }
528
529  /**
530   * Describe the unified file data
531   *
532   * @extends UnifiedRecord
533   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
534   * @since 10
535   */
536  /**
537   * Describe the unified file data
538   *
539   * @extends UnifiedRecord
540   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
541   * @atomicservice
542   * @since 11
543   */
544  class File extends UnifiedRecord {
545    /**
546     * Indicates the details of unified File
547     *
548     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
549     * @since 10
550     */
551    /**
552     * Indicates the details of unified File
553     *
554     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
555     * @atomicservice
556     * @since 11
557     */
558    details?: Record<string, string>;
559    /**
560     * Indicates the uri of file
561     *
562     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
563     * @since 10
564     */
565    /**
566     * Indicates the uri of file
567     *
568     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
569     * @atomicservice
570     * @since 11
571     */
572    uri: string;
573  }
574
575  /**
576   * Describe the unified image data
577   *
578   * @extends File
579   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
580   * @since 10
581   */
582  /**
583   * Describe the unified image data
584   *
585   * @extends File
586   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
587   * @atomicservice
588   * @since 11
589   */
590  class Image extends File {
591    /**
592     * Indicates the uri of image
593     *
594     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
595     * @since 10
596     */
597    /**
598     * Indicates the uri of image
599     *
600     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
601     * @atomicservice
602     * @since 11
603     */
604    imageUri: string;
605  }
606
607  /**
608   * Describe the unified video data
609   *
610   * @extends File
611   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
612   * @since 10
613   */
614  /**
615   * Describe the unified video data
616   *
617   * @extends File
618   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
619   * @atomicservice
620   * @since 11
621   */
622  class Video extends File {
623    /**
624     * Indicates the uri of video
625     *
626     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
627     * @since 10
628     */
629    /**
630     * Indicates the uri of video
631     *
632     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
633     * @atomicservice
634     * @since 11
635     */
636    videoUri: string;
637  }
638
639  /**
640   * Describe the unified audio data
641   *
642   * @extends File
643   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
644   * @since 10
645   */
646  /**
647   * Describe the unified audio data
648   *
649   * @extends File
650   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
651   * @atomicservice
652   * @since 11
653   */
654  class Audio extends File {
655    /**
656     * Indicates the uri of audio
657     *
658     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
659     * @since 10
660     */
661    /**
662     * Indicates the uri of audio
663     *
664     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
665     * @atomicservice
666     * @since 11
667     */
668    audioUri: string;
669  }
670
671  /**
672   * Describe the unified folder data
673   *
674   * @extends File
675   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
676   * @since 10
677   */
678  /**
679   * Describe the unified folder data
680   *
681   * @extends File
682   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
683   * @atomicservice
684   * @since 11
685   */
686  class Folder extends File {
687    /**
688     * Indicates the uri of folder
689     *
690     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
691     * @since 10
692     */
693    /**
694     * Indicates the uri of folder
695     *
696     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
697     * @atomicservice
698     * @since 11
699     */
700    folderUri: string;
701  }
702
703  /**
704   * Describe system defined type data(this kind of data is provided and bound to OpenHarmony,
705   * also can be parsed by system provided API)
706   *
707   * @extends UnifiedRecord
708   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
709   * @since 10
710   */
711  /**
712   * Describe system defined type data(this kind of data is provided and bound to OpenHarmony,
713   * also can be parsed by system provided API)
714   *
715   * @extends UnifiedRecord
716   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
717   * @atomicservice
718   * @since 11
719   */
720  class SystemDefinedRecord extends UnifiedRecord {
721    /**
722     * Indicates the details of system defined data
723     *
724     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
725     * @since 10
726     */
727    /**
728     * Indicates the details of system defined data
729     *
730     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
731     * @atomicservice
732     * @since 11
733     */
734    details?: Record<string, number | string | Uint8Array>;
735  }
736
737  /**
738   * Describe system defined form data(this kind of data is provided and bound to OpenHarmony,
739   * also can be parsed by system provided API)
740   *
741   * @extends SystemDefinedRecord
742   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
743   * @since 10
744   */
745  /**
746   * Describe system defined form data(this kind of data is provided and bound to OpenHarmony,
747   * also can be parsed by system provided API)
748   *
749   * @extends SystemDefinedRecord
750   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
751   * @atomicservice
752   * @since 11
753   */
754  class SystemDefinedForm extends SystemDefinedRecord {
755    /**
756     * Indicates the id of form
757     *
758     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
759     * @since 10
760     */
761    /**
762     * Indicates the id of form
763     *
764     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
765     * @atomicservice
766     * @since 11
767     */
768    formId: number;
769    /**
770     * Indicates the name of form
771     *
772     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
773     * @since 10
774     */
775    /**
776     * Indicates the name of form
777     *
778     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
779     * @atomicservice
780     * @since 11
781     */
782    formName: string;
783    /**
784     * Indicates the bundle name of form
785     *
786     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
787     * @since 10
788     */
789    /**
790     * Indicates the bundle name of form
791     *
792     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
793     * @atomicservice
794     * @since 11
795     */
796    bundleName: string;
797    /**
798     * Indicates the ability name of form
799     *
800     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
801     * @since 10
802     */
803    /**
804     * Indicates the ability name of form
805     *
806     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
807     * @atomicservice
808     * @since 11
809     */
810    abilityName: string;
811    /**
812     * Indicates the module of form
813     *
814     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
815     * @since 10
816     */
817    /**
818     * Indicates the module of form
819     *
820     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
821     * @atomicservice
822     * @since 11
823     */
824    module: string;
825  }
826
827  /**
828   * Describe system defined app item data(this kind of data is provided and bound to OpenHarmony,
829   * also can be parsed by system provided API)
830   *
831   * @extends SystemDefinedRecord
832   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
833   * @since 10
834   */
835  /**
836   * Describe system defined app item data(this kind of data is provided and bound to OpenHarmony,
837   * also can be parsed by system provided API)
838   *
839   * @extends SystemDefinedRecord
840   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
841   * @atomicservice
842   * @since 11
843   */
844  class SystemDefinedAppItem extends SystemDefinedRecord {
845    /**
846     * Indicates the app id
847     *
848     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
849     * @since 10
850     */
851    /**
852     * Indicates the app id
853     *
854     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
855     * @atomicservice
856     * @since 11
857     */
858    appId: string;
859    /**
860     * Indicates the app name
861     *
862     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
863     * @since 10
864     */
865    /**
866     * Indicates the app name
867     *
868     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
869     * @atomicservice
870     * @since 11
871     */
872    appName: string;
873    /**
874     * Indicates the id of app icon
875     *
876     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
877     * @since 10
878     */
879    /**
880     * Indicates the id of app icon
881     *
882     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
883     * @atomicservice
884     * @since 11
885     */
886    appIconId: string;
887    /**
888     * Indicates the id of app label
889     *
890     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
891     * @since 10
892     */
893    /**
894     * Indicates the id of app label
895     *
896     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
897     * @atomicservice
898     * @since 11
899     */
900    appLabelId: string;
901    /**
902     * Indicates the bundle name of app
903     *
904     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
905     * @since 10
906     */
907    /**
908     * Indicates the bundle name of app
909     *
910     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
911     * @atomicservice
912     * @since 11
913     */
914    bundleName: string;
915    /**
916     * Indicates the ability name of app
917     *
918     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
919     * @since 10
920     */
921    /**
922     * Indicates the ability name of app
923     *
924     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
925     * @atomicservice
926     * @since 11
927     */
928    abilityName: string;
929  }
930
931  /**
932   * Describe system defined pixel map data(this kind of data is provided and bound to OpenHarmony,
933   * also can be parsed by system provided API)
934   *
935   * @extends SystemDefinedRecord
936   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
937   * @since 10
938   */
939  /**
940   * Describe system defined pixel map data(this kind of data is provided and bound to OpenHarmony,
941   * also can be parsed by system provided API)
942   *
943   * @extends SystemDefinedRecord
944   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
945   * @atomicservice
946   * @since 11
947   */
948  class SystemDefinedPixelMap extends SystemDefinedRecord {
949    /**
950     * Indicates the raw data of pixel map
951     *
952     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
953     * @since 10
954     */
955    /**
956     * Indicates the raw data of pixel map
957     *
958     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
959     * @atomicservice
960     * @since 11
961     */
962    rawData: Uint8Array;
963  }
964
965  /**
966   * Describe application defined data(this kind of data is provided and bound to OpenHarmony,
967   * also can be parsed by system provided API)
968   *
969   * @extends UnifiedRecord
970   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
971   * @since 10
972   */
973  /**
974   * Describe application defined data(this kind of data is provided and bound to OpenHarmony,
975   * also can be parsed by system provided API)
976   *
977   * @extends UnifiedRecord
978   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
979   * @atomicservice
980   * @since 11
981   */
982  class ApplicationDefinedRecord extends UnifiedRecord {
983    /**
984     * Indicates the type of data, should always be started with 'ApplicationDefined.', will
985     * return error otherwise
986     *
987     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
988     * @since 10
989     */
990    /**
991     * Indicates the type of data, should always be started with 'ApplicationDefined.', will
992     * return error otherwise
993     *
994     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
995     * @atomicservice
996     * @since 11
997     */
998    applicationDefinedType: string;
999    /**
1000     * Indicates the raw data of application defined data
1001     *
1002     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1003     * @since 10
1004     */
1005    /**
1006     * Indicates the raw data of application defined data
1007     *
1008     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1009     * @atomicservice
1010     * @since 11
1011     */
1012    rawData: Uint8Array;
1013  }
1014
1015  /**
1016   * Describe the sharing channel that UDMF support
1017   *
1018   * @enum { string }
1019   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1020   * @since 10
1021   */
1022  /**
1023   * Describe the sharing channel that UDMF support
1024   *
1025   * @enum { string }
1026   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1027   * @atomicservice
1028   * @since 11
1029   */
1030  enum Intention {
1031    /**
1032     * Indicates the intention of data hub
1033     *
1034     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1035     * @since 10
1036     */
1037    /**
1038     * Indicates the intention of data hub
1039     *
1040     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1041     * @atomicservice
1042     * @since 11
1043     */
1044    DATA_HUB = 'DataHub',
1045
1046    /**
1047     * Indicates the intention of drag
1048     *
1049     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1050     * @systemapi
1051     * @stagemodelonly
1052     * @since 12
1053     */
1054     DRAG = 'Drag'
1055  }
1056
1057  /**
1058   * Describe the optional arguments of data operation
1059   *
1060   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1061   * @since 10
1062   */
1063  /**
1064   * Describe the optional arguments of data operation
1065   *
1066   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1067   * @atomicservice
1068   * @since 11
1069   */
1070  type Options = {
1071    /**
1072     * Indicates the target Intention
1073     *
1074     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1075     * @since 10
1076     */
1077    /**
1078     * Indicates the target Intention
1079     *
1080     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1081     * @atomicservice
1082     * @since 11
1083     */
1084    intention?: Intention;
1085
1086    /**
1087     * Indicates the unique identifier of target UnifiedData
1088     *
1089     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1090     * @since 10
1091     */
1092    /**
1093     * Indicates the unique identifier of target UnifiedData
1094     *
1095     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1096     * @atomicservice
1097     * @since 11
1098     */
1099    key?: string;
1100  };
1101
1102  /**
1103   * Insert data into unified data channel by Intention
1104   *
1105   * @param { Options } options - fill the intention field to indicate the target {@link Intention}.
1106   * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention.
1107   * @param { AsyncCallback<string> } callback - {string}: the unique identifier.
1108   * @throws { BusinessError } 201 - Permission denied.
1109   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1110   * <br>2.Incorrect Parameters types.
1111   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1112   * @since 10
1113   */
1114  /**
1115   * Insert data into unified data channel by Intention
1116   *
1117   * @param { Options } options - fill the intention field to indicate the target {@link Intention}.
1118   * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention.
1119   * @param { AsyncCallback<string> } callback - {string}: the unique identifier.
1120   * @throws { BusinessError } 201 - Permission denied.
1121   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1122   * <br>2.Incorrect Parameters types.
1123   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1124   * @atomicservice
1125   * @since 11
1126   */
1127  function insertData(options: Options, data: UnifiedData, callback: AsyncCallback<string>): void;
1128
1129  /**
1130   * Insert data into unified data channel by Intention
1131   *
1132   * @param { Options } options - fill the intention field to indicate the target {@link Intention}.
1133   * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention.
1134   * @returns { Promise<string> } {string}: the unique identifier.
1135   * @throws { BusinessError } 201 - Permission denied.
1136   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1137   * <br>2.Incorrect Parameters types.
1138   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1139   * @since 10
1140   */
1141  /**
1142   * Insert data into unified data channel by Intention
1143   *
1144   * @param { Options } options - fill the intention field to indicate the target {@link Intention}.
1145   * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention.
1146   * @returns { Promise<string> } {string}: the unique identifier.
1147   * @throws { BusinessError } 201 - Permission denied.
1148   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1149   * <br>2.Incorrect Parameters types.
1150   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1151   * @atomicservice
1152   * @since 11
1153   */
1154  function insertData(options: Options, data: UnifiedData): Promise<string>;
1155
1156  /**
1157   * Update data to unified data channel by Unique Identifier
1158   *
1159   * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}.
1160   * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data.
1161   * @param { AsyncCallback<void> } callback - the callback of updateData.
1162   * @throws { BusinessError } 201 - Permission denied.
1163   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1164   * <br>2.Incorrect Parameters types.
1165   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1166   * @since 10
1167   */
1168  /**
1169   * Update data to unified data channel by Unique Identifier
1170   *
1171   * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}.
1172   * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data.
1173   * @param { AsyncCallback<void> } callback - the callback of updateData.
1174   * @throws { BusinessError } 201 - Permission denied.
1175   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1176   * <br>2.Incorrect Parameters types.
1177   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1178   * @atomicservice
1179   * @since 11
1180   */
1181  function updateData(options: Options, data: UnifiedData, callback: AsyncCallback<void>): void;
1182
1183  /**
1184   * Update data to unified data channel by Unique Identifier
1185   *
1186   * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}.
1187   * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data.
1188   * @returns { Promise<void> } the promise returned by the function.
1189   * @throws { BusinessError } 201 - Permission denied.
1190   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1191   * <br>2.Incorrect Parameters types.
1192   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1193   * @since 10
1194   */
1195  /**
1196   * Update data to unified data channel by Unique Identifier
1197   *
1198   * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}.
1199   * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data.
1200   * @returns { Promise<void> } the promise returned by the function.
1201   * @throws { BusinessError } 201 - Permission denied.
1202   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1203   * <br>2.Incorrect Parameters types.
1204   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1205   * @atomicservice
1206   * @since 11
1207   */
1208  function updateData(options: Options, data: UnifiedData): Promise<void>;
1209
1210  /**
1211   * Query data of unified data channel by Intention or Unique Identifier
1212   *
1213   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1214   * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the target {@link UnifiedData} object array.
1215   * @throws { BusinessError } 201 - Permission denied.
1216   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1217   * <br>2.Incorrect Parameters types.
1218   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1219   * @since 10
1220   */
1221  /**
1222   * Query data of unified data channel by Intention or Unique Identifier
1223   *
1224   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1225   * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the target {@link UnifiedData} object array.
1226   * @throws { BusinessError } 201 - Permission denied.
1227   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1228   * <br>2.Incorrect Parameters types.
1229   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1230   * @atomicservice
1231   * @since 11
1232   */
1233  function queryData(options: Options, callback: AsyncCallback<Array<UnifiedData>>): void;
1234
1235  /**
1236   * Query data of unified data channel by Intention or Unique Identifier
1237   *
1238   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1239   * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the target {@link UnifiedData} object array.
1240   * @throws { BusinessError } 201 - Permission denied.
1241   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1242   * <br>2.Incorrect Parameters types.
1243   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1244   * @since 10
1245   */
1246  /**
1247   * Query data of unified data channel by Intention or Unique Identifier
1248   *
1249   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1250   * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the target {@link UnifiedData} object array.
1251   * @throws { BusinessError } 201 - Permission denied.
1252   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1253   * <br>2.Incorrect Parameters types.
1254   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1255   * @atomicservice
1256   * @since 11
1257   */
1258  function queryData(options: Options): Promise<Array<UnifiedData>>;
1259
1260  /**
1261   * Delete data of unified data channel by Intention or Unique Identifier
1262   *
1263   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1264   * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the deleted {@link UnifiedData} object array.
1265   * @throws { BusinessError } 201 - Permission denied.
1266   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1267   * <br>2.Incorrect Parameters types.
1268   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1269   * @since 10
1270   */
1271  /**
1272   * Delete data of unified data channel by Intention or Unique Identifier
1273   *
1274   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1275   * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the deleted {@link UnifiedData} object array.
1276   * @throws { BusinessError } 201 - Permission denied.
1277   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1278   * <br>2.Incorrect Parameters types.
1279   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1280   * @atomicservice
1281   * @since 11
1282   */
1283  function deleteData(options: Options, callback: AsyncCallback<Array<UnifiedData>>): void;
1284
1285  /**
1286   * Delete data of unified data channel by Intention or Unique Identifier
1287   *
1288   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1289   * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the deleted {@link UnifiedData} object array.
1290   * @throws { BusinessError } 201 - Permission denied.
1291   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1292   * <br>2.Incorrect Parameters types.
1293   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1294   * @since 10
1295   */
1296  /**
1297   * Delete data of unified data channel by Intention or Unique Identifier
1298   *
1299   * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}.
1300   * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the deleted {@link UnifiedData} object array.
1301   * @throws { BusinessError } 201 - Permission denied.
1302   * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified;
1303   * <br>2.Incorrect Parameters types.
1304   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1305   * @atomicservice
1306   * @since 11
1307   */
1308  function deleteData(options: Options): Promise<Array<UnifiedData>>;
1309
1310  /**
1311   * Set app sharing options.
1312   *
1313   * @param { intention } Describe the sharing channel that UDMF support.
1314   * @param { shareOptions } Types of scope that UnifiedData can be used.
1315   * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1316   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1317   *                                                                   2. Incorrect parameter types.
1318   * @throws { BusinessError } 20400001 - Settings already exist.
1319   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1320   * @systemapi
1321   * @stagemodelonly
1322   * @since 12
1323   */
1324   function setAppShareOptions(intention: Intention, shareOptions: ShareOptions): void;
1325
1326   /**
1327    * Remove app sharing options.
1328    *
1329    * @param { intention } Describe the sharing channel that UDMF support.
1330    * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1331    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1332    *                                                                   2. Incorrect parameter types.
1333    * @syscap SystemCapability.DistributedDataManager.UDMF.Core
1334    * @systemapi
1335    * @stagemodelonly
1336    * @since 12
1337    */
1338   function removeAppShareOptions(intention: Intention): void;
1339}
1340
1341export default unifiedDataChannel;
1342