diff --git a/zh-cn/application-dev/reference/apis/js-apis-userFileManager.md b/zh-cn/application-dev/reference/apis/js-apis-userFileManager.md index b37505664f301282571431399563d1d432604f2b..4086cc53fe5714e89eec6c47f8542f361fe9241e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-userFileManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-userFileManager.md @@ -62,6 +62,14 @@ getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult< | options | [FetchOptions](#fetchoptions) | 是 | 图片和视频检索选项。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | 是 | callback返回图片和视频检索结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -111,6 +119,14 @@ getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g | --------------------------- | -------------- | | Promise<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | Promise对象,返回图片和视频数据结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -155,6 +171,15 @@ createPhotoAsset(displayName: string, albumUri: string, callback: AsyncCallback& | albumUri | string | 是 | 创建的图片或者视频所在相册的uri。 | | callback | AsyncCallback<[FileAsset](#fileasset)> | 是 | callback返回创建的图片和视频结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName or albumUri is not string. | +| 14000001 | if type displayName invalid. | + **示例:** ```ts @@ -197,6 +222,15 @@ createPhotoAsset(displayName: string, callback: AsyncCallback<FileAsset>): | displayName | string | 是 | 创建的图片或者视频文件名。 | | callback | AsyncCallback<[FileAsset](#fileasset)> | 是 | callback返回创建的图片和视频结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName is not string. | +| 14000001 | if type displayName invalid. | + **示例:** ```ts @@ -237,6 +271,14 @@ createPhotoAsset(displayName: string, albumUri?: string): Promise<FileAsset&g | --------------------------- | -------------- | | Promise<[FileAsset](#fileasset)> | Promise对象,返回创建的图片和视频结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName or albumUri is not string. | + **示例:** ```ts @@ -271,6 +313,15 @@ createPhotoAsset(displayName: string, createOption: PhotoCreateOptions, callback | createOption | [PhotoCreateOptions](#photocreateoptions10) | 是 | 图片或视频的创建选项。 | | callback | AsyncCallback<[FileAsset](#fileasset)> | 是 | callback返回创建的图片和视频结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName is not string. | +| 14000001 | if type displayName invalid. | + **示例:** ```ts @@ -314,6 +365,14 @@ createPhotoAsset(displayName: string, createOption: PhotoCreateOptions): Promise | --------------------------- | -------------- | | Promise<[FileAsset](#fileasset)> | Promise对象,返回创建的图片和视频结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName is not string. | + **示例:** ```ts @@ -341,7 +400,7 @@ createAudioAsset(displayName: string, callback: AsyncCallback<FileAsset>): **系统能力**:SystemCapability.FileManagement.UserFileManager.Core -**需要权限**:ohos.permission.WRITE_IMAGEVIDEO +**需要权限**:ohos.permission.WRITE_AUDIO **参数:** @@ -350,6 +409,15 @@ createAudioAsset(displayName: string, callback: AsyncCallback<FileAsset>): | displayName | string | 是 | 创建的音频文件名。 | | callback | AsyncCallback<[FileAsset](#fileasset)> | 是 | callback返回创建的音频资源结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName is not string. | +| 14000001 | if type displayName invalid. | + **示例:** ```ts @@ -375,7 +443,7 @@ createAudioAsset(displayName: string): Promise<FileAsset>; **系统能力**:SystemCapability.FileManagement.UserFileManager.Core -**需要权限**:ohos.permission.WRITE_IMAGEVIDEO +**需要权限**:ohos.permission.WRITE_AUDIO **参数:** @@ -389,6 +457,14 @@ createAudioAsset(displayName: string): Promise<FileAsset>; | --------------------------- | -------------- | | Promise<[FileAsset](#fileasset)> | Promise对象,返回创建的音频资源结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type displayName is not string. | + **示例:** ```ts @@ -423,6 +499,14 @@ getPhotoAlbums(options: AlbumFetchOptions, callback: AsyncCallback<FetchResul | options | [AlbumFetchOptions](#albumfetchoptions) | 是 | 相册检索选项。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[Album](#album)>> | 是 | callback返回相册检索结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not AlbumFetchOptions. | + **示例:** ```ts @@ -474,6 +558,14 @@ getPhotoAlbums(options: AlbumFetchOptions): Promise<FetchResult<Album>& | --------------------------- | -------------- | | Promise<[FetchResult](#fetchresult)<[Album](#album)>> | Promise对象,返回相册检索结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not AlbumFetchOptions. | + **示例:** ```ts @@ -599,11 +691,13 @@ deleteAlbums(albums: Array<Album>, callback: AsyncCallback<void>): v **示例:** ```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + async function example() { - // 示例代码为删除名称包含newAlbumName的第一个相册。 + // 示例代码为删除相册名为newAlbumName的相册。 console.info('deleteAlbumsDemo'); let predicates = new dataSharePredicates.DataSharePredicates(); - predicates.like('album_name', '%newAlbumName%'); + predicates.equalTo('album_name', 'newAlbumName'); let fetchOptions = { fetchColumns: [], predicates: predicates @@ -648,11 +742,13 @@ deleteAlbums(albums: Array<Album>): Promise<void>; **示例:** ```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + async function example() { - // 示例代码为删除名称包含newAlbumName的第一个相册。 + // 示例代码为删除相册名为newAlbumName的相册。 console.info('deleteAlbumsDemo'); let predicates = new dataSharePredicates.DataSharePredicates(); - predicates.like('album_name', '%newAlbumName%'); + predicates.equalTo('album_name', 'newAlbumName'); let fetchOptions = { fetchColumns: [], predicates: predicates @@ -689,14 +785,24 @@ getAlbums(type: AlbumType, subType: AlbumSubType, options: FetchOptions, callbac | options | [FetchOptions](#fetchoptions) | 是 | 检索选项。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[Album](#album)>> | 是 | callback返回获取相册的结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOption. | + **示例:** ```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + async function example() { - // 示例代码中为获取相册名中包含newAlbumName的第一个相册。 + // 示例代码中为获取相册名为newAlbumName的相册。 console.info('getAlbumsDemo'); let predicates = new dataSharePredicates.DataSharePredicates(); - predicates.like('album_name', '%newAlbumName%'); + predicates.equalTo('album_name', 'newAlbumName'); let fetchOptions = { fetchColumns: [], predicates: predicates @@ -737,6 +843,14 @@ getAlbums(type: AlbumType, subType: AlbumSubType, callback: AsyncCallback<Fet | subType | [AlbumSubType](#albumsubtype10) | 是 | 相册子类型。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[Album](#album)>> | 是 | callback返回获取相册的结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOption. | + **示例:** ```ts @@ -785,14 +899,24 @@ getAlbums(type: AlbumType, subType: AlbumSubType, options?: FetchOptions): Promi | --------------------------- | -------------- | | Promise<[FetchResult](#fetchresult)<[Album](#album)>> | Promise对象,返回获取相册的结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOption. | + **示例:** ```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + async function example() { - // 示例代码中为获取相册名中包含newAlbumName的第一个相册。 + // 示例代码中为获取相册名为newAlbumName的相册。 console.info('getAlbumsDemo'); let predicates = new dataSharePredicates.DataSharePredicates(); - predicates.like('album_name', '%newAlbumName%'); + predicates.equalTo('album_name', 'newAlbumName'); let fetchOptions = { fetchColumns: [], predicates: predicates @@ -828,6 +952,14 @@ getPrivateAlbum(type: PrivateAlbumType, callback: AsyncCallback<FetchResult&l | type | [PrivateAlbumType](#privatealbumtype) | 是 | 系统相册类型。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[PrivateAlbum](#privatealbum)>> | 是 | callback返回相册检索结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type type is not PrivateAlbumType. | + **示例:** ```ts @@ -866,6 +998,14 @@ getPrivateAlbum(type: PrivateAlbumType): Promise<FetchResult<PrivateAlbum& | --------------------------- | -------------- | | Promise<[FetchResult](#fetchresult)<[PrivateAlbum](#privatealbum)>> | Promise对象,返回相册检索结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type type is not PrivateAlbumType. | + **示例:** ```ts @@ -898,6 +1038,14 @@ getAudioAssets(options: FetchOptions, callback: AsyncCallback<FetchResult< | options | [FetchOptions](#fetchoptions) | 是 | 检索选项。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | 是 | callback返回音频检索结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -948,6 +1096,14 @@ getAudioAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g | --------------------------- | -------------- | | Promise<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | Promise对象,返回音频检索结果。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -993,6 +1149,14 @@ delete(uri: string, callback: AsyncCallback<void>): void; | uri | string | 是 | 媒体文件uri。 | | callback | AsyncCallback<void> | 是 | callback返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type uri is not string. | + **示例:** ```ts @@ -1048,6 +1212,14 @@ delete(uri: string): Promise<void>; | --------------------------------------- | ----------------- | | Promise<void>| Promise对象,返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type uri is not string. | + **示例:** ```ts @@ -1385,9 +1557,19 @@ on(uri: string, forSubUri: boolean, callback: Callback<ChangeData>) : void | forSubUri | boolean | 是 | 是否模糊监听,uri为相册uri时,forSubUri 为true能监听到相册中文件的变化,如果是false只能监听相册本身变化。uri为fileAsset时,forSubUri 为true、false没有区别,uri为DefaultChangeUri时,forSubUri必须为true,如果为false将找不到该uri,收不到任何消息。 | | callback | Callback<[ChangeData](#changedata10)> | 是 | 返回要监听的[ChangeData](#changedata10)。注:uri可以注册多个不同的callback监听,[off10+](#off10)可以关闭该uri所有监听,也可以关闭指定callback的监听。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if parameter is invalid. | + **示例:** ```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + async function example() { console.info('onDemo'); let predicates = new dataSharePredicates.DataSharePredicates(); @@ -1438,9 +1620,19 @@ async function example() { | uri | string | 是 | FileAsset的uri, Album的uri或[DefaultChangeUri](#defaultchangeuri10)的值。 | | callback | Callback<[ChangeData](#changedata10)> | 否 | 解除[on10+](#on10)注册时的callback的监听,不填时,解除该uri的所有监听。注:off指定注册的callback后不会进入此回调。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if parameter is invalid. | + **示例:** ```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + async function example() { console.info('offDemo'); let predicates = new dataSharePredicates.DataSharePredicates(); @@ -1557,7 +1749,7 @@ async function example() { }; let fetchResult = await mgr.getPhotoAssets(fetchOption); let fileAsset = await fetchResult.getFirstObject(); - let displayName = userFileManager.ImageVideoKey.DISPLAY_NAME; + let displayName = userFileManager.ImageVideoKey.DISPLAY_NAME.toString(); fileAsset.set(displayName, 'newDisplayName1'); } catch (err) { console.error('release failed. message = ', err); @@ -1595,7 +1787,7 @@ async function example() { }; let fetchResult = await mgr.getPhotoAssets(fetchOption); let fileAsset = await fetchResult.getFirstObject(); - let displayName = userFileManager.ImageVideoKey.DISPLAY_NAME; + let displayName = userFileManager.ImageVideoKey.DISPLAY_NAME.toString(); let fileAssetDisplayName = fileAsset.get(displayName); console.info('fileAsset get fileAssetDisplayName = ', fileAssetDisplayName); fileAsset.set(displayName, 'newDisplayName2'); @@ -1640,7 +1832,7 @@ async function example() { }; let fetchResult = await mgr.getPhotoAssets(fetchOption); let fileAsset = await fetchResult.getFirstObject(); - let displayName = userFileManager.ImageVideoKey.DISPLAY_NAME; + let displayName = userFileManager.ImageVideoKey.DISPLAY_NAME.toString(); let fileAssetDisplayName = fileAsset.get(displayName); console.info('fileAsset get fileAssetDisplayName = ', fileAssetDisplayName); fileAsset.set(displayName, 'newDisplayName3'); @@ -2060,6 +2252,15 @@ setHidden(hiddenState: boolean, callback: AsyncCallback<void>): void | hiddenState | boolean | 是 | 是否设置为隐藏文件,true:将文件资产放入隐藏相册;false:从隐藏相册中恢复。 | | callback | AsyncCallback<void> | 是 | callback返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)和[通用错误码](../errorcodes/errorcode-universal.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 202 | Called by non-system application. | +| 13900020 | if parameter is invalid. | + **示例:** ```ts @@ -2108,6 +2309,15 @@ setHidden(hiddenState: boolean): Promise<void> | ------------------- | ---------- | | Promise<void> | Promise对象,返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)和[通用错误码](../errorcodes/errorcode-universal.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 202 | Called by non-system application. | +| 13900020 | if parameter is invalid. | + **示例:** ```ts @@ -2198,7 +2408,7 @@ async function example() { const fetchCount = fetchResult.getCount(); console.info('count:' + fetchCount); let fileAsset = await fetchResult.getLastObject(); - if (!fetchResult.isAfterLast()) { + if (fetchResult.isAfterLast()) { console.info('fileAsset isAfterLast displayName = ', fileAsset.displayName); } else { console.info('fileAsset not isAfterLast '); @@ -2464,6 +2674,14 @@ getPositionObject(index: number, callback: AsyncCallback<T>): void | index | number | 是 | 要获取的文件的索引,从0开始。 | | callback | AsyncCallback<T> | 是 | 异步返回指定索引的文件资产的回调。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type index is not number. | + **示例:** ```ts @@ -2507,6 +2725,14 @@ getPositionObject(index: number): Promise<T> | --------------------------------------- | ----------------- | | Promise<T> | Promise对象,返回结果集中指定索引的一个对象。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type index is not number. | + **示例:** ```ts @@ -2604,8 +2830,8 @@ async function example() { | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------ | ------ | ---- | ---- | ------- | -| albumType8+ | [AlbumType]( #albumtype10) | 是 | 否 | 相册类型。 | -| albumSubType8+ | [AlbumSubType]( #albumsubtype10) | 是 | 否 | 相册子类型。 | +| albumType10+ | [AlbumType]( #albumtype10) | 是 | 否 | 相册类型。 | +| albumSubType10+ | [AlbumSubType]( #albumsubtype10) | 是 | 否 | 相册子类型。 | | albumName | string | 是 | 用户相册可写,预置相册不可写 | 相册名称。 | | albumUri | string | 是 | 否 | 相册Uri。 | | count | number | 是 | 否 | 相册中文件数量。 | @@ -2628,6 +2854,14 @@ getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult< | options | [FetchOptions](#fetchoptions) | 是 | 检索选项。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | 是 | callback返回图片和视频数据结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -2678,6 +2912,14 @@ getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g | --------------------------------------- | ----------------- | | Promise<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | Promise对象,返回图片和视频数据结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -2803,6 +3045,14 @@ addPhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<void&g | assets | Array<[FileAsset](#fileasset)> | 是 | 待添加到相册中的图片或视频数组。 | | callback | AsyncCallback<void> | 是 | callback返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -2855,6 +3105,14 @@ addPhotoAssets(assets: Array<FileAsset>): Promise<void>; | --------------------------------------- | ----------------- | |Promise<void> | Promise对象,返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -2900,6 +3158,14 @@ removePhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<voi | assets | Array<[FileAsset](#fileasset)> | 是 | 相册中待移除的图片或视频数组。 | | callback | AsyncCallback<void> | 是 | callback返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -2952,6 +3218,14 @@ removePhotoAssets(assets: Array<FileAsset>): Promise<void>; | --------------------------------------- | ----------------- | |Promise<void> | Promise对象,返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -2997,6 +3271,14 @@ recoverPhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<vo | assets | Array<[FileAsset](#fileasset)> | 是 | 回收站中待恢复图片或者视频数组。 | | callback | AsyncCallback<void> | 是 | callback返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -3049,6 +3331,14 @@ recoverPhotoAssets(assets: Array<FileAsset>): Promise<void>; | --------------------------------------- | ----------------- | |Promise<void> | Promise对象,返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -3096,6 +3386,14 @@ deletePhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<voi | assets | Array<[FileAsset](#fileasset)> | 是 | 回收站中待彻底删除图片或者视频数组。 | | callback | AsyncCallback<void> | 是 | callback返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -3150,6 +3448,14 @@ deletePhotoAssets(assets: Array<FileAsset>): Promise<void>; | --------------------------------------- | ----------------- | |Promise<void> | Promise对象,返回void。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if PhotoAssets is invalid. | + **示例:** ```ts @@ -3211,6 +3517,14 @@ getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult< | options | [FetchOptions](#fetchoptions) | 是 | 检索选项。 | | callback | AsyncCallback<[FetchResult](#fetchresult)<[FileAsset](#fileasset)>> | 是 | callback返回图片和视频数据结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts @@ -3259,6 +3573,14 @@ getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g | --------------------------------------- | ----------------- | | Promise:[FetchResult](#fetchresult)<[FileAsset](#fileasset)>| Promise对象,返回图片和视频数据结果集。 | +**错误码:** + +接口抛出错误码的详细介绍请参见[文件管理错误码](../errorcodes/errorcode-filemanagement.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 13900020 | if type options is not FetchOptions. | + **示例:** ```ts