ReqRest
Show / Hide Table of Contents

Class ResponseTypeInfoBuilder<TRequest>

A builder which gets returned by an ApiRequest (or one of its generic variants) instance when upgrading it via the Receive<T>() method(s). This builder allows enhancing the possible response type with information like which status codes are required for receiving that response content type.

Inheritance
Object
ResponseTypeInfoBuilder<TRequest>
Namespace: ReqRest
Assembly: ReqRest.dll
Syntax
public sealed class ResponseTypeInfoBuilder<TRequest>
    where TRequest : ApiRequestBase
Type Parameters
Name Description
TRequest

The request type which gets returned after upgrading.

Constructors

ResponseTypeInfoBuilder(TRequest, Type)

Initializes a new builder instance which enhances the upgrade information of the specified request.

Declaration
public ResponseTypeInfoBuilder(TRequest request, Type responseType)
Parameters
Type Name Description
TRequest request

The upgraded request.

Type responseType

The type with which the request was just being upgraded.

Exceptions
Type Condition
ArgumentNullException
  • request
  • responseType

Methods

Build(Func<IHttpContentDeserializer>, IEnumerable<StatusCodeRange>)

Creates a new ResponseTypeInfo instance with the specified values and adds it to the request's PossibleResponseTypes list. Afterwards, the request is returned to allow continuous request info building.

Declaration
public TRequest Build(Func<IHttpContentDeserializer> responseDeserializerFactory, IEnumerable<StatusCodeRange> forStatusCodes)
Parameters
Type Name Description
Func<IHttpContentDeserializer> responseDeserializerFactory

A function which returns an IHttpContentDeserializer that must be used to deserialize the .NET object from an HTTP response.

IEnumerable<StatusCodeRange> forStatusCodes

A set of status codes for which the response type is the result.

Returns
Type Description
TRequest

The api request instance with which this class was initialized.

Exceptions
Type Condition
ArgumentNullException
  • responseDeserializerFactory
  • forStatusCodes
ArgumentException

forStatusCodes is empty.

Extension Methods

JsonResponseTypeInfoBuilderExtensions.AsJson<T>(ResponseTypeInfoBuilder<T>, StatusCodeRange[])
JsonResponseTypeInfoBuilderExtensions.AsJson<T>(ResponseTypeInfoBuilder<T>, IEnumerable<StatusCodeRange>, Nullable<JsonSerializer>)
JsonResponseTypeInfoBuilderExtensions.AsJson<T>(ResponseTypeInfoBuilder<T>, IEnumerable<StatusCodeRange>, Func<JsonHttpContentSerializer>)
Back to top Copyright © 2019 ReqRest - Generated with DocFX - Material Theme made by Oscar Vásquez - Impressum (Imprint)