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
platformIPlatformAdapterhttpClientHttpClientloggerILogger
Methods
CancelOperationAsync(string, CancellationToken)
Starts asynchronous cancellation on a long-running operation.
public Task CancelOperationAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the operation resource to be cancelled.
cancellationTokenCancellationTokenThe 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
namestringThe name of the operation resource to be deleted.
cancellationTokenCancellationTokenThe 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
operationIdstringThe ID of the operation to fetch status for.
cancellationTokenCancellationTokenA 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
namestringThe name of the operation resource.
cancellationTokenCancellationTokenThe 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
namestringThe name of the operation's parent resource.
filterstringThe standard list filter.
pageSizeint?The standard list page size.
pageTokenstringThe standard list page token.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation.
Returns
- Task<GoogleLongRunningListOperationsResponse>
A list of operations that match the specified filter in the request.