Class AsyncFiles
-
- All Implemented Interfaces:
public final class AsyncFilesAsync module of Files
-
-
Constructor Summary
Constructors Constructor Description AsyncFiles(ApiClient apiClient)
-
Method Summary
Modifier and Type Method Description CompletableFuture<File>get(String name, GetFileConfig config)Asynchronously retrieves the file information from the service. CompletableFuture<DeleteFileResponse>delete(String name, DeleteFileConfig config)Asynchronously deletes a remotely stored file. CompletableFuture<AsyncPager<File>>list(ListFilesConfig config)Asynchronously makes an API request to list the available files. CompletableFuture<RegisterFilesResponse>registerFiles(GoogleCredentials credentials, List<String> uris, RegisterFilesConfig config)Asynchronously registers Google Cloud Storage files for use with the API. CompletableFuture<File>upload(File file, UploadFileConfig config)Asynchronously uploads a file to the GenAI API. CompletableFuture<File>upload(Array<byte> bytes, UploadFileConfig config)Asynchronously uploads a bytes array as a file to the GenAI API. CompletableFuture<File>upload(InputStream stream, long size, UploadFileConfig config)Asynchronously uploads a stream as a file to the GenAI API. CompletableFuture<File>upload(String filePath, UploadFileConfig config)Asynchronously uploads a file by its path to the GenAI API. CompletableFuture<Void>download(String fileName, String downloadPath, DownloadFileConfig config)Asynchronously downloads a file from the GenAI API to the provided path. CompletableFuture<Void>download(Video video, String downloadPath, DownloadFileConfig config)Asynchronously downloads a video from the GenAI API to the provided path. CompletableFuture<Void>download(GeneratedVideo video, String downloadPath, DownloadFileConfig config)Asynchronously downloads a generated video from the GenAI API to the provided path. CompletableFuture<Void>download(File file, String downloadPath, DownloadFileConfig config)Asynchronously downloads a file from the GenAI API to the provided path. -
-
Constructor Detail
-
AsyncFiles
AsyncFiles(ApiClient apiClient)
-
-
Method Detail
-
get
CompletableFuture<File> get(String name, GetFileConfig config)
Asynchronously retrieves the file information from the service.
- Parameters:
name- - The name identifier for the file to retrieve.config- - Optional, configuration for the get method.- Returns:
A File object representing the file.
-
delete
CompletableFuture<DeleteFileResponse> delete(String name, DeleteFileConfig config)
Asynchronously deletes a remotely stored file.
- Parameters:
name- - The name identifier for the file to delete.config- - Optional, configuration for the delete method.- Returns:
The DeleteFileResponse, the response for the delete method.
-
list
CompletableFuture<AsyncPager<File>> list(ListFilesConfig config)
Asynchronously makes an API request to list the available files.
- Parameters:
config- A ListFilesConfig for configuring the list request.- Returns:
A CompletableFuture that resolves to a AsyncPager. The AsyncPager has a `forEach` method that can be used to asynchronously process items in the page and automatically query the next page once the current page is exhausted.
-
registerFiles
CompletableFuture<RegisterFilesResponse> registerFiles(GoogleCredentials credentials, List<String> uris, RegisterFilesConfig config)
Asynchronously registers Google Cloud Storage files for use with the API.
- Parameters:
credentials- The Google Cloud credentials to use for registering the files.uris- The list of GCS URIs to register.config- Optional configuration for the registration request.- Returns:
A future that resolves to the response containing the registered files.
-
upload
CompletableFuture<File> upload(File file, UploadFileConfig config)
Asynchronously uploads a file to the GenAI API.
- Parameters:
file- The file to upload.config- The configuration for the upload.- Returns:
A future that resolves to the uploaded file.
-
upload
CompletableFuture<File> upload(Array<byte> bytes, UploadFileConfig config)
Asynchronously uploads a bytes array as a file to the GenAI API.
- Parameters:
bytes- The bytes of the file to upload.config- The configuration for the upload.- Returns:
A future that resolves to the uploaded file.
-
upload
CompletableFuture<File> upload(InputStream stream, long size, UploadFileConfig config)
Asynchronously uploads a stream as a file to the GenAI API.
- Parameters:
stream- The stream of the file to upload.size- The size of the file in bytes.config- The configuration for the upload.- Returns:
A future that resolves to the uploaded file.
-
upload
CompletableFuture<File> upload(String filePath, UploadFileConfig config)
Asynchronously uploads a file by its path to the GenAI API.
- Parameters:
filePath- The path to the file to upload.config- The configuration for the upload.- Returns:
A future that resolves to the uploaded file.
-
download
CompletableFuture<Void> download(String fileName, String downloadPath, DownloadFileConfig config)
Asynchronously downloads a file from the GenAI API to the provided path.
- Parameters:
fileName- The name of the file to download.downloadPath- The path to download the file to.config- The configuration for the download.- Returns:
A future that resolves to the downloaded file.
-
download
CompletableFuture<Void> download(Video video, String downloadPath, DownloadFileConfig config)
Asynchronously downloads a video from the GenAI API to the provided path.
- Parameters:
video- The video to download.downloadPath- The path to download the video to.config- The configuration for the download.- Returns:
A future that resolves to the downloaded video.
-
download
CompletableFuture<Void> download(GeneratedVideo video, String downloadPath, DownloadFileConfig config)
Asynchronously downloads a generated video from the GenAI API to the provided path.
- Parameters:
video- The generated video to download.downloadPath- The path to download the video to.config- The configuration for the download.- Returns:
A future that resolves to the downloaded video.
-
download
CompletableFuture<Void> download(File file, String downloadPath, DownloadFileConfig config)
Asynchronously downloads a file from the GenAI API to the provided path.
- Parameters:
file- The file to download.downloadPath- The path to download the file to.config- The configuration for the download.- Returns:
A future that resolves to the downloaded file.
-
-
-
-