1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit CoreFileKit 19 */ 20 21/** 22 * Provides the recycling ability to the file manager. 23 * 24 * @namespace recent 25 * @syscap SystemCapability.FileManagement.UserFileService 26 * @systemapi 27 * @StageModelOnly 28 * @since 10 29 */ 30declare namespace recent { 31 /** 32 * FileInfo Object 33 * 34 * @interface FileInfo 35 * @syscap SystemCapability.FileManagement.UserFileService 36 * @systemapi 37 * @StageModelOnly 38 * @since 10 39 */ 40 interface FileInfo { 41 /** 42 * Indicates the uri of the file. 43 * 44 * @type { string } 45 * @readonly 46 * @syscap SystemCapability.FileManagement.UserFileService 47 * @systemapi 48 * @StageModelOnly 49 * @since 10 50 */ 51 readonly uri: string; 52 53 /** 54 * Indicates the source path of the file. 55 * 56 * @type { string } 57 * @readonly 58 * @syscap SystemCapability.FileManagement.UserFileService 59 * @systemapi 60 * @StageModelOnly 61 * @since 10 62 */ 63 readonly srcPath: string; 64 65 /** 66 * Indicates the name of the file. 67 * 68 * @type { string } 69 * @readonly 70 * @syscap SystemCapability.FileManagement.UserFileService 71 * @systemapi 72 * @StageModelOnly 73 * @since 10 74 */ 75 readonly fileName: string; 76 77 /** 78 * Indicates the mode of the file. 79 * 80 * @type { number } 81 * @readonly 82 * @syscap SystemCapability.FileManagement.UserFileService 83 * @systemapi 84 * @StageModelOnly 85 * @since 10 86 */ 87 readonly mode: number; 88 89 /** 90 * Indicates the size of the file. 91 * 92 * @type { number } 93 * @readonly 94 * @syscap SystemCapability.FileManagement.UserFileService 95 * @systemapi 96 * @StageModelOnly 97 * @since 10 98 */ 99 readonly size: number; 100 101 /** 102 * Indicates the mtime of the file. 103 * 104 * @type { number } 105 * @readonly 106 * @syscap SystemCapability.FileManagement.UserFileService 107 * @systemapi 108 * @StageModelOnly 109 * @since 10 110 */ 111 readonly mtime: number; 112 113 /** 114 * Indicates the ctime of the file. 115 * 116 * @type { number } 117 * @readonly 118 * @syscap SystemCapability.FileManagement.UserFileService 119 * @systemapi 120 * @StageModelOnly 121 * @since 10 122 */ 123 readonly ctime: number; 124 } 125 126 /** 127 * List files in the Recent. 128 * 129 * @permission ohos.permission.FILE_ACCESS_MANAGER 130 * @returns { Array<FileInfo> } Returns the next level FileInfo Object. 131 * @throws { BusinessError } 13900002 - No such file or directory 132 * @throws { BusinessError } 13900020 - Invalid argument 133 * @throws { BusinessError } 13900042 - Unknown error 134 * @syscap SystemCapability.FileManagement.UserFileService 135 * @systemapi 136 * @StageModelOnly 137 * @since 10 138 */ 139 function listFile(): Array<FileInfo>; 140 141 /** 142 * Add a file to the Recent. 143 * 144 * @permission ohos.permission.FILE_ACCESS_MANAGER 145 * @param { string } uri - The identity of a file. 146 * @throws { BusinessError } 13900002 - No such file or directory 147 * @throws { BusinessError } 13900020 - Invalid argument 148 * @throws { BusinessError } 13900042 - Unknown error 149 * @syscap SystemCapability.FileManagement.UserFileService 150 * @systemapi 151 * @StageModelOnly 152 * @since 10 153 */ 154 function add(uri: string): void; 155 156 /** 157 * Remove a file from the Recent. 158 * 159 * @permission ohos.permission.FILE_ACCESS_MANAGER 160 * @param { string } uri - The identity of a file. 161 * @throws { BusinessError } 13900002 - No such file or directory 162 * @throws { BusinessError } 13900020 - Invalid argument 163 * @throws { BusinessError } 13900042 - Unknown error 164 * @syscap SystemCapability.FileManagement.UserFileService 165 * @systemapi 166 * @StageModelOnly 167 * @since 10 168 */ 169 function remove(uri: string): void; 170} 171 172export default recent; 173