diff --git a/src/AdminAssistant.UI/Shared/WebAPIClient/v1/AdminAssistantWebAPIClientCodeGen.cs b/src/AdminAssistant.UI/Shared/WebAPIClient/v1/AdminAssistantWebAPIClientCodeGen.cs index 707b0ba3..2e784440 100644 --- a/src/AdminAssistant.UI/Shared/WebAPIClient/v1/AdminAssistantWebAPIClientCodeGen.cs +++ b/src/AdminAssistant.UI/Shared/WebAPIClient/v1/AdminAssistantWebAPIClientCodeGen.cs @@ -1237,6 +1237,194 @@ public async System.Threading.Tasks.Task GetBankByIdAsync(int b } } + /// Update an existing Currency. + /// Ok - returns the updated CurrencyResponseDto + /// A server side error occurred. + public System.Threading.Tasks.Task PutCurrencyAsync(CurrencyUpdateRequestDto? body) + { + return PutCurrencyAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Update an existing Currency. + /// Ok - returns the updated CurrencyResponseDto + /// A server side error occurred. + public async System.Threading.Tasks.Task PutCurrencyAsync(CurrencyUpdateRequestDto? body, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/v1/core-module/Currency"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + 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); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + 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); + } + throw new ApiException("NotFound - When the BankID of the given currencyUpdateRequest does not exist.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 422) + { + 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); + } + throw new ApiException("UnprocessableEntity - When the given currencyUpdateRequest is invalid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + 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(); + } + } + + /// Creates a new Currency. + /// Created - returns the created currency with its assigned newly ID. + /// A server side error occurred. + public System.Threading.Tasks.Task PostCurrencyAsync(CurrencyCreateRequestDto? body) + { + return PostCurrencyAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Creates a new Currency. + /// Created - returns the created currency with its assigned newly ID. + /// A server side error occurred. + public async System.Threading.Tasks.Task PostCurrencyAsync(CurrencyCreateRequestDto? body, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/v1/core-module/Currency"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + 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_ == 201) + { + 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 + if (status_ == 422) + { + 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); + } + throw new ApiException("UnprocessableEntity - When the given currencyCreateRequest is invalid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + 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(); + } + } + /// Lists all currencies supported by the API wherever a CurrencyID can be provided. /// Ok - returns a list of CurrencyResponseDto /// A server side error occurred. @@ -1313,6 +1501,98 @@ public async System.Threading.Tasks.Task GetBankByIdAsync(int b } } + /// Gets the Currency with the given ID. + /// The ID of the Currency to be returned. + /// OK - returns the Bank requested. + /// A server side error occurred. + public System.Threading.Tasks.Task GetCurrencyByIdAsync(int currencyID) + { + return GetCurrencyByIdAsync(currencyID, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Gets the Currency with the given ID. + /// The ID of the Currency to be returned. + /// OK - returns the Bank requested. + /// A server side error occurred. + public async System.Threading.Tasks.Task GetCurrencyByIdAsync(int currencyID, System.Threading.CancellationToken cancellationToken) + { + if (currencyID == null) + throw new System.ArgumentNullException("currencyID"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/v1/core-module/Currency/{currencyID}"); + urlBuilder_.Replace("{currencyID}", System.Uri.EscapeDataString(ConvertToString(currencyID, System.Globalization.CultureInfo.InvariantCulture))); + + 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("application/json")); + + 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); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + 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); + } + throw new ApiException("NotFound - When the given CurrencyID does not exist.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + 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(); + } + } + /// Lists all documents. /// Ok - returns a list of DocumentResponseDto /// A server side error occurred. diff --git a/src/AdminAssistant.UI/Shared/WebAPIClient/v1/IAdminAssistantWebAPIClientCodeGen.cs b/src/AdminAssistant.UI/Shared/WebAPIClient/v1/IAdminAssistantWebAPIClientCodeGen.cs index 97cce915..104aa911 100644 --- a/src/AdminAssistant.UI/Shared/WebAPIClient/v1/IAdminAssistantWebAPIClientCodeGen.cs +++ b/src/AdminAssistant.UI/Shared/WebAPIClient/v1/IAdminAssistantWebAPIClientCodeGen.cs @@ -180,6 +180,28 @@ public partial interface IAdminAssistantWebAPIClient /// A server side error occurred. System.Threading.Tasks.Task> GetContactAsync(System.Threading.CancellationToken cancellationToken); + /// Update an existing Currency. + /// Ok - returns the updated CurrencyResponseDto + /// A server side error occurred. + System.Threading.Tasks.Task PutCurrencyAsync(CurrencyUpdateRequestDto? body); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Update an existing Currency. + /// Ok - returns the updated CurrencyResponseDto + /// A server side error occurred. + System.Threading.Tasks.Task PutCurrencyAsync(CurrencyUpdateRequestDto? body, System.Threading.CancellationToken cancellationToken); + + /// Creates a new Currency. + /// Created - returns the created currency with its assigned newly ID. + /// A server side error occurred. + System.Threading.Tasks.Task PostCurrencyAsync(CurrencyCreateRequestDto? body); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Creates a new Currency. + /// Created - returns the created currency with its assigned newly ID. + /// A server side error occurred. + System.Threading.Tasks.Task PostCurrencyAsync(CurrencyCreateRequestDto? body, System.Threading.CancellationToken cancellationToken); + /// Lists all currencies supported by the API wherever a CurrencyID can be provided. /// Ok - returns a list of CurrencyResponseDto /// A server side error occurred. @@ -191,6 +213,19 @@ public partial interface IAdminAssistantWebAPIClient /// A server side error occurred. System.Threading.Tasks.Task> GetCurrencyAsync(System.Threading.CancellationToken cancellationToken); + /// Gets the Currency with the given ID. + /// The ID of the Currency to be returned. + /// OK - returns the Bank requested. + /// A server side error occurred. + System.Threading.Tasks.Task GetCurrencyByIdAsync(int currencyID); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Gets the Currency with the given ID. + /// The ID of the Currency to be returned. + /// OK - returns the Bank requested. + /// A server side error occurred. + System.Threading.Tasks.Task GetCurrencyByIdAsync(int currencyID, System.Threading.CancellationToken cancellationToken); + /// Lists all documents. /// Ok - returns a list of DocumentResponseDto /// A server side error occurred. @@ -478,6 +513,22 @@ public partial class ContactResponseDto public string? LastName { get; set; }= default!; + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.3.11.0 (Newtonsoft.Json v12.0.0.0)")] + public partial class CurrencyCreateRequestDto + { + /// The Currency identifier. + [Newtonsoft.Json.JsonProperty("currencyID", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? CurrencyID { get; set; }= default!; + + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string? Symbol { get; set; }= default!; + + [Newtonsoft.Json.JsonProperty("decimalFormat", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string? DecimalFormat { get; set; }= default!; + + } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.3.11.0 (Newtonsoft.Json v12.0.0.0)")] @@ -493,6 +544,22 @@ public partial class CurrencyResponseDto public string? DecimalFormat { get; set; }= default!; + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.3.11.0 (Newtonsoft.Json v12.0.0.0)")] + public partial class CurrencyUpdateRequestDto + { + /// The Currency identifier. + [Newtonsoft.Json.JsonProperty("currencyID", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? CurrencyID { get; set; }= default!; + + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string? Symbol { get; set; }= default!; + + [Newtonsoft.Json.JsonProperty("decimalFormat", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string? DecimalFormat { get; set; }= default!; + + } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.3.11.0 (Newtonsoft.Json v12.0.0.0)")]