<PackageReference Include="Refit" Version="16.2.0" />

Refit.ApiResponse<T>

public sealed class ApiResponse<T> : IApiResponse<T>, IApiResponse, IDisposable
Implementation of IApiResponse<T> that provides additional functionalities.
public T Content { get; }

Gets the deserialized response content as T.

Gets the HTTP response content headers as defined in RFC 2616.

public ApiExceptionBase Error { get; }

Gets the ApiExceptionBase object in case of unsuccessful request or response.

public bool HasContent { get; }

Gets a value indicating whether deserialized Content is available.

public HttpResponseHeaders Headers { get; }

Gets the HTTP response headers.

public bool IsReceived { get; }

public bool IsSuccessful { get; }

public bool IsSuccessfulWithContent { get; }

Gets a value indicating whether the request was successful and deserialized Content is available.

public bool IsSuccessStatusCode { get; }

public string ReasonPhrase { get; }

Gets the reason phrase which typically is sent by the server together with the status code.

Gets the HTTP Request message which led to this response.

public RefitSettings Settings { get; }

Gets the Refit settings used to send the request.

public HttpStatusCode? StatusCode { get; }

Gets the HTTP response status code.

public Version Version { get; }

Gets the HTTP Message version.

public ApiResponse(HttpRequestMessage request, HttpResponseMessage response, T content, RefitSettings settings, ApiExceptionBase error = null)

Implementation of IApiResponse<T> that provides additional functionalities.

public ApiResponse(HttpResponseMessage response, T content, RefitSettings settings)

Initializes a new instance of the ApiResponse<T> class.

public ApiResponse(HttpResponseMessage response, T content, RefitSettings settings, ApiExceptionBase error)

Initializes a new instance of the ApiResponse<T> class.

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Ensures the request was successful and without any other error by throwing an exception in case of failure.

Ensures the request was successful by throwing an exception in case of failure.

public bool HasRequestError(out ApiRequestException error)

public bool HasResponseError(out ApiException error)