Class ApiResponse<T1, T2, T3, T4, T5, T6, T7, T8>
Encapsulates information which were returned by a RESTful HTTP API after making a request to it. This response class declares that it may hold a resource of one of the generic type parameters.
Inheritance
Implements
Namespace: ReqRest
Assembly: ReqRest.dll
Syntax
public sealed class ApiResponse<T1, T2, T3, T4, T5, T6, T7, T8> : ApiResponseBase, IHttpResponseMessageBuilder, IHttpHeadersBuilder<HttpResponseHeaders>, IHttpHeadersBuilder, IHttpContentBuilder, IHttpProtocolVersionBuilder, IHttpResponseReasonPhraseBuilder, IHttpStatusCodeBuilder, IBuilder
Type Parameters
Name | Description |
---|---|
T1 | A potential type which may be deserialized from this response. |
T2 | A potential type which may be deserialized from this response. |
T3 | A potential type which may be deserialized from this response. |
T4 | A potential type which may be deserialized from this response. |
T5 | A potential type which may be deserialized from this response. |
T6 | A potential type which may be deserialized from this response. |
T7 | A potential type which may be deserialized from this response. |
T8 | A potential type which may be deserialized from this response. |
Methods
DeserializeResourceAsync()
Deserializes the HTTP content and returns the deserialized resource.
Declaration
public Task<Variant<T1, T2, T3, T4, T5, T6, T7, T8>> DeserializeResourceAsync()
Returns
Type | Description |
---|---|
Task<NCommons.Monads.Variant<T1, T2, T3, T4, T5, T6, T7, T8>> | The deserialized resource represented through a NCommons.Monads.Variant`8 which holds a value that matches the response type declared for the response's HTTP status code. This variant is empty if the response's HTTP status code doesn't match any declared one. |
Exceptions
Type | Condition |
---|---|
HttpContentSerializationException | There was a resource to deserialize, but the underlying IHttpContentDeserializer threw an exception while deserializing the resource. |
InvalidOperationException | GetCurrentResponseTypeInfo() returned null. --or-- The ResponseDeserializerFactory of the ResponseTypeInfo returned by GetCurrentResponseTypeInfo() returned null. |