ReqRest
Show / Hide Table of Contents

Class JsonResponseTypeInfoBuilderExtensions

Extends the ResponseTypeInfoBuilder<TRequest> class with methods for declaring that a certain response type will be received as JSON.

Inheritance
Object
JsonResponseTypeInfoBuilderExtensions
Namespace: ReqRest.Serializers.NewtonsoftJson
Assembly: ReqRest.Serializers.NewtonsoftJson.dll
Syntax
public static class JsonResponseTypeInfoBuilderExtensions

Methods

AsJson<T>(ResponseTypeInfoBuilder<T>, StatusCodeRange[])

Declares that an object returned by the API should be deserialized from JSON if the response falls within one of the specified status code ranges.

Declaration
public static T AsJson<T>(this ResponseTypeInfoBuilder<T> builder, params StatusCodeRange[] forStatusCodes)
    where T : ApiRequestBase
Parameters
Type Name Description
ResponseTypeInfoBuilder<T> builder

The builder.

StatusCodeRange[] forStatusCodes

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

Returns
Type Description
T

An generic ApiRequest variation.

Type Parameters
Name Description
T

The request.

Exceptions
Type Condition
ArgumentNullException
  • builder
  • forStatusCodes
ArgumentException

forStatusCodes is empty.

AsJson<T>(ResponseTypeInfoBuilder<T>, IEnumerable<StatusCodeRange>, Func<JsonHttpContentSerializer>)

Declares that an object returned by the API should be deserialized from JSON if the response falls within one of the specified status code ranges.

Declaration
public static T AsJson<T>(this ResponseTypeInfoBuilder<T> builder, IEnumerable<StatusCodeRange> forStatusCodes, Func<JsonHttpContentSerializer> jsonHttpContentDeserializerFactory)
    where T : ApiRequestBase
Parameters
Type Name Description
ResponseTypeInfoBuilder<T> builder

The builder.

IEnumerable<StatusCodeRange> forStatusCodes

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

Func<JsonHttpContentSerializer> jsonHttpContentDeserializerFactory

A factory function which creates a JsonHttpContentSerializer which should be used for the deserialization.

Returns
Type Description
T

An generic ApiRequest variation.

Type Parameters
Name Description
T

The request.

Exceptions
Type Condition
ArgumentNullException
  • builder
  • forStatusCodes
  • jsonHttpContentDeserializerFactory
ArgumentException

forStatusCodes is empty.

AsJson<T>(ResponseTypeInfoBuilder<T>, IEnumerable<StatusCodeRange>, Nullable<JsonSerializer>)

Declares that an object returned by the API should be deserialized from JSON if the response falls within one of the specified status code ranges.

Declaration
public static T AsJson<T>(this ResponseTypeInfoBuilder<T> builder, IEnumerable<StatusCodeRange> forStatusCodes, JsonSerializer? jsonSerializer = default(JsonSerializer? ))
    where T : ApiRequestBase
Parameters
Type Name Description
ResponseTypeInfoBuilder<T> builder

The builder.

IEnumerable<StatusCodeRange> forStatusCodes

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

Nullable<Newtonsoft.Json.JsonSerializer> jsonSerializer

A Newtonsoft.Json.JsonSerializer which should be used for the deserialization.

Returns
Type Description
T

An generic ApiRequest variation.

Type Parameters
Name Description
T

The request.

Exceptions
Type Condition
ArgumentNullException
  • builder
  • forStatusCodes
ArgumentException

forStatusCodes is empty.

Back to top Copyright © 2019 ReqRest - Generated with DocFX - Material Theme made by Oscar Vásquez - Impressum (Imprint)