Skip to main content

ParallelModelClient.SendContentAsync method

Sends an authenticated request with caller-provided HTTP content to the Core API.

public Task<ParallelModelResponse> SendContentAsync(HttpMethod method, string endpoint,
Func<HttpContent?>? contentFactory, IReadOnlyDictionary<string, string?>? query = null,
IReadOnlyDictionary<string, string>? headers = null, TimeSpan? timeout = default,
CancellationToken cancellationToken = default)
parameterdescription
methodThe HTTP method to use for the request.
endpointThe relative endpoint path within the target API.
contentFactoryA factory that creates fresh HTTP content for each request attempt, or null when no content is required.
queryOptional query parameters to append to the request URI.
headersOptional request headers. Authorization and X-ParallelModel-Region are managed by the client.
timeoutThe optional request timeout; when omitted, the configured timeout is used.
cancellationTokenThe cancellation token used to cancel the operation.

Return Value​

A task that represents the asynchronous operation and returns the API response, including its status code, parsed JSON when available, raw text and headers.

Exceptions​

exceptioncondition
ParallelModelConfigurationExceptionThe endpoint is not a safe relative API path.
ParallelModelTransportExceptionThe HTTP transport fails or the response body cannot be read.
ParallelModelResponseDecodeExceptionThe API returns malformed JSON with a JSON content type.

Remarks​

The content factory is invoked for each request attempt; it must provide fresh content if the request is retried.

See Also​