2022-08-10 09:49:36 +00:00
|
|
|
/*
|
2023-01-04 07:39:12 +00:00
|
|
|
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
|
2022-08-10 09:49:36 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2024-01-08 07:25:39 +00:00
|
|
|
* @kit CoreFileKit
|
2023-12-11 09:08:03 +00:00
|
|
|
*/
|
|
|
|
|
2023-04-10 12:47:59 +00:00
|
|
|
import type { AsyncCallback, Callback } from './@ohos.base';
|
2023-01-04 07:39:12 +00:00
|
|
|
import type Context from './application/Context';
|
2022-08-10 09:49:36 +00:00
|
|
|
import image from './@ohos.multimedia.image';
|
2022-09-06 08:41:29 +00:00
|
|
|
import dataSharePredicates from './@ohos.data.dataSharePredicates';
|
2022-08-10 09:49:36 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-31 08:17:52 +00:00
|
|
|
* @namespace userFileManager
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
declare namespace userFileManager {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Returns an instance of UserFileManager
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { Context } context - Hap context information
|
|
|
|
* @returns { UserFileManager } Instance of UserFileManager
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
2022-08-10 09:49:36 +00:00
|
|
|
* @StageModelOnly
|
2023-05-31 08:17:52 +00:00
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
function getUserFileMgr(context: Context): UserFileManager;
|
|
|
|
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Enumeration types for different kinds of Files
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @enum { number } FileType
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
enum FileType {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Image file type
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
IMAGE = 1,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Video file type
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
VIDEO,
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Audio file type
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
AUDIO
|
|
|
|
}
|
|
|
|
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Enumeration types for different types of FileAsset
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @enum { number } PhotoSubType
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum PhotoSubType {
|
|
|
|
/**
|
|
|
|
* Default Photo Type
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
DEFAULT,
|
|
|
|
/**
|
|
|
|
* Screenshot Photo Type
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
SCREENSHOT,
|
|
|
|
/**
|
|
|
|
* Camera Photo Type
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
CAMERA
|
|
|
|
}
|
|
|
|
|
2023-01-04 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* File position
|
|
|
|
*
|
2023-07-25 15:49:25 +00:00
|
|
|
* @enum { number } File position, which indicates the file is on local device or cloud
|
2023-01-04 07:39:12 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum PositionType {
|
|
|
|
/**
|
2023-07-25 15:49:25 +00:00
|
|
|
* File exists only on local device
|
2023-01-04 07:39:12 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
LOCAL = 1,
|
|
|
|
/**
|
2023-07-25 15:49:25 +00:00
|
|
|
* File exists only on cloud
|
2023-01-04 07:39:12 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
CLOUD,
|
|
|
|
/**
|
2023-07-25 15:49:25 +00:00
|
|
|
* File exists on both local and cloud
|
2023-01-04 07:39:12 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
BOTH
|
|
|
|
}
|
|
|
|
|
2022-09-06 08:41:29 +00:00
|
|
|
/**
|
|
|
|
* Indicates the type of file asset member.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @typedef { number | string | boolean } MemberType
|
2023-06-29 08:08:17 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2022-10-21 06:29:24 +00:00
|
|
|
* @systemapi
|
2023-05-31 08:17:52 +00:00
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
type MemberType = number | string | boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the type of notify event.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @typedef { 'deviceChange' | 'albumChange' | 'imageChange' | 'audioChange' | 'videoChange' | 'remoteFileChange' } ChangeEvent
|
2023-06-29 08:08:17 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2022-10-21 06:29:24 +00:00
|
|
|
* @systemapi
|
2023-05-31 08:17:52 +00:00
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
2023-05-31 08:17:52 +00:00
|
|
|
type ChangeEvent =
|
|
|
|
'deviceChange'
|
|
|
|
| 'albumChange'
|
|
|
|
| 'imageChange'
|
|
|
|
| 'audioChange'
|
|
|
|
| 'videoChange'
|
|
|
|
| 'remoteFileChange';
|
2022-09-06 08:41:29 +00:00
|
|
|
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Provides methods to encapsulate file attributes.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface FileAsset
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
interface FileAsset {
|
|
|
|
/**
|
|
|
|
* URI of the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly uri: string;
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* File type, for example, IMAGE, VIDEO, AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { FileType }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
readonly fileType: FileType;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Display name (with a file name extension) of the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
displayName: string;
|
|
|
|
/**
|
2022-11-16 09:28:27 +00:00
|
|
|
* Return the fileAsset member parameter.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { string } member - The name of the parameter. for example : get(ImageVideoKey.URI)
|
|
|
|
* @returns { MemberType }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
get(member: string): MemberType;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-11-16 09:28:27 +00:00
|
|
|
* Set the fileAsset member parameter.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { string } member - The name of the parameter
|
|
|
|
* @param { string } value - The value of the parameter.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
* @example : Set(ImageVideoKey.TITLE, "newTitle"), call commitModify after set value
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
set(member: string, value: string): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Modify meta data where the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - No value will be returned.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
commitModify(callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Modify meta data where the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @returns { Promise<void> } Return promise
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
commitModify(): Promise<void>;
|
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Open local file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO or ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } mode - Mode for open, for example: rw, r, w.
|
|
|
|
* @param { AsyncCallback<number> } callback - Callback return the fd of the file.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
open(mode: string, callback: AsyncCallback<number>): void;
|
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Open local file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO or ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } mode - Mode for open, for example: rw, r, w.
|
|
|
|
* @returns { Promise<number> } Return promise
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
open(mode: string): Promise<number>;
|
|
|
|
/**
|
|
|
|
* Close the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { number } fd - Fd of the file which had been opened
|
|
|
|
* @param { AsyncCallback<void> } callback - No value will be returned.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
close(fd: number, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Close the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { number } fd - Fd of the file which had been opened
|
|
|
|
* @returns { Promise<void> } Return promise
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
close(fd: number): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Get thumbnail of the file when the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AsyncCallback<image.PixelMap> } callback - Callback used to return the thumbnail's pixelMap.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
getThumbnail(callback: AsyncCallback<image.PixelMap>): void;
|
|
|
|
/**
|
|
|
|
* Get thumbnail of the file when the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { image.Size } size - Thumbnail's size
|
|
|
|
* @param { AsyncCallback<image.PixelMap> } callback - Callback used to return the thumbnail's pixelMap.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getThumbnail(size: image.Size, callback: AsyncCallback<image.PixelMap>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Get thumbnail of the file when the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { image.Size } size - Thumbnail's size
|
|
|
|
* @returns { Promise<image.PixelMap> } Return promise
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getThumbnail(size?: image.Size): Promise<image.PixelMap>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Set favorite for the file when the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { boolean } isFavorite - True is favorite file, false is not favorite file
|
|
|
|
* @param { AsyncCallback<void> } callback - Callback used to return, No value is returned.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
favorite(isFavorite: boolean, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Set favorite for the file when the file is located.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2023-01-30 09:36:01 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { boolean } isFavorite - isFavorite True is favorite file, false is not favorite file
|
|
|
|
* @returns { Promise<void> } Return promise
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
favorite(isFavorite: boolean): Promise<void>;
|
2023-05-07 16:19:13 +00:00
|
|
|
/**
|
|
|
|
* Set file hidden state.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album.
|
|
|
|
* @param { AsyncCallback<void> } callback - Return void.
|
|
|
|
* @throws { BusinessError } 202 - Called by non-system application.
|
|
|
|
* @throws { BusinessError } 13900020 - if parameter is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
setHidden(hiddenState: boolean, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Set file hidden state.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { boolean } hiddenState - true: Put the asset into hidden album; false: Recover the asset from hidden album.
|
|
|
|
* @returns { Promise<void> } Returns the promise
|
|
|
|
* @throws { BusinessError } 202 - Called by non-system application.
|
|
|
|
* @throws { BusinessError } 13900020 - if parameter is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
setHidden(hiddenState: boolean): Promise<void>;
|
2023-07-19 03:42:22 +00:00
|
|
|
/**
|
|
|
|
* Set user comment info to the asset.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { string } userComment - user comment info
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns void.
|
|
|
|
* @throws { BusinessError } 202 - Called by non-system application.
|
2024-05-29 08:01:12 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
|
|
|
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
2023-07-19 03:42:22 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
setUserComment(userComment: string, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Set user comment info to the asset.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { string } userComment - user comment info
|
|
|
|
* @returns { Promise<void> } Returns void
|
|
|
|
* @throws { BusinessError } 202 - Called by non-system application.
|
2024-05-29 08:01:12 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
|
|
|
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
2023-07-19 03:42:22 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
setUserComment(userComment: string): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Get exif info of the asset.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @param { AsyncCallback<string> } callback - Returns exif info into a json string
|
|
|
|
* @throws { BusinessError } 202 - Called by non-system application.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getExif(callback: AsyncCallback<string>): void;
|
|
|
|
/**
|
|
|
|
* Get exif info of the asset.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @returns { Promise<string> } Returns exif info into a json string
|
|
|
|
* @throws { BusinessError } 202 - Called by non-system application.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getExif(): Promise<string>;
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Describes AUDIO TYPE FetchOptions's predicate
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @enum { string } AudioKey
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
enum AudioKey {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* File uri, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
URI,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* File name
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DISPLAY_NAME,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Date of the file creation, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DATE_ADDED,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Modify date of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DATE_MODIFIED,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Title of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
TITLE,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Artist of the audio file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
ARTIST,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Audio album of the audio file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
AUDIOALBUM,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Duration of the audio file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DURATION,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Favorite state of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2023-01-30 09:36:01 +00:00
|
|
|
FAVORITE
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-31 08:17:52 +00:00
|
|
|
* Describes Image, Video TYPE FetchOptions's predicate
|
|
|
|
*
|
|
|
|
* @enum { string } ImageVideoKey
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
|
|
|
*/
|
2022-08-10 09:49:36 +00:00
|
|
|
enum ImageVideoKey {
|
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* File uri, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
URI,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* File type of the Asset, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
FILE_TYPE,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* File name
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DISPLAY_NAME,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Date of the file creation, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DATE_ADDED,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Modify date of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DATE_MODIFIED,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Title of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
TITLE,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Duration of the audio and video file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DURATION,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Width of the image file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
WIDTH,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Height of the image file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
HEIGHT,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Date taken of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DATE_TAKEN,
|
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Orientation of the image file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
ORIENTATION,
|
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* Favorite state of the file, read only
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
2023-01-04 07:39:12 +00:00
|
|
|
FAVORITE,
|
|
|
|
/**
|
2023-04-13 02:52:41 +00:00
|
|
|
* File position, read only
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
POSITION,
|
|
|
|
/**
|
|
|
|
* Trashed date of the file, read only
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
DATE_TRASHED,
|
|
|
|
/**
|
|
|
|
* Hidden state of the file, read only
|
2023-01-04 07:39:12 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-07-19 03:42:22 +00:00
|
|
|
HIDDEN,
|
|
|
|
/**
|
|
|
|
* User comment info
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
USER_COMMENT,
|
|
|
|
/**
|
|
|
|
* Camera shot key
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
CAMERA_SHOT_KEY
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes Album TYPE predicate
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @enum { string } AlbumKey
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
enum AlbumKey {
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Album uri
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
URI,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* File type of the Album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
FILE_TYPE,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Album name
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
ALBUM_NAME,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Date of the Album creation
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
DATE_ADDED,
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Modify date of the Album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2023-01-30 09:36:01 +00:00
|
|
|
DATE_MODIFIED
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Fetch parameters
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface FetchOptions
|
2022-09-06 08:41:29 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
interface FetchOptions {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Indicates the columns to query.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 07:01:46 +00:00
|
|
|
* @type { Array<string> }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
fetchColumns: Array<string>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Predicate to query
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { dataSharePredicates.DataSharePredicates }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
predicates: dataSharePredicates.DataSharePredicates;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch parameters
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface AlbumFetchOptions
|
2022-09-06 08:41:29 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
interface AlbumFetchOptions {
|
|
|
|
/**
|
|
|
|
* Predicate to query
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { dataSharePredicates.DataSharePredicates }
|
2022-09-06 08:41:29 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
predicates: dataSharePredicates.DataSharePredicates;
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Describe additional operations for creating photo
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @interface PhotoCreateOptions
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
interface PhotoCreateOptions {
|
|
|
|
/**
|
|
|
|
* SubType of the photo
|
|
|
|
*
|
2024-07-10 06:51:14 +00:00
|
|
|
* @type { ?PhotoSubType }
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
subType?: PhotoSubType;
|
2023-07-19 03:42:22 +00:00
|
|
|
/**
|
|
|
|
* Camera shot key
|
|
|
|
*
|
|
|
|
* @type { ?string }
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
cameraShotKey?: string;
|
2023-04-13 02:52:41 +00:00
|
|
|
}
|
|
|
|
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Implements file retrieval.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface FetchResult
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
interface FetchResult<T> {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Obtains the total number of files in the file retrieval result.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { number } Total number of files.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
getCount(): number;
|
|
|
|
/**
|
|
|
|
* Checks whether the result set points to the last row.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { boolean } Whether the file is the last one.
|
2022-08-10 09:49:36 +00:00
|
|
|
* You need to check whether the file is the last one before calling getNextObject,
|
2022-11-16 09:28:27 +00:00
|
|
|
* which returns the next file only when False is returned for this method.
|
2023-05-31 08:17:52 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
isAfterLast(): boolean;
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Releases the FetchResult instance and invalidates it. Other methods cannot be called.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
close(): void;
|
|
|
|
/**
|
|
|
|
* Obtains the first FileAsset in the file retrieval result. This method uses a callback to return the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { AsyncCallback<T> } callback - Callback used to return the file in the format of a FileAsset instance.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getFirstObject(callback: AsyncCallback<T>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the first T in the file retrieval result. This method uses a promise to return the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<T> } A Promise instance used to return the file in the format of a T instance.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getFirstObject(): Promise<T>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the next T in the file retrieval result.
|
2022-08-10 09:49:36 +00:00
|
|
|
* This method uses a callback to return the file.
|
|
|
|
* Before calling this method, you must use isAfterLast() to check whether the result set points to the last row.
|
2022-11-16 09:28:27 +00:00
|
|
|
* This method returns the next file only when False is returned for isAfterLast().
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { AsyncCallback<T> } callback - Callback used to return the file in the format of a T instance.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getNextObject(callback: AsyncCallback<T>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the next T in the file retrieval result.
|
2022-08-10 09:49:36 +00:00
|
|
|
* This method uses a promise to return the file.
|
|
|
|
* Before calling this method, you must use isAfterLast() to check whether the result set points to the last row.
|
2022-11-16 09:28:27 +00:00
|
|
|
* This method returns the next file only when False is returned for isAfterLast().
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<T> } A Promise instance used to return the file in the format of a T instance.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getNextObject(): Promise<T>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the last T in the file retrieval result. This method uses a callback to return the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { AsyncCallback<T> } callback - Callback used to return the file in the format of a T instance.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getLastObject(callback: AsyncCallback<T>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the last T in the file retrieval result. This method uses a promise to return the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<T> } A Promise instance used to return the file in the format of a T instance.
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getLastObject(): Promise<T>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the T with the specified index in the file retrieval result.
|
2022-08-10 09:49:36 +00:00
|
|
|
* This method uses a callback to return the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { number } index - Index of the file to obtain.
|
|
|
|
* @param { AsyncCallback<T> } callback - Callback used to return the file in the format of a T instance.
|
|
|
|
* @throws { BusinessError } 13900020 - if type index is not number
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPositionObject(index: number, callback: AsyncCallback<T>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains the T with the specified index in the file retrieval result.
|
2022-08-10 09:49:36 +00:00
|
|
|
* This method uses a promise to return the file.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { number } index - Index of the file to obtain.
|
|
|
|
* @returns { Promise<T> } A Promise instance used to return the file in the format of a T instance.
|
|
|
|
* @throws { BusinessError } 13900020 - if type index is not number
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPositionObject(index: number): Promise<T>;
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Obtains all T in the file retrieval result.
|
|
|
|
* This method uses a callback to return the result. After this method is called,
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AsyncCallback<Array<T>> } callback - Callback used to return a T array.
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getAllObject(callback: AsyncCallback<Array<T>>): void;
|
|
|
|
/**
|
|
|
|
* Obtains all T in the file retrieval result.
|
|
|
|
* This method uses a promise to return the result. that store the selected media resources.
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @returns { Promise<Array<T>> } A Promise instance used to return a T array.
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getAllObject(): Promise<Array<T>>;
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
2023-01-04 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* Album type.
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @enum { number } AlbumType
|
2023-01-04 07:39:12 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum AlbumType {
|
|
|
|
/**
|
|
|
|
* Album created by user.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
USER = 0,
|
|
|
|
/**
|
|
|
|
* Album created by system, which metadata cannot be modified by user.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
SYSTEM = 1024
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Album subtype
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @enum { number } AlbumSubType
|
2023-01-04 07:39:12 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum AlbumSubType {
|
|
|
|
/**
|
|
|
|
* Generic user-created albums.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
USER_GENERIC = 1,
|
|
|
|
/**
|
|
|
|
* Favorite album, which assets are marked as favorite.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
FAVORITE = 1025,
|
|
|
|
/**
|
|
|
|
* Video album, which contains all video assets.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
VIDEO,
|
|
|
|
/**
|
|
|
|
* Hidden album, which assets are marked as hidden.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
HIDDEN,
|
|
|
|
/**
|
|
|
|
* Trash album, which assets are deleted.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
TRASH,
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Screenshot album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
SCREENSHOT,
|
|
|
|
/**
|
|
|
|
* Camera album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
CAMERA,
|
2023-01-04 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* Any album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
ANY = 2147483647
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Defines the AbsAlbum.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface AbsAlbum
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
interface AbsAlbum {
|
2023-01-04 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* Album type
|
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { AlbumType }
|
2023-01-04 07:39:12 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
readonly albumType: AlbumType;
|
|
|
|
/**
|
|
|
|
* Album subtype
|
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { AlbumSubType }
|
2023-01-04 07:39:12 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
readonly albumSubType: AlbumSubType;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Album name.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
albumName: string;
|
|
|
|
/**
|
|
|
|
* Album uri.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly albumUri: string;
|
|
|
|
/**
|
|
|
|
* Date (timestamp) when the album was last modified.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { number }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly dateModified: number;
|
|
|
|
/**
|
|
|
|
* File count for the album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { number }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly count: number;
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* CoverUri for the album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2023-01-04 07:39:12 +00:00
|
|
|
coverUri: string;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains files in an album. This method uses an asynchronous callback to return the files.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { FetchOptions } options - Retrieval options.
|
|
|
|
* @param { AsyncCallback<FetchResult<FileAsset>> } callback - Callback used to return the files in the format of a FetchResult instance.
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<FileAsset>>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Obtains files in an album. This method uses a promise to return the files.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { FetchOptions } options - Retrieval options.
|
|
|
|
* @returns { Promise<FetchResult<FileAsset>> } A Promise instance used to return the files in the format of a FetchResult instance.
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>>;
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Defines the album.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface Album
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
interface Album extends AbsAlbum {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Modify the meta data for the album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - No value will be returned.
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
commitModify(callback: AsyncCallback<void>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Modify the meta data for the album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @returns { Promise<void> } Return promise
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
commitModify(): Promise<void>;
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Add PhotoAssets to the album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to add
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - Returns void
|
2023-04-13 02:52:41 +00:00
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
addPhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Add PhotoAssets to the album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to add
|
|
|
|
* @returns { Promise<void> } Returns the promise
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
addPhotoAssets(assets: Array<FileAsset>): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Remove PhotoAssets from the album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to remove
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns void
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
removePhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Remove PhotoAssets from the album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to remove
|
|
|
|
* @returns { Promise<void> } Returns the promise
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
removePhotoAssets(assets: Array<FileAsset>): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Recover PhotoAssets from the trash album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to recover
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns void
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
recoverPhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Recover PhotoAssets from the trash album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to recover
|
|
|
|
* @returns { Promise<void> } Returns the promise
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
recoverPhotoAssets(assets: Array<FileAsset>): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Delete PhotoAssets permanently from the trash album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to delete
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns void
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
deletePhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Delete PhotoAssets permanently from the trash album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<FileAsset> } assets - Assets to delete
|
|
|
|
* @returns { Promise<void> } Returns the promise
|
|
|
|
* @throws { BusinessError } 13900020 - if PhotoAssets is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
deletePhotoAssets(assets: Array<FileAsset>): Promise<void>;
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-31 08:17:52 +00:00
|
|
|
* Defines the UserFileManager class and provides functions to access the data in user file storage.
|
|
|
|
*
|
|
|
|
* @interface UserFileManager
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
interface UserFileManager {
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Query photo, video assets
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { FetchOptions } options - retrieval options.
|
|
|
|
* @param { AsyncCallback<FetchResult<FileAsset>> } callback - Callback return the FetchResult.
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<FileAsset>>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Query photo, video assets
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { FetchOptions } options - Retrieval options.
|
|
|
|
* @returns { Promise<FetchResult<FileAsset>> } A promise instance used to return the files in the format of a FetchResult instance
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Create Photo Asset
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @param { string } albumUri - Asset will put into the album.
|
|
|
|
* @param { AsyncCallback<FileAsset> } callback - Callback used to return the FileAsset
|
|
|
|
* @throws { BusinessError } 13900020 - if type displayName or albumUri is not string
|
|
|
|
* @throws { BusinessError } 14000001 - if type displayName invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
createPhotoAsset(displayName: string, albumUri: string, callback: AsyncCallback<FileAsset>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Create Photo Asset
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @param { AsyncCallback<FileAsset> } callback - Callback used to return the FileAsset
|
|
|
|
* @throws { BusinessError } 13900020 - if type displayName is not string
|
|
|
|
* @throws { BusinessError } 14000001 - if type displayName invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
createPhotoAsset(displayName: string, callback: AsyncCallback<FileAsset>): void;
|
|
|
|
/**
|
|
|
|
* Create Photo Asset
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @param { string } albumUri - Album uri is optional, PhotoAssets will put into the default album without albumUri
|
|
|
|
* @returns { Promise<FileAsset> } A Promise instance used to return the FileAsset
|
|
|
|
* @throws { BusinessError } 13900020 - if type displayName or albumUri is not string
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
createPhotoAsset(displayName: string, albumUri?: string): Promise<FileAsset>;
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Create Photo Asset
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @param { PhotoCreateOptions } createOption - Create operation
|
|
|
|
* @returns { Promise<FileAsset> } A Promise instance used to return the FileAsset
|
2023-04-13 02:52:41 +00:00
|
|
|
* @throws { BusinessError } 13900020 - if type displayName is not string
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
createPhotoAsset(displayName: string, createOption: PhotoCreateOptions): Promise<FileAsset>;
|
|
|
|
/**
|
|
|
|
* Create Photo Asset
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @param { PhotoCreateOptions } createOption - Photo create operation
|
|
|
|
* @param { AsyncCallback<FileAsset> } callback - Callback used to return the FileAsset
|
2023-04-13 02:52:41 +00:00
|
|
|
* @throws { BusinessError } 13900020 - if type displayName is not string
|
|
|
|
* @throws { BusinessError } 14000001 - if type displayName invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
createPhotoAsset(displayName: string, createOption: PhotoCreateOptions, callback: AsyncCallback<FileAsset>): void;
|
|
|
|
/**
|
|
|
|
* Create Audio Asset
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @param { AsyncCallback<FileAsset> } callback - Callback used to return the FileAsset
|
2023-04-13 02:52:41 +00:00
|
|
|
* @throws { BusinessError } 13900020 - if type displayName is not string
|
|
|
|
* @throws { BusinessError } 14000001 - if type displayName invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
createAudioAsset(displayName: string, callback: AsyncCallback<FileAsset>): void;
|
|
|
|
/**
|
|
|
|
* Create Audio Asset
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } displayName - File name
|
|
|
|
* @returns { Promise<FileAsset> } A Promise instance used to return the FileAsset
|
2023-04-13 02:52:41 +00:00
|
|
|
* @throws { BusinessError } 13900020 - if type displayName is not string
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
createAudioAsset(displayName: string): Promise<FileAsset>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains albums based on the retrieval options. This method uses an asynchronous callback to return.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AlbumFetchOptions } options - Retrieval options.
|
|
|
|
* @param { AsyncCallback<FetchResult<Album>> } callback - Callback used to return an album array.
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not AlbumFetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPhotoAlbums(options: AlbumFetchOptions, callback: AsyncCallback<FetchResult<Album>>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains albums based on the retrieval options. This method uses a promise to return the albums.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { AlbumFetchOptions } options - Retrieval options.
|
|
|
|
* @returns { Promise<FetchResult<Album>> } A Promise instance used to return an album array.
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not AlbumFetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPhotoAlbums(options: AlbumFetchOptions): Promise<FetchResult<Album>>;
|
2023-01-04 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* Create a generic user album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { string } name - Album name to be created.
|
|
|
|
* @param { AsyncCallback<Album> } callback - Returns the instance of newly created Album
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
createAlbum(name: string, callback: AsyncCallback<Album>): void;
|
|
|
|
/**
|
|
|
|
* Create a generic user album.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { string } name - Album name to be created.
|
|
|
|
* @returns { Promise<Album> } Returns the instance of newly created Album
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
createAlbum(name: string): Promise<Album>;
|
|
|
|
/**
|
|
|
|
* Delete generic user-created albums.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<Album> } albums - Specify which album to delete
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns void
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
deleteAlbums(albums: Array<Album>, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Delete generic user-created albums.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.WRITE_IMAGEVIDEO
|
|
|
|
* @param { Array<Album> } albums - Specify which album to delete
|
|
|
|
* @returns { Promise<void> } Returns the promise
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
deleteAlbums(albums: Array<Album>): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Obtains albums based on the retrieval options and album types.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @param { AlbumType } type - Album type.
|
|
|
|
* @param { AlbumSubType } subType - Album subtype.
|
|
|
|
* @param { FetchOptions } options - options to fetch albums
|
|
|
|
* @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result of the albums
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOption
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getAlbums(
|
|
|
|
type: AlbumType,
|
|
|
|
subType: AlbumSubType,
|
|
|
|
options: FetchOptions,
|
|
|
|
callback: AsyncCallback<FetchResult<Album>>
|
|
|
|
): void;
|
|
|
|
/**
|
|
|
|
* Obtains albums based on the album types.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @param { AlbumType } type - Album type.
|
|
|
|
* @param { AlbumSubType } subType - Album subtype.
|
|
|
|
* @param { AsyncCallback<FetchResult<Album>> } callback - Returns the fetch result of the albums
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOption
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getAlbums(type: AlbumType, subType: AlbumSubType, callback: AsyncCallback<FetchResult<Album>>): void;
|
|
|
|
/**
|
|
|
|
* Obtains albums based on the retrieval options and album types.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @param { AlbumType } type - Album type.
|
|
|
|
* @param { AlbumSubType } subType - Album subtype.
|
|
|
|
* @param { FetchOptions } [options] -options to fetch albums
|
|
|
|
* @returns { Promise<FetchResult<Album>> } - Returns the fetch result of the albums
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOption
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getAlbums(type: AlbumType, subType: AlbumSubType, options?: FetchOptions): Promise<FetchResult<Album>>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains system private albums based on the private album type. This method uses an asynchronous callback to return.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { PrivateAlbumType } type - Private album type
|
|
|
|
* @param { AsyncCallback<FetchResult<PrivateAlbum>> } callback - Used to return a private album FetchResult.
|
|
|
|
* @throws { BusinessError } 13900020 - if type type is not PrivateAlbumType
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPrivateAlbum(type: PrivateAlbumType, callback: AsyncCallback<FetchResult<PrivateAlbum>>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Obtains system private albums based on the private album type. This method uses a promise to return.
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { PrivateAlbumType } type - Private album type
|
|
|
|
* @returns { Promise<FetchResult<PrivateAlbum>> } A Promise instance used to return a private album FetchResult.
|
|
|
|
* @throws { BusinessError } 13900020 - if type type is not PrivateAlbumType
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getPrivateAlbum(type: PrivateAlbumType): Promise<FetchResult<PrivateAlbum>>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Query audio assets
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { FetchOptions } options - Retrieval options.
|
|
|
|
* @param { AsyncCallback<FetchResult<FileAsset>> } callback - Callback return the FetchResult.
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getAudioAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<FileAsset>>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Query audio assets
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { FetchOptions } options - Retrieval options.
|
|
|
|
* @returns { Promise<FetchResult<FileAsset>> } A promise instance used to return the files in the format of a FetchResult instance
|
|
|
|
* @throws { BusinessError } 13900020 - if type options is not FetchOptions
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
getAudioAssets(options: FetchOptions): Promise<FetchResult<FileAsset>>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2023-05-31 08:17:52 +00:00
|
|
|
* Delete Asset
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO
|
|
|
|
* @param { string } uri - Uri of FileAsset
|
|
|
|
* @param { AsyncCallback<void> } callback - No value returned
|
|
|
|
* @throws { BusinessError } 13900020 - if type uri is not string
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
delete(uri: string, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Delete Asset
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } uri - Uri of FileAsset
|
|
|
|
* @returns { Promise<void> } A Promise instance, no value returned
|
|
|
|
* @throws { BusinessError } 13900020 - if type uri is not string
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
delete(uri: string): Promise<void>;
|
2023-07-19 03:42:22 +00:00
|
|
|
/**
|
|
|
|
* Get the index of the asset in the album
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @param { string } photoUri - The photo asset uri.
|
|
|
|
* @param { string } albumUri - The album uri.
|
|
|
|
* @param { FetchOptions } options - fetch options
|
|
|
|
* @param { AsyncCallback<number> } callback - Returns the index of the asset in the album
|
2024-05-29 08:01:12 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
|
|
|
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
2023-07-19 03:42:22 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback<number>): void;
|
|
|
|
/**
|
|
|
|
* Get the index of the asset in the album
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO
|
|
|
|
* @param { string } photoUri - The photo asset uri.
|
|
|
|
* @param { string } albumUri - The album uri.
|
|
|
|
* @param { FetchOptions } options - fetch options
|
|
|
|
* @returns { Promise<number> } - Returns the index of the asset in the album
|
2024-05-29 08:01:12 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
|
|
|
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
2023-07-19 03:42:22 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise<number>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-11-16 09:28:27 +00:00
|
|
|
* Turn on monitor the data changes
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { ChangeEvent } type - One of 'deviceChange','albumChange','imageChange','audioChange','videoChange','remoteFileChange'
|
|
|
|
* @param { Callback<void> } callback - No value returned
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
on(type: ChangeEvent, callback: Callback<void>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-11-16 09:28:27 +00:00
|
|
|
* Turn off monitor the data changes
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { ChangeEvent } type - One of 'deviceChange','albumChange','imageChange','audioChange','videoChange','remoteFileChange'
|
|
|
|
* @param { Callback<void> } callback - No value returned
|
2022-09-06 08:41:29 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
off(type: ChangeEvent, callback?: Callback<void>): void;
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* Turn on monitor for the specified uri.
|
|
|
|
*
|
|
|
|
* @param { string } uri - FileAsset's uri, album's uri or DefaultChangeUri
|
|
|
|
* @param { boolean } forSubUri - Monitor the sub uri.
|
|
|
|
* @param { Callback<ChangeData> } callback - callback function, return the ChangeData to be monitored
|
|
|
|
* @throws { BusinessError } 13900020 - if parameter is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
on(uri: string, forSubUri: boolean, callback: Callback<ChangeData>): void;
|
|
|
|
/**
|
|
|
|
* Turn off monitor for the specified uri.
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } uri - FileAsset's uri, Album's uri or DefaultChangeUri value
|
2023-04-13 02:52:41 +00:00
|
|
|
* @param { Callback<ChangeData> } [callback] - Remove specified callback from monitoring to a specified uri
|
|
|
|
* @throws { BusinessError } 13900020 - if parameter is invalid
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
off(uri: string, callback?: Callback<ChangeData>): void;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* Get Active Peer device information
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { AsyncCallback<Array<PeerInfo>> } callback - Callback return the list of the active peer devices' information
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
getActivePeers(callback: AsyncCallback<Array<PeerInfo>>): void;
|
|
|
|
/**
|
|
|
|
* Get Active Peer device information
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<Array<PeerInfo>> } Promise used to return the list of the active peer devices' information
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
getActivePeers(): Promise<Array<PeerInfo>>;
|
|
|
|
/**
|
|
|
|
* Get all the peer devices' information
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { AsyncCallback<Array<PeerInfo>> } callback - Callback return the list of the all the peer devices' information
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
getAllPeers(callback: AsyncCallback<Array<PeerInfo>>): void;
|
|
|
|
/**
|
|
|
|
* Get all the peer devices' information
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<Array<PeerInfo>> } Promise used to return the list of the all the peer devices' information
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
getAllPeers(): Promise<Array<PeerInfo>>;
|
|
|
|
/**
|
|
|
|
* Release UserFileManager instance
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @param { AsyncCallback<void> } callback - No value returned
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
release(callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Release UserFileManager instance
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<void> } Return promise
|
2022-08-10 09:49:36 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
release(): Promise<void>;
|
|
|
|
}
|
|
|
|
|
2023-04-13 02:52:41 +00:00
|
|
|
/**
|
|
|
|
* NotifyType subtype
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @enum { number } NotifyType subtype
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum NotifyType {
|
|
|
|
/**
|
|
|
|
* Type for add notification of the FileAsset or Album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
NOTIFY_ADD,
|
|
|
|
/**
|
|
|
|
* Type for update notification of the FileAsset or Album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
NOTIFY_UPDATE,
|
|
|
|
/**
|
|
|
|
* Type for remove notification of the FileAsset or Album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
NOTIFY_REMOVE,
|
|
|
|
/**
|
|
|
|
* Type for notification of the FileAsset added at an Album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
NOTIFY_ALBUM_ADD_ASSET,
|
|
|
|
/**
|
|
|
|
* Type for notification of the FileAsset removed at an Album
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
NOTIFY_ALBUM_REMOVE_ASSET
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DefaultChangeUri subtype
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @enum { string } DefaultChangeUri subtype
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum DefaultChangeUri {
|
|
|
|
/**
|
|
|
|
* Uri for default PhotoAsset, use with forDescendant{true}, will recieve all PhotoAsset's change notifications
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
DEFAULT_PHOTO_URI,
|
|
|
|
/**
|
|
|
|
* Uri for default Album, use with forDescendant{true}, will recieve all Album's change notifications
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
DEFAULT_ALBUM_URI,
|
|
|
|
/**
|
|
|
|
* Uri for default AudioAsset, use with forDescendant{true}, will recieve all AudioAsset's change notifications
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
DEFAULT_AUDIO_URI
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the value of the monitor callback function
|
|
|
|
*
|
2023-05-31 08:17:52 +00:00
|
|
|
* @interface ChangeData
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
interface ChangeData {
|
|
|
|
/**
|
|
|
|
* the NotifyType of ChangeData
|
2024-07-10 06:28:25 +00:00
|
|
|
*
|
|
|
|
* @type { NotifyType }
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
type: NotifyType;
|
|
|
|
/**
|
|
|
|
* all uris of the same NotifyType, could be FileAssets' or Albums'
|
|
|
|
*
|
2024-07-10 07:01:46 +00:00
|
|
|
* @type { Array<string> }
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
uris: Array<string>;
|
|
|
|
/**
|
|
|
|
* change details of the Album's FileAssets when uris is the Album's uri type
|
|
|
|
*
|
2024-07-10 07:01:46 +00:00
|
|
|
* @type { Array<string> }
|
2023-04-13 02:52:41 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
subUris: Array<string>;
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Peer devices' information
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface PeerInfo
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
interface PeerInfo {
|
|
|
|
/**
|
|
|
|
* Peer device name
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly deviceName: string;
|
|
|
|
/**
|
|
|
|
* Peer device network id
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { string }
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly networkId: string;
|
|
|
|
/**
|
|
|
|
* Peer device online status
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2024-07-10 06:28:25 +00:00
|
|
|
* @type { boolean }
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
readonly isOnline: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Private album type
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @enum { string } PrivateAlbumType
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
enum PrivateAlbumType {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* System Private Album: Favorite album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
|
|
|
TYPE_FAVORITE,
|
|
|
|
/**
|
|
|
|
* System Private Album: Trash album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2023-01-30 09:36:01 +00:00
|
|
|
TYPE_TRASH
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
2022-09-06 08:41:29 +00:00
|
|
|
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Defines the private album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
|
|
|
* @interface PrivateAlbum
|
2023-01-30 09:36:01 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
2023-05-31 08:17:52 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
interface PrivateAlbum extends AbsAlbum {
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Delete asset permanently from Trash bin, only support the Trash album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } uri - uri of asset
|
|
|
|
* @param { AsyncCallback<void> } callback - No value returned
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
delete(uri: string, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Delete asset permanently from Trash bin, only support the Trash album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } uri - Uri of asset
|
|
|
|
* @returns { Promise<void> } A Promise instance, no value returned
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
delete(uri: string): Promise<void>;
|
2022-08-10 09:49:36 +00:00
|
|
|
/**
|
2022-09-06 08:41:29 +00:00
|
|
|
* Recover asset from Trash bin, only support the Trash album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } uri - Uri of asset
|
|
|
|
* @param { AsyncCallback<void> } callback - No value returned
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-09-06 08:41:29 +00:00
|
|
|
*/
|
|
|
|
recover(uri: string, callback: AsyncCallback<void>): void;
|
|
|
|
/**
|
|
|
|
* Recover asset from Trash bin, only support the Trash album
|
2023-05-31 08:17:52 +00:00
|
|
|
*
|
2022-09-06 08:41:29 +00:00
|
|
|
* @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO
|
2023-05-31 08:17:52 +00:00
|
|
|
* @param { string } uri - Uri of asset
|
|
|
|
* @returns { Promise<void> } A Promise instance, no value returned
|
|
|
|
* @syscap SystemCapability.FileManagement.UserFileManager.Core
|
|
|
|
* @systemapi
|
|
|
|
* @since 9
|
2022-08-10 09:49:36 +00:00
|
|
|
*/
|
2022-09-06 08:41:29 +00:00
|
|
|
recover(uri: string): Promise<void>;
|
2022-08-10 09:49:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-16 09:28:27 +00:00
|
|
|
export default userFileManager;
|