Package com.google.genai.types
Class Operation<T,O extends Operation<T,O>>
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.Operation<T,O>
- Direct Known Subclasses:
GenerateVideosOperation,ImportFileOperation,UploadToFileSearchStoreOperation
A long-running operation.
-
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondone()If the value is `false`, it means the operation is still in progress.error()The error result of the operation in case of failure or cancellation.abstract OfromApiResponse(com.fasterxml.jackson.databind.JsonNode apiResponse, boolean isVertexAi) Creates a new Operation object from an API response.metadata()Service-specific metadata associated with the operation.name()The server-assigned name, which is only unique within the same service that originally returns it.response()The result of the operation.Methods inherited from class com.google.genai.JsonSerializable
setMaxReadLength, stringToJsonNode, toJson
-
Constructor Details
-
Operation
public Operation()
-
-
Method Details
-
name
The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. -
metadata
Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. -
done
If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. -
error
The error result of the operation in case of failure or cancellation. -
response
The result of the operation. -
fromApiResponse
public abstract O fromApiResponse(com.fasterxml.jackson.databind.JsonNode apiResponse, boolean isVertexAi) Creates a new Operation object from an API response.- Parameters:
apiResponse- The API response.isVertexAi- Whether the API response is from Vertex AI.- Returns:
- The new Operation object.
-