/
IRestResponse.cs
103 lines (87 loc) · 2.45 KB
/
IRestResponse.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Net;
namespace RestSharp
{
/// <summary>
/// Container for data sent back from API
/// </summary>
public interface IRestResponse
{
/// <summary>
/// The RestRequest that was made to get this RestResponse
/// </summary>
/// <remarks>
/// Mainly for debugging if ResponseStatus is not OK
/// </remarks>
IRestRequest Request { get; set; }
/// <summary>
/// MIME content type of response
/// </summary>
string ContentType { get; set; }
/// <summary>
/// Length in bytes of the response content
/// </summary>
long ContentLength { get; set; }
/// <summary>
/// Encoding of the response content
/// </summary>
string ContentEncoding { get; set; }
/// <summary>
/// String representation of response content
/// </summary>
string Content { get; set; }
/// <summary>
/// HTTP response status code
/// </summary>
HttpStatusCode StatusCode { get; set; }
/// <summary>
/// Description of HTTP status returned
/// </summary>
string StatusDescription { get; set; }
/// <summary>
/// Response content
/// </summary>
byte[] RawBytes { get; set; }
/// <summary>
/// The URL that actually responded to the content (different from request if redirected)
/// </summary>
Uri ResponseUri { get; set; }
/// <summary>
/// HttpWebResponse.Server
/// </summary>
string Server { get; set; }
/// <summary>
/// Cookies returned by server with the response
/// </summary>
IList<RestResponseCookie> Cookies { get; }
/// <summary>
/// Headers returned by server with the response
/// </summary>
IList<Parameter> Headers { get; }
/// <summary>
/// Status of the request. Will return Error for transport errors.
/// HTTP errors will still return ResponseStatus.Completed, check StatusCode instead
/// </summary>
ResponseStatus ResponseStatus { get; set; }
/// <summary>
/// Transport or other non-HTTP error generated while attempting request
/// </summary>
string ErrorMessage { get; set; }
/// <summary>
/// The exception thrown during the request, if any
/// </summary>
Exception ErrorException { get; set; }
}
/// <summary>
/// Container for data sent back from API including deserialized data
/// </summary>
/// <typeparam name="T">Type of data to deserialize to</typeparam>
public interface IRestResponse<T> : IRestResponse
{
/// <summary>
/// Deserialized entity data
/// </summary>
T Data { get; set; }
}
}