/* * OpenAPI Petstore * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * * The version of the OpenAPI document: 1.0.0 * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections.Generic; using System.Net; namespace Org.OpenAPITools.Client { /// /// Provides a non-generic contract for the ApiResponse wrapper. /// public interface IApiResponse { /// /// The data type of /// Type ResponseType { get; } /// /// The content of this response /// Object Content { get; } /// /// Gets or sets the status code (HTTP status code) /// /// The status code. HttpStatusCode StatusCode { get; } /// /// Gets or sets the HTTP headers /// /// HTTP headers Multimap Headers { get; } /// /// Gets or sets any error text defined by the calling client. /// string ErrorText { get; set; } /// /// Gets or sets any cookies passed along on the response. /// List Cookies { get; set; } /// /// The raw content of this response /// string RawContent { get; } } /// /// API Response /// public class ApiResponse : IApiResponse { #region Properties /// /// Gets or sets the status code (HTTP status code) /// /// The status code. public HttpStatusCode StatusCode { get; } /// /// Gets or sets the HTTP headers /// /// HTTP headers public Multimap Headers { get; } /// /// Gets or sets the data (parsed HTTP body) /// /// The data. public T Data { get; } /// /// Gets or sets any error text defined by the calling client. /// public string ErrorText { get; set; } /// /// Gets or sets any cookies passed along on the response. /// public List Cookies { get; set; } /// /// The content of this response /// public Type ResponseType { get { return typeof(T); } } /// /// The data type of /// public object Content { get { return Data; } } /// /// The raw content /// public string RawContent { get; } #endregion Properties #region Constructors /// /// Initializes a new instance of the class. /// /// HTTP status code. /// HTTP headers. /// Data (parsed HTTP body) /// Raw content. public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) { StatusCode = statusCode; Headers = headers; Data = data; RawContent = rawContent; } /// /// Initializes a new instance of the class. /// /// HTTP status code. /// HTTP headers. /// Data (parsed HTTP body) public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) { } /// /// Initializes a new instance of the class. /// /// HTTP status code. /// Data (parsed HTTP body) /// Raw content. public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) { } /// /// Initializes a new instance of the class. /// /// HTTP status code. /// Data (parsed HTTP body) public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) { } #endregion Constructors } }