registerFiles

suspend fun registerFiles(credentials: GoogleCredentials, uris: List<String>, config: RegisterFilesConfig? = null): RegisterFilesResponse

Registers Google Cloud Storage files for use with the API.

This is the only Files operation that needs more than an API key: the service reads the objects out of GCS on your behalf, which requires an OAuth token. The credentials are applied to this request alone, so the client stays an ordinary Gemini Developer API key client. Do not pass credentials to the Client constructor for this.

The bucket must also grant the Gemini API service agent the Storage Object Viewer role, and the API key must belong to the same project as these credentials. See https://ai.google.dev/gemini-api/docs/file-input-methods#registration for the full setup.

Return

The RegisterFilesResponse containing the registered files.

Parameters

credentials

The Google credentials authorizing access to the GCS objects.

uris

The list of URIs to register.

config

Optional configuration for the registration.