| | | 1 | | /* |
| | | 2 | | * WeShare API |
| | | 3 | | * |
| | | 4 | | * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) |
| | | 5 | | * |
| | | 6 | | * The version of the OpenAPI document: 1.0 |
| | | 7 | | * Generated by: https://github.com/openapitools/openapi-generator.git |
| | | 8 | | */ |
| | | 9 | | |
| | | 10 | | |
| | | 11 | | using System; |
| | | 12 | | using System.Collections.Generic; |
| | | 13 | | using System.Net; |
| | | 14 | | |
| | | 15 | | namespace Applications.WeShare.Swagger.Client |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Provides a non-generic contract for the ApiResponse wrapper. |
| | | 19 | | /// </summary> |
| | | 20 | | public interface IApiResponse |
| | | 21 | | { |
| | | 22 | | /// <summary> |
| | | 23 | | /// The data type of <see cref="Content"/> |
| | | 24 | | /// </summary> |
| | | 25 | | Type ResponseType { get; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// The content of this response |
| | | 29 | | /// </summary> |
| | | 30 | | Object Content { get; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets or sets the status code (HTTP status code) |
| | | 34 | | /// </summary> |
| | | 35 | | /// <value>The status code.</value> |
| | | 36 | | HttpStatusCode StatusCode { get; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets or sets the HTTP headers |
| | | 40 | | /// </summary> |
| | | 41 | | /// <value>HTTP headers</value> |
| | | 42 | | Multimap<string, string> Headers { get; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets or sets any error text defined by the calling client. |
| | | 46 | | /// </summary> |
| | | 47 | | string ErrorText { get; set; } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Gets or sets any cookies passed along on the response. |
| | | 51 | | /// </summary> |
| | | 52 | | List<Cookie> Cookies { get; set; } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// The raw content of this response |
| | | 56 | | /// </summary> |
| | | 57 | | string RawContent { get; } |
| | | 58 | | } |
| | | 59 | | |
| | | 60 | | /// <summary> |
| | | 61 | | /// API Response |
| | | 62 | | /// </summary> |
| | | 63 | | public class ApiResponse<T> : IApiResponse |
| | | 64 | | { |
| | | 65 | | #region Properties |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Gets or sets the status code (HTTP status code) |
| | | 69 | | /// </summary> |
| | | 70 | | /// <value>The status code.</value> |
| | 36 | 71 | | public HttpStatusCode StatusCode { get; } |
| | | 72 | | |
| | | 73 | | /// <summary> |
| | | 74 | | /// Gets or sets the HTTP headers |
| | | 75 | | /// </summary> |
| | | 76 | | /// <value>HTTP headers</value> |
| | 123 | 77 | | public Multimap<string, string> Headers { get; } |
| | | 78 | | |
| | | 79 | | /// <summary> |
| | | 80 | | /// Gets or sets the data (parsed HTTP body) |
| | | 81 | | /// </summary> |
| | | 82 | | /// <value>The data.</value> |
| | 13 | 83 | | public T Data { get; } |
| | | 84 | | |
| | | 85 | | /// <summary> |
| | | 86 | | /// Gets or sets any error text defined by the calling client. |
| | | 87 | | /// </summary> |
| | 54 | 88 | | public string ErrorText { get; set; } |
| | | 89 | | |
| | | 90 | | /// <summary> |
| | | 91 | | /// Gets or sets any cookies passed along on the response. |
| | | 92 | | /// </summary> |
| | 34 | 93 | | public List<Cookie> Cookies { get; set; } |
| | | 94 | | |
| | | 95 | | /// <summary> |
| | | 96 | | /// The content of this response |
| | | 97 | | /// </summary> |
| | | 98 | | public Type ResponseType |
| | | 99 | | { |
| | 0 | 100 | | get { return typeof(T); } |
| | | 101 | | } |
| | | 102 | | |
| | | 103 | | /// <summary> |
| | | 104 | | /// The data type of <see cref="Content"/> |
| | | 105 | | /// </summary> |
| | | 106 | | public object Content |
| | | 107 | | { |
| | 0 | 108 | | get { return Data; } |
| | | 109 | | } |
| | | 110 | | |
| | | 111 | | /// <summary> |
| | | 112 | | /// The raw content |
| | | 113 | | /// </summary> |
| | 42 | 114 | | public string RawContent { get; } |
| | | 115 | | |
| | | 116 | | #endregion Properties |
| | | 117 | | |
| | | 118 | | #region Constructors |
| | | 119 | | |
| | | 120 | | /// <summary> |
| | | 121 | | /// Initializes a new instance of the <see cref="ApiResponse{T}" /> class. |
| | | 122 | | /// </summary> |
| | | 123 | | /// <param name="statusCode">HTTP status code.</param> |
| | | 124 | | /// <param name="headers">HTTP headers.</param> |
| | | 125 | | /// <param name="data">Data (parsed HTTP body)</param> |
| | | 126 | | /// <param name="rawContent">Raw content.</param> |
| | 34 | 127 | | public ApiResponse(HttpStatusCode statusCode, Multimap<string, string> headers, T data, string rawContent) |
| | 34 | 128 | | { |
| | 34 | 129 | | StatusCode = statusCode; |
| | 34 | 130 | | Headers = headers; |
| | 34 | 131 | | Data = data; |
| | 34 | 132 | | RawContent = rawContent; |
| | 34 | 133 | | } |
| | | 134 | | |
| | | 135 | | /// <summary> |
| | | 136 | | /// Initializes a new instance of the <see cref="ApiResponse{T}" /> class. |
| | | 137 | | /// </summary> |
| | | 138 | | /// <param name="statusCode">HTTP status code.</param> |
| | | 139 | | /// <param name="headers">HTTP headers.</param> |
| | | 140 | | /// <param name="data">Data (parsed HTTP body)</param> |
| | 0 | 141 | | public ApiResponse(HttpStatusCode statusCode, Multimap<string, string> headers, T data) : this(statusCode, heade |
| | 0 | 142 | | { |
| | 0 | 143 | | } |
| | | 144 | | |
| | | 145 | | /// <summary> |
| | | 146 | | /// Initializes a new instance of the <see cref="ApiResponse{T}" /> class. |
| | | 147 | | /// </summary> |
| | | 148 | | /// <param name="statusCode">HTTP status code.</param> |
| | | 149 | | /// <param name="data">Data (parsed HTTP body)</param> |
| | | 150 | | /// <param name="rawContent">Raw content.</param> |
| | 0 | 151 | | public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawConte |
| | 0 | 152 | | { |
| | 0 | 153 | | } |
| | | 154 | | |
| | | 155 | | /// <summary> |
| | | 156 | | /// Initializes a new instance of the <see cref="ApiResponse{T}" /> class. |
| | | 157 | | /// </summary> |
| | | 158 | | /// <param name="statusCode">HTTP status code.</param> |
| | | 159 | | /// <param name="data">Data (parsed HTTP body)</param> |
| | 0 | 160 | | public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) |
| | 0 | 161 | | { |
| | 0 | 162 | | } |
| | | 163 | | |
| | | 164 | | #endregion Constructors |
| | | 165 | | } |
| | | 166 | | } |