Class IncomingResponseExtensions
Provides extension methods for IncomingResponse to decode its Slice-encoded payload.
public static class IncomingResponseExtensions
- Inheritance
-
IncomingResponseExtensions
- Inherited Members
Methods
DecodeReturnValueAsync<T>(IncomingResponse, OutgoingRequest, SliceEncoding, IProxy, DecodeFunc<T>, IActivator?, CancellationToken)
Decodes a response payload.
public static ValueTask<T> DecodeReturnValueAsync<T>(this IncomingResponse response, OutgoingRequest request, SliceEncoding encoding, IProxy sender, DecodeFunc<T> decodeReturnValue, IActivator? defaultActivator = null, CancellationToken cancellationToken = default)
Parameters
response
IncomingResponseThe incoming response.
request
OutgoingRequestThe outgoing request.
encoding
SliceEncodingThe encoding of the response payload.
sender
IProxyThe proxy that sent the request.
decodeReturnValue
DecodeFunc<T>A function that decodes the return value.
defaultActivator
IActivatorThe activator to use when the activator provided by the request's ISliceFeature is null. Used only when
encoding
is Slice1.cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- ValueTask<T>
A value task that holds the operation's return value. This value task is faulted and holds a SliceException when encoding is Slice1 and the status code is ApplicationError.
Type Parameters
T
The type of the return value.
Exceptions
- DispatchException
Thrown when the encoding is Slice1 and the status code of the response is greater than ApplicationError, or when the encoding is Slice2 and the status code is greater than Ok.
DecodeVoidReturnValueAsync(IncomingResponse, OutgoingRequest, IProxy, CancellationToken)
Verifies that a Slice2-encoded response payload carries no return value or only tagged return values.
public static ValueTask DecodeVoidReturnValueAsync(this IncomingResponse response, OutgoingRequest request, IProxy sender, CancellationToken cancellationToken = default)
Parameters
response
IncomingResponseThe incoming response.
request
OutgoingRequestThe outgoing request.
sender
IProxyThe proxy that sent the request (not used by this method).
cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- ValueTask
A value task representing the asynchronous completion of the operation.
Remarks
This method is a ResponseDecodeFunc.
Exceptions
- DispatchException
Thrown if the status code of the response is greater than Ok.
DecodeVoidReturnValueAsync(IncomingResponse, OutgoingRequest, SliceEncoding, IProxy, IActivator?, CancellationToken)
Verifies that a Slice-encoded response payload carries no return value or only tagged return values.
public static ValueTask DecodeVoidReturnValueAsync(this IncomingResponse response, OutgoingRequest request, SliceEncoding encoding, IProxy sender, IActivator? defaultActivator = null, CancellationToken cancellationToken = default)
Parameters
response
IncomingResponseThe incoming response.
request
OutgoingRequestThe outgoing request.
encoding
SliceEncodingThe encoding of the response payload.
sender
IProxyThe proxy that sent the request.
defaultActivator
IActivatorThe activator to use when the activator provided by the request's ISliceFeature is null. Used only when
encoding
is Slice1.cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- ValueTask
A value task representing the asynchronous completion of the operation. This value task is faulted and holds a SliceException when encoding is Slice1 and the status code is ApplicationError.
Exceptions
- DispatchException
Thrown when the encoding is Slice1 and the status code of the response is greater than ApplicationError, or when the encoding is Slice2 and the status code is greater than Ok.