Package io.supabase.api
Class StorageFileAPI
java.lang.Object
io.supabase.api.StorageFileAPI
- All Implemented Interfaces:
IStorageFileAPI
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionPOST /object/copy/DELETE /object/{bucketName}download
(String path, FileTransformOptions transformOptions) Downloads a file from a private bucket.getPublicUrl
(String path, FileDownloadOption downloadOptions, FileTransformOptions transformOptions) Creates the url for an object in a public bucketgetSignedUrl
(String path, int expiresIn, FileDownloadOption downloadOptions, FileTransformOptions transformOptions) POST /object/sign/{bucketName}getSignedUrls
(List<String> paths, int expiresIn, FileDownloadOption downloadOptions, FileTransformOptions transformOptions) POST /object/sign/{bucketName}list
(FileSearchOptions options) POST /object/list/{bucketName}list
(String path, FileSearchOptions options) POST /object/list/{bucketName}POST /object/move/PUT /object/{bucketName}/{wildcard}POST /object/{bucketName}/{wildcard}
-
Constructor Details
-
StorageFileAPI
-
-
Method Details
-
upload
POST /object/{bucketName}/{wildcard}
- Specified by:
upload
in interfaceIStorageFileAPI
- Parameters:
path
- The path to the file within the bucket of where it should be uploaded.file
- The file that needs to be uploaded.- Returns:
- a
FilePathResponse
-
update
PUT /object/{bucketName}/{wildcard}
- Specified by:
update
in interfaceIStorageFileAPI
- Parameters:
path
- The path to the file within the bucket that should get updated.file
- The new file that should be placed.- Returns:
- a
FilePathResponse
-
move
POST /object/move/
- Specified by:
move
in interfaceIStorageFileAPI
- Parameters:
fromPath
- The path to the object that needs to be moved.toPath
- The new path where the object should be moved to.- Returns:
- a
MessageResponse
-
copy
POST /object/copy/
- Specified by:
copy
in interfaceIStorageFileAPI
- Parameters:
fromPath
- The path to the object that needs to be copied.toPath
- The new path where the object should be copied to.- Returns:
- a
FilePathResponse
-
getSignedUrl
public CompletableFuture<FileSignedUrlResponse> getSignedUrl(String path, int expiresIn, FileDownloadOption downloadOptions, FileTransformOptions transformOptions) POST /object/sign/{bucketName}
This method just wraps
getSignedUrls(List, int, FileDownloadOption, FileTransformOptions)
- Specified by:
getSignedUrl
in interfaceIStorageFileAPI
- Parameters:
path
- The singular file path that should be signed.expiresIn
- how many seconds until the signed url expires.downloadOptions
- any additional download options.transformOptions
- The transform options if any- Returns:
- a
FileSignedUrlResponse
-
getSignedUrls
public CompletableFuture<List<FileSignedUrlResponse>> getSignedUrls(List<String> paths, int expiresIn, FileDownloadOption downloadOptions, FileTransformOptions transformOptions) POST /object/sign/{bucketName}
- Specified by:
getSignedUrls
in interfaceIStorageFileAPI
- Parameters:
paths
- a list of file paths that should be signed.expiresIn
- how many seconds until the signed urls expires.downloadOptions
- any additional download options.transformOptions
- The transform options if any- Returns:
- a list of
FileSignedUrlResponse
-
download
Downloads a file from a private bucket. To download something from a public bucket, make a request to the url from
getPublicUrl(String, FileDownloadOption, FileTransformOptions)
GET /object/authenticated/{bucketName}/{wildcard}
- Specified by:
download
in interfaceIStorageFileAPI
- Parameters:
path
- The path of the file to downloadtransformOptions
- The transform options if any- Returns:
- a
FileDownload
-
getPublicUrl
public FilePublicUrlResponse getPublicUrl(String path, FileDownloadOption downloadOptions, FileTransformOptions transformOptions) Creates the url for an object in a public bucket- Specified by:
getPublicUrl
in interfaceIStorageFileAPI
- Parameters:
path
- The path of the file the link should point to.downloadOptions
- The download options if any.transformOptions
- The transform options if any- Returns:
- a
FilePublicUrlResponse
-
list
POST /object/list/{bucketName}
- Specified by:
list
in interfaceIStorageFileAPI
- Parameters:
options
- Options for the file search- Returns:
- a list of
File
-
list
POST /object/list/{bucketName}
- Specified by:
list
in interfaceIStorageFileAPI
- Parameters:
path
- The prefix to list objects byoptions
- Options for the file search- Returns:
- a list of
File
-
delete
DELETE /object/{bucketName}
- Specified by:
delete
in interfaceIStorageFileAPI
- Parameters:
paths
- a list of paths to files that should be deleted. BE WARY! PROVIDING NULL OR AN EMPTY LIST WILL DELETE THE ENTIRE BUCKET!- Returns:
- a list of the deleted files
-