diff --git a/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.cs b/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.cs
index 3a657c4..c9c4f92 100644
--- a/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.cs
+++ b/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.cs
@@ -55,18 +55,18 @@ public string BaseUrl
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task CreateOrderAsync(CreateOrderRequestContract body)
+ public virtual System.Threading.Tasks.Task AddAsync(CreateOrderRequestContract body)
{
- return CreateOrderAsync(body, System.Threading.CancellationToken.None);
+ return AddAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CreateOrderAsync(CreateOrderRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task AddAsync(CreateOrderRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/CreateOrder");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/Add");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -104,7 +104,7 @@ public virtual async System.Threading.Tasks.Task(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -133,18 +133,18 @@ public virtual async System.Threading.Tasks.TaskSuccess
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task AddAsync(CreateOrderRequestContract body)
+ public virtual System.Threading.Tasks.Task AddBulkAsync(CreateOrderRequestContractCreateBulkRequestContract body)
{
- return AddAsync(body, System.Threading.CancellationToken.None);
+ return AddBulkAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task AddAsync(CreateOrderRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task AddBulkAsync(CreateOrderRequestContractCreateBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/Add");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/AddBulk");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -182,7 +182,7 @@ public virtual async System.Threading.Tasks.Task AddAsync(
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -211,18 +211,18 @@ public virtual async System.Threading.Tasks.Task AddAsync(
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task AddBulkAsync(CreateOrderRequestContractCreateBulkRequestContract body)
+ public virtual System.Threading.Tasks.Task UpdateAsync(UpdateOrderRequestContract body)
{
- return AddBulkAsync(body, System.Threading.CancellationToken.None);
+ return UpdateAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task AddBulkAsync(CreateOrderRequestContractCreateBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task UpdateAsync(UpdateOrderRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/AddBulk");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/Update");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -234,7 +234,7 @@ public virtual async System.Threading.Tasks.Task AddBulkAsync(C
var content_ = new System.Net.Http.StringContent(json_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
- request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Method = new System.Net.Http.HttpMethod("PUT");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
PrepareRequest(client_, request_, urlBuilder_);
@@ -260,7 +260,7 @@ public virtual async System.Threading.Tasks.Task AddBulkAsync(C
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -289,18 +289,18 @@ public virtual async System.Threading.Tasks.Task AddBulkAsync(C
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task UpdateAsync(UpdateOrderRequestContract body)
+ public virtual System.Threading.Tasks.Task UpdateBulkAsync(UpdateOrderRequestContractUpdateBulkRequestContract body)
{
- return UpdateAsync(body, System.Threading.CancellationToken.None);
+ return UpdateBulkAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task UpdateAsync(UpdateOrderRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task UpdateBulkAsync(UpdateOrderRequestContractUpdateBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/Update");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/UpdateBulk");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -338,7 +338,7 @@ public virtual async System.Threading.Tasks.Task U
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -367,18 +367,18 @@ public virtual async System.Threading.Tasks.Task U
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task UpdateBulkAsync(UpdateOrderRequestContractUpdateBulkRequestContract body)
+ public virtual System.Threading.Tasks.Task HardDeleteByIdAsync(Int64DeleteRequestContract body)
{
- return UpdateBulkAsync(body, System.Threading.CancellationToken.None);
+ return HardDeleteByIdAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task UpdateBulkAsync(UpdateOrderRequestContractUpdateBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task HardDeleteByIdAsync(Int64DeleteRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/UpdateBulk");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/HardDeleteById");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -390,7 +390,7 @@ public virtual async System.Threading.Tasks.Task UpdateBulkAsyn
var content_ = new System.Net.Http.StringContent(json_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
- request_.Method = new System.Net.Http.HttpMethod("PUT");
+ request_.Method = new System.Net.Http.HttpMethod("DELETE");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
PrepareRequest(client_, request_, urlBuilder_);
@@ -445,18 +445,18 @@ public virtual async System.Threading.Tasks.Task UpdateBulkAsyn
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task HardDeleteByIdAsync(Int64DeleteRequestContract body)
+ public virtual System.Threading.Tasks.Task HardDeleteBulkByIdsAsync(Int64DeleteBulkRequestContract body)
{
- return HardDeleteByIdAsync(body, System.Threading.CancellationToken.None);
+ return HardDeleteBulkByIdsAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task HardDeleteByIdAsync(Int64DeleteRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task HardDeleteBulkByIdsAsync(Int64DeleteBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/HardDeleteById");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/HardDeleteBulkByIds");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -523,18 +523,18 @@ public virtual async System.Threading.Tasks.Task HardDeleteById
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task HardDeleteBulkByIdsAsync(Int64DeleteBulkRequestContract body)
+ public virtual System.Threading.Tasks.Task SoftDeleteByIdAsync(Int64SoftDeleteRequestContract body)
{
- return HardDeleteBulkByIdsAsync(body, System.Threading.CancellationToken.None);
+ return SoftDeleteByIdAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task HardDeleteBulkByIdsAsync(Int64DeleteBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task SoftDeleteByIdAsync(Int64SoftDeleteRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/HardDeleteBulkByIds");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/SoftDeleteById");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -601,18 +601,18 @@ public virtual async System.Threading.Tasks.Task HardDeleteBulk
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task SoftDeleteByIdAsync(Int64SoftDeleteRequestContract body)
+ public virtual System.Threading.Tasks.Task SoftDeleteBulkByIdsAsync(Int64SoftDeleteBulkRequestContract body)
{
- return SoftDeleteByIdAsync(body, System.Threading.CancellationToken.None);
+ return SoftDeleteBulkByIdsAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task SoftDeleteByIdAsync(Int64SoftDeleteRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task SoftDeleteBulkByIdsAsync(Int64SoftDeleteBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/SoftDeleteById");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/SoftDeleteBulkByIds");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -679,18 +679,18 @@ public virtual async System.Threading.Tasks.Task SoftDeleteById
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task SoftDeleteBulkByIdsAsync(Int64SoftDeleteBulkRequestContract body)
+ public virtual System.Threading.Tasks.Task GetByIdAsync(Int64GetIdRequestContract body)
{
- return SoftDeleteBulkByIdsAsync(body, System.Threading.CancellationToken.None);
+ return GetByIdAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task SoftDeleteBulkByIdsAsync(Int64SoftDeleteBulkRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetByIdAsync(Int64GetIdRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/SoftDeleteBulkByIds");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetById");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -702,7 +702,7 @@ public virtual async System.Threading.Tasks.Task SoftDeleteBulk
var content_ = new System.Net.Http.StringContent(json_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
- request_.Method = new System.Net.Http.HttpMethod("DELETE");
+ request_.Method = new System.Net.Http.HttpMethod("POST");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
PrepareRequest(client_, request_, urlBuilder_);
@@ -728,7 +728,7 @@ public virtual async System.Threading.Tasks.Task SoftDeleteBulk
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -757,18 +757,18 @@ public virtual async System.Threading.Tasks.Task SoftDeleteBulk
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task GetByIdAsync(Int64GetIdRequestContract body)
+ public virtual System.Threading.Tasks.Task GetByUniqueIdentityAsync(GetUniqueIdentityRequestContract body)
{
- return GetByIdAsync(body, System.Threading.CancellationToken.None);
+ return GetByUniqueIdentityAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task GetByIdAsync(Int64GetIdRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetByUniqueIdentityAsync(GetUniqueIdentityRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetById");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetByUniqueIdentity");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -835,18 +835,18 @@ public virtual async System.Threading.Tasks.Task G
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task GetByUniqueIdentityAsync(GetUniqueIdentityRequestContract body)
+ public virtual System.Threading.Tasks.Task FilterAsync(FilterRequestContract body)
{
- return GetByUniqueIdentityAsync(body, System.Threading.CancellationToken.None);
+ return FilterAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task GetByUniqueIdentityAsync(GetUniqueIdentityRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task FilterAsync(FilterRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetByUniqueIdentity");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/Filter");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -884,7 +884,7 @@ public virtual async System.Threading.Tasks.Task G
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -913,18 +913,18 @@ public virtual async System.Threading.Tasks.Task G
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task FilterAsync(FilterRequestContract body)
+ public virtual System.Threading.Tasks.Task GetAllAsync()
{
- return FilterAsync(body, System.Threading.CancellationToken.None);
+ return GetAllAsync(System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task FilterAsync(FilterRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetAllAsync(System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/Filter");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetAll");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -932,11 +932,7 @@ public virtual async System.Threading.Tasks.TaskSuccess
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task GetAllAsync()
+ public virtual System.Threading.Tasks.Task GetAllByUniqueIdentityAsync(GetUniqueIdentityRequestContract body)
{
- return GetAllAsync(System.Threading.CancellationToken.None);
+ return GetAllByUniqueIdentityAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task GetAllAsync(System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetAllByUniqueIdentityAsync(GetUniqueIdentityRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetAll");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetAllByUniqueIdentity");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -1010,7 +1006,11 @@ public virtual async System.Threading.Tasks.Task
+ {
+ public ObjectResponseResult(T responseObject, string responseText)
+ {
+ this.Object = responseObject;
+ this.Text = responseText;
+ }
+
+ public T Object { get; }
+
+ public string Text { get; }
+ }
+
+ public bool ReadResponseAsString { get; set; }
+
+ protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken)
+ {
+ if (response == null || response.Content == null)
+ {
+ return new ObjectResponseResult(default(T), string.Empty);
+ }
+
+ if (ReadResponseAsString)
+ {
+ var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings);
+ return new ObjectResponseResult(typedBody, responseText);
+ }
+ catch (Newtonsoft.Json.JsonException exception)
+ {
+ var message = "Could not deserialize the response body string as " + typeof(T).FullName + ".";
+ throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception);
+ }
+ }
+ else
+ {
+ try
+ {
+ using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
+ using (var streamReader = new System.IO.StreamReader(responseStream))
+ using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader))
+ {
+ var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings);
+ var typedBody = serializer.Deserialize(jsonTextReader);
+ return new ObjectResponseResult(typedBody, string.Empty);
+ }
+ }
+ catch (Newtonsoft.Json.JsonException exception)
+ {
+ var message = "Could not deserialize the response body stream as " + typeof(T).FullName + ".";
+ throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception);
+ }
+ }
+ }
+
+ private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo)
+ {
+ if (value == null)
+ {
+ return "";
+ }
+
+ if (value is System.Enum)
+ {
+ var name = System.Enum.GetName(value.GetType(), value);
+ if (name != null)
+ {
+ var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
+ if (field != null)
+ {
+ var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute))
+ as System.Runtime.Serialization.EnumMemberAttribute;
+ if (attribute != null)
+ {
+ return attribute.Value != null ? attribute.Value : name;
+ }
+ }
+
+ var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo));
+ return converted == null ? string.Empty : converted;
+ }
+ }
+ else if (value is bool)
+ {
+ return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant();
+ }
+ else if (value is byte[])
+ {
+ return System.Convert.ToBase64String((byte[]) value);
+ }
+ else if (value.GetType().IsArray)
+ {
+ var array = System.Linq.Enumerable.OfType