interface_sdk-js/api/@ohos.file.photoAccessHelper.d.ts
luojunlin e284a92197 添加元服务能力标签
Signed-off-by: luojunlin <luojunlin5@huawei.com>
Change-Id: I24722b1ace809e3c470f9857938c5c1f157d981c
2023-12-19 09:49:40 +08:00

2558 lines
94 KiB
TypeScript

/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit Media Library Kit
*/
import type { AsyncCallback, Callback } from './@ohos.base';
import type Context from './application/Context';
import type image from './@ohos.multimedia.image';
import type dataSharePredicates from './@ohos.data.dataSharePredicates';
/**
* Helper functions to access image and video assets
*
* @namespace photoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
declare namespace photoAccessHelper {
/**
* Returns an instance of PhotoAccessHelper
*
* @param { Context } context - Hap context information
* @returns { PhotoAccessHelper } Instance of PhotoAccessHelper
* @throws { BusinessError } 401 - if parameter is invalid
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @StageModelOnly
* @since 10
*/
/**
* Returns an instance of PhotoAccessHelper
*
* @param { Context } context - Hap context information
* @returns { PhotoAccessHelper } Instance of PhotoAccessHelper
* @throws { BusinessError } 401 - if parameter is invalid
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @StageModelOnly
* @atomicservice
* @since 11
*/
function getPhotoAccessHelper(context: Context): PhotoAccessHelper;
/**
* Enumeration of different types of photos
*
* @enum { number } PhotoType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum PhotoType {
/**
* Image asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
IMAGE = 1,
/**
* Video asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
VIDEO
}
/**
* Enumeration of different categories of photos
*
* @enum { number } PhotoSubtype
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
enum PhotoSubtype {
/**
* Default Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
DEFAULT,
/**
* Screenshot Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
SCREENSHOT
}
/**
* Photo asset position
*
* @enum { number } Photo asset position, such as local device or cloud
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
enum PositionType {
/**
* Asset exists only in local device
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
LOCAL = 1 << 0,
/**
* Asset exists only in cloud
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
CLOUD = 1 << 1
}
/**
* Enumeration of different recommendation type
*
* @enum { number } RecommendationType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
enum RecommendationType {
/**
* QR_OR_BAR_CODE indicates that QR code or barcode photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
QR_OR_BAR_CODE = 1,
/**
* QR_CODE indicates that QR code photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
QR_CODE = 2,
/**
* BAR_CODE indicates that barcode photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
BAR_CODE = 3,
/**
* ID_CARD indicates that QR code or barcode photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
ID_CARD = 4,
/**
* PROFILE_PICTURE indicates that profile picture photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
PROFILE_PICTURE = 5
}
/**
* Indicates the type of photo asset member.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
type MemberType = number | string | boolean;
/**
* Defines the photo asset
*
* @interface PhotoAsset
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface PhotoAsset {
/**
* uri of the asset.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly uri: string;
/**
* Photo type, image or video
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly photoType: PhotoType;
/**
* Display name (with a file name extension) of the asset.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly displayName: string;
/**
* Returns the value of the specified member.
*
* @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE)
* @returns { MemberType }
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000014 - Member is not a valid PhotoKey
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
get(member: string): MemberType;
/**
* Set a new value to the specified member
*
* @param { string } member - Photo asset member
* @param { string } value - The new value of the member.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000014 - Member is not a valid PhotoKey
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @example : set(PhotoKeys.TITLE, "newTitle"), call commitModify after set
*/
set(member: string, value: string): void;
/**
* Modify metadata of the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { AsyncCallback<void> } callback - Returns void.
* @throws { BusinessError } 401 - if values to commit is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Modify metadata of the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { AsyncCallback<void> } callback - Returns void.
* @throws { BusinessError } 401 - if values to commit is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
commitModify(callback: AsyncCallback<void>): void;
/**
* Modify metadata of the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 401 - if values to commit is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Modify metadata of the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 401 - if values to commit is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
commitModify(): Promise<void>;
/**
* Open the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO
* @param { string } mode - Mode for open, for example: rw, r, w.
* @param { AsyncCallback<number> } callback - Callback return the fd of the asset.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
open(mode: string, callback: AsyncCallback<number>): void;
/**
* Open the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO
* @param { string } mode - Mode for open, for example: rw, r, w.
* @returns { Promise<number> } Returns the fd
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
open(mode: string): Promise<number>;
/**
* Open the asset in read only mode
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<number> } callback - Returns the read only fd
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getReadOnlyFd(callback: AsyncCallback<number>): void;
/**
* Open the asset in read only mode
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise<number> } Returns the read only fd
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getReadOnlyFd(): Promise<number>;
/**
* Close the asset
*
* @param { number } fd - The opened fd of the asset.
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
close(fd: number, callback: AsyncCallback<void>): void;
/**
* Close the asset
*
* @param { number } fd - The opened fd of the asset.
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
close(fd: number): Promise<void>;
/**
* Get thumbnail of the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<image.PixelMap> } callback - Returns the thumbnail's pixelMap.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getThumbnail(callback: AsyncCallback<image.PixelMap>): void;
/**
* Get thumbnail of the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { image.Size } size - Thumbnail's size
* @param { AsyncCallback<image.PixelMap> } callback - Returns the thumbnail's pixelMap.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getThumbnail(size: image.Size, callback: AsyncCallback<image.PixelMap>): void;
/**
* Get thumbnail of the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { image.Size } size - Thumbnail's size
* @returns { Promise<image.PixelMap> } Returns the thumbnail's pixelMap.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getThumbnail(size?: image.Size): Promise<image.PixelMap>;
/**
* Set favorite state for the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { boolean } favoriteState - true: Put the asset into favorite album; false: Remove the asset from favorite album.
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setFavorite(favoriteState: boolean, callback: AsyncCallback<void>): void;
/**
* Set favorite state for the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { boolean } favoriteState - true: Put the asset into favorite album; false: Remove the asset from favorite album.
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setFavorite(favoriteState: boolean): Promise<void>;
/**
* Set asset hidden state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album.
* @param { AsyncCallback<void> } callback - Returns void.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setHidden(hiddenState: boolean, callback: AsyncCallback<void>): void;
/**
* Set asset hidden state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album.
* @returns { Promise<void> } Returns the promise
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setHidden(hiddenState: boolean): Promise<void>;
/**
* Set user comment info to the asset.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } userComment - user comment info
* @param { AsyncCallback<void> } callback - Returns void.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setUserComment(userComment: string, callback: AsyncCallback<void>): void;
/**
* Set user comment info to the asset.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } userComment - user comment info
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setUserComment(userComment: string): Promise<void>;
/**
* Get exif info of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<string> } callback - Returns exif info into a json string
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
getExif(callback: AsyncCallback<string>): void;
/**
* Get exif info of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise<string> } Returns exif info into a json string
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
getExif(): Promise<string>;
/**
* Set asset pending state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { boolean } pendingState - true: Set asset in pending status; false: Recover asset from pending status.
* @param { AsyncCallback<void> } callback - Returns the callback
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
setPending(pendingState: boolean, callback: AsyncCallback<void>): void;
/**
* Set asset pending state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { boolean } pendingState - true: Set asset in pending status; false: Recover asset from pending status.
* @returns { Promise<void> } Returns the promise
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
setPending(pendingState: boolean): Promise<void>;
/**
* Check if asset has been edited.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<boolean> } callback - Returns whether the asset has been edited.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
isEdited(callback: AsyncCallback<boolean>): void;
/**
* Check if asset has been edited.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise<boolean> } Returns whether the asset has been edited.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
isEdited(): Promise<boolean>;
/**
* Request asset edit data.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<string> } callback - Returns asset edit data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestEditData(callback: AsyncCallback<string>): void;
/**
* Request asset edit data.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise<string> } Returns asset edit data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestEditData(): Promise<string>;
/**
* Requests the read-only FD of the source asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<number> } callback - Returns opened source asset fd.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestSource(callback: AsyncCallback<number>): void;
/**
* Requests the read-only FD of the source asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise<number> } Returns opened source asset fd.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestSource(): Promise<number>;
/**
* Commit edit data and edited asset.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } editData - editData to be saved.
* @param { string } uri - uri of the edited asset within the applications's own sandbox.
* @param { AsyncCallback<void> } callback - Returns callback.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
commitEditedAsset(editData: string, uri: string, callback: AsyncCallback<void>);
/**
* Commit edit data and edited asset.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } editData - editData to be saved.
* @param { string } uri - uri of the edited asset within the applications's own sandbox.
* @returns { Promise<void> } Returns promise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
commitEditedAsset(editData: string, uri: string): Promise<void>;
/**
* Revert asset edits to original state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { AsyncCallback<void> } callback - Returns callback.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
revertToOriginal(callback: AsyncCallback<void>);
/**
* Revert asset edits to original state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise<void> } Returns promise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
revertToOriginal(): Promise<void>;
/**
* Request thumbnails of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback<image.PixelMap> } callback - Returns the required pixels
* @returns { string } Returns request photo task id.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestPhoto(callback: AsyncCallback<image.PixelMap>): string;
/**
* Request thumbnails of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { RequestPhotoOptions } options - Request photo options
* @param { AsyncCallback<image.PixelMap> } callback - Returns the required pixels
* @returns { string } Returns request photo task id.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestPhoto(options: RequestPhotoOptions, callback: AsyncCallback<image.PixelMap>): string;
/**
* Cancel photo request
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { string } requestId - The request id to be canceled
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
cancelPhotoRequest(requestId: string): void;
}
/**
* Enumeration of photo asset members
*
* @enum { string } PhotoKeys
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum PhotoKeys {
/**
* Asset uri, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
URI = 'uri',
/**
* Photo type of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
PHOTO_TYPE = 'media_type',
/**
* Asset name, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DISPLAY_NAME = 'display_name',
/**
* Size of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
SIZE = 'size',
/**
* Creation date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DATE_ADDED = 'date_added',
/**
* Modified date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DATE_MODIFIED = 'date_modified',
/**
* Duration of video files, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DURATION = 'duration',
/**
* Width of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
WIDTH = 'width',
/**
* Height of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
HEIGHT = 'height',
/**
* Date taken of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DATE_TAKEN = 'date_taken',
/**
* Orientation of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
ORIENTATION = 'orientation',
/**
* Favorite state of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
FAVORITE = 'is_favorite',
/**
* Title of the asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
TITLE = 'title',
/**
* Asset position, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
POSITION = 'position',
/**
* Trashed date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
DATE_TRASHED = 'date_trashed',
/**
* Hidden state of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
HIDDEN = 'hidden',
/**
* User comment info
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
USER_COMMENT = 'user_comment',
/**
* Camera shot key
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
CAMERA_SHOT_KEY = 'camera_shot_key',
/**
* The year of the file created, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
DATE_YEAR = 'date_year',
/**
* The month of the file created, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
DATE_MONTH = 'date_month',
/**
* The day of the file created, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
DATE_DAY = 'date_day',
/**
* Pending state of the asset, true means asset is pending, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
PENDING = 'pending'
}
/**
* Enumeration of photo album members.
*
* @enum { string } AlbumKeys
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum AlbumKeys {
/**
* Album uri
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
URI = 'uri',
/**
* Album name
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
ALBUM_NAME = 'album_name'
}
/**
* Enumeration of mode for displaying albums containing hidden assets
*
* @enum { number } HiddenPhotosDisplayMode
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
enum HiddenPhotosDisplayMode {
/**
* Display the system hidden album that contains all the hidden assets.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ASSETS_MODE,
/**
* Display all albums containing hidden assets(excluding the system hidden album and the system trash album).
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ALBUMS_MODE
}
/**
* Options to fetch assets or albums
*
* @interface FetchOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface FetchOptions {
/**
* Indicates the members to query.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
fetchColumns: Array<string>;
/**
* Predicates to query
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
predicates: dataSharePredicates.DataSharePredicates;
}
/**
* Options to create a photo asset for system apps
*
* @interface PhotoCreateOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
interface PhotoCreateOptions {
/**
* Specify subtype of the asset to create
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
subtype?: PhotoSubtype;
/**
* Camera shot key
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
cameraShotKey?: string;
}
/**
* Options to create a photo asset
*
* @interface CreateOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface CreateOptions {
/**
* Title of the asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
title?: string;
}
/**
* Options to request photo
*
* @interface RequestPhotoOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
interface RequestPhotoOptions {
/**
* Size of thumbnail
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
size?: image.Size;
/**
* Type of photo request
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestPhotoType?: RequestPhotoType;
}
/**
* The fetch result of assets or albums
*
* @interface FetchResult
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface FetchResult<T> {
/**
* Obtains the total number of objects in the fetch result.
*
* @returns { number } Total number of objects.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getCount(): number;
/**
* Checks whether the result set points to the last row.
* You need to check whether the object is the last one before calling getNextObject.
*
* @returns { boolean } Whether the object is the last one in the fetch result.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
isAfterLast(): boolean;
/**
* Obtains the first object in the fetch result.
*
* @param { AsyncCallback<T> } callback - Returns the first object in the fetch result.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getFirstObject(callback: AsyncCallback<T>): void;
/**
* Obtains the first object in the fetch result.
*
* @returns { Promise<T> } Returns the first object in the fetch result.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getFirstObject(): Promise<T>;
/**
* Obtains the next object in the fetch result.
* Before calling this method, you must use isAfterLast() to check whether the current position is the last row
* in the fetch result. This method only works when the current position is not the last row.
*
* @param { AsyncCallback<T> } callback - Returns the next object
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getNextObject(callback: AsyncCallback<T>): void;
/**
* Obtains the next object in the fetch result.
* Before calling this method, you must use isAfterLast() to check whether the current position is the last row
* in the fetch result. This method only works when the current position is not the last row.
*
* @returns { Promise<T> } Returns the next object
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getNextObject(): Promise<T>;
/**
* Obtains the last object in the fetch result
*
* @param { AsyncCallback<T> } callback - Returns the last object
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getLastObject(callback: AsyncCallback<T>): void;
/**
* Obtains the last object in the fetch result
*
* @returns { Promise<T> } Returns the last object
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getLastObject(): Promise<T>;
/**
* Obtains the object with the specified index in the fetch result.
*
* @param { number } index - Index of the object to obtain.
* @param { AsyncCallback<T> } callback - Returns the object
* @throws { BusinessError } 401 - if type index is not number
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getObjectByPosition(index: number, callback: AsyncCallback<T>): void;
/**
* Obtains the object with the specified index in the fetch result.
*
* @param { number } index - Index of the asset to obtain.
* @returns { Promise<T> } Returns the object
* @throws { BusinessError } 401 - if type index is not number
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getObjectByPosition(index: number): Promise<T>;
/**
* Obtains all objects in the fetch result.
*
* @param { AsyncCallback<Array<T>> } callback - Returns all the objects
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAllObjects(callback: AsyncCallback<Array<T>>): void;
/**
* Obtains all objects in the fetch result.
*
* @returns { Promise<Array<T>> } Returns all the objects
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAllObjects(): Promise<Array<T>>;
/**
* Releases the fetch result.
*
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
close(): void;
}
/**
* Album type.
*
* @enum { number } AlbumType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum AlbumType {
/**
* Album created by user.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
USER = 0,
/**
* Album created by system, which metadata cannot be modified.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
SYSTEM = 1024
}
/**
* Album subtype
*
* @enum { number } AlbumSubtype
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum AlbumSubtype {
/**
* Generic user-created albums.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
USER_GENERIC = 1,
/**
* Favorite album, which assets are marked as favorite.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
FAVORITE = 1025,
/**
* Video album, which contains all video assets.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
VIDEO,
/**
* Hidden album, which assets are marked as hidden.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
HIDDEN,
/**
* Trash album, which assets are deleted.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
TRASH,
/**
* Screenshot album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
SCREENSHOT,
/**
* Camera album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
CAMERA,
/**
* Image album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
IMAGE,
/**
* Any album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
ANY = 2147483647
}
/**
* Request photo type.
*
* @enum { number } RequestPhotoType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
enum RequestPhotoType {
/**
* Request all thumbnails: fast thumbnail and quality thumbnail
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
REQUEST_ALL_THUMBNAILS = 0,
/**
* Only request fast thumbnail
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
REQUEST_FAST_THUMBNAIL,
/**
* Only request quality thumbnail
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
REQUEST_QUALITY_THUMBNAIL
}
/**
* Defines the abstract interface of albums.
*
* @interface AbsAlbum
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface AbsAlbum {
/**
* Album type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly albumType: AlbumType;
/**
* Album subtype
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly albumSubtype: AlbumSubtype;
/**
* Album name.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
albumName: string;
/**
* Album uri.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly albumUri: string;
/**
* Number of assets in the album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly count: number;
/**
* Cover uri for the album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
readonly coverUri: string;
/**
* Fetch assets in an album.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @param { AsyncCallback<FetchResult<PhotoAsset>> } callback - Returns the fetch result
* @throws { BusinessError } 401 - if type options is not FetchOptions
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<PhotoAsset>>): void;
/**
* Fetch assets in an album.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result
* @throws { BusinessError } 401 - if type options is not FetchOptions
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAssets(options: FetchOptions): Promise<FetchResult<PhotoAsset>>;
}
/**
* Defines the album.
*
* @interface Album
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface Album extends AbsAlbum {
/**
* Modify metadata for the album
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 401 - if value to modify is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
commitModify(callback: AsyncCallback<void>): void;
/**
* Modify metadata for the album
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 401 - if value to modify is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
commitModify(): Promise<void>;
/**
* Add assets to the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to add
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
addAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void;
/**
* Add assets to the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to add
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
addAssets(assets: Array<PhotoAsset>): Promise<void>;
/**
* Remove assets from the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to remove
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
removeAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void;
/**
* Remove assets from the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to remove
* @returns { Promise<void> } Returns the promise
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
removeAssets(assets: Array<PhotoAsset>): Promise<void>;
/**
* Recover assets from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to recover
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
recoverAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void;
/**
* Recover assets from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to recover
* @returns { Promise<void> } Returns the promise
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
recoverAssets(assets: Array<PhotoAsset>): Promise<void>;
/**
* Delete assets permanently from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to delete
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
deleteAssets(assets: Array<PhotoAsset>, callback: AsyncCallback<void>): void;
/**
* Delete assets permanently from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<PhotoAsset> } assets - Assets to delete
* @returns { Promise<void> } Returns the promise
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if PhotoAssets is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
deleteAssets(assets: Array<PhotoAsset>): Promise<void>;
/**
* Set cover uri for this album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } uri - The asset uri to set
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setCoverUri(uri: string, callback: AsyncCallback<void>): void;
/**
* Set cover uri for this album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } uri - The asset uri to set
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
setCoverUri(uri: string): Promise<void>;
}
/**
* Helper functions to access photos and albums.
*
* @interface PhotoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface PhotoAccessHelper {
/**
* Fetch photo assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @param { AsyncCallback<FetchResult<PhotoAsset>> } callback - Returns the fetch result.
* @throws { BusinessError } 401 - if type options is not FetchOptions
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<PhotoAsset>>): void;
/**
* Fetch photo assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Retrieval options.
* @returns { Promise<FetchResult<PhotoAsset>> } Returns the fetch result.
* @throws { BusinessError } 401 - if type options is not FetchOptions
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAssets(options: FetchOptions): Promise<FetchResult<PhotoAsset>>;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @param { AsyncCallback<PhotoAsset> } callback - Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if type displayName is not string
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
createAsset(displayName: string, callback: AsyncCallback<PhotoAsset>): void;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @returns { Promise<PhotoAsset> } Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if type displayName or albumUri is not string
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
createAsset(displayName: string): Promise<PhotoAsset>;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @param { PhotoCreateOptions } options - Create operation
* @returns { Promise<PhotoAsset> } Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if type displayName is not string
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
createAsset(displayName: string, options: PhotoCreateOptions): Promise<PhotoAsset>;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @param { PhotoCreateOptions } options - Photo create operation
* @param { AsyncCallback<PhotoAsset> } callback - Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if type displayName is not string
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000001 - Invalid display name
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
createAsset(displayName: string, options: PhotoCreateOptions, callback: AsyncCallback<PhotoAsset>): void;
/**
* Create a photo asset:
* 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission;
* 2. Get WRITE_IMAGEVIDEO permission by ACL;
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { PhotoType } photoType - Photo asset type
* @param { string } extension - Asset extension
* @param { CreateOptions } options - Asset create option
* @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - if type createOption is wrong
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Create a photo asset:
* 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission;
* 2. Get WRITE_IMAGEVIDEO permission by ACL;
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { PhotoType } photoType - Photo asset type
* @param { string } extension - Asset extension
* @param { CreateOptions } options - Asset create option
* @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - if type createOption is wrong
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
createAsset(photoType: PhotoType, extension: string, options: CreateOptions, callback: AsyncCallback<string>): void;
/**
* Create a photo asset:
* 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission;
* 2. Get WRITE_IMAGEVIDEO permission by ACL;
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { PhotoType } photoType - Photo asset type
* @param { string } extension - Asset extension
* @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - if type createOption is wrong
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Create a photo asset:
* 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission;
* 2. Get WRITE_IMAGEVIDEO permission by ACL;
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { PhotoType } photoType - Photo asset type
* @param { string } extension - Asset extension
* @param { AsyncCallback<string> } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - if type createOption is wrong
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
createAsset(photoType: PhotoType, extension: string, callback: AsyncCallback<string>): void;
/**
* Create a photo asset:
* 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission;
* 2. Get WRITE_IMAGEVIDEO permission by ACL;
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { PhotoType } photoType - Photo asset type
* @param { string } extension - Asset extension
* @param { CreateOptions } [options] - Optional asset create option
* @returns { Promise<string> } Returns the uri of the newly created asset
* @throws { BusinessError } 401 - if type createOption is wrong
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Create a photo asset:
* 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission;
* 2. Get WRITE_IMAGEVIDEO permission by ACL;
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { PhotoType } photoType - Photo asset type
* @param { string } extension - Asset extension
* @param { CreateOptions } [options] - Optional asset create option
* @returns { Promise<string> } Returns the uri of the newly created asset
* @throws { BusinessError } 401 - if type createOption is wrong
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
createAsset(photoType: PhotoType, extension: string, options?: CreateOptions): Promise<string>;
/**
* Create a generic user album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } name - Album name to be created.
* @param { AsyncCallback<Album> } callback - Returns the instance of newly created Album
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900015 - File exists
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
createAlbum(name: string, callback: AsyncCallback<Album>): void;
/**
* Create a generic user album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } name - Album name to be created.
* @returns { Promise<Album> } Returns the instance of newly created Album
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900015 - File exists
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
createAlbum(name: string): Promise<Album>;
/**
* Delete generic user-created albums.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<Album> } albums - Specify which albums to delete
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
deleteAlbums(albums: Array<Album>, callback: AsyncCallback<void>): void;
/**
* Delete generic user-created albums.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<Album> } albums - Specify which albums to delete
* @returns { Promise<void> } Returns the promise
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
deleteAlbums(albums: Array<Album>): Promise<void>;
/**
* Fetch albums.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AlbumType } type - Album type.
* @param { AlbumSubtype } subtype - Album subtype.
* @param { FetchOptions } options - options to fetch albums
* @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result
* @throws { BusinessError } 401 - if type options is not FetchOption
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAlbums(
type: AlbumType,
subtype: AlbumSubtype,
options: FetchOptions,
callback: AsyncCallback<FetchResult<Album>>
): void;
/**
* Fetch albums.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AlbumType } type - Album type.
* @param { AlbumSubtype } subtype - Album subtype.
* @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result
* @throws { BusinessError } 401 - if type options is not FetchOption
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAlbums(type: AlbumType, subtype: AlbumSubtype, callback: AsyncCallback<FetchResult<Album>>): void;
/**
* Fetch albums.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AlbumType } type - Album type.
* @param { AlbumSubtype } subtype - Album subtype.
* @param { FetchOptions } [options] - options to fetch albums
* @returns { Promise<FetchResult<Album>> } - Returns the fetch result
* @throws { BusinessError } 401 - if type options is not FetchOption
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
getAlbums(type: AlbumType, subtype: AlbumSubtype, options?: FetchOptions): Promise<FetchResult<Album>>;
/**
* Fetch albums containing hidden assets.
*
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
* @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets.
* @param { FetchOptions } options - Options to fetch albums.
* @param { AsyncCallback<FetchResult<Album>> } callback - Returns fetchResult of albums containing hidden assets.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getHiddenAlbums(mode: HiddenPhotosDisplayMode, options: FetchOptions, callback: AsyncCallback<FetchResult<Album>>): void;
/**
* Fetch albums containing hidden assets.
*
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
* @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets.
* @param { AsyncCallback<FetchResult<Album>> } callback - Returns fetchResult of albums containing hidden assets.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getHiddenAlbums(mode: HiddenPhotosDisplayMode, callback: AsyncCallback<FetchResult<Album>>): void;
/**
* Fetch albums containing hidden assets.
*
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
* @param { HiddenPhotosDisplayMode } mode - Display mode of albums containing hidden assets.
* @param { FetchOptions } [options] - Options to fetch albums.
* @returns { Promise<FetchResult<Album>> } Returns fetchResult of albums containing hidden assets.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getHiddenAlbums(mode: HiddenPhotosDisplayMode, options?: FetchOptions): Promise<FetchResult<Album>>;
/**
* Delete assets
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<string> } uriList - Uris of assets to delete
* @param { AsyncCallback<void> } callback - No value returned
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000002 - Invalid uri
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
deleteAssets(uriList: Array<string>, callback: AsyncCallback<void>): void;
/**
* Delete assets
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<string> } uriList - Uris of assets to delete
* @returns { Promise<void> } - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000002 - Invalid uri
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
deleteAssets(uriList: Array<string>): Promise<void>;
/**
* Register change notify for the specified uri.
*
* @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri
* @param { boolean } forChildUris - Monitor the child uris.
* @param { Callback<ChangeData> } callback - Returns the changed data
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
registerChange(uri: string, forChildUris: boolean, callback: Callback<ChangeData>): void;
/**
* Unregister change notify for the specified uri.
*
* @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri
* @param { Callback<ChangeData> } [callback] - The callback function to unregister.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
unRegisterChange(uri: string, callback?: Callback<ChangeData>): void;
/**
* Create a pop-up box to delete photos
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<string> } uriList - List of the asset uris to be deleted
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
createDeleteRequest(uriList: Array<string>, callback: AsyncCallback<void>): void;
/**
* Create a pop-up box to delete photos
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array<string> } uriList - List of the asset uris to be deleted
* @returns { Promise<void> } - Returns void
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
createDeleteRequest(uriList: Array<string>): Promise<void>;
/**
* Get the index of the asset in the album
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { string } photoUri - The photo asset uri.
* @param { string } albumUri - The album uri.
* @param { FetchOptions } options - fetch options
* @param { AsyncCallback<number> } callback - Returns the index of the asset in the album
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback<number>): void;
/**
* Get the index of the asset in the album
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { string } photoUri - The photo asset uri.
* @param { string } albumUri - The album uri.
* @param { FetchOptions } options - fetch options
* @returns { Promise<number> } - Returns the index of the asset in the album
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise<number>;
/**
* Release PhotoAccessHelper instance
*
* @param { AsyncCallback<void> } callback - Returns void
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
release(callback: AsyncCallback<void>): void;
/**
* Release PhotoAccessHelper instance
*
* @returns { Promise<void> } Returns void
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
release(): Promise<void>;
/**
* Saves form information
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { FormInfo } info - Information store with the form.
* @param { AsyncCallback<void> } callback - No value returned.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
saveFormInfo(info: FormInfo, callback: AsyncCallback<void>): void;
/**
* Saves form information
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { FormInfo } info - Information store with the form.
* @returns { Promise<void> } Return void.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
saveFormInfo(info: FormInfo): Promise<void>;
/**
* Removes form information
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { FormInfo } info - Information store with the form.
* @param { AsyncCallback<void> } callback - No value returned.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
removeFormInfo(info: FormInfo, callback: AsyncCallback<void>): void;
/**
* Removes form information
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { FormInfo } info - Information store with the form.
* @returns { Promise<void> } Return void.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
removeFormInfo(info: FormInfo): Promise<void>;
}
/**
* Form information.
*
* @interface FormInfo
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
interface FormInfo {
/**
* Id of the form.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
formId: string;
/**
* URI of the photo or album.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
uri: string;
}
/**
* Enumeration types of data change.
*
* @enum { number } NotifyType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum NotifyType {
/**
* Data(assets or albums) have been newly created
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
NOTIFY_ADD,
/**
* Data(assets or albums) have been modified
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
NOTIFY_UPDATE,
/**
* Data(assets or albums) have been removed
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
NOTIFY_REMOVE,
/**
* Assets have been added to an album.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
NOTIFY_ALBUM_ADD_ASSET,
/**
* Assets have been removed from an album.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
NOTIFY_ALBUM_REMOVE_ASSET
}
/**
* Enumeration uris for registerChange.
*
* @enum { string } DefaultChangeUri
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
enum DefaultChangeUri {
/**
* Uri for default PhotoAsset, use with forDescendant{true}, will receive all PhotoAsset's change notifications
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DEFAULT_PHOTO_URI = 'file://media/Photo',
/**
* Uri for default Album, use with forDescendant{true}, will receive all Album's change notifications
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
DEFAULT_ALBUM_URI = 'file://media/PhotoAlbum',
/**
* Uri for albums in hidden album view.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
DEFAULT_HIDDEN_ALBUM_URI = 'file://media/HiddenAlbum'
}
/**
* Defines the change data
*
* @interface ChangeData
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
interface ChangeData {
/**
* The NotifyType of ChangeData
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
type: NotifyType;
/**
* The changed uris
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
uris: Array<string>;
/**
* Change details of the asset uris to an album.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
extraUris: Array<string>;
}
/**
* PhotoViewMIMETypes represents the type of media resource that photo picker selects.
*
* @enum { string } PhotoViewMIMETypes
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
export enum PhotoViewMIMETypes {
/**
* IMAGE_TYPE indicates that the selected media resources are images.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
IMAGE_TYPE = 'image/*',
/**
* VIDEO_TYPE indicates that the selected media resources are videos.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
VIDEO_TYPE = 'video/*',
/**
* IMAGE_VIDEO_TYPE indicates that the selected media resources are images and videos.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
IMAGE_VIDEO_TYPE = '*/*'
}
/**
* PhotoSelectOptions Object
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
class PhotoSelectOptions {
/**
* The Type of the file in the picker window.
*
* @type { ?PhotoViewMIMETypes }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
MIMEType?: PhotoViewMIMETypes;
/**
* Maximum number of images for a single selection.
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
maxSelectNumber?: number;
/**
* Support search.
*
* @type { ?boolean }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
isSearchSupported?: boolean;
/**
* Support taking photos.
*
* @type { ?boolean }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
isPhotoTakingSupported?: boolean;
/**
* Support editing photos.
*
* @type { ?boolean }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
isEditSupported?: boolean;
/**
* The recommendation options when use recommendation photo function.
*
* @type { ?RecommendationOptions }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
recommendationOptions?: RecommendationOptions;
}
/**
* Options for recommend photos
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
class RecommendationOptions {
/**
* The recommendation photo type when select photo in photo picker.
*
* @type { ?RecommendationType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
recommendationType?: RecommendationType;
}
/**
* PhotoSelectResult Object
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
class PhotoSelectResult {
/**
* The uris for the selected files.
*
* @type { Array<string> }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
photoUris: Array<string>;
/**
* Original option.
*
* @type { boolean }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
isOriginalPhoto: boolean;
}
/**
* PhotoViewPicker Object
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
class PhotoViewPicker {
/**
* Pull up the photo picker based on the selection mode.
*
* @param { PhotoSelectOptions } option - represents the options provided in select mode.
* @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files.
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
select(option?: PhotoSelectOptions): Promise<PhotoSelectResult>;
/**
* Pull up the photo picker based on the selection mode.
*
* @param { PhotoSelectOptions } option - represents the options provided in select mode.
* @param { AsyncCallback<PhotoSelectResult> } callback - callback
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>): void;
/**
* Pull up the photo picker based on the selection mode.
*
* @param { AsyncCallback<PhotoSelectResult> } callback - callback
* @throws { BusinessError } 401 - if parameter is invalid
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
select(callback: AsyncCallback<PhotoSelectResult>): void;
}
}
export default photoAccessHelper;