ApiBaseGetAsyncT Method

Sends a GET request to the specified URL.

Definition

Namespace: GenerativeAI.Core
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
protected Task<T> GetAsync<T>(
	string url,
	CancellationToken cancellationToken = default
)

Parameters

url  String
The full URL of the API endpoint.
cancellationToken  CancellationToken  (Optional)
Token to propagate notification that the operation should be canceled.

Type Parameters

T
The type to deserialize the response into.

Return Value

TaskT
The deserialized object from the response.

Exceptions

HttpRequestExceptionThrows upon a non-success status code.
InvalidOperationExceptionThrows if deserialization fails.

See Also