diff --git a/api/@ohos.file.photoAccessHelper.d.ts b/api/@ohos.file.photoAccessHelper.d.ts index 5d405d9c866c6bce76785335bb1c087a7614401b..cc96b04230f59d3297d327d02630a28d81ec7f58 100644 --- a/api/@ohos.file.photoAccessHelper.d.ts +++ b/api/@ohos.file.photoAccessHelper.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Huawei Device Co., Ltd. + * Copyright (C) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -3210,6 +3210,16 @@ declare namespace photoAccessHelper { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Options for creating an image or video asset. + * + * @interface CreateOptions + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @crossplatform + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ interface CreateOptions { /** * Title of the asset @@ -3227,6 +3237,16 @@ declare namespace photoAccessHelper { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Title of the asset + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @crossplatform + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ title?: string; /** * Specify subtype of the asset to create @@ -5065,6 +5085,26 @@ declare namespace photoAccessHelper { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Creates an image or video asset with the specified file type, file name extension, and options. + * This API uses an asynchronous callback to return the result. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Type of the file to create, which can be IMAGE or VIDEO. + * @param { string } extension - File name extension, for example, 'jpg'. + * @param { CreateOptions } options - Options for creating the image or video asset, for example, {title: 'testPhoto'}. + * @param { AsyncCallback } callback - Callback used to return the URI of the created image or video asset. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @crossplatform + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ createAsset(photoType: PhotoType, extension: string, options: CreateOptions, callback: AsyncCallback): void; /** * Creates an image or video asset with the specified file type and file name extension. @@ -5100,6 +5140,25 @@ declare namespace photoAccessHelper { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Creates an image or video asset with the specified file type and file name extension. + * This API uses an asynchronous callback to return the result. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Type of the file to create, which can be IMAGE or VIDEO. + * @param { string } extension - File name extension, for example, 'jpg'. + * @param { AsyncCallback } callback - Callback used to return the URI of the created image or video asset. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @crossplatform + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ createAsset(photoType: PhotoType, extension: string, callback: AsyncCallback): void; /** * Creates an image or video asset with the specified file type, file name extension, and options. @@ -5137,6 +5196,26 @@ declare namespace photoAccessHelper { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Creates an image or video asset with the specified file type, file name extension, and options. + * This API uses a promise to return the result. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Type of the file to create, which can be IMAGE or VIDEO. + * @param { string } extension - File name extension, for example, 'jpg'. + * @param { CreateOptions } [options] - Options for creating the image or video asset, for example, {title: 'testPhoto'}. + * @returns { Promise } Returns the uri of the newly created asset + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @crossplatform + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ createAsset(photoType: PhotoType, extension: string, options?: CreateOptions): Promise; /** * Creates an album. This API uses an asynchronous callback to return the result.