// <auto-generated>
{{>partial_header}}
{{#nrt}}
#nullable enable

{{/nrt}}
using System;

namespace {{packageName}}.{{clientPackage}}
{
    /// <summary>
    /// API Exception
    /// </summary>
    {{>visibility}} class ApiException : Exception
    {
        /// <summary>
        /// The reason the api request failed
        /// </summary>
        public string{{nrt?}} ReasonPhrase { get; }

        /// <summary>
        /// The HttpStatusCode
        /// </summary>
        public System.Net.HttpStatusCode StatusCode { get; }

        /// <summary>
        /// The raw data returned by the api
        /// </summary>
        public string RawContent { get; }
        
        /// <summary>
        /// Construct the ApiException from parts of the response
        /// </summary>
        /// <param name="reasonPhrase"></param>
        /// <param name="statusCode"></param>
        /// <param name="rawContent"></param>
        public ApiException(string{{nrt?}} reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent)
        {
            ReasonPhrase = reasonPhrase;

            StatusCode = statusCode;

            RawContent = rawContent;
        }
    }
}
