1/* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file Helper functions to access image and video assets 18 * @kit MediaLibraryKit 19 */ 20 21import type Context from './application/Context'; 22import type image from './@ohos.multimedia.image'; 23import lang from '../arkts/@arkts.lang'; 24import photoAccessHelper from './@ohos.file.photoAccessHelper'; 25 26/** 27 * Helper functions to access image and video assets 28 * 29 * @namespace sendablePhotoAccessHelper 30 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 31 * @atomicservice 32 * @since 12 33 */ 34declare namespace sendablePhotoAccessHelper { 35 /** 36 * Returns an instance of PhotoAccessHelper 37 * 38 * @param { Context } context - Hap context information 39 * @returns { PhotoAccessHelper } Instance of PhotoAccessHelper 40 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 41 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 42 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 43 * @StageModelOnly 44 * @atomicservice 45 * @since 12 46 */ 47 function getPhotoAccessHelper(context: Context): PhotoAccessHelper; 48 49 /** 50 * Enumeration of different types of photos 51 * 52 * @enum { number } PhotoType 53 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 54 * @atomicservice 55 * @since 12 56 */ 57 const enum PhotoType { 58 /** 59 * Image asset 60 * 61 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 62 * @atomicservice 63 * @since 12 64 */ 65 IMAGE = 1, 66 /** 67 * Video asset 68 * 69 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 70 * @atomicservice 71 * @since 12 72 */ 73 VIDEO 74 } 75 76 /** 77 * Defines the photo asset 78 * 79 * @interface PhotoAsset 80 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 81 * @atomicservice 82 * @since 12 83 */ 84 interface PhotoAsset extends lang.ISendable { 85 /** 86 * uri of the asset. 87 * 88 * @type { string } 89 * @readonly 90 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 91 * @atomicservice 92 * @since 12 93 */ 94 readonly uri: string; 95 /** 96 * Photo type, image or video 97 * 98 * @type { PhotoType } 99 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 100 * @since 12 101 */ 102 readonly photoType: PhotoType; 103 /** 104 * Display name (with a file name extension) of the asset. 105 * 106 * @type { string } 107 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 108 * @since 12 109 */ 110 readonly displayName: string; 111 /** 112 * Returns the value of the specified member. 113 * 114 * @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE) 115 * @returns { MemberType } Returns the value of the specified photo asset member 116 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 117 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 118 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 119 * @since 12 120 */ 121 get(member: string): photoAccessHelper.MemberType; 122 /** 123 * Set a new value to the specified member 124 * 125 * @param { string } member - Photo asset member 126 * @param { string } value - The new value of the member. 127 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 128 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 129 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 130 * @since 12 131 * @example : set(PhotoKeys.TITLE, "newTitle"), call commitModify after set 132 */ 133 set(member: string, value: string): void; 134 /** 135 * Modify metadata of the asset 136 * 137 * @permission ohos.permission.WRITE_IMAGEVIDEO 138 * @returns { Promise<void> } Returns void 139 * @throws { BusinessError } 201 - Permission denied 140 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 141 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 142 * @throws { BusinessError } 14000011 - Internal system error 143 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 144 * @atomicservice 145 * @since 12 146 */ 147 commitModify(): Promise<void>; 148 /** 149 * Get thumbnail of the asset 150 * 151 * @permission ohos.permission.READ_IMAGEVIDEO 152 * @param { image.Size } [size] - Thumbnail's size 153 * @returns { Promise<image.PixelMap> } Returns the thumbnail's pixelMap. 154 * @throws { BusinessError } 201 - Permission denied 155 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 156 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 157 * @throws { BusinessError } 14000011 - Internal system error 158 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 159 * @since 12 160 */ 161 getThumbnail(size?: image.Size): Promise<image.PixelMap>; 162 /** 163 * Get analysis data of the asset. 164 * 165 * @permission ohos.permission.READ_IMAGEVIDEO 166 * @param { AnalysisType } analysisType - Analysis type 167 * @returns { Promise<string> } Returns analysis info into a json string 168 * @throws { BusinessError } 201 - Permission denied 169 * @throws { BusinessError } 202 - Called by non-system application 170 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 171 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 172 * @throws { BusinessError } 14000011 - Internal system error 173 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 174 * @systemapi 175 * @since 12 176 */ 177 getAnalysisData(analysisType: photoAccessHelper.AnalysisType): Promise<string>; 178 /** 179 * Requests the read-only FD of the source asset. 180 * 181 * @permission ohos.permission.READ_IMAGEVIDEO 182 * @returns { Promise<number> } Returns opened source asset fd. 183 * @throws { BusinessError } 201 - Permission denied. 184 * @throws { BusinessError } 202 - Called by non-system application. 185 * @throws { BusinessError } 14000011 - Internal system error 186 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 187 * @systemapi 188 * @since 12 189 */ 190 requestSource(): Promise<number>; 191 /** 192 * Creates a photoAccessHelper photoasset from sendable photoAccessHelper photoasset. 193 * 194 * @returns { photoAccessHelper.PhotoAsset } Returns the instance if the operation is successful. 195 * @throws { BusinessError } 201 - Permission denied. 196 * @throws { BusinessError } 14000011 - Internal system error 197 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 198 * @since 12 199 */ 200 convertToPhotoAsset(): photoAccessHelper.PhotoAsset; 201 } 202 203 /** 204 * The fetch result of assets or albums 205 * 206 * @interface FetchResult 207 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 208 * @since 12 209 */ 210 interface FetchResult<T> extends lang.ISendable { 211 /** 212 * Obtains the total number of objects in the fetch result. 213 * 214 * @returns { number } Total number of objects. 215 * @throws { BusinessError } 14000011 - Internal system error 216 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 217 * @since 12 218 */ 219 getCount(): number; 220 /** 221 * Checks whether the result set points to the last row. 222 * You need to check whether the object is the last one before calling getNextObject. 223 * 224 * @returns { boolean } Whether the object is the last one in the fetch result. 225 * @throws { BusinessError } 14000011 - Internal system error 226 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 227 * @since 12 228 */ 229 isAfterLast(): boolean; 230 /** 231 * Obtains the first object in the fetch result. 232 * 233 * @returns { Promise<T> } Returns the first object in the fetch result. 234 * @throws { BusinessError } 14000011 - Internal system error 235 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 236 * @since 12 237 */ 238 getFirstObject(): Promise<T>; 239 /** 240 * Obtains the next object in the fetch result. 241 * Before calling this method, you must use isAfterLast() to check whether the current position is the last row 242 * in the fetch result. This method only works when the current position is not the last row. 243 * 244 * @returns { Promise<T> } Returns the next object 245 * @throws { BusinessError } 14000011 - Internal system error 246 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 247 * @since 12 248 */ 249 getNextObject(): Promise<T>; 250 /** 251 * Obtains the last object in the fetch result 252 * 253 * @returns { Promise<T> } Returns the last object 254 * @throws { BusinessError } 14000011 - Internal system error 255 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 256 * @since 12 257 */ 258 getLastObject(): Promise<T>; 259 /** 260 * Obtains the object with the specified index in the fetch result. 261 * 262 * @param { number } index - Index of the asset to obtain. 263 * @returns { Promise<T> } Returns the object 264 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 265 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 266 * @throws { BusinessError } 14000011 - Internal system error 267 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 268 * @since 12 269 */ 270 getObjectByPosition(index: number): Promise<T>; 271 /** 272 * Obtains all objects in the fetch result. 273 * 274 * @returns { Promise<Array<T>> } Returns all the objects 275 * @throws { BusinessError } 14000011 - Internal system error 276 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 277 * @since 12 278 */ 279 getAllObjects(): Promise<Array<T>>; 280 /** 281 * Releases the fetch result. 282 * 283 * @throws { BusinessError } 14000011 - Internal system error 284 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 285 * @since 12 286 */ 287 close(): void; 288 } 289 290 /** 291 * Album type. 292 * 293 * @enum { number } AlbumType 294 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 295 * @since 12 296 */ 297 const enum AlbumType { 298 /** 299 * Album created by user. 300 * 301 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 302 * @since 12 303 */ 304 USER = 0, 305 /** 306 * Album created by system, which metadata cannot be modified. 307 * 308 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 309 * @since 12 310 */ 311 SYSTEM = 1024, 312 /** 313 * Album created by smart abilities. 314 * 315 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 316 * @systemapi 317 * @since 12 318 */ 319 SMART = 4096 320 } 321 322 /** 323 * Album subtype 324 * 325 * @enum { number } AlbumSubtype 326 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 327 * @since 12 328 */ 329 const enum AlbumSubtype { 330 /** 331 * Generic user-created albums. 332 * 333 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 334 * @since 12 335 */ 336 USER_GENERIC = 1, 337 /** 338 * Favorite album, which assets are marked as favorite. 339 * 340 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 341 * @since 12 342 */ 343 FAVORITE = 1025, 344 /** 345 * Video album, which contains all video assets. 346 * 347 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 348 * @since 12 349 */ 350 VIDEO, 351 /** 352 * Hidden album, which assets are marked as hidden. 353 * 354 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 355 * @systemapi 356 * @since 12 357 */ 358 HIDDEN, 359 /** 360 * Trash album, which assets are deleted. 361 * 362 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 363 * @systemapi 364 * @since 12 365 */ 366 TRASH, 367 /** 368 * Screenshot album 369 * 370 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 371 * @systemapi 372 * @since 12 373 */ 374 SCREENSHOT, 375 /** 376 * Camera album 377 * 378 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 379 * @systemapi 380 * @since 12 381 */ 382 CAMERA, 383 /** 384 * Image album 385 * 386 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 387 * @since 12 388 */ 389 IMAGE = 1031, 390 /** 391 * Source album 392 * 393 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 394 * @systemapi 395 * @since 12 396 */ 397 SOURCE_GENERIC = 2049, 398 /** 399 * Classify album 400 * 401 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 402 * @systemapi 403 * @since 12 404 */ 405 CLASSIFY = 4097, 406 /** 407 * Location album 408 * 409 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 410 * @systemapi 411 * @since 12 412 */ 413 GEOGRAPHY_LOCATION = 4099, 414 /** 415 * City album 416 * 417 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 418 * @systemapi 419 * @since 12 420 */ 421 GEOGRAPHY_CITY, 422 /** 423 * ShootingMode album 424 * 425 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 426 * @systemapi 427 * @since 12 428 */ 429 SHOOTING_MODE, 430 /** 431 * Portrait album 432 * 433 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 434 * @systemapi 435 * @since 12 436 */ 437 PORTRAIT, 438 /** 439 * Group photo album 440 * 441 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 442 * @systemapi 443 * @since 12 444 */ 445 GROUP_PHOTO, 446 /** 447 * Highlight album 448 * 449 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 450 * @systemapi 451 * @since 12 452 */ 453 HIGHLIGHT = 4104, 454 /** 455 * Highlight suggestions album 456 * 457 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 458 * @systemapi 459 * @since 12 460 */ 461 HIGHLIGHT_SUGGESTIONS, 462 /** 463 * Any album 464 * 465 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 466 * @since 12 467 */ 468 ANY = 2147483647 469 } 470 471 /** 472 * Defines the abstract interface of albums. 473 * 474 * @interface AbsAlbum 475 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 476 * @since 12 477 */ 478 interface AbsAlbum extends lang.ISendable { 479 /** 480 * Album type 481 * 482 * @type { AlbumType } 483 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 484 * @since 12 485 */ 486 readonly albumType: AlbumType; 487 /** 488 * Album subtype 489 * 490 * @type { AlbumSubtype } 491 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 492 * @since 12 493 */ 494 readonly albumSubtype: AlbumSubtype; 495 /** 496 * Album name. 497 * 498 * @type { string } 499 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 500 * @since 12 501 */ 502 albumName: string; 503 /** 504 * Album uri. 505 * 506 * @type { string } 507 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 508 * @since 12 509 */ 510 readonly albumUri: string; 511 /** 512 * Number of assets in the album 513 * 514 * @type { number } 515 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 516 * @since 12 517 */ 518 readonly count: number; 519 /** 520 * Cover uri for the album 521 * 522 * @type { string } 523 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 524 * @since 12 525 */ 526 readonly coverUri: string; 527 /** 528 * Fetch assets in an album. 529 * 530 * @permission ohos.permission.READ_IMAGEVIDEO 531 * @param { FetchOptions } options - Fetch options. 532 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result 533 * @throws { BusinessError } 201 - Permission denied. 534 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 535 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 536 * @throws { BusinessError } 14000011 - Internal system error 537 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 538 * @since 12 539 */ 540 getAssets(options: photoAccessHelper.FetchOptions): Promise<FetchResult<PhotoAsset>>; 541 } 542 543 /** 544 * Defines the album. 545 * 546 * @interface Album 547 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 548 * @since 12 549 */ 550 interface Album extends AbsAlbum { 551 /** 552 * Number of image assets in the album 553 * 554 * @type { ?number } 555 * @readonly 556 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 557 * @since 12 558 */ 559 readonly imageCount?: number; 560 /** 561 * Number of video assets in the album 562 * 563 * @type { ?number } 564 * @readonly 565 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 566 * @since 12 567 */ 568 readonly videoCount?: number; 569 /** 570 * Modify metadata for the album 571 * 572 * @permission ohos.permission.WRITE_IMAGEVIDEO 573 * @returns { Promise<void> } Returns void 574 * @throws { BusinessError } 201 - Permission denied. 575 * @throws { BusinessError } 14000011 - Internal system error 576 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 577 * @since 12 578 */ 579 commitModify(): Promise<void>; 580 /** 581 * Creates a photoAccessHelper album from sendable photoAccessHelper album. 582 * 583 * @returns { photoAccessHelper.Album } Returns the instance if the operation is successful. 584 * @throws { BusinessError } 201 - Permission denied. 585 * @throws { BusinessError } 14000011 - Internal system error 586 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 587 * @since 12 588 */ 589 convertToPhotoAlbum(): photoAccessHelper.Album; 590 /** 591 * Get the faceId of the portrait album or group photo album. 592 * 593 * @permission ohos.permission.READ_IMAGEVIDEO 594 * @returns { Promise<string> } Returns tag_id if portrait album, Returns group_tag if group photo album, 595 * <br>Returns empty if not found. 596 * @throws { BusinessError } 201 - Permission denied 597 * @throws { BusinessError } 202 - Called by non-system application 598 * @throws { BusinessError } 14000011 - Internal system error 599 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 600 * @systemapi 601 * @since 13 602 */ 603 getFaceId(): Promise<string>; 604 } 605 606 /** 607 * Helper functions to access photos and albums. 608 * 609 * @interface PhotoAccessHelper 610 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 611 * @atomicservice 612 * @since 12 613 */ 614 interface PhotoAccessHelper extends lang.ISendable { 615 /** 616 * Fetch photo assets 617 * 618 * @permission ohos.permission.READ_IMAGEVIDEO 619 * @param { FetchOptions } options - Retrieval options. 620 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result. 621 * @throws { BusinessError } 201 - Permission denied. 622 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 623 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 624 * @throws { BusinessError } 14000011 - Internal system error 625 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 626 * @since 12 627 */ 628 getAssets(options: photoAccessHelper.FetchOptions): Promise<FetchResult<PhotoAsset>>; 629 /** 630 * Fetch a group of burst assets 631 * 632 * @permission ohos.permission.READ_IMAGEVIDEO 633 * @param { string } burstKey - Burst asset options. 634 * @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result. 635 * @throws { BusinessError } 201 - Permission denied 636 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 637 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 638 * @throws { BusinessError } 14000011 - Internal system error 639 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 640 * @since 12 641 */ 642 getBurstAssets(burstKey: string, options: photoAccessHelper.FetchOptions): Promise<FetchResult<PhotoAsset>>; 643 /** 644 * Create a photo asset 645 * 646 * @permission ohos.permission.WRITE_IMAGEVIDEO 647 * @param { string } displayName - Asset name 648 * @returns { Promise<PhotoAsset> } Returns the newly created asset 649 * @throws { BusinessError } 201 - Permission denied 650 * @throws { BusinessError } 202 - Called by non-system application. 651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 652 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 653 * @throws { BusinessError } 14000011 - Internal system error 654 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 655 * @systemapi 656 * @since 12 657 */ 658 createAsset(displayName: string): Promise<PhotoAsset>; 659 /** 660 * Create a photo asset 661 * 662 * @permission ohos.permission.WRITE_IMAGEVIDEO 663 * @param { string } displayName - Asset name 664 * @param { PhotoCreateOptions } options - Create operation 665 * @throws { BusinessError } 201 - Permission denied 666 * @returns { Promise<PhotoAsset> } Returns the newly created asset 667 * @throws { BusinessError } 202 - Called by non-system application. 668 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 669 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 670 * @throws { BusinessError } 14000011 - Internal system error 671 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 672 * @systemapi 673 * @since 12 674 */ 675 createAsset(displayName: string, options: photoAccessHelper.PhotoCreateOptions): Promise<PhotoAsset>; 676 /** 677 * Create a photo asset: 678 * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; 679 * 2. Get WRITE_IMAGEVIDEO permission by ACL; 680 * 681 * @permission ohos.permission.WRITE_IMAGEVIDEO 682 * @param { PhotoType } photoType - Photo asset type 683 * @param { string } extension - Asset extension 684 * @param { CreateOptions } [options] - Optional asset create option 685 * @returns { Promise<string> } Returns the uri of the newly created asset 686 * @throws { BusinessError } 201 - Permission denied 687 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 688 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 689 * @throws { BusinessError } 14000011 - Internal system error 690 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 691 * @atomicservice 692 * @since 12 693 */ 694 createAsset(photoType: PhotoType, extension: string, options?: photoAccessHelper.CreateOptions): Promise<string>; 695 /** 696 * Fetch albums. 697 * 698 * @permission ohos.permission.READ_IMAGEVIDEO 699 * @param { FetchOptions } [options] - options to fetch albums 700 * @returns { Promise<FetchResult<Album>> } - Returns the fetch result 701 * @throws { BusinessError } 201 - Permission denied 702 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 703 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 704 * @throws { BusinessError } 14000011 - Internal system error 705 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 706 * @since 12 707 */ 708 getAlbums(options: photoAccessHelper.FetchOptions): Promise<FetchResult<Album>>; 709 /** 710 * Fetch albums. 711 * 712 * @permission ohos.permission.READ_IMAGEVIDEO 713 * @param { AlbumType } type - Album type. 714 * @param { AlbumSubtype } subtype - Album subtype. 715 * @param { FetchOptions } [options] - options to fetch albums 716 * @returns { Promise<FetchResult<Album>> } - Returns the fetch result 717 * @throws { BusinessError } 201 - Permission denied 718 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 719 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 720 * @throws { BusinessError } 14000011 - Internal system error 721 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 722 * @since 12 723 */ 724 getAlbums( 725 type: AlbumType, 726 subtype: AlbumSubtype, 727 options?: photoAccessHelper.FetchOptions 728 ): Promise<FetchResult<Album>>; 729 /** 730 * Fetch albums containing hidden assets. 731 * 732 * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS 733 * @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets. 734 * @param { FetchOptions } [options] - Options to fetch albums. 735 * @returns { Promise<FetchResult<Album>> } Returns fetchResult of albums containing hidden assets. 736 * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. 737 * @throws { BusinessError } 202 - Called by non-system application 738 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 739 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 740 * @throws { BusinessError } 14000011 - Internal system error 741 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 742 * @systemapi 743 * @since 12 744 */ 745 getHiddenAlbums( 746 mode: photoAccessHelper.HiddenPhotosDisplayMode, 747 options?: photoAccessHelper.FetchOptions 748 ): Promise<FetchResult<Album>>; 749 /** 750 * Release PhotoAccessHelper instance 751 * 752 * @returns { Promise<void> } Returns void 753 * @throws { BusinessError } 14000011 - Internal system error 754 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 755 * @since 12 756 */ 757 release(): Promise<void>; 758 } 759} 760 761export default sendablePhotoAccessHelper;