1/* 2 * Copyright (c) 2023-2024 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 */ 40/** 41 * Provide methods for sharing data between different applications across unified data channels. 42 * 43 * @namespace unifiedDataChannel 44 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 45 * @crossplatform 46 * @atomicservice 47 * @since 14 48 */ 49declare namespace unifiedDataChannel { 50 /** 51 * Types of scope that UnifiedData can be used. 52 * @enum { number } 53 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 54 * @atomicservice 55 * @since 12 56 */ 57 enum ShareOptions { 58 /** 59 * IN_APP indicates that only use in the same app is allowed. 60 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 61 * @atomicservice 62 * @since 12 63 */ 64 IN_APP, 65 /** 66 * CROSS_APP indicates that use in any app in this device is allowed. 67 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 68 * @atomicservice 69 * @since 12 70 */ 71 CROSS_APP 72 } 73 74 /** 75 * Indicated delay get UnifiedData 76 * 77 * @typedef {function} GetDelayData 78 * @param { string } type - the type of UnifiedData required. 79 * @returns { UnifiedData } Return the UnifiedData required. 80 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 81 * @atomicservice 82 * @since 12 83 */ 84 type GetDelayData = (type: string) => UnifiedData; 85 86 /** 87 * Indicates type of value. 88 * @typedef {number | string | boolean | image.PixelMap | Want | ArrayBuffer | object | null | undefined} 89 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 90 * @atomicservice 91 * @since 12 92 */ 93 /** 94 * Indicates type of value. 95 * @typedef {number | string | boolean | image.PixelMap | Want | ArrayBuffer | object | null | undefined} 96 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 97 * @crossplatform 98 * @atomicservice 99 * @since 14 100 */ 101 type ValueType = number | string | boolean | image.PixelMap | Want | ArrayBuffer | object | null | undefined; 102 103 /** 104 * Describe the unified data properties. 105 * 106 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 107 * @atomicservice 108 * @since 12 109 */ 110 class UnifiedDataProperties { 111 /** 112 * extra property data. key-value pairs. 113 * @type { ?Record<string, object> } 114 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 115 * @atomicservice 116 * @since 12 117 */ 118 extras?: Record<string, object>; 119 120 /** 121 * the user-defined tag of a UnifiedData object. 122 * @type { ?string } 123 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 124 * @atomicservice 125 * @since 12 126 */ 127 tag?: string; 128 /** 129 * a timestamp, which indicates when data is written. 130 * @type { ?Date } 131 * @readonly 132 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 133 * @atomicservice 134 * @since 12 135 */ 136 readonly timestamp?: Date; 137 /** 138 * Indicates the scope of clipboard data which can be used. 139 * If it is not set or is incorrectly set, The default value is CrossDevice. 140 * @type { ?ShareOptions } 141 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 142 * @atomicservice 143 * @since 12 144 */ 145 shareOptions?: ShareOptions; 146 147 /** 148 * Indicated delay get UnifiedData. 149 * @type { ?GetDelayData } 150 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 151 * @atomicservice 152 * @since 12 153 */ 154 getDelayData?: GetDelayData; 155 } 156 157 /** 158 * Describe the unified data. 159 * 160 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 161 * @since 10 162 */ 163 /** 164 * Describe the unified data. 165 * 166 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 167 * @atomicservice 168 * @since 11 169 */ 170 /** 171 * Describe the unified data. 172 * 173 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 174 * @crossplatform 175 * @atomicservice 176 * @since 14 177 */ 178 class UnifiedData { 179 /** 180 * Create unified data with a record 181 * 182 * @param { UnifiedRecord } record - Record will add into unified data. 183 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 184 * <br>2.Incorrect parameters types. 185 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 186 * @since 10 187 */ 188 /** 189 * Create unified data with a record 190 * 191 * @param { UnifiedRecord } record - Record will add into unified data. 192 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 193 * <br>2.Incorrect parameters types. 194 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 195 * @atomicservice 196 * @since 11 197 */ 198 /** 199 * Create unified data with a record 200 * 201 * @param { UnifiedRecord } record - Record will add into unified data. 202 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 203 * <br>2.Incorrect parameters types. 204 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 205 * @crossplatform 206 * @atomicservice 207 * @since 14 208 */ 209 constructor(record: UnifiedRecord); 210 /** 211 * Create a empty unified data. 212 * 213 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 214 * @atomicservice 215 * @since 12 216 */ 217 /** 218 * Create a empty unified data. 219 * 220 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 221 * @crossplatform 222 * @atomicservice 223 * @since 14 224 */ 225 constructor(); 226 /** 227 * Add a record into unified data 228 * 229 * @param { UnifiedRecord } record - Record will add into unified data. 230 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 231 * <br>2.Incorrect parameters types. 232 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 233 * @since 10 234 */ 235 /** 236 * Add a record into unified data 237 * 238 * @param { UnifiedRecord } record - Record will add into unified data. 239 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 240 * <br>2.Incorrect parameters types. 241 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 242 * @atomicservice 243 * @since 11 244 */ 245 /** 246 * Add a record into unified data 247 * 248 * @param { UnifiedRecord } record - Record will add into unified data. 249 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 250 * <br>2.Incorrect parameters types. 251 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 252 * @crossplatform 253 * @atomicservice 254 * @since 14 255 */ 256 addRecord(record: UnifiedRecord): void; 257 /** 258 * Get all records of unified data 259 * 260 * @returns { Array<UnifiedRecord> } Return the records of unified data 261 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 262 * @since 10 263 */ 264 /** 265 * Get all records of unified data 266 * 267 * @returns { Array<UnifiedRecord> } Return the records of unified data 268 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 269 * @atomicservice 270 * @since 11 271 */ 272 /** 273 * Get all records of unified data 274 * 275 * @returns { Array<UnifiedRecord> } Return the records of unified data 276 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 277 * @crossplatform 278 * @atomicservice 279 * @since 14 280 */ 281 getRecords(): Array<UnifiedRecord>; 282 283 /** 284 * Checks whether there is a specified type of data in DataProperties. 285 * @param { string } type - indicates to query data type. 286 * @returns { boolean } if having mimeType in UnifiedData returns true, else returns false. 287 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 288 * <br>2.Incorrect parameters types. 289 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 290 * @atomicservice 291 * @since 12 292 */ 293 /** 294 * Checks whether there is a specified type of data in DataProperties. 295 * @param { string } type - indicates to query data type. 296 * @returns { boolean } if having mimeType in UnifiedData returns true, else returns false. 297 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 298 * <br>2.Incorrect parameters types. 299 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 300 * @crossplatform 301 * @atomicservice 302 * @since 14 303 */ 304 hasType(type: string): boolean; 305 306 /** 307 * UTD types of all content in the UnifiedData. 308 * @returns { Array<string> } type of array 309 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 310 * @atomicservice 311 * @since 12 312 */ 313 /** 314 * UTD types of all content in the UnifiedData. 315 * @returns { Array<string> } type of array 316 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 317 * @crossplatform 318 * @atomicservice 319 * @since 14 320 */ 321 getTypes(): Array<string>; 322 323 /** 324 * UnifiedData properties. 325 * @type { UnifiedDataProperties } 326 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 327 * @atomicservice 328 * @since 12 329 */ 330 properties: UnifiedDataProperties; 331 } 332 333 /** 334 * The data abstract supported by unified data 335 * 336 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 337 * @since 10 338 */ 339 /** 340 * The data abstract supported by unified data 341 * 342 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 343 * @atomicservice 344 * @since 11 345 */ 346 class Summary { 347 /** 348 * A map for each type and data size, key is data type, value is the corresponding data size 349 * 350 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 351 * @since 10 352 */ 353 /** 354 * A map for each type and data size, key is data type, value is the corresponding data size 355 * 356 * @type { Record<string, number> } 357 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 358 * @atomicservice 359 * @since 11 360 */ 361 summary: Record<string, number>; 362 /** 363 * Total data size of data in Bytes 364 * 365 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 366 * @since 10 367 */ 368 /** 369 * Total data size of data in Bytes 370 * 371 * @type { number } 372 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 373 * @atomicservice 374 * @since 11 375 */ 376 totalSize: number; 377 } 378 379 /** 380 * Describe the unified record 381 * 382 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 383 * @since 10 384 */ 385 /** 386 * Describe the unified record 387 * 388 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 389 * @atomicservice 390 * @since 11 391 */ 392 /** 393 * Describe the unified record 394 * 395 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 396 * @crossplatform 397 * @atomicservice 398 * @since 14 399 */ 400 class UnifiedRecord { 401 /** 402 * Get type of unified record 403 * 404 * @returns { string } Return the type of unified data 405 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 406 * @since 10 407 */ 408 /** 409 * Get type of unified record 410 * 411 * @returns { string } Return the type of unified data 412 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 413 * @atomicservice 414 * @since 11 415 */ 416 /** 417 * Get type of unified record 418 * 419 * @returns { string } Return the type of unified data 420 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 421 * @crossplatform 422 * @atomicservice 423 * @since 14 424 */ 425 getType(): string; 426 427 /** 428 * Create unified record. 429 * 430 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 431 * @atomicservice 432 * @since 12 433 */ 434 /** 435 * Create unified record. 436 * 437 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 438 * @crossplatform 439 * @atomicservice 440 * @since 14 441 */ 442 constructor(); 443 444 /** 445 * Create unified record by type and value. 446 * 447 * @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. 448 * @param { ValueType } value - indicates to value of unified record. 449 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 450 * <br>2.Incorrect parameters types; 451 * <br>3.Parameter verification failed. 452 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 453 * @atomicservice 454 * @since 12 455 */ 456 /** 457 * Create unified record by type and value. 458 * 459 * @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. 460 * @param { ValueType } value - indicates to value of unified record. 461 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 462 * <br>2.Incorrect parameters types; 463 * <br>3.Parameter verification failed. 464 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 465 * @crossplatform 466 * @atomicservice 467 * @since 14 468 */ 469 constructor(type: string, value: ValueType); 470 471 /** 472 * Get the value of unified record. 473 * 474 * @returns { ValueType } Return the value of unified record. 475 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 476 * @atomicservice 477 * @since 12 478 */ 479 /** 480 * Get the value of unified record. 481 * 482 * @returns { ValueType } Return the value of unified record. 483 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 484 * @crossplatform 485 * @atomicservice 486 * @since 14 487 */ 488 getValue(): ValueType; 489 490 /** 491 * Get the types of unified record. 492 * 493 * @returns { Array<string> } Return the types of unified record. 494 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 495 * @atomicservice 496 * @since 15 497 */ 498 getTypes(): Array<string>; 499 500 /** 501 * Add an entry into unified record 502 * 503 * @param { string } type - type of entry. 504 * @param { ValueType } value - value of entry. 505 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 506 * <br>2.Incorrect parameters types. 507 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 508 * @atomicservice 509 * @since 15 510 */ 511 addEntry(type: string, value: ValueType): void; 512 513 /** 514 * Get an entry from unified record 515 * 516 * @param { string } type - type of entry want to get. 517 * @returns { ValueType } Return the value corresponding to the type. 518 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 519 * <br>2.Incorrect parameters types. 520 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 521 * @atomicservice 522 * @since 15 523 */ 524 getEntry(type: string): ValueType; 525 526 /** 527 * Get entries from unified record 528 * 529 * @returns { Record<string, ValueType> } Return all entries in the record. 530 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 531 * @atomicservice 532 * @since 15 533 */ 534 getEntries(): Record<string, ValueType>; 535 } 536 537 /** 538 * Describe the unified text data 539 * 540 * @extends UnifiedRecord 541 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 542 * @since 10 543 */ 544 /** 545 * Describe the unified text data 546 * 547 * @extends UnifiedRecord 548 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 549 * @atomicservice 550 * @since 11 551 */ 552 /** 553 * Describe the unified text data 554 * 555 * @extends UnifiedRecord 556 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 557 * @crossplatform 558 * @atomicservice 559 * @since 14 560 */ 561 class Text extends UnifiedRecord { 562 /** 563 * Indicates the details of unified text 564 * 565 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 566 * @since 10 567 */ 568 /** 569 * Indicates the details of unified text 570 * 571 * @type { ?Record<string, string> } 572 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 573 * @atomicservice 574 * @since 11 575 */ 576 /** 577 * Indicates the details of unified text 578 * 579 * @type { ?Record<string, string> } 580 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 581 * @crossplatform 582 * @atomicservice 583 * @since 14 584 */ 585 details?: Record<string, string>; 586 } 587 588 /** 589 * Describe the unified plain text data 590 * 591 * @extends Text 592 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 593 * @since 10 594 */ 595 /** 596 * Describe the unified plain text data 597 * 598 * @extends Text 599 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 600 * @atomicservice 601 * @since 11 602 */ 603 /** 604 * Describe the unified plain text data 605 * 606 * @extends Text 607 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 608 * @crossplatform 609 * @atomicservice 610 * @since 14 611 */ 612 class PlainText extends Text { 613 /** 614 * Indicates the content of text 615 * 616 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 617 * @since 10 618 */ 619 /** 620 * Indicates the content of text 621 * 622 * @type { string } 623 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 624 * @atomicservice 625 * @since 11 626 */ 627 /** 628 * Indicates the content of text 629 * 630 * @type { string } 631 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 632 * @crossplatform 633 * @atomicservice 634 * @since 14 635 */ 636 textContent: string; 637 /** 638 * Indicates the abstract of text 639 * 640 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 641 * @since 10 642 */ 643 /** 644 * Indicates the abstract of text 645 * 646 * @type { ?string } 647 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 648 * @atomicservice 649 * @since 11 650 */ 651 /** 652 * Indicates the abstract of text 653 * 654 * @type { ?string } 655 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 656 * @crossplatform 657 * @atomicservice 658 * @since 14 659 */ 660 abstract?: string; 661 } 662 663 /** 664 * Describe the unified link data 665 * 666 * @extends Text 667 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 668 * @since 10 669 */ 670 /** 671 * Describe the unified link data 672 * 673 * @extends Text 674 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 675 * @atomicservice 676 * @since 11 677 */ 678 /** 679 * Describe the unified link data 680 * 681 * @extends Text 682 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 683 * @crossplatform 684 * @atomicservice 685 * @since 14 686 */ 687 class Hyperlink extends Text { 688 /** 689 * Indicates the url of a link 690 * 691 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 692 * @since 10 693 */ 694 /** 695 * Indicates the url of a link 696 * 697 * @type { string } 698 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 699 * @atomicservice 700 * @since 11 701 */ 702 /** 703 * Indicates the url of a link 704 * 705 * @type { string } 706 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 707 * @crossplatform 708 * @atomicservice 709 * @since 14 710 */ 711 url: string; 712 /** 713 * Indicates the description of a link 714 * 715 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 716 * @since 10 717 */ 718 /** 719 * Indicates the description of a link 720 * 721 * @type { ?string } 722 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 723 * @atomicservice 724 * @since 11 725 */ 726 /** 727 * Indicates the description of a link 728 * 729 * @type { ?string } 730 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 731 * @crossplatform 732 * @atomicservice 733 * @since 14 734 */ 735 description?: string; 736 } 737 738 /** 739 * Describe the unified html data 740 * 741 * @extends Text 742 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 743 * @since 10 744 */ 745 /** 746 * Describe the unified html data 747 * 748 * @extends Text 749 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 750 * @atomicservice 751 * @since 11 752 */ 753 /** 754 * Describe the unified html data 755 * 756 * @extends Text 757 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 758 * @crossplatform 759 * @atomicservice 760 * @since 14 761 */ 762 class HTML extends Text { 763 /** 764 * Indicates the content of html, with html tags 765 * 766 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 767 * @since 10 768 */ 769 /** 770 * Indicates the content of html, with html tags 771 * 772 * @type { string } 773 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 774 * @atomicservice 775 * @since 11 776 */ 777 /** 778 * Indicates the content of html, with html tags 779 * 780 * @type { string } 781 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 782 * @crossplatform 783 * @atomicservice 784 * @since 14 785 */ 786 htmlContent: string; 787 /** 788 * Indicates the plain content of html 789 * 790 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 791 * @since 10 792 */ 793 /** 794 * Indicates the plain content of html 795 * 796 * @type { ?string } 797 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 798 * @atomicservice 799 * @since 11 800 */ 801 /** 802 * Indicates the plain content of html 803 * 804 * @type { ?string } 805 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 806 * @crossplatform 807 * @atomicservice 808 * @since 14 809 */ 810 plainContent?: string; 811 } 812 813 /** 814 * Describe the unified file data 815 * 816 * @extends UnifiedRecord 817 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 818 * @since 10 819 */ 820 /** 821 * Describe the unified file data 822 * 823 * @extends UnifiedRecord 824 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 825 * @atomicservice 826 * @since 11 827 */ 828 /** 829 * Describe the unified file data 830 * 831 * @extends UnifiedRecord 832 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 833 * @crossplatform 834 * @atomicservice 835 * @since 14 836 */ 837 class File extends UnifiedRecord { 838 /** 839 * Indicates the details of unified File 840 * 841 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 842 * @since 10 843 */ 844 /** 845 * Indicates the details of unified File 846 * 847 * @type { ?Record<string, string> } 848 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 849 * @atomicservice 850 * @since 11 851 */ 852 /** 853 * Indicates the details of unified File 854 * 855 * @type { ?Record<string, string> } 856 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 857 * @crossplatform 858 * @atomicservice 859 * @since 14 860 */ 861 details?: Record<string, string>; 862 /** 863 * Indicates the uri of file 864 * 865 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 866 * @since 10 867 */ 868 /** 869 * Indicates the uri of file 870 * 871 * @type { string } 872 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 873 * @atomicservice 874 * @since 11 875 */ 876 /** 877 * Indicates the uri of file 878 * 879 * @type { string } 880 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 881 * @crossplatform 882 * @atomicservice 883 * @since 14 884 */ 885 uri: string; 886 } 887 888 /** 889 * Describe the unified image data 890 * 891 * @extends File 892 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 893 * @since 10 894 */ 895 /** 896 * Describe the unified image data 897 * 898 * @extends File 899 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 900 * @atomicservice 901 * @since 11 902 */ 903 /** 904 * Describe the unified image data 905 * 906 * @extends File 907 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 908 * @crossplatform 909 * @atomicservice 910 * @since 14 911 */ 912 class Image extends File { 913 /** 914 * Indicates the uri of image 915 * 916 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 917 * @since 10 918 */ 919 /** 920 * Indicates the uri of image 921 * 922 * @type { string } 923 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 924 * @atomicservice 925 * @since 11 926 */ 927 /** 928 * Indicates the uri of image 929 * 930 * @type { string } 931 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 932 * @crossplatform 933 * @atomicservice 934 * @since 14 935 */ 936 imageUri: string; 937 } 938 939 /** 940 * Describe the unified video data 941 * 942 * @extends File 943 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 944 * @since 10 945 */ 946 /** 947 * Describe the unified video data 948 * 949 * @extends File 950 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 951 * @atomicservice 952 * @since 11 953 */ 954 /** 955 * Describe the unified video data 956 * 957 * @extends File 958 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 959 * @crossplatform 960 * @atomicservice 961 * @since 14 962 */ 963 class Video extends File { 964 /** 965 * Indicates the uri of video 966 * 967 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 968 * @since 10 969 */ 970 /** 971 * Indicates the uri of video 972 * 973 * @type { string } 974 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 975 * @atomicservice 976 * @since 11 977 */ 978 /** 979 * Indicates the uri of video 980 * 981 * @type { string } 982 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 983 * @crossplatform 984 * @atomicservice 985 * @since 14 986 */ 987 videoUri: string; 988 } 989 990 /** 991 * Describe the unified audio data 992 * 993 * @extends File 994 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 995 * @since 10 996 */ 997 /** 998 * Describe the unified audio data 999 * 1000 * @extends File 1001 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1002 * @atomicservice 1003 * @since 11 1004 */ 1005 /** 1006 * Describe the unified audio data 1007 * 1008 * @extends File 1009 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1010 * @crossplatform 1011 * @atomicservice 1012 * @since 14 1013 */ 1014 class Audio extends File { 1015 /** 1016 * Indicates the uri of audio 1017 * 1018 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1019 * @since 10 1020 */ 1021 /** 1022 * Indicates the uri of audio 1023 * 1024 * @type { string } 1025 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1026 * @atomicservice 1027 * @since 11 1028 */ 1029 /** 1030 * Indicates the uri of audio 1031 * 1032 * @type { string } 1033 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1034 * @crossplatform 1035 * @atomicservice 1036 * @since 14 1037 */ 1038 audioUri: string; 1039 } 1040 1041 /** 1042 * Describe the unified folder data 1043 * 1044 * @extends File 1045 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1046 * @since 10 1047 */ 1048 /** 1049 * Describe the unified folder data 1050 * 1051 * @extends File 1052 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1053 * @atomicservice 1054 * @since 11 1055 */ 1056 /** 1057 * Describe the unified folder data 1058 * 1059 * @extends File 1060 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1061 * @crossplatform 1062 * @atomicservice 1063 * @since 14 1064 */ 1065 class Folder extends File { 1066 /** 1067 * Indicates the uri of folder 1068 * 1069 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1070 * @since 10 1071 */ 1072 /** 1073 * Indicates the uri of folder 1074 * 1075 * @type { string } 1076 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1077 * @atomicservice 1078 * @since 11 1079 */ 1080 /** 1081 * Indicates the uri of folder 1082 * 1083 * @type { string } 1084 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1085 * @crossplatform 1086 * @atomicservice 1087 * @since 14 1088 */ 1089 folderUri: string; 1090 } 1091 1092 /** 1093 * Describe system defined type data(this kind of data is provided and bound to OpenHarmony, 1094 * also can be parsed by system provided API) 1095 * 1096 * @extends UnifiedRecord 1097 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1098 * @since 10 1099 */ 1100 /** 1101 * Describe system defined type data(this kind of data is provided and bound to OpenHarmony, 1102 * also can be parsed by system provided API) 1103 * 1104 * @extends UnifiedRecord 1105 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1106 * @atomicservice 1107 * @since 11 1108 */ 1109 class SystemDefinedRecord extends UnifiedRecord { 1110 /** 1111 * Indicates the details of system defined data 1112 * 1113 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1114 * @since 10 1115 */ 1116 /** 1117 * Indicates the details of system defined data 1118 * 1119 * @type { ?Record<string, number | string | Uint8Array> } 1120 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1121 * @atomicservice 1122 * @since 11 1123 */ 1124 details?: Record<string, number | string | Uint8Array>; 1125 } 1126 1127 /** 1128 * Describe system defined form data(this kind of data is provided and bound to OpenHarmony, 1129 * also can be parsed by system provided API) 1130 * 1131 * @extends SystemDefinedRecord 1132 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1133 * @since 10 1134 */ 1135 /** 1136 * Describe system defined form data(this kind of data is provided and bound to OpenHarmony, 1137 * also can be parsed by system provided API) 1138 * 1139 * @extends SystemDefinedRecord 1140 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1141 * @atomicservice 1142 * @since 11 1143 */ 1144 class SystemDefinedForm extends SystemDefinedRecord { 1145 /** 1146 * Indicates the id of form 1147 * 1148 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1149 * @since 10 1150 */ 1151 /** 1152 * Indicates the id of form 1153 * 1154 * @type { number } 1155 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1156 * @atomicservice 1157 * @since 11 1158 */ 1159 formId: number; 1160 /** 1161 * Indicates the name of form 1162 * 1163 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1164 * @since 10 1165 */ 1166 /** 1167 * Indicates the name of form 1168 * 1169 * @type { string } 1170 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1171 * @atomicservice 1172 * @since 11 1173 */ 1174 formName: string; 1175 /** 1176 * Indicates the bundle name of form 1177 * 1178 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1179 * @since 10 1180 */ 1181 /** 1182 * Indicates the bundle name of form 1183 * 1184 * @type { string } 1185 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1186 * @atomicservice 1187 * @since 11 1188 */ 1189 bundleName: string; 1190 /** 1191 * Indicates the ability name of form 1192 * 1193 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1194 * @since 10 1195 */ 1196 /** 1197 * Indicates the ability name of form 1198 * 1199 * @type { string } 1200 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1201 * @atomicservice 1202 * @since 11 1203 */ 1204 abilityName: string; 1205 /** 1206 * Indicates the module of form 1207 * 1208 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1209 * @since 10 1210 */ 1211 /** 1212 * Indicates the module of form 1213 * 1214 * @type { string } 1215 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1216 * @atomicservice 1217 * @since 11 1218 */ 1219 module: string; 1220 } 1221 1222 /** 1223 * Describe system defined app item data(this kind of data is provided and bound to OpenHarmony, 1224 * also can be parsed by system provided API) 1225 * 1226 * @extends SystemDefinedRecord 1227 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1228 * @since 10 1229 */ 1230 /** 1231 * Describe system defined app item data(this kind of data is provided and bound to OpenHarmony, 1232 * also can be parsed by system provided API) 1233 * 1234 * @extends SystemDefinedRecord 1235 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1236 * @atomicservice 1237 * @since 11 1238 */ 1239 class SystemDefinedAppItem extends SystemDefinedRecord { 1240 /** 1241 * Indicates the app id 1242 * 1243 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1244 * @since 10 1245 */ 1246 /** 1247 * Indicates the app id 1248 * 1249 * @type { string } 1250 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1251 * @atomicservice 1252 * @since 11 1253 */ 1254 appId: string; 1255 /** 1256 * Indicates the app name 1257 * 1258 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1259 * @since 10 1260 */ 1261 /** 1262 * Indicates the app name 1263 * 1264 * @type { string } 1265 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1266 * @atomicservice 1267 * @since 11 1268 */ 1269 appName: string; 1270 /** 1271 * Indicates the id of app icon 1272 * 1273 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1274 * @since 10 1275 */ 1276 /** 1277 * Indicates the id of app icon 1278 * 1279 * @type { string } 1280 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1281 * @atomicservice 1282 * @since 11 1283 */ 1284 appIconId: string; 1285 /** 1286 * Indicates the id of app label 1287 * 1288 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1289 * @since 10 1290 */ 1291 /** 1292 * Indicates the id of app label 1293 * 1294 * @type { string } 1295 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1296 * @atomicservice 1297 * @since 11 1298 */ 1299 appLabelId: string; 1300 /** 1301 * Indicates the bundle name of app 1302 * 1303 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1304 * @since 10 1305 */ 1306 /** 1307 * Indicates the bundle name of app 1308 * 1309 * @type { string } 1310 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1311 * @atomicservice 1312 * @since 11 1313 */ 1314 bundleName: string; 1315 /** 1316 * Indicates the ability name of app 1317 * 1318 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1319 * @since 10 1320 */ 1321 /** 1322 * Indicates the ability name of app 1323 * 1324 * @type { string } 1325 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1326 * @atomicservice 1327 * @since 11 1328 */ 1329 abilityName: string; 1330 } 1331 1332 /** 1333 * Describe system defined pixel map data(this kind of data is provided and bound to OpenHarmony, 1334 * also can be parsed by system provided API) 1335 * 1336 * @extends SystemDefinedRecord 1337 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1338 * @since 10 1339 */ 1340 /** 1341 * Describe system defined pixel map data(this kind of data is provided and bound to OpenHarmony, 1342 * also can be parsed by system provided API) 1343 * 1344 * @extends SystemDefinedRecord 1345 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1346 * @atomicservice 1347 * @since 11 1348 */ 1349 class SystemDefinedPixelMap extends SystemDefinedRecord { 1350 /** 1351 * Indicates the raw data of pixel map 1352 * 1353 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1354 * @since 10 1355 */ 1356 /** 1357 * Indicates the raw data of pixel map 1358 * 1359 * @type { Uint8Array } 1360 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1361 * @atomicservice 1362 * @since 11 1363 */ 1364 rawData: Uint8Array; 1365 } 1366 1367 /** 1368 * Describe application defined data(this kind of data is provided and bound to OpenHarmony, 1369 * also can be parsed by system provided API) 1370 * 1371 * @extends UnifiedRecord 1372 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1373 * @since 10 1374 */ 1375 /** 1376 * Describe application defined data(this kind of data is provided and bound to OpenHarmony, 1377 * also can be parsed by system provided API) 1378 * 1379 * @extends UnifiedRecord 1380 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1381 * @atomicservice 1382 * @since 11 1383 */ 1384 class ApplicationDefinedRecord extends UnifiedRecord { 1385 /** 1386 * Indicates the type of data, should always be started with 'ApplicationDefined.', will 1387 * return error otherwise 1388 * 1389 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1390 * @since 10 1391 */ 1392 /** 1393 * Indicates the type of data, should always be started with 'ApplicationDefined.', will 1394 * return error otherwise 1395 * 1396 * @type { string } 1397 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1398 * @atomicservice 1399 * @since 11 1400 */ 1401 applicationDefinedType: string; 1402 /** 1403 * Indicates the raw data of application defined data 1404 * 1405 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1406 * @since 10 1407 */ 1408 /** 1409 * Indicates the raw data of application defined data 1410 * 1411 * @type { Uint8Array } 1412 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1413 * @atomicservice 1414 * @since 11 1415 */ 1416 rawData: Uint8Array; 1417 } 1418 1419 /** 1420 * Describe the sharing channel that UDMF support 1421 * 1422 * @enum { string } 1423 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1424 * @since 10 1425 */ 1426 /** 1427 * Describe the sharing channel that UDMF support 1428 * 1429 * @enum { string } 1430 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1431 * @atomicservice 1432 * @since 11 1433 */ 1434 enum Intention { 1435 /** 1436 * Indicates the intention of data hub 1437 * 1438 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1439 * @since 10 1440 */ 1441 /** 1442 * Indicates the intention of data hub 1443 * 1444 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1445 * @atomicservice 1446 * @since 11 1447 */ 1448 DATA_HUB = 'DataHub', 1449 1450 /** 1451 * Indicates the intention of drag 1452 * 1453 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1454 * @systemapi 1455 * @StageModelOnly 1456 * @since 12 1457 */ 1458 /** 1459 * Indicates the intention of drag 1460 * 1461 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1462 * @stagemodelonly 1463 * @since 14 1464 */ 1465 DRAG = 'Drag' 1466 } 1467 1468 /** 1469 * Describe the optional arguments of data operation 1470 * 1471 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1472 * @since 10 1473 */ 1474 /** 1475 * Describe the optional arguments of data operation 1476 * 1477 * @typedef { object } 1478 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1479 * @atomicservice 1480 * @since 11 1481 */ 1482 type Options = { 1483 /** 1484 * Indicates the target Intention 1485 * 1486 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1487 * @since 10 1488 */ 1489 /** 1490 * Indicates the target Intention 1491 * 1492 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1493 * @atomicservice 1494 * @since 11 1495 */ 1496 intention?: Intention; 1497 1498 /** 1499 * Indicates the unique identifier of target UnifiedData 1500 * 1501 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1502 * @since 10 1503 */ 1504 /** 1505 * Indicates the unique identifier of target UnifiedData 1506 * 1507 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1508 * @atomicservice 1509 * @since 11 1510 */ 1511 key?: string; 1512 }; 1513 1514 /** 1515 * Defines the types of file conflict options when getting data from the UDMF. 1516 * 1517 * @enum { number } 1518 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1519 * @atomicservice 1520 * @since 15 1521 */ 1522 enum FileConflictOptions { 1523 /** 1524 * Overwrite when destUri has file with same name. 1525 * 1526 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1527 * @atomicservice 1528 * @since 15 1529 */ 1530 OVERWRITE, 1531 1532 /** 1533 * Skip when destUri has file with same name. 1534 * 1535 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1536 * @atomicservice 1537 * @since 15 1538 */ 1539 SKIP 1540 } 1541 1542 /** 1543 * Defines the types of progress indicator when getting data from the UDMF. 1544 * 1545 * @enum { number } 1546 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1547 * @atomicservice 1548 * @since 15 1549 */ 1550 enum ProgressIndicator { 1551 /** 1552 * Getting data without system default progress indicator. 1553 * 1554 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1555 * @atomicservice 1556 * @since 15 1557 */ 1558 NONE, 1559 1560 /** 1561 * Getting data with system default progress indicator. 1562 * 1563 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1564 * @atomicservice 1565 * @since 15 1566 */ 1567 DEFAULT 1568 } 1569 1570 /** 1571 * Defines the listener status of obtaining progress and data. 1572 * 1573 * @enum { number } 1574 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1575 * @atomicservice 1576 * @since 15 1577 */ 1578 enum ListenerStatus { 1579 /** 1580 * Indicates the finished status. 1581 * 1582 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1583 * @atomicservice 1584 * @since 15 1585 */ 1586 FINISHED = 0, 1587 1588 /** 1589 * Indicates that processing is still in progress. 1590 * 1591 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1592 * @atomicservice 1593 * @since 15 1594 */ 1595 PROCESSING, 1596 1597 /** 1598 * Indicates that the process has been canceled. 1599 * 1600 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1601 * @atomicservice 1602 * @since 15 1603 */ 1604 CANCELED, 1605 1606 /** 1607 * Indicates that an internal error has occurred. 1608 * 1609 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1610 * @atomicservice 1611 * @since 15 1612 */ 1613 INNER_ERROR = 200, 1614 1615 /** 1616 * Indicates that the GetDataParams contains invalid parameters. 1617 * 1618 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1619 * @atomicservice 1620 * @since 15 1621 */ 1622 INVALID_PARAMETERS, 1623 1624 /** 1625 * Indicates that no data is obtained. 1626 * 1627 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1628 * @atomicservice 1629 * @since 15 1630 */ 1631 DATA_NOT_FOUND, 1632 1633 /** 1634 * Indicates that an error occurred in the synchronization process. 1635 * 1636 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1637 * @atomicservice 1638 * @since 15 1639 */ 1640 SYNC_FAILED, 1641 1642 /** 1643 * Indicates that an error occurred during file copying. 1644 * 1645 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1646 * @atomicservice 1647 * @since 15 1648 */ 1649 COPY_FILE_FAILED, 1650 } 1651 1652 /** 1653 * Indicates the progress information. 1654 * 1655 * @interface ProgressInfo 1656 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1657 * @atomicservice 1658 * @since 15 1659 */ 1660 interface ProgressInfo { 1661 /** 1662 * Indicates the UDMF processing progress. 1663 * 1664 * @type { number } 1665 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1666 * @atomicservice 1667 * @since 15 1668 */ 1669 progress: number; 1670 1671 /** 1672 * Indicates the status of obtaining progress and data. 1673 * 1674 * @type { ListenerStatus } 1675 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1676 * @atomicservice 1677 * @since 15 1678 */ 1679 status: ListenerStatus; 1680 } 1681 1682 /** 1683 * A listener callback function that fetches progress info and data. 1684 * 1685 * @typedef { function } DataProgressListener 1686 * @param { ProgressInfo } progressInfo - the progress information. 1687 * @param { UnifiedData | null } data - Data obtained when the progress reaches 100%. 1688 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1689 * @atomicservice 1690 * @since 15 1691 */ 1692 type DataProgressListener = (progressInfo: ProgressInfo, data: UnifiedData | null) => void; 1693 1694 /** 1695 * Represents the get data parameters when getting data from udmf. 1696 * 1697 * @interface GetDataParams 1698 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1699 * @atomicservice 1700 * @since 15 1701 */ 1702 interface GetDataParams { 1703 /** 1704 * Indicates whether to use default system progress indicator. 1705 * 1706 * @type { ProgressIndicator } 1707 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1708 * @atomicservice 1709 * @since 15 1710 */ 1711 progressIndicator: ProgressIndicator; 1712 1713 /** 1714 * Indicates progress and data listener when getting unified data. 1715 * 1716 * @type { DataProgressListener } 1717 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1718 * @atomicservice 1719 * @since 15 1720 */ 1721 dataProgressListener: DataProgressListener; 1722 1723 /** 1724 * Indicates the dest path uri where copy file will be copied to sandbox of application. 1725 * 1726 * @type { string } 1727 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1728 * @atomicservice 1729 * @since 15 1730 */ 1731 destUri?: string; 1732 1733 /** 1734 * Indicates file conflict options when dest path has file with same name. 1735 * 1736 * @type { FileConflictOptions } 1737 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1738 * @atomicservice 1739 * @since 15 1740 */ 1741 fileConflictOptions?: FileConflictOptions; 1742 } 1743 1744 /** 1745 * Insert data into unified data channel by Intention 1746 * 1747 * @param { Options } options - fill the intention field to indicate the target {@link Intention}. 1748 * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. 1749 * @param { AsyncCallback<string> } callback - {string}: the unique identifier. 1750 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1751 * <br>2.Incorrect parameters types. 1752 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1753 * @since 10 1754 */ 1755 /** 1756 * Insert data into unified data channel by Intention 1757 * 1758 * @param { Options } options - fill the intention field to indicate the target {@link Intention}. 1759 * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. 1760 * @param { AsyncCallback<string> } callback - {string}: the unique identifier. 1761 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1762 * <br>2.Incorrect parameters types. 1763 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1764 * @atomicservice 1765 * @since 11 1766 */ 1767 function insertData(options: Options, data: UnifiedData, callback: AsyncCallback<string>): void; 1768 1769 /** 1770 * Insert data into unified data channel by Intention 1771 * 1772 * @param { Options } options - fill the intention field to indicate the target {@link Intention}. 1773 * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. 1774 * @returns { Promise<string> } {string}: the unique identifier. 1775 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1776 * <br>2.Incorrect parameters types. 1777 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1778 * @since 10 1779 */ 1780 /** 1781 * Insert data into unified data channel by Intention 1782 * 1783 * @param { Options } options - fill the intention field to indicate the target {@link Intention}. 1784 * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. 1785 * @returns { Promise<string> } {string}: the unique identifier. 1786 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1787 * <br>2.Incorrect parameters types. 1788 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1789 * @atomicservice 1790 * @since 11 1791 */ 1792 function insertData(options: Options, data: UnifiedData): Promise<string>; 1793 1794 /** 1795 * Update data to unified data channel by Unique Identifier 1796 * 1797 * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. 1798 * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. 1799 * @param { AsyncCallback<void> } callback - the callback of updateData. 1800 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1801 * <br>2.Incorrect parameters types. 1802 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1803 * @since 10 1804 */ 1805 /** 1806 * Update data to unified data channel by Unique Identifier 1807 * 1808 * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. 1809 * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. 1810 * @param { AsyncCallback<void> } callback - the callback of updateData. 1811 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1812 * <br>2.Incorrect parameters types. 1813 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1814 * @atomicservice 1815 * @since 11 1816 */ 1817 function updateData(options: Options, data: UnifiedData, callback: AsyncCallback<void>): void; 1818 1819 /** 1820 * Update data to unified data channel by Unique Identifier 1821 * 1822 * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. 1823 * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. 1824 * @returns { Promise<void> } the promise returned by the function. 1825 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1826 * <br>2.Incorrect parameters types. 1827 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1828 * @since 10 1829 */ 1830 /** 1831 * Update data to unified data channel by Unique Identifier 1832 * 1833 * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. 1834 * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. 1835 * @returns { Promise<void> } the promise returned by the function. 1836 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1837 * <br>2.Incorrect parameters types. 1838 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1839 * @atomicservice 1840 * @since 11 1841 */ 1842 function updateData(options: Options, data: UnifiedData): Promise<void>; 1843 1844 /** 1845 * Query data of unified data channel by Intention or Unique Identifier 1846 * 1847 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1848 * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the target {@link UnifiedData} object array. 1849 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1850 * <br>2.Incorrect parameters types. 1851 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1852 * @since 10 1853 */ 1854 /** 1855 * Query data of unified data channel by Intention or Unique Identifier 1856 * 1857 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1858 * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the target {@link UnifiedData} object array. 1859 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1860 * <br>2.Incorrect parameters types. 1861 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1862 * @atomicservice 1863 * @since 11 1864 */ 1865 function queryData(options: Options, callback: AsyncCallback<Array<UnifiedData>>): void; 1866 1867 /** 1868 * Query data of unified data channel by Intention or Unique Identifier 1869 * 1870 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1871 * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the target {@link UnifiedData} object array. 1872 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1873 * <br>2.Incorrect parameters types. 1874 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1875 * @since 10 1876 */ 1877 /** 1878 * Query data of unified data channel by Intention or Unique Identifier 1879 * 1880 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1881 * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the target {@link UnifiedData} object array. 1882 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1883 * <br>2.Incorrect parameters types. 1884 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1885 * @atomicservice 1886 * @since 11 1887 */ 1888 function queryData(options: Options): Promise<Array<UnifiedData>>; 1889 1890 /** 1891 * Delete data of unified data channel by Intention or Unique Identifier 1892 * 1893 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1894 * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the deleted {@link UnifiedData} object array. 1895 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1896 * <br>2.Incorrect parameters types. 1897 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1898 * @since 10 1899 */ 1900 /** 1901 * Delete data of unified data channel by Intention or Unique Identifier 1902 * 1903 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1904 * @param { AsyncCallback<Array<UnifiedData>> } callback - {Array<UnifiedData>}: the deleted {@link UnifiedData} object array. 1905 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1906 * <br>2.Incorrect parameters types. 1907 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1908 * @atomicservice 1909 * @since 11 1910 */ 1911 function deleteData(options: Options, callback: AsyncCallback<Array<UnifiedData>>): void; 1912 1913 /** 1914 * Delete data of unified data channel by Intention or Unique Identifier 1915 * 1916 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1917 * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the deleted {@link UnifiedData} object array. 1918 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1919 * <br>2.Incorrect parameters types. 1920 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1921 * @since 10 1922 */ 1923 /** 1924 * Delete data of unified data channel by Intention or Unique Identifier 1925 * 1926 * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. 1927 * @returns { Promise<Array<UnifiedData>> } {Array<UnifiedData>}: the deleted {@link UnifiedData} object array. 1928 * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; 1929 * <br>2.Incorrect parameters types. 1930 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1931 * @atomicservice 1932 * @since 11 1933 */ 1934 function deleteData(options: Options): Promise<Array<UnifiedData>>; 1935 1936 /** 1937 * Set app sharing options. 1938 * 1939 * @param { Intention } intention - Describe the sharing channel that UDMF support. 1940 * @param { ShareOptions } shareOptions - Types of scope that UnifiedData can be used. 1941 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 1942 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1943 * 2. Incorrect parameter types. 1944 * @throws { BusinessError } 20400001 - Settings already exist. 1945 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1946 * @systemapi 1947 * @StageModelOnly 1948 * @since 12 1949 */ 1950 /** 1951 * Set app sharing options. 1952 * 1953 * @permission ohos.permission.MANAGE_UDMF_APP_SHARE_OPTION 1954 * @param { Intention } intention - Describe the sharing channel that UDMF support. Currently only supports DRAG intention. 1955 * @param { ShareOptions } shareOptions - Types of scope that UnifiedData can be used. 1956 * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.MANAGE_UDMF_APP_SHARE_OPTION". 1957 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1958 * 2. Incorrect parameter types; 1959 * 3. Parameter verification failed. 1960 * @throws { BusinessError } 20400001 - Settings already exist. 1961 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1962 * @stagemodelonly 1963 * @since 14 1964 */ 1965 function setAppShareOptions(intention: Intention, shareOptions: ShareOptions): void; 1966 1967 /** 1968 * Remove app sharing options. 1969 * 1970 * @param { Intention } intention - Describe the sharing channel that UDMF support. 1971 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 1972 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1973 * 2. Incorrect parameter types. 1974 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1975 * @systemapi 1976 * @StageModelOnly 1977 * @since 12 1978 */ 1979 /** 1980 * Remove app sharing options. 1981 * 1982 * @permission ohos.permission.MANAGE_UDMF_APP_SHARE_OPTION 1983 * @param { Intention } intention - Describe the sharing channel that UDMF support. Currently only supports DRAG intention. 1984 * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.MANAGE_UDMF_APP_SHARE_OPTION". 1985 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1986 * 2. Incorrect parameter types; 1987 * 3. Parameter verification failed. 1988 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 1989 * @stagemodelonly 1990 * @since 14 1991 */ 1992 function removeAppShareOptions(intention: Intention): void; 1993 1994 /** 1995 * It is used to convert the multi-entry structure. 1996 * <br>When the input parameters use different records to represent various formats of a single data entry, 1997 * and the tag in the properties is marked as "records_to_entries_data_format", this API will convert the data into a single record with multiple entries. 1998 * <br>If the input data does not meet the conversion criteria, it will remain unchanged by default. 1999 * 2000 * @param { UnifiedData } data - {@link UnifiedData} Data represents the data that needs to be converted. 2001 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 2002 * @syscap SystemCapability.DistributedDataManager.UDMF.Core 2003 * @stagemodelonly 2004 * @atomicservice 2005 * @since 17 2006 */ 2007 function convertRecordsToEntries(data: UnifiedData): void; 2008} 2009 2010export default unifiedDataChannel; 2011