mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 04:40:54 +00:00
Remove the redundant ApiInfo property
This commit is contained in:
@@ -17,7 +17,6 @@ namespace Octokit.Internal
|
||||
HttpResponse = response;
|
||||
Headers = response.Headers;
|
||||
Body = body;
|
||||
ApiInfo = response.ApiInfo;
|
||||
StatusCode = response.StatusCode;
|
||||
ContentType = response.ContentType;
|
||||
Body = bodyAsObject;
|
||||
@@ -25,7 +24,6 @@ namespace Octokit.Internal
|
||||
|
||||
public T Body { get; private set; }
|
||||
public IReadOnlyDictionary<string, string> Headers { get; private set; }
|
||||
public ApiInfo ApiInfo { get; set; }
|
||||
public HttpStatusCode StatusCode { get; set; }
|
||||
public IResponse HttpResponse { get; private set; }
|
||||
public string ContentType { get; set; }
|
||||
|
||||
@@ -4,23 +4,55 @@ using System.Net;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// A response from an API call that includes the deserialized object instance.
|
||||
/// </summary>
|
||||
public interface IApiResponse<out T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Object deserialized from the JSON response body.
|
||||
/// </summary>
|
||||
T Body { get; }
|
||||
|
||||
ApiInfo ApiInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The response status code.
|
||||
/// </summary>
|
||||
HttpStatusCode StatusCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The original non-deserialized http response.
|
||||
/// </summary>
|
||||
IResponse HttpResponse { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a generic HTTP response
|
||||
/// </summary>
|
||||
public interface IResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Raw response body. Typically a string, but when requesting images, it will be a byte array.
|
||||
/// </summary>
|
||||
object Body { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the API.
|
||||
/// </summary>
|
||||
IReadOnlyDictionary<string, string> Headers { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the API response parsed from the response headers.
|
||||
/// </summary>
|
||||
ApiInfo ApiInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The response status code.
|
||||
/// </summary>
|
||||
HttpStatusCode StatusCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The content type of the response.
|
||||
/// </summary>
|
||||
string ContentType { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Net;
|
||||
using Octokit.Internal;
|
||||
|
||||
namespace Octokit.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic HTTP response
|
||||
/// </summary>
|
||||
public class Response : IResponse
|
||||
{
|
||||
public Response() : this(new Dictionary<string, string>())
|
||||
@@ -30,10 +32,25 @@ namespace Octokit.Internal
|
||||
ContentType = contentType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raw response body. Typically a string, but when requesting images, it will be a byte array.
|
||||
/// </summary>
|
||||
public object Body { get; private set; }
|
||||
/// <summary>
|
||||
/// Information about the API.
|
||||
/// </summary>
|
||||
public IReadOnlyDictionary<string, string> Headers { get; private set; }
|
||||
/// <summary>
|
||||
/// Information about the API response parsed from the response headers.
|
||||
/// </summary>
|
||||
public ApiInfo ApiInfo { get; private set; }
|
||||
/// <summary>
|
||||
/// The response status code.
|
||||
/// </summary>
|
||||
public HttpStatusCode StatusCode { get; private set; }
|
||||
/// <summary>
|
||||
/// The content type of the response.
|
||||
/// </summary>
|
||||
public string ContentType { get; private set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user