Class Files

  • All Implemented Interfaces:

    
    public final class Files
    
                        

    Provides methods for interacting with the available GenAI files. Instantiating this class is not required. After instantiating a Client, access methods through `client.files.methodName(...)` directly.

    • Constructor Detail

    • Method Detail

      • get

         File get(String name, GetFileConfig config)

        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

         DeleteFileResponse delete(String name, DeleteFileConfig config)

        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

         Pager<File> list(ListFilesConfig config)

        Makes an API request to list the available files.

        Parameters:
        config - A ListFilesConfig for configuring the list request.
        Returns:

        A Pager object that contains the list of files. The pager is an iterable and automatically queries the next page once the current page is exhausted.

      • registerFiles

         RegisterFilesResponse registerFiles(GoogleCredentials credentials, List<String> uris, RegisterFilesConfig config)

        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:

        The response containing the registered files.

      • upload

         File upload(File file, UploadFileConfig config)

        Uploads a file to the API.

        Parameters:
        file - The file to upload.
        config - The configuration for the upload.
        Returns:

        The uploaded file.

      • upload

         File upload(Array<byte> bytes, UploadFileConfig config)

        Uploads a file to the API.

        Parameters:
        bytes - The bytes of the file to upload.
        config - The configuration for the upload.
        Returns:

        The uploaded file.

      • upload

         File upload(InputStream inputStream, long size, UploadFileConfig config)

        Uploads a file to the API.

        Parameters:
        inputStream - The input stream of the file to upload.
        size - The size of the file to upload.
        config - The configuration for the upload.
        Returns:

        The uploaded file.

      • upload

         File upload(String filePath, UploadFileConfig config)

        Uploads a file to the API.

        Parameters:
        filePath - The path of the file to upload.
        config - The configuration for the upload.
        Returns:

        The uploaded file.

      • download

         void download(String fileName, String downloadPath, DownloadFileConfig config)

        Downloads a file from the API.

        Parameters:
        fileName - The name of the file to download.
        downloadPath - The path to download the file to.
        config - The configuration for the download.
      • download

         void download(Video video, String downloadPath, DownloadFileConfig config)

        Downloads a video from the API.

        Parameters:
        video - The video to download.
        downloadPath - The path to download the video to.
        config - The configuration for the download.
      • download

         void download(File file, String downloadPath, DownloadFileConfig config)

        Downloads a file from the API.

        Parameters:
        file - The file to download.
        downloadPath - The path to download the file to.
        config - The configuration for the download.
      • download

         void download(GeneratedVideo generatedVideo, String downloadPath, DownloadFileConfig config)

        Downloads a generated video from the API.

        Parameters:
        generatedVideo - The generated video to download.
        downloadPath - The path to download the generated video to.
        config - The configuration for the download.