|
9 | 9 |
|
10 | 10 | public interface IStorageFileAPI { |
11 | 11 |
|
| 12 | + /** |
| 13 | + * <p>POST /object/{bucketName}/{wildcard}</p> |
| 14 | + * |
| 15 | + * @param path The path to the file within the bucket of where it should be uploaded. |
| 16 | + * @param file The file that needs to be uploaded. |
| 17 | + * @return a {@link FilePathResponse} |
| 18 | + */ |
12 | 19 | CompletableFuture<FilePathResponse> upload(String path, File file); |
| 20 | + |
| 21 | + /** |
| 22 | + * <p>PUT /object/{bucketName}/{wildcard}</p> |
| 23 | + * |
| 24 | + * @param path The path to the file within the bucket that should get updated. |
| 25 | + * @param file The new file that should be placed. |
| 26 | + * @return a {@link FilePathResponse} |
| 27 | + */ |
13 | 28 | CompletableFuture<FilePathResponse> update(String path, File file); |
| 29 | + |
| 30 | + /** |
| 31 | + * <p>POST /object/move/</p> |
| 32 | + * |
| 33 | + * @param fromPath The path to the object that needs to be moved. |
| 34 | + * @param toPath The new path where the object should be moved to. |
| 35 | + * @return a {@link MessageResponse} |
| 36 | + */ |
14 | 37 | CompletableFuture<MessageResponse> move(String fromPath, String toPath); |
| 38 | + |
| 39 | + /** |
| 40 | + * <p>POST /object/copy/</p> |
| 41 | + * |
| 42 | + * @param fromPath The path to the object that needs to be copied. |
| 43 | + * @param toPath The new path where the object should be copied to. |
| 44 | + * @return a {@link FilePathResponse} |
| 45 | + */ |
15 | 46 | CompletableFuture<FilePathResponse> copy(String fromPath, String toPath); |
16 | | - CompletableFuture<FileSignedUrlResponse> getSignedUrl(String path, int expiresIn, FileDownloadOption options); |
17 | | - CompletableFuture<List<FileSignedUrlResponse>> getSignedUrls(List<String> paths, int expiresIn, FileDownloadOption options); |
18 | | - CompletableFuture<FileDownload> download(String path); |
19 | | - FilePublicUrlResponse getPublicUrl(String path, FileDownloadOption options); |
20 | 47 |
|
| 48 | + /** |
| 49 | + * <p>POST /object/sign/{bucketName}</p> |
| 50 | + * <p>This method just wraps {@link #getSignedUrls(List, int, FileDownloadOption, FileTransformOptions)}</p> |
| 51 | + * |
| 52 | + * @param path The singular file path that should be signed. |
| 53 | + * @param expiresIn how many seconds until the signed url expires. |
| 54 | + * @param downloadOptions any additional download options. |
| 55 | + * @param transformOptions The transform options if any |
| 56 | + * @return a {@link FileSignedUrlResponse} |
| 57 | + */ |
| 58 | + CompletableFuture<FileSignedUrlResponse> getSignedUrl(String path, int expiresIn, FileDownloadOption downloadOptions, FileTransformOptions transformOptions); |
| 59 | + |
| 60 | + /** |
| 61 | + * <p>POST /object/sign/{bucketName}</p> |
| 62 | + * |
| 63 | + * @param paths a list of file paths that should be signed. |
| 64 | + * @param expiresIn how many seconds until the signed urls expires. |
| 65 | + * @param downloadOptions any additional download options. |
| 66 | + * @param transformOptions The transform options if any |
| 67 | + * @return a list of {@link FileSignedUrlResponse} |
| 68 | + */ |
| 69 | + CompletableFuture<List<FileSignedUrlResponse>> getSignedUrls(List<String> paths, int expiresIn, FileDownloadOption downloadOptions, FileTransformOptions transformOptions); |
| 70 | + |
| 71 | + /** |
| 72 | + * <p>Downloads a file from a private bucket. To download something from a public bucket, make a request to the url from {@link #getPublicUrl(String, FileDownloadOption, FileTransformOptions)}</p> |
| 73 | + * <p>GET /object/authenticated/{bucketName}/{wildcard}</p> |
| 74 | + * |
| 75 | + * @param path The path of the file to download |
| 76 | + * @param transformOptions The transform options if any |
| 77 | + * @return a {@link FileDownload} |
| 78 | + */ |
| 79 | + CompletableFuture<FileDownload> download(String path, FileTransformOptions transformOptions); |
| 80 | + |
| 81 | + /** |
| 82 | + * Creates the url for an object in a public bucket |
| 83 | + * |
| 84 | + * @param path The path of the file the link should point to. |
| 85 | + * @param downloadOptions The download options if any. |
| 86 | + * @param transformOptions The transform options if any |
| 87 | + * @return a {@link FilePublicUrlResponse} |
| 88 | + */ |
| 89 | + FilePublicUrlResponse getPublicUrl(String path, FileDownloadOption downloadOptions, FileTransformOptions transformOptions); |
| 90 | + |
| 91 | + /** |
| 92 | + * <p>POST /object/list/{bucketName}</p> |
| 93 | + * |
| 94 | + * @param options Options for the file search |
| 95 | + * @return a list of {@link io.supabase.data.file.File} |
| 96 | + */ |
21 | 97 | CompletableFuture<List<io.supabase.data.file.File>> list(FileSearchOptions options); |
| 98 | + |
| 99 | + /** |
| 100 | + * <p>POST /object/list/{bucketName}</p> |
| 101 | + * |
| 102 | + * @param path The prefix to list objects by |
| 103 | + * @param options Options for the file search |
| 104 | + * @return a list of {@link io.supabase.data.file.File} |
| 105 | + */ |
22 | 106 | CompletableFuture<List<io.supabase.data.file.File>> list(String path, FileSearchOptions options); |
| 107 | + |
| 108 | + /** |
| 109 | + * <p>DELETE /object/{bucketName}</p> |
| 110 | + * |
| 111 | + * @param paths a list of paths to files that should be deleted. BE WARY! PROVIDING NULL OR AN EMPTY LIST WILL DELETE THE ENTIRE BUCKET! |
| 112 | + * @return a list of the deleted files |
| 113 | + */ |
23 | 114 | CompletableFuture<List<io.supabase.data.file.File>> delete(List<String> paths); |
24 | 115 | } |
0 commit comments