Table of Contents

Class IncomingRequestExtensions

Namespace
IceRpc.Slice
Assembly
IceRpc.Slice.dll

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 IncomingRequest

The 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 IncomingRequest

The incoming request.

sliceException SliceException

The Slice exception to encode in the payload.

encoding SliceEncoding

The encoding used for the request payload.

Returns

OutgoingResponse

The new outgoing response.

Exceptions

NotSupportedException

Thrown when sliceException does not support encoding encoding.

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 IncomingRequest

The incoming request.

encoding SliceEncoding

The encoding of the request's payload.

decodeFunc DecodeFunc<T>

The decode function for the arguments from the payload.

defaultActivator IActivator

The activator to use when the activator provided by the request's ISliceFeature is null. Used only when encoding is Slice1.

cancellationToken CancellationToken

A 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 IncomingRequest

The incoming request.

encoding SliceEncoding

The encoding of the request payload.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

ValueTask

A value task that completes when the checking is complete.