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 Helper functions to access image and video assets 18 * @kit MediaLibraryKit 19 */ 20 21import type { AsyncCallback, Callback } from './@ohos.base'; 22import type Context from './application/Context'; 23import type image from './@ohos.multimedia.image'; 24import type dataSharePredicates from './@ohos.data.dataSharePredicates'; 25import type { CustomColors } from './@ohos.arkui.theme'; 26 27/** 28 * Helper functions to access image and video assets 29 * 30 * @namespace photoAccessHelper 31 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 32 * @since 10 33 */ 34/** 35 * Helper functions to access image and video assets 36 * 37 * @namespace photoAccessHelper 38 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 39 * @atomicservice 40 * @since 11 41 */ 42/** 43 * Helper functions to access image and video assets 44 * 45 * @namespace photoAccessHelper 46 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 47 * @crossplatform 48 * @atomicservice 49 * @since 12 50 */ 51declare namespace photoAccessHelper { 52 /** 53 * Returns an instance of PhotoAccessHelper 54 * 55 * @param { Context } context - Hap context information 56 * @returns { PhotoAccessHelper } Instance of PhotoAccessHelper 57 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 58 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 59 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 60 * @StageModelOnly 61 * @since 10 62 */ 63 /** 64 * Returns an instance of PhotoAccessHelper 65 * 66 * @param { Context } context - Hap context information 67 * @returns { PhotoAccessHelper } Instance of PhotoAccessHelper 68 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 69 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 70 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 71 * @StageModelOnly 72 * @atomicservice 73 * @since 11 74 */ 75 /** 76 * Returns an instance of PhotoAccessHelper 77 * 78 * @param { Context } context - Hap context information 79 * @returns { PhotoAccessHelper } Instance of PhotoAccessHelper 80 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 81 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 82 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 83 * @StageModelOnly 84 * @crossplatform 85 * @atomicservice 86 * @since 12 87 */ 88 function getPhotoAccessHelper(context: Context): PhotoAccessHelper; 89 90 /** 91 * Enumeration of different types of photos 92 * 93 * @enum { number } PhotoType 94 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 95 * @since 10 96 */ 97 /** 98 * Enumeration of different types of photos 99 * 100 * @enum { number } PhotoType 101 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 102 * @atomicservice 103 * @since 11 104 */ 105 /** 106 * Enumeration of different types of photos 107 * 108 * @enum { number } PhotoType 109 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 110 * @crossplatform 111 * @atomicservice 112 * @since 12 113 */ 114 enum PhotoType { 115 /** 116 * Image asset 117 * 118 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 119 * @since 10 120 */ 121 /** 122 * Image asset 123 * 124 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 125 * @atomicservice 126 * @since 11 127 */ 128 /** 129 * Image asset 130 * 131 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 132 * @crossplatform 133 * @atomicservice 134 * @since 12 135 */ 136 IMAGE = 1, 137 /** 138 * Video asset 139 * 140 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 141 * @since 10 142 */ 143 /** 144 * Video asset 145 * 146 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 147 * @atomicservice 148 * @since 11 149 */ 150 /** 151 * Video asset 152 * 153 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 154 * @crossplatform 155 * @atomicservice 156 * @since 12 157 */ 158 VIDEO 159 } 160 161 /** 162 * Enumeration of different categories of photos 163 * 164 * @enum { number } PhotoSubtype 165 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 166 * @systemapi 167 * @since 10 168 */ 169 /** 170 * Enumeration of different categories of photos 171 * 172 * @enum { number } PhotoSubtype 173 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 174 * @atomicservice 175 * @since 12 176 */ 177 enum PhotoSubtype { 178 /** 179 * Default Photo Type 180 * 181 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 182 * @systemapi 183 * @since 10 184 */ 185 /** 186 * Default Photo Type 187 * 188 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 189 * @atomicservice 190 * @since 12 191 */ 192 DEFAULT = 0, 193 /** 194 * Screenshot Photo Type 195 * 196 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 197 * @systemapi 198 * @since 10 199 */ 200 SCREENSHOT = 1, 201 /** 202 * Moving Photo Type 203 * 204 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 205 * @atomicservice 206 * @since 12 207 */ 208 MOVING_PHOTO = 3, 209 /** 210 * Burst Photo Type 211 * 212 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 213 * @atomicservice 214 * @since 12 215 */ 216 BURST = 4, 217 } 218 219 /** 220 * Enumeration of dynamic range type 221 * 222 * @enum { number } DynamicRangeType 223 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 224 * @since 12 225 */ 226 enum DynamicRangeType { 227 /** 228 * SDR(Standard-Dynamic Range) format 229 * 230 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 231 * @since 12 232 */ 233 SDR = 0, 234 /** 235 * HDR(High-Dynamic Range) format 236 * 237 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 238 * @since 12 239 */ 240 HDR = 1 241 } 242 243 /** 244 * Ability to access thumbnail 245 * 246 * @enum { number } ThumbnailVisibility 247 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 248 * @systemapi 249 * @since 14 250 */ 251 enum ThumbnailVisibility { 252 /** 253 * Unable to access thumbnail 254 * 255 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 256 * @systemapi 257 * @since 14 258 */ 259 INVISIBLE = 0, 260 /** 261 * able to access thumbnail 262 * 263 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 264 * @systemapi 265 * @since 14 266 */ 267 VISIBLE = 1 268 } 269 270 /** 271 * Photo asset position 272 * 273 * @enum { number } Photo asset position, such as local device or cloud 274 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 275 * @systemapi 276 * @since 10 277 */ 278 enum PositionType { 279 /** 280 * Asset exists only in local device 281 * 282 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 283 * @systemapi 284 * @since 10 285 */ 286 LOCAL = 1 << 0, 287 /** 288 * Asset exists only in cloud 289 * 290 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 291 * @systemapi 292 * @since 10 293 */ 294 CLOUD = 1 << 1 295 } 296 297 /** 298 * Analysis type 299 * 300 * @enum { number } AnalysisType 301 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 302 * @systemapi 303 * @since 11 304 */ 305 enum AnalysisType { 306 /** 307 * Analysis of aesthetics score 308 * 309 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 310 * @systemapi 311 * @since 11 312 */ 313 ANALYSIS_AESTHETICS_SCORE = 0, 314 /** 315 * Analysis of label 316 * 317 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 318 * @systemapi 319 * @since 11 320 */ 321 ANALYSIS_LABEL, 322 /** 323 * Analysis of ocr 324 * 325 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 326 * @systemapi 327 * @since 11 328 */ 329 ANALYSIS_OCR, 330 /** 331 * Analysis of face 332 * 333 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 334 * @systemapi 335 * @since 11 336 */ 337 ANALYSIS_FACE, 338 /** 339 * Analysis of object 340 * 341 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 342 * @systemapi 343 * @since 11 344 */ 345 ANALYSIS_OBJECT, 346 /** 347 * Analysis of recommendation 348 * 349 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 350 * @systemapi 351 * @since 11 352 */ 353 ANALYSIS_RECOMMENDATION, 354 /** 355 * Analysis of segmentation 356 * 357 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 358 * @systemapi 359 * @since 11 360 */ 361 ANALYSIS_SEGMENTATION, 362 /** 363 * Analysis of composition 364 * 365 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 366 * @systemapi 367 * @since 11 368 */ 369 ANALYSIS_COMPOSITION, 370 /** 371 * Analysis of saliency 372 * 373 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 374 * @systemapi 375 * @since 11 376 */ 377 ANALYSIS_SALIENCY, 378 /** 379 * Analysis of photo detail address info 380 * 381 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 382 * @systemapi 383 * @since 11 384 */ 385 ANALYSIS_DETAIL_ADDRESS, 386 /** 387 * Analysis of human face tag 388 * 389 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 390 * @systemapi 391 * @since 12 392 */ 393 ANALYSIS_HUMAN_FACE_TAG, 394 /** 395 * Analysis of head position 396 * 397 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 398 * @systemapi 399 * @since 12 400 */ 401 ANALYSIS_HEAD_POSITION, 402 /** 403 * Analysis of bone pose 404 * 405 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 406 * @systemapi 407 * @since 12 408 */ 409 ANALYSIS_BONE_POSE, 410 /** 411 * Analysis of video label 412 * 413 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 414 * @systemapi 415 * @since 12 416 */ 417 ANALYSIS_VIDEO_LABEL, 418 /** 419 * Analysis of highlight 420 * 421 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 422 * @systemapi 423 * @since 12 424 */ 425 ANALYSIS_HIGHLIGHT, 426 /** 427 * Analysis of multi crop 428 * 429 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 430 * @systemapi 431 * @since 12 432 */ 433 ANALYSIS_MULTI_CROP 434 } 435 436 /** 437 * Enumeration of different recommendation type 438 * 439 * @enum { number } RecommendationType 440 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 441 * @atomicservice 442 * @since 11 443 */ 444 enum RecommendationType { 445 /** 446 * QR_OR_BAR_CODE indicates that QR code or barcode photos can be recommended 447 * 448 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 449 * @atomicservice 450 * @since 11 451 */ 452 QR_OR_BAR_CODE = 1, 453 454 /** 455 * QR_CODE indicates that QR code photos can be recommended 456 * 457 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 458 * @atomicservice 459 * @since 11 460 */ 461 QR_CODE = 2, 462 463 /** 464 * BAR_CODE indicates that barcode photos can be recommended 465 * 466 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 467 * @atomicservice 468 * @since 11 469 */ 470 BAR_CODE = 3, 471 472 /** 473 * ID_CARD indicates that QR code or barcode photos can be recommended 474 * 475 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 476 * @atomicservice 477 * @since 11 478 */ 479 ID_CARD = 4, 480 481 /** 482 * PROFILE_PICTURE indicates that profile picture photos can be recommended 483 * 484 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 485 * @atomicservice 486 * @since 11 487 */ 488 PROFILE_PICTURE = 5, 489 490 /** 491 * PASSPORT indicates that passport photos can be recommended 492 * 493 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 494 * @atomicservice 495 * @since 12 496 */ 497 PASSPORT = 6, 498 499 /** 500 * BANK_CARD indicates that bank card photos can be recommended 501 * 502 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 503 * @atomicservice 504 * @since 12 505 */ 506 BANK_CARD = 7, 507 508 /** 509 * DRIVER_LICENSE indicates that driver license photos can be recommended 510 * 511 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 512 * @atomicservice 513 * @since 12 514 */ 515 DRIVER_LICENSE = 8, 516 517 /** 518 * DRIVING_LICENSE indicates that driving license photos can be recommended 519 * 520 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 521 * @atomicservice 522 * @since 12 523 */ 524 DRIVING_LICENSE = 9, 525 526 /** 527 * FEATURED_SINGLE_PORTRAIT indicates that featured single portrait photos can be recommended 528 * 529 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 530 * @atomicservice 531 * @since 12 532 */ 533 FEATURED_SINGLE_PORTRAIT = 10 534 } 535 536 /** 537 * Enumeration of delivery mode. 538 * 539 * @enum { number } DeliveryMode 540 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 541 * @since 11 542 */ 543 enum DeliveryMode { 544 /** 545 * Fast delivery mode 546 * 547 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 548 * @since 11 549 */ 550 FAST_MODE = 0, 551 552 /** 553 * High quality delivery mode 554 * 555 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 556 * @since 11 557 */ 558 HIGH_QUALITY_MODE = 1, 559 560 /** 561 * Balance delivery mode 562 * 563 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 564 * @since 11 565 */ 566 BALANCE_MODE = 2 567 } 568 569 /** 570 * Enumeration of source mode 571 * 572 * @enum { number } SourceMode 573 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 574 * @systemapi 575 * @since 11 576 */ 577 enum SourceMode { 578 /** 579 * Original mode 580 * 581 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 582 * @systemapi 583 * @since 11 584 */ 585 ORIGINAL_MODE = 0, 586 587 /** 588 * Edited mode 589 * 590 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 591 * @systemapi 592 * @since 11 593 */ 594 EDITED_MODE = 1 595 } 596 597 /** 598 * Enumeration type of permissions for accessing asset uri. 599 * 600 * @enum { number } PhotoPermissionType 601 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 602 * @systemapi 603 * @since 12 604 */ 605 enum PhotoPermissionType { 606 /** 607 * Temporary access to photos, this permission could be canceled when APP dies. 608 * 609 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 610 * @systemapi 611 * @since 12 612 */ 613 TEMPORARY_READ_IMAGEVIDEO = 0, 614 615 /** 616 * Persistence access to photos. 617 * 618 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 619 * @systemapi 620 * @since 12 621 */ 622 PERSISTENT_READ_IMAGEVIDEO = 1 623 } 624 625 /** 626 * Enumeration type of hide sensitive information. 627 * 628 * @enum { number } HideSensitiveType 629 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 630 * @systemapi 631 * @since 12 632 */ 633 enum HideSensitiveType { 634 /** 635 * Hide location information and shooting param. 636 * 637 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 638 * @systemapi 639 * @since 12 640 */ 641 HIDE_LOCATION_AND_SHOOTING_PARAM = 0, 642 643 /** 644 * Hide location information. 645 * 646 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 647 * @systemapi 648 * @since 12 649 */ 650 HIDE_LOCATION_ONLY = 1, 651 652 /** 653 * Hide shooting param. 654 * 655 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 656 * @systemapi 657 * @since 12 658 */ 659 HIDE_SHOOTING_PARAM_ONLY = 2, 660 661 /** 662 * Hide nothing. 663 * 664 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 665 * @systemapi 666 * @since 12 667 */ 668 NO_HIDE_SENSITIVE_TYPE = 3 669 } 670 671 /** 672 * Enumeration type of authorization mode. 673 * 674 * @enum { number } AuthorizationMode 675 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 676 * @systemapi 677 * @since 12 678 */ 679 enum AuthorizationMode { 680 /** 681 * Short time authorization. 682 * 683 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 684 * @systemapi 685 * @since 12 686 */ 687 SHORT_TIME_AUTHORIZATION = 0 688 } 689 690 /** 691 * Enumeration type of watermarktypes of photos 692 * 693 * @enum { number } WatermarkType 694 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 695 * @systemapi 696 * @since 14 697 */ 698 enum WatermarkType { 699 /** 700 * WatermarkType of Default 701 * 702 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 703 * @systemapi 704 * @since 14 705 */ 706 DEFAULT = 0, 707 708 /** 709 * WatermarkType of BRAND_COMMON 710 * 711 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 712 * @systemapi 713 * @since 14 714 */ 715 BRAND_COMMON = 1, 716 717 /** 718 * WatermarkType of COMMON 719 * 720 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 721 * @systemapi 722 * @since 14 723 */ 724 COMMON = 2, 725 726 /** 727 * WatermarkType of BRAND 728 * 729 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 730 * @systemapi 731 * @since 14 732 */ 733 BRAND = 3, 734 } 735 736 /** 737 * Enum: complete button text 738 * 739 * @enum { number } CompleteButtonText 740 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 741 * @atomicservice 742 * @since 14 743 */ 744 enum CompleteButtonText { 745 /** 746 * Complete button text: done 747 * 748 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 749 * @atomicservice 750 * @since 14 751 */ 752 TEXT_DONE = 0, 753 /** 754 * Complete button text: send 755 * 756 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 757 * @atomicservice 758 * @since 14 759 */ 760 TEXT_SEND = 1, 761 762 /** 763 * Complete button text: add 764 * 765 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 766 * @atomicservice 767 * @since 14 768 */ 769 TEXT_ADD = 2, 770 } 771 772 /** 773 * Options to request media asset 774 * 775 * @interface RequestOptions 776 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 777 * @since 11 778 */ 779 interface RequestOptions { 780 /** 781 * Indicates the delivery mode 782 * 783 * @type { DeliveryMode } 784 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 785 * @since 11 786 */ 787 deliveryMode: DeliveryMode; 788 789 /** 790 * Indicates the source mode 791 * 792 * @type { ?SourceMode } 793 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 794 * @systemapi 795 * @since 11 796 */ 797 sourceMode?: SourceMode 798 } 799 800 /** 801 * Media asset data handler 802 * 803 * @interface MediaAssetDataHandler 804 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 805 * @since 11 806 */ 807 interface MediaAssetDataHandler<T> { 808 /** 809 * Indicates required media asset data is prepared 810 * 811 * @param { T } data - the returned data of media asset 812 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 813 * @since 11 814 */ 815 /** 816 * Indicates required media asset data is prepared 817 * 818 * @param { T } data - the returned data of media asset 819 * @param { Map<string, string> } [map] - additional information for the data 820 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 821 * @since 12 822 */ 823 onDataPrepared(data: T, map?: Map<string, string>): void; 824 } 825 826 /** 827 * Data handler when quick request image is finished 828 * 829 * @typedef QuickImageDataHandler 830 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 831 * @since 13 832 */ 833 interface QuickImageDataHandler<T> { 834 /** 835 * Indicates required media asset data quickly is prepared 836 * 837 * @param { T } data - the returned data of picture 838 * @param { image.ImageSource } imageSource - the returned data of imageSource 839 * @param { Map<string, string> } map - additional information for the data 840 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 841 * @since 13 842 */ 843 onDataPrepared(data: T, imageSource: image.ImageSource, map: Map<string, string>): void; 844 } 845 846 /** 847 * Photo Proxy used to save image data 848 * 849 * @interface PhotoProxy 850 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 851 * @systemapi 852 * @since 11 853 */ 854 interface PhotoProxy {} 855 856 /** 857 * Media asset manager 858 * 859 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 860 * @since 11 861 */ 862 /** 863 * Media asset manager 864 * 865 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 866 * @atomicservice 867 * @since 14 868 */ 869 class MediaAssetManager { 870 /** 871 * Request image 872 * 873 * @permission ohos.permission.READ_IMAGEVIDEO 874 * @param { Context } context - Hap context information 875 * @param { PhotoAsset } asset - the photo asset requested 876 * @param { RequestOptions } requestOptions - the request options 877 * @param { MediaAssetDataHandler<image.ImageSource> } dataHandler - data handler used to obtain media asset data when ImageSource is prepared 878 * @returns { Promise<string> } Returns request id 879 * @throws { BusinessError } 201 - Permission denied 880 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 881 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 882 * @throws { BusinessError } 14000011 - System inner fail 883 * @static 884 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 885 * @since 11 886 */ 887 static requestImage( 888 context: Context, 889 asset: PhotoAsset, 890 requestOptions: RequestOptions, 891 dataHandler: MediaAssetDataHandler<image.ImageSource> 892 ): Promise<string>; 893 894 /** 895 * Quick request image 896 * 897 * @permission ohos.permission.READ_IMAGEVIDEO 898 * @param { Context } context - Hap context information 899 * @param { PhotoAsset } asset - the photo asset requested 900 * @param { RequestOptions } requestOptions - the request options 901 * @param { QuickImageDataHandler<image.Picture> } dataHandler - data handler used to obtain image data quickly when picture is prepared 902 * @returns { Promise<string> } Returns request id 903 * @throws { BusinessError } 201 - Permission denied 904 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 905 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 906 * @throws { BusinessError } 14000011 - Internal system error 907 * @static 908 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 909 * @since 13 910 */ 911 static quickRequestImage( 912 context: Context, 913 asset: PhotoAsset, 914 requestOptions: RequestOptions, 915 dataHandler: QuickImageDataHandler<image.Picture> 916 ): Promise<string>; 917 918 /** 919 * Request image data 920 * 921 * @permission ohos.permission.READ_IMAGEVIDEO 922 * @param { Context } context - Hap context information 923 * @param { PhotoAsset } asset - the photo asset requested 924 * @param { RequestOptions } requestOptions - the request options 925 * @param { MediaAssetDataHandler<ArrayBuffer> } dataHandler - data handler used obtain media asset data when data is prepared 926 * @returns { Promise<string> } Returns request id 927 * @throws { BusinessError } 201 - Permission denied 928 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 929 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 930 * @throws { BusinessError } 14000011 - System inner fail 931 * @static 932 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 933 * @since 11 934 */ 935 static requestImageData( 936 context: Context, 937 asset: PhotoAsset, 938 requestOptions: RequestOptions, 939 dataHandler: MediaAssetDataHandler<ArrayBuffer> 940 ): Promise<string>; 941 942 /** 943 * Request moving photo 944 * 945 * @permission ohos.permission.READ_IMAGEVIDEO 946 * @param { Context } context - Hap context information 947 * @param { PhotoAsset } asset - the photo asset requested 948 * @param { RequestOptions } requestOptions - the request options 949 * @param { MediaAssetDataHandler<MovingPhoto> } dataHandler - data handler used to obtain moving photo when data is prepared 950 * @returns { Promise<string> } Returns request id 951 * @throws { BusinessError } 201 - Permission denied 952 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 953 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 954 * @throws { BusinessError } 14000011 - System inner fail 955 * @static 956 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 957 * @since 12 958 */ 959 static requestMovingPhoto( 960 context: Context, 961 asset: PhotoAsset, 962 requestOptions: RequestOptions, 963 dataHandler: MediaAssetDataHandler<MovingPhoto> 964 ): Promise<string>; 965 966 /** 967 * Cancel request 968 * 969 * @permission ohos.permission.READ_IMAGEVIDEO 970 * @param { Context } context - Hap context information 971 * @param { string } requestId - the request id to be canceled 972 * @returns { Promise<void> } Returns void 973 * @throws { BusinessError } 201 - Permission denied 974 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 975 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 976 * @throws { BusinessError } 14000011 - System inner fail 977 * @static 978 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 979 * @since 12 980 */ 981 static cancelRequest(context: Context, requestId: string): Promise<void>; 982 983 /** 984 * Request video file 985 * 986 * @permission ohos.permission.READ_IMAGEVIDEO 987 * @param { Context } context - Hap context information 988 * @param { PhotoAsset } asset - the photo asset requested 989 * @param { RequestOptions } requestOptions - the request options 990 * @param { string } fileUri - the destination file uri to save the video data 991 * @param { MediaAssetDataHandler<boolean> } dataHandler - data handler used to notify the client that data has been written to the application sandbox 992 * @returns { Promise<string> } Returns request id 993 * @throws { BusinessError } 201 - Permission denied 994 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 995 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 996 * @throws { BusinessError } 14000011 - System inner fail 997 * @static 998 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 999 * @since 12 1000 */ 1001 static requestVideoFile( 1002 context: Context, 1003 asset: PhotoAsset, 1004 requestOptions: RequestOptions, 1005 fileUri: string, 1006 dataHandler: MediaAssetDataHandler<boolean> 1007 ): Promise<string>; 1008 1009 /** 1010 * Load moving photo 1011 * 1012 * @param { Context } context - Hap context information 1013 * @param { string } imageFileUri - image file uri of the moving photo to be loaded 1014 * @param { string } videoFileUri - video file uri of the moving photo to be loaded 1015 * @returns { Promise<MovingPhoto> } Returns moving photo 1016 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1017 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1018 * @throws { BusinessError } 14000011 - Internal system error 1019 * @static 1020 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1021 * @since 12 1022 */ 1023 /** 1024 * Load moving photo 1025 * 1026 * @param { Context } context - Hap context information 1027 * @param { string } imageFileUri - image file uri of the moving photo to be loaded 1028 * @param { string } videoFileUri - video file uri of the moving photo to be loaded 1029 * @returns { Promise<MovingPhoto> } Returns moving photo 1030 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1031 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1032 * @throws { BusinessError } 14000011 - Internal system error 1033 * @static 1034 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1035 * @atomicservice 1036 * @since 14 1037 */ 1038 static loadMovingPhoto( 1039 context: Context, 1040 imageFileUri: string, 1041 videoFileUri: string 1042 ): Promise<MovingPhoto>; 1043 } 1044 1045 /** 1046 * Indicates the type of photo asset member. 1047 * 1048 * @typedef { number | string | boolean } MemberType 1049 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1050 * @since 10 1051 */ 1052 /** 1053 * Indicates the type of photo asset member. 1054 * 1055 * @typedef { number | string | boolean } MemberType 1056 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1057 * @crossplatform 1058 * @since 12 1059 */ 1060 type MemberType = number | string | boolean; 1061 1062 /** 1063 * Defines the photo asset 1064 * 1065 * @interface PhotoAsset 1066 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1067 * @since 10 1068 */ 1069 /** 1070 * Defines the photo asset 1071 * 1072 * @interface PhotoAsset 1073 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1074 * @atomicservice 1075 * @since 11 1076 */ 1077 /** 1078 * Defines the photo asset 1079 * 1080 * @interface PhotoAsset 1081 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1082 * @crossplatform 1083 * @atomicservice 1084 * @since 12 1085 */ 1086 interface PhotoAsset { 1087 /** 1088 * uri of the asset. 1089 * 1090 * @type { string } 1091 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1092 * @since 10 1093 */ 1094 /** 1095 * uri of the asset. 1096 * 1097 * @type { string } 1098 * @readonly 1099 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1100 * @crossplatform 1101 * @atomicservice 1102 * @since 12 1103 */ 1104 readonly uri: string; 1105 /** 1106 * Photo type, image or video 1107 * 1108 * @type { PhotoType } 1109 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1110 * @since 10 1111 */ 1112 /** 1113 * Photo type, image or video 1114 * 1115 * @type { PhotoType } 1116 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1117 * @crossplatform 1118 * @since 12 1119 */ 1120 readonly photoType: PhotoType; 1121 /** 1122 * Display name (with a file name extension) of the asset. 1123 * 1124 * @type { string } 1125 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1126 * @since 10 1127 */ 1128 /** 1129 * Display name (with a file name extension) of the asset. 1130 * 1131 * @type { string } 1132 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1133 * @crossplatform 1134 * @since 12 1135 */ 1136 readonly displayName: string; 1137 /** 1138 * Returns the value of the specified member. 1139 * 1140 * @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE) 1141 * @returns { MemberType } Returns the value of the specified photo asset member 1142 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1143 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1144 * @throws { BusinessError } 13900020 - Invalid argument 1145 * @throws { BusinessError } 14000014 - Member is not a valid PhotoKey 1146 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1147 * @since 10 1148 */ 1149 /** 1150 * Returns the value of the specified member. 1151 * 1152 * @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE) 1153 * @returns { MemberType } Returns the value of the specified photo asset member 1154 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1155 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1156 * @throws { BusinessError } 13900020 - Invalid argument 1157 * @throws { BusinessError } 14000014 - Member is not a valid PhotoKey 1158 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1159 * @crossplatform 1160 * @since 12 1161 */ 1162 get(member: string): MemberType; 1163 /** 1164 * Set a new value to the specified member 1165 * 1166 * @param { string } member - Photo asset member 1167 * @param { string } value - The new value of the member. 1168 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1169 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1170 * @throws { BusinessError } 13900020 - Invalid argument 1171 * @throws { BusinessError } 14000014 - Member is not a valid PhotoKey 1172 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1173 * @since 10 1174 * @example : set(PhotoKeys.TITLE, "newTitle"), call commitModify after set 1175 */ 1176 set(member: string, value: string): void; 1177 /** 1178 * Modify metadata of the asset 1179 * 1180 * @permission ohos.permission.WRITE_IMAGEVIDEO 1181 * @param { AsyncCallback<void> } callback - Returns void. 1182 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1183 * <br>2. Incorrect parameter types. 1184 * @throws { BusinessError } 13900012 - Permission denied 1185 * @throws { BusinessError } 13900020 - Invalid argument 1186 * @throws { BusinessError } 14000001 - Invalid display name 1187 * @throws { BusinessError } 14000011 - System inner fail 1188 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1189 * @since 10 1190 */ 1191 /** 1192 * Modify metadata of the asset 1193 * 1194 * @permission ohos.permission.WRITE_IMAGEVIDEO 1195 * @param { AsyncCallback<void> } callback - Returns void. 1196 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1197 * <br>2. Incorrect parameter types. 1198 * @throws { BusinessError } 13900012 - Permission denied 1199 * @throws { BusinessError } 13900020 - Invalid argument 1200 * @throws { BusinessError } 14000001 - Invalid display name 1201 * @throws { BusinessError } 14000011 - System inner fail 1202 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1203 * @atomicservice 1204 * @since 11 1205 */ 1206 commitModify(callback: AsyncCallback<void>): void; 1207 /** 1208 * Modify metadata of the asset 1209 * 1210 * @permission ohos.permission.WRITE_IMAGEVIDEO 1211 * @returns { Promise<void> } Returns void 1212 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1213 * <br>2. Incorrect parameter types. 1214 * @throws { BusinessError } 13900012 - Permission denied 1215 * @throws { BusinessError } 13900020 - Invalid argument 1216 * @throws { BusinessError } 14000001 - Invalid display name 1217 * @throws { BusinessError } 14000011 - System inner fail 1218 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1219 * @since 10 1220 */ 1221 /** 1222 * Modify metadata of the asset 1223 * 1224 * @permission ohos.permission.WRITE_IMAGEVIDEO 1225 * @returns { Promise<void> } Returns void 1226 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1227 * <br>2. Incorrect parameter types. 1228 * @throws { BusinessError } 13900012 - Permission denied 1229 * @throws { BusinessError } 13900020 - Invalid argument 1230 * @throws { BusinessError } 14000001 - Invalid display name 1231 * @throws { BusinessError } 14000011 - System inner fail 1232 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1233 * @atomicservice 1234 * @since 11 1235 */ 1236 commitModify(): Promise<void>; 1237 /** 1238 * Open the asset 1239 * 1240 * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO 1241 * @param { string } mode - Mode for open, for example: rw, r, w. 1242 * @param { AsyncCallback<number> } callback - Callback return the fd of the asset. 1243 * @throws { BusinessError } 202 - Called by non-system application. 1244 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1245 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1246 * @throws { BusinessError } 13900012 - Permission denied 1247 * @throws { BusinessError } 13900020 - Invalid argument 1248 * @throws { BusinessError } 14000011 - System inner fail 1249 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1250 * @systemapi 1251 * @since 10 1252 * @deprecated since 11 1253 */ 1254 open(mode: string, callback: AsyncCallback<number>): void; 1255 /** 1256 * Open the asset 1257 * 1258 * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO 1259 * @param { string } mode - Mode for open, for example: rw, r, w. 1260 * @returns { Promise<number> } Returns the fd 1261 * @throws { BusinessError } 202 - Called by non-system application. 1262 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1263 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1264 * @throws { BusinessError } 13900012 - Permission denied 1265 * @throws { BusinessError } 13900020 - Invalid argument 1266 * @throws { BusinessError } 14000011 - System inner fail 1267 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1268 * @systemapi 1269 * @since 10 1270 * @deprecated since 11 1271 */ 1272 open(mode: string): Promise<number>; 1273 /** 1274 * Open the asset in read only mode 1275 * 1276 * @permission ohos.permission.READ_IMAGEVIDEO 1277 * @param { AsyncCallback<number> } callback - Returns the read only fd 1278 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1279 * <br>2. Incorrect parameter types. 1280 * @throws { BusinessError } 13900012 - Permission denied 1281 * @throws { BusinessError } 13900020 - Invalid argument 1282 * @throws { BusinessError } 14000011 - System inner fail 1283 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1284 * @since 10 1285 * @deprecated since 11 1286 */ 1287 getReadOnlyFd(callback: AsyncCallback<number>): void; 1288 /** 1289 * Open the asset in read only mode 1290 * 1291 * @permission ohos.permission.READ_IMAGEVIDEO 1292 * @returns { Promise<number> } Returns the read only fd 1293 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1294 * <br>2. Incorrect parameter types. 1295 * @throws { BusinessError } 13900012 - Permission denied 1296 * @throws { BusinessError } 13900020 - Invalid argument 1297 * @throws { BusinessError } 14000011 - System inner fail 1298 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1299 * @since 10 1300 * @deprecated since 11 1301 */ 1302 getReadOnlyFd(): Promise<number>; 1303 /** 1304 * Close the asset 1305 * 1306 * @param { number } fd - The opened fd of the asset. 1307 * @param { AsyncCallback<void> } callback - Returns void 1308 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1309 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1310 * @throws { BusinessError } 13900020 - Invalid argument 1311 * @throws { BusinessError } 14000011 - System inner fail 1312 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1313 * @since 10 1314 * @deprecated since 11 1315 */ 1316 close(fd: number, callback: AsyncCallback<void>): void; 1317 /** 1318 * Close the asset 1319 * 1320 * @param { number } fd - The opened fd of the asset. 1321 * @returns { Promise<void> } Returns void 1322 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1323 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1324 * @throws { BusinessError } 13900020 - Invalid argument 1325 * @throws { BusinessError } 14000011 - System inner fail 1326 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1327 * @since 10 1328 * @deprecated since 11 1329 */ 1330 close(fd: number): Promise<void>; 1331 /** 1332 * Get thumbnail of the asset 1333 * 1334 * @permission ohos.permission.READ_IMAGEVIDEO 1335 * @param { AsyncCallback<image.PixelMap> } callback - Returns the thumbnail's pixelMap. 1336 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1337 * <br>2. Incorrect parameter types. 1338 * @throws { BusinessError } 13900012 - Permission denied 1339 * @throws { BusinessError } 13900020 - Invalid argument 1340 * @throws { BusinessError } 14000011 - System inner fail 1341 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1342 * @since 10 1343 */ 1344 getThumbnail(callback: AsyncCallback<image.PixelMap>): void; 1345 /** 1346 * Get thumbnail of the asset 1347 * 1348 * @permission ohos.permission.READ_IMAGEVIDEO 1349 * @param { image.Size } size - Thumbnail's size 1350 * @param { AsyncCallback<image.PixelMap> } callback - Returns the thumbnail's pixelMap. 1351 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1352 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1353 * @throws { BusinessError } 13900012 - Permission denied 1354 * @throws { BusinessError } 13900020 - Invalid argument 1355 * @throws { BusinessError } 14000011 - System inner fail 1356 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1357 * @since 10 1358 */ 1359 getThumbnail(size: image.Size, callback: AsyncCallback<image.PixelMap>): void; 1360 /** 1361 * Get thumbnail of the asset 1362 * 1363 * @permission ohos.permission.READ_IMAGEVIDEO 1364 * @param { image.Size } [size] - Thumbnail's size 1365 * @returns { Promise<image.PixelMap> } Returns the thumbnail's pixelMap. 1366 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1367 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1368 * @throws { BusinessError } 13900012 - Permission denied 1369 * @throws { BusinessError } 13900020 - Invalid argument 1370 * @throws { BusinessError } 14000011 - System inner fail 1371 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1372 * @since 10 1373 */ 1374 getThumbnail(size?: image.Size): Promise<image.PixelMap>; 1375 /** 1376 * Set favorite state for the asset 1377 * 1378 * @permission ohos.permission.WRITE_IMAGEVIDEO 1379 * @param { boolean } favoriteState - true: Put the asset into favorite album; false: Remove the asset from favorite album. 1380 * @param { AsyncCallback<void> } callback - Returns void 1381 * @throws { BusinessError } 202 - Called by non-system application. 1382 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1383 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1384 * @throws { BusinessError } 13900012 - Permission denied 1385 * @throws { BusinessError } 13900020 - Invalid argument 1386 * @throws { BusinessError } 14000011 - System inner fail 1387 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1388 * @systemapi 1389 * @since 10 1390 * @deprecated since 11 1391 * @useinstead photoAccessHelper.MediaAssetChangeRequest#setFavorite 1392 */ 1393 setFavorite(favoriteState: boolean, callback: AsyncCallback<void>): void; 1394 /** 1395 * Set favorite state for the asset 1396 * 1397 * @permission ohos.permission.WRITE_IMAGEVIDEO 1398 * @param { boolean } favoriteState - true: Put the asset into favorite album; false: Remove the asset from favorite album. 1399 * @returns { Promise<void> } Returns void 1400 * @throws { BusinessError } 202 - Called by non-system application. 1401 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1402 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1403 * @throws { BusinessError } 13900012 - Permission denied 1404 * @throws { BusinessError } 13900020 - Invalid argument 1405 * @throws { BusinessError } 14000011 - System inner fail 1406 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1407 * @systemapi 1408 * @since 10 1409 * @deprecated since 11 1410 * @useinstead photoAccessHelper.MediaAssetChangeRequest#setFavorite 1411 */ 1412 setFavorite(favoriteState: boolean): Promise<void>; 1413 /** 1414 * Set asset hidden state. 1415 * 1416 * @permission ohos.permission.WRITE_IMAGEVIDEO 1417 * @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album. 1418 * @param { AsyncCallback<void> } callback - Returns void. 1419 * @throws { BusinessError } 202 - Called by non-system application. 1420 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1421 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1422 * @throws { BusinessError } 13900012 - Permission denied 1423 * @throws { BusinessError } 13900020 - Invalid argument 1424 * @throws { BusinessError } 14000011 - System inner fail 1425 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1426 * @systemapi 1427 * @since 10 1428 * @deprecated since 11 1429 * @useinstead photoAccessHelper.MediaAssetChangeRequest#setHidden 1430 */ 1431 setHidden(hiddenState: boolean, callback: AsyncCallback<void>): void; 1432 /** 1433 * Set asset hidden state. 1434 * 1435 * @permission ohos.permission.WRITE_IMAGEVIDEO 1436 * @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album. 1437 * @returns { Promise<void> } Returns void 1438 * @throws { BusinessError } 202 - Called by non-system application. 1439 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1440 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1441 * @throws { BusinessError } 13900012 - Permission denied 1442 * @throws { BusinessError } 13900020 - Invalid argument 1443 * @throws { BusinessError } 14000011 - System inner fail 1444 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1445 * @systemapi 1446 * @since 10 1447 * @deprecated since 11 1448 * @useinstead photoAccessHelper.MediaAssetChangeRequest#setHidden 1449 */ 1450 setHidden(hiddenState: boolean): Promise<void>; 1451 /** 1452 * Set user comment info to the asset. 1453 * 1454 * @permission ohos.permission.WRITE_IMAGEVIDEO 1455 * @param { string } userComment - user comment info 1456 * @param { AsyncCallback<void> } callback - Returns void. 1457 * @throws { BusinessError } 202 - Called by non-system application. 1458 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1459 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1460 * @throws { BusinessError } 13900012 - Permission denied 1461 * @throws { BusinessError } 13900020 - Invalid argument 1462 * @throws { BusinessError } 14000011 - System inner fail 1463 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1464 * @systemapi 1465 * @since 10 1466 * @deprecated since 11 1467 * @useinstead photoAccessHelper.MediaAssetChangeRequest#setUserComment 1468 */ 1469 setUserComment(userComment: string, callback: AsyncCallback<void>): void; 1470 /** 1471 * Set user comment info to the asset. 1472 * 1473 * @permission ohos.permission.WRITE_IMAGEVIDEO 1474 * @param { string } userComment - user comment info 1475 * @returns { Promise<void> } Returns void 1476 * @throws { BusinessError } 202 - Called by non-system application. 1477 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1478 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1479 * @throws { BusinessError } 13900012 - Permission denied 1480 * @throws { BusinessError } 13900020 - Invalid argument 1481 * @throws { BusinessError } 14000011 - System inner fail 1482 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1483 * @systemapi 1484 * @since 10 1485 * @deprecated since 11 1486 * @useinstead photoAccessHelper.MediaAssetChangeRequest#setUserComment 1487 */ 1488 setUserComment(userComment: string): Promise<void>; 1489 /** 1490 * Get exif info of the asset. 1491 * 1492 * @permission ohos.permission.READ_IMAGEVIDEO 1493 * @param { AsyncCallback<string> } callback - Returns exif info into a json string 1494 * @throws { BusinessError } 202 - Called by non-system application. 1495 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1496 * <br>2. Incorrect parameter types. 1497 * @throws { BusinessError } 13900012 - Permission denied 1498 * @throws { BusinessError } 13900020 - Invalid argument 1499 * @throws { BusinessError } 14000011 - System inner fail 1500 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1501 * @systemapi 1502 * @since 10 1503 */ 1504 getExif(callback: AsyncCallback<string>): void; 1505 /** 1506 * Get analysis data of the asset. 1507 * 1508 * @permission ohos.permission.READ_IMAGEVIDEO 1509 * @param { AnalysisType } analysisType - Analysis type 1510 * @returns { Promise<string> } Returns analysis info into a json string 1511 * @throws { BusinessError } 201 - Permission denied 1512 * @throws { BusinessError } 202 - Called by non-system application 1513 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1514 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1515 * @throws { BusinessError } 14000011 - System inner fail 1516 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1517 * @systemapi 1518 * @since 11 1519 */ 1520 getAnalysisData(analysisType: AnalysisType): Promise<string>; 1521 /** 1522 * Get exif info of the asset. 1523 * 1524 * @permission ohos.permission.READ_IMAGEVIDEO 1525 * @returns { Promise<string> } Returns exif info into a json string 1526 * @throws { BusinessError } 202 - Called by non-system application. 1527 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1528 * <br>2. Incorrect parameter types. 1529 * @throws { BusinessError } 13900012 - Permission denied 1530 * @throws { BusinessError } 13900020 - Invalid argument 1531 * @throws { BusinessError } 14000011 - System inner fail 1532 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1533 * @systemapi 1534 * @since 10 1535 */ 1536 getExif(): Promise<string>; 1537 /** 1538 * Set asset pending state. 1539 * 1540 * @permission ohos.permission.WRITE_IMAGEVIDEO 1541 * @param { boolean } pendingState - true: Set asset in pending status; false: Recover asset from pending status. 1542 * @param { AsyncCallback<void> } callback - Returns void 1543 * @throws { BusinessError } 201 - Permission denied 1544 * @throws { BusinessError } 202 - Called by non-system application. 1545 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1546 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1547 * @throws { BusinessError } 14000011 - System inner fail 1548 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1549 * @systemapi 1550 * @since 11 1551 */ 1552 setPending(pendingState: boolean, callback: AsyncCallback<void>): void; 1553 /** 1554 * Set asset pending state. 1555 * 1556 * @permission ohos.permission.WRITE_IMAGEVIDEO 1557 * @param { boolean } pendingState - true: Set asset in pending status; false: Recover asset from pending status. 1558 * @returns { Promise<void> } Returns void 1559 * @throws { BusinessError } 201 - Permission denied. 1560 * @throws { BusinessError } 202 - Called by non-system application. 1561 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1562 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1563 * @throws { BusinessError } 14000011 - System inner fail 1564 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1565 * @systemapi 1566 * @since 11 1567 */ 1568 setPending(pendingState: boolean): Promise<void>; 1569 /** 1570 * Check if asset has been edited. 1571 * 1572 * @permission ohos.permission.READ_IMAGEVIDEO 1573 * @param { AsyncCallback<boolean> } callback - Returns whether the asset has been edited. 1574 * @throws { BusinessError } 201 - Permission denied. 1575 * @throws { BusinessError } 202 - Called by non-system application. 1576 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1577 * <br>2. Incorrect parameter types. 1578 * @throws { BusinessError } 14000011 - System inner fail 1579 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1580 * @systemapi 1581 * @since 11 1582 */ 1583 isEdited(callback: AsyncCallback<boolean>): void; 1584 /** 1585 * Check if asset has been edited. 1586 * 1587 * @permission ohos.permission.READ_IMAGEVIDEO 1588 * @returns { Promise<boolean> } Returns whether the asset has been edited. 1589 * @throws { BusinessError } 201 - Permission denied. 1590 * @throws { BusinessError } 202 - Called by non-system application. 1591 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1592 * <br>2. Incorrect parameter types. 1593 * @throws { BusinessError } 14000011 - System inner fail 1594 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1595 * @systemapi 1596 * @since 11 1597 */ 1598 isEdited(): Promise<boolean>; 1599 /** 1600 * Request asset edit data. 1601 * 1602 * @permission ohos.permission.READ_IMAGEVIDEO 1603 * @param { AsyncCallback<string> } callback - Returns asset edit data. 1604 * @throws { BusinessError } 201 - Permission denied. 1605 * @throws { BusinessError } 202 - Called by non-system application. 1606 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1607 * <br>2. Incorrect parameter types. 1608 * @throws { BusinessError } 14000011 - System inner fail 1609 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1610 * @systemapi 1611 * @since 11 1612 */ 1613 requestEditData(callback: AsyncCallback<string>): void; 1614 /** 1615 * Request asset edit data. 1616 * 1617 * @permission ohos.permission.READ_IMAGEVIDEO 1618 * @returns { Promise<string> } Returns asset edit data. 1619 * @throws { BusinessError } 201 - Permission denied. 1620 * @throws { BusinessError } 202 - Called by non-system application. 1621 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1622 * <br>2. Incorrect parameter types. 1623 * @throws { BusinessError } 14000011 - System inner fail 1624 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1625 * @systemapi 1626 * @since 11 1627 */ 1628 requestEditData(): Promise<string>; 1629 /** 1630 * Get media asset edit data. 1631 * 1632 * @permission ohos.permission.READ_IMAGEVIDEO 1633 * @returns { Promise<MediaAssetEditData> } Returns media asset edit data 1634 * @throws { BusinessError } 201 - Permission denied 1635 * @throws { BusinessError } 202 - Called by non-system application 1636 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1637 * <br>2. Incorrect parameter types. 1638 * @throws { BusinessError } 14000011 - System inner fail 1639 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1640 * @systemapi 1641 * @since 11 1642 */ 1643 getEditData(): Promise<MediaAssetEditData>; 1644 /** 1645 * Clone asset. 1646 * 1647 * @permission ohos.permission.WRITE_IMAGEVIDEO 1648 * @param { string } title - The title of asset. 1649 * @returns { Promise<PhotoAsset> } Returns asset 1650 * @throws { BusinessError } 201 - Permission denied 1651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1652 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1653 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 1654 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 1655 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1656 * @since 14 1657 */ 1658 clone(title: string): Promise<PhotoAsset>; 1659 /** 1660 * Requests the read-only FD of the source asset. 1661 * 1662 * @permission ohos.permission.READ_IMAGEVIDEO 1663 * @param { AsyncCallback<number> } callback - Returns opened source asset fd. 1664 * @throws { BusinessError } 201 - Permission denied. 1665 * @throws { BusinessError } 202 - Called by non-system application. 1666 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1667 * <br>2. Incorrect parameter types. 1668 * @throws { BusinessError } 14000011 - System inner fail 1669 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1670 * @systemapi 1671 * @since 11 1672 */ 1673 requestSource(callback: AsyncCallback<number>): void; 1674 /** 1675 * Requests the read-only FD of the source asset. 1676 * 1677 * @permission ohos.permission.READ_IMAGEVIDEO 1678 * @returns { Promise<number> } Returns opened source asset fd. 1679 * @throws { BusinessError } 201 - Permission denied. 1680 * @throws { BusinessError } 202 - Called by non-system application. 1681 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1682 * <br>2. Incorrect parameter types. 1683 * @throws { BusinessError } 14000011 - System inner fail 1684 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1685 * @systemapi 1686 * @since 11 1687 */ 1688 requestSource(): Promise<number>; 1689 /** 1690 * Commit edit data and edited asset. 1691 * 1692 * @permission ohos.permission.WRITE_IMAGEVIDEO 1693 * @param { string } editData - editData to be saved. 1694 * @param { string } uri - uri of the edited asset within the applications's own sandbox. 1695 * @param { AsyncCallback<void> } callback - Returns void. 1696 * @throws { BusinessError } 201 - Permission denied. 1697 * @throws { BusinessError } 202 - Called by non-system application. 1698 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1699 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1700 * @throws { BusinessError } 14000011 - System inner fail 1701 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1702 * @systemapi 1703 * @since 11 1704 */ 1705 commitEditedAsset(editData: string, uri: string, callback: AsyncCallback<void>); 1706 /** 1707 * Commit edit data and edited asset. 1708 * 1709 * @permission ohos.permission.WRITE_IMAGEVIDEO 1710 * @param { string } editData - editData to be saved. 1711 * @param { string } uri - uri of the edited asset within the applications's own sandbox. 1712 * @returns { Promise<void> } Returns void. 1713 * @throws { BusinessError } 201 - Permission denied. 1714 * @throws { BusinessError } 202 - Called by non-system application. 1715 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1716 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1717 * @throws { BusinessError } 14000011 - System inner fail 1718 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1719 * @systemapi 1720 * @since 11 1721 */ 1722 commitEditedAsset(editData: string, uri: string): Promise<void>; 1723 /** 1724 * Revert asset edits to original state. 1725 * 1726 * @permission ohos.permission.WRITE_IMAGEVIDEO 1727 * @param { AsyncCallback<void> } callback - Returns void. 1728 * @throws { BusinessError } 201 - Permission denied. 1729 * @throws { BusinessError } 202 - Called by non-system application. 1730 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1731 * <br>2. Incorrect parameter types. 1732 * @throws { BusinessError } 14000011 - System inner fail 1733 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1734 * @systemapi 1735 * @since 11 1736 */ 1737 revertToOriginal(callback: AsyncCallback<void>); 1738 /** 1739 * Revert asset edits to original state. 1740 * 1741 * @permission ohos.permission.WRITE_IMAGEVIDEO 1742 * @returns { Promise<void> } Returns void. 1743 * @throws { BusinessError } 201 - Permission denied. 1744 * @throws { BusinessError } 202 - Called by non-system application. 1745 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1746 * <br>2. Incorrect parameter types. 1747 * @throws { BusinessError } 14000011 - System inner fail 1748 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1749 * @systemapi 1750 * @since 11 1751 */ 1752 revertToOriginal(): Promise<void>; 1753 /** 1754 * Request thumbnails of the asset. 1755 * 1756 * @permission ohos.permission.READ_IMAGEVIDEO 1757 * @param { AsyncCallback<image.PixelMap> } callback - Returns the required pixels 1758 * @returns { string } Returns request photo task id. 1759 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 1760 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 1761 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1762 * <br>2. Incorrect parameter types. 1763 * @throws { BusinessError } 14000011 - System inner fail 1764 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1765 * @systemapi 1766 * @since 11 1767 */ 1768 requestPhoto(callback: AsyncCallback<image.PixelMap>): string; 1769 /** 1770 * Request thumbnails of the asset. 1771 * 1772 * @permission ohos.permission.READ_IMAGEVIDEO 1773 * @param { RequestPhotoOptions } options - Request photo options 1774 * @param { AsyncCallback<image.PixelMap> } callback - Returns the required pixels 1775 * @returns { string } Returns request photo task id. 1776 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 1777 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 1778 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1779 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1780 * @throws { BusinessError } 14000011 - System inner fail 1781 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1782 * @systemapi 1783 * @since 11 1784 */ 1785 requestPhoto(options: RequestPhotoOptions, callback: AsyncCallback<image.PixelMap>): string; 1786 /** 1787 * Cancel photo request 1788 * 1789 * @permission ohos.permission.READ_IMAGEVIDEO 1790 * @param { string } requestId - The request id to be canceled 1791 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 1792 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 1793 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1794 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1795 * @throws { BusinessError } 14000011 - System inner fail 1796 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1797 * @systemapi 1798 * @since 11 1799 */ 1800 cancelPhotoRequest(requestId: string): void; 1801 /** 1802 * Fetch thumbnail of the video keyframe. 1803 * 1804 * @permission ohos.permission.READ_IMAGEVIDEO 1805 * @param { number } beginFrameTimeMs - Fetch the time position of the video frame. 1806 * @param { ThumbnailType } type - The type of thumbnail. 1807 * @returns { Promise<image.PixelMap> } Returns the thumbnail's pixelMap. 1808 * @throws { BusinessError } 201 - Permission denied 1809 * @throws { BusinessError } 202 - Called by non-system application 1810 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1811 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1812 * @throws { BusinessError } 14000011 - Internal system error 1813 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1814 * @systemapi 1815 * @since 14 1816 */ 1817 getKeyFrameThumbnail(beginFrameTimeMs: number, type: ThumbnailType): Promise<image.PixelMap>; 1818 } 1819 1820 /** 1821 * Enumeration of photo asset members 1822 * 1823 * @enum { string } PhotoKeys 1824 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1825 * @since 10 1826 */ 1827 /** 1828 * Enumeration of photo asset members 1829 * 1830 * @enum { string } PhotoKeys 1831 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1832 * @crossplatform 1833 * @since 12 1834 */ 1835 enum PhotoKeys { 1836 /** 1837 * Asset uri, read only 1838 * 1839 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1840 * @since 10 1841 */ 1842 /** 1843 * Asset uri, read only 1844 * 1845 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1846 * @crossplatform 1847 * @since 12 1848 */ 1849 URI = 'uri', 1850 /** 1851 * Photo type of the asset, read only 1852 * 1853 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1854 * @since 10 1855 */ 1856 /** 1857 * Photo type of the asset, read only 1858 * 1859 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1860 * @crossplatform 1861 * @since 12 1862 */ 1863 PHOTO_TYPE = 'media_type', 1864 /** 1865 * Asset name, read only 1866 * 1867 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1868 * @since 10 1869 */ 1870 /** 1871 * Asset name, read only 1872 * 1873 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1874 * @crossplatform 1875 * @since 12 1876 */ 1877 DISPLAY_NAME = 'display_name', 1878 /** 1879 * Size of the asset, read only 1880 * 1881 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1882 * @since 10 1883 */ 1884 /** 1885 * Size of the asset, read only 1886 * 1887 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1888 * @crossplatform 1889 * @since 12 1890 */ 1891 SIZE = 'size', 1892 /** 1893 * Creation date of the asset, read only 1894 * 1895 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1896 * @since 10 1897 */ 1898 /** 1899 * Creation date of the asset, read only 1900 * 1901 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1902 * @crossplatform 1903 * @since 12 1904 */ 1905 DATE_ADDED = 'date_added', 1906 /** 1907 * Modified date of the asset, read only 1908 * 1909 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1910 * @since 10 1911 */ 1912 /** 1913 * Modified date of the asset, read only 1914 * 1915 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1916 * @crossplatform 1917 * @since 12 1918 */ 1919 DATE_MODIFIED = 'date_modified', 1920 /** 1921 * Duration of video files, read only 1922 * 1923 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1924 * @since 10 1925 */ 1926 /** 1927 * Duration of video files, read only 1928 * 1929 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1930 * @crossplatform 1931 * @since 12 1932 */ 1933 DURATION = 'duration', 1934 /** 1935 * Width of the image asset, read only 1936 * 1937 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1938 * @since 10 1939 */ 1940 /** 1941 * Width of the image asset, read only 1942 * 1943 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1944 * @crossplatform 1945 * @since 12 1946 */ 1947 WIDTH = 'width', 1948 /** 1949 * Height of the image asset, read only 1950 * 1951 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1952 * @since 10 1953 */ 1954 /** 1955 * Height of the image asset, read only 1956 * 1957 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1958 * @crossplatform 1959 * @since 12 1960 */ 1961 HEIGHT = 'height', 1962 /** 1963 * Date taken of the asset, read only 1964 * 1965 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1966 * @since 10 1967 */ 1968 /** 1969 * Date taken of the asset, read only 1970 * 1971 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1972 * @crossplatform 1973 * @since 12 1974 */ 1975 DATE_TAKEN = 'date_taken', 1976 /** 1977 * Orientation of the image asset, read only 1978 * 1979 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1980 * @since 10 1981 */ 1982 /** 1983 * Orientation of the image asset, read only 1984 * 1985 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1986 * @crossplatform 1987 * @since 12 1988 */ 1989 ORIENTATION = 'orientation', 1990 /** 1991 * Favorite state of the asset, read only 1992 * 1993 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 1994 * @since 10 1995 */ 1996 /** 1997 * Favorite state of the asset, read only 1998 * 1999 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2000 * @crossplatform 2001 * @since 12 2002 */ 2003 FAVORITE = 'is_favorite', 2004 /** 2005 * Title of the asset 2006 * 2007 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2008 * @since 10 2009 */ 2010 /** 2011 * Title of the asset 2012 * 2013 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2014 * @crossplatform 2015 * @since 12 2016 */ 2017 TITLE = 'title', 2018 /** 2019 * Asset position, read only 2020 * 2021 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2022 * @systemapi 2023 * @since 10 2024 */ 2025 POSITION = 'position', 2026 /** 2027 * Trashed date of the asset, read only 2028 * 2029 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2030 * @systemapi 2031 * @since 10 2032 */ 2033 DATE_TRASHED = 'date_trashed', 2034 /** 2035 * Hidden state of the asset, read only 2036 * 2037 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2038 * @systemapi 2039 * @since 10 2040 */ 2041 HIDDEN = 'hidden', 2042 /** 2043 * User comment info 2044 * 2045 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2046 * @systemapi 2047 * @since 10 2048 */ 2049 USER_COMMENT = 'user_comment', 2050 /** 2051 * Camera shot key 2052 * 2053 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2054 * @systemapi 2055 * @since 10 2056 */ 2057 CAMERA_SHOT_KEY = 'camera_shot_key', 2058 /** 2059 * The year of the file created, read only 2060 * 2061 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2062 * @systemapi 2063 * @since 11 2064 */ 2065 DATE_YEAR = 'date_year', 2066 /** 2067 * The month of the file created, read only 2068 * 2069 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2070 * @systemapi 2071 * @since 11 2072 */ 2073 DATE_MONTH = 'date_month', 2074 /** 2075 * The day of the file created, read only 2076 * 2077 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2078 * @systemapi 2079 * @since 11 2080 */ 2081 DATE_DAY = 'date_day', 2082 /** 2083 * Pending state of the asset, true means asset is pending, read only 2084 * 2085 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2086 * @systemapi 2087 * @since 11 2088 */ 2089 PENDING = 'pending', 2090 /** 2091 * Creation time of the asset in milliseconds, read only 2092 * 2093 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2094 * @since 12 2095 */ 2096 DATE_ADDED_MS = 'date_added_ms', 2097 /** 2098 * Modified time of the asset in milliseconds, read only 2099 * 2100 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2101 * @since 12 2102 */ 2103 DATE_MODIFIED_MS = 'date_modified_ms', 2104 /** 2105 * Trashed time of the asset in milliseconds, read only 2106 * 2107 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2108 * @systemapi 2109 * @since 12 2110 */ 2111 DATE_TRASHED_MS = 'date_trashed_ms', 2112 /** 2113 * Photo subtype of the asset, read only 2114 * 2115 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2116 * @since 12 2117 */ 2118 PHOTO_SUBTYPE = 'subtype', 2119 /** 2120 * Effect mode of moving photo, read only 2121 * 2122 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2123 * @systemapi 2124 * @since 12 2125 */ 2126 MOVING_PHOTO_EFFECT_MODE = 'moving_photo_effect_mode', 2127 /** 2128 * Cover position of the asset, read only 2129 * 2130 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2131 * @since 12 2132 */ 2133 COVER_POSITION = 'cover_position', 2134 /** 2135 * Dynamic range type of the asset, read only 2136 * 2137 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2138 * @since 12 2139 */ 2140 DYNAMIC_RANGE_TYPE = 'dynamic_range_type', 2141 /** 2142 * Unique uuid of the burst photos, read only 2143 * 2144 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2145 * @since 12 2146 */ 2147 BURST_KEY = 'burst_key', 2148 /** 2149 * Thumbnail of photo asset has been ready, read only 2150 * 2151 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2152 * @systemapi 2153 * @since 13 2154 */ 2155 THUMBNAIL_READY = 'thumbnail_ready', 2156 /** 2157 * Width and height information of lcd picture, read only 2158 * 2159 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2160 * @since 12 2161 */ 2162 LCD_SIZE = 'lcd_size', 2163 /** 2164 * Width and height information of thumbnail picture, read only 2165 * 2166 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2167 * @since 12 2168 */ 2169 THM_SIZE = 'thm_size', 2170 /** 2171 * Detail time of the asset, read only 2172 * 2173 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2174 * @since 13 2175 */ 2176 DETAIL_TIME = 'detail_time', 2177 /** 2178 * Date taken of the asset in milliseconds, read only 2179 * 2180 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2181 * @since 13 2182 */ 2183 DATE_TAKEN_MS = 'date_taken_ms', 2184 /** 2185 * Cloud enhancement status of the asset, read only 2186 * 2187 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2188 * @systemapi 2189 * @since 13 2190 */ 2191 CE_AVAILABLE = 'ce_available', 2192 /** 2193 * watermark type of the asset, read only 2194 * 2195 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2196 * @systemapi 2197 * @since 14 2198 */ 2199 SUPPORTED_WATERMARK_TYPE = 'supported_watermark_type', 2200 /** 2201 * visibility of thumbnails 2202 * 2203 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2204 * @systemapi 2205 * @since 14 2206 */ 2207 THUMBNAIL_VISIBLE = 'thumbnail_visible' 2208 2209 } 2210 2211 /** 2212 * Enumeration of photo album members. 2213 * 2214 * @enum { string } AlbumKeys 2215 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2216 * @since 10 2217 */ 2218 /** 2219 * Enumeration of photo album members. 2220 * 2221 * @enum { string } AlbumKeys 2222 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2223 * @crossplatform 2224 * @since 12 2225 */ 2226 enum AlbumKeys { 2227 /** 2228 * Album uri 2229 * 2230 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2231 * @since 10 2232 */ 2233 /** 2234 * Album uri 2235 * 2236 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2237 * @crossplatform 2238 * @since 12 2239 */ 2240 URI = 'uri', 2241 /** 2242 * Album name 2243 * 2244 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2245 * @since 10 2246 */ 2247 /** 2248 * Album name 2249 * 2250 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2251 * @crossplatform 2252 * @since 12 2253 */ 2254 ALBUM_NAME = 'album_name' 2255 } 2256 2257 /** 2258 * Enumeration of mode for displaying albums containing hidden assets 2259 * 2260 * @enum { number } HiddenPhotosDisplayMode 2261 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2262 * @systemapi 2263 * @since 11 2264 */ 2265 enum HiddenPhotosDisplayMode { 2266 /** 2267 * Display the system hidden album that contains all the hidden assets. 2268 * 2269 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2270 * @systemapi 2271 * @since 11 2272 */ 2273 ASSETS_MODE, 2274 /** 2275 * Display all albums containing hidden assets(excluding the system hidden album and the system trash album). 2276 * 2277 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2278 * @systemapi 2279 * @since 11 2280 */ 2281 ALBUMS_MODE 2282 } 2283 2284 /** 2285 * Options to fetch assets or albums 2286 * 2287 * @interface FetchOptions 2288 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2289 * @since 10 2290 */ 2291 /** 2292 * Options to fetch assets or albums 2293 * 2294 * @interface FetchOptions 2295 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2296 * @crossplatform 2297 * @since 12 2298 */ 2299 interface FetchOptions { 2300 /** 2301 * Indicates the members to query. 2302 * 2303 * @type { Array<string> } 2304 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2305 * @since 10 2306 */ 2307 /** 2308 * Indicates the members to query. 2309 * 2310 * @type { Array<string> } 2311 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2312 * @crossplatform 2313 * @since 12 2314 */ 2315 fetchColumns: Array<string>; 2316 /** 2317 * Predicates to query 2318 * 2319 * @type { dataSharePredicates.DataSharePredicates } 2320 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2321 * @since 10 2322 */ 2323 /** 2324 * Predicates to query 2325 * 2326 * @type { dataSharePredicates.DataSharePredicates } 2327 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2328 * @crossplatform 2329 * @since 12 2330 */ 2331 predicates: dataSharePredicates.DataSharePredicates; 2332 } 2333 2334 /** 2335 * Options to create a photo asset for system apps 2336 * 2337 * @interface PhotoCreateOptions 2338 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2339 * @systemapi 2340 * @since 10 2341 */ 2342 interface PhotoCreateOptions { 2343 /** 2344 * Specify subtype of the asset to create 2345 * 2346 * @type { ?PhotoSubtype } 2347 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2348 * @systemapi 2349 * @since 10 2350 */ 2351 subtype?: PhotoSubtype; 2352 /** 2353 * Camera shot key 2354 * 2355 * @type { ?string } 2356 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2357 * @systemapi 2358 * @since 10 2359 */ 2360 cameraShotKey?: string; 2361 } 2362 2363 /** 2364 * Config to create photo asset 2365 * 2366 * @interface PhotoCreationConfig 2367 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2368 * @atomicservice 2369 * @since 12 2370 */ 2371 interface PhotoCreationConfig { 2372 /** 2373 * Title of the asset 2374 * 2375 * @type { ?string } 2376 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2377 * @atomicservice 2378 * @since 12 2379 */ 2380 title?: string; 2381 2382 /** 2383 * Extension of the asset 2384 * 2385 * @type { string } 2386 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2387 * @atomicservice 2388 * @since 12 2389 */ 2390 fileNameExtension: string; 2391 2392 /** 2393 * Specify photo type of the asset to create, include image or video 2394 * 2395 * @type { PhotoType } 2396 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2397 * @atomicservice 2398 * @since 12 2399 */ 2400 photoType: PhotoType; 2401 2402 /** 2403 * Specify photo subtype of the asset to create, include default or moving_photo 2404 * 2405 * @type { ?PhotoSubtype } 2406 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2407 * @atomicservice 2408 * @since 12 2409 */ 2410 subtype?: PhotoSubtype; 2411 } 2412 2413 /** 2414 * Options to create a photo asset 2415 * 2416 * @interface CreateOptions 2417 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2418 * @since 10 2419 */ 2420 /** 2421 * Options to create a photo asset 2422 * 2423 * @interface CreateOptions 2424 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2425 * @atomicservice 2426 * @since 11 2427 */ 2428 interface CreateOptions { 2429 /** 2430 * Title of the asset 2431 * 2432 * @type { ?string } 2433 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2434 * @since 10 2435 */ 2436 /** 2437 * Title of the asset 2438 * 2439 * @type { ?string } 2440 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2441 * @atomicservice 2442 * @since 11 2443 */ 2444 title?: string; 2445 /** 2446 * Specify subtype of the asset to create 2447 * 2448 * @type { ?PhotoSubtype } 2449 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2450 * @atomicservice 2451 * @since 12 2452 */ 2453 subtype?: PhotoSubtype; 2454 } 2455 2456 /** 2457 * Options to request photo 2458 * 2459 * @interface RequestPhotoOptions 2460 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2461 * @systemapi 2462 * @since 11 2463 */ 2464 interface RequestPhotoOptions { 2465 /** 2466 * Size of thumbnail 2467 * 2468 * @type { ?image.Size } 2469 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2470 * @systemapi 2471 * @since 11 2472 */ 2473 size?: image.Size; 2474 /** 2475 * Type of photo request 2476 * 2477 * @type { ?RequestPhotoType } 2478 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2479 * @systemapi 2480 * @since 11 2481 */ 2482 requestPhotoType?: RequestPhotoType; 2483 } 2484 2485 /** 2486 * The fetch result of assets or albums 2487 * 2488 * @interface FetchResult 2489 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2490 * @since 10 2491 */ 2492 /** 2493 * The fetch result of assets or albums 2494 * 2495 * @interface FetchResult 2496 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2497 * @crossplatform 2498 * @since 12 2499 */ 2500 interface FetchResult<T> { 2501 /** 2502 * Obtains the total number of objects in the fetch result. 2503 * 2504 * @returns { number } Total number of objects. 2505 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2506 * <br>2. Incorrect parameter types. 2507 * @throws { BusinessError } 13900020 - Invalid argument 2508 * @throws { BusinessError } 14000011 - System inner fail 2509 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2510 * @since 10 2511 */ 2512 /** 2513 * Obtains the total number of objects in the fetch result. 2514 * 2515 * @returns { number } Total number of objects. 2516 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2517 * <br>2. Incorrect parameter types. 2518 * @throws { BusinessError } 13900020 - Invalid argument 2519 * @throws { BusinessError } 14000011 - System inner fail 2520 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2521 * @crossplatform 2522 * @since 12 2523 */ 2524 getCount(): number; 2525 /** 2526 * Checks whether the result set points to the last row. 2527 * You need to check whether the object is the last one before calling getNextObject. 2528 * 2529 * @returns { boolean } Whether the object is the last one in the fetch result. 2530 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2531 * <br>2. Incorrect parameter types. 2532 * @throws { BusinessError } 13900020 - Invalid argument 2533 * @throws { BusinessError } 14000011 - System inner fail 2534 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2535 * @since 10 2536 */ 2537 /** 2538 * Checks whether the result set points to the last row. 2539 * You need to check whether the object is the last one before calling getNextObject. 2540 * 2541 * @returns { boolean } Whether the object is the last one in the fetch result. 2542 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2543 * <br>2. Incorrect parameter types. 2544 * @throws { BusinessError } 13900020 - Invalid argument 2545 * @throws { BusinessError } 14000011 - System inner fail 2546 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2547 * @crossplatform 2548 * @since 12 2549 */ 2550 isAfterLast(): boolean; 2551 /** 2552 * Obtains the first object in the fetch result. 2553 * 2554 * @param { AsyncCallback<T> } callback - Returns the first object in the fetch result. 2555 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2556 * <br>2. Incorrect parameter types. 2557 * @throws { BusinessError } 13900020 - Invalid argument 2558 * @throws { BusinessError } 14000011 - System inner fail 2559 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2560 * @since 10 2561 */ 2562 /** 2563 * Obtains the first object in the fetch result. 2564 * 2565 * @param { AsyncCallback<T> } callback - Returns the first object in the fetch result. 2566 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2567 * <br>2. Incorrect parameter types. 2568 * @throws { BusinessError } 13900020 - Invalid argument 2569 * @throws { BusinessError } 14000011 - System inner fail 2570 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2571 * @crossplatform 2572 * @since 12 2573 */ 2574 getFirstObject(callback: AsyncCallback<T>): void; 2575 /** 2576 * Obtains the first object in the fetch result. 2577 * 2578 * @returns { Promise<T> } Returns the first object in the fetch result. 2579 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2580 * <br>2. Incorrect parameter types. 2581 * @throws { BusinessError } 13900020 - Invalid argument 2582 * @throws { BusinessError } 14000011 - System inner fail 2583 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2584 * @since 10 2585 */ 2586 /** 2587 * Obtains the first object in the fetch result. 2588 * 2589 * @returns { Promise<T> } Returns the first object in the fetch result. 2590 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2591 * <br>2. Incorrect parameter types. 2592 * @throws { BusinessError } 13900020 - Invalid argument 2593 * @throws { BusinessError } 14000011 - System inner fail 2594 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2595 * @crossplatform 2596 * @since 12 2597 */ 2598 getFirstObject(): Promise<T>; 2599 /** 2600 * Obtains the next object in the fetch result. 2601 * Before calling this method, you must use isAfterLast() to check whether the current position is the last row 2602 * in the fetch result. This method only works when the current position is not the last row. 2603 * 2604 * @param { AsyncCallback<T> } callback - Returns the next object 2605 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2606 * <br>2. Incorrect parameter types. 2607 * @throws { BusinessError } 13900020 - Invalid argument 2608 * @throws { BusinessError } 14000011 - System inner fail 2609 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2610 * @since 10 2611 */ 2612 /** 2613 * Obtains the next object in the fetch result. 2614 * Before calling this method, you must use isAfterLast() to check whether the current position is the last row 2615 * in the fetch result. This method only works when the current position is not the last row. 2616 * 2617 * @param { AsyncCallback<T> } callback - Returns the next object 2618 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2619 * <br>2. Incorrect parameter types. 2620 * @throws { BusinessError } 13900020 - Invalid argument 2621 * @throws { BusinessError } 14000011 - System inner fail 2622 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2623 * @crossplatform 2624 * @since 12 2625 */ 2626 getNextObject(callback: AsyncCallback<T>): void; 2627 /** 2628 * Obtains the next object in the fetch result. 2629 * Before calling this method, you must use isAfterLast() to check whether the current position is the last row 2630 * in the fetch result. This method only works when the current position is not the last row. 2631 * 2632 * @returns { Promise<T> } Returns the next object 2633 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2634 * <br>2. Incorrect parameter types. 2635 * @throws { BusinessError } 13900020 - Invalid argument 2636 * @throws { BusinessError } 14000011 - System inner fail 2637 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2638 * @since 10 2639 */ 2640 /** 2641 * Obtains the next object in the fetch result. 2642 * Before calling this method, you must use isAfterLast() to check whether the current position is the last row 2643 * in the fetch result. This method only works when the current position is not the last row. 2644 * 2645 * @returns { Promise<T> } Returns the next object 2646 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2647 * <br>2. Incorrect parameter types. 2648 * @throws { BusinessError } 13900020 - Invalid argument 2649 * @throws { BusinessError } 14000011 - System inner fail 2650 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2651 * @crossplatform 2652 * @since 12 2653 */ 2654 getNextObject(): Promise<T>; 2655 /** 2656 * Obtains the last object in the fetch result 2657 * 2658 * @param { AsyncCallback<T> } callback - Returns the last object 2659 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2660 * <br>2. Incorrect parameter types. 2661 * @throws { BusinessError } 13900020 - Invalid argument 2662 * @throws { BusinessError } 14000011 - System inner fail 2663 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2664 * @since 10 2665 */ 2666 /** 2667 * Obtains the last object in the fetch result 2668 * 2669 * @param { AsyncCallback<T> } callback - Returns the last object 2670 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2671 * <br>2. Incorrect parameter types. 2672 * @throws { BusinessError } 13900020 - Invalid argument 2673 * @throws { BusinessError } 14000011 - System inner fail 2674 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2675 * @crossplatform 2676 * @since 12 2677 */ 2678 getLastObject(callback: AsyncCallback<T>): void; 2679 /** 2680 * Obtains the last object in the fetch result 2681 * 2682 * @returns { Promise<T> } Returns the last object 2683 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2684 * <br>2. Incorrect parameter types. 2685 * @throws { BusinessError } 13900020 - Invalid argument 2686 * @throws { BusinessError } 14000011 - System inner fail 2687 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2688 * @since 10 2689 */ 2690 /** 2691 * Obtains the last object in the fetch result 2692 * 2693 * @returns { Promise<T> } Returns the last object 2694 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2695 * <br>2. Incorrect parameter types. 2696 * @throws { BusinessError } 13900020 - Invalid argument 2697 * @throws { BusinessError } 14000011 - System inner fail 2698 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2699 * @crossplatform 2700 * @since 12 2701 */ 2702 getLastObject(): Promise<T>; 2703 /** 2704 * Obtains the object with the specified index in the fetch result. 2705 * 2706 * @param { number } index - Index of the object to obtain. 2707 * @param { AsyncCallback<T> } callback - Returns the object 2708 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2709 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2710 * @throws { BusinessError } 13900020 - Invalid argument 2711 * @throws { BusinessError } 14000011 - System inner fail 2712 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2713 * @since 10 2714 */ 2715 /** 2716 * Obtains the object with the specified index in the fetch result. 2717 * 2718 * @param { number } index - Index of the object to obtain. 2719 * @param { AsyncCallback<T> } callback - Returns the object 2720 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2721 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2722 * @throws { BusinessError } 13900020 - Invalid argument 2723 * @throws { BusinessError } 14000011 - System inner fail 2724 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2725 * @crossplatform 2726 * @since 12 2727 */ 2728 getObjectByPosition(index: number, callback: AsyncCallback<T>): void; 2729 /** 2730 * Obtains the object with the specified index in the fetch result. 2731 * 2732 * @param { number } index - Index of the asset to obtain. 2733 * @returns { Promise<T> } Returns the object 2734 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2735 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2736 * @throws { BusinessError } 13900020 - Invalid argument 2737 * @throws { BusinessError } 14000011 - System inner fail 2738 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2739 * @since 10 2740 */ 2741 /** 2742 * Obtains the object with the specified index in the fetch result. 2743 * 2744 * @param { number } index - Index of the asset to obtain. 2745 * @returns { Promise<T> } Returns the object 2746 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2747 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2748 * @throws { BusinessError } 13900020 - Invalid argument 2749 * @throws { BusinessError } 14000011 - System inner fail 2750 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2751 * @crossplatform 2752 * @since 12 2753 */ 2754 getObjectByPosition(index: number): Promise<T>; 2755 /** 2756 * Obtains all objects in the fetch result. 2757 * 2758 * @param { AsyncCallback<Array<T>> } callback - Returns all the objects 2759 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2760 * <br>2. Incorrect parameter types. 2761 * @throws { BusinessError } 13900020 - Invalid argument 2762 * @throws { BusinessError } 14000011 - System inner fail 2763 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2764 * @since 10 2765 */ 2766 /** 2767 * Obtains all objects in the fetch result. 2768 * 2769 * @param { AsyncCallback<Array<T>> } callback - Returns all the objects 2770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2771 * <br>2. Incorrect parameter types. 2772 * @throws { BusinessError } 13900020 - Invalid argument 2773 * @throws { BusinessError } 14000011 - System inner fail 2774 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2775 * @crossplatform 2776 * @since 12 2777 */ 2778 getAllObjects(callback: AsyncCallback<Array<T>>): void; 2779 /** 2780 * Obtains all objects in the fetch result. 2781 * 2782 * @returns { Promise<Array<T>> } Returns all the objects 2783 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2784 * <br>2. Incorrect parameter types. 2785 * @throws { BusinessError } 13900020 - Invalid argument 2786 * @throws { BusinessError } 14000011 - System inner fail 2787 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2788 * @since 10 2789 */ 2790 /** 2791 * Obtains all objects in the fetch result. 2792 * 2793 * @returns { Promise<Array<T>> } Returns all the objects 2794 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2795 * <br>2. Incorrect parameter types. 2796 * @throws { BusinessError } 13900020 - Invalid argument 2797 * @throws { BusinessError } 14000011 - System inner fail 2798 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2799 * @crossplatform 2800 * @since 12 2801 */ 2802 getAllObjects(): Promise<Array<T>>; 2803 /** 2804 * Releases the fetch result. 2805 * 2806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2807 * <br>2. Incorrect parameter types. 2808 * @throws { BusinessError } 13900020 - Invalid argument 2809 * @throws { BusinessError } 14000011 - System inner fail 2810 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2811 * @since 10 2812 */ 2813 /** 2814 * Releases the fetch result. 2815 * 2816 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2817 * <br>2. Incorrect parameter types. 2818 * @throws { BusinessError } 13900020 - Invalid argument 2819 * @throws { BusinessError } 14000011 - System inner fail 2820 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2821 * @crossplatform 2822 * @since 12 2823 */ 2824 close(): void; 2825 } 2826 2827 /** 2828 * Album type. 2829 * 2830 * @enum { number } AlbumType 2831 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2832 * @since 10 2833 */ 2834 /** 2835 * Album type. 2836 * 2837 * @enum { number } AlbumType 2838 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2839 * @crossplatform 2840 * @since 12 2841 */ 2842 enum AlbumType { 2843 /** 2844 * Album created by user. 2845 * 2846 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2847 * @since 10 2848 */ 2849 /** 2850 * Album created by user. 2851 * 2852 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2853 * @crossplatform 2854 * @since 12 2855 */ 2856 USER = 0, 2857 /** 2858 * Album created by system, which metadata cannot be modified. 2859 * 2860 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2861 * @since 10 2862 */ 2863 /** 2864 * Album created by system, which metadata cannot be modified. 2865 * 2866 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2867 * @crossplatform 2868 * @since 12 2869 */ 2870 SYSTEM = 1024, 2871 /** 2872 * Album created by smart abilities. 2873 * 2874 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2875 * @systemapi 2876 * @since 11 2877 */ 2878 SMART = 4096 2879 } 2880 2881 /** 2882 * Album subtype 2883 * 2884 * @enum { number } AlbumSubtype 2885 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2886 * @since 10 2887 */ 2888 /** 2889 * Album subtype 2890 * 2891 * @enum { number } AlbumSubtype 2892 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2893 * @crossplatform 2894 * @since 12 2895 */ 2896 enum AlbumSubtype { 2897 /** 2898 * Generic user-created albums. 2899 * 2900 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2901 * @since 10 2902 */ 2903 /** 2904 * Generic user-created albums. 2905 * 2906 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2907 * @crossplatform 2908 * @since 12 2909 */ 2910 USER_GENERIC = 1, 2911 /** 2912 * Favorite album, which assets are marked as favorite. 2913 * 2914 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2915 * @since 10 2916 */ 2917 /** 2918 * Favorite album, which assets are marked as favorite. 2919 * 2920 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2921 * @crossplatform 2922 * @since 12 2923 */ 2924 FAVORITE = 1025, 2925 /** 2926 * Video album, which contains all video assets. 2927 * 2928 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2929 * @since 10 2930 */ 2931 /** 2932 * Video album, which contains all video assets. 2933 * 2934 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2935 * @crossplatform 2936 * @since 12 2937 */ 2938 VIDEO, 2939 /** 2940 * Hidden album, which assets are marked as hidden. 2941 * 2942 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2943 * @systemapi 2944 * @since 10 2945 */ 2946 HIDDEN, 2947 /** 2948 * Trash album, which assets are deleted. 2949 * 2950 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2951 * @systemapi 2952 * @since 10 2953 */ 2954 TRASH, 2955 /** 2956 * Screenshot album 2957 * 2958 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2959 * @systemapi 2960 * @since 10 2961 */ 2962 SCREENSHOT, 2963 /** 2964 * Camera album 2965 * 2966 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2967 * @systemapi 2968 * @since 10 2969 */ 2970 CAMERA, 2971 /** 2972 * Image album 2973 * 2974 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2975 * @systemapi 2976 * @since 11 2977 */ 2978 /** 2979 * Image album 2980 * 2981 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2982 * @since 12 2983 */ 2984 IMAGE = 1031, 2985 /** 2986 * Cloud Enhancement album 2987 * 2988 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2989 * @systemapi 2990 * @since 13 2991 */ 2992 CLOUD_ENHANCEMENT = 1032, 2993 /** 2994 * Source album 2995 * 2996 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 2997 * @systemapi 2998 * @since 11 2999 */ 3000 SOURCE_GENERIC = 2049, 3001 /** 3002 * Classify album 3003 * 3004 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3005 * @systemapi 3006 * @since 11 3007 */ 3008 CLASSIFY = 4097, 3009 /** 3010 * Location album 3011 * 3012 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3013 * @systemapi 3014 * @since 11 3015 */ 3016 GEOGRAPHY_LOCATION = 4099, 3017 /** 3018 * City album 3019 * 3020 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3021 * @systemapi 3022 * @since 11 3023 */ 3024 GEOGRAPHY_CITY, 3025 /** 3026 * ShootingMode album 3027 * 3028 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3029 * @systemapi 3030 * @since 11 3031 */ 3032 SHOOTING_MODE, 3033 /** 3034 * Portrait album 3035 * 3036 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3037 * @systemapi 3038 * @since 11 3039 */ 3040 PORTRAIT, 3041 /** 3042 * Group photo album 3043 * 3044 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3045 * @systemapi 3046 * @since 13 3047 */ 3048 GROUP_PHOTO, 3049 /** 3050 * Highlight album 3051 * 3052 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3053 * @systemapi 3054 * @since 12 3055 */ 3056 HIGHLIGHT = 4104, 3057 /** 3058 * Highlight suggestions album 3059 * 3060 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3061 * @systemapi 3062 * @since 12 3063 */ 3064 HIGHLIGHT_SUGGESTIONS, 3065 /** 3066 * Any album 3067 * 3068 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3069 * @since 10 3070 */ 3071 /** 3072 * Any album 3073 * 3074 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3075 * @crossplatform 3076 * @since 12 3077 */ 3078 ANY = 2147483647 3079 } 3080 3081 /** 3082 * Request photo type. 3083 * 3084 * @enum { number } RequestPhotoType 3085 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3086 * @systemapi 3087 * @since 11 3088 */ 3089 enum RequestPhotoType { 3090 /** 3091 * Request all thumbnails: fast thumbnail and quality thumbnail 3092 * 3093 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3094 * @systemapi 3095 * @since 11 3096 */ 3097 REQUEST_ALL_THUMBNAILS = 0, 3098 /** 3099 * Only request fast thumbnail 3100 * 3101 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3102 * @systemapi 3103 * @since 11 3104 */ 3105 REQUEST_FAST_THUMBNAIL, 3106 /** 3107 * Only request quality thumbnail 3108 * 3109 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3110 * @systemapi 3111 * @since 11 3112 */ 3113 REQUEST_QUALITY_THUMBNAIL 3114 } 3115 3116 /** 3117 * Defines the abstract interface of albums. 3118 * 3119 * @interface AbsAlbum 3120 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3121 * @since 10 3122 */ 3123 /** 3124 * Defines the abstract interface of albums. 3125 * 3126 * @interface AbsAlbum 3127 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3128 * @crossplatform 3129 * @since 12 3130 */ 3131 interface AbsAlbum { 3132 /** 3133 * Album type 3134 * 3135 * @type { AlbumType } 3136 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3137 * @since 10 3138 */ 3139 /** 3140 * Album type 3141 * 3142 * @type { AlbumType } 3143 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3144 * @crossplatform 3145 * @since 12 3146 */ 3147 readonly albumType: AlbumType; 3148 /** 3149 * Album subtype 3150 * 3151 * @type { AlbumSubtype } 3152 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3153 * @since 10 3154 */ 3155 /** 3156 * Album subtype 3157 * 3158 * @type { AlbumSubtype } 3159 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3160 * @crossplatform 3161 * @since 12 3162 */ 3163 readonly albumSubtype: AlbumSubtype; 3164 /** 3165 * Album name. 3166 * 3167 * @type { string } 3168 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3169 * @since 10 3170 */ 3171 /** 3172 * Album name. 3173 * 3174 * @type { string } 3175 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3176 * @crossplatform 3177 * @since 12 3178 */ 3179 albumName: string; 3180 /** 3181 * Album uri. 3182 * 3183 * @type { string } 3184 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3185 * @since 10 3186 */ 3187 /** 3188 * Album uri. 3189 * 3190 * @type { string } 3191 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3192 * @crossplatform 3193 * @since 12 3194 */ 3195 readonly albumUri: string; 3196 /** 3197 * Number of assets in the album 3198 * 3199 * @type { number } 3200 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3201 * @since 10 3202 */ 3203 /** 3204 * Number of assets in the album 3205 * 3206 * @type { number } 3207 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3208 * @crossplatform 3209 * @since 12 3210 */ 3211 readonly count: number; 3212 /** 3213 * Cover uri for the album 3214 * 3215 * @type { string } 3216 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3217 * @since 10 3218 */ 3219 readonly coverUri: string; 3220 /** 3221 * Fetch assets in an album. 3222 * 3223 * @permission ohos.permission.READ_IMAGEVIDEO 3224 * @param { FetchOptions } options - Fetch options. 3225 * @param { AsyncCallback<FetchResult<PhotoAsset>> } callback - Returns the fetch result 3226 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3227 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3228 * @throws { BusinessError } 13900012 - Permission denied 3229 * @throws { BusinessError } 13900020 - Invalid argument 3230 * @throws { BusinessError } 14000011 - System inner fail 3231 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3232 * @since 10 3233 */ 3234 /** 3235 * Fetch assets in an album. 3236 * 3237 * @permission ohos.permission.READ_IMAGEVIDEO 3238 * @param { FetchOptions } options - Fetch options. 3239 * @param { AsyncCallback<FetchResult<PhotoAsset>> } callback - Returns the fetch result 3240 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3241 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3242 * @throws { BusinessError } 13900012 - Permission denied 3243 * @throws { BusinessError } 13900020 - Invalid argument 3244 * @throws { BusinessError } 14000011 - System inner fail 3245 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3246 * @crossplatform 3247 * @since 12 3248 */ 3249 getAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<PhotoAsset>>): void; 3250 /** 3251 * Fetch assets in an album. 3252 * 3253 * @permission ohos.permission.READ_IMAGEVIDEO 3254 * @param { FetchOptions } options - Fetch options. 3255 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result 3256 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3257 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3258 * @throws { BusinessError } 13900012 - Permission denied 3259 * @throws { BusinessError } 13900020 - Invalid argument 3260 * @throws { BusinessError } 14000011 - System inner fail 3261 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3262 * @since 10 3263 */ 3264 /** 3265 * Fetch assets in an album. 3266 * 3267 * @permission ohos.permission.READ_IMAGEVIDEO 3268 * @param { FetchOptions } options - Fetch options. 3269 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result 3270 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3271 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3272 * @throws { BusinessError } 13900012 - Permission denied 3273 * @throws { BusinessError } 13900020 - Invalid argument 3274 * @throws { BusinessError } 14000011 - System inner fail 3275 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3276 * @crossplatform 3277 * @since 12 3278 */ 3279 getAssets(options: FetchOptions): Promise<FetchResult<PhotoAsset>>; 3280 /** 3281 * Fetch shared photo assets in an album. 3282 * 3283 * @permission ohos.permission.ACCESS_MEDIALIB_THUMB_DB 3284 * @param { FetchOptions } options - Fetch options. 3285 * @returns { Array<SharedPhotoAsset> } Returns the shared photo assets 3286 * @throws { BusinessError } 201 - Permission denied 3287 * @throws { BusinessError } 202 - Called by non-system application 3288 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3289 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3290 * @throws { BusinessError } 14000011 - Internal system error 3291 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3292 * @systemapi 3293 * @since 13 3294 */ 3295 getSharedPhotoAssets(options: FetchOptions): Array<SharedPhotoAsset>; 3296 } 3297 3298 /** 3299 * Defines the album. 3300 * 3301 * @interface Album 3302 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3303 * @since 10 3304 */ 3305 /** 3306 * Defines the album. 3307 * 3308 * @interface Album 3309 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3310 * @crossplatform 3311 * @since 12 3312 */ 3313 interface Album extends AbsAlbum { 3314 /** 3315 * Number of image assets in the album 3316 * 3317 * @type { ?number } 3318 * @readonly 3319 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3320 * @since 11 3321 */ 3322 /** 3323 * Number of image assets in the album 3324 * 3325 * @type { ?number } 3326 * @readonly 3327 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3328 * @crossplatform 3329 * @since 12 3330 */ 3331 readonly imageCount?: number; 3332 /** 3333 * Number of video assets in the album 3334 * 3335 * @type { ?number } 3336 * @readonly 3337 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3338 * @since 11 3339 */ 3340 /** 3341 * Number of video assets in the album 3342 * 3343 * @type { ?number } 3344 * @readonly 3345 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3346 * @crossplatform 3347 * @since 12 3348 */ 3349 readonly videoCount?: number; 3350 /** 3351 * Modify metadata for the album 3352 * 3353 * @permission ohos.permission.WRITE_IMAGEVIDEO 3354 * @param { AsyncCallback<void> } callback - Returns void 3355 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3356 * <br>2. Incorrect parameter types. 3357 * @throws { BusinessError } 13900012 - Permission denied 3358 * @throws { BusinessError } 13900020 - Invalid argument 3359 * @throws { BusinessError } 14000011 - System inner fail 3360 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3361 * @since 10 3362 */ 3363 commitModify(callback: AsyncCallback<void>): void; 3364 /** 3365 * Modify metadata for the album 3366 * 3367 * @permission ohos.permission.WRITE_IMAGEVIDEO 3368 * @returns { Promise<void> } Returns void 3369 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3370 * <br>2. Incorrect parameter types. 3371 * @throws { BusinessError } 13900012 - Permission denied 3372 * @throws { BusinessError } 13900020 - Invalid argument 3373 * @throws { BusinessError } 14000011 - System inner fail 3374 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3375 * @since 10 3376 */ 3377 commitModify(): Promise<void>; 3378 /** 3379 * Add assets to the album. 3380 * 3381 * @permission ohos.permission.WRITE_IMAGEVIDEO 3382 * @param { Array<PhotoAsset> } assets - Assets to add 3383 * @param { AsyncCallback<void> } callback - Returns void 3384 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3385 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3386 * @throws { BusinessError } 13900012 - Permission denied 3387 * @throws { BusinessError } 13900020 - Invalid argument 3388 * @throws { BusinessError } 14000011 - System inner fail 3389 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3390 * @since 10 3391 * @deprecated since 11 3392 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#addAssets 3393 */ 3394 addAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void; 3395 /** 3396 * Add assets to the album. 3397 * 3398 * @permission ohos.permission.WRITE_IMAGEVIDEO 3399 * @param { Array<PhotoAsset> } assets - Assets to add 3400 * @returns { Promise<void> } Returns void 3401 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3402 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3403 * @throws { BusinessError } 13900012 - Permission denied 3404 * @throws { BusinessError } 13900020 - Invalid argument 3405 * @throws { BusinessError } 14000011 - System inner fail 3406 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3407 * @since 10 3408 * @deprecated since 11 3409 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#addAssets 3410 */ 3411 addAssets(assets: Array<PhotoAsset>): Promise<void>; 3412 /** 3413 * Remove assets from the album. 3414 * 3415 * @permission ohos.permission.WRITE_IMAGEVIDEO 3416 * @param { Array<PhotoAsset> } assets - Assets to remove 3417 * @param { AsyncCallback<void> } callback - Returns void 3418 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3419 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3420 * @throws { BusinessError } 13900012 - Permission denied 3421 * @throws { BusinessError } 13900020 - Invalid argument 3422 * @throws { BusinessError } 14000011 - System inner fail 3423 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3424 * @since 10 3425 * @deprecated since 11 3426 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#removeAssets 3427 */ 3428 removeAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void; 3429 /** 3430 * Remove assets from the album. 3431 * 3432 * @permission ohos.permission.WRITE_IMAGEVIDEO 3433 * @param { Array<PhotoAsset> } assets - Assets to remove 3434 * @returns { Promise<void> } Returns void 3435 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3436 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3437 * @throws { BusinessError } 13900012 - Permission denied 3438 * @throws { BusinessError } 13900020 - Invalid argument 3439 * @throws { BusinessError } 14000011 - System inner fail 3440 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3441 * @since 10 3442 * @deprecated since 11 3443 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#removeAssets 3444 */ 3445 removeAssets(assets: Array<PhotoAsset>): Promise<void>; 3446 /** 3447 * Recover assets from the trash album. 3448 * 3449 * @permission ohos.permission.WRITE_IMAGEVIDEO 3450 * @param { Array<PhotoAsset> } assets - Assets to recover 3451 * @param { AsyncCallback<void> } callback - Returns void 3452 * @throws { BusinessError } 202 - Called by non-system application. 3453 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3454 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3455 * @throws { BusinessError } 13900012 - Permission denied 3456 * @throws { BusinessError } 13900020 - Invalid argument 3457 * @throws { BusinessError } 14000011 - System inner fail 3458 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3459 * @systemapi 3460 * @since 10 3461 * @deprecated since 11 3462 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#recoverAssets 3463 */ 3464 recoverAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void; 3465 /** 3466 * Recover assets from the trash album. 3467 * 3468 * @permission ohos.permission.WRITE_IMAGEVIDEO 3469 * @param { Array<PhotoAsset> } assets - Assets to recover 3470 * @returns { Promise<void> } Returns void 3471 * @throws { BusinessError } 202 - Called by non-system application. 3472 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3473 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3474 * @throws { BusinessError } 13900012 - Permission denied 3475 * @throws { BusinessError } 13900020 - Invalid argument 3476 * @throws { BusinessError } 14000011 - System inner fail 3477 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3478 * @systemapi 3479 * @since 10 3480 * @deprecated since 11 3481 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#recoverAssets 3482 */ 3483 recoverAssets(assets: Array<PhotoAsset>): Promise<void>; 3484 /** 3485 * Delete assets permanently from the trash album. 3486 * 3487 * @permission ohos.permission.WRITE_IMAGEVIDEO 3488 * @param { Array<PhotoAsset> } assets - Assets to delete 3489 * @param { AsyncCallback<void> } callback - Returns void 3490 * @throws { BusinessError } 202 - Called by non-system application. 3491 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3492 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3493 * @throws { BusinessError } 13900012 - Permission denied 3494 * @throws { BusinessError } 13900020 - Invalid argument 3495 * @throws { BusinessError } 14000011 - System inner fail 3496 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3497 * @systemapi 3498 * @since 10 3499 * @deprecated since 11 3500 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAssets 3501 */ 3502 deleteAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void; 3503 /** 3504 * Delete assets permanently from the trash album. 3505 * 3506 * @permission ohos.permission.WRITE_IMAGEVIDEO 3507 * @param { Array<PhotoAsset> } assets - Assets to delete 3508 * @returns { Promise<void> } Returns void 3509 * @throws { BusinessError } 202 - Called by non-system application. 3510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3511 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3512 * @throws { BusinessError } 13900012 - Permission denied 3513 * @throws { BusinessError } 13900020 - Invalid argument 3514 * @throws { BusinessError } 14000011 - System inner fail 3515 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3516 * @systemapi 3517 * @since 10 3518 * @deprecated since 11 3519 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAssets 3520 */ 3521 deleteAssets(assets: Array<PhotoAsset>): Promise<void>; 3522 /** 3523 * Set cover uri for this album. 3524 * 3525 * @permission ohos.permission.WRITE_IMAGEVIDEO 3526 * @param { string } uri - The asset uri to set 3527 * @param { AsyncCallback<void> } callback - Returns void 3528 * @throws { BusinessError } 202 - Called by non-system application. 3529 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3530 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3531 * @throws { BusinessError } 13900012 - Permission denied 3532 * @throws { BusinessError } 13900020 - Invalid argument 3533 * @throws { BusinessError } 14000011 - System inner fail 3534 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3535 * @systemapi 3536 * @since 10 3537 * @deprecated since 11 3538 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#setCoverUri 3539 */ 3540 setCoverUri(uri: string, callback: AsyncCallback<void>): void; 3541 /** 3542 * Set cover uri for this album. 3543 * 3544 * @permission ohos.permission.WRITE_IMAGEVIDEO 3545 * @param { string } uri - The asset uri to set 3546 * @returns { Promise<void> } Returns void 3547 * @throws { BusinessError } 202 - Called by non-system application. 3548 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3549 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3550 * @throws { BusinessError } 13900012 - Permission denied 3551 * @throws { BusinessError } 13900020 - Invalid argument 3552 * @throws { BusinessError } 14000011 - System inner fail 3553 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3554 * @systemapi 3555 * @since 10 3556 * @deprecated since 11 3557 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#setCoverUri 3558 */ 3559 setCoverUri(uri: string): Promise<void>; 3560 /** 3561 * Get the faceId of the portrait album or group photo album. 3562 * 3563 * @permission ohos.permission.READ_IMAGEVIDEO 3564 * @returns { Promise<string> } Returns tag_id if portrait album, Returns group_tag if group photo album, 3565 * <br>Returns empty if not found. 3566 * @throws { BusinessError } 201 - Permission denied 3567 * @throws { BusinessError } 202 - Called by non-system application 3568 * @throws { BusinessError } 14000011 - Internal system error 3569 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3570 * @systemapi 3571 * @since 13 3572 */ 3573 getFaceId(): Promise<string>; 3574 } 3575 3576 /** 3577 * Helper functions to access photos and albums. 3578 * 3579 * @interface PhotoAccessHelper 3580 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3581 * @since 10 3582 */ 3583 /** 3584 * Helper functions to access photos and albums. 3585 * 3586 * @interface PhotoAccessHelper 3587 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3588 * @atomicservice 3589 * @since 11 3590 */ 3591 /** 3592 * Helper functions to access photos and albums. 3593 * 3594 * @interface PhotoAccessHelper 3595 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3596 * @crossplatform 3597 * @atomicservice 3598 * @since 12 3599 */ 3600 interface PhotoAccessHelper { 3601 /** 3602 * Fetch photo assets 3603 * 3604 * @permission ohos.permission.READ_IMAGEVIDEO 3605 * @param { FetchOptions } options - Fetch options. 3606 * @param { AsyncCallback<FetchResult<PhotoAsset>> } callback - Returns the fetch result. 3607 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3608 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3609 * @throws { BusinessError } 13900012 - Permission denied 3610 * @throws { BusinessError } 13900020 - Invalid argument 3611 * @throws { BusinessError } 14000011 - System inner fail 3612 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3613 * @since 10 3614 */ 3615 /** 3616 * Fetch photo assets 3617 * 3618 * @permission ohos.permission.READ_IMAGEVIDEO 3619 * @param { FetchOptions } options - Fetch options. 3620 * @param { AsyncCallback<FetchResult<PhotoAsset>> } callback - Returns the fetch result. 3621 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3622 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3623 * @throws { BusinessError } 13900012 - Permission denied 3624 * @throws { BusinessError } 13900020 - Invalid argument 3625 * @throws { BusinessError } 14000011 - System inner fail 3626 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3627 * @crossplatform 3628 * @since 12 3629 */ 3630 getAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<PhotoAsset>>): void; 3631 /** 3632 * Fetch photo assets 3633 * 3634 * @permission ohos.permission.READ_IMAGEVIDEO 3635 * @param { FetchOptions } options - Retrieval options. 3636 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result. 3637 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3638 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3639 * @throws { BusinessError } 13900012 - Permission denied 3640 * @throws { BusinessError } 13900020 - Invalid argument 3641 * @throws { BusinessError } 14000011 - System inner fail 3642 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3643 * @since 10 3644 */ 3645 /** 3646 * Fetch photo assets 3647 * 3648 * @permission ohos.permission.READ_IMAGEVIDEO 3649 * @param { FetchOptions } options - Retrieval options. 3650 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result. 3651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3652 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3653 * @throws { BusinessError } 13900012 - Permission denied 3654 * @throws { BusinessError } 13900020 - Invalid argument 3655 * @throws { BusinessError } 14000011 - System inner fail 3656 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3657 * @crossplatform 3658 * @since 12 3659 */ 3660 getAssets(options: FetchOptions): Promise<FetchResult<PhotoAsset>>; 3661 /** 3662 * Fetch a group of burst assets 3663 * 3664 * @permission ohos.permission.READ_IMAGEVIDEO 3665 * @param { string } burstKey - Burst asset uuid 3666 * @param { FetchOptions } options - Retrieval options. 3667 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result. 3668 * @throws { BusinessError } 201 - Permission denied 3669 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3670 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3671 * @throws { BusinessError } 14000011 - Internal system error 3672 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3673 * @since 12 3674 */ 3675 getBurstAssets(burstKey: string, options: FetchOptions): Promise<FetchResult<PhotoAsset>>; 3676 /** 3677 * Create a photo asset 3678 * 3679 * @permission ohos.permission.WRITE_IMAGEVIDEO 3680 * @param { string } displayName - Asset name 3681 * @param { AsyncCallback<PhotoAsset> } callback - Returns the newly created asset 3682 * @throws { BusinessError } 202 - Called by non-system application. 3683 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3684 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3685 * @throws { BusinessError } 13900012 - Permission denied 3686 * @throws { BusinessError } 13900020 - Invalid argument 3687 * @throws { BusinessError } 14000001 - Invalid display name 3688 * @throws { BusinessError } 14000011 - System inner fail 3689 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3690 * @systemapi 3691 * @since 10 3692 */ 3693 createAsset(displayName: string, callback: AsyncCallback<PhotoAsset>): void; 3694 /** 3695 * Create a photo asset 3696 * 3697 * @permission ohos.permission.WRITE_IMAGEVIDEO 3698 * @param { string } displayName - Asset name 3699 * @returns { Promise<PhotoAsset> } Returns the newly created asset 3700 * @throws { BusinessError } 202 - Called by non-system application. 3701 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3702 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3703 * @throws { BusinessError } 13900012 - Permission denied 3704 * @throws { BusinessError } 13900020 - Invalid argument 3705 * @throws { BusinessError } 14000001 - Invalid display name 3706 * @throws { BusinessError } 14000011 - System inner fail 3707 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3708 * @systemapi 3709 * @since 10 3710 */ 3711 createAsset(displayName: string): Promise<PhotoAsset>; 3712 /** 3713 * Create a photo asset 3714 * 3715 * @permission ohos.permission.WRITE_IMAGEVIDEO 3716 * @param { string } displayName - Asset name 3717 * @param { PhotoCreateOptions } options - Create operation 3718 * @returns { Promise<PhotoAsset> } Returns the newly created asset 3719 * @throws { BusinessError } 202 - Called by non-system application. 3720 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3721 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3722 * @throws { BusinessError } 13900012 - Permission denied 3723 * @throws { BusinessError } 13900020 - Invalid argument 3724 * @throws { BusinessError } 14000001 - Invalid display name 3725 * @throws { BusinessError } 14000011 - System inner fail 3726 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3727 * @systemapi 3728 * @since 10 3729 */ 3730 createAsset(displayName: string, options: PhotoCreateOptions): Promise<PhotoAsset>; 3731 /** 3732 * Create a photo asset 3733 * 3734 * @permission ohos.permission.WRITE_IMAGEVIDEO 3735 * @param { string } displayName - Asset name 3736 * @param { PhotoCreateOptions } options - Photo create operation 3737 * @param { AsyncCallback<PhotoAsset> } callback - Returns the newly created asset 3738 * @throws { BusinessError } 202 - Called by non-system application. 3739 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3740 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3741 * @throws { BusinessError } 13900012 - Permission denied 3742 * @throws { BusinessError } 13900020 - Invalid argument 3743 * @throws { BusinessError } 14000001 - Invalid display name 3744 * @throws { BusinessError } 14000011 - System inner fail 3745 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3746 * @systemapi 3747 * @since 10 3748 */ 3749 createAsset(displayName: string, options: PhotoCreateOptions, callback: AsyncCallback<PhotoAsset>): void; 3750 /** 3751 * Create a photo asset: 3752 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 3753 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 3754 * 3755 * @permission ohos.permission.WRITE_IMAGEVIDEO 3756 * @param { PhotoType } photoType - Photo asset type 3757 * @param { string } extension - Asset extension 3758 * @param { CreateOptions } options - Asset create option 3759 * @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset 3760 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3761 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3762 * @throws { BusinessError } 13900012 - Permission denied 3763 * @throws { BusinessError } 13900020 - Invalid argument 3764 * @throws { BusinessError } 14000011 - System inner fail 3765 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3766 * @since 10 3767 */ 3768 /** 3769 * Create a photo asset: 3770 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 3771 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 3772 * 3773 * @permission ohos.permission.WRITE_IMAGEVIDEO 3774 * @param { PhotoType } photoType - Photo asset type 3775 * @param { string } extension - Asset extension 3776 * @param { CreateOptions } options - Asset create option 3777 * @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset 3778 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3779 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3780 * @throws { BusinessError } 13900012 - Permission denied 3781 * @throws { BusinessError } 13900020 - Invalid argument 3782 * @throws { BusinessError } 14000011 - System inner fail 3783 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3784 * @atomicservice 3785 * @since 11 3786 */ 3787 createAsset(photoType: PhotoType, extension: string, options: CreateOptions, callback: AsyncCallback<string>): void; 3788 /** 3789 * Create a photo asset: 3790 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 3791 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 3792 * 3793 * @permission ohos.permission.WRITE_IMAGEVIDEO 3794 * @param { PhotoType } photoType - Photo asset type 3795 * @param { string } extension - Asset extension 3796 * @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset 3797 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3798 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3799 * @throws { BusinessError } 13900012 - Permission denied 3800 * @throws { BusinessError } 13900020 - Invalid argument 3801 * @throws { BusinessError } 14000011 - System inner fail 3802 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3803 * @since 10 3804 */ 3805 /** 3806 * Create a photo asset: 3807 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 3808 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 3809 * 3810 * @permission ohos.permission.WRITE_IMAGEVIDEO 3811 * @param { PhotoType } photoType - Photo asset type 3812 * @param { string } extension - Asset extension 3813 * @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset 3814 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3815 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3816 * @throws { BusinessError } 13900012 - Permission denied 3817 * @throws { BusinessError } 13900020 - Invalid argument 3818 * @throws { BusinessError } 14000011 - System inner fail 3819 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3820 * @atomicservice 3821 * @since 11 3822 */ 3823 createAsset(photoType: PhotoType, extension: string, callback: AsyncCallback<string>): void; 3824 /** 3825 * Create a photo asset: 3826 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 3827 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 3828 * 3829 * @permission ohos.permission.WRITE_IMAGEVIDEO 3830 * @param { PhotoType } photoType - Photo asset type 3831 * @param { string } extension - Asset extension 3832 * @param { CreateOptions } [options] - Optional asset create option 3833 * @returns { Promise<string> } Returns the uri of the newly created asset 3834 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3835 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3836 * @throws { BusinessError } 13900012 - Permission denied 3837 * @throws { BusinessError } 13900020 - Invalid argument 3838 * @throws { BusinessError } 14000011 - System inner fail 3839 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3840 * @since 10 3841 */ 3842 /** 3843 * Create a photo asset: 3844 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 3845 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 3846 * 3847 * @permission ohos.permission.WRITE_IMAGEVIDEO 3848 * @param { PhotoType } photoType - Photo asset type 3849 * @param { string } extension - Asset extension 3850 * @param { CreateOptions } [options] - Optional asset create option 3851 * @returns { Promise<string> } Returns the uri of the newly created asset 3852 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3853 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3854 * @throws { BusinessError } 13900012 - Permission denied 3855 * @throws { BusinessError } 13900020 - Invalid argument 3856 * @throws { BusinessError } 14000011 - System inner fail 3857 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3858 * @atomicservice 3859 * @since 11 3860 */ 3861 createAsset(photoType: PhotoType, extension: string, options?: CreateOptions): Promise<string>; 3862 /** 3863 * Create a generic user album. 3864 * 3865 * @permission ohos.permission.WRITE_IMAGEVIDEO 3866 * @param { string } name - Album name to be created. 3867 * @param { AsyncCallback<Album> } callback - Returns the instance of newly created Album 3868 * @throws { BusinessError } 202 - Called by non-system application. 3869 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3870 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3871 * @throws { BusinessError } 13900012 - Permission denied 3872 * @throws { BusinessError } 13900015 - File exists 3873 * @throws { BusinessError } 13900020 - Invalid argument 3874 * @throws { BusinessError } 14000011 - System inner fail 3875 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3876 * @systemapi 3877 * @since 10 3878 * @deprecated since 11 3879 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#createAlbumRequest 3880 */ 3881 createAlbum(name: string, callback: AsyncCallback<Album>): void; 3882 /** 3883 * Create a generic user album. 3884 * 3885 * @permission ohos.permission.WRITE_IMAGEVIDEO 3886 * @param { string } name - Album name to be created. 3887 * @returns { Promise<Album> } Returns the instance of newly created Album 3888 * @throws { BusinessError } 202 - Called by non-system application. 3889 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3890 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3891 * @throws { BusinessError } 13900012 - Permission denied 3892 * @throws { BusinessError } 13900015 - File exists 3893 * @throws { BusinessError } 13900020 - Invalid argument 3894 * @throws { BusinessError } 14000011 - System inner fail 3895 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3896 * @systemapi 3897 * @since 10 3898 * @deprecated since 11 3899 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#createAlbumRequest 3900 */ 3901 createAlbum(name: string): Promise<Album>; 3902 /** 3903 * Delete generic user-created albums. 3904 * 3905 * @permission ohos.permission.WRITE_IMAGEVIDEO 3906 * @param { Array<Album> } albums - Specify which albums to delete 3907 * @param { AsyncCallback<void> } callback - Returns void 3908 * @throws { BusinessError } 202 - Called by non-system application. 3909 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3910 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3911 * @throws { BusinessError } 13900012 - Permission denied 3912 * @throws { BusinessError } 13900020 - Invalid argument 3913 * @throws { BusinessError } 14000011 - System inner fail 3914 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3915 * @systemapi 3916 * @since 10 3917 * @deprecated since 11 3918 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAlbums 3919 */ 3920 deleteAlbums(albums: Array<Album>, callback: AsyncCallback<void>): void; 3921 /** 3922 * Delete generic user-created albums. 3923 * 3924 * @permission ohos.permission.WRITE_IMAGEVIDEO 3925 * @param { Array<Album> } albums - Specify which albums to delete 3926 * @returns { Promise<void> } Returns void 3927 * @throws { BusinessError } 202 - Called by non-system application. 3928 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3929 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3930 * @throws { BusinessError } 13900012 - Permission denied 3931 * @throws { BusinessError } 13900020 - Invalid argument 3932 * @throws { BusinessError } 14000011 - System inner fail 3933 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3934 * @systemapi 3935 * @since 10 3936 * @deprecated since 11 3937 * @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAlbums 3938 */ 3939 deleteAlbums(albums: Array<Album>): Promise<void>; 3940 /** 3941 * Fetch albums. 3942 * 3943 * @permission ohos.permission.READ_IMAGEVIDEO 3944 * @param { AlbumType } type - Album type. 3945 * @param { AlbumSubtype } subtype - Album subtype. 3946 * @param { FetchOptions } options - options to fetch albums 3947 * @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result 3948 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3949 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3950 * @throws { BusinessError } 13900012 - Permission denied 3951 * @throws { BusinessError } 13900020 - Invalid argument 3952 * @throws { BusinessError } 14000011 - System inner fail 3953 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3954 * @since 10 3955 */ 3956 /** 3957 * Fetch albums. 3958 * 3959 * @permission ohos.permission.READ_IMAGEVIDEO 3960 * @param { AlbumType } type - Album type. 3961 * @param { AlbumSubtype } subtype - Album subtype. 3962 * @param { FetchOptions } options - options to fetch albums 3963 * @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result 3964 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3965 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3966 * @throws { BusinessError } 13900012 - Permission denied 3967 * @throws { BusinessError } 13900020 - Invalid argument 3968 * @throws { BusinessError } 14000011 - System inner fail 3969 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3970 * @crossplatform 3971 * @since 12 3972 */ 3973 getAlbums( 3974 type: AlbumType, 3975 subtype: AlbumSubtype, 3976 options: FetchOptions, 3977 callback: AsyncCallback<FetchResult<Album>> 3978 ): void; 3979 /** 3980 * Fetch albums. 3981 * 3982 * @permission ohos.permission.READ_IMAGEVIDEO 3983 * @param { AlbumType } type - Album type. 3984 * @param { AlbumSubtype } subtype - Album subtype. 3985 * @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result 3986 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 3987 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3988 * @throws { BusinessError } 13900012 - Permission denied 3989 * @throws { BusinessError } 13900020 - Invalid argument 3990 * @throws { BusinessError } 14000011 - System inner fail 3991 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 3992 * @since 10 3993 */ 3994 /** 3995 * Fetch albums. 3996 * 3997 * @permission ohos.permission.READ_IMAGEVIDEO 3998 * @param { AlbumType } type - Album type. 3999 * @param { AlbumSubtype } subtype - Album subtype. 4000 * @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result 4001 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4002 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4003 * @throws { BusinessError } 13900012 - Permission denied 4004 * @throws { BusinessError } 13900020 - Invalid argument 4005 * @throws { BusinessError } 14000011 - System inner fail 4006 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4007 * @crossplatform 4008 * @since 12 4009 */ 4010 getAlbums(type: AlbumType, subtype: AlbumSubtype, callback: AsyncCallback<FetchResult<Album>>): void; 4011 /** 4012 * Fetch albums. 4013 * 4014 * @permission ohos.permission.READ_IMAGEVIDEO 4015 * @param { AlbumType } type - Album type. 4016 * @param { AlbumSubtype } subtype - Album subtype. 4017 * @param { FetchOptions } [options] - options to fetch albums 4018 * @returns { Promise<FetchResult<Album>> } - Returns the fetch result 4019 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4020 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4021 * @throws { BusinessError } 13900012 - Permission denied 4022 * @throws { BusinessError } 13900020 - Invalid argument 4023 * @throws { BusinessError } 14000011 - System inner fail 4024 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4025 * @since 10 4026 */ 4027 /** 4028 * Fetch albums. 4029 * 4030 * @permission ohos.permission.READ_IMAGEVIDEO 4031 * @param { AlbumType } type - Album type. 4032 * @param { AlbumSubtype } subtype - Album subtype. 4033 * @param { FetchOptions } [options] - options to fetch albums 4034 * @returns { Promise<FetchResult<Album>> } - Returns the fetch result 4035 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4036 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4037 * @throws { BusinessError } 13900012 - Permission denied 4038 * @throws { BusinessError } 13900020 - Invalid argument 4039 * @throws { BusinessError } 14000011 - System inner fail 4040 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4041 * @crossplatform 4042 * @since 12 4043 */ 4044 getAlbums(type: AlbumType, subtype: AlbumSubtype, options?: FetchOptions): Promise<FetchResult<Album>>; 4045 /** 4046 * Fetch albums containing hidden assets. 4047 * 4048 * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS 4049 * @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets. 4050 * @param { FetchOptions } options - Options to fetch albums. 4051 * @param { AsyncCallback<FetchResult<Album>> } callback - Returns fetchResult of albums containing hidden assets. 4052 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4053 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4054 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4055 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4056 * @throws { BusinessError } 14000011 - System inner fail. 4057 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4058 * @systemapi 4059 * @since 11 4060 */ 4061 getHiddenAlbums(mode: HiddenPhotosDisplayMode, options: FetchOptions, callback: AsyncCallback<FetchResult<Album>>): void; 4062 /** 4063 * Fetch albums containing hidden assets. 4064 * 4065 * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS 4066 * @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets. 4067 * @param { AsyncCallback<FetchResult<Album>> } callback - Returns fetchResult of albums containing hidden assets. 4068 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4069 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4070 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4071 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4072 * @throws { BusinessError } 14000011 - System inner fail. 4073 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4074 * @systemapi 4075 * @since 11 4076 */ 4077 getHiddenAlbums(mode: HiddenPhotosDisplayMode, callback: AsyncCallback<FetchResult<Album>>): void; 4078 /** 4079 * Fetch albums containing hidden assets. 4080 * 4081 * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS 4082 * @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets. 4083 * @param { FetchOptions } [options] - Options to fetch albums. 4084 * @returns { Promise<FetchResult<Album>> } Returns fetchResult of albums containing hidden assets. 4085 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4086 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4087 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4088 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4089 * @throws { BusinessError } 14000011 - System inner fail. 4090 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4091 * @systemapi 4092 * @since 11 4093 */ 4094 getHiddenAlbums(mode: HiddenPhotosDisplayMode, options?: FetchOptions): Promise<FetchResult<Album>>; 4095 /** 4096 * Delete assets 4097 * 4098 * @permission ohos.permission.WRITE_IMAGEVIDEO 4099 * @param { Array<string> } uriList - Uris of assets to delete 4100 * @param { AsyncCallback<void> } callback - No value returned 4101 * @throws { BusinessError } 202 - Called by non-system application. 4102 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4103 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4104 * @throws { BusinessError } 13900012 - Permission denied 4105 * @throws { BusinessError } 13900020 - Invalid argument 4106 * @throws { BusinessError } 14000002 - Invalid uri 4107 * @throws { BusinessError } 14000011 - System inner fail 4108 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4109 * @systemapi 4110 * @since 10 4111 * @deprecated since 11 4112 * @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets 4113 */ 4114 deleteAssets(uriList: Array<string>, callback: AsyncCallback<void>): void; 4115 /** 4116 * Delete assets 4117 * 4118 * @permission ohos.permission.WRITE_IMAGEVIDEO 4119 * @param { Array<string> } uriList - Uris of assets to delete 4120 * @returns { Promise<void> } - Returns void 4121 * @throws { BusinessError } 202 - Called by non-system application. 4122 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4123 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4124 * @throws { BusinessError } 13900012 - Permission denied 4125 * @throws { BusinessError } 13900020 - Invalid argument 4126 * @throws { BusinessError } 14000002 - Invalid uri 4127 * @throws { BusinessError } 14000011 - System inner fail 4128 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4129 * @systemapi 4130 * @since 10 4131 * @deprecated since 11 4132 * @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets 4133 */ 4134 deleteAssets(uriList: Array<string>): Promise<void>; 4135 /** 4136 * Register change notify for the specified uri. 4137 * 4138 * @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri 4139 * @param { boolean } forChildUris - Monitor the child uris. 4140 * @param { Callback<ChangeData> } callback - Returns the changed data 4141 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4142 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4143 * @throws { BusinessError } 13900012 - Permission denied 4144 * @throws { BusinessError } 13900020 - Invalid argument 4145 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4146 * @since 10 4147 */ 4148 registerChange(uri: string, forChildUris: boolean, callback: Callback<ChangeData>): void; 4149 /** 4150 * Get analysis progress of the asset. 4151 * 4152 * @permission ohos.permission.READ_IMAGEVIDEO 4153 * @param { AnalysisType } analysisType - Analysis type 4154 * @returns { Promise<string> } Returns analysis progress info into a json string 4155 * @throws { BusinessError } 201 - Permission denied 4156 * @throws { BusinessError } 202 - Called by non-system application 4157 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4158 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4159 * @throws { BusinessError } 14000011 - Internal system error 4160 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4161 * @systemapi 4162 * @since 12 4163 */ 4164 getDataAnalysisProgress(analysisType: AnalysisType): Promise<string>; 4165 /** 4166 * Unregister change notify for the specified uri. 4167 * 4168 * @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri 4169 * @param { Callback<ChangeData> } [callback] - The callback function to unregister. 4170 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4171 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4172 * @throws { BusinessError } 13900012 - Permission denied 4173 * @throws { BusinessError } 13900020 - Invalid argument 4174 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4175 * @since 10 4176 */ 4177 unRegisterChange(uri: string, callback?: Callback<ChangeData>): void; 4178 /** 4179 * Create a pop-up box to delete photos 4180 * 4181 * @permission ohos.permission.WRITE_IMAGEVIDEO 4182 * @param { Array<string> } uriList - List of the asset uris to be deleted 4183 * @param { AsyncCallback<void> } callback - Returns void 4184 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4185 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4186 * @throws { BusinessError } 13900012 - Permission denied 4187 * @throws { BusinessError } 13900020 - Invalid argument 4188 * @throws { BusinessError } 14000011 - System inner fail 4189 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4190 * @since 10 4191 * @deprecated since 11 4192 * @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets 4193 */ 4194 createDeleteRequest(uriList: Array<string>, callback: AsyncCallback<void>): void; 4195 /** 4196 * Create a pop-up box to delete photos 4197 * 4198 * @permission ohos.permission.WRITE_IMAGEVIDEO 4199 * @param { Array<string> } uriList - List of the asset uris to be deleted 4200 * @returns { Promise<void> } - Returns void 4201 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4202 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4203 * @throws { BusinessError } 13900012 - Permission denied 4204 * @throws { BusinessError } 13900020 - Invalid argument 4205 * @throws { BusinessError } 14000011 - System inner fail 4206 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4207 * @since 10 4208 * @deprecated since 11 4209 * @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets 4210 */ 4211 createDeleteRequest(uriList: Array<string>): Promise<void>; 4212 /** 4213 * Create a save dialog to save photos 4214 * 4215 * @param { Array<string> } srcFileUris - List of the file uris to be saved 4216 * @param { Array<PhotoCreationConfig> } photoCreationConfigs - List of the photo asset creation configs 4217 * @returns { Promise<Array<string>> } - Returns the media library file uri list to application which has been authorized 4218 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4219 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4220 * @throws { BusinessError } 14000011 - Internal system error 4221 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4222 * @atomicservice 4223 * @since 12 4224 */ 4225 showAssetsCreationDialog(srcFileUris: Array<string>, photoCreationConfigs: Array<PhotoCreationConfig>): Promise<Array<string>>; 4226 /** 4227 * Create assets and grant save permission to the app which called the save dialog. 4228 * 4229 * @permission ohos.permission.WRITE_IMAGEVIDEO 4230 * @param { string } bundleName - BundleName of the application which called the save dialog 4231 * @param { string } appName - AppName of the application which called the save dialog 4232 * @param { string } appId - AppId of the application which called the save dialog 4233 * @param { Array<PhotoCreationConfig> } photoCreationConfigs - List of the photo asset creation configs 4234 * @returns { Promise<Array<string>> } - Returns the media library file uri list to application which has been authorized 4235 * @throws { BusinessError } 201 - Permission denied 4236 * @throws { BusinessError } 202 - Called by non-system application 4237 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4238 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4239 * @throws { BusinessError } 14000011 - Internal system error 4240 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4241 * @systemapi 4242 * @since 12 4243 */ 4244 createAssetsForApp(bundleName: string, appName: string, appId: string, photoCreationConfigs: Array<PhotoCreationConfig>): Promise<Array<string>>; 4245 /** 4246 * Create asset and grant short term permission to the application. 4247 * 4248 * @permission ohos.permission.SHORT_TERM_WRITE_IMAGEVIDEO 4249 * @param { PhotoCreationConfig } photoCreationConfig - photo asset creation configs 4250 * @returns { Promise<string> } - Returns the media library file uri to application which has been authorized 4251 * @throws { BusinessError } 201 - Permission denied 4252 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4253 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4254 * @throws { BusinessError } 14000011 - Internal system error 4255 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4256 * @since 12 4257 */ 4258 createAssetWithShortTermPermission(photoCreationConfig: PhotoCreationConfig): Promise<string>; 4259 /** 4260 * Create assets and grant save permission with authorization mode to the app which called the save dialog. 4261 * 4262 * @permission ohos.permission.WRITE_IMAGEVIDEO 4263 * @param { string } bundleName - BundleName of the application which called the save dialog 4264 * @param { string } appName - AppName of the application which called the save dialog 4265 * @param { string } appId - AppId of the application which called the save dialog 4266 * @param { number } tokenId - TokenId of the application which called the save dialog 4267 * @param { AuthorizationMode } authorizationMode - Mode of authorization 4268 * @param { Array<PhotoCreationConfig> } photoCreationConfigs - List of the photo asset creation configs 4269 * @returns { Promise<Array<string>> } - Returns the media library file uri list to application which has been authorized 4270 * @throws { BusinessError } 201 - Permission denied 4271 * @throws { BusinessError } 202 - Called by non-system application 4272 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4273 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4274 * @throws { BusinessError } 14000011 - Internal system error 4275 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4276 * @systemapi 4277 * @since 12 4278 */ 4279 createAssetsForAppWithMode( 4280 bundleName: string, 4281 appName: string, 4282 appId: string, 4283 tokenId: number, 4284 authorizationMode: AuthorizationMode, 4285 photoCreationConfigs: Array<PhotoCreationConfig> 4286 ): Promise<Array<string>>; 4287 /** 4288 * Authorize the uri list. 4289 * 4290 * @param { Array<string> } srcFileUris - Unauthorized uri list 4291 * @returns { Promise<Array<string>> } - Returns the authorized uri list 4292 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4293 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4294 * @throws { BusinessError } 14000011 - Internal system error 4295 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4296 * @atomicservice 4297 * @since 14 4298 */ 4299 requestPhotoUrisReadPermission(srcFileUris: Array<string>): Promise<Array<string>>; 4300 /** 4301 * Get the index of the asset in the album 4302 * 4303 * @permission ohos.permission.READ_IMAGEVIDEO 4304 * @param { string } photoUri - The photo asset uri. 4305 * @param { string } albumUri - The album uri. 4306 * @param { FetchOptions } options - fetch options 4307 * @param { AsyncCallback<number> } callback - Returns the index of the asset in the album 4308 * @throws { BusinessError } 202 - Called by non-system application. 4309 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4310 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4311 * @throws { BusinessError } 13900012 - Permission denied 4312 * @throws { BusinessError } 13900020 - Invalid argument 4313 * @throws { BusinessError } 14000011 - System inner fail 4314 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4315 * @systemapi 4316 * @since 10 4317 */ 4318 getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback<number>): void; 4319 /** 4320 * Get the index of the asset in the album 4321 * 4322 * @permission ohos.permission.READ_IMAGEVIDEO 4323 * @param { string } photoUri - The photo asset uri. 4324 * @param { string } albumUri - The album uri. 4325 * @param { FetchOptions } options - fetch options 4326 * @returns { Promise<number> } - Returns the index of the asset in the album 4327 * @throws { BusinessError } 202 - Called by non-system application. 4328 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4329 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4330 * @throws { BusinessError } 13900012 - Permission denied 4331 * @throws { BusinessError } 13900020 - Invalid argument 4332 * @throws { BusinessError } 14000011 - System inner fail 4333 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4334 * @systemapi 4335 * @since 10 4336 */ 4337 getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise<number>; 4338 /** 4339 * Release PhotoAccessHelper instance 4340 * 4341 * @param { AsyncCallback<void> } callback - Returns void 4342 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4343 * <br>2. Incorrect parameter types. 4344 * @throws { BusinessError } 13900020 - Invalid argument 4345 * @throws { BusinessError } 14000011 - System inner fail 4346 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4347 * @since 10 4348 */ 4349 release(callback: AsyncCallback<void>): void; 4350 /** 4351 * Release PhotoAccessHelper instance 4352 * 4353 * @returns { Promise<void> } Returns void 4354 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4355 * <br>2. Incorrect parameter types. 4356 * @throws { BusinessError } 13900020 - Invalid argument 4357 * @throws { BusinessError } 14000011 - System inner fail 4358 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4359 * @since 10 4360 */ 4361 release(): Promise<void>; 4362 /** 4363 * Saves form information 4364 * 4365 * @permission ohos.permission.WRITE_IMAGEVIDEO 4366 * @param { FormInfo } info - Information store with the form. 4367 * @param { AsyncCallback<void> } callback - No value returned. 4368 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4369 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4370 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4371 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4372 * @throws { BusinessError } 14000011 - System inner fail. 4373 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4374 * @systemapi 4375 * @since 11 4376 */ 4377 saveFormInfo(info: FormInfo, callback: AsyncCallback<void>): void; 4378 /** 4379 * Saves form information 4380 * 4381 * @permission ohos.permission.WRITE_IMAGEVIDEO 4382 * @param { FormInfo } info - Information store with the form. 4383 * @returns { Promise<void> } Return void. 4384 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4385 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4386 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4387 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4388 * @throws { BusinessError } 14000011 - System inner fail. 4389 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4390 * @systemapi 4391 * @since 11 4392 */ 4393 saveFormInfo(info: FormInfo): Promise<void>; 4394 /** 4395 * Removes form information 4396 * 4397 * @permission ohos.permission.WRITE_IMAGEVIDEO 4398 * @param { FormInfo } info - Information store with the form. 4399 * @param { AsyncCallback<void> } callback - No value returned. 4400 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4401 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4402 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4403 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4404 * @throws { BusinessError } 14000011 - System inner fail. 4405 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4406 * @systemapi 4407 * @since 11 4408 */ 4409 removeFormInfo(info: FormInfo, callback: AsyncCallback<void>): void; 4410 /** 4411 * Removes form information 4412 * 4413 * @permission ohos.permission.WRITE_IMAGEVIDEO 4414 * @param { FormInfo } info - Information store with the form. 4415 * @returns { Promise<void> } Return void. 4416 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 4417 * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 4418 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4419 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4420 * @throws { BusinessError } 14000011 - System inner fail. 4421 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4422 * @systemapi 4423 * @since 11 4424 */ 4425 removeFormInfo(info: FormInfo): Promise<void>; 4426 /** 4427 * Apply the change request of asset or album. 4428 * 4429 * @permission ohos.permission.WRITE_IMAGEVIDEO 4430 * @param { MediaChangeRequest } mediaChangeRequest - The change request to be applied 4431 * @returns { Promise<void> } Returns void 4432 * @throws { BusinessError } 201 - Permission denied 4433 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4434 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4435 * @throws { BusinessError } 14000011 - System inner fail 4436 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4437 * @atomicservice 4438 * @since 11 4439 */ 4440 applyChanges(mediaChangeRequest: MediaChangeRequest): Promise<void>; 4441 /** 4442 * Get index construction progress. 4443 * 4444 * @permission ohos.permission.READ_IMAGEVIDEO 4445 * @returns { Promise<string> } Returns progress of the photo and video 4446 * @throws { BusinessError } 201 - Permission denied 4447 * @throws { BusinessError } 202 - Called by non-system application 4448 * @throws { BusinessError } 14000011 - Internal system error 4449 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4450 * @systemapi 4451 * @since 12 4452 */ 4453 getIndexConstructProgress(): Promise<string>; 4454 /** 4455 * Grant permission of assets to an APP. 4456 * 4457 * @permission ohos.permission.READ_IMAGEVIDEO 4458 * @param { string } appid - App Id 4459 * @param { Array<string> } uriList - List of asset uris whose permission will be granted to an App, 4460 * <br>the capacity of uriList is 1000. 4461 * @param { PhotoPermissionType } photoPermissionType - Permission type of accessing assets. 4462 * @param { HideSensitiveType } hideSensitiveType - Hide sensitive info type of accessing assets. 4463 * @returns { Promise<number> } Returns result of grant permission 4464 * @throws { BusinessError } 201 - Permission denied 4465 * @throws { BusinessError } 202 - Called by non-system application 4466 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4467 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4468 * @throws { BusinessError } 14000011 - Internal system error 4469 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4470 * @systemapi 4471 * @since 12 4472 */ 4473 grantPhotoUrisPermission( 4474 appid: string, 4475 uriList: Array<string>, 4476 photoPermissionType: PhotoPermissionType, 4477 hideSensitiveType: HideSensitiveType 4478 ): Promise<number>; 4479 /** 4480 * Grant permission of asset to an APP. 4481 * 4482 * @permission ohos.permission.READ_IMAGEVIDEO 4483 * @param { string } appid - App Id 4484 * @param { string } uri - Asset uri whose permission will be granted to an App. 4485 * @param { PhotoPermissionType } photoPermissionType - Permission type of accessing assets. 4486 * @param { HideSensitiveType } hideSensitiveType - Hide sensitive info type of accessing assets. 4487 * @returns { Promise<number> } Returns result of grant permission 4488 * @throws { BusinessError } 201 - Permission denied 4489 * @throws { BusinessError } 202 - Called by non-system application 4490 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4491 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4492 * @throws { BusinessError } 14000011 - Internal system error 4493 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4494 * @systemapi 4495 * @since 12 4496 */ 4497 grantPhotoUriPermission(appid: string, uri: string, photoPermissionType: PhotoPermissionType, hideSensitiveType: HideSensitiveType): Promise<number>; 4498 /** 4499 * Cancel permission of asset to an APP. 4500 * 4501 * @permission ohos.permission.READ_IMAGEVIDEO 4502 * @param { string } appid - App Id 4503 * @param { string } uri - Asset uri whose permission will be granted to an App. 4504 * @param { PhotoPermissionType } photoPermissionType - Permission type of accessing assets. 4505 * @returns { Promise<number> } Returns result of cancel permission 4506 * @throws { BusinessError } 201 - Permission denied 4507 * @throws { BusinessError } 202 - Called by non-system application 4508 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4509 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4510 * @throws { BusinessError } 14000011 - Internal system error 4511 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4512 * @systemapi 4513 * @since 12 4514 */ 4515 cancelPhotoUriPermission(appid: string, uri: string, photoPermissionType: PhotoPermissionType): Promise<number>; 4516 /** 4517 * Provides the capability of thumbnail generation according to specified rules. 4518 * 4519 * @permission ohos.permission.READ_IMAGEVIDEO 4520 * @param { dataSharePredicates.DataSharePredicates } predicate - Rule options for generating thumbnails. 4521 * @param { AsyncCallback<void> } callback - Returns void when the task is completed. 4522 * @returns { number } Create task id for generating thumbnails 4523 * @throws { BusinessError } 201 - Permission denied 4524 * @throws { BusinessError } 202 - Called by non-system application 4525 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4526 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4527 * @throws { BusinessError } 14000011 - Internal system error 4528 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4529 * @systemapi 4530 * @since 13 4531 */ 4532 startThumbnailCreationTask(predicate: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>): number; 4533 /** 4534 * Provides the capability of stop generating thumbnails. 4535 * 4536 * @permission ohos.permission.READ_IMAGEVIDEO 4537 * @param { number } taskId - Stop generating thumbnail task id. 4538 * @throws { BusinessError } 201 - Permission denied 4539 * @throws { BusinessError } 202 - Called by non-system application 4540 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4541 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4542 * @throws { BusinessError } 14000011 - Internal system error 4543 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4544 * @systemapi 4545 * @since 13 4546 */ 4547 stopThumbnailCreationTask(taskId: number): void; 4548 /** 4549 * Fetch shared photo assets. 4550 * 4551 * @permission ohos.permission.ACCESS_MEDIALIB_THUMB_DB 4552 * @param { FetchOptions } options - Fetch options. 4553 * @returns { Array<SharedPhotoAsset> } Returns the shared photo assets 4554 * @throws { BusinessError } 201 - Permission denied 4555 * @throws { BusinessError } 202 - Called by non-system application 4556 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4557 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4558 * @throws { BusinessError } 14000011 - Internal system error 4559 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4560 * @systemapi 4561 * @since 13 4562 */ 4563 getSharedPhotoAssets(options: FetchOptions): Array<SharedPhotoAsset>; 4564 } 4565 4566 /** 4567 * Form information. 4568 * 4569 * @interface FormInfo 4570 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4571 * @systemapi 4572 * @since 11 4573 */ 4574 interface FormInfo { 4575 /** 4576 * Id of the form. 4577 * 4578 * @type { string } 4579 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4580 * @systemapi 4581 * @since 11 4582 */ 4583 formId: string; 4584 /** 4585 * URI of the photo or album. 4586 * 4587 * @type { string } 4588 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4589 * @systemapi 4590 * @since 11 4591 */ 4592 uri: string; 4593 } 4594 4595 /** 4596 * Enumeration types of data change. 4597 * 4598 * @enum { number } NotifyType 4599 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4600 * @since 10 4601 */ 4602 enum NotifyType { 4603 /** 4604 * Data(assets or albums) have been newly created 4605 * 4606 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4607 * @since 10 4608 */ 4609 NOTIFY_ADD, 4610 /** 4611 * Data(assets or albums) have been modified 4612 * 4613 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4614 * @since 10 4615 */ 4616 NOTIFY_UPDATE, 4617 /** 4618 * Data(assets or albums) have been removed 4619 * 4620 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4621 * @since 10 4622 */ 4623 NOTIFY_REMOVE, 4624 /** 4625 * Assets have been added to an album. 4626 * 4627 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4628 * @since 10 4629 */ 4630 NOTIFY_ALBUM_ADD_ASSET, 4631 /** 4632 * Assets have been removed from an album. 4633 * 4634 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4635 * @since 10 4636 */ 4637 NOTIFY_ALBUM_REMOVE_ASSET 4638 } 4639 4640 /** 4641 * Enumeration uris for registerChange. 4642 * 4643 * @enum { string } DefaultChangeUri 4644 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4645 * @since 10 4646 */ 4647 enum DefaultChangeUri { 4648 /** 4649 * Uri for default PhotoAsset, use with forDescendant{true}, will receive all PhotoAsset's change notifications 4650 * 4651 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4652 * @since 10 4653 */ 4654 DEFAULT_PHOTO_URI = 'file://media/Photo', 4655 /** 4656 * Uri for default Album, use with forDescendant{true}, will receive all Album's change notifications 4657 * 4658 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4659 * @since 10 4660 */ 4661 DEFAULT_ALBUM_URI = 'file://media/PhotoAlbum', 4662 /** 4663 * Uri for albums in hidden album view. 4664 * 4665 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4666 * @systemapi 4667 * @since 11 4668 */ 4669 DEFAULT_HIDDEN_ALBUM_URI = 'file://media/HiddenAlbum' 4670 } 4671 4672 /** 4673 * Defines the change data 4674 * 4675 * @interface ChangeData 4676 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4677 * @since 10 4678 */ 4679 interface ChangeData { 4680 /** 4681 * The NotifyType of ChangeData 4682 * 4683 * @type { NotifyType } 4684 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4685 * @since 10 4686 */ 4687 type: NotifyType; 4688 /** 4689 * The changed uris 4690 * 4691 * @type { Array<string> } 4692 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4693 * @since 10 4694 */ 4695 uris: Array<string>; 4696 /** 4697 * Change details of the asset uris to an album. 4698 * 4699 * @type { Array<string> } 4700 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4701 * @since 10 4702 */ 4703 extraUris: Array<string>; 4704 /** 4705 * sharedPhotoAssets of the same type 4706 * 4707 * @type { Array<SharedPhotoAsset> } 4708 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4709 * @systemapi 4710 * @since 14 4711 */ 4712 sharedPhotoAssets: Array<SharedPhotoAsset>; 4713 /** 4714 * sharedAlbumAssets of the same type 4715 * 4716 * @type { Array<SharedAlbumAsset> } 4717 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4718 * @systemapi 4719 * @since 14 4720 */ 4721 sharedAlbumAssets: Array<SharedAlbumAsset>; 4722 /** 4723 * sharedExtraPhotoAssets of the same type 4724 * 4725 * @type { Array<SharedPhotoAsset> } 4726 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4727 * @systemapi 4728 * @since 14 4729 */ 4730 sharedExtraPhotoAssets: Array<SharedPhotoAsset>; 4731 } 4732 4733 /** 4734 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 4735 * 4736 * @enum { string } PhotoViewMIMETypes 4737 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4738 * @since 10 4739 */ 4740 /** 4741 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 4742 * 4743 * @enum { string } PhotoViewMIMETypes 4744 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4745 * @atomicservice 4746 * @since 11 4747 */ 4748 /** 4749 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 4750 * 4751 * @enum { string } PhotoViewMIMETypes 4752 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4753 * @crossplatform 4754 * @atomicservice 4755 * @since 12 4756 */ 4757 export enum PhotoViewMIMETypes { 4758 /** 4759 * IMAGE_TYPE indicates that the selected media resources are images. 4760 * 4761 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4762 * @since 10 4763 */ 4764 /** 4765 * IMAGE_TYPE indicates that the selected media resources are images. 4766 * 4767 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4768 * @atomicservice 4769 * @since 11 4770 */ 4771 /** 4772 * IMAGE_TYPE indicates that the selected media resources are images. 4773 * 4774 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4775 * @crossplatform 4776 * @atomicservice 4777 * @since 12 4778 */ 4779 IMAGE_TYPE = 'image/*', 4780 /** 4781 * VIDEO_TYPE indicates that the selected media resources are videos. 4782 * 4783 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4784 * @since 10 4785 */ 4786 /** 4787 * VIDEO_TYPE indicates that the selected media resources are videos. 4788 * 4789 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4790 * @atomicservice 4791 * @since 11 4792 */ 4793 /** 4794 * VIDEO_TYPE indicates that the selected media resources are videos. 4795 * 4796 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4797 * @crossplatform 4798 * @atomicservice 4799 * @since 12 4800 */ 4801 VIDEO_TYPE = 'video/*', 4802 /** 4803 * IMAGE_VIDEO_TYPE indicates that the selected media resources are images and videos. 4804 * 4805 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4806 * @since 10 4807 */ 4808 /** 4809 * IMAGE_VIDEO_TYPE indicates that the selected media resources are images and videos. 4810 * 4811 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4812 * @atomicservice 4813 * @since 11 4814 */ 4815 /** 4816 * IMAGE_VIDEO_TYPE indicates that the selected media resources are images and videos. 4817 * 4818 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4819 * @crossplatform 4820 * @atomicservice 4821 * @since 12 4822 */ 4823 IMAGE_VIDEO_TYPE = '*/*', 4824 4825 /** 4826 * MOVING_PHOTO_IMAGE_TYPE indicates that the selected media resources are moving photos. 4827 * 4828 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4829 * @atomicservice 4830 * @since 12 4831 */ 4832 MOVING_PHOTO_IMAGE_TYPE = 'image/movingPhoto' 4833 } 4834 4835 /** 4836 * Class BaseSelectOptions, which is extracted from class PhotoSelectOptions 4837 * 4838 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4839 * @crossplatform 4840 * @atomicservice 4841 * @since 12 4842 */ 4843 class BaseSelectOptions { 4844 /** 4845 * The Type of the file in the picker window. 4846 * 4847 * @type { ?PhotoViewMIMETypes } 4848 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4849 * @since 10 4850 */ 4851 /** 4852 * The Type of the file in the picker window. 4853 * 4854 * @type { ?PhotoViewMIMETypes } 4855 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4856 * @atomicservice 4857 * @since 11 4858 */ 4859 /** 4860 * The Type of the file in the picker window. 4861 * Move from class PhotoSelectOptions to it's base class BaseSelectOptions 4862 * 4863 * @type { ?PhotoViewMIMETypes } 4864 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4865 * @crossplatform 4866 * @atomicservice 4867 * @since 12 4868 */ 4869 MIMEType?: PhotoViewMIMETypes; 4870 4871 /** 4872 * Maximum number of images for a single selection. 4873 * 4874 * @type { ?number } 4875 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4876 * @since 10 4877 */ 4878 /** 4879 * Maximum number of images for a single selection. 4880 * 4881 * @type { ?number } 4882 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4883 * @atomicservice 4884 * @since 11 4885 */ 4886 /** 4887 * Maximum number of images for a single selection. 4888 * Move from class PhotoSelectOptions to it's base class BaseSelectOptions 4889 * 4890 * @type { ?number } 4891 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4892 * @atomicservice 4893 * @since 12 4894 */ 4895 maxSelectNumber?: number; 4896 4897 /** 4898 * Support search. 4899 * 4900 * @type { ?boolean } 4901 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4902 * @atomicservice 4903 * @since 11 4904 */ 4905 /** 4906 * Support search. 4907 * Move from class PhotoSelectOptions to it's base class BaseSelectOptions 4908 * 4909 * @type { ?boolean } 4910 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4911 * @atomicservice 4912 * @since 12 4913 */ 4914 isSearchSupported?: boolean; 4915 4916 /** 4917 * Support taking photos. 4918 * 4919 * @type { ?boolean } 4920 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4921 * @atomicservice 4922 * @since 11 4923 */ 4924 /** 4925 * Support taking photos. 4926 * Move from class PhotoSelectOptions to it's base class BaseSelectOptions 4927 * 4928 * @type { ?boolean } 4929 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4930 * @atomicservice 4931 * @since 12 4932 */ 4933 isPhotoTakingSupported?: boolean; 4934 4935 /** 4936 * The recommendation options when use recommendation photo function. 4937 * 4938 * @type { ?RecommendationOptions } 4939 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4940 * @atomicservice 4941 * @since 11 4942 */ 4943 /** 4944 * The recommendation options when use recommendation photo function. 4945 * Move from class PhotoSelectOptions to it's base class BaseSelectOptions 4946 * 4947 * @type { ?RecommendationOptions } 4948 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4949 * @atomicservice 4950 * @since 12 4951 */ 4952 recommendationOptions?: RecommendationOptions; 4953 4954 /** 4955 * The uri for the preselected files. 4956 * 4957 * @type { ?Array<string> } 4958 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4959 * @atomicservice 4960 * @since 11 4961 */ 4962 /** 4963 * The uri for the preselected files. 4964 * Move from class PhotoSelectOptions to it's base class BaseSelectOptions 4965 * 4966 * @type { ?Array<string> } 4967 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4968 * @atomicservice 4969 * @since 12 4970 */ 4971 preselectedUris?: Array<string>; 4972 4973 /** 4974 * Support preview in single selection mode or not 4975 * 4976 * @type { ?boolean } 4977 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4978 * @atomicservice 4979 * @since 12 4980 */ 4981 isPreviewForSingleSelectionSupported?: boolean; 4982 } 4983 4984 /** 4985 * PhotoSelectOptions Object 4986 * 4987 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4988 * @since 10 4989 */ 4990 /** 4991 * PhotoSelectOptions Object 4992 * 4993 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 4994 * @atomicservice 4995 * @since 11 4996 */ 4997 /** 4998 * PhotoSelectOptions extends base class BaseSelectOptions 4999 * 5000 * @extends BaseSelectOptions 5001 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5002 * @crossplatform 5003 * @atomicservice 5004 * @since 12 5005 */ 5006 class PhotoSelectOptions extends BaseSelectOptions { 5007 /** 5008 * Support editing photos. 5009 * 5010 * @type { ?boolean } 5011 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5012 * @atomicservice 5013 * @since 11 5014 */ 5015 isEditSupported?: boolean; 5016 5017 /** 5018 * Support select original photo or not 5019 * 5020 * @type { ?boolean } 5021 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5022 * @atomicservice 5023 * @since 12 5024 */ 5025 isOriginalSupported?: boolean; 5026 5027 /** 5028 * SubWindow name 5029 * 5030 * @type { ?string } 5031 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5032 * @atomicservice 5033 * @since 12 5034 */ 5035 subWindowName?: string; 5036 5037 /** 5038 * Theme color 5039 * 5040 * @type { ?CustomColors } 5041 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5042 * @systemapi 5043 * @since 12 5044 */ 5045 themeColor?: CustomColors; 5046 5047 /** 5048 * Complete button text 5049 * 5050 * @type { ?CompleteButtonText } 5051 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5052 * @atomicservice 5053 * @since 14 5054 */ 5055 completeButtonText?: CompleteButtonText; 5056 } 5057 5058 /** 5059 * Options for recommend photos 5060 * 5061 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5062 * @atomicservice 5063 * @since 11 5064 */ 5065 class RecommendationOptions { 5066 /** 5067 * The recommendation photo type when select photo in photo picker. 5068 * 5069 * @type { ?RecommendationType } 5070 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5071 * @atomicservice 5072 * @since 11 5073 */ 5074 recommendationType?: RecommendationType; 5075 5076 /** 5077 * The textContextInfo to recommend images. 5078 * 5079 * @type { ?TextContextInfo } 5080 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5081 * @atomicservice 5082 * @since 12 5083 */ 5084 textContextInfo?: TextContextInfo; 5085 } 5086 5087 /** 5088 * Defines the text context info. 5089 * 5090 * @interface TextContextInfo 5091 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5092 * @atomicservice 5093 * @since 12 5094 */ 5095 interface TextContextInfo { 5096 /** 5097 * The Simplified Chinese(UTF-8) text within 250 to recommend images. 5098 * 5099 * @type { ?string } 5100 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5101 * @atomicservice 5102 * @since 12 5103 */ 5104 text?: string; 5105 } 5106 5107 /** 5108 * PhotoSelectResult Object 5109 * 5110 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5111 * @since 10 5112 */ 5113 /** 5114 * PhotoSelectResult Object 5115 * 5116 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5117 * @atomicservice 5118 * @since 11 5119 */ 5120 /** 5121 * PhotoSelectResult Object 5122 * 5123 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5124 * @crossplatform 5125 * @atomicservice 5126 * @since 12 5127 */ 5128 class PhotoSelectResult { 5129 /** 5130 * The uris for the selected files. 5131 * 5132 * @type { Array<string> } 5133 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5134 * @since 10 5135 */ 5136 /** 5137 * The uris for the selected files. 5138 * 5139 * @type { Array<string> } 5140 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5141 * @atomicservice 5142 * @since 11 5143 */ 5144 /** 5145 * The uris for the selected files. 5146 * 5147 * @type { Array<string> } 5148 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5149 * @crossplatform 5150 * @atomicservice 5151 * @since 12 5152 */ 5153 photoUris: Array<string>; 5154 5155 /** 5156 * Original option. 5157 * 5158 * @type { boolean } 5159 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5160 * @since 10 5161 */ 5162 /** 5163 * Original option. 5164 * 5165 * @type { boolean } 5166 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5167 * @atomicservice 5168 * @since 11 5169 */ 5170 /** 5171 * Original option. 5172 * 5173 * @type { boolean } 5174 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5175 * @crossplatform 5176 * @atomicservice 5177 * @since 12 5178 */ 5179 isOriginalPhoto: boolean; 5180 } 5181 5182 /** 5183 * PhotoViewPicker Object 5184 * 5185 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5186 * @since 10 5187 */ 5188 /** 5189 * PhotoViewPicker Object 5190 * 5191 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5192 * @atomicservice 5193 * @since 11 5194 */ 5195 /** 5196 * PhotoViewPicker Object 5197 * 5198 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5199 * @crossplatform 5200 * @atomicservice 5201 * @since 12 5202 */ 5203 class PhotoViewPicker { 5204 /** 5205 * Pull up the photo picker based on the selection mode. 5206 * 5207 * @param { PhotoSelectOptions } [option] - represents the options provided in select mode. 5208 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 5209 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5210 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5211 * @throws { BusinessError } 13900042 - Unknown error 5212 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5213 * @since 10 5214 */ 5215 /** 5216 * Pull up the photo picker based on the selection mode. 5217 * 5218 * @param { PhotoSelectOptions } [option] - represents the options provided in select mode. 5219 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 5220 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5221 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5222 * @throws { BusinessError } 13900042 - Unknown error 5223 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5224 * @atomicservice 5225 * @since 11 5226 */ 5227 /** 5228 * Pull up the photo picker based on the selection mode. 5229 * 5230 * @param { PhotoSelectOptions } [option] - represents the options provided in select mode. 5231 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 5232 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5233 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5234 * @throws { BusinessError } 13900042 - Unknown error 5235 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5236 * @crossplatform 5237 * @atomicservice 5238 * @since 12 5239 */ 5240 select(option?: PhotoSelectOptions): Promise<PhotoSelectResult>; 5241 5242 /** 5243 * Pull up the photo picker based on the selection mode. 5244 * 5245 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 5246 * @param { AsyncCallback<PhotoSelectResult> } callback - Returns the PhotoSelectResult by photo picker 5247 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5248 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5249 * @throws { BusinessError } 13900042 - Unknown error 5250 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5251 * @since 10 5252 */ 5253 /** 5254 * Pull up the photo picker based on the selection mode. 5255 * 5256 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 5257 * @param { AsyncCallback<PhotoSelectResult> } callback - Returns the PhotoSelectResult by photo picker 5258 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5259 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5260 * @throws { BusinessError } 13900042 - Unknown error 5261 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5262 * @atomicservice 5263 * @since 11 5264 */ 5265 /** 5266 * Pull up the photo picker based on the selection mode. 5267 * 5268 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 5269 * @param { AsyncCallback<PhotoSelectResult> } callback - Returns the PhotoSelectResult by photo picker 5270 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5271 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5272 * @throws { BusinessError } 13900042 - Unknown error 5273 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5274 * @crossplatform 5275 * @atomicservice 5276 * @since 12 5277 */ 5278 select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>): void; 5279 5280 /** 5281 * Pull up the photo picker based on the selection mode. 5282 * 5283 * @param { AsyncCallback<PhotoSelectResult> } callback - Returns the PhotoSelectResult by photo picker 5284 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5285 * <br>2. Incorrect parameter types. 5286 * @throws { BusinessError } 13900042 - Unknown error 5287 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5288 * @since 10 5289 */ 5290 /** 5291 * Pull up the photo picker based on the selection mode. 5292 * 5293 * @param { AsyncCallback<PhotoSelectResult> } callback - Returns the PhotoSelectResult by photo picker 5294 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5295 * <br>2. Incorrect parameter types. 5296 * @throws { BusinessError } 13900042 - Unknown error 5297 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5298 * @atomicservice 5299 * @since 11 5300 */ 5301 /** 5302 * Pull up the photo picker based on the selection mode. 5303 * 5304 * @param { AsyncCallback<PhotoSelectResult> } callback - Returns the PhotoSelectResult by photo picker 5305 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5306 * <br>2. Incorrect parameter types. 5307 * @throws { BusinessError } 13900042 - Unknown error 5308 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5309 * @crossplatform 5310 * @atomicservice 5311 * @since 12 5312 */ 5313 select(callback: AsyncCallback<PhotoSelectResult>): void; 5314 } 5315 5316 /** 5317 * MediaAssetEditData Object 5318 * 5319 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5320 * @systemapi 5321 * @since 11 5322 */ 5323 class MediaAssetEditData { 5324 /** 5325 * The constructor to create a MediaAssetEditData instance. 5326 * 5327 * @param { string } compatibleFormat - Compatible format 5328 * @param { string } formatVersion - Format version 5329 * @throws { BusinessError } 202 - Called by non-system application 5330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5331 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5332 * @throws { BusinessError } 14000011 - System inner fail 5333 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5334 * @systemapi 5335 * @since 11 5336 */ 5337 constructor(compatibleFormat: string, formatVersion: string); 5338 5339 /** 5340 * Compatible format 5341 * 5342 * @type { string } 5343 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5344 * @systemapi 5345 * @since 11 5346 */ 5347 compatibleFormat: string; 5348 5349 /** 5350 * Format version 5351 * 5352 * @type { string } 5353 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5354 * @systemapi 5355 * @since 11 5356 */ 5357 formatVersion: string; 5358 5359 /** 5360 * Edit data 5361 * 5362 * @type { string } 5363 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5364 * @systemapi 5365 * @since 11 5366 */ 5367 data: string; 5368 } 5369 5370 /** 5371 * Enumeration of resource type. 5372 * 5373 * @enum { number } ResourceType 5374 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5375 * @atomicservice 5376 * @since 11 5377 */ 5378 enum ResourceType { 5379 /** 5380 * Image resource 5381 * 5382 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5383 * @atomicservice 5384 * @since 11 5385 */ 5386 IMAGE_RESOURCE = 1, 5387 5388 /** 5389 * Video resource 5390 * 5391 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5392 * @atomicservice 5393 * @since 11 5394 */ 5395 VIDEO_RESOURCE = 2, 5396 5397 /** 5398 * Photo proxy 5399 * 5400 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5401 * @systemapi 5402 * @since 11 5403 */ 5404 PHOTO_PROXY = 3, 5405 5406 /** 5407 * Private moving photo resource 5408 * 5409 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5410 * @systemapi 5411 * @since 13 5412 */ 5413 PRIVATE_MOVING_PHOTO_RESOURCE = 4 5414 } 5415 5416 /** 5417 * The format in which the image is saved 5418 * 5419 * @enum { number } ImageFileType 5420 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5421 * @since 13 5422 */ 5423 enum ImageFileType { 5424 /** 5425 * Jpeg type 5426 * 5427 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5428 * @since 13 5429 */ 5430 JPEG = 1, 5431 5432 /** 5433 * Heif type 5434 * 5435 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5436 * @since 13 5437 */ 5438 HEIF = 2 5439 } 5440 5441 /** 5442 * Enumeration of moving photo effect mode. 5443 * 5444 * @enum { number } MovingPhotoEffectMode 5445 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5446 * @systemapi 5447 * @since 12 5448 */ 5449 enum MovingPhotoEffectMode { 5450 /** 5451 * Default 5452 * 5453 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5454 * @systemapi 5455 * @since 12 5456 */ 5457 DEFAULT = 0, 5458 5459 /** 5460 * Bounce play 5461 * 5462 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5463 * @systemapi 5464 * @since 12 5465 */ 5466 BOUNCE_PLAY = 1, 5467 5468 /** 5469 * Loop play 5470 * 5471 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5472 * @systemapi 5473 * @since 12 5474 */ 5475 LOOP_PLAY = 2, 5476 5477 /** 5478 * Long exposure 5479 * 5480 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5481 * @systemapi 5482 * @since 12 5483 */ 5484 LONG_EXPOSURE = 3, 5485 5486 /** 5487 * Multi exposure 5488 * 5489 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5490 * @systemapi 5491 * @since 12 5492 */ 5493 MULTI_EXPOSURE = 4, 5494 5495 /** 5496 * Cinema graph 5497 * 5498 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5499 * @systemapi 5500 * @since 13 5501 */ 5502 CINEMA_GRAPH = 5, 5503 5504 /** 5505 * Image only 5506 * 5507 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5508 * @systemapi 5509 * @since 13 5510 */ 5511 IMAGE_ONLY = 10 5512 } 5513 5514 /** 5515 * Enumeration of video enhancement type. 5516 * 5517 * @enum { number } VideoEnhancementType 5518 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5519 * @systemapi 5520 * @since 13 5521 */ 5522 enum VideoEnhancementType { 5523 /** 5524 * Quality enhancement local 5525 * 5526 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5527 * @systemapi 5528 * @since 13 5529 */ 5530 QUALITY_ENHANCEMENT_LOCAL = 0, 5531 5532 /** 5533 * Quality enhancement cloud 5534 * 5535 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5536 * @systemapi 5537 * @since 13 5538 */ 5539 QUALITY_ENHANCEMENT_CLOUD = 1, 5540 5541 /** 5542 * Quality enhancement local and cloud 5543 * 5544 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5545 * @systemapi 5546 * @since 13 5547 */ 5548 QUALITY_ENHANCEMENT_LOCAL_AND_CLOUD = 2 5549 } 5550 5551 /** 5552 * Defines the interface of media change request. 5553 * 5554 * @interface MediaChangeRequest 5555 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5556 * @atomicservice 5557 * @since 11 5558 */ 5559 interface MediaChangeRequest {} 5560 5561 /** 5562 * Defines the class of media asset change request. 5563 * 5564 * @implements MediaChangeRequest 5565 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5566 * @atomicservice 5567 * @since 11 5568 */ 5569 class MediaAssetChangeRequest implements MediaChangeRequest { 5570 /** 5571 * The constructor to create a MediaAssetChangeRequest instance. 5572 * 5573 * @param { PhotoAsset } asset - Specify which asset to change 5574 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5575 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5576 * @throws { BusinessError } 14000011 - System inner fail 5577 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5578 * @since 11 5579 */ 5580 /** 5581 * The constructor to create a MediaAssetChangeRequest instance. 5582 * 5583 * @param { PhotoAsset } asset - Specify which asset to change 5584 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5585 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5586 * @throws { BusinessError } 14000011 - System inner fail 5587 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5588 * @atomicservice 5589 * @since 12 5590 */ 5591 constructor(asset: PhotoAsset); 5592 5593 /** 5594 * Create image asset change request. 5595 * 5596 * @param { Context } context - Hap context information 5597 * @param { string } fileUri - File uri 5598 * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance 5599 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5600 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5601 * @throws { BusinessError } 13900002 - No such file 5602 * @throws { BusinessError } 14000011 - System inner fail 5603 * @static 5604 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5605 * @since 11 5606 */ 5607 /** 5608 * Create image asset change request. 5609 * 5610 * @param { Context } context - Hap context information 5611 * @param { string } fileUri - File uri 5612 * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance 5613 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5614 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5615 * @throws { BusinessError } 13900002 - No such file 5616 * @throws { BusinessError } 14000011 - System inner fail 5617 * @static 5618 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5619 * @atomicservice 5620 * @since 12 5621 */ 5622 static createImageAssetRequest(context: Context, fileUri: string): MediaAssetChangeRequest; 5623 5624 /** 5625 * Create video asset change request. 5626 * 5627 * @param { Context } context - Hap context information 5628 * @param { string } fileUri - File uri 5629 * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance 5630 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5631 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5632 * @throws { BusinessError } 13900002 - No such file 5633 * @throws { BusinessError } 14000011 - System inner fail 5634 * @static 5635 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5636 * @since 11 5637 */ 5638 static createVideoAssetRequest(context: Context, fileUri: string): MediaAssetChangeRequest; 5639 5640 /** 5641 * Create asset change request. 5642 * 5643 * @param { Context } context - Hap context information 5644 * @param { string } displayName - Asset name 5645 * @param { PhotoCreateOptions } [options] - Optional photo create option 5646 * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance 5647 * @throws { BusinessError } 202 - Called by non-system application 5648 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5649 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5650 * @throws { BusinessError } 14000001 - Invalid display name 5651 * @throws { BusinessError } 14000011 - System inner fail 5652 * @static 5653 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5654 * @systemapi 5655 * @since 11 5656 */ 5657 static createAssetRequest(context: Context, displayName: string, options?: PhotoCreateOptions): MediaAssetChangeRequest; 5658 5659 /** 5660 * Create asset change request. 5661 * 5662 * @param { Context } context - Hap context information 5663 * @param { PhotoType } photoType - Photo asset type 5664 * @param { string } extension - Asset extension 5665 * @param { CreateOptions } [options] - Optional asset create option 5666 * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance 5667 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5668 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5669 * @throws { BusinessError } 14000011 - System inner fail 5670 * @static 5671 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5672 * @atomicservice 5673 * @since 11 5674 */ 5675 static createAssetRequest(context: Context, photoType: PhotoType, extension: string, options?: CreateOptions): MediaAssetChangeRequest; 5676 5677 /** 5678 * Delete assets. 5679 * 5680 * @permission ohos.permission.WRITE_IMAGEVIDEO 5681 * @param { Context } context - Hap context information 5682 * @param { Array<PhotoAsset> } assets - Assets to delete 5683 * @returns { Promise<void> } - Returns void 5684 * @throws { BusinessError } 201 - Permission denied 5685 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5686 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5687 * @throws { BusinessError } 14000011 - System inner fail 5688 * @static 5689 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5690 * @since 11 5691 */ 5692 static deleteAssets(context: Context, assets: Array<PhotoAsset>): Promise<void>; 5693 5694 /** 5695 * Delete assets. 5696 * 5697 * @permission ohos.permission.WRITE_IMAGEVIDEO 5698 * @param { Context } context - Hap context information 5699 * @param { Array<string> } uriList - Uris of assets to delete 5700 * @returns { Promise<void> } - Returns void 5701 * @throws { BusinessError } 201 - Permission denied 5702 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5703 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5704 * @throws { BusinessError } 14000002 - Invalid asset uri 5705 * @throws { BusinessError } 14000011 - System inner fail 5706 * @static 5707 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5708 * @since 11 5709 */ 5710 static deleteAssets(context: Context, uriList: Array<string>): Promise<void>; 5711 5712 /** 5713 * Get the asset. 5714 * 5715 * @returns { PhotoAsset } - Returns the asset 5716 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5717 * <br>2. Incorrect parameter types. 5718 * @throws { BusinessError } 14000011 - System inner fail 5719 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5720 * @since 11 5721 */ 5722 /** 5723 * Get the asset. 5724 * 5725 * @returns { PhotoAsset } - Returns the asset 5726 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5727 * <br>2. Incorrect parameter types. 5728 * @throws { BusinessError } 14000011 - System inner fail 5729 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5730 * @atomicservice 5731 * @since 12 5732 */ 5733 getAsset(): PhotoAsset; 5734 5735 /** 5736 * Set favorite state of the asset. 5737 * 5738 * @param { boolean } favoriteState - true: Put the asset into favorite album; false: Remove the asset from favorite album. 5739 * @throws { BusinessError } 202 - Called by non-system application 5740 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5741 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5742 * @throws { BusinessError } 14000011 - System inner fail 5743 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5744 * @systemapi 5745 * @since 11 5746 */ 5747 setFavorite(favoriteState: boolean): void; 5748 5749 /** 5750 * Set hidden state of the asset. 5751 * 5752 * @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album. 5753 * @throws { BusinessError } 202 - Called by non-system application 5754 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5755 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5756 * @throws { BusinessError } 14000011 - System inner fail 5757 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5758 * @systemapi 5759 * @since 11 5760 */ 5761 setHidden(hiddenState: boolean): void; 5762 5763 /** 5764 * Set user comment of the asset. 5765 * 5766 * @param { string } userComment - user comment info 5767 * @throws { BusinessError } 202 - Called by non-system application 5768 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5769 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5770 * @throws { BusinessError } 14000011 - System inner fail 5771 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5772 * @systemapi 5773 * @since 11 5774 */ 5775 setUserComment(userComment: string): void; 5776 5777 /** 5778 * Set location of the asset. 5779 * 5780 * @param { number } longitude - longitude value of the asset 5781 * @param { number } latitude - latitude value of the asset 5782 * @throws { BusinessError } 202 - Called by non-system application 5783 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5784 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5785 * @throws { BusinessError } 14000011 - System inner fail 5786 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5787 * @systemapi 5788 * @since 11 5789 */ 5790 setLocation(longitude: number, latitude: number): void; 5791 5792 /** 5793 * Set title of the asset. 5794 * 5795 * @param { string } title - the new title of the asset 5796 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5797 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5798 * @throws { BusinessError } 14000011 - System inner fail 5799 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5800 * @since 11 5801 */ 5802 /** 5803 * Set title of the asset. 5804 * 5805 * @param { string } title - the new title of the asset 5806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5807 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5808 * @throws { BusinessError } 14000011 - System inner fail 5809 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5810 * @atomicservice 5811 * @since 12 5812 */ 5813 setTitle(title: string): void; 5814 5815 /** 5816 * Save edit data. 5817 * 5818 * @param { MediaAssetEditData } editData - edit data of the asset 5819 * @throws { BusinessError } 202 - Called by non-system application 5820 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5821 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5822 * @throws { BusinessError } 14000011 - System inner fail 5823 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5824 * @systemapi 5825 * @since 11 5826 */ 5827 setEditData(editData: MediaAssetEditData): void; 5828 5829 /** 5830 * Get write cache handler. 5831 * 5832 * @permission ohos.permission.WRITE_IMAGEVIDEO 5833 * @returns { Promise<number> } Returns the write cache handler 5834 * @throws { BusinessError } 201 - Permission denied 5835 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5836 * <br>2. Incorrect parameter types. 5837 * @throws { BusinessError } 14000011 - System inner fail 5838 * @throws { BusinessError } 14000016 - Operation Not Support 5839 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5840 * @since 11 5841 */ 5842 getWriteCacheHandler(): Promise<number>; 5843 5844 /** 5845 * Add resource of the asset using file uri. 5846 * 5847 * @param { ResourceType } type - Resource type 5848 * @param { string } fileUri - File uri 5849 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5850 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5851 * @throws { BusinessError } 13900002 - No such file 5852 * @throws { BusinessError } 14000011 - System inner fail 5853 * @throws { BusinessError } 14000016 - Operation Not Support 5854 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5855 * @atomicservice 5856 * @since 11 5857 */ 5858 addResource(type: ResourceType, fileUri: string): void; 5859 5860 /** 5861 * Add resource of the asset using ArrayBuffer. 5862 * 5863 * @param { ResourceType } type - Resource type 5864 * @param { ArrayBuffer } data - Data buffer to add 5865 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5866 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5867 * @throws { BusinessError } 14000011 - System inner fail 5868 * @throws { BusinessError } 14000016 - Operation Not Support 5869 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5870 * @atomicservice 5871 * @since 11 5872 */ 5873 addResource(type: ResourceType, data: ArrayBuffer): void; 5874 5875 /** 5876 * Add resource of the asset using PhotoProxy. 5877 * 5878 * @param { ResourceType } type - Resource type 5879 * @param { PhotoProxy } proxy - Photo proxy used to add resource 5880 * @throws { BusinessError } 202 - Called by non-system application 5881 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5882 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5883 * @throws { BusinessError } 14000011 - System inner fail 5884 * @throws { BusinessError } 14000016 - Operation Not Support 5885 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5886 * @systemapi 5887 * @since 11 5888 */ 5889 addResource(type: ResourceType, proxy: PhotoProxy): void; 5890 5891 /** 5892 * Set camera shot key. 5893 * 5894 * @param { string } cameraShotKey - Camera shot key of the asset 5895 * @throws { BusinessError } 202 - Called by non-system application 5896 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5897 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5898 * @throws { BusinessError } 14000011 - System inner fail 5899 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5900 * @systemapi 5901 * @since 12 5902 */ 5903 setCameraShotKey(cameraShotKey: string): void; 5904 5905 /** 5906 * Save the photo asset captured by camera. 5907 * 5908 * @throws { BusinessError } 14000011 - System inner fail 5909 * @throws { BusinessError } 14000016 - Operation Not Support 5910 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5911 * @since 12 5912 */ 5913 saveCameraPhoto(): void; 5914 5915 /** 5916 * Save the photo asset captured by camera with imageFileType. 5917 * 5918 * @param { ImageFileType } imageFileType - Image file type 5919 * @throws { BusinessError } 14000011 - System inner fail 5920 * @throws { BusinessError } 14000016 - Operation Not Support 5921 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5922 * @since 13 5923 */ 5924 saveCameraPhoto(imageFileType: ImageFileType): void; 5925 5926 /** 5927 * Discard the photo asset captured by camera. 5928 * 5929 * @throws { BusinessError } 14000011 - Internal system error 5930 * @throws { BusinessError } 14000016 - Operation Not Support 5931 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5932 * @since 12 5933 */ 5934 discardCameraPhoto(): void; 5935 5936 /** 5937 * Set effect mode of moving photo. 5938 * 5939 * @param { MovingPhotoEffectMode } mode - the new effect mode of the moving photo 5940 * @throws { BusinessError } 202 - Called by non-system application 5941 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5942 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5943 * @throws { BusinessError } 14000011 - System inner fail 5944 * @throws { BusinessError } 14000016 - Operation Not Support 5945 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5946 * @systemapi 5947 * @since 12 5948 */ 5949 setEffectMode(mode: MovingPhotoEffectMode): void; 5950 5951 /** 5952 * Set video enhancement attribute 5953 * 5954 * @param { VideoEnhancementType } videoEnhancementType - The type of video enhancement 5955 * @param { string } photoId - The photo id of video 5956 * @throws { BusinessError } 202 - Called by non-system application 5957 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5958 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5959 * @throws { BusinessError } 14000011 - Internal system error 5960 * @throws { BusinessError } 14000016 - Operation Not Support 5961 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5962 * @systemapi 5963 * @since 13 5964 */ 5965 setVideoEnhancementAttr(videoEnhancementType: VideoEnhancementType, photoId: string): void; 5966 5967 /** 5968 * Set watermark type of the asset. 5969 * 5970 * @param { WatermarkType } watermarkType - the new watermark type of the asset 5971 * @throws { BusinessError } 202 - Called by non-system application 5972 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5973 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5974 * @throws { BusinessError } 14000011 - Internal system error 5975 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5976 * @systemapi 5977 * @since 14 5978 */ 5979 setSupportedWatermarkType(watermarkType: WatermarkType): void; 5980 } 5981 5982 /** 5983 * Defines the class of media assets change request. 5984 * 5985 * @implements MediaChangeRequest 5986 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 5987 * @systemapi 5988 * @since 11 5989 */ 5990 class MediaAssetsChangeRequest implements MediaChangeRequest { 5991 /** 5992 * The constructor to create a MediaAssetsChangeRequest instance. 5993 * 5994 * @param { Array<PhotoAsset> } assets - Specify which assets to change 5995 * @throws { BusinessError } 202 - Called by non-system application 5996 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 5997 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5998 * @throws { BusinessError } 14000011 - System inner fail 5999 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6000 * @systemapi 6001 * @since 11 6002 */ 6003 constructor(assets: Array<PhotoAsset>); 6004 6005 /** 6006 * Set favorite state of the assets. 6007 * 6008 * @param { boolean } favoriteState - true: Put the assets into favorite album; false: Remove the assets from favorite album. 6009 * @throws { BusinessError } 202 - Called by non-system application 6010 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6011 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6012 * @throws { BusinessError } 14000011 - System inner fail 6013 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6014 * @systemapi 6015 * @since 11 6016 */ 6017 setFavorite(favoriteState: boolean): void; 6018 6019 /** 6020 * Set hidden state of the assets. 6021 * 6022 * @param { boolean } hiddenState - true: Put the assets into hidden album; false: Recover the assets from hidden album. 6023 * @throws { BusinessError } 202 - Called by non-system application 6024 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6025 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6026 * @throws { BusinessError } 14000011 - System inner fail 6027 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6028 * @systemapi 6029 * @since 11 6030 */ 6031 setHidden(hiddenState: boolean): void; 6032 6033 /** 6034 * Set user comment of the assets. 6035 * 6036 * @param { string } userComment - user comment info 6037 * @throws { BusinessError } 202 - Called by non-system application 6038 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6039 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6040 * @throws { BusinessError } 14000011 - System inner fail 6041 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6042 * @systemapi 6043 * @since 11 6044 */ 6045 setUserComment(userComment: string): void; 6046 } 6047 6048 /** 6049 * Defines the class of media album change request. 6050 * 6051 * @implements MediaChangeRequest 6052 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6053 * @since 11 6054 */ 6055 class MediaAlbumChangeRequest implements MediaChangeRequest { 6056 /** 6057 * The constructor to create a MediaAlbumChangeRequest instance. 6058 * 6059 * @param { Album } album - Specify which album to change 6060 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6061 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6062 * @throws { BusinessError } 14000011 - System inner fail 6063 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6064 * @since 11 6065 */ 6066 constructor(album: Album); 6067 6068 /** 6069 * Create album change request. 6070 * 6071 * @param { Context } context - Hap context information 6072 * @param { string } name - Album name 6073 * @returns { MediaAlbumChangeRequest } - Returns a MediaAlbumChangeRequest instance 6074 * @throws { BusinessError } 202 - Called by non-system application 6075 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6076 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6077 * @throws { BusinessError } 14000011 - System inner fail 6078 * @static 6079 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6080 * @systemapi 6081 * @since 11 6082 */ 6083 static createAlbumRequest(context: Context, name: string): MediaAlbumChangeRequest; 6084 6085 /** 6086 * Delete albums. 6087 * 6088 * @permission ohos.permission.WRITE_IMAGEVIDEO 6089 * @param { Context } context - Hap context information 6090 * @param { Array<Album> } albums - Albums to delete 6091 * @returns { Promise<void> } - Returns void 6092 * @throws { BusinessError } 201 - Permission denied 6093 * @throws { BusinessError } 202 - Called by non-system application 6094 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6095 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6096 * @throws { BusinessError } 14000011 - System inner fail 6097 * @static 6098 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6099 * @systemapi 6100 * @since 11 6101 */ 6102 static deleteAlbums(context: Context, albums: Array<Album>): Promise<void>; 6103 6104 /** 6105 * Get the album. 6106 * 6107 * @returns { Album } - Returns the album 6108 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6109 * <br>2. Incorrect parameter types. 6110 * @throws { BusinessError } 14000011 - System inner fail 6111 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6112 * @since 11 6113 */ 6114 getAlbum(): Album; 6115 6116 /** 6117 * Set cover uri of the album. 6118 * 6119 * @param { string } coverUri - the asset uri to set 6120 * @throws { BusinessError } 202 - Called by non-system application 6121 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6122 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6123 * @throws { BusinessError } 14000011 - System inner fail 6124 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6125 * @systemapi 6126 * @since 11 6127 */ 6128 setCoverUri(coverUri: string): void; 6129 6130 /** 6131 * Set name of the album. 6132 * 6133 * @param { string } name - the new name to set 6134 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6135 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6136 * @throws { BusinessError } 14000011 - System inner fail 6137 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6138 * @since 11 6139 */ 6140 setAlbumName(name: string): void; 6141 6142 /** 6143 * Add assets into the album. 6144 * 6145 * @param { Array<PhotoAsset> } assets - the assets to add 6146 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6147 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6148 * @throws { BusinessError } 14000011 - System inner fail 6149 * @throws { BusinessError } 14000016 - Operation Not Support 6150 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6151 * @since 11 6152 */ 6153 addAssets(assets: Array<PhotoAsset>): void; 6154 6155 /** 6156 * Remove assets from the album. 6157 * 6158 * @param { Array<PhotoAsset> } assets - the assets to be removed 6159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6160 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6161 * @throws { BusinessError } 14000011 - System inner fail 6162 * @throws { BusinessError } 14000016 - Operation Not Support 6163 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6164 * @since 11 6165 */ 6166 removeAssets(assets: Array<PhotoAsset>): void; 6167 6168 /** 6169 * Move assets to the target album. 6170 * 6171 * @param { Array<PhotoAsset> } assets - the assets to move 6172 * @param { Album } targetAlbum - target album 6173 * @throws { BusinessError } 202 - Called by non-system application 6174 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6175 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6176 * @throws { BusinessError } 14000011 - System inner fail 6177 * @throws { BusinessError } 14000016 - Operation Not Support 6178 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6179 * @systemapi 6180 * @since 11 6181 */ 6182 moveAssets(assets: Array<PhotoAsset>, targetAlbum: Album): void; 6183 6184 /** 6185 * Recover assets from the trash album. 6186 * 6187 * @param { Array<PhotoAsset> } assets - the assets to recover 6188 * @throws { BusinessError } 202 - Called by non-system application 6189 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6190 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6191 * @throws { BusinessError } 14000011 - System inner fail 6192 * @throws { BusinessError } 14000016 - Operation Not Support 6193 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6194 * @systemapi 6195 * @since 11 6196 */ 6197 recoverAssets(assets: Array<PhotoAsset>): void; 6198 6199 /** 6200 * Delete assets permanently from the trash album. 6201 * 6202 * @param { Array<PhotoAsset> } assets - the assets to be deleted permanently 6203 * @throws { BusinessError } 202 - Called by non-system application 6204 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6205 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6206 * @throws { BusinessError } 14000011 - System inner fail 6207 * @throws { BusinessError } 14000016 - Operation Not Support 6208 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6209 * @systemapi 6210 * @since 11 6211 */ 6212 deleteAssets(assets: Array<PhotoAsset>): void; 6213 6214 /** 6215 * Set portrait album to me 6216 * 6217 * @throws { BusinessError } 202 - Called by non-system application 6218 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6219 * <br>2. Incorrect parameter types. 6220 * @throws { BusinessError } 14000011 - System inner fail 6221 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6222 * @systemapi 6223 * @since 11 6224 */ 6225 setIsMe(): void; 6226 6227 /** 6228 * Set display level of the portrait album 6229 * 6230 * @param { number } displayLevel - The level of display interface for portrait albums, such as homepage and more pages 6231 * @throws { BusinessError } 202 - Called by non-system application 6232 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6233 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6234 * @throws { BusinessError } 14000011 - System inner fail 6235 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6236 * @systemapi 6237 * @since 11 6238 */ 6239 setDisplayLevel(displayLevel: number): void; 6240 6241 /** 6242 * Remove assets from the smart album 6243 * 6244 * @param { Array<PhotoAsset> } assets - List of assets that need to be removed 6245 * @throws { BusinessError } 202 - Called by non-system application 6246 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6247 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6248 * @throws { BusinessError } 14000011 - System inner fail 6249 * @throws { BusinessError } 14000016 - Operation Not Support 6250 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6251 * @systemapi 6252 * @since 11 6253 */ 6254 dismissAssets(assets: Array<PhotoAsset>): void; 6255 6256 /** 6257 * Merge two portrait albums 6258 * 6259 * @param { Album } target - Albums that need to be merged 6260 * @throws { BusinessError } 202 - Called by non-system application 6261 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6262 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6263 * @throws { BusinessError } 14000011 - System inner fail 6264 * @throws { BusinessError } 14000016 - Operation Not Support 6265 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6266 * @systemapi 6267 * @since 11 6268 */ 6269 mergeAlbum(target: Album): void; 6270 6271 /** 6272 * Place the current album in front of the target album. 6273 * 6274 * @param { Album } album - Specify the target album to be placed before 6275 * @throws { BusinessError } 202 - Called by non-system application 6276 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6277 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6278 * @throws { BusinessError } 14000011 - System inner fail 6279 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6280 * @systemapi 6281 * @since 11 6282 */ 6283 placeBefore(album: Album): void; 6284 6285 /** 6286 * Dismiss group photo album. 6287 * 6288 * @throws { BusinessError } 202 - Called by non-system application 6289 * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types. 6290 * @throws { BusinessError } 14000011 - System inner fail 6291 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6292 * @systemapi 6293 * @since 13 6294 */ 6295 dismiss(): void; 6296 } 6297 6298 /** 6299 * Defines the shared photo asset 6300 * 6301 * @interface SharedPhotoAsset 6302 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6303 * @systemapi 6304 * @since 13 6305 */ 6306 interface SharedPhotoAsset { 6307 /** 6308 * File id of photo asset 6309 * 6310 * @type { number } 6311 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6312 * @systemapi 6313 * @since 13 6314 */ 6315 fileId: number; 6316 /** 6317 * URI of photo asset 6318 * 6319 * @type { string } 6320 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6321 * @systemapi 6322 * @since 13 6323 */ 6324 uri: string; 6325 /** 6326 * Path data of photo asset 6327 * 6328 * @type { string } 6329 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6330 * @systemapi 6331 * @since 13 6332 */ 6333 data: string; 6334 /** 6335 * Media type of photo asset 6336 * 6337 * @type { PhotoType } 6338 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6339 * @systemapi 6340 * @since 13 6341 */ 6342 mediaType: PhotoType; 6343 /** 6344 * Display name of photo asset 6345 * 6346 * @type { string } 6347 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6348 * @systemapi 6349 * @since 13 6350 */ 6351 displayName: string; 6352 /** 6353 * Size of photo asset 6354 * 6355 * @type { number } 6356 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6357 * @systemapi 6358 * @since 13 6359 */ 6360 size: number; 6361 /** 6362 * Added date of photo asset 6363 * 6364 * @type { number } 6365 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6366 * @systemapi 6367 * @since 13 6368 */ 6369 dateAdded: number; 6370 /** 6371 * Modify date of photo asset 6372 * 6373 * @type { number } 6374 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6375 * @systemapi 6376 * @since 13 6377 */ 6378 dateModified: number; 6379 /** 6380 * Duration of video photo asset 6381 * 6382 * @type { number } 6383 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6384 * @systemapi 6385 * @since 13 6386 */ 6387 duration: number; 6388 /** 6389 * Width of photo asset 6390 * 6391 * @type { number } 6392 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6393 * @systemapi 6394 * @since 13 6395 */ 6396 width: number; 6397 /** 6398 * Height of photo asset 6399 * 6400 * @type { number } 6401 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6402 * @systemapi 6403 * @since 13 6404 */ 6405 height: number; 6406 /** 6407 * DateTaken of photo asset 6408 * 6409 * @type { number } 6410 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6411 * @systemapi 6412 * @since 13 6413 */ 6414 dateTaken: number; 6415 /** 6416 * Orientation of photo asset 6417 * 6418 * @type { number } 6419 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6420 * @systemapi 6421 * @since 13 6422 */ 6423 orientation: number; 6424 /** 6425 * Favorite state of photo asset 6426 * 6427 * @type { boolean } 6428 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6429 * @systemapi 6430 * @since 13 6431 */ 6432 isFavorite: boolean; 6433 /** 6434 * Title of photo asset 6435 * 6436 * @type { string } 6437 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6438 * @systemapi 6439 * @since 13 6440 */ 6441 title: string; 6442 /** 6443 * Position of photo asset 6444 * 6445 * @type { PositionType } 6446 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6447 * @systemapi 6448 * @since 13 6449 */ 6450 position: PositionType; 6451 /** 6452 * Trashed date of photo asset 6453 * 6454 * @type { number } 6455 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6456 * @systemapi 6457 * @since 13 6458 */ 6459 dateTrashed: number; 6460 /** 6461 * Hidden state of photo asset 6462 * 6463 * @type { boolean } 6464 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6465 * @systemapi 6466 * @since 13 6467 */ 6468 hidden: boolean; 6469 /** 6470 * User comment info of photo asset 6471 * 6472 * @type { string } 6473 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6474 * @systemapi 6475 * @since 13 6476 */ 6477 userComment: string; 6478 /** 6479 * Camera shot key of photo asset 6480 * 6481 * @type { string } 6482 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6483 * @systemapi 6484 * @since 13 6485 */ 6486 cameraShotKey: string; 6487 /** 6488 * The year of the file created 6489 * 6490 * @type { string } 6491 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6492 * @systemapi 6493 * @since 13 6494 */ 6495 dateYear: string; 6496 /** 6497 * The month of the file created 6498 * 6499 * @type { string } 6500 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6501 * @systemapi 6502 * @since 13 6503 */ 6504 dateMonth: string; 6505 /** 6506 * The day of the file created 6507 * 6508 * @type { string } 6509 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6510 * @systemapi 6511 * @since 13 6512 */ 6513 dateDay: string; 6514 /** 6515 * Pending state of the asset, true means asset is pending 6516 * 6517 * @type { boolean } 6518 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6519 * @systemapi 6520 * @since 13 6521 */ 6522 pending: boolean; 6523 /** 6524 * Added date of photo asset in milliseconds 6525 * 6526 * @type { number } 6527 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6528 * @systemapi 6529 * @since 13 6530 */ 6531 dateAddedMs: number; 6532 /** 6533 * Modified time of the asset in milliseconds 6534 * 6535 * @type { number } 6536 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6537 * @systemapi 6538 * @since 13 6539 */ 6540 dateModifiedMs: number; 6541 /** 6542 * Trashed time of the asset in milliseconds 6543 * 6544 * @type { number } 6545 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6546 * @systemapi 6547 * @since 13 6548 */ 6549 dateTrashedMs: number; 6550 /** 6551 * Subtype of photo asset 6552 * 6553 * @type { PhotoSubtype } 6554 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6555 * @systemapi 6556 * @since 13 6557 */ 6558 subtype: PhotoSubtype; 6559 /** 6560 * Effect mode of moving photo 6561 * 6562 * @type { MovingPhotoEffectMode } 6563 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6564 * @systemapi 6565 * @since 13 6566 */ 6567 movingPhotoEffectMode: MovingPhotoEffectMode; 6568 /** 6569 * Dynamic range type of the asset 6570 * 6571 * @type { DynamicRangeType } 6572 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6573 * @systemapi 6574 * @since 13 6575 */ 6576 dynamicRangeType: DynamicRangeType; 6577 /** 6578 * Ready state of thumbnail 6579 * 6580 * @type { boolean } 6581 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6582 * @systemapi 6583 * @since 13 6584 */ 6585 thumbnailReady: boolean; 6586 /** 6587 * Width and height information of lcd picture 6588 * 6589 * @type { string } 6590 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6591 * @systemapi 6592 * @since 13 6593 */ 6594 lcdSize: string; 6595 /** 6596 * Width and height information of thumbnail picture 6597 * 6598 * @type { string } 6599 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6600 * @systemapi 6601 * @since 13 6602 */ 6603 thmSize: string; 6604 /** 6605 * modified time of thumbnail status 6606 * 6607 * @type { number } 6608 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6609 * @systemapi 6610 * @since 14 6611 */ 6612 thumbnailModifiedMs?: number; 6613 /** 6614 * visibility of thumbnails 6615 * 6616 * @type { ThumbnailVisibility } 6617 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6618 * @systemapi 6619 * @since 14 6620 */ 6621 thumbnailVisible: ThumbnailVisibility; 6622 } 6623 6624 /** 6625 * Defines the shared album asset 6626 * 6627 * @interface SharedAlbumAsset 6628 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6629 * @systemapi 6630 * @since 14 6631 */ 6632 interface SharedAlbumAsset { 6633 /** 6634 * album id of album asset 6635 * 6636 * @type { number } 6637 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6638 * @systemapi 6639 * @since 14 6640 */ 6641 albumId: number; 6642 /** 6643 * type of album asset 6644 * 6645 * @type { AlbumType } 6646 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6647 * @systemapi 6648 * @since 14 6649 */ 6650 albumType: AlbumType; 6651 /** 6652 * subtype of album asset 6653 * 6654 * @type { AlbumSubtype } 6655 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6656 * @systemapi 6657 * @since 14 6658 */ 6659 albumSubType: AlbumSubtype; 6660 /** 6661 * album name 6662 * 6663 * @type { string } 6664 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6665 * @systemapi 6666 * @since 14 6667 */ 6668 albumName: string; 6669 /** 6670 * uri of album cover 6671 * 6672 * @type { string } 6673 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6674 * @systemapi 6675 * @since 14 6676 */ 6677 coverUri: string; 6678 /** 6679 * number of assets in this album 6680 * 6681 * @type { number } 6682 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6683 * @systemapi 6684 * @since 14 6685 */ 6686 count: number; 6687 /** 6688 * number of photo assets in this album 6689 * 6690 * @type { number } 6691 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6692 * @systemapi 6693 * @since 14 6694 */ 6695 imageCount: number; 6696 /** 6697 * number of video assets in this album 6698 * 6699 * @type { number } 6700 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6701 * @systemapi 6702 * @since 14 6703 */ 6704 videoCount: number; 6705 } 6706 6707 /** 6708 * Defines the moving photo. 6709 * 6710 * @interface MovingPhoto 6711 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6712 * @atomicservice 6713 * @since 12 6714 */ 6715 interface MovingPhoto { 6716 /** 6717 * Request the image and video content of the moving photo and write to destination uri. 6718 * 6719 * @permission ohos.permission.READ_IMAGEVIDEO 6720 * @param { string } imageFileUri - Destination uri of the image content to be written 6721 * @param { string } videoFileUri - Destination uri of the video content to be written 6722 * @returns { Promise<void> } Returns void 6723 * @throws { BusinessError } 201 - Permission denied 6724 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6725 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6726 * @throws { BusinessError } 14000011 - System inner fail 6727 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6728 * @atomicservice 6729 * @since 12 6730 */ 6731 requestContent(imageFileUri: string, videoFileUri: string): Promise<void>; 6732 6733 /** 6734 * Request content of the moving photo for the given resource type and write to destination uri. 6735 * 6736 * @permission ohos.permission.READ_IMAGEVIDEO 6737 * @param { ResourceType } resourceType - The resource type of the content to request 6738 * @param { string } fileUri - Destination uri of the content to be written 6739 * @returns { Promise<void> } Returns void 6740 * @throws { BusinessError } 201 - Permission denied 6741 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6742 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6743 * @throws { BusinessError } 14000011 - System inner fail 6744 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6745 * @atomicservice 6746 * @since 12 6747 */ 6748 requestContent(resourceType: ResourceType, fileUri: string): Promise<void>; 6749 6750 /** 6751 * Request content of the moving photo for the given resource type and return the array buffer. 6752 * 6753 * @permission ohos.permission.READ_IMAGEVIDEO 6754 * @param { ResourceType } resourceType - The resource type of the content to request 6755 * @returns { Promise<ArrayBuffer> } Returns array buffer of the content 6756 * @throws { BusinessError } 201 - Permission denied 6757 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6758 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6759 * @throws { BusinessError } 14000011 - System inner fail 6760 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6761 * @atomicservice 6762 * @since 12 6763 */ 6764 requestContent(resourceType: ResourceType): Promise<ArrayBuffer>; 6765 6766 /** 6767 * Get uri of the moving photo. 6768 * 6769 * @returns { string } Returns uri of the moving photo 6770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6771 * <br>2. Incorrect parameter types. 6772 * @throws { BusinessError } 14000011 - System inner fail 6773 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6774 * @atomicservice 6775 * @since 12 6776 */ 6777 getUri(): string; 6778 } 6779 6780 /** 6781 * Highlight album info type 6782 * 6783 * @enum { number } HighlightAlbumInfoType 6784 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6785 * @systemapi 6786 * @since 12 6787 */ 6788 enum HighlightAlbumInfoType { 6789 /** 6790 * Highlight cover info 6791 * 6792 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6793 * @systemapi 6794 * @since 12 6795 */ 6796 COVER_INFO = 0, 6797 /** 6798 * Highlight play info 6799 * 6800 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6801 * @systemapi 6802 * @since 12 6803 */ 6804 PLAY_INFO 6805 } 6806 6807 /** 6808 * Highlight user action type 6809 * 6810 * @enum { number } HighlightUserActionType 6811 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6812 * @systemapi 6813 * @since 12 6814 */ 6815 enum HighlightUserActionType { 6816 /** 6817 * Highlight album inserted picture count 6818 * 6819 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6820 * @systemapi 6821 * @since 12 6822 */ 6823 INSERTED_PIC_COUNT = 0, 6824 /** 6825 * Highlight album removed picture count 6826 * 6827 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6828 * @systemapi 6829 * @since 12 6830 */ 6831 REMOVED_PIC_COUNT, 6832 /** 6833 * Highlight album shared screenshot count 6834 * 6835 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6836 * @systemapi 6837 * @since 12 6838 */ 6839 SHARED_SCREENSHOT_COUNT, 6840 /** 6841 * Highlight album shared cover count 6842 * 6843 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6844 * @systemapi 6845 * @since 12 6846 */ 6847 SHARED_COVER_COUNT, 6848 /** 6849 * Highlight album renamed count 6850 * 6851 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6852 * @systemapi 6853 * @since 12 6854 */ 6855 RENAMED_COUNT, 6856 /** 6857 * Highlight album changed cover count 6858 * 6859 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6860 * @systemapi 6861 * @since 12 6862 */ 6863 CHANGED_COVER_COUNT, 6864 /** 6865 * Highlight album render viewed times 6866 * 6867 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6868 * @systemapi 6869 * @since 12 6870 */ 6871 RENDER_VIEWED_TIMES = 100, 6872 /** 6873 * Highlight album render viewed duration 6874 * 6875 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6876 * @systemapi 6877 * @since 12 6878 */ 6879 RENDER_VIEWED_DURATION, 6880 /** 6881 * Highlight album art layout viewed times 6882 * 6883 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6884 * @systemapi 6885 * @since 12 6886 */ 6887 ART_LAYOUT_VIEWED_TIMES, 6888 /** 6889 * Highlight album art layout viewed duration 6890 * 6891 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6892 * @systemapi 6893 * @since 12 6894 */ 6895 ART_LAYOUT_VIEWED_DURATION 6896 } 6897 6898 /** 6899 * The type of thumbnail 6900 * 6901 * @enum { number } ThumbnailType 6902 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6903 * @systemapi 6904 * @since 13 6905 */ 6906 enum ThumbnailType { 6907 /** 6908 * LCD thumbnail 6909 * 6910 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6911 * @systemapi 6912 * @since 13 6913 */ 6914 LCD = 1, 6915 /** 6916 * THM thumbnail 6917 * 6918 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6919 * @systemapi 6920 * @since 13 6921 */ 6922 THM = 2 6923 } 6924 6925 /** 6926 * Defines the class of highlight album. 6927 * 6928 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6929 * @systemapi 6930 * @since 12 6931 */ 6932 class HighlightAlbum { 6933 /** 6934 * The constructor to create a highlight instance. 6935 * 6936 * @param { Album } album - Analysis album 6937 * @throws { BusinessError } 202 - Called by non-system application 6938 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6939 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6940 * @throws { BusinessError } 14000011 - Internal system error 6941 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6942 * @systemapi 6943 * @since 12 6944 */ 6945 constructor(album: Album); 6946 6947 /** 6948 * Get highlight album info. 6949 * 6950 * @permission ohos.permission.READ_IMAGEVIDEO 6951 * @param { HighlightAlbumInfoType } type - Highlight album info type 6952 * @returns { Promise<string> } Returns highlight album info into a json string 6953 * @throws { BusinessError } 201 - Permission denied 6954 * @throws { BusinessError } 202 - Called by non-system application 6955 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6956 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6957 * @throws { BusinessError } 14000011 - Internal system error 6958 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6959 * @systemapi 6960 * @since 12 6961 */ 6962 getHighlightAlbumInfo(type: HighlightAlbumInfoType): Promise<string>; 6963 6964 /** 6965 * Get highlight resource array buffer. 6966 * 6967 * @permission ohos.permission.READ_IMAGEVIDEO 6968 * @param { string } resourceUri - highlight resource uri 6969 * @returns { Promise<ArrayBuffer> } Returns array buffer of the content 6970 * @throws { BusinessError } 201 - Permission denied 6971 * @throws { BusinessError } 202 - Called by non-system application 6972 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6973 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6974 * @throws { BusinessError } 14000011 - Internal system error 6975 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6976 * @systemapi 6977 * @since 12 6978 */ 6979 getHighlightResource(resourceUri: string): Promise<ArrayBuffer>; 6980 6981 /** 6982 * Set highlight user action data 6983 * 6984 * @permission ohos.permission.WRITE_IMAGEVIDEO 6985 * @param { HighlightUserActionType } type - Highlight user action type 6986 * @param { number } actionData - User action highlight album data 6987 * @returns { Promise<void> } Returns void 6988 * @throws { BusinessError } 201 - Permission denied 6989 * @throws { BusinessError } 202 - Called by non-system application 6990 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6991 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6992 * @throws { BusinessError } 14000011 - Internal system error 6993 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 6994 * @systemapi 6995 * @since 12 6996 */ 6997 setHighlightUserActionData(type: HighlightUserActionType, actionData: number): Promise<void>; 6998 } 6999 7000 /** 7001 * Cloud enhancement task stage. 7002 * 7003 * @enum { number } CloudEnhancementTaskStage 7004 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7005 * @systemapi 7006 * @since 13 7007 */ 7008 enum CloudEnhancementTaskStage { 7009 /** 7010 * Cloud enhancement task exception stage. 7011 * 7012 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7013 * @systemapi 7014 * @since 13 7015 */ 7016 TASK_STAGE_EXCEPTION = -1, 7017 /** 7018 * Cloud enhancement task preparing stage. 7019 * 7020 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7021 * @systemapi 7022 * @since 13 7023 */ 7024 TASK_STAGE_PREPARING, 7025 /** 7026 * Cloud enhancement task uploading stage. 7027 * 7028 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7029 * @systemapi 7030 * @since 13 7031 */ 7032 TASK_STAGE_UPLOADING, 7033 /** 7034 * Cloud enhancement task executing stage. 7035 * 7036 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7037 * @systemapi 7038 * @since 13 7039 */ 7040 TASK_STAGE_EXECUTING, 7041 /** 7042 * Cloud enhancement task downloading stage. 7043 * 7044 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7045 * @systemapi 7046 * @since 13 7047 */ 7048 TASK_STAGE_DOWNLOADING, 7049 /** 7050 * Cloud enhancement task failed stage. 7051 * 7052 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7053 * @systemapi 7054 * @since 13 7055 */ 7056 TASK_STAGE_FAILED, 7057 /** 7058 * Cloud enhancement task completed stage. 7059 * 7060 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7061 * @systemapi 7062 * @since 13 7063 */ 7064 TASK_STAGE_COMPLETED 7065 } 7066 7067 /** 7068 * Task state of cloud enhancement. 7069 * 7070 * @interface CloudEnhancementTaskState 7071 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7072 * @systemapi 7073 * @since 13 7074 */ 7075 interface CloudEnhancementTaskState { 7076 /** 7077 * Indicates the cloud enhancement task stage. 7078 * 7079 * @type { CloudEnhancementTaskStage } 7080 * @readonly 7081 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7082 * @systemapi 7083 * @since 13 7084 */ 7085 readonly taskStage: CloudEnhancementTaskStage; 7086 /** 7087 * Indicates the transferred file size. 7088 * 7089 * @type { ?number } 7090 * @readonly 7091 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7092 * @systemapi 7093 * @since 13 7094 */ 7095 readonly transferredFileSize?: number; 7096 /** 7097 * Indicates the total file size. 7098 * 7099 * @type { ?number } 7100 * @readonly 7101 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7102 * @systemapi 7103 * @since 13 7104 */ 7105 readonly totalFileSize?: number; 7106 /** 7107 * Indicates the expected duration of cloud enhancement queue time. 7108 * 7109 * @type { ?number } 7110 * @readonly 7111 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7112 * @systemapi 7113 * @since 13 7114 */ 7115 readonly expectedDuration?: number; 7116 /** 7117 * Status code when failed in cloud enhancement. 7118 * 7119 * @type { ?number } 7120 * @readonly 7121 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7122 * @systemapi 7123 * @since 13 7124 */ 7125 readonly statusCode?: number; 7126 } 7127 7128 /** 7129 * Defines the class of cloud enhancement. 7130 * 7131 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7132 * @systemapi 7133 * @since 13 7134 */ 7135 class CloudEnhancement { 7136 /** 7137 * Get cloud enhancement instance. 7138 * 7139 * @param { Context } context - Hap context information 7140 * @returns { CloudEnhancement } Returns cloud enhancement instance 7141 * @throws { BusinessError } 202 - Called by non-system application 7142 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7143 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7144 * @throws { BusinessError } 14000011 - Internal system error 7145 * @static 7146 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7147 * @systemapi 7148 * @since 13 7149 */ 7150 static getCloudEnhancementInstance(context: Context): CloudEnhancement; 7151 7152 /** 7153 * Submit cloud enhancement tasks. 7154 * 7155 * @permission ohos.permission.WRITE_IMAGEVIDEO 7156 * @param { Array<PhotoAsset> } photoAssets - The photo assets requested 7157 * @param { boolean } hasCloudWatermark - true: Persistent cloud watermark; false: Not persistent cloud watermark. 7158 * @returns { Promise<void> } Returns void 7159 * @throws { BusinessError } 201 - Permission denied 7160 * @throws { BusinessError } 202 - Called by non-system application 7161 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7162 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7163 * @throws { BusinessError } 14000011 - Internal system error 7164 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7165 * @systemapi 7166 * @since 13 7167 */ 7168 submitCloudEnhancementTasks(photoAssets: Array<PhotoAsset>, hasCloudWatermark: boolean): Promise<void>; 7169 7170 /** 7171 * Prioritize cloud enhancement task. 7172 * 7173 * @permission ohos.permission.WRITE_IMAGEVIDEO 7174 * @param { PhotoAsset } photoAsset - The photo asset requested 7175 * @returns { Promise<void> } Returns void 7176 * @throws { BusinessError } 201 - Permission denied 7177 * @throws { BusinessError } 202 - Called by non-system application 7178 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7179 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7180 * @throws { BusinessError } 14000011 - Internal system error 7181 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7182 * @systemapi 7183 * @since 13 7184 */ 7185 prioritizeCloudEnhancementTask(photoAsset: PhotoAsset): Promise<void>; 7186 7187 /** 7188 * Cancel cloud enhancement tasks. 7189 * 7190 * @permission ohos.permission.WRITE_IMAGEVIDEO 7191 * @param { Array<PhotoAsset> } photoAssets - The photo assets requested 7192 * @returns { Promise<void> } Returns void 7193 * @throws { BusinessError } 201 - Permission denied 7194 * @throws { BusinessError } 202 - Called by non-system application 7195 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7196 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7197 * @throws { BusinessError } 14000011 - Internal system error 7198 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7199 * @systemapi 7200 * @since 13 7201 */ 7202 cancelCloudEnhancementTasks(photoAssets: Array<PhotoAsset>): Promise<void>; 7203 7204 /** 7205 * Cancel all cloud enhancement tasks. 7206 * 7207 * @permission ohos.permission.WRITE_IMAGEVIDEO 7208 * @returns { Promise<void> } Returns void 7209 * @throws { BusinessError } 201 - Permission denied 7210 * @throws { BusinessError } 202 - Called by non-system application 7211 * @throws { BusinessError } 14000011 - Internal system error 7212 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7213 * @systemapi 7214 * @since 13 7215 */ 7216 cancelAllCloudEnhancementTasks(): Promise<void>; 7217 7218 /** 7219 * Query cloud enhancement task state. 7220 * 7221 * @permission ohos.permission.READ_IMAGEVIDEO 7222 * @param { PhotoAsset } photoAsset - The photo asset requested 7223 * @returns { Promise<CloudEnhancementTaskState> } Returns cloud enhancement task state 7224 * @throws { BusinessError } 201 - Permission denied 7225 * @throws { BusinessError } 202 - Called by non-system application 7226 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7227 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7228 * @throws { BusinessError } 14000011 - Internal system error 7229 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7230 * @systemapi 7231 * @since 13 7232 */ 7233 queryCloudEnhancementTaskState(photoAsset: PhotoAsset): Promise<CloudEnhancementTaskState>; 7234 7235 /** 7236 * Sync cloud enhancement task status. 7237 * 7238 * @permission ohos.permission.READ_IMAGEVIDEO 7239 * @returns { Promise<void> } Returns void 7240 * @throws { BusinessError } 201 - Permission denied 7241 * @throws { BusinessError } 202 - Called by non-system application 7242 * @throws { BusinessError } 14000011 - Internal system error 7243 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7244 * @systemapi 7245 * @since 13 7246 */ 7247 syncCloudEnhancementTaskStatus(): Promise<void>; 7248 7249 /** 7250 * Get cloud enhancement pair. 7251 * 7252 * @permission ohos.permission.READ_IMAGEVIDEO 7253 * @param { PhotoAsset } asset - The asset requested 7254 * @returns { Promise<PhotoAsset> } Returns cloud-enhanced asset 7255 * @throws { BusinessError } 201 - Permission denied 7256 * @throws { BusinessError } 202 - Called by non-system application 7257 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7258 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7259 * @throws { BusinessError } 14000011 - Internal system error 7260 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7261 * @systemapi 7262 * @since 13 7263 */ 7264 getCloudEnhancementPair(asset: PhotoAsset): Promise<PhotoAsset>; 7265 } 7266 7267 /** 7268 * Cloud enhancement state. 7269 * 7270 * @enum { number } CloudEnhancementState 7271 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7272 * @systemapi 7273 * @since 13 7274 */ 7275 enum CloudEnhancementState { 7276 /** 7277 * Cloud enhancement unavailable state. 7278 * 7279 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7280 * @systemapi 7281 * @since 13 7282 */ 7283 UNAVAILABLE = 0, 7284 /** 7285 * Cloud enhancement available state. 7286 * 7287 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7288 * @systemapi 7289 * @since 13 7290 */ 7291 AVAILABLE, 7292 /** 7293 * Cloud enhancement executing state. 7294 * 7295 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7296 * @systemapi 7297 * @since 13 7298 */ 7299 EXECUTING, 7300 /** 7301 * Cloud enhancement completed state. 7302 * 7303 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7304 * @systemapi 7305 * @since 13 7306 */ 7307 COMPLETED 7308 } 7309 7310 /** 7311 * Cloud media asset task status. 7312 * 7313 * @enum { number } CloudMediaAssetTaskStatus 7314 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7315 * @systemapi 7316 * @since 14 7317 */ 7318 enum CloudMediaAssetTaskStatus { 7319 /** 7320 * Cloud media asset task status of downloading. 7321 * 7322 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7323 * @systemapi 7324 * @since 14 7325 */ 7326 DOWNLOADING = 0, 7327 /** 7328 * Cloud media asset task status of paused. 7329 * 7330 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7331 * @systemapi 7332 * @since 14 7333 */ 7334 PAUSED = 1, 7335 /** 7336 * Cloud media asset task status of idle. 7337 * 7338 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7339 * @systemapi 7340 * @since 14 7341 */ 7342 IDLE = 2 7343 } 7344 7345 /** 7346 * Cloud media task pause cause. 7347 * 7348 * @enum { number } CloudMediaTaskPauseCause 7349 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7350 * @systemapi 7351 * @since 14 7352 */ 7353 enum CloudMediaTaskPauseCause { 7354 /** 7355 * No pause. 7356 * 7357 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7358 * @systemapi 7359 * @since 14 7360 */ 7361 NO_PAUSE = 0, 7362 /** 7363 * Temperature limit. 7364 * 7365 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7366 * @systemapi 7367 * @since 14 7368 */ 7369 TEMPERATURE_LIMIT = 1, 7370 /** 7371 * Rom limit. 7372 * 7373 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7374 * @systemapi 7375 * @since 14 7376 */ 7377 ROM_LIMIT = 2, 7378 /** 7379 * Network flow limit. 7380 * 7381 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7382 * @systemapi 7383 * @since 14 7384 */ 7385 NETWORK_FLOW_LIMIT = 3, 7386 /** 7387 * Wifi unavailable. 7388 * 7389 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7390 * @systemapi 7391 * @since 14 7392 */ 7393 WIFI_UNAVAILABLE = 4, 7394 /** 7395 * Power limit. 7396 * 7397 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7398 * @systemapi 7399 * @since 14 7400 */ 7401 POWER_LIMIT = 5, 7402 /** 7403 * Background task unavailable. 7404 * 7405 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7406 * @systemapi 7407 * @since 14 7408 */ 7409 BACKGROUND_TASK_UNAVAILABLE = 6, 7410 /** 7411 * Frequent user requests. 7412 * 7413 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7414 * @systemapi 7415 * @since 14 7416 */ 7417 FREQUENT_USER_REQUESTS = 7, 7418 /** 7419 * cloud error. 7420 * 7421 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7422 * @systemapi 7423 * @since 14 7424 */ 7425 CLOUD_ERROR = 8, 7426 /** 7427 * User paused. 7428 * 7429 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7430 * @systemapi 7431 * @since 14 7432 */ 7433 USER_PAUSED = 9 7434 } 7435 7436 /** 7437 * Status of cloud media asset. 7438 * 7439 * @interface CloudMediaAssetStatus 7440 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7441 * @systemapi 7442 * @since 14 7443 */ 7444 interface CloudMediaAssetStatus { 7445 /** 7446 * Indicates the cloud media asset task status. 7447 * 7448 * @type { CloudMediaAssetTaskStatus } 7449 * @readonly 7450 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7451 * @systemapi 7452 * @since 14 7453 */ 7454 readonly taskStatus: CloudMediaAssetTaskStatus; 7455 /** 7456 * Indicates the downloading task info, including total count, total size, remain count and remain size. 7457 * 7458 * @type { string } 7459 * @readonly 7460 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7461 * @systemapi 7462 * @since 14 7463 */ 7464 readonly taskInfo: string; 7465 /** 7466 * Indicates the cloud media task pause status. 7467 * 7468 * @type { CloudMediaTaskPauseCause } 7469 * @readonly 7470 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7471 * @systemapi 7472 * @since 14 7473 */ 7474 readonly errorCode: CloudMediaTaskPauseCause; 7475 } 7476 7477 /** 7478 * Cloud media download type. 7479 * 7480 * @enum { number } CloudMediaDownloadType 7481 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7482 * @systemapi 7483 * @since 14 7484 */ 7485 enum CloudMediaDownloadType { 7486 /** 7487 * High-priority download policy, no background task required. 7488 * 7489 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7490 * @systemapi 7491 * @since 14 7492 */ 7493 DOWNLOAD_FORCE = 0, 7494 /** 7495 * Low-priority download policy, requiring background task. 7496 * 7497 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7498 * @systemapi 7499 * @since 14 7500 */ 7501 DOWNLOAD_GENTLE = 1 7502 } 7503 7504 /** 7505 * Cloud media retain type. 7506 * 7507 * @enum { number } CloudMediaRetainType 7508 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7509 * @systemapi 7510 * @since 14 7511 */ 7512 enum CloudMediaRetainType { 7513 /** 7514 * Delete native metadata and thumbnails of cloud-only media assets. 7515 * 7516 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7517 * @systemapi 7518 * @since 14 7519 */ 7520 RETAIN_FORCE = 0 7521 } 7522 7523 /** 7524 * Defines the class of cloud media asset manager. 7525 * 7526 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7527 * @systemapi 7528 * @since 14 7529 */ 7530 class CloudMediaAssetManager { 7531 /** 7532 * Get cloud media asset manager instance. 7533 * 7534 * @param { Context } context - Hap context information 7535 * @returns { CloudMediaAssetManager } Returns cloud media asset manager instance 7536 * @throws { BusinessError } 202 - Called by non-system application 7537 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7538 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7539 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 7540 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 7541 * @static 7542 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7543 * @systemapi 7544 * @since 14 7545 */ 7546 static getCloudMediaAssetManagerInstance(context: Context): CloudMediaAssetManager; 7547 7548 /** 7549 * Start or resume download cloud media. 7550 * 7551 * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER 7552 * @param { CloudMediaDownloadType } downloadType - cloud media download type. 7553 * @returns { Promise<void> } Returns void 7554 * @throws { BusinessError } 201 - Permission denied 7555 * @throws { BusinessError } 202 - Called by non-system application 7556 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7557 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7558 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 7559 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 7560 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7561 * @systemapi 7562 * @since 14 7563 */ 7564 startDownloadCloudMedia(downloadType: CloudMediaDownloadType): Promise<void>; 7565 7566 /** 7567 * Pause download cloud media. 7568 * 7569 * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER 7570 * @returns { Promise<void> } Returns void 7571 * @throws { BusinessError } 201 - Permission denied 7572 * @throws { BusinessError } 202 - Called by non-system application 7573 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 7574 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 7575 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7576 * @systemapi 7577 * @since 14 7578 */ 7579 pauseDownloadCloudMedia(): Promise<void>; 7580 7581 /** 7582 * Cancel download cloud media. 7583 * 7584 * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER 7585 * @returns { Promise<void> } Returns void 7586 * @throws { BusinessError } 201 - Permission denied 7587 * @throws { BusinessError } 202 - Called by non-system application 7588 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 7589 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 7590 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7591 * @systemapi 7592 * @since 14 7593 */ 7594 cancelDownloadCloudMedia(): Promise<void>; 7595 7596 /** 7597 * Retain cloud media asset. 7598 * 7599 * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER 7600 * @param { CloudMediaRetainType } retainType - cloud media retain type. 7601 * @returns { Promise<void> } Returns void 7602 * @throws { BusinessError } 201 - Permission denied 7603 * @throws { BusinessError } 202 - Called by non-system application 7604 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 7605 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 7606 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 7607 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 7608 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7609 * @systemapi 7610 * @since 14 7611 */ 7612 retainCloudMediaAsset(retainType: CloudMediaRetainType): Promise<void>; 7613 7614 /** 7615 * Get cloud media asset status. 7616 * 7617 * @permission ohos.permission.READ_IMAGEVIDEO 7618 * @returns { Promise<CloudMediaAssetStatus> } Returns cloud media asset status 7619 * @throws { BusinessError } 201 - Permission denied 7620 * @throws { BusinessError } 202 - Called by non-system application 7621 * @throws { BusinessError } 14000011 - Internal system error. It is recommended to retry and check the logs. 7622 * <br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. 7623 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 7624 * @systemapi 7625 * @since 14 7626 */ 7627 getCloudMediaAssetStatus(): Promise<CloudMediaAssetStatus>; 7628 } 7629} 7630 7631export default photoAccessHelper; 7632