Class IncomingRequestExtensions
Provides extension methods for IncomingRequest to decode its Slice-encoded payload.
public static class IncomingRequestExtensions
- Inheritance
-
IncomingRequestExtensions
- Inherited Members
Methods
CheckNonIdempotent(IncomingRequest)
The generated code calls this method to ensure that when an operation is not declared idempotent, the request is not marked idempotent. If the request is marked idempotent, it means the caller incorrectly believes this operation is idempotent.
public static void CheckNonIdempotent(this IncomingRequest request)
Parameters
request
IncomingRequestThe request to check.
Exceptions
- InvalidDataException
Thrown if the request contains the Idempotent field.
CreateSliceExceptionResponse(IncomingRequest, SliceException, SliceEncoding)
Creates an outgoing response with status code ApplicationError with a Slice exception payload.
public static OutgoingResponse CreateSliceExceptionResponse(this IncomingRequest request, SliceException sliceException, SliceEncoding encoding)
Parameters
request
IncomingRequestThe incoming request.
sliceException
SliceExceptionThe Slice exception to encode in the payload.
encoding
SliceEncodingThe encoding used for the request payload.
Returns
- OutgoingResponse
The new outgoing response.
Exceptions
- NotSupportedException
Thrown when
sliceException
does not support encodingencoding
.
DecodeArgsAsync<T>(IncomingRequest, SliceEncoding, DecodeFunc<T>, IActivator?, CancellationToken)
Decodes a request payload into a list of arguments.
public static ValueTask<T> DecodeArgsAsync<T>(this IncomingRequest request, SliceEncoding encoding, DecodeFunc<T> decodeFunc, IActivator? defaultActivator = null, CancellationToken cancellationToken = default)
Parameters
request
IncomingRequestThe incoming request.
encoding
SliceEncodingThe encoding of the request's payload.
decodeFunc
DecodeFunc<T>The decode function for the arguments from the payload.
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>
The request arguments.
Type Parameters
T
The type of the request parameters.
DecodeEmptyArgsAsync(IncomingRequest, SliceEncoding, CancellationToken)
Verifies that a request payload carries no argument or only unknown tagged arguments.
public static ValueTask DecodeEmptyArgsAsync(this IncomingRequest request, SliceEncoding encoding, CancellationToken cancellationToken = default)
Parameters
request
IncomingRequestThe incoming request.
encoding
SliceEncodingThe encoding of the request payload.
cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- ValueTask
A value task that completes when the checking is complete.