Class Files

java.lang.Object
com.google.genai.gaos.Files

public class Files extends Object
  • Method Details

    • async

      public AsyncFiles 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

      public byte[] download(@Nonnull String environment, @Nonnull String path)
      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

      public 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:
      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

      public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull File file, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract)
    • upload

      public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull byte[] bytes)
    • upload

      public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull byte[] bytes, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract)
    • upload

      public UploadEnvironmentFileResponse upload(@Nonnull String environment, @Nonnull String path, @Nonnull InputStream stream, long sizeBytes, @Nullable String mimeType, @Nullable Boolean overwrite, @Nullable Boolean extract)