/*
* 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 Helper functions to access image and video assets
* @kit MediaLibraryKit
*/
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';
import type { CustomColors } from './@ohos.arkui.theme';
/**
* Helper functions to access image and video assets
*
* @namespace photoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Helper functions to access image and video assets
*
* @namespace photoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
/**
* Helper functions to access image and video assets
*
* @namespace photoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
declare namespace photoAccessHelper {
/**
* Returns an instance of PhotoAccessHelper
*
* @param { Context } context - Hap context information
* @returns { PhotoAccessHelper } Instance of PhotoAccessHelper
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @StageModelOnly
* @atomicservice
* @since 11
*/
/**
* Returns an instance of PhotoAccessHelper
*
* @param { Context } context - Hap context information
* @returns { PhotoAccessHelper } Instance of PhotoAccessHelper
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @StageModelOnly
* @crossplatform
* @atomicservice
* @since 12
*/
function getPhotoAccessHelper(context: Context): PhotoAccessHelper;
/**
* Enumeration of different types of photos
*
* @enum { number } PhotoType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Enumeration of different types of photos
*
* @enum { number } PhotoType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
/**
* Enumeration of different types of photos
*
* @enum { number } PhotoType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
enum PhotoType {
/**
* Image asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Image asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
/**
* Image asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
IMAGE = 1,
/**
* Video asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Video asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
/**
* Video asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
VIDEO
}
/**
* Enumeration of different categories of photos
*
* @enum { number } PhotoSubtype
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
/**
* Enumeration of different categories of photos
*
* @enum { number } PhotoSubtype
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
enum PhotoSubtype {
/**
* Default Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
/**
* Default Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
DEFAULT = 0,
/**
* Screenshot Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
*/
SCREENSHOT = 1,
/**
* Moving Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
MOVING_PHOTO = 3,
/**
* Burst Photo Type
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
BURST = 4,
}
/**
* Enumeration of dynamic range type
*
* @enum { number } DynamicRangeType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
enum DynamicRangeType {
/**
* SDR(Standard-Dynamic Range) format
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
SDR = 0,
/**
* HDR(High-Dynamic Range) format
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
HDR = 1
}
/**
* 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
}
/**
* Analysis type
*
* @enum { number } AnalysisType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
enum AnalysisType {
/**
* Analysis of aesthetics score
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_AESTHETICS_SCORE = 0,
/**
* Analysis of label
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_LABEL,
/**
* Analysis of ocr
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_OCR,
/**
* Analysis of face
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_FACE,
/**
* Analysis of object
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_OBJECT,
/**
* Analysis of recommendation
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_RECOMMENDATION,
/**
* Analysis of segmentation
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_SEGMENTATION,
/**
* Analysis of composition
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_COMPOSITION,
/**
* Analysis of saliency
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_SALIENCY,
/**
* Analysis of photo detail address info
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ANALYSIS_DETAIL_ADDRESS,
/**
* Analysis of human face tag
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
ANALYSIS_HUMAN_FACE_TAG,
/**
* Analysis of head position
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
ANALYSIS_HEAD_POSITION,
/**
* Analysis of bone pose
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
ANALYSIS_BONE_POSE,
/**
* Analysis of video label
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
ANALYSIS_VIDEO_LABEL,
/**
* Analysis of highlight
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
ANALYSIS_HIGHLIGHT,
/**
* Analysis of multi crop
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
ANALYSIS_MULTI_CROP
}
/**
* Enumeration of different recommendation type
*
* @enum { number } RecommendationType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
enum RecommendationType {
/**
* QR_OR_BAR_CODE indicates that QR code or barcode photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
QR_OR_BAR_CODE = 1,
/**
* QR_CODE indicates that QR code photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
QR_CODE = 2,
/**
* BAR_CODE indicates that barcode photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
BAR_CODE = 3,
/**
* ID_CARD indicates that QR code or barcode photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
ID_CARD = 4,
/**
* PROFILE_PICTURE indicates that profile picture photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
PROFILE_PICTURE = 5,
/**
* PASSPORT indicates that passport photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
PASSPORT = 6,
/**
* BANK_CARD indicates that bank card photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
BANK_CARD = 7,
/**
* DRIVER_LICENSE indicates that driver license photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
DRIVER_LICENSE = 8,
/**
* DRIVING_LICENSE indicates that driving license photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
DRIVING_LICENSE = 9,
/**
* FEATURED_SINGLE_PORTRAIT indicates that featured single portrait photos can be recommended
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
FEATURED_SINGLE_PORTRAIT = 10
}
/**
* Enumeration of delivery mode.
*
* @enum { number } DeliveryMode
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
enum DeliveryMode {
/**
* Fast delivery mode
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
FAST_MODE = 0,
/**
* High quality delivery mode
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
HIGH_QUALITY_MODE = 1,
/**
* Balance delivery mode
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
BALANCE_MODE = 2
}
/**
* Enumeration of compatible mode.
*
* @enum { number } CompatibleMode
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
enum CompatibleMode {
/**
* Original format mode
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
ORIGINAL_FORMAT_MODE = 0,
/**
* Compatible format mode.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
COMPATIBLE_FORMAT_MODE = 1
}
/**
* Data handler used to notify the progress of required media asset data
*
* @interface MediaAssetProgressHandler
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
interface MediaAssetProgressHandler {
/**
* Indicates the progress of required media asset data
*
* @param { number } progress - the progress of required media asset data; from 0 to 100.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
onProgress(progress: number): void;
}
/**
* Enumeration of source mode
*
* @enum { number } SourceMode
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
enum SourceMode {
/**
* Original mode
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
ORIGINAL_MODE = 0,
/**
* Edited mode
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
EDITED_MODE = 1
}
/**
* Enumeration type of permissions for accessing asset uri.
*
* @enum { number } PhotoPermissionType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
enum PhotoPermissionType {
/**
* Temporary access to photos, this permission could be canceled when APP dies.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
TEMPORARY_READ_IMAGEVIDEO = 0,
/**
* Persistence access to photos.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
PERSISTENT_READ_IMAGEVIDEO = 1
}
/**
* Enumeration type of hide sensitive information.
*
* @enum { number } HideSensitiveType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
enum HideSensitiveType {
/**
* Hide location information and shooting param.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
HIDE_LOCATION_AND_SHOOTING_PARAM = 0,
/**
* Hide location information.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
HIDE_LOCATION_ONLY = 1,
/**
* Hide shooting param.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
HIDE_SHOOTING_PARAM_ONLY = 2,
/**
* Hide nothing.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
NO_HIDE_SENSITIVE_TYPE = 3
}
/**
* Enumeration type of authorization mode.
*
* @enum { number } AuthorizationMode
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
enum AuthorizationMode {
/**
* Short time authorization.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
SHORT_TIME_AUTHORIZATION = 0
}
/**
* Enum: complete button text
*
* @enum { number } CompleteButtonText
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
enum CompleteButtonText {
/**
* Complete button text: done
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
TEXT_DONE = 0,
/**
* Complete button text: send
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
TEXT_SEND = 1,
/**
* Complete button text: add
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
TEXT_ADD = 2,
}
/**
* Enumeration type of watermarktypes of photos
*
* @enum { number } WatermarkType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
enum WatermarkType {
/**
* WatermarkType of Default
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
DEFAULT = 0,
/**
* WatermarkType of BRAND_COMMON
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
BRAND_COMMON = 1,
/**
* WatermarkType of COMMON
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
COMMON = 2,
/**
* WatermarkType of BRAND
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
BRAND = 3,
}
/**
* Options to request media asset
*
* @interface RequestOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
interface RequestOptions {
/**
* Indicates the delivery mode
*
* @type { DeliveryMode }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
deliveryMode: DeliveryMode;
/**
* Indicates the source mode
*
* @type { ?SourceMode }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
sourceMode?: SourceMode;
/**
* Indicates the compatible mode
*
* @type { ?CompatibleMode }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
compatibleMode?: CompatibleMode;
/**
* data handler used to notify the progress of required media asset data
*
* @type { ?MediaAssetProgressHandler }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
mediaAssetProgressHandler?: MediaAssetProgressHandler;
}
/**
* Media asset data handler
*
* @interface MediaAssetDataHandler
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
interface MediaAssetDataHandler {
/**
* Indicates required media asset data is prepared
*
* @param { T } data - the returned data of media asset
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
/**
* Indicates required media asset data is prepared
*
* @param { T } data - the returned data of media asset
* @param { Map } [map] - additional information for the data
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
onDataPrepared(data: T, map?: Map): void;
}
/**
* Data handler when quick request image is finished
*
* @typedef QuickImageDataHandler
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
interface QuickImageDataHandler {
/**
* Indicates required media asset data quickly is prepared
*
* @param { T } data - the returned data of picture
* @param { image.ImageSource } imageSource - the returned data of imageSource
* @param { Map } map - additional information for the data
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
onDataPrepared(data: T, imageSource: image.ImageSource, map: Map): void;
}
/**
* Photo Proxy used to save image data
*
* @interface PhotoProxy
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
interface PhotoProxy {}
/**
* Media asset manager
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
class MediaAssetManager {
/**
* Request image
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { Context } context - Hap context information
* @param { PhotoAsset } asset - the photo asset requested
* @param { RequestOptions } requestOptions - the request options
* @param { MediaAssetDataHandler } dataHandler - data handler used to obtain media asset data when ImageSource is prepared
* @returns { Promise } Returns request id
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
static requestImage(
context: Context,
asset: PhotoAsset,
requestOptions: RequestOptions,
dataHandler: MediaAssetDataHandler
): Promise;
/**
* Quick request image
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { Context } context - Hap context information
* @param { PhotoAsset } asset - the photo asset requested
* @param { RequestOptions } requestOptions - the request options
* @param { QuickImageDataHandler } dataHandler - data handler used to obtain image data quickly when picture is prepared
* @returns { Promise } Returns request id
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - Internal system error
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
static quickRequestImage(
context: Context,
asset: PhotoAsset,
requestOptions: RequestOptions,
dataHandler: QuickImageDataHandler
): Promise;
/**
* Request image data
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { Context } context - Hap context information
* @param { PhotoAsset } asset - the photo asset requested
* @param { RequestOptions } requestOptions - the request options
* @param { MediaAssetDataHandler } dataHandler - data handler used obtain media asset data when data is prepared
* @returns { Promise } Returns request id
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
static requestImageData(
context: Context,
asset: PhotoAsset,
requestOptions: RequestOptions,
dataHandler: MediaAssetDataHandler
): Promise;
/**
* Request moving photo
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { Context } context - Hap context information
* @param { PhotoAsset } asset - the photo asset requested
* @param { RequestOptions } requestOptions - the request options
* @param { MediaAssetDataHandler } dataHandler - data handler used to obtain moving photo when data is prepared
* @returns { Promise } Returns request id
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
static requestMovingPhoto(
context: Context,
asset: PhotoAsset,
requestOptions: RequestOptions,
dataHandler: MediaAssetDataHandler
): Promise;
/**
* Cancel request
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { Context } context - Hap context information
* @param { string } requestId - the request id to be canceled
* @returns { Promise } Returns void
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
static cancelRequest(context: Context, requestId: string): Promise;
/**
* Request video file
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { Context } context - Hap context information
* @param { PhotoAsset } asset - the photo asset requested
* @param { RequestOptions } requestOptions - the request options
* @param { string } fileUri - the destination file uri to save the video data
* @param { MediaAssetDataHandler } dataHandler - data handler used to notify the client that data has been written to the application sandbox
* @returns { Promise } Returns request id
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
static requestVideoFile(
context: Context,
asset: PhotoAsset,
requestOptions: RequestOptions,
fileUri: string,
dataHandler: MediaAssetDataHandler
): Promise;
/**
* Load moving photo
*
* @param { Context } context - Hap context information
* @param { string } imageFileUri - image file uri of the moving photo to be loaded
* @param { string } videoFileUri - video file uri of the moving photo to be loaded
* @returns { Promise } Returns moving photo
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - Internal system error
* @static
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
static loadMovingPhoto(
context: Context,
imageFileUri: string,
videoFileUri: string
): Promise;
}
/**
* Indicates the type of photo asset member.
*
* @typedef { number | string | boolean } MemberType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Indicates the type of photo asset member.
*
* @typedef { number | string | boolean } MemberType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
type MemberType = number | string | boolean;
/**
* Defines the photo asset
*
* @interface PhotoAsset
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Defines the photo asset
*
* @interface PhotoAsset
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
/**
* Defines the photo asset
*
* @interface PhotoAsset
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
interface PhotoAsset {
/**
* uri of the asset.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* uri of the asset.
*
* @type { string }
* @readonly
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
readonly uri: string;
/**
* Photo type, image or video
*
* @type { PhotoType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Photo type, image or video
*
* @type { PhotoType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly photoType: PhotoType;
/**
* Display name (with a file name extension) of the asset.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Display name (with a file name extension) of the asset.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly displayName: string;
/**
* Returns the value of the specified member.
*
* @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE)
* @returns { MemberType } Returns the value of the specified photo asset member
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000014 - Member is not a valid PhotoKey
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Returns the value of the specified member.
*
* @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE)
* @returns { MemberType } Returns the value of the specified photo asset member
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000014 - Member is not a valid PhotoKey
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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 } callback - Returns void.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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 } callback - Returns void.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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;
/**
* Modify metadata of the asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise } Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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 } Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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;
/**
* 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 } callback - Callback return the fd of the asset.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
*/
open(mode: string, callback: AsyncCallback): 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 } Returns the fd
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
*/
open(mode: string): Promise;
/**
* Open the asset in read only mode
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns the read only fd
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
*/
getReadOnlyFd(callback: AsyncCallback): void;
/**
* Open the asset in read only mode
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns the read only fd
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
*/
getReadOnlyFd(): Promise;
/**
* Close the asset
*
* @param { number } fd - The opened fd of the asset.
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
*/
close(fd: number, callback: AsyncCallback): void;
/**
* Close the asset
*
* @param { number } fd - The opened fd of the asset.
* @returns { Promise } Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
*/
close(fd: number): Promise;
/**
* Get thumbnail of the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns the thumbnail's pixelMap.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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): void;
/**
* Get thumbnail of the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { image.Size } size - Thumbnail's size
* @param { AsyncCallback } callback - Returns the thumbnail's pixelMap.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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): void;
/**
* Get thumbnail of the asset
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { image.Size } [size] - Thumbnail's size
* @returns { Promise } Returns the thumbnail's pixelMap.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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;
/**
* 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 } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#setFavorite
*/
setFavorite(favoriteState: boolean, callback: AsyncCallback): 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 } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#setFavorite
*/
setFavorite(favoriteState: boolean): Promise;
/**
* 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 } callback - Returns void.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#setHidden
*/
setHidden(hiddenState: boolean, callback: AsyncCallback): 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 } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#setHidden
*/
setHidden(hiddenState: boolean): Promise;
/**
* Set user comment info to the asset.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } userComment - user comment info
* @param { AsyncCallback } callback - Returns void.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#setUserComment
*/
setUserComment(userComment: string, callback: AsyncCallback): void;
/**
* Set user comment info to the asset.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } userComment - user comment info
* @returns { Promise } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#setUserComment
*/
setUserComment(userComment: string): Promise;
/**
* Get exif info of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns exif info into a json string
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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): void;
/**
* Get analysis data of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AnalysisType } analysisType - Analysis type
* @returns { Promise } Returns analysis info into a json string
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getAnalysisData(analysisType: AnalysisType): Promise;
/**
* Get exif info of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns exif info into a json string
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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;
/**
* 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 } callback - Returns void
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
setPending(pendingState: boolean, callback: AsyncCallback): 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 } Returns void
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
setPending(pendingState: boolean): Promise;
/**
* Check if asset has been edited.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns whether the asset has been edited.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
isEdited(callback: AsyncCallback): void;
/**
* Check if asset has been edited.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns whether the asset has been edited.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
isEdited(): Promise;
/**
* Request asset edit data.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns asset edit data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestEditData(callback: AsyncCallback): void;
/**
* Request asset edit data.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns asset edit data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestEditData(): Promise;
/**
* Get media asset edit data.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns media asset edit data
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getEditData(): Promise;
/**
* Requests the read-only FD of the source asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns opened source asset fd.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestSource(callback: AsyncCallback): void;
/**
* Requests the read-only FD of the source asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns opened source asset fd.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestSource(): Promise;
/**
* 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 } callback - Returns void.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
commitEditedAsset(editData: string, uri: string, callback: AsyncCallback);
/**
* 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 } Returns void.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
commitEditedAsset(editData: string, uri: string): Promise;
/**
* Revert asset edits to original state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns void.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
revertToOriginal(callback: AsyncCallback);
/**
* Revert asset edits to original state.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise } Returns void.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
revertToOriginal(): Promise;
/**
* Request thumbnails of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AsyncCallback } 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. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestPhoto(callback: AsyncCallback): string;
/**
* Request thumbnails of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { RequestPhotoOptions } options - Request photo options
* @param { AsyncCallback } 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. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
requestPhoto(options: RequestPhotoOptions, callback: AsyncCallback): 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. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
cancelPhotoRequest(requestId: string): void;
/**
* Fetch thumbnail of the video keyframe.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { number } beginFrameTimeMs - Fetch the time position of the video frame.
* @param { ThumbnailType } type - The type of thumbnail.
* @returns { Promise } Returns the thumbnail's pixelMap.
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - Internal system error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
getKeyFrameThumbnail(beginFrameTimeMs: number, type: ThumbnailType): Promise;
}
/**
* Enumeration of photo asset members
*
* @enum { string } PhotoKeys
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Enumeration of photo asset members
*
* @enum { string } PhotoKeys
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
enum PhotoKeys {
/**
* Asset uri, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Asset uri, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
URI = 'uri',
/**
* Photo type of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Photo type of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
PHOTO_TYPE = 'media_type',
/**
* Asset name, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Asset name, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
DISPLAY_NAME = 'display_name',
/**
* Size of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Size of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
SIZE = 'size',
/**
* Creation date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Creation date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
DATE_ADDED = 'date_added',
/**
* Modified date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Modified date of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
DATE_MODIFIED = 'date_modified',
/**
* Duration of video files, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Duration of video files, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
DURATION = 'duration',
/**
* Width of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Width of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
WIDTH = 'width',
/**
* Height of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Height of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
HEIGHT = 'height',
/**
* Date taken of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Date taken of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
DATE_TAKEN = 'date_taken',
/**
* Orientation of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Orientation of the image asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
ORIENTATION = 'orientation',
/**
* Favorite state of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Favorite state of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
FAVORITE = 'is_favorite',
/**
* Title of the asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Title of the asset
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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',
/**
* Creation time of the asset in milliseconds, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
DATE_ADDED_MS = 'date_added_ms',
/**
* Modified time of the asset in milliseconds, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
DATE_MODIFIED_MS = 'date_modified_ms',
/**
* Trashed time of the asset in milliseconds, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
DATE_TRASHED_MS = 'date_trashed_ms',
/**
* Photo subtype of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
PHOTO_SUBTYPE = 'subtype',
/**
* Effect mode of moving photo, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
MOVING_PHOTO_EFFECT_MODE = 'moving_photo_effect_mode',
/**
* Dynamic range type of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
DYNAMIC_RANGE_TYPE = 'dynamic_range_type',
/**
* Cover position of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
COVER_POSITION = 'cover_position',
/**
* Unique uuid of the burst photos, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
BURST_KEY = 'burst_key',
/**
* Thumbnail of photo asset has been ready, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
THUMBNAIL_READY = 'thumbnail_ready',
/**
* Width and height information of lcd picture, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
LCD_SIZE = 'lcd_size',
/**
* Width and height information of thumbnail picture, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
THM_SIZE = 'thm_size',
/**
* Detail time of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
DETAIL_TIME = 'detail_time',
/**
* Date taken of the asset in milliseconds, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 13
*/
DATE_TAKEN_MS = 'date_taken_ms',
/**
* Cloud enhancement status of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
CE_AVAILABLE = 'ce_available',
/**
* watermark type of the asset, read only
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
SUPPORTED_WATERMARK_TYPE = 'supported_watermark_type'
}
/**
* Enumeration of photo album members.
*
* @enum { string } AlbumKeys
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Enumeration of photo album members.
*
* @enum { string } AlbumKeys
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
enum AlbumKeys {
/**
* Album uri
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album uri
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
URI = 'uri',
/**
* Album name
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album name
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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
*/
/**
* Options to fetch assets or albums
*
* @interface FetchOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
interface FetchOptions {
/**
* Indicates the members to query.
*
* @type { Array }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Indicates the members to query.
*
* @type { Array }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
fetchColumns: Array;
/**
* Predicates to query
*
* @type { dataSharePredicates.DataSharePredicates }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Predicates to query
*
* @type { dataSharePredicates.DataSharePredicates }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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
*
* @type { ?PhotoSubtype }
* @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;
}
/**
* Config to create photo asset
*
* @interface PhotoCreationConfig
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
interface PhotoCreationConfig {
/**
* Title of the asset
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
title?: string;
/**
* Extension of the asset
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
fileNameExtension: string;
/**
* Specify photo type of the asset to create, include image or video
*
* @type { PhotoType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
photoType: PhotoType;
/**
* Specify photo subtype of the asset to create, include default or moving_photo
*
* @type { ?PhotoSubtype }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
subtype?: PhotoSubtype;
}
/**
* Options to create a photo asset
*
* @interface CreateOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Options to create a photo asset
*
* @interface CreateOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
interface CreateOptions {
/**
* Title of the asset
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Title of the asset
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
title?: string;
/**
* Specify subtype of the asset to create
*
* @type { ?PhotoSubtype }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
subtype?: PhotoSubtype;
}
/**
* Options to request photo
*
* @interface RequestPhotoOptions
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
interface RequestPhotoOptions {
/**
* Size of thumbnail
*
* @type { ?image.Size }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
size?: image.Size;
/**
* Type of photo request
*
* @type { ?RequestPhotoType }
* @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
*/
/**
* The fetch result of assets or albums
*
* @interface FetchResult
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
interface FetchResult {
/**
* Obtains the total number of objects in the fetch result.
*
* @returns { number } Total number of objects.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the total number of objects in the fetch result.
*
* @returns { number } Total number of objects.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* 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 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
isAfterLast(): boolean;
/**
* Obtains the first object in the fetch result.
*
* @param { AsyncCallback } callback - Returns the first object in the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the first object in the fetch result.
*
* @param { AsyncCallback } callback - Returns the first object in the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getFirstObject(callback: AsyncCallback): void;
/**
* Obtains the first object in the fetch result.
*
* @returns { Promise } Returns the first object in the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the first object in the fetch result.
*
* @returns { Promise } Returns the first object in the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getFirstObject(): Promise;
/**
* 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 } callback - Returns the next object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* 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 } callback - Returns the next object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getNextObject(callback: AsyncCallback): 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 } Returns the next object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* 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 } Returns the next object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getNextObject(): Promise;
/**
* Obtains the last object in the fetch result
*
* @param { AsyncCallback } callback - Returns the last object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the last object in the fetch result
*
* @param { AsyncCallback } callback - Returns the last object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getLastObject(callback: AsyncCallback): void;
/**
* Obtains the last object in the fetch result
*
* @returns { Promise } Returns the last object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the last object in the fetch result
*
* @returns { Promise } Returns the last object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getLastObject(): Promise;
/**
* Obtains the object with the specified index in the fetch result.
*
* @param { number } index - Index of the object to obtain.
* @param { AsyncCallback } callback - Returns the object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the object with the specified index in the fetch result.
*
* @param { number } index - Index of the object to obtain.
* @param { AsyncCallback } callback - Returns the object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getObjectByPosition(index: number, callback: AsyncCallback): void;
/**
* Obtains the object with the specified index in the fetch result.
*
* @param { number } index - Index of the asset to obtain.
* @returns { Promise } Returns the object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains the object with the specified index in the fetch result.
*
* @param { number } index - Index of the asset to obtain.
* @returns { Promise } Returns the object
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getObjectByPosition(index: number): Promise;
/**
* Obtains all objects in the fetch result.
*
* @param { AsyncCallback> } callback - Returns all the objects
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains all objects in the fetch result.
*
* @param { AsyncCallback> } callback - Returns all the objects
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAllObjects(callback: AsyncCallback>): void;
/**
* Obtains all objects in the fetch result.
*
* @returns { Promise> } Returns all the objects
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Obtains all objects in the fetch result.
*
* @returns { Promise> } Returns all the objects
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAllObjects(): Promise>;
/**
* Releases the fetch result.
*
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Releases the fetch result.
*
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
close(): void;
}
/**
* Album type.
*
* @enum { number } AlbumType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album type.
*
* @enum { number } AlbumType
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
enum AlbumType {
/**
* Album created by user.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album created by user.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
USER = 0,
/**
* Album created by system, which metadata cannot be modified.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album created by system, which metadata cannot be modified.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
SYSTEM = 1024,
/**
* Album created by smart abilities.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
SMART = 4096
}
/**
* Album subtype
*
* @enum { number } AlbumSubtype
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album subtype
*
* @enum { number } AlbumSubtype
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
enum AlbumSubtype {
/**
* Generic user-created albums.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Generic user-created albums.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
USER_GENERIC = 1,
/**
* Favorite album, which assets are marked as favorite.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Favorite album, which assets are marked as favorite.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
FAVORITE = 1025,
/**
* Video album, which contains all video assets.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Video album, which contains all video assets.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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 album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
IMAGE = 1031,
/**
* Cloud Enhancement album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
CLOUD_ENHANCEMENT = 1032,
/**
* Source album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
SOURCE_GENERIC = 2049,
/**
* Classify album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
CLASSIFY = 4097,
/**
* Location album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
GEOGRAPHY_LOCATION = 4099,
/**
* City album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
GEOGRAPHY_CITY,
/**
* ShootingMode album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
SHOOTING_MODE,
/**
* Portrait album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
PORTRAIT,
/**
* Group photo album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
GROUP_PHOTO,
/**
* Highlight album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
HIGHLIGHT = 4104,
/**
* Highlight suggestions album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
HIGHLIGHT_SUGGESTIONS,
/**
* Any album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Any album
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
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
*/
/**
* Defines the abstract interface of albums.
*
* @interface AbsAlbum
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
interface AbsAlbum {
/**
* Album type
*
* @type { AlbumType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album type
*
* @type { AlbumType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly albumType: AlbumType;
/**
* Album subtype
*
* @type { AlbumSubtype }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album subtype
*
* @type { AlbumSubtype }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly albumSubtype: AlbumSubtype;
/**
* Album name.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album name.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
albumName: string;
/**
* Album uri.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Album uri.
*
* @type { string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly albumUri: string;
/**
* Number of assets in the album
*
* @type { number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Number of assets in the album
*
* @type { number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly count: number;
/**
* Cover uri for the album
*
* @type { string }
* @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> } callback - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Fetch assets in an album.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @param { AsyncCallback> } callback - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAssets(options: FetchOptions, callback: AsyncCallback>): void;
/**
* Fetch assets in an album.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @returns { Promise> } Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Fetch assets in an album.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @returns { Promise> } Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAssets(options: FetchOptions): Promise>;
/**
* Fetch shared photo assets in an album.
*
* @permission ohos.permission.ACCESS_MEDIALIB_THUMB_DB
* @param { FetchOptions } options - Fetch options.
* @returns { Array } Returns the shared photo assets
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - Internal system error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
getSharedPhotoAssets(options: FetchOptions): Array;
}
/**
* Defines the album.
*
* @interface Album
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Defines the album.
*
* @interface Album
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
interface Album extends AbsAlbum {
/**
* Number of image assets in the album
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
/**
* Number of image assets in the album
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly imageCount?: number;
/**
* Number of video assets in the album
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 11
*/
/**
* Number of video assets in the album
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
readonly videoCount?: number;
/**
* Modify metadata for the album
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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;
/**
* Modify metadata for the album
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @returns { Promise } Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types.
* @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;
/**
* Add assets to the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to add
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#addAssets
*/
addAssets(assets: Array, callback: AsyncCallback): void;
/**
* Add assets to the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to add
* @returns { Promise } Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#addAssets
*/
addAssets(assets: Array): Promise;
/**
* Remove assets from the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to remove
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#removeAssets
*/
removeAssets(assets: Array, callback: AsyncCallback): void;
/**
* Remove assets from the album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to remove
* @returns { Promise } Returns void
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#removeAssets
*/
removeAssets(assets: Array): Promise;
/**
* Recover assets from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to recover
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#recoverAssets
*/
recoverAssets(assets: Array, callback: AsyncCallback): void;
/**
* Recover assets from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to recover
* @returns { Promise } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#recoverAssets
*/
recoverAssets(assets: Array): Promise;
/**
* Delete assets permanently from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to delete
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAssets
*/
deleteAssets(assets: Array, callback: AsyncCallback): void;
/**
* Delete assets permanently from the trash album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } assets - Assets to delete
* @returns { Promise } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAssets
*/
deleteAssets(assets: Array): Promise;
/**
* Set cover uri for this album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } uri - The asset uri to set
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#setCoverUri
*/
setCoverUri(uri: string, callback: AsyncCallback): void;
/**
* Set cover uri for this album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } uri - The asset uri to set
* @returns { Promise } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#setCoverUri
*/
setCoverUri(uri: string): Promise;
/**
* Get the faceId of the portrait album or group photo album.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @returns { Promise } Returns tag_id if portrait album, Returns group_tag if group photo album,
*
Returns empty if not found.
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application
* @throws { BusinessError } 14000011 - Internal system error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 13
*/
getFaceId(): Promise;
}
/**
* Helper functions to access photos and albums.
*
* @interface PhotoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Helper functions to access photos and albums.
*
* @interface PhotoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 11
*/
/**
* Helper functions to access photos and albums.
*
* @interface PhotoAccessHelper
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @atomicservice
* @since 12
*/
interface PhotoAccessHelper {
/**
* Fetch photo assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @param { AsyncCallback> } callback - Returns the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Fetch photo assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Fetch options.
* @param { AsyncCallback> } callback - Returns the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAssets(options: FetchOptions, callback: AsyncCallback>): void;
/**
* Fetch photo assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Retrieval options.
* @returns { Promise> } Returns the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Fetch photo assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { FetchOptions } options - Retrieval options.
* @returns { Promise> } Returns the fetch result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAssets(options: FetchOptions): Promise>;
/**
* Fetch a group of burst assets
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { string } burstKey - Burst asset uuid
* @param { FetchOptions } options - Retrieval options.
* @returns { Promise> } Returns the fetch result.
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - Internal system error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 12
*/
getBurstAssets(burstKey: string, options: FetchOptions): Promise>;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @param { AsyncCallback } callback - Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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): void;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @returns { Promise } Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @param { PhotoCreateOptions } options - Create operation
* @returns { Promise } Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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;
/**
* Create a photo asset
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } displayName - Asset name
* @param { PhotoCreateOptions } options - Photo create operation
* @param { AsyncCallback } callback - Returns the newly created asset
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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): 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 } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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 } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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): 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 } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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 } callback - Returns the uri of the newly created asset
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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): 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 } Returns the uri of the newly created asset
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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 } Returns the uri of the newly created asset
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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;
/**
* Create a generic user album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } name - Album name to be created.
* @param { AsyncCallback } callback - Returns the instance of newly created Album
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#createAlbumRequest
*/
createAlbum(name: string, callback: AsyncCallback): void;
/**
* Create a generic user album.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { string } name - Album name to be created.
* @returns { Promise } Returns the instance of newly created Album
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#createAlbumRequest
*/
createAlbum(name: string): Promise;
/**
* Delete generic user-created albums.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } albums - Specify which albums to delete
* @param { AsyncCallback } callback - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAlbums
*/
deleteAlbums(albums: Array, callback: AsyncCallback): void;
/**
* Delete generic user-created albums.
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } albums - Specify which albums to delete
* @returns { Promise } Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAlbumChangeRequest#deleteAlbums
*/
deleteAlbums(albums: Array): Promise;
/**
* 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> } callback - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* 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> } callback - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAlbums(
type: AlbumType,
subtype: AlbumSubtype,
options: FetchOptions,
callback: AsyncCallback>
): void;
/**
* Fetch albums.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AlbumType } type - Album type.
* @param { AlbumSubtype } subtype - Album subtype.
* @param { AsyncCallback> } callback - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* Fetch albums.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AlbumType } type - Album type.
* @param { AlbumSubtype } subtype - Album subtype.
* @param { AsyncCallback> } callback - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAlbums(type: AlbumType, subtype: AlbumSubtype, callback: AsyncCallback>): 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> } - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
/**
* 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> } - Returns the fetch result
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 14000011 - System inner fail
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @crossplatform
* @since 12
*/
getAlbums(type: AlbumType, subtype: AlbumSubtype, options?: FetchOptions): Promise>;
/**
* 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> } 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. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getHiddenAlbums(mode: HiddenPhotosDisplayMode, options: FetchOptions, callback: AsyncCallback>): 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> } 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. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getHiddenAlbums(mode: HiddenPhotosDisplayMode, callback: AsyncCallback>): 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> } 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. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - System inner fail.
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 11
*/
getHiddenAlbums(mode: HiddenPhotosDisplayMode, options?: FetchOptions): Promise>;
/**
* Delete assets
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } uriList - Uris of assets to delete
* @param { AsyncCallback } callback - No value returned
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets
*/
deleteAssets(uriList: Array, callback: AsyncCallback): void;
/**
* Delete assets
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array } uriList - Uris of assets to delete
* @returns { Promise } - Returns void
* @throws { BusinessError } 202 - Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @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
* @deprecated since 11
* @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets
*/
deleteAssets(uriList: Array): Promise;
/**
* 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 } callback - Returns the changed data
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
registerChange(uri: string, forChildUris: boolean, callback: Callback): void;
/**
* Get analysis progress of the asset.
*
* @permission ohos.permission.READ_IMAGEVIDEO
* @param { AnalysisType } analysisType - Analysis type
* @returns { Promise } Returns analysis progress info into a json string
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Called by non-system application
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14000011 - Internal system error
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @systemapi
* @since 12
*/
getDataAnalysisProgress(analysisType: AnalysisType): Promise;
/**
* Unregister change notify for the specified uri.
*
* @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri
* @param { Callback } [callback] - The callback function to unregister.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
*
2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900020 - Invalid argument
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @since 10
*/
unRegisterChange(uri: string, callback?: Callback): void;
/**
* Create a pop-up box to delete photos
*
* @permission ohos.permission.WRITE_IMAGEVIDEO
* @param { Array