| 376 | */ |
| 377 | deleteFile(bucketId: string, fileId: string): Promise<{}>; |
| 378 | deleteFile( |
| 379 | paramsOrFirst: { bucketId: string, fileId: string } | string, |
| 380 | ...rest: [(string)?] |
| 381 | ): Promise<{}> { |
| 382 | let params: { bucketId: string, fileId: string }; |
| 383 | |
| 384 | if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { |
| 385 | params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; |
| 386 | } else { |
| 387 | params = { |
| 388 | bucketId: paramsOrFirst as string, |
| 389 | fileId: rest[0] as string |
| 390 | }; |
| 391 | } |
| 392 | |
| 393 | const bucketId = params.bucketId; |
| 394 | const fileId = params.fileId; |
| 395 | |
| 396 | if (typeof bucketId === 'undefined') { |
| 397 | throw new AppwriteException('Missing required parameter: "bucketId"'); |
| 398 | } |
| 399 | |
| 400 | if (typeof fileId === 'undefined') { |
| 401 | throw new AppwriteException('Missing required parameter: "fileId"'); |
| 402 | } |
| 403 | |
| 404 | const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); |
| 405 | const payload: Payload = {}; |
| 406 | |
| 407 | const uri = new URL(this.client.config.endpoint + apiPath); |
| 408 | return this.client.call('delete', uri, { |
| 409 | 'content-type': 'application/json', |
| 410 | }, payload); |
| 411 | } |
| 412 | |
| 413 | /** |
| 414 | * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. |