Table of Contents

Class OperationsClient

Namespace
GenerativeAI.Clients
Assembly
GenerativeAI.dll

Provides functionality for interacting with long-running operations. The OperationsClient allows for querying, listing, canceling, and deleting operations on a given platform.

public class OperationsClient : BaseClient
Inheritance
OperationsClient
Inherited Members
Extension Methods

Constructors

OperationsClient(IPlatformAdapter, HttpClient?, ILogger?)

Provides functionality for interacting with long-running operations. Supports querying, listing, canceling, and deleting operations via the platform interface.

public OperationsClient(IPlatformAdapter platform, HttpClient? httpClient = null, ILogger? logger = null)

Parameters

platform IPlatformAdapter
httpClient HttpClient
logger ILogger

Methods

CancelOperationAsync(string, CancellationToken)

Starts asynchronous cancellation on a long-running operation.

public Task CancelOperationAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the operation resource to be cancelled.

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.

DeleteOperationAsync(string, CancellationToken)

Deletes a long-running operation.

public Task DeleteOperationAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the operation resource to be deleted.

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.

FetchOperationStatusAsync(string, CancellationToken)

Fetches the status of a long-running operation by its ID.

public Task<GoogleLongRunningOperation> FetchOperationStatusAsync(string operationId, CancellationToken cancellationToken)

Parameters

operationId string

The ID of the operation to fetch status for.

cancellationToken CancellationToken

A cancellation token to cancel the operation.

Returns

Task<GoogleLongRunningOperation>

The current status of the long-running operation.

GetOperationAsync(string, CancellationToken)

Gets the latest state of a long-running operation.

public Task<GoogleLongRunningOperation?> GetOperationAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the operation resource.

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task<GoogleLongRunningOperation>

The GoogleLongRunningOperation resource.

ListOperationsAsync(string, string?, int?, string?, CancellationToken)

Lists operations that match the specified filter in the request.

public Task<GoogleLongRunningListOperationsResponse?> ListOperationsAsync(string name, string? filter = null, int? pageSize = null, string? pageToken = null, CancellationToken cancellationToken = default)

Parameters

name string

The name of the operation's parent resource.

filter string

The standard list filter.

pageSize int?

The standard list page size.

pageToken string

The standard list page token.

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task<GoogleLongRunningListOperationsResponse>

A list of operations that match the specified filter in the request.