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((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")] + public partial class OrderPortalClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public OrderPortalClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new EasyMicroservices.PaymentsMicroservice.Clients.MyJsonSerializerSettings(new Newtonsoft.Json.JsonSerializerSettings { }); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + public Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task GetAllByUniqueIdentityAsync(GetUniqueIdentityRequestContract body) + public virtual System.Threading.Tasks.Task CreateOrderPortalAsync(CreateOrderRequestContract body) { - return GetAllByUniqueIdentityAsync(body, System.Threading.CancellationToken.None); + return CreateOrderPortalAsync(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 GetAllByUniqueIdentityAsync(GetUniqueIdentityRequestContract body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task CreateOrderPortalAsync(CreateOrderRequestContract body, System.Threading.CancellationToken cancellationToken) { var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Order/GetAllByUniqueIdentity"); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/OrderPortal/CreateOrderPortal"); var client_ = _httpClient; var disposeClient_ = false; @@ -1114,7 +1252,86 @@ 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); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task OpenPortalAsync(long? id) + { + return OpenPortalAsync(id, 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 OpenPortalAsync(long? id, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/OrderPortal/OpenPortal?"); + if (id != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + 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); diff --git a/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.nswag.json b/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.nswag.json index 1e2e38b..45689dd 100644 --- a/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.nswag.json +++ b/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/Connected Services/PaymentsGeneratedServices/OpenAPI.nswag.json @@ -5,55 +5,6 @@ "version": "1.0" }, "paths": { - "/api/Order/CreateOrder": { - "post": { - "tags": [ - "Order" - ], - "operationId": "CreateOrder", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateOrderRequestContract" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/CreateOrderRequestContract" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/CreateOrderRequestContract" - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/CreateOrderResponseContractMessageContract" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateOrderResponseContractMessageContract" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/CreateOrderResponseContractMessageContract" - } - } - } - } - } - } - }, "/api/Order/Add": { "post": { "tags": [ @@ -672,6 +623,95 @@ } } }, + "/api/OrderPortal/CreateOrderPortal": { + "post": { + "tags": [ + "OrderPortal" + ], + "operationId": "CreateOrderPortal", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateOrderRequestContract" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateOrderRequestContract" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateOrderRequestContract" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/CreateOrderResponseContractMessageContract" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateOrderResponseContractMessageContract" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateOrderResponseContractMessageContract" + } + } + } + } + } + } + }, + "/api/OrderPortal/OpenPortal": { + "get": { + "tags": [ + "OrderPortal" + ], + "operationId": "OpenPortal", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/MessageContract" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageContract" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/MessageContract" + } + } + } + } + } + } + }, "/api/OrderStatusHistory/Add": { "post": { "tags": [ diff --git a/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/EasyMicroservices.PaymentsMicroservice.Clients.csproj b/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/EasyMicroservices.PaymentsMicroservice.Clients.csproj index 369e36f..e6f7b7c 100644 --- a/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/EasyMicroservices.PaymentsMicroservice.Clients.csproj +++ b/src/CSharp/EasyMicroservices.PaymentsMicroservice.Clients/EasyMicroservices.PaymentsMicroservice.Clients.csproj @@ -5,7 +5,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.1 + 0.0.0.2 client generated code. EasyMicroservices@gmail.com microservice,Payment,Payments,client