ApiBaseSendAsyncTRequest, TResponse Method
Sends an HTTP request (e.g., POST, PUT, or PATCH) to the specified URL.
Namespace: GenerativeAI.CoreAssembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
protected Task<TResponse> SendAsync<TRequest, TResponse>(
string url,
TRequest payload,
HttpMethod method,
CancellationToken cancellationToken = default
)
- url String
- The full URL of the API endpoint.
- payload TRequest
- The request payload to send in the body.
- method HttpMethod
- The HTTP method (e.g., POST, PUT, PATCH).
- cancellationToken CancellationToken (Optional)
- Token to propagate notification that the operation should be canceled.
- TRequest
- The type of the request payload.
- TResponse
- The type to deserialize the response into.
TaskTResponseThe deserialized object from the response.