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