//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace DemoWebApi.DemoData.Client
{
	
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class Address : object
	{
		
		/// <summary>
		/// String length: inclusive between 2 and 50
		/// </summary>
		[System.ComponentModel.DataAnnotations.StringLength(50, MinimumLength=2)]
		[System.Runtime.Serialization.DataMember()]
		public string City { get; set; }
		
		/// <summary>
		/// String length: inclusive between 2 and 30
		/// </summary>
		[System.ComponentModel.DefaultValueAttribute("Australia")]
		[System.ComponentModel.DataAnnotations.StringLength(30, MinimumLength=2)]
		[System.Runtime.Serialization.DataMember()]
		public string Country { get; set; } = "Australia";
		
		[System.Runtime.Serialization.DataMember()]
		public System.Guid Id { get; set; }
		
		/// <summary>
		/// String length: inclusive between 2 and 10
		/// </summary>
		[System.ComponentModel.DataAnnotations.StringLength(10, MinimumLength=2)]
		[System.Runtime.Serialization.DataMember()]
		public string PostalCode { get; set; }
		
		/// <summary>
		/// String length: inclusive between 2 and 30
		/// </summary>
		[System.ComponentModel.DataAnnotations.StringLength(30, MinimumLength=2)]
		[System.Runtime.Serialization.DataMember()]
		public string State { get; set; }
		
		/// <summary>
		/// String length: inclusive between 2 and 100
		/// </summary>
		[System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength=2)]
		[System.Runtime.Serialization.DataMember()]
		public string Street1 { get; set; }
		
		/// <summary>
		/// String length: inclusive between 2 and 100
		/// </summary>
		[System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength=2)]
		[System.Runtime.Serialization.DataMember()]
		public string Street2 { get; set; }
		
		[System.ComponentModel.DefaultValueAttribute(AddressType.Residential)]
		[System.Runtime.Serialization.DataMember()]
		public DemoWebApi.DemoData.Client.AddressType Type { get; set; } = AddressType.Residential;
		
		/// <summary>
		/// It is a field
		/// </summary>
		[System.Runtime.Serialization.DataMember()]
		public DemoWebApi.DemoData.Another.Client.MyPoint Location { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public enum AddressType
	{
		
		[System.Runtime.Serialization.EnumMember()]
		Postal,
		
		[System.Runtime.Serialization.EnumMember()]
		Residential,
	}
	
	/// <summary>
	/// </summary>
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class BigNumbers : object
	{
		
		[System.Runtime.Serialization.DataMember()]
		public System.Numerics.BigInteger BigInt { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Int128 Signed128 { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public long Signed64 { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.UInt128 Unsigned128 { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public ulong Unsigned64 { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class Company : DemoWebApi.DemoData.Base.Client.Entity
	{
		
		/// <summary>
		/// BusinessNumber to be serialized as BusinessNum
		/// </summary>
		[System.Runtime.Serialization.DataMember(Name="BusinessNum")]
		public string BusinessNumber { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string BusinessNumberType { get; set; }
		
		/// <summary>
		/// Data type: Date
		/// </summary>
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Date)]
		[System.Runtime.Serialization.DataMember()]
		public System.DateTimeOffset FoundDate { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.DateOnly RegisterDate { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string[][] TextMatrix { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public int[,] Int2D { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public int[][] Int2DJagged { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Collections.Generic.IEnumerable<string> Lines { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public enum Days
	{
		
		[System.Runtime.Serialization.EnumMember()]
		Sat = 1,
		
		[System.Runtime.Serialization.EnumMember()]
		Sun = 2,
		
		[System.Runtime.Serialization.EnumMember()]
		Mon = 3,
		
		[System.Runtime.Serialization.EnumMember()]
		Tue = 4,
		
		[System.Runtime.Serialization.EnumMember()]
		Wed = 5,
		
		/// <summary>
		/// Thursday
		/// </summary>
		[System.Runtime.Serialization.EnumMember()]
		Thu = 6,
		
		[System.Runtime.Serialization.EnumMember()]
		Fri = 7,
	}
	
	/// <summary>
	/// To test different serializations against Guid
	/// </summary>
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class IdMap : object
	{
		
		[System.Runtime.Serialization.DataMember()]
		public System.Guid Id { get; set; }
		
		[System.Runtime.Serialization.DataMember(EmitDefaultValue=false)]
		public System.Guid IdNotEmitDefaultValue { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Nullable<System.Guid> NullableId { get; set; }
		
		/// <summary>
		/// Required
		/// </summary>
		[System.ComponentModel.DataAnnotations.RequiredAttribute()]
		[System.Runtime.Serialization.DataMember(IsRequired =true)]
		public string RequiredName { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string Text { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class IntegralEntity : DemoWebApi.DemoData.Base.Client.Entity
	{
		
		[System.Runtime.Serialization.DataMember()]
		public byte Byte { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public int Int { get; set; }
		
		/// <summary>
		/// Range: inclusive between -1000 and 1000000
		/// </summary>
		[System.ComponentModel.DataAnnotations.Range(typeof(System.Int32), "-1000", "1000000")]
		[System.Runtime.Serialization.DataMember()]
		public int ItemCount { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public sbyte SByte { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public short Short { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public uint UInt { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public ushort UShort { get; set; }
	}
	
	[System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))]
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public enum MedicalContraindiationResponseTypeReason
	{
		
		[System.Runtime.Serialization.EnumMember(Value="Mm")]
		M,
		
		[System.Runtime.Serialization.EnumMember(Value="Ss")]
		S,
		
		[System.Runtime.Serialization.EnumMember(Value="Pp")]
		P,
		
		[System.Runtime.Serialization.EnumMember(Value="I")]
		I,
		
		[System.Runtime.Serialization.EnumMember(Value="A")]
		A,
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public enum MedicalContraindiationResponseTypeTypeCode
	{
		
		[System.Runtime.Serialization.EnumMember(Value="P")]
		P,
		
		[System.Runtime.Serialization.EnumMember(Value="Tt")]
		T,
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class MimsPackage : object
	{
		
		/// <summary>
		/// Range: inclusive between 10 and 100
		/// </summary>
		[System.ComponentModel.DefaultValueAttribute(20)]
		[System.ComponentModel.DataAnnotations.Range(typeof(System.Int32), "10", "100", ErrorMessage="KK has to be between 10 and 100.")]
		[System.Runtime.Serialization.DataMember()]
		public int KK { get; set; } = 20;
		
		/// <summary>
		/// Having an initialized value in the property is not like defining a DefaultValueAttribute. Such intialization happens at run time,
		/// and there's no reliable way for a codegen to know if the value is declared by the programmer, or is actually the natural default value like 0.
		/// </summary>
		[System.Runtime.Serialization.DataMember()]
		public int KK2 { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Nullable<DemoWebApi.DemoData.Client.MyEnumType> OptionalEnum { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Nullable<int> OptionalInt { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public DemoWebApi.DemoData.Client.MimsResult<decimal> Result { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string Tag { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class MimsResult<T> : object
	{
		
		[System.Runtime.Serialization.DataMember()]
		public System.DateTime GeneratedAt { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string Message { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public T Result { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public bool Success { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public enum MyEnumType
	{
		
		[System.Runtime.Serialization.EnumMember()]
		First = 1,
		
		[System.Runtime.Serialization.EnumMember()]
		Two = 2,
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class MyGeneric<T, K, U> : object
	{
		
		[System.Runtime.Serialization.DataMember()]
		public K MyK { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public T MyT { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public U MyU { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string Status { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class MyPeopleDic : object
	{
		
		[System.Runtime.Serialization.DataMember()]
		public System.Collections.Generic.IDictionary<string, string> AnotherDic { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Collections.Generic.IDictionary<string, DemoWebApi.DemoData.Client.Person> Dic { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Collections.Generic.IDictionary<int, string> IntDic { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class Person : DemoWebApi.DemoData.Base.Client.Entity
	{
		
		/// <summary>
		/// Data type: Date
		/// </summary>
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Date)]
		[System.Runtime.Serialization.DataMember()]
		public System.Nullable<System.DateTimeOffset> Baptised { get; set; }
		
		/// <summary>
		/// Date of Birth.
		/// This is optional.
		/// </summary>
		[System.Runtime.Serialization.DataMember()]
		public System.Nullable<System.DateOnly> DOB { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string GivenName { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public string Surname { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class PhoneNumber : object
	{
		
		/// <summary>
		/// Max length: 120
		/// </summary>
		[System.ComponentModel.DataAnnotations.MaxLength(120)]
		[System.Runtime.Serialization.DataMember()]
		public string FullNumber { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public DemoWebApi.DemoData.Client.PhoneType PhoneType { get; set; }
	}
	
	/// <summary>
	/// Phone type
	/// Tel, Mobile, Skyp and Fax
	/// 
	/// </summary>
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public enum PhoneType
	{
		
		/// <summary>
		/// Land line
		/// </summary>
		[System.Runtime.Serialization.EnumMember()]
		Tel,
		
		/// <summary>
		/// Mobile phone
		/// </summary>
		[System.Runtime.Serialization.EnumMember()]
		Mobile,
		
		[System.Runtime.Serialization.EnumMember()]
		Skype,
		
		[System.Runtime.Serialization.EnumMember()]
		Fax,
	}
}
namespace DemoWebApi.DemoData.Another.Client
{
	
	
	/// <summary>
	/// 2D position
	/// with X and Y
	/// for Demo
	/// </summary>
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public struct MyPoint
	{
		
		/// <summary>
		/// X
		/// </summary>
		public double X;
		
		/// <summary>
		/// Y
		/// </summary>
		public double Y;
	}
}
namespace DemoWebApi.DemoData.Base.Client
{
	
	
	/// <summary>
	/// Base class of company and person
	/// </summary>
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class Entity : object
	{
		
		/// <summary>
		/// Multiple addresses
		/// </summary>
		[System.Runtime.Serialization.DataMember()]
		public System.Collections.Generic.IList<DemoWebApi.DemoData.Client.Address> Addresses { get; set; }
		
		/// <summary>
		/// Max length: 255
		/// </summary>
		[System.ComponentModel.DataAnnotations.MaxLength(255)]
		[System.Runtime.Serialization.DataMember()]
		public string EmailAddress { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Nullable<System.Guid> Id { get; set; }
		
		/// <summary>
		/// Name of the entity.
		/// Required
		/// Min length: 2
		/// Max length: 255
		/// </summary>
		[System.ComponentModel.DataAnnotations.RequiredAttribute()]
		[System.ComponentModel.DataAnnotations.MinLength(2)]
		[System.ComponentModel.DataAnnotations.MaxLength(255)]
		[System.Runtime.Serialization.DataMember(IsRequired =true)]
		public string Name { get; set; }
		
		[System.Runtime.Serialization.DataMember()]
		public System.Collections.ObjectModel.ObservableCollection<DemoWebApi.DemoData.Client.PhoneNumber> PhoneNumbers { get; set; }
		
		/// <summary>
		/// Matching regular expression pattern: https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)
		/// </summary>
		[System.ComponentModel.DataAnnotations.RegularExpressionAttribute(@"https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)")]
		[System.Runtime.Serialization.DataMember()]
		public System.Uri Web { get; set; }
	}
}
namespace DemoWebApi.Models.Client
{
	
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class AddExternalLoginBindingModel : object
	{
		
		/// <summary>
		/// Required
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		public string ExternalAccessToken { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class ChangePasswordBindingModel : object
	{
		
		/// <summary>
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string ConfirmPassword { get; set; }
		
		/// <summary>
		/// Required
		/// String length: inclusive between 6 and 100
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.RequiredAttribute()]
		[System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength=6, ErrorMessage="The {0} must be at least {2} characters long.")]
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string NewPassword { get; set; }
		
		/// <summary>
		/// Required
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.RequiredAttribute()]
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string OldPassword { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class RegisterBindingModel : object
	{
		
		/// <summary>
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string ConfirmPassword { get; set; }
		
		/// <summary>
		/// Required
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		public string Email { get; set; }
		
		/// <summary>
		/// Required
		/// String length: inclusive between 6 and 100
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		[System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength=6, ErrorMessage="The {0} must be at least {2} characters long.")]
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string Password { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class RegisterExternalBindingModel : object
	{
		
		/// <summary>
		/// Required
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		public string Email { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class RemoveLoginBindingModel : object
	{
		
		/// <summary>
		/// Required
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		public string LoginProvider { get; set; }
		
		/// <summary>
		/// Required
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		public string ProviderKey { get; set; }
	}
	
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class SetPasswordBindingModel : object
	{
		
		/// <summary>
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string ConfirmPassword { get; set; }
		
		/// <summary>
		/// Required
		/// String length: inclusive between 6 and 100
		/// Data type: Password
		/// </summary>
		[System.ComponentModel.DataAnnotations.Required()]
		[System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength=6, ErrorMessage="The {0} must be at least {2} characters long.")]
		[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
		public string NewPassword { get; set; }
	}
	
	/// <summary>
	/// Auth token
	/// </summary>
	[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
	[System.SerializableAttribute()]
	public class TokenResponseModel : object
	{
		
		[System.Runtime.Serialization.DataMember(Name="access_token")]
		public string AccessToken { get; set; }
		
		[System.Runtime.Serialization.DataMember(Name="expires")]
		public string Expires { get; set; }
		
		[System.Runtime.Serialization.DataMember(Name="expires_in")]
		public int ExpiresIn { get; set; }
		
		[System.Runtime.Serialization.DataMember(Name="issued")]
		public string Issued { get; set; }
		
		[System.Runtime.Serialization.DataMember(Name="token_type")]
		public string TokenType { get; set; }
		
		[System.Runtime.Serialization.DataMember(Name="username")]
		public string Username { get; set; }
	}
}
namespace DebugWeb.Controllers.Client
{
	using System;
	using System.Linq;
	using System.Collections.Generic;
	using System.Threading.Tasks;
	using System.Net.Http;
	using System.Text.Json;
	using System.Text.Json.Serialization;
	using Fonlow.Net.Http;
	
	
	public partial class Dummy
	{
		
		private System.Net.Http.HttpClient client;
		
		private JsonSerializerOptions jsonSerializerSettings;
		
		public Dummy(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null)
		{
			if (client == null)
				throw new ArgumentNullException(nameof(client), "Null HttpClient.");

			if (client.BaseAddress == null)
				throw new ArgumentNullException(nameof(client), "HttpClient has no BaseAddress");

			this.client = client;
			this.jsonSerializerSettings = jsonSerializerSettings;
		}
		
		/// <summary>
		/// POST Dummy/createPerson
		/// </summary>
		public async Task<DemoWebApi.DemoData.Client.Person> CreatePersonAsync(DemoWebApi.DemoData.Client.Person p, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/createPerson";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
			var contentJson = JsonSerializer.Serialize(p, jsonSerializerSettings);
			var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json");
			httpRequestMessage.Content = content;
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<DemoWebApi.DemoData.Client.Person>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// POST Dummy/createPerson2
		/// </summary>
		public async Task<DemoWebApi.DemoData.Client.Person> CreatePerson2Async(DemoWebApi.DemoData.Client.Person p, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/createPerson2";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
			var contentJson = JsonSerializer.Serialize(p, jsonSerializerSettings);
			var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json");
			httpRequestMessage.Content = content;
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<DemoWebApi.DemoData.Client.Person>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// POST Dummy/createPersonByAdmin
		/// Status Codes: 404:NotFound, 204:NoContent, 422:UnprocessableEntity
		/// </summary>
		public async Task<DemoWebApi.DemoData.Client.Person> CreatePersonByAdminAsync(DemoWebApi.DemoData.Client.Person p, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/createPersonByAdmin";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
			var contentJson = JsonSerializer.Serialize(p, jsonSerializerSettings);
			var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json");
			httpRequestMessage.Content = content;
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<DemoWebApi.DemoData.Client.Person>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// POST Dummy/createPersonWeak
		/// Status Codes: 404:NotFound, 204:NoContent, 200:OK : DemoWebApi.DemoData.Person
		/// </summary>
		public async Task<DemoWebApi.DemoData.Client.Person> CreatePersonWeakAsync(DemoWebApi.DemoData.Client.Person p, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/createPersonWeak";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
			var contentJson = JsonSerializer.Serialize(p, jsonSerializerSettings);
			var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json");
			httpRequestMessage.Content = content;
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<DemoWebApi.DemoData.Client.Person>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// POST Dummy/createPersonWithNotFound
		/// Status Codes: 404:NotFound
		/// </summary>
		public async Task<DemoWebApi.DemoData.Client.Person> CreatePersonWithNotFoundAsync(DemoWebApi.DemoData.Client.Person p, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/createPersonWithNotFound";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
			var contentJson = JsonSerializer.Serialize(p, jsonSerializerSettings);
			var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json");
			httpRequestMessage.Content = content;
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<DemoWebApi.DemoData.Client.Person>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// POST Dummy/createPersonWithStatuses
		/// Status Codes: 404:NotFound, 204:NoContent, 422:UnprocessableEntity
		/// </summary>
		public async Task<DemoWebApi.DemoData.Client.Person> CreatePersonWithStatusesAsync(DemoWebApi.DemoData.Client.Person p, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/createPersonWithStatuses";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
			var contentJson = JsonSerializer.Serialize(p, jsonSerializerSettings);
			var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json");
			httpRequestMessage.Content = content;
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<DemoWebApi.DemoData.Client.Person>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// DELETE Dummy/{id}
		/// </summary>
		public async Task DeleteAsync(long id, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/"+id;
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri);
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
		
		/// <summary>
		/// GET Dummy/AnonymousDynamic
		/// </summary>
		public async Task<System.Text.Json.Nodes.JsonObject> GetAnonymousDynamicAsync(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
		{
			var requestUri = "Dummy/AnonymousDynamic";
			using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri);
			handleHeaders?.Invoke(httpRequestMessage.Headers);
			var responseMessage = await client.SendAsync(httpRequestMessage);
			try
			{
				responseMessage.EnsureSuccessStatusCodeEx();
				if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; }
				var contentString = await responseMessage.Content.ReadAsStringAsync();
				return JsonSerializer.Deserialize<System.Text.Json.Nodes.JsonObject>(contentString, jsonSerializerSettings);
			}
			finally
			{
				responseMessage.Dispose();
			}
		}
	}
}

namespace Fonlow.Net.Http
{
	using System.Net.Http;

	public class WebApiRequestException : HttpRequestException
	{
		public new System.Net.HttpStatusCode StatusCode { get; private set; }

		public string Response { get; private set; }

		public System.Net.Http.Headers.HttpResponseHeaders Headers { get; private set; }

		public System.Net.Http.Headers.MediaTypeHeaderValue ContentType { get; private set; }

		public WebApiRequestException(string message, System.Net.HttpStatusCode statusCode, string response, System.Net.Http.Headers.HttpResponseHeaders headers, System.Net.Http.Headers.MediaTypeHeaderValue contentType) : base(message)
		{
			StatusCode = statusCode;
			Response = response;
			Headers = headers;
			ContentType = contentType;
		}
	}

	public static class ResponseMessageExtensions
	{
		public static void EnsureSuccessStatusCodeEx(this HttpResponseMessage responseMessage)
		{
			if (!responseMessage.IsSuccessStatusCode)
			{
				var responseText = responseMessage.Content.ReadAsStringAsync().Result;
				var contentType = responseMessage.Content.Headers.ContentType;
				throw new WebApiRequestException(responseMessage.ReasonPhrase, responseMessage.StatusCode, responseText, responseMessage.Headers, contentType);
			}
		}
	}
}
