diff --git a/src/Altinn.Dan.Plugin.Banking/Clients/Bank.cs b/src/Altinn.Dan.Plugin.Banking/Clients/Bank.cs
deleted file mode 100644
index 693e04d..0000000
--- a/src/Altinn.Dan.Plugin.Banking/Clients/Bank.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-
-/*
-using System.Net.Http;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using Jose;
-
-namespace Altinn.Dan.Plugin.Banking.Clients;
-public partial class Bank
-{
- public X509Certificate2 DecryptionCertificate { get; set; }
-
- ///
- /// The bank sends a encrypted payload, use the ProcessResponse-mechanism to decrypt before further processing
- ///
- /// Http client
- /// Response from bank
- // ReSharper disable once UnusedParameterInPartialMethod
- partial void ProcessResponse(HttpClient client, HttpResponseMessage response)
- {
- if (!response.IsSuccessStatusCode) return;
-
- var jwt = response.Content.ReadAsStringAsync().Result;
- var decryptedContent =
- JWT.Decode(jwt,
- DecryptionCertificate
- .GetRSAPrivateKey()); //, JweAlgorithm.RSA_OAEP_256, JweEncryption.A128CBC_HS256);
-
- response.Content = new StringContent(decryptedContent, Encoding.UTF8);
- }
-} */
diff --git a/src/Altinn.Dan.Plugin.Banking/Clients/BankClient.cs b/src/Altinn.Dan.Plugin.Banking/Clients/BankClient.cs
deleted file mode 100644
index dc8f3a1..0000000
--- a/src/Altinn.Dan.Plugin.Banking/Clients/BankClient.cs
+++ /dev/null
@@ -1,2569 +0,0 @@
-//----------------------
-//
-// Generated using the NSwag toolchain v13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org)
-//
-//----------------------
-
-
-/*
-#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
-#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
-#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
-#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
-#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
-#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
-#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
-
-namespace Altinn.Dan.Plugin.Banking.Clients
-{
- using Altinn.Dan.Plugin.Banking.Exceptions;
- using System;
- using System = global::System;
-
- [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v11.0.0.0))")]
- public partial class Bank
- {
- private string _baseUrl = "https://hostname.no/v1";
- private System.Net.Http.HttpClient _httpClient;
- private System.Lazy _settings;
-
- public Bank(System.Net.Http.HttpClient httpClient)
- {
- _httpClient = httpClient;
- _settings = new System.Lazy(CreateSerializerSettings);
- }
-
- private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
- {
- var settings = new Newtonsoft.Json.JsonSerializerSettings();
- UpdateJsonSerializerSettings(settings);
- return settings;
- }
-
- public string BaseUrl
- {
- get { return _baseUrl; }
- set { _baseUrl = value; }
- }
-
- protected 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);
- /// List of accounts for a specified party and period. Account number can be provided in place of the party identifier for lookup requests directly on the account. Must provide a blank list if no hits.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Parts identifier, personal identification number, D-number or organization number
- /// The account number. Not in use per now.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public System.Threading.Tasks.Task ListAccountsAsync(System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string partyID, string accountID, string additionalReferenceID, AdditionalReferenceIDType? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate)
- {
- return ListAccountsAsync(accountInfoRequestID, correlationID, legal_Mandate, partyID, accountID, additionalReferenceID, additionalReferenceIDType, fromDate, toDate, System.Threading.CancellationToken.None);
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// List of accounts for a specified party and period. Account number can be provided in place of the party identifier for lookup requests directly on the account. Must provide a blank list if no hits.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Parts identifier, personal identification number, D-number or organization number
- /// The account number. Not in use per now.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public async System.Threading.Tasks.Task ListAccountsAsync(System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string partyID, string accountID, string additionalReferenceID, AdditionalReferenceIDType? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate, System.Threading.CancellationToken cancellationToken)
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/accounts?");
- if (fromDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fromDate") + "=").Append(System.Uri.EscapeDataString(fromDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (toDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("toDate") + "=").Append(System.Uri.EscapeDataString(toDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- if (accountInfoRequestID == null)
- throw new System.ArgumentNullException("accountInfoRequestID");
- request_.Headers.TryAddWithoutValidation("AccountInfoRequestID",
- ConvertToString(accountInfoRequestID, System.Globalization.CultureInfo.InvariantCulture));
- if (correlationID == null)
- throw new System.ArgumentNullException("correlationID");
- request_.Headers.TryAddWithoutValidation("CorrelationID",
- ConvertToString(correlationID, System.Globalization.CultureInfo.InvariantCulture));
- if (legal_Mandate == null)
- throw new System.ArgumentNullException("legal_Mandate");
- request_.Headers.TryAddWithoutValidation("Legal-Mandate",
- ConvertToString(legal_Mandate, System.Globalization.CultureInfo.InvariantCulture));
- if (partyID != null)
- request_.Headers.TryAddWithoutValidation("PartyID", ConvertToString(partyID, System.Globalization.CultureInfo.InvariantCulture));
- if (accountID != null)
- request_.Headers.TryAddWithoutValidation("AccountID", ConvertToString(accountID, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceID != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceID",
- ConvertToString(additionalReferenceID, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceIDType != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceIDType",
- ConvertToString(additionalReferenceIDType, System.Globalization.CultureInfo.InvariantCulture));
- 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_ == 400)
- {
- 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(
- "ACC-001 and best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.",
- status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else if (status_ == 401)
- {
- 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(
- "ACC-010 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.",
- status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else if (status_ == 403)
- {
- 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(
- "ACC-011 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.",
- status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else if (status_ == 405)
- {
- 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(
- "ACC-012 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.",
- status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else if (status_ == 429)
- {
- 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(
- "ACC-022 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.",
- status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else if (status_ == 500)
- {
- 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(
- "ACC-100 or ACC-500 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.",
- status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- 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("Best possible description of the error from Data Provider.", status_, objectResponse_.Text, headers_,
- objectResponse_.Object, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- return new Accounts();
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// Account details, including balances, for an account
- /// Unique reference to the account. Shall match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public System.Threading.Tasks.Task ShowAccountByIdAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType2? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate)
- {
- return ShowAccountByIdAsync(accountReference, accountInfoRequestID, correlationID, legal_Mandate, additionalReferenceID, additionalReferenceIDType, fromDate, toDate, System.Threading.CancellationToken.None);
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// Account details, including balances, for an account
- /// Unique reference to the account. Shall match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public async System.Threading.Tasks.Task ShowAccountByIdAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType2? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate, System.Threading.CancellationToken cancellationToken)
- {
- if (accountReference == null)
- throw new System.ArgumentNullException("accountReference");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/accounts/{accountReference}?");
- urlBuilder_.Replace("{accountReference}", System.Uri.EscapeDataString(ConvertToString(accountReference, System.Globalization.CultureInfo.InvariantCulture)));
- if (fromDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fromDate") + "=").Append(System.Uri.EscapeDataString(fromDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (toDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("toDate") + "=").Append(System.Uri.EscapeDataString(toDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- if (accountInfoRequestID == null)
- throw new System.ArgumentNullException("accountInfoRequestID");
- request_.Headers.TryAddWithoutValidation("AccountInfoRequestID", ConvertToString(accountInfoRequestID, System.Globalization.CultureInfo.InvariantCulture));
- if (correlationID == null)
- throw new System.ArgumentNullException("correlationID");
- request_.Headers.TryAddWithoutValidation("CorrelationID", ConvertToString(correlationID, System.Globalization.CultureInfo.InvariantCulture));
- if (legal_Mandate == null)
- throw new System.ArgumentNullException("legal_Mandate");
- request_.Headers.TryAddWithoutValidation("Legal-Mandate", ConvertToString(legal_Mandate, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceID != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceID", ConvertToString(additionalReferenceID, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceIDType != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceIDType", ConvertToString(additionalReferenceIDType, System.Globalization.CultureInfo.InvariantCulture));
- 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_ == 400)
- {
- 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("ACC-001 and best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 401)
- {
- 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("ACC-010 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 403)
- {
- 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("ACC-011 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- 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("ACC-002 or ACC-003 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 405)
- {
- 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("ACC-012 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 429)
- {
- 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("ACC-022 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 500)
- {
- 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("ACC-100 or ACC-500 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- 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("Best possible description of the error from Data Provider", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// Transactions for specified account and period. Empty list if no hits. Must support pagination on large result sets (min 1000) - see separate description in the link element.
- /// Unique reference to the account. Shall match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// A list of transactions
- /// A server side error occurred.
- public System.Threading.Tasks.Task ListTransactionsAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType3? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate)
- {
- return ListTransactionsAsync(accountReference, accountInfoRequestID, correlationID, legal_Mandate, additionalReferenceID, additionalReferenceIDType, fromDate, toDate, System.Threading.CancellationToken.None);
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// Transactions for specified account and period. Empty list if no hits. Must support pagination on large result sets (min 1000) - see separate description in the link element.
- /// Unique reference to the account. Shall match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// A list of transactions
- /// A server side error occurred.
- public async System.Threading.Tasks.Task ListTransactionsAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType3? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate, System.Threading.CancellationToken cancellationToken)
- {
- if (accountReference == null)
- throw new System.ArgumentNullException("accountReference");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/accounts/{accountReference}/transactions?");
- urlBuilder_.Replace("{accountReference}", System.Uri.EscapeDataString(ConvertToString(accountReference, System.Globalization.CultureInfo.InvariantCulture)));
- if (fromDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fromDate") + "=").Append(System.Uri.EscapeDataString(fromDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (toDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("toDate") + "=").Append(System.Uri.EscapeDataString(toDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- if (accountInfoRequestID == null)
- throw new System.ArgumentNullException("accountInfoRequestID");
- request_.Headers.TryAddWithoutValidation("AccountInfoRequestID", ConvertToString(accountInfoRequestID, System.Globalization.CultureInfo.InvariantCulture));
- if (correlationID == null)
- throw new System.ArgumentNullException("correlationID");
- request_.Headers.TryAddWithoutValidation("CorrelationID", ConvertToString(correlationID, System.Globalization.CultureInfo.InvariantCulture));
- if (legal_Mandate == null)
- throw new System.ArgumentNullException("legal_Mandate");
- request_.Headers.TryAddWithoutValidation("Legal-Mandate", ConvertToString(legal_Mandate, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceID != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceID", ConvertToString(additionalReferenceID, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceIDType != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceIDType", ConvertToString(additionalReferenceIDType, System.Globalization.CultureInfo.InvariantCulture));
- 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_ == 400)
- {
- 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("ACC-001 and best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 401)
- {
- 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("ACC-010 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 403)
- {
- 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("ACC-011 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- 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("ACC-002 or ACC-003 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 405)
- {
- 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("ACC-012 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 429)
- {
- 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("ACC-022 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 500)
- {
- 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("ACC-100 or ACC-500 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- 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("Best possible description of the error from Data Provider", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// List of cards associated with the specified account. Empty list if no hits.
- /// Unique reference to the account. Shall not match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public System.Threading.Tasks.Task ListCardsAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType4? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate)
- {
- return ListCardsAsync(accountReference, accountInfoRequestID, correlationID, legal_Mandate, additionalReferenceID, additionalReferenceIDType, fromDate, toDate, System.Threading.CancellationToken.None);
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// List of cards associated with the specified account. Empty list if no hits.
- /// Unique reference to the account. Shall not match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public async System.Threading.Tasks.Task ListCardsAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType4? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate, System.Threading.CancellationToken cancellationToken)
- {
- if (accountReference == null)
- throw new System.ArgumentNullException("accountReference");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/accounts/{accountReference}/cards?");
- urlBuilder_.Replace("{accountReference}", System.Uri.EscapeDataString(ConvertToString(accountReference, System.Globalization.CultureInfo.InvariantCulture)));
- if (fromDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fromDate") + "=").Append(System.Uri.EscapeDataString(fromDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (toDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("toDate") + "=").Append(System.Uri.EscapeDataString(toDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- if (accountInfoRequestID == null)
- throw new System.ArgumentNullException("accountInfoRequestID");
- request_.Headers.TryAddWithoutValidation("AccountInfoRequestID", ConvertToString(accountInfoRequestID, System.Globalization.CultureInfo.InvariantCulture));
- if (correlationID == null)
- throw new System.ArgumentNullException("correlationID");
- request_.Headers.TryAddWithoutValidation("CorrelationID", ConvertToString(correlationID, System.Globalization.CultureInfo.InvariantCulture));
- if (legal_Mandate == null)
- throw new System.ArgumentNullException("legal_Mandate");
- request_.Headers.TryAddWithoutValidation("Legal-Mandate", ConvertToString(legal_Mandate, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceID != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceID", ConvertToString(additionalReferenceID, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceIDType != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceIDType", ConvertToString(additionalReferenceIDType, System.Globalization.CultureInfo.InvariantCulture));
- 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_ == 400)
- {
- 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("ACC-001 and best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 401)
- {
- 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("ACC-010 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 403)
- {
- 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("ACC-011 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- 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("ACC-002 or ACC-003 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 405)
- {
- 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("ACC-012 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 429)
- {
- 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("ACC-022 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 500)
- {
- 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("ACC-100 or ACC-500 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- 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("Best possible description of the error from Data Provider", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// Role holders for the specified account. Empty list if no hits.
- /// Unique reference to the account. Shall not match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public System.Threading.Tasks.Task ListRolesAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType5? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate)
- {
- return ListRolesAsync(accountReference, accountInfoRequestID, correlationID, legal_Mandate, additionalReferenceID, additionalReferenceIDType, fromDate, toDate, System.Threading.CancellationToken.None);
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// Role holders for the specified account. Empty list if no hits.
- /// Unique reference to the account. Shall not match the account number.
- /// Unique reference number / case number that follows the case throughout the different requests.
- /// Correlation ID, unique identifier for the technical request
- /// The Legal basis used by data consumers in order to fetch data. Should be validated by the data provider.
- /// Reference ID based on AdditionalReferenceIDType. Should be validated according to the legal-mandate.
- /// What type of reference to expect in AdditionalReferenceID
- /// From date, current date if not stated
- /// To date, current date if not stated
- /// Valid response
- /// A server side error occurred.
- public async System.Threading.Tasks.Task ListRolesAsync(string accountReference, System.Guid accountInfoRequestID, System.Guid correlationID, string legal_Mandate, string additionalReferenceID, AdditionalReferenceIDType5? additionalReferenceIDType, System.DateTimeOffset? fromDate, System.DateTimeOffset? toDate, System.Threading.CancellationToken cancellationToken)
- {
- if (accountReference == null)
- throw new System.ArgumentNullException("accountReference");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/accounts/{accountReference}/roles?");
- urlBuilder_.Replace("{accountReference}", System.Uri.EscapeDataString(ConvertToString(accountReference, System.Globalization.CultureInfo.InvariantCulture)));
- if (fromDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fromDate") + "=").Append(System.Uri.EscapeDataString(fromDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (toDate != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("toDate") + "=").Append(System.Uri.EscapeDataString(toDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- if (accountInfoRequestID == null)
- throw new System.ArgumentNullException("accountInfoRequestID");
- request_.Headers.TryAddWithoutValidation("AccountInfoRequestID", ConvertToString(accountInfoRequestID, System.Globalization.CultureInfo.InvariantCulture));
- if (correlationID == null)
- throw new System.ArgumentNullException("correlationID");
- request_.Headers.TryAddWithoutValidation("CorrelationID", ConvertToString(correlationID, System.Globalization.CultureInfo.InvariantCulture));
- if (legal_Mandate == null)
- throw new System.ArgumentNullException("legal_Mandate");
- request_.Headers.TryAddWithoutValidation("Legal-Mandate", ConvertToString(legal_Mandate, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceID != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceID", ConvertToString(additionalReferenceID, System.Globalization.CultureInfo.InvariantCulture));
- if (additionalReferenceIDType != null)
- request_.Headers.TryAddWithoutValidation("AdditionalReferenceIDType", ConvertToString(additionalReferenceIDType, System.Globalization.CultureInfo.InvariantCulture));
- 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_ == 400)
- {
- 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("ACC-001 and best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 401)
- {
- 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("ACC-010 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 403)
- {
- 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("ACC-011 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- 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("ACC-002 or ACC-003 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 405)
- {
- 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("ACC-012 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 429)
- {
- 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("ACC-022 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 500)
- {
- 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("ACC-100 or ACC-500 and the best possible description of the error from Data Provider. See information regarding specific error situations on github under API-spesification for the different ACC codes.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- 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("Best possible description of the error from Data Provider", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- protected struct ObjectResponseResult
- {
- 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 || true)
- {
- 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