Method SendStreamingAsync
SendStreamingAsync<TItem>(HttpRequestMessage, CancellationToken)
Sends an API request and returns a streaming response (see StreamingResponse).
Declaration
protected IAsyncEnumerable<TItem> SendStreamingAsync<TItem>(HttpRequestMessage request, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequestMessage | request | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TItem> |
Type Parameters
| Name | Description |
|---|---|
| TItem |
Exceptions
| Type | Condition |
|---|---|
| HttpRequestException | An error occurred while sending the request. |
| BadRequestApiException | A 400 (Bad Request) response was returned. |
| UnauthorizedApiException | A 401 (Unauthorized) response was returned. |
| ForbiddenApiException | A 403 (Forbidden) response was returned. |
| NotFoundApiException | A 404 (Not Found) response was returned. |
| UserChangedApiException | A 412 (Precondition Failed) response was returned. |
| ValidationApiException | A 422 (Unprocessable Content/Entity) response was returned. |
| UserRequiredApiException | A 428 (Precondition Required) response was returned. |
| ApiException | A response other than 2xx or one of the other known/expected error codes was returned. |
| HttpIOException | The streaming response ended before completion. |
| FormatException | The response was not a streaming response or contained an unrecognized record. |
SendStreamingAsync<TItem>(HttpRequestMessage, object?, CancellationToken)
Sends an API request with the specified content and returns a streaming response (see StreamingResponse). Exceptions reported in the response stream are thrown from the enumeration as the corresponding ApiException. Null items are yielded as null, so a nullable item type should be used if the endpoint can produce them.
Declaration
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "The trimming requirement is enforced on the reflection-based constructors via RequiresUnreferencedCode. The trim-safe constructors supply a source-generated IJsonTypeInfoResolver, so no unreferenced code is used at runtime.")]
protected virtual IAsyncEnumerable<TItem> SendStreamingAsync<TItem>(HttpRequestMessage request, object? content, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequestMessage | request | |
| object | content | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TItem> |
Type Parameters
| Name | Description |
|---|---|
| TItem |
Exceptions
| Type | Condition |
|---|---|
| HttpRequestException | An error occurred while sending the request. |
| BadRequestApiException | A 400 (Bad Request) response was returned. |
| UnauthorizedApiException | A 401 (Unauthorized) response was returned. |
| ForbiddenApiException | A 403 (Forbidden) response was returned. |
| NotFoundApiException | A 404 (Not Found) response was returned. |
| UserChangedApiException | A 412 (Precondition Failed) response was returned. |
| ValidationApiException | A 422 (Unprocessable Content/Entity) response was returned. |
| UserRequiredApiException | A 428 (Precondition Required) response was returned. |
| ApiException | A response other than 2xx or one of the other known/expected error codes was returned. |
| HttpIOException | The streaming response ended before completion. |
| FormatException | The response was not a streaming response or contained an unrecognized record. |