Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ namespace Refit
public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable
{
T Content { get; }
new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }
new Refit.ApiException? Error { get; }
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")]
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")]
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")]
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")]
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")]
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")]
new bool IsSuccessStatusCode { get; }
}
public interface IFormUrlEncodedParameterFormatter
{
Expand Down
9 changes: 9 additions & 0 deletions Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ namespace Refit
public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable
{
T Content { get; }
new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }
new Refit.ApiException? Error { get; }
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")]
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")]
[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")]
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")]
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")]
[get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")]
new bool IsSuccessStatusCode { get; }
}
public interface IFormUrlEncodedParameterFormatter
{
Expand Down
25 changes: 25 additions & 0 deletions Refit/ApiResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,31 @@ void Dispose(bool disposing)
/// <inheritdoc/>
public interface IApiResponse<out T> : IApiResponse
{
#if NET6_0_OR_GREATER
/// <summary>
/// The <see cref="ApiException"/> object in case of unsuccessful response.
/// </summary>
[SuppressMessage(
"Naming",
"CA1716:Identifiers should not match keywords",
Justification = "By Design"
)]
new ApiException? Error { get; }

/// <summary>
/// HTTP response content headers as defined in RFC 2616.
/// </summary>
new HttpContentHeaders? ContentHeaders { get; }

/// <summary>
/// Indicates whether the request was successful.
/// </summary>
[MemberNotNullWhen(true, nameof(Content))]
[MemberNotNullWhen(true, nameof(ContentHeaders))]
[MemberNotNullWhen(false, nameof(Error))]
new bool IsSuccessStatusCode { get; }
#endif

/// <summary>
/// Deserialized request content as <typeparamref name="T"/>.
/// </summary>
Expand Down