Package com.google.genai.gaos
Class AsyncFiles
java.lang.Object
com.google.genai.gaos.AsyncFiles
-
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<byte[]>Downloads binary file content from an environment workspace.CompletableFuture<byte[]>Downloads binary file content from an environment workspace with custom options.downloadStream(String environment, String path) Downloads binary file content as an InputStream.downloadToFile(String environment, String path, File destination) Downloads a file from an environment workspace and saves it to a local destination file.downloadToFile(String environment, String path, Path destination) Downloads a file from an environment workspace and saves it to a local destination Path.list()Retrieves file metadata or directory contents from an environment's snapshot.list(GetEnvironmentFilesRequest request) Retrieves file metadata or directory contents from an environment's snapshot.list(GetEnvironmentFilesRequest request, Options options) Retrieves file metadata or directory contents from an environment's snapshot.sync()Switches to the sync SDK.upload(UploadEnvironmentFileRequest request) Uploads a file or extracts an archive inside an environment workspace asynchronously.upload(UploadEnvironmentFileRequest request, Options options) Uploads a file or extracts an archive inside an environment workspace asynchronously with custom options.upload(String environment, String path, byte[] bytes, String mimeType, Boolean overwrite, Boolean extract) upload(String environment, String path, File file, String mimeType, Boolean overwrite, Boolean extract) upload(String environment, String path, InputStream stream, long sizeBytes, String mimeType, Boolean overwrite, Boolean extract)
-
Method Details
-
sync
Switches to the sync SDK.- Returns:
- The sync SDK
-
list
Retrieves file metadata or directory contents from an environment's snapshot. To download file contents directly, pass ?alt=media or use the files.download helper.- Returns:
- The async call builder
-
list
public CompletableFuture<GetEnvironmentFilesResponse> list(@Nonnull GetEnvironmentFilesRequest request) Retrieves file metadata or directory contents from an environment's snapshot. To download file contents directly, pass ?alt=media or use the files.download helper.- Parameters:
request- The request object containing all the parameters for the API call.- Returns:
CompletableFuture<GetEnvironmentFilesResponse>- The async response
-
list
public CompletableFuture<GetEnvironmentFilesResponse> list(@Nonnull GetEnvironmentFilesRequest request, @Nullable Options options) Retrieves file metadata or directory contents from an environment's snapshot. To download file contents directly, pass ?alt=media or use the files.download helper.- Parameters:
request- The request object containing all the parameters for the API call.options- additional options- Returns:
CompletableFuture<GetEnvironmentFilesResponse>- The async response
-
download
Downloads binary file content from an environment workspace.- Parameters:
environment- The environment ID or resource name.path- The relative file path to download.- Returns:
- CompletableFuture containing the binary file content as a byte array.
-
download
public CompletableFuture<byte[]> download(@Nonnull String environment, @Nonnull String path, @Nullable Options options) Downloads binary file content from an environment workspace with custom options.- Parameters:
environment- The environment ID or resource name.path- The relative file path to download.options- Additional request options.- Returns:
- CompletableFuture containing the binary file content as a byte array.
-
downloadStream
public CompletableFuture<InputStream> downloadStream(@Nonnull String environment, @Nonnull String path) Downloads binary file content as an InputStream.- Parameters:
environment- The environment ID or resource name.path- The relative file path to download.- Returns:
- CompletableFuture containing an InputStream of the downloaded file content.
-
downloadToFile
public CompletableFuture<Void> downloadToFile(@Nonnull String environment, @Nonnull String path, @Nonnull File destination) Downloads a file from an environment workspace and saves it to a local destination file.- Parameters:
environment- The environment ID or resource name.path- The relative file path to download.destination- The local File to write to.- Returns:
- CompletableFuture that completes when writing completes.
-
downloadToFile
public CompletableFuture<Void> downloadToFile(@Nonnull String environment, @Nonnull String path, @Nonnull Path destination) Downloads a file from an environment workspace and saves it to a local destination Path.- Parameters:
environment- The environment ID or resource name.path- The relative file path to download.destination- The local Path to write to.- Returns:
- CompletableFuture that completes when writing completes.
-
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull UploadEnvironmentFileRequest request) Uploads a file or extracts an archive inside an environment workspace asynchronously.- Parameters:
request- The upload request containing environment, path, content, and options.- Returns:
- CompletableFuture containing the response.
-
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull UploadEnvironmentFileRequest request, @Nullable Options options) Uploads a file or extracts an archive inside an environment workspace asynchronously with custom options.- Parameters:
request- The upload request.options- Additional request options.- Returns:
- CompletableFuture containing the response.
-
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull String environment, @Nonnull String path, @Nonnull File file) -
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull String environment, @Nonnull String path, @Nonnull File file, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract) -
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull String environment, @Nonnull String path, @Nonnull byte[] bytes) -
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull String environment, @Nonnull String path, @Nonnull byte[] bytes, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract) -
upload
public CompletableFuture<UploadEnvironmentFileResponse> upload(@Nonnull String environment, @Nonnull String path, @Nonnull InputStream stream, long sizeBytes, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract)
-