< Summary

Information
Class: /home/wethinkcode/student_work/csharp/GroupProject/super-cool-group/weshare-qa/GeneratedApiCode/src/Applications.WeShare.Swagger/Client/ApiResponse.cs
Assembly: Default
File(s): /home/wethinkcode/student_work/csharp/GroupProject/super-cool-group/weshare-qa/GeneratedApiCode/src/Applications.WeShare.Swagger/Client/ApiResponse.cs
Line coverage
54%
Covered lines: 13
Uncovered lines: 11
Coverable lines: 24
Total lines: 166
Line coverage: 54.1%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

/home/wethinkcode/student_work/csharp/GroupProject/super-cool-group/weshare-qa/GeneratedApiCode/src/Applications.WeShare.Swagger/Client/ApiResponse.cs

#LineLine coverage
 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
 11using System;
 12using System.Collections.Generic;
 13using System.Net;
 14
 15namespace 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>
 3671        public HttpStatusCode StatusCode { get; }
 72
 73        /// <summary>
 74        /// Gets or sets the HTTP headers
 75        /// </summary>
 76        /// <value>HTTP headers</value>
 12377        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>
 1383        public T Data { get; }
 84
 85        /// <summary>
 86        /// Gets or sets any error text defined by the calling client.
 87        /// </summary>
 5488        public string ErrorText { get; set; }
 89
 90        /// <summary>
 91        /// Gets or sets any cookies passed along on the response.
 92        /// </summary>
 3493        public List<Cookie> Cookies { get; set; }
 94
 95        /// <summary>
 96        /// The content of this response
 97        /// </summary>
 98        public Type ResponseType
 99        {
 0100            get { return typeof(T); }
 101        }
 102
 103        /// <summary>
 104        /// The data type of <see cref="Content"/>
 105        /// </summary>
 106        public object Content
 107        {
 0108            get { return Data; }
 109        }
 110
 111        /// <summary>
 112        /// The raw content
 113        /// </summary>
 42114        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>
 34127        public ApiResponse(HttpStatusCode statusCode, Multimap<string, string> headers, T data, string rawContent)
 34128        {
 34129            StatusCode = statusCode;
 34130            Headers = headers;
 34131            Data = data;
 34132            RawContent = rawContent;
 34133        }
 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>
 0141        public ApiResponse(HttpStatusCode statusCode, Multimap<string, string> headers, T data) : this(statusCode, heade
 0142        {
 0143        }
 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>
 0151        public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawConte
 0152        {
 0153        }
 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>
 0160        public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null)
 0161        {
 0162        }
 163
 164        #endregion Constructors
 165    }
 166}