| 253 | */ |
| 254 | getFile(bucketId: string, fileId: string): Promise<Models.File>; |
| 255 | getFile( |
| 256 | paramsOrFirst: { bucketId: string, fileId: string } | string, |
| 257 | ...rest: [(string)?] |
| 258 | ): Promise<Models.File> { |
| 259 | let params: { bucketId: string, fileId: string }; |
| 260 | |
| 261 | if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { |
| 262 | params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; |
| 263 | } else { |
| 264 | params = { |
| 265 | bucketId: paramsOrFirst as string, |
| 266 | fileId: rest[0] as string |
| 267 | }; |
| 268 | } |
| 269 | |
| 270 | const bucketId = params.bucketId; |
| 271 | const fileId = params.fileId; |
| 272 | |
| 273 | if (typeof bucketId === 'undefined') { |
| 274 | throw new AppwriteException('Missing required parameter: "bucketId"'); |
| 275 | } |
| 276 | |
| 277 | if (typeof fileId === 'undefined') { |
| 278 | throw new AppwriteException('Missing required parameter: "fileId"'); |
| 279 | } |
| 280 | |
| 281 | const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); |
| 282 | const payload: Payload = {}; |
| 283 | |
| 284 | const uri = new URL(this.client.config.endpoint + apiPath); |
| 285 | return this.client.call('get', uri, { |
| 286 | }, payload); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Update a file by its unique ID. Only users with write permissions have access to update this resource. |