HTTP API Toolkit HTTP API Toolkit
HTTP API Toolkit HTTP API Toolkit
DocFX + Singulink = ♥

Search Results for

    Method PostStreamingAsync

    PostStreamingAsync<TItem>(InterpolatedApiPathHandler, object?, ReadOnlySpan<(string Name, object? Value)>, CancellationToken)

    Sends a POST request and returns a streaming response (see StreamingResponse).

    Declaration
    protected IAsyncEnumerable<TItem> PostStreamingAsync<TItem>(InterpolatedApiPathHandler path, object? content = null, ReadOnlySpan<(string Name, object? Value)> query = default, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    InterpolatedApiPathHandler path

    The path of the request, relative to the base address.

    object content

    The content of the request: serialized as JSON, unless it is an HttpContent or a string. Default is null, which sends no content. An HttpContent is disposed with the request, so it can only be sent once.

    ReadOnlySpan<(string Name, object Value)> query

    The query string parameters. Parameters with a null value are left out.

    CancellationToken cancellationToken

    A token to cancel the request.

    Returns
    Type Description
    IAsyncEnumerable<TItem>
    Type Parameters
    Name Description
    TItem

    The type of the streamed items.

    Remarks

    The request is created with CreateRequest(HttpMethod, InterpolatedApiPathHandler, ReadOnlySpan<(string Name, object? Value)>) and sent when the enumeration starts, and again for each enumeration. Exceptions reported in the response stream are thrown from the enumeration as the corresponding ApiException. Null items are yielded as null, whether or not the item type is nullable.

    Exceptions
    Type Condition
    ArgumentException

    path is not valid or leads outside the base address. Thrown when the enumeration starts.

    HttpRequestException

    An error occurred while sending the request or reading the response.

    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.

    ConflictApiException

    A 409 (Conflict) response was returned.

    UserChangedApiException

    A 412 (Precondition Failed) response was returned.

    ContentTooLargeApiException

    A 413 (Content Too Large) response was returned.

    UnsupportedMediaTypeApiException

    A 415 (Unsupported Media Type) response was returned.

    ValidationApiException

    A 422 (Unprocessable Content) response was returned.

    UserRequiredApiException

    A 428 (Precondition Required) response was returned.

    TooManyRequestsApiException

    A 429 (Too Many Requests) response was returned.

    ServerErrorApiException

    A 500 (Internal Server Error) response was returned.

    ServiceUnavailableApiException

    A 503 (Service Unavailable) response was returned.

    ApiException

    Any other error response or a 3xx response was returned. Redirects are not followed, except on browser platforms (see Location).

    JsonException

    The response content is not valid JSON for the response type, such as a missing or null value where the type does not allow one, or a body that is null.

    TaskCanceledException

    The request did not complete within its timeout (see RequestTimeout and SetRequestTimeout(HttpRequestMessage, TimeSpan)). The inner exception is a TimeoutException.

    InvalidOperationException

    RequestTimeout is zero, or negative other than InfiniteTimeSpan.

    IOException

    The streaming response ended before completion. On .NET 10 and later, this is an HttpIOException.

    FormatException

    The response was not a streaming response or contained an unrecognized record.

    TaskCanceledException

    The response did not start within the request's timeout (see RequestTimeout and SetRequestTimeout(HttpRequestMessage, TimeSpan)). The inner exception is a TimeoutException.

    PostStreamingAsync<TItem>(InterpolatedApiPathHandler, object?, CancellationToken)

    Sends a POST request and returns a streaming response (see StreamingResponse).

    Declaration
    protected IAsyncEnumerable<TItem> PostStreamingAsync<TItem>(InterpolatedApiPathHandler path, object? content, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    InterpolatedApiPathHandler path

    The path of the request, relative to the base address.

    object content

    The content of the request: serialized as JSON, unless it is an HttpContent or a string. Default is null, which sends no content. An HttpContent is disposed with the request, so it can only be sent once.

    CancellationToken cancellationToken

    A token to cancel the request.

    Returns
    Type Description
    IAsyncEnumerable<TItem>
    Type Parameters
    Name Description
    TItem

    The type of the streamed items.

    Remarks

    The request is created with CreateRequest(HttpMethod, InterpolatedApiPathHandler, ReadOnlySpan<(string Name, object? Value)>) and sent when the enumeration starts, and again for each enumeration. Exceptions reported in the response stream are thrown from the enumeration as the corresponding ApiException. Null items are yielded as null, whether or not the item type is nullable.

    Exceptions
    Type Condition
    ArgumentException

    path is not valid or leads outside the base address. Thrown when the enumeration starts.

    HttpRequestException

    An error occurred while sending the request or reading the response.

    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.

    ConflictApiException

    A 409 (Conflict) response was returned.

    UserChangedApiException

    A 412 (Precondition Failed) response was returned.

    ContentTooLargeApiException

    A 413 (Content Too Large) response was returned.

    UnsupportedMediaTypeApiException

    A 415 (Unsupported Media Type) response was returned.

    ValidationApiException

    A 422 (Unprocessable Content) response was returned.

    UserRequiredApiException

    A 428 (Precondition Required) response was returned.

    TooManyRequestsApiException

    A 429 (Too Many Requests) response was returned.

    ServerErrorApiException

    A 500 (Internal Server Error) response was returned.

    ServiceUnavailableApiException

    A 503 (Service Unavailable) response was returned.

    ApiException

    Any other error response or a 3xx response was returned. Redirects are not followed, except on browser platforms (see Location).

    JsonException

    The response content is not valid JSON for the response type, such as a missing or null value where the type does not allow one, or a body that is null.

    TaskCanceledException

    The request did not complete within its timeout (see RequestTimeout and SetRequestTimeout(HttpRequestMessage, TimeSpan)). The inner exception is a TimeoutException.

    InvalidOperationException

    RequestTimeout is zero, or negative other than InfiniteTimeSpan.

    IOException

    The streaming response ended before completion. On .NET 10 and later, this is an HttpIOException.

    FormatException

    The response was not a streaming response or contained an unrecognized record.

    TaskCanceledException

    The response did not start within the request's timeout (see RequestTimeout and SetRequestTimeout(HttpRequestMessage, TimeSpan)). The inner exception is a TimeoutException.

    PostStreamingAsync<TItem>(InterpolatedApiPathHandler, CancellationToken)

    Sends a POST request and returns a streaming response (see StreamingResponse).

    Declaration
    protected IAsyncEnumerable<TItem> PostStreamingAsync<TItem>(InterpolatedApiPathHandler path, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    InterpolatedApiPathHandler path

    The path of the request, relative to the base address.

    CancellationToken cancellationToken

    A token to cancel the request.

    Returns
    Type Description
    IAsyncEnumerable<TItem>
    Type Parameters
    Name Description
    TItem

    The type of the streamed items.

    Remarks

    The request is created with CreateRequest(HttpMethod, InterpolatedApiPathHandler, ReadOnlySpan<(string Name, object? Value)>) and sent when the enumeration starts, and again for each enumeration. Exceptions reported in the response stream are thrown from the enumeration as the corresponding ApiException. Null items are yielded as null, whether or not the item type is nullable.

    Exceptions
    Type Condition
    ArgumentException

    path is not valid or leads outside the base address. Thrown when the enumeration starts.

    HttpRequestException

    An error occurred while sending the request or reading the response.

    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.

    ConflictApiException

    A 409 (Conflict) response was returned.

    UserChangedApiException

    A 412 (Precondition Failed) response was returned.

    ContentTooLargeApiException

    A 413 (Content Too Large) response was returned.

    UnsupportedMediaTypeApiException

    A 415 (Unsupported Media Type) response was returned.

    ValidationApiException

    A 422 (Unprocessable Content) response was returned.

    UserRequiredApiException

    A 428 (Precondition Required) response was returned.

    TooManyRequestsApiException

    A 429 (Too Many Requests) response was returned.

    ServerErrorApiException

    A 500 (Internal Server Error) response was returned.

    ServiceUnavailableApiException

    A 503 (Service Unavailable) response was returned.

    ApiException

    Any other error response or a 3xx response was returned. Redirects are not followed, except on browser platforms (see Location).

    JsonException

    The response content is not valid JSON for the response type, such as a missing or null value where the type does not allow one, or a body that is null.

    TaskCanceledException

    The request did not complete within its timeout (see RequestTimeout and SetRequestTimeout(HttpRequestMessage, TimeSpan)). The inner exception is a TimeoutException.

    InvalidOperationException

    RequestTimeout is zero, or negative other than InfiniteTimeSpan.

    IOException

    The streaming response ended before completion. On .NET 10 and later, this is an HttpIOException.

    FormatException

    The response was not a streaming response or contained an unrecognized record.

    TaskCanceledException

    The response did not start within the request's timeout (see RequestTimeout and SetRequestTimeout(HttpRequestMessage, TimeSpan)). The inner exception is a TimeoutException.

    © Singulink. All rights reserved.