pub struct BatchHandle {
pub name: String,
/* private fields */
}
Expand description
Represents a long-running batch operation, providing methods to manage its lifecycle.
A Batch
object is a handle to a batch operation on the Gemini API. It allows you to
check the status, cancel the operation, or delete it once it’s no longer needed.
Fields§
§name: String
The unique resource name of the batch operation, e.g., operations/batch-xxxxxxxx
.
Implementations§
Source§impl BatchHandle
impl BatchHandle
Sourcepub async fn status(&self) -> Result<BatchStatus, Error>
pub async fn status(&self) -> Result<BatchStatus, Error>
Retrieves the current status of the batch operation by making an API call.
This method provides a snapshot of the batch’s state at a single point in time.
Sourcepub async fn cancel(self) -> Result<(), (Self, ClientError)>
pub async fn cancel(self) -> Result<(), (Self, ClientError)>
Sends a request to the API to cancel the batch operation.
Cancellation is not guaranteed to be instantaneous. The operation may continue to run for some time after the cancellation request is made.
Consumes the batch. If cancellation fails, returns the batch and error information so it can be retried.
Sourcepub async fn delete(self) -> Result<(), (Self, ClientError)>
pub async fn delete(self) -> Result<(), (Self, ClientError)>
Deletes the batch operation resource from the server.
Note: This method indicates that the client is no longer interested in the operation result.
It does not cancel a running operation. To stop a running batch, use the cancel
method.
This method should typically be used after the batch has completed.
Consumes the batch. If deletion fails, returns the batch and error information so it can be retried.