Package com.google.genai.gaos
Class Files
java.lang.Object
com.google.genai.gaos.Files
-
Method Summary
Modifier and TypeMethodDescriptionasync()Switches to the async SDK.byte[]Downloads binary file content from an environment workspace.byte[]Downloads binary file content from an environment workspace with custom options.downloadStream(String environment, String path) Downloads binary file content as an InputStream.voiddownloadToFile(String environment, String path, File destination) Downloads a file from an environment workspace and saves it to a local destination file.voiddownloadToFile(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.upload(UploadEnvironmentFileRequest request) Uploads a file or extracts an archive inside an environment workspace.upload(UploadEnvironmentFileRequest request, Options options) Uploads a file or extracts an archive inside an environment workspace 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
-
async
Switches to the async SDK.- Returns:
- The async 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 call builder
-
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.- Parameters:
request- The request object containing all the parameters for the API call.- Returns:
- The response from the API call
- Throws:
RuntimeException- subclass if the API call fails
-
list
public 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:
- The response from the API call
- Throws:
RuntimeException- subclass if the API call fails
-
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:
- The binary file content as a byte array.
-
download
public 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:
- The binary file content as a byte array.
-
downloadStream
Downloads binary file content as an InputStream.- Parameters:
environment- The environment ID or resource name.path- The relative file path to download.- Returns:
- An InputStream of the downloaded file content.
-
downloadToFile
public 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.
-
downloadToFile
public 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.
-
upload
Uploads a file or extracts an archive inside an environment workspace.- Parameters:
request- The upload request containing environment, path, content, and options.- Returns:
- The response containing the uploaded file metadata or extracted files.
-
upload
public UploadEnvironmentFileResponse upload(@Nonnull UploadEnvironmentFileRequest request, @Nullable Options options) Uploads a file or extracts an archive inside an environment workspace with custom options.- Parameters:
request- The upload request.options- Additional request options.- Returns:
- The response containing the uploaded file metadata or extracted files.
-
upload
public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull File file) -
upload
-
upload
public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull byte[] bytes) -
upload
-
upload
public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull InputStream stream, long sizeBytes, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract)
-