diff --git a/BunqSdk.Samples/AttachmentPublicSample.cs b/BunqSdk.Samples/AttachmentPublicSample.cs index 9eca1da..7c9ce82 100644 --- a/BunqSdk.Samples/AttachmentPublicSample.cs +++ b/BunqSdk.Samples/AttachmentPublicSample.cs @@ -16,7 +16,7 @@ public class AttachmentPublicSample : ISample public void Run() { - var apiContext = ApiContext.Restore(); + BunqContext.LoadApiContext(ApiContext.Restore()); var customHeaders = new Dictionary { @@ -24,8 +24,8 @@ public void Run() {ApiClient.HEADER_ATTACHMENT_DESCRIPTION, DESCRIPTION_TEST_JPG_ATTACHMENT} }; var requestBytes = File.ReadAllBytes(PATH_ATTACHMENT_IN); - var uuid = AttachmentPublic.Create(apiContext, requestBytes, customHeaders).Value; - var responseBytes = AttachmentPublicContent.List(apiContext, uuid).Value; + var uuid = AttachmentPublic.Create(requestBytes, customHeaders).Value; + var responseBytes = AttachmentPublicContent.List(uuid).Value; var fileOut = new FileInfo(PATH_ATTACHMENT_OUT); fileOut.Directory.Create(); File.WriteAllBytes(fileOut.FullName, responseBytes); diff --git a/BunqSdk.Samples/CardDebitSample.cs b/BunqSdk.Samples/CardDebitSample.cs index 98e9106..b32f7ff 100644 --- a/BunqSdk.Samples/CardDebitSample.cs +++ b/BunqSdk.Samples/CardDebitSample.cs @@ -20,25 +20,17 @@ public class CardDebitSample : ISample public void Run() { - var apiContext = ApiContext.Restore(); + BunqContext.LoadApiContext(ApiContext.Restore()); var cardPinAssignment = new CardPinAssignment( CARD_PIN_ASSIGNMENT_TYPE_PRIMARY, PIN_CODE, MONETARY_ACCOUNT_ID ); var allCardPinAssignments = new List {cardPinAssignment}; - var requestMap = new Dictionary - { - {CardDebit.FIELD_NAME_ON_CARD, NAME_YOUR_COMPANY}, - {CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine()}, - {CardDebit.FIELD_PIN_CODE_ASSIGNMENT, allCardPinAssignments}, - { - CardDebit.FIELD_ALIAS, - new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST} - }, - }; - Console.WriteLine(CardDebit.Create(apiContext, requestMap, USER_ITEM_ID)); + Console.WriteLine(CardDebit.Create(GenerateRandomSecondLine(), NAME_YOUR_COMPANY, + new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST}, + pinCodeAssignment: allCardPinAssignments)); } private static string GenerateRandomSecondLine() diff --git a/BunqSdk.Samples/CustomerStatementExportSample.cs b/BunqSdk.Samples/CustomerStatementExportSample.cs index e15f85f..d66368d 100644 --- a/BunqSdk.Samples/CustomerStatementExportSample.cs +++ b/BunqSdk.Samples/CustomerStatementExportSample.cs @@ -35,7 +35,7 @@ public class CustomerStatementExportSample : ISample public void Run() { - var apiContext = ApiContext.Restore(); + BunqContext.LoadApiContext(ApiContext.Restore()); var timeSpanWeek = new TimeSpan( DAYS_IN_WEEK, TIME_UNIT_COUNT_NONE, @@ -45,31 +45,18 @@ public void Run() var dateStart = DateTime.Now.Subtract(timeSpanWeek); var dateEnd = DateTime.Now; - var customerStatementMap = new Dictionary - { - {CustomerStatementExport.FIELD_STATEMENT_FORMAT, STATEMENT_FORMAT}, - {CustomerStatementExport.FIELD_DATE_START, dateStart.ToString(FORMAT_DATE_STATEMENT)}, - {CustomerStatementExport.FIELD_DATE_END, dateEnd.ToString(FORMAT_DATE_STATEMENT)}, - }; + var userId = BunqContext.UserContext.UserId; - var userId = User.List(apiContext).Value[INDEX_FIRST].UserCompany.Id; + var userIdInt = userId; + var monetaryAccountId = BunqContext.UserContext.PrimaryMonetaryAccountBank.Id.Value; - if (userId != null) - { - var userIdInt = (int) userId; - var monetaryAccountId = MonetaryAccountBank.List(apiContext, userIdInt).Value[INDEX_FIRST].Id; + var monetaryAccountIdInt = monetaryAccountId; + var customerStatementId = CustomerStatementExport.Create(STATEMENT_FORMAT, + dateStart.ToString(FORMAT_DATE_STATEMENT), dateEnd.ToString(FORMAT_DATE_STATEMENT)).Value; - if (monetaryAccountId != null) - { - var monetaryAccountIdInt = (int) monetaryAccountId; - var customerStatementId = CustomerStatementExport.Create(apiContext, customerStatementMap, - userIdInt, monetaryAccountIdInt).Value; + CustomerStatementExport.Delete(customerStatementId); - CustomerStatementExport.Delete(apiContext, userIdInt, monetaryAccountIdInt, customerStatementId); - } - } - - apiContext.Save(); + BunqContext.ApiContext.Save(); } } -} +} \ No newline at end of file diff --git a/BunqSdk.Samples/MonetaryAccountSample.cs b/BunqSdk.Samples/MonetaryAccountSample.cs index 1fa2ba3..e56835a 100644 --- a/BunqSdk.Samples/MonetaryAccountSample.cs +++ b/BunqSdk.Samples/MonetaryAccountSample.cs @@ -7,14 +7,11 @@ namespace Bunq.Sdk.Samples { public class MonetaryAccountSample : ISample { - private const int USER_ITEM_ID = 0; // Put your user ID here - private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here - public void Run() { - var apiContext = ApiContext.Restore(); - var monetaryAccount = MonetaryAccount.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value; - Console.WriteLine(monetaryAccount.MonetaryAccountBank); + BunqContext.LoadApiContext(ApiContext.Restore()); + var monetaryAccount = BunqContext.UserContext.PrimaryMonetaryAccountBank; + Console.WriteLine(monetaryAccount); } } } diff --git a/BunqSdk.Samples/PaymentBatchSample.cs b/BunqSdk.Samples/PaymentBatchSample.cs index e5ece12..1718268 100644 --- a/BunqSdk.Samples/PaymentBatchSample.cs +++ b/BunqSdk.Samples/PaymentBatchSample.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Bunq.Sdk.Context; +using Bunq.Sdk.Model.Core; using Bunq.Sdk.Model.Generated.Endpoint; using Bunq.Sdk.Model.Generated.Object; using Bunq.Sdk.Samples.Utils; @@ -14,8 +15,6 @@ public class PaymentBatchSample : ISample private const string COUNTERPARTY_POINTER_TYPE = "EMAIL"; private const string COUNTERPARTY_EMAIL = "bravo@bunq.com"; private const string PAYMENT_DESCRIPTION = "This is a generated payment batch!"; - private const int USER_ITEM_ID = 0; // Put your user ID here - private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here public void Run() { @@ -38,11 +37,18 @@ public void Run() } } }; + var allPayment = new List(); + var payment = new Payment + { + Amount = new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY), + CounterpartyAlias = + new MonetaryAccountReference(new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)), + Description = PAYMENT_DESCRIPTION + }; - var paymentBatchId = PaymentBatch.Create(apiContext, paymentBatchMap, USER_ITEM_ID, - MONETARY_ACCOUNT_ITEM_ID).Value; + var paymentBatchId = PaymentBatch.Create(allPayment).Value; - Console.WriteLine(PaymentBatch.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentBatchId)); + Console.WriteLine(PaymentBatch.Get(paymentBatchId)); } } } diff --git a/BunqSdk.Samples/PaymentListSample.cs b/BunqSdk.Samples/PaymentListSample.cs index 3757d9c..e962580 100644 --- a/BunqSdk.Samples/PaymentListSample.cs +++ b/BunqSdk.Samples/PaymentListSample.cs @@ -21,30 +21,22 @@ public class PaymentListSample : ISample /// private const int PAGE_SIZE = 3; - /// - /// Constants to be changed to run the example. - /// - private const int USER_ITEM_ID = 0; // Put your user ID here - private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here - public void Run() { - var apiContext = ApiContext.Restore(); + BunqContext.LoadApiContext(ApiContext.Restore()); var paginationCountOnly = new Pagination { Count = PAGE_SIZE, }; Console.WriteLine(MESSAGE_LATEST_PAGE_IDS); - var paymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, - paginationCountOnly.UrlParamsCountOnly); + var paymentResponse = Payment.List(urlParams: paginationCountOnly.UrlParamsCountOnly); PrintPayments(paymentResponse.Value); var pagination = paymentResponse.Pagination; if (pagination.HasPreviousPage()) { Console.WriteLine(MESSAGE_SECOND_LATEST_PAGE_IDS); - var previousPaymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, - pagination.UrlParamsPreviousPage); + var previousPaymentResponse = Payment.List(urlParams: pagination.UrlParamsPreviousPage); PrintPayments(previousPaymentResponse.Value); } else diff --git a/BunqSdk.Samples/PaymentSample.cs b/BunqSdk.Samples/PaymentSample.cs index be0b8cb..66da16f 100644 --- a/BunqSdk.Samples/PaymentSample.cs +++ b/BunqSdk.Samples/PaymentSample.cs @@ -19,24 +19,15 @@ public class PaymentSample : ISample public void Run() { - var apiContext = ApiContext.Restore(); - var paymentMap = new Dictionary - { - {Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)}, - { - Payment.FIELD_COUNTERPARTY_ALIAS, - new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL) - }, - {Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION} - }; + BunqContext.LoadApiContext(ApiContext.Restore()); + var paymentId = Payment.Create(new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY), + new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL), PAYMENT_DESCRIPTION).Value; - var paymentId = Payment.Create(apiContext, paymentMap, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value; + Console.WriteLine(Payment.Get(paymentId)); - Console.WriteLine(Payment.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentId)); - // Save the API context to account for all the changes that might have occurred to it // during the sample execution - apiContext.Save(); + BunqContext.ApiContext.Save(); } } -} +} \ No newline at end of file diff --git a/BunqSdk.Samples/RequestSample.cs b/BunqSdk.Samples/RequestSample.cs index ba40970..1813afb 100644 --- a/BunqSdk.Samples/RequestSample.cs +++ b/BunqSdk.Samples/RequestSample.cs @@ -14,27 +14,19 @@ public class RequestSample : ISample private const string COUNTERPARTY_POINTER_TYPE = "EMAIL"; private const string COUNTERPARTY_EMAIL = "bravo@bunq.com"; private const string REQUEST_DESCRIPTION = "This is a generated request!"; - private const int USER_ITEM_ID = 0; // Put your user ID here - private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here private const string STATUS_REVOKED = "REVOKED"; public void Run() { var apiContext = ApiContext.Restore(); - var requestMap = new Dictionary - { - {RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(REQUEST_AMOUNT, REQUEST_CURRENCY)}, - {RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)}, - {RequestInquiry.FIELD_DESCRIPTION, REQUEST_DESCRIPTION}, - {RequestInquiry.FIELD_ALLOW_BUNQME, true} - }; - var requestId = RequestInquiry.Create(apiContext, requestMap, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value; - Console.WriteLine(RequestInquiry.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, requestId)); + var requestId = RequestInquiry.Create(new Amount(REQUEST_AMOUNT, REQUEST_CURRENCY), + new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL), REQUEST_DESCRIPTION, false).Value; + + Console.WriteLine(RequestInquiry.Get(requestId)); var requestUpdateMap = new Dictionary {{RequestInquiry.FIELD_STATUS, STATUS_REVOKED}}; - var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, USER_ITEM_ID, - MONETARY_ACCOUNT_ITEM_ID, requestId); + var requestUpdated = RequestInquiry.Update(requestId, status: STATUS_REVOKED); Console.WriteLine(requestUpdated); } } -} +} \ No newline at end of file diff --git a/BunqSdk.Samples/UserListSample.cs b/BunqSdk.Samples/UserListSample.cs index 0f00bb0..dd24ede 100644 --- a/BunqSdk.Samples/UserListSample.cs +++ b/BunqSdk.Samples/UserListSample.cs @@ -9,15 +9,20 @@ public class UserListSample : ISample { public void Run() { - var apiContext = ApiContext.Restore(); - var users = User.List(apiContext).Value; + BunqContext.LoadApiContext(ApiContext.Restore()); + var users = User.List().Value; - apiContext.Save(); + BunqContext.ApiContext.Save(); foreach (var oneUser in users) { Console.WriteLine(oneUser.UserCompany); } + + // or + + Console.WriteLine(BunqContext.UserContext.UserCompany); + Console.WriteLine(BunqContext.UserContext.UserPerson); } } } diff --git a/BunqSdk.Tests/BunqSdkTestBase.cs b/BunqSdk.Tests/BunqSdkTestBase.cs index cacef7e..848325a 100644 --- a/BunqSdk.Tests/BunqSdkTestBase.cs +++ b/BunqSdk.Tests/BunqSdkTestBase.cs @@ -29,7 +29,7 @@ public class BunqSdkTestBase /// /// Gets an Api Context, re-creates if needed and returns it. /// - protected static ApiContext GetApiContext() + protected static ApiContext SetUpApiContext() { ApiContext apiContext; @@ -44,6 +44,8 @@ protected static ApiContext GetApiContext() apiContext.EnsureSessionActive(); apiContext.Save(FILENAME_CONTEXT_CONF); + + BunqContext.LoadApiContext(apiContext); return apiContext; } diff --git a/BunqSdk.Tests/Context/ApiContextTest.cs b/BunqSdk.Tests/Context/ApiContextTest.cs index 9ed1318..521adc8 100644 --- a/BunqSdk.Tests/Context/ApiContextTest.cs +++ b/BunqSdk.Tests/Context/ApiContextTest.cs @@ -18,7 +18,7 @@ public class ApiContextTest : BunqSdkTestBase, IClassFixture public ApiContextTest() { - if (apiContext == null) apiContext = GetApiContext(); + if (apiContext == null) apiContext = SetUpApiContext(); } /// @@ -27,7 +27,7 @@ public ApiContextTest() [Fact] public void TestApiContextSerializeDeserialize() { - var apiContextJson = apiContext.ToJson(); + var apiContextJson = BunqContext.ApiContext.ToJson(); var apiContextDeSerialised = ApiContext.FromJson(apiContextJson); Assert.Equal(apiContextJson, apiContextDeSerialised.ToJson()); diff --git a/BunqSdk.Tests/Http/PaginationScenarioTest.cs b/BunqSdk.Tests/Http/PaginationScenarioTest.cs index 848bfef..4bda2a1 100644 --- a/BunqSdk.Tests/Http/PaginationScenarioTest.cs +++ b/BunqSdk.Tests/Http/PaginationScenarioTest.cs @@ -38,7 +38,7 @@ public class PaginationScenarioTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); [Fact] public void TestApiScenarioPaymentListingWithPagination() @@ -90,19 +90,12 @@ private static IList GetPaymentsRequired() private static BunqResponse> ListPayments(IDictionary urlParams) { - return Payment.List(API_CONTEXT, USER_ID, MONETARY_ACCOUNT_ID, urlParams); + return Payment.List(urlParams: urlParams); } private static void CreatePayment() { - var requestMap = new Dictionary - { - {Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT_EUR, PAYMENT_CURRENCY)}, - {Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}, - {Payment.FIELD_COUNTERPARTY_ALIAS, COUNTER_PARTY_OTHER} - }; - - Payment.Create(API_CONTEXT, requestMap, USER_ID, MONETARY_ACCOUNT_ID); + Payment.Create(new Amount(PAYMENT_AMOUNT_EUR, PAYMENT_CURRENCY), COUNTER_PARTY_OTHER, PAYMENT_DESCRIPTION); } } } diff --git a/BunqSdk.Tests/Http/ResponseIdOnBadRequestTest.cs b/BunqSdk.Tests/Http/ResponseIdOnBadRequestTest.cs index 7c6cf29..0ff26b2 100644 --- a/BunqSdk.Tests/Http/ResponseIdOnBadRequestTest.cs +++ b/BunqSdk.Tests/Http/ResponseIdOnBadRequestTest.cs @@ -11,7 +11,7 @@ public class ResponseIdOnBadRequestTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Invalid user id to trigger BadRequestException @@ -22,7 +22,7 @@ public class ResponseIdOnBadRequestTest : BunqSdkTestBase public void TestBadRequestWithResponseId() { var caughtException = Assert.Throws( - () => UserPerson.Get(API_CONTEXT, INVALID_USER_PERSON_ID) + () => UserPerson.Get() ); Assert.NotNull(caughtException.ResponseId); diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/AttachmentPublicTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/AttachmentPublicTest.cs index fbc5135..bd8de68 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/AttachmentPublicTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/AttachmentPublicTest.cs @@ -26,7 +26,7 @@ public class AttachmentPublicTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests if the file we upload is the file we are getting back once successfully uploaded does. @@ -42,8 +42,8 @@ public void TestAttachmentUploadAndRetrieval() {ApiClient.HEADER_ATTACHMENT_DESCRIPTION, ATTACHMENT_DESCRIPTION} }; - var attachmentUuid = AttachmentPublic.Create(API_CONTEXT, fileContentBytes, customHeaders).Value; - var responseBytes = AttachmentPublicContent.List(API_CONTEXT, attachmentUuid).Value; + var attachmentUuid = AttachmentPublic.Create(fileContentBytes, customHeaders).Value; + var responseBytes = AttachmentPublicContent.List(attachmentUuid).Value; Assert.Equal(fileContentBytes, responseBytes); } diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/AvatarTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/AvatarTest.cs index 0023cb1..d7c6c5e 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/AvatarTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/AvatarTest.cs @@ -28,7 +28,7 @@ public class AvatarTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests the creation of an avatar by uploading a picture via AttachmentPublic and setting it as avatar @@ -44,11 +44,11 @@ public void TestCreateAvatarAndRetrieval() { {Avatar.FIELD_ATTACHMENT_PUBLIC_UUID, attachmentUuid} }; - var avatarUuid = Avatar.Create(API_CONTEXT, avatarMap).Value; + var avatarUuid = Avatar.Create(attachmentUuid).Value; - var attachmentUuidFromAvatar = Avatar.Get(API_CONTEXT, avatarUuid).Value + var attachmentUuidFromAvatar = Avatar.Get(avatarUuid).Value .Image[INDEX_FIRST].AttachmentPublicUuid; - var revievedFileContentByte = AttachmentPublicContent.List(API_CONTEXT, attachmentUuidFromAvatar).Value; + var revievedFileContentByte = AttachmentPublicContent.List(attachmentUuidFromAvatar).Value; Assert.Equal(attachmentUuid, attachmentUuidFromAvatar); Assert.Equal(fileContentByte, revievedFileContentByte); @@ -61,8 +61,8 @@ private static string UploadAvatarAndGetUuid(byte[] fileContentByte) {ApiClient.HEADER_ATTACHMENT_DESCRIPTION, ATTACHMENT_DECSRIPTION}, {ApiClient.HEADER_CONTENT_TYPE, CONTEN_TYPE}, }; - - return AttachmentPublic.Create(API_CONTEXT, fileContentByte, customHeaders).Value; + + return AttachmentPublic.Create(fileContentByte, customHeaders).Value; } } } diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs index ae3618f..2ff8d50 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using Bunq.Sdk.Context; using Bunq.Sdk.Model.Generated.Endpoint; using Bunq.Sdk.Model.Generated.Object; @@ -25,13 +26,14 @@ public class CardDebitTest : BunqSdkTestBase private const int BASE_DECIMAL = 10; private const int CARD_SECOND_LINE_LENGTH_MAXIMUM = 20; private const int NUMBER_ONE = 1; + private const string CardTypeMaestro = "MAESTRO"; private static readonly int USER_ID = Config.GetUserId(); /// /// API context used to for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests ordering a new card and checks if the fields we have entered are indeed correct by. @@ -40,20 +42,16 @@ public class CardDebitTest : BunqSdkTestBase public void TestOrderNewMaestroCard() { var cardPinAssignment = new CardPinAssignment( - CARD_PIN_ASSIGNMENT_TYPE_PRIMARY, + CARD_PIN_ASSIGNMENT_TYPE_PRIMARY, PIN_CODE, Config.GetMonetarytAccountId()); var allCardPinAssignments = new List {cardPinAssignment}; - var cardDebitMap = new Dictionary - { - {CardDebit.FIELD_ALIAS, GetAlias()}, - {CardDebit.FIELD_NAME_ON_CARD, GetAnAllowedName()}, - {CardDebit.FIELD_PIN_CODE_ASSIGNMENT, allCardPinAssignments}, - {CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine()} - }; - var cardDebit = CardDebit.Create(API_CONTEXT, cardDebitMap, USER_ID).Value; + var cardDebit = CardDebit.Create(GenerateRandomSecondLine(), GetAnAllowedName(), GetAlias(), CardTypeMaestro, + allCardPinAssignments).Value; - var cardFromCardEndpoint = Card.Get(API_CONTEXT, USER_ID, cardDebit.Id.Value).Value; + Assert.True(cardDebit.Id != null); + + var cardFromCardEndpoint = Card.Get(cardDebit.Id.Value).Value; Assert.Equal(cardDebit.SecondLine, cardFromCardEndpoint.SecondLine); Assert.Equal(cardDebit.Created, cardFromCardEndpoint.Created); @@ -62,7 +60,7 @@ public void TestOrderNewMaestroCard() private static string GetAnAllowedName() { - return CardName.List(API_CONTEXT, USER_ID).Value[INDEX_FIRST].PossibleCardNameArray[INDEX_FIRST]; + return CardName.List().Value[INDEX_FIRST].PossibleCardNameArray[INDEX_FIRST]; } private static string GenerateRandomSecondLine() @@ -77,7 +75,7 @@ private static string GenerateRandomSecondLine() private static Pointer GetAlias() { - return User.Get(API_CONTEXT, USER_ID).Value.UserCompany.Alias[INDEX_FIRST]; + return User.Get().Value.UserCompany.Alias[INDEX_FIRST]; } } } \ No newline at end of file diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContentTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContentTest.cs index a5a9b22..fe41cb9 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContentTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContentTest.cs @@ -28,7 +28,7 @@ public class DraftShareInviteBankQrCodeContentTest : BunqSdkTestBase /// /// API context to use for the test API calls /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests the creation of a connect and getting the qr code related to this connect. @@ -40,7 +40,7 @@ public void TestCreateInviteBankAndGetQrCode() { var draftId = GetShareInviteId(); - var qrContent = DraftShareInviteBankQrCodeContent.List(API_CONTEXT, USER_ID, draftId).Value; + var qrContent = DraftShareInviteBankQrCodeContent.List(draftId).Value; var fileOut = new FileInfo(FILENAME_QR_CODE_IMAGE); fileOut.Directory.Create(); @@ -53,16 +53,10 @@ private static int GetShareInviteId() var addTime = new TimeSpan(TIME_UNIT_AMOUNT_ZERO, TIME_UNIT_AMOUNT_ONE, TIME_UNIT_AMOUNT_ZERO); var expirationTime = currentDate.Add(addTime).ToString(FORMAT_DATE); - var draftShareInviteBankEntry = new DraftShareInviteBankEntry(new ShareDetail + var draftShareInviteEntry = new DraftShareInviteEntry(new ShareDetail {Payment = new ShareDetailPayment(true, true, true, true)}); - var requestMap = new Dictionary - { - {DraftShareInviteBank.FIELD_DRAFT_SHARE_SETTINGS, draftShareInviteBankEntry}, - {DraftShareInviteBank.FIELD_EXPIRATION, expirationTime} - }; - - return DraftShareInviteBank.Create(API_CONTEXT, requestMap, USER_ID).Value; + return DraftShareInviteBank.Create(expirationTime, draftShareInviteEntry).Value; } } } diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/MonetaryAccountBankTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/MonetaryAccountBankTest.cs index 6de7ebb..c9cd3fd 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/MonetaryAccountBankTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/MonetaryAccountBankTest.cs @@ -15,6 +15,7 @@ public class MonetaryAccountBankTest : BunqSdkTestBase /// Config values /// private const string STATUS = "CANCELLED"; + private const string SUBS_STATUS = "REDEMPTION_VOLUNTARY"; private const string REASON = "OTHER"; private const string REASON_DESCRIPTION = "Because this is a test"; @@ -26,7 +27,7 @@ public class MonetaryAccountBankTest : BunqSdkTestBase /// /// API context used for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests the creation of a new monetary account. This accoult will then be removed afterwards. @@ -34,26 +35,15 @@ public class MonetaryAccountBankTest : BunqSdkTestBase [Fact] public void TestCreationNewMonetaryAccount() { - var requestMap = new Dictionary - { - {MonetaryAccountBank.FIELD_CURRENCY, CURRENCY}, - {MonetaryAccountBank.FIELD_DESCRIPTION, MONETARY_ACCOUNT_DESCRIPTION} - }; - var monetaryAccountToCloseId = MonetaryAccountBank.Create(API_CONTEXT, requestMap, USER_ID).Value; + var monetaryAccountToCloseId = MonetaryAccountBank.Create(CURRENCY, MONETARY_ACCOUNT_DESCRIPTION).Value; DeleteMonetaryAccount(monetaryAccountToCloseId); } private static void DeleteMonetaryAccount(int idToClose) { - var requestMap = new Dictionary - { - {MonetaryAccountBank.FIELD_STATUS, STATUS}, - {MonetaryAccountBank.FIELD_SUB_STATUS, SUBS_STATUS}, - {MonetaryAccountBank.FIELD_REASON, REASON}, - {MonetaryAccountBank.FIELD_REASON_DESCRIPTION, REASON_DESCRIPTION} - }; - MonetaryAccountBank.Update(API_CONTEXT, requestMap, USER_ID, idToClose); + MonetaryAccountBank.Update(idToClose, status: STATUS, subStatus: SUBS_STATUS, reason: REASON, + reasonDescription: REASON_DESCRIPTION); } } -} +} \ No newline at end of file diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs index a288e97..3563a78 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs @@ -29,7 +29,7 @@ public class PaymentChatTest : BunqSdkTestBase /// /// API context used for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests sending a chat message in a newly created payment. @@ -37,27 +37,14 @@ public class PaymentChatTest : BunqSdkTestBase [Fact] public void TestSendPaymentChat() { - var paymentChatMap = new Dictionary(); - var chatId = PaymentChat.Create(API_CONTEXT, paymentChatMap, USER_ID, MONETARTY_ACCOUNT_ID, - CreatePaymentAndGetId()).Value; + var chatId = PaymentChat.Create(CreatePaymentAndGetId()).Value; - var chatMessageMap = new Dictionary - { - {ChatMessageText.FIELD_TEXT, MESSAGE_TEXT} - }; - ChatMessageText.Create(API_CONTEXT, chatMessageMap, USER_ID, chatId); + ChatMessageText.Create(chatId, MESSAGE_TEXT); } private static int CreatePaymentAndGetId() { - var requestMap = new Dictionary - { - {Payment.FIELD_AMOUNT, new Amount(AMOUNT_EUR, CURRENCY)}, - {Payment.FIELD_COUNTERPARTY_ALIAS, COUNTER_PARTY_ALIAS}, - {Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}, - }; - - return Payment.Create(API_CONTEXT, requestMap, USER_ID, MONETARTY_ACCOUNT_ID).Value; + return Payment.Create(new Amount(AMOUNT_EUR, CURRENCY), COUNTER_PARTY_ALIAS, PAYMENT_DESCRIPTION).Value; } } } diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/PaymentTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/PaymentTest.cs index 83795c5..e41e131 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/PaymentTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/PaymentTest.cs @@ -16,6 +16,7 @@ public class PaymentTest : BunqSdkTestBase /// Config values. /// private const string PAYMENT_AMOUNT_EUR = "0.01"; + private const string PAYMENT_CURRENCY = "EUR"; private const string PAYMENT_DESCRIPTION = "C# test Payment"; @@ -27,7 +28,7 @@ public class PaymentTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests making a payment to another sanndbox user. @@ -37,14 +38,7 @@ public class PaymentTest : BunqSdkTestBase [Fact] public void TestMakePaymentToOtherUser() { - var requestMap = new Dictionary - { - {Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT_EUR, PAYMENT_CURRENCY)}, - {Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}, - {Payment.FIELD_COUNTERPARTY_ALIAS, COUNTER_PARTY_OTHER} - }; - - Payment.Create(API_CONTEXT, requestMap, USER_ID, MONETARY_ACCOUNT_ID); + Payment.Create(new Amount(PAYMENT_AMOUNT_EUR, PAYMENT_CURRENCY), COUNTER_PARTY_OTHER, PAYMENT_DESCRIPTION); } /// @@ -55,14 +49,7 @@ public void TestMakePaymentToOtherUser() [Fact] public void TestMakePaymentToOtherAccount() { - var requestMap = new Dictionary - { - {Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT_EUR, PAYMENT_CURRENCY)}, - {Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}, - {Payment.FIELD_COUNTERPARTY_ALIAS, COUNTER_PARTY_SELF} - }; - - Payment.Create(API_CONTEXT, requestMap, USER_ID, MONETARY_ACCOUNT_ID); + Payment.Create(new Amount(PAYMENT_AMOUNT_EUR, PAYMENT_CURRENCY), COUNTER_PARTY_SELF, PAYMENT_DESCRIPTION); } } -} +} \ No newline at end of file diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/RequestInquiryTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/RequestInquiryTest.cs index 9b97575..93cda65 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/RequestInquiryTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/RequestInquiryTest.cs @@ -18,8 +18,8 @@ public class RequestInquiryTest : BunqSdkTestBase /// private const string AMOUNT_EUR = "0.01"; private const string FIELD_CURRENCY = "EUR"; - private const string FIELD_PAYMENT_DESCRIPTION = "C# test Payment"; - private const string FIELD_STATUS = "ACCEPTED"; + private const string PAYMENT_DESCRIPTION = "C# test Payment"; + private const string STATUS = "ACCEPTED"; private const int INDEX_FIRST = 0; private static readonly int USER_ID = Config.GetUserId(); @@ -30,7 +30,7 @@ public class RequestInquiryTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests sending a request from monetary account 1 to monetary account 2 and accepting this request. @@ -38,31 +38,16 @@ public class RequestInquiryTest : BunqSdkTestBase [Fact] public void TestRequestInquiry() { - var requestMap = new Dictionary - { - {RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(AMOUNT_EUR, FIELD_CURRENCY)}, - {RequestInquiry.FIELD_COUNTERPARTY_ALIAS, COUNTER_PARTY_SELF}, - {RequestInquiry.FIELD_DESCRIPTION, FIELD_PAYMENT_DESCRIPTION}, - {RequestInquiry.FIELD_ALLOW_BUNQME, false} - }; + RequestInquiry.Create(new Amount(AMOUNT_EUR, FIELD_CURRENCY), COUNTER_PARTY_SELF, PAYMENT_DESCRIPTION, false); - RequestInquiry.Create(API_CONTEXT, requestMap, USER_ID, MONETARY_ACCOUNT_ID); - - Assert.Equal(FIELD_STATUS, AcceptRequest()); + Assert.Equal(STATUS, AcceptRequest()); } private static string AcceptRequest() { - var requestResponseId = RequestResponse - .List(API_CONTEXT, USER_ID, SECOND_MONETARY_ACCOUNT_ID).Value[INDEX_FIRST].Id.Value; - - var requestMap = new Dictionary - { - {RequestResponse.FIELD_STATUS, FIELD_STATUS} - }; + var requestResponseId = RequestResponse.List().Value[INDEX_FIRST].Id.Value; - return RequestResponse.Update(API_CONTEXT, requestMap, USER_ID, SECOND_MONETARY_ACCOUNT_ID, - requestResponseId).Value.Status; + return RequestResponse.Update(requestResponseId, status: STATUS).Value.Status; } } } diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/SessionTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/SessionTest.cs index 350725f..254ca24 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/SessionTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/SessionTest.cs @@ -26,7 +26,7 @@ public class SessionTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests the deleteion of the current session. @@ -36,7 +36,7 @@ public class SessionTest : BunqSdkTestBase [Fact] public void TestSessionDeletion() { - Session.Delete(API_CONTEXT, SESSION_ID_DUMMY); + Session.Delete(SESSION_ID_DUMMY); File.Delete(FILENAME_CONTEXT_CONF); } diff --git a/BunqSdk.Tests/Model/Generated/Endpoint/TabUsageSingleTest.cs b/BunqSdk.Tests/Model/Generated/Endpoint/TabUsageSingleTest.cs index c8d9d60..23849fd 100644 --- a/BunqSdk.Tests/Model/Generated/Endpoint/TabUsageSingleTest.cs +++ b/BunqSdk.Tests/Model/Generated/Endpoint/TabUsageSingleTest.cs @@ -16,12 +16,13 @@ public class TabUsageSingleTest : BunqSdkTestBase /// /// Config values /// - private const string TAB_FIELD_DESCRIPTION = "Pay the tab for Java test please."; - private const string FIELD_STATUS_OPEN = "OPEN"; + private const string TAB_DESCRIPTION = "Pay the tab for Java test please."; + + private const string STATUS_OPEN = "OPEN"; private const string AMOUNT_EUR = "10.00"; private const string FIELD_CURRENCY = "EUR"; - private const string TAB_ITEM_FIELD_DESCRIPTION = "Super expensive java tea"; - private const string FIELD_STATUS_WAITING = "WAITING_FOR_PAYMENT"; + private const string TAB_ITEM_DESCRIPTION = "Super expensive java tea"; + private const string STATUS_WAITING = "WAITING_FOR_PAYMENT"; private static readonly int USER_ID = Config.GetUserId(); private static readonly int MONETARY_ACCOUNT_ID = Config.GetMonetarytAccountId(); @@ -30,7 +31,7 @@ public class TabUsageSingleTest : BunqSdkTestBase /// /// API context to use for the test API calls. /// - private static readonly ApiContext API_CONTEXT = GetApiContext(); + private static readonly ApiContext API_CONTEXT = SetUpApiContext(); /// /// Tests opening a new tab, adding a tab item to it and update this tab to awaiting payment. @@ -44,41 +45,25 @@ public void TestCreateTabAndUpdate() var tabUuid = CreateTabAndGetUuid(); AddTabItem(tabUuid); - var updateTabMap = new Dictionary - { - {TabUsageSingle.FIELD_STATUS, FIELD_STATUS_WAITING} - }; - TabUsageSingle.Update(API_CONTEXT, updateTabMap, USER_ID, MONETARY_ACCOUNT_ID, CASH_REGISTER_ID, tabUuid); + TabUsageSingle.Update(CASH_REGISTER_ID, tabUuid, status: STATUS_WAITING); DeleteTab(tabUuid); } - private static void DeleteTab(string tabId) + private static void DeleteTab(string tabUuid) { - TabUsageSingle.Delete(API_CONTEXT, USER_ID, MONETARY_ACCOUNT_ID, CASH_REGISTER_ID, tabId); + TabUsageSingle.Delete(CASH_REGISTER_ID, tabUuid); } private static string CreateTabAndGetUuid() { - var createTabMap = new Dictionary - { - {TabUsageSingle.FIELD_DESCRIPTION, TAB_FIELD_DESCRIPTION}, - {TabUsageSingle.FIELD_STATUS, FIELD_STATUS_OPEN}, - {TabUsageSingle.FIELD_AMOUNT_TOTAL, new Amount(AMOUNT_EUR, FIELD_CURRENCY)} - }; - - return TabUsageSingle.Create(API_CONTEXT, createTabMap, USER_ID, MONETARY_ACCOUNT_ID, - CASH_REGISTER_ID).Value; + return TabUsageSingle.Create(CASH_REGISTER_ID, TAB_DESCRIPTION, STATUS_OPEN, + new Amount(AMOUNT_EUR, FIELD_CURRENCY)).Value; } private static void AddTabItem(string tabUuid) { - var tabItemMap = new Dictionary - { - {TabItemShop.FIELD_AMOUNT, new Amount(AMOUNT_EUR, FIELD_CURRENCY)}, - {TabItemShop.FIELD_DESCRIPTION, TAB_ITEM_FIELD_DESCRIPTION} - }; - TabItemShop.Create(API_CONTEXT, tabItemMap, USER_ID, MONETARY_ACCOUNT_ID, CASH_REGISTER_ID, tabUuid); + TabItemShop.Create(CASH_REGISTER_ID, tabUuid, TAB_ITEM_DESCRIPTION); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Context/ApiContext.cs b/BunqSdk/Context/ApiContext.cs index 2edda96..adfbeb7 100644 --- a/BunqSdk/Context/ApiContext.cs +++ b/BunqSdk/Context/ApiContext.cs @@ -84,7 +84,7 @@ public static ApiContext Create(ApiEnvironmentType environmentType, string apiKe /// Create and initialize an API Context. /// public static ApiContext Create(ApiEnvironmentType environmentType, string apiKey, string deviceDescription, - IList permittedIps, string proxy = null) + List permittedIps, string proxy = null) { var apiContext = new ApiContext { @@ -100,7 +100,7 @@ public static ApiContext Create(ApiEnvironmentType environmentType, string apiKe /// /// Initializes an API context with Installation, DeviceServer and a SessionServer. /// - private void Initialize(string deviceDescription, IList permittedIps) + private void Initialize(string deviceDescription, List permittedIps) { /* The calls below are order-sensitive: to initialize a Device Registration, we need an * Installation, and to initialize a Session we need a Device Registration. */ @@ -120,9 +120,9 @@ private void InitializeInstallationContext() InstallationContext = new InstallationContext(installationResponse.Value, keyPairClient); } - private void RegisterDevice(string deviceDescription, IList permittedIps) + private void RegisterDevice(string deviceDescription, List permittedIps) { - DeviceServer.Create(this, GenerateRequestBodyBytes(deviceDescription, permittedIps)); + DeviceServerInternal.Create(this, deviceDescription, ApiKey, permittedIps); } private IDictionary GenerateRequestBodyBytes(string description, IList permittedIps) @@ -168,7 +168,7 @@ public void CloseSession() private void DeleteSession() { - Session.Delete(this, SESSION_ID_DUMMY); + Session.Delete(SESSION_ID_DUMMY); } /// diff --git a/BunqSdk/Context/BunqContext.cs b/BunqSdk/Context/BunqContext.cs new file mode 100644 index 0000000..a749a44 --- /dev/null +++ b/BunqSdk/Context/BunqContext.cs @@ -0,0 +1,51 @@ +using System; +using Bunq.Sdk.Exception; + +namespace Bunq.Sdk.Context +{ + public static class BunqContext + { + private const string ErrorApicontextHasNotBeenLoaded = "apiContext has not been loaded."; + private const string ErrorUserContextHasNotBeenLoaded = "userContext has not been loaded, you can load this by loading apiContext."; + private static ApiContext apiContext; + private static UserContext userContext; + + public static ApiContext ApiContext { + get + { + if (apiContext == null) + { + throw new BunqException(ErrorApicontextHasNotBeenLoaded); + } + else + { + return apiContext; + } + } + private set => apiContext = value ?? throw new ArgumentNullException(nameof(value)); + } + + public static UserContext UserContext + { + get + { + if (userContext == null) + { + throw new BunqException(ErrorUserContextHasNotBeenLoaded); + } + else + { + return userContext; + } + } + private set => userContext = value ?? throw new ArgumentNullException(nameof(value)); + } + + public static void LoadApiContext(ApiContext apiContextToLoad) + { + ApiContext = apiContextToLoad; + UserContext = new UserContext(apiContextToLoad.SessionContext.UserId); + UserContext.InitPrimaryMonetaryAccount(); + } + } +} diff --git a/BunqSdk/Context/SessionContext.cs b/BunqSdk/Context/SessionContext.cs index 9335d34..cbab494 100644 --- a/BunqSdk/Context/SessionContext.cs +++ b/BunqSdk/Context/SessionContext.cs @@ -1,4 +1,6 @@ using System; +using System.Diagnostics; +using Bunq.Sdk.Exception; using Bunq.Sdk.Model.Core; using Newtonsoft.Json; @@ -9,6 +11,13 @@ namespace Bunq.Sdk.Context /// public class SessionContext { + /// + /// Error constatns. + /// + private const string ErrorCouldNotDetermineUserId = "Could not determine user id."; + private const string ErrorSessionserverUsercompanyIdNull = "sessionServer.UserCompany.Id != null"; + private const string ErrorsessionserverUserpersonIdNull = "sessionServer.UserPerson.Id != null"; + /// /// Default assumed value for session timeout. /// @@ -25,6 +34,9 @@ public class SessionContext /// [JsonProperty(PropertyName = "expiry_time")] public DateTime ExpiryTime { get; private set; } + + [JsonProperty(PropertyName = "user_id")] + public int UserId { get; private set; } [JsonConstructor] private SessionContext() @@ -35,6 +47,25 @@ public SessionContext(SessionServer sessionServer) { Token = sessionServer.SessionToken.Token; ExpiryTime = DateTime.Now.AddSeconds(GetSessionTimeout(sessionServer)); + UserId = GetUserId(sessionServer); + } + + private static int GetUserId(SessionServer sessionServer) + { + if (sessionServer.UserCompany != null && sessionServer.UserPerson == null) + { + Debug.Assert(sessionServer.UserCompany.Id != null, ErrorSessionserverUsercompanyIdNull); + return sessionServer.UserCompany.Id.Value; + } + else if (sessionServer.UserPerson != null && sessionServer.UserCompany == null) + { + Debug.Assert(sessionServer.UserPerson.Id != null, ErrorsessionserverUserpersonIdNull); + return sessionServer.UserPerson.Id.Value; + } + else + { + throw new BunqException(ErrorCouldNotDetermineUserId); + } } private static double GetSessionTimeout(SessionServer sessionServer) diff --git a/BunqSdk/Context/UserContext.cs b/BunqSdk/Context/UserContext.cs new file mode 100644 index 0000000..330c90b --- /dev/null +++ b/BunqSdk/Context/UserContext.cs @@ -0,0 +1,80 @@ +using System; +using Bunq.Sdk.Exception; +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Endpoint; + +namespace Bunq.Sdk.Context +{ + public class UserContext + { + /// + /// Error constatns. + /// + private const string ErrorUnexpectedUser = "\'\"{0}\" is unexpected user instance.\'"; + + private const string ErrorNoActiveMonetaryAccountFound = "No active monetary account found."; + private const string ErrorPirmaryMonetaryAccountHasNotBeenLoaded = "Pirmary monetary account has not been loaded."; + private const string MonetaryAccountStatusActive = "ACTIVE"; + private MonetaryAccountBank primaryMonetaryAccountBank; + + public UserPerson UserPerson { get; private set; } + public UserCompany UserCompany { get; private set; } + + public MonetaryAccountBank PrimaryMonetaryAccountBank + { + get => primaryMonetaryAccountBank ?? throw new BunqException(ErrorPirmaryMonetaryAccountHasNotBeenLoaded); + private set => primaryMonetaryAccountBank = value ?? throw new ArgumentNullException(nameof(value)); + } + + public int UserId { get; } + + public UserContext(int userId) + { + UserId = userId; + + var userObject = User.List().Value[0].GetReferencedObject(); + this.SetUser(userObject); + } + + private void SetUser(BunqModel user) + { + if (user.GetType() == typeof(UserPerson)) + { + this.UserPerson = (UserPerson) user; + } + else if (user.GetType() == typeof(UserCompany)) + { + this.UserCompany = (UserCompany) user; + } + else + { + throw new BunqException(string.Format(ErrorUnexpectedUser, user.GetType())); + } + } + + public void InitPrimaryMonetaryAccount() + { + var allMonetaryAccount = MonetaryAccountBank.List().Value; + + foreach (var accountBank in allMonetaryAccount) + { + if (!accountBank.Status.Equals(MonetaryAccountStatusActive)) continue; + this.PrimaryMonetaryAccountBank = accountBank; + + return; + } + + throw new BunqException(ErrorNoActiveMonetaryAccountFound); + } + + public bool IsOnlyUserPersonSet() + { + return UserCompany == null && UserPerson != null; + } + + public bool isOnlyUserCompanySet() + { + return UserPerson == null && UserCompany != null; + } + } +} diff --git a/BunqSdk/Http/ApiClient.cs b/BunqSdk/Http/ApiClient.cs index 9df4989..7c3b4fb 100644 --- a/BunqSdk/Http/ApiClient.cs +++ b/BunqSdk/Http/ApiClient.cs @@ -309,7 +309,7 @@ private static string DetermineResponseIdByAllHeader(HttpHeaders allHeader) } else { - throw new BunqException(ERROR_COULD_NOT_DETERMINE_RESPONSE_ID_HEADER); + return ERROR_COULD_NOT_DETERMINE_RESPONSE_ID_HEADER; } } diff --git a/BunqSdk/Model/Core/BunqModel.cs b/BunqSdk/Model/Core/BunqModel.cs index 790109c..fa1e648 100644 --- a/BunqSdk/Model/Core/BunqModel.cs +++ b/BunqSdk/Model/Core/BunqModel.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Bunq.Sdk.Context; using Bunq.Sdk.Http; using Bunq.Sdk.Json; using Newtonsoft.Json.Linq; @@ -13,6 +14,7 @@ public abstract class BunqModel /// Field constants. /// private const string FIELD_RESPONSE = "Response"; + private const string FIELD_ID = "Id"; private const string FIELD_UUID = "Uuid"; private const string FIELD_PAGINATION = "Pagination"; @@ -95,7 +97,7 @@ protected static BunqResponse FromJson(BunqResponseRaw responseRaw) public static T CreateFromJsonString(string json) { var modelValue = BunqJsonConvert.DeserializeObject(json); - + return modelValue; } @@ -148,5 +150,20 @@ public override string ToString() } public abstract bool IsAllFieldNull(); + + protected static ApiContext GetApiContext() + { + return BunqContext.ApiContext; + } + + protected static int DetermineUserId() + { + return BunqContext.UserContext.UserId; + } + + protected static int DetermineMonetaryAccountId(int? monetaryAccountId = null) + { + return monetaryAccountId ?? BunqContext.UserContext.PrimaryMonetaryAccountBank.Id.Value; + } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Core/DeviceServerInternal.cs b/BunqSdk/Model/Core/DeviceServerInternal.cs new file mode 100644 index 0000000..c1fa76d --- /dev/null +++ b/BunqSdk/Model/Core/DeviceServerInternal.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using System.Text; +using Bunq.Sdk.Context; +using Bunq.Sdk.Http; +using Bunq.Sdk.Json; +using Bunq.Sdk.Model.Generated.Endpoint; + +namespace Bunq.Sdk.Model.Core +{ + public class DeviceServerInternal : DeviceServer + { + /// + /// Create a new DeviceServer providing the installation token in the header and signing the request with the + /// private part of the key you used to create the installation. The API Key that you are using will be bound to + /// the IP address of the DeviceServer which you have created.

Using a Wildcard API Key gives you the + /// freedom to make API calls even if the IP address has changed after the POST device-server.

Find out + /// more at this link https://bunq.com/en/apikey-dynamic-ip. + ///
+ public static BunqResponse Create(ApiContext apiContext, string description, string secret, List permittedIps = null, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(apiContext); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_SECRET, secret}, + {FIELD_PERMITTED_IPS, permittedIps}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = apiClient.Post(ENDPOINT_URL_CREATE, requestBytes, customHeaders); + + return ProcessForId(responseRaw); + } + } +} diff --git a/BunqSdk/Model/Generated/Endpoint/AttachmentConversationContent.cs b/BunqSdk/Model/Generated/Endpoint/AttachmentConversationContent.cs index 14589c3..f8635f7 100644 --- a/BunqSdk/Model/Generated/Endpoint/AttachmentConversationContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/AttachmentConversationContent.cs @@ -18,34 +18,37 @@ public class AttachmentConversationContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation/{1}/attachment/{2}/content"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation/{1}/attachment/{2}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "AttachmentConversationContent"; - + /// /// Get the raw content of a specific attachment. /// - public static BunqResponse List(ApiContext apiContext, int userId, int chatConversationId, int attachmentId, IDictionary customHeaders = null) + public static BunqResponse List(int chatConversationId, int attachmentId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, chatConversationId, attachmentId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), chatConversationId, attachmentId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static AttachmentConversationContent CreateFromJsonString(string json) @@ -53,4 +56,4 @@ public static AttachmentConversationContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/AttachmentMonetaryAccount.cs b/BunqSdk/Model/Generated/Endpoint/AttachmentMonetaryAccount.cs index 6052c53..6f69eb9 100644 --- a/BunqSdk/Model/Generated/Endpoint/AttachmentMonetaryAccount.cs +++ b/BunqSdk/Model/Generated/Endpoint/AttachmentMonetaryAccount.cs @@ -19,38 +19,42 @@ public class AttachmentMonetaryAccount : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/attachment"; - - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/attachment"; + + /// /// The attachment. /// [JsonProperty(PropertyName = "attachment")] - public Attachment Attachment { get; private set; } - + public Attachment Attachment { get; set; } + /// /// The ID of the attachment created. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// Create a new monetary account attachment. Create a POST request with a payload that contains the binary /// representation of the file, without any JSON wrapping. Make sure you define the MIME type (i.e. image/jpeg) /// in the Content-Type header. You are required to provide a description of the attachment using the /// X-Bunq-Attachment-Description header. /// - public static BunqResponse Create(ApiContext apiContext, byte[] requestBytes, int userId, int monetaryAccountId, IDictionary customHeaders = null) + public static BunqResponse Create(byte[] requestBytes, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -59,15 +63,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Id != null) { return false; } - + return true; } - + /// /// public static AttachmentMonetaryAccount CreateFromJsonString(string json) @@ -75,4 +79,4 @@ public static AttachmentMonetaryAccount CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/AttachmentPublic.cs b/BunqSdk/Model/Generated/Endpoint/AttachmentPublic.cs index 8349743..d4033e5 100644 --- a/BunqSdk/Model/Generated/Endpoint/AttachmentPublic.cs +++ b/BunqSdk/Model/Generated/Endpoint/AttachmentPublic.cs @@ -19,70 +19,74 @@ public class AttachmentPublic : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "attachment-public"; - private const string ENDPOINT_URL_READ = "attachment-public/{0}"; - + protected const string ENDPOINT_URL_CREATE = "attachment-public"; + + protected const string ENDPOINT_URL_READ = "attachment-public/{0}"; + /// /// Object type. /// private const string OBJECT_TYPE_POST = "Uuid"; + private const string OBJECT_TYPE_GET = "AttachmentPublic"; - + /// /// The UUID of the attachment. /// [JsonProperty(PropertyName = "uuid")] - public string Uuid { get; private set; } - + public string Uuid { get; set; } + /// /// The timestamp of the attachment's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the attachment's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The attachment. /// [JsonProperty(PropertyName = "attachment")] - public Attachment Attachment { get; private set; } - + public Attachment Attachment { get; set; } + /// /// Create a new public attachment. Create a POST request with a payload that contains a binary representation /// of the file, without any JSON wrapping. Make sure you define the MIME type (i.e. image/jpeg, or image/png) /// in the Content-Type header. You are required to provide a description of the attachment using the /// X-Bunq-Attachment-Description header. /// - public static BunqResponse Create(ApiContext apiContext, byte[] requestBytes, IDictionary customHeaders = null) + public static BunqResponse Create(byte[] requestBytes, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); var responseRaw = apiClient.Post(ENDPOINT_URL_CREATE, requestBytes, customHeaders); - + return ProcessForUuid(responseRaw); } - + /// /// Get a specific attachment's metadata through its UUID. The Content-Type header of the response will describe /// the MIME type of the attachment file. /// - public static BunqResponse Get(ApiContext apiContext, string attachmentPublicUuid, IDictionary customHeaders = null) + public static BunqResponse Get(string attachmentPublicUuid, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, attachmentPublicUuid), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, attachmentPublicUuid), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -91,25 +95,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Attachment != null) { return false; } - + return true; } - + /// /// public static AttachmentPublic CreateFromJsonString(string json) @@ -117,4 +121,4 @@ public static AttachmentPublic CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/AttachmentPublicContent.cs b/BunqSdk/Model/Generated/Endpoint/AttachmentPublicContent.cs index 52f47a4..240542b 100644 --- a/BunqSdk/Model/Generated/Endpoint/AttachmentPublicContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/AttachmentPublicContent.cs @@ -18,34 +18,36 @@ public class AttachmentPublicContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "attachment-public/{0}/content"; - + protected const string ENDPOINT_URL_LISTING = "attachment-public/{0}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "AttachmentPublicContent"; - + /// /// Get the raw content of a specific attachment. /// - public static BunqResponse List(ApiContext apiContext, string attachmentPublicUuid, IDictionary customHeaders = null) + public static BunqResponse List(string attachmentPublicUuid, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, attachmentPublicUuid), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, attachmentPublicUuid), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static AttachmentPublicContent CreateFromJsonString(string json) @@ -53,4 +55,4 @@ public static AttachmentPublicContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/AttachmentTab.cs b/BunqSdk/Model/Generated/Endpoint/AttachmentTab.cs index d4e2322..a497a51 100644 --- a/BunqSdk/Model/Generated/Endpoint/AttachmentTab.cs +++ b/BunqSdk/Model/Generated/Endpoint/AttachmentTab.cs @@ -19,68 +19,77 @@ public class AttachmentTab : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/attachment-tab"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/attachment-tab/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/attachment-tab"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/attachment-tab/{2}"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "AttachmentTab"; - + /// /// The id of the attachment. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the attachment's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the attachment's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The attachment. /// [JsonProperty(PropertyName = "attachment")] - public Attachment Attachment { get; private set; } - + public Attachment Attachment { get; set; } + /// /// Upload a new attachment to use with a tab, and to read its metadata. Create a POST request with a payload /// that contains the binary representation of the file, without any JSON wrapping. Make sure you define the /// MIME type (i.e. image/jpeg) in the Content-Type header. You are required to provide a description of the /// attachment using the X-Bunq-Attachment-Description header. /// - public static BunqResponse Create(ApiContext apiContext, byte[] requestBytes, int userId, int monetaryAccountId, IDictionary customHeaders = null) + public static BunqResponse Create(byte[] requestBytes, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a specific attachment. The header of the response contains the content-type of the attachment. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int attachmentTabId, IDictionary customHeaders = null) + public static BunqResponse Get(int attachmentTabId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, attachmentTabId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + attachmentTabId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -89,25 +98,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Attachment != null) { return false; } - + return true; } - + /// /// public static AttachmentTab CreateFromJsonString(string json) @@ -115,4 +124,4 @@ public static AttachmentTab CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/AttachmentTabContent.cs b/BunqSdk/Model/Generated/Endpoint/AttachmentTabContent.cs index 0053df6..6a8de14 100644 --- a/BunqSdk/Model/Generated/Endpoint/AttachmentTabContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/AttachmentTabContent.cs @@ -18,34 +18,39 @@ public class AttachmentTabContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/attachment-tab/{2}/content"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/attachment-tab/{2}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "AttachmentTabContent"; - + /// /// Get the raw content of a specific attachment. /// - public static BunqResponse List(ApiContext apiContext, int userId, int monetaryAccountId, int attachmentTabId, IDictionary customHeaders = null) + public static BunqResponse List(int attachmentTabId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, attachmentTabId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), attachmentTabId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static AttachmentTabContent CreateFromJsonString(string json) @@ -53,4 +58,4 @@ public static AttachmentTabContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Avatar.cs b/BunqSdk/Model/Generated/Endpoint/Avatar.cs index 1824c92..30afdb3 100644 --- a/BunqSdk/Model/Generated/Endpoint/Avatar.cs +++ b/BunqSdk/Model/Generated/Endpoint/Avatar.cs @@ -21,58 +21,69 @@ public class Avatar : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "avatar"; - private const string ENDPOINT_URL_READ = "avatar/{0}"; - + protected const string ENDPOINT_URL_CREATE = "avatar"; + + protected const string ENDPOINT_URL_READ = "avatar/{0}"; + /// /// Field constants. /// public const string FIELD_ATTACHMENT_PUBLIC_UUID = "attachment_public_uuid"; - + /// /// Object type. /// private const string OBJECT_TYPE_POST = "Uuid"; + private const string OBJECT_TYPE_GET = "Avatar"; - + /// /// The UUID of the created avatar. /// [JsonProperty(PropertyName = "uuid")] - public string Uuid { get; private set; } - + public string Uuid { get; set; } + /// /// The content type of the image. /// [JsonProperty(PropertyName = "image")] - public List Image { get; private set; } - + public List Image { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, IDictionary customHeaders = null) + /// The public UUID of the public attachment from which an avatar image must be created. + public static BunqResponse Create(string attachmentPublicUuid, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_ATTACHMENT_PUBLIC_UUID, attachmentPublicUuid}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); var responseRaw = apiClient.Post(ENDPOINT_URL_CREATE, requestBytes, customHeaders); - + return ProcessForUuid(responseRaw); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, string avatarUuid, IDictionary customHeaders = null) + public static BunqResponse Get(string avatarUuid, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, avatarUuid), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, avatarUuid), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -81,15 +92,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Image != null) { return false; } - + return true; } - + /// /// public static Avatar CreateFromJsonString(string json) @@ -97,4 +108,4 @@ public static Avatar CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs b/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs index a517765..12b4260 100644 --- a/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs +++ b/BunqSdk/Model/Generated/Endpoint/BillingContractSubscription.cs @@ -17,90 +17,102 @@ public class BillingContractSubscription : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/billing-contract-subscription"; - private const string ENDPOINT_URL_LISTING = "user/{0}/billing-contract-subscription"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/billing-contract-subscription"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/billing-contract-subscription"; + /// /// Field constants. /// public const string FIELD_SUBSCRIPTION_TYPE = "subscription_type"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "BillingContractSubscription"; - + /// /// The id of the billing contract. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the billing contract was made. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the billing contract was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The date from when the billing contract is valid. /// [JsonProperty(PropertyName = "contract_date_start")] - public string ContractDateStart { get; private set; } - + public string ContractDateStart { get; set; } + /// /// The date until when the billing contract is valid. /// [JsonProperty(PropertyName = "contract_date_end")] - public string ContractDateEnd { get; private set; } - + public string ContractDateEnd { get; set; } + /// /// The version of the billing contract. /// [JsonProperty(PropertyName = "contract_version")] - public int? ContractVersion { get; private set; } - + public int? ContractVersion { get; set; } + /// /// The subscription type of the user. Can be one of PERSON_SUPER_LIGHT_V1, PERSON_LIGHT_V1, PERSON_MORE_V1, /// PERSON_FREE_V1, PERSON_PREMIUM_V1, COMPANY_V1, or COMPANY_V2. /// [JsonProperty(PropertyName = "subscription_type")] - public string SubscriptionType { get; private set; } - + public string SubscriptionType { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The subscription type of the user. Can be one of PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, COMPANY_V1, or COMPANY_V2. + public static BunqResponse Create(string subscriptionType, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_SUBSCRIPTION_TYPE, subscriptionType}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get all subscription billing contract for the authenticated user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -109,40 +121,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.ContractDateStart != null) { return false; } - + if (this.ContractDateEnd != null) { return false; } - + if (this.ContractVersion != null) { return false; } - + if (this.SubscriptionType != null) { return false; } - + return true; } - + /// /// public static BillingContractSubscription CreateFromJsonString(string json) @@ -150,4 +162,4 @@ public static BillingContractSubscription CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserProfile.cs b/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserProfile.cs index 0626ab8..bad2a58 100644 --- a/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserProfile.cs +++ b/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserProfile.cs @@ -14,52 +14,52 @@ public class BunqMeFundraiserProfile : BunqModel /// Field constants. ///
public const string FIELD_POINTER = "pointer"; - - + + /// /// The color chosen for the bunq.me fundraiser profile in hexadecimal format. /// [JsonProperty(PropertyName = "color")] - public string Color { get; private set; } - + public string Color { get; set; } + /// /// The LabelMonetaryAccount with the public information of the User and the MonetaryAccount that created the /// bunq.me fundraiser profile. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The description of the bunq.me fundraiser profile. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The attachments attached to the fundraiser profile. /// [JsonProperty(PropertyName = "attachment")] - public List Attachment { get; private set; } - + public List Attachment { get; set; } + /// /// The pointer (url) which will be used to access the bunq.me fundraiser profile. /// [JsonProperty(PropertyName = "pointer")] - public MonetaryAccountReference Pointer { get; private set; } - + public MonetaryAccountReference Pointer { get; set; } + /// /// The status of the bunq.me fundraiser profile, can be ACTIVE or DEACTIVATED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The URL which the user is sent to when a payment is completed. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - - + public string RedirectUrl { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -68,40 +68,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Alias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Attachment != null) { return false; } - + if (this.Pointer != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + return true; } - + /// /// public static BunqMeFundraiserProfile CreateFromJsonString(string json) @@ -109,4 +109,4 @@ public static BunqMeFundraiserProfile CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserResult.cs b/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserResult.cs index 834cc03..d53a8b5 100644 --- a/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserResult.cs +++ b/BunqSdk/Model/Generated/Endpoint/BunqMeFundraiserResult.cs @@ -13,33 +13,33 @@ public class BunqMeFundraiserResult : BunqModel /// The id of the bunq.me. ///
[JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the bunq.me was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the bunq.me was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The bunq.me fundraiser profile. /// [JsonProperty(PropertyName = "bunqme_fundraiser_profile")] - public BunqMeFundraiserProfile BunqmeFundraiserProfile { get; private set; } - + public BunqMeFundraiserProfile BunqmeFundraiserProfile { get; set; } + /// /// The list of payments, paid to the bunq.me fundraiser profile. /// [JsonProperty(PropertyName = "payments")] - public List Payments { get; private set; } - - + public List Payments { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -48,30 +48,30 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.BunqmeFundraiserProfile != null) { return false; } - + if (this.Payments != null) { return false; } - + return true; } - + /// /// public static BunqMeFundraiserResult CreateFromJsonString(string json) @@ -79,4 +79,4 @@ public static BunqMeFundraiserResult CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BunqMeTab.cs b/BunqSdk/Model/Generated/Endpoint/BunqMeTab.cs index 8d14262..4fe658a 100644 --- a/BunqSdk/Model/Generated/Endpoint/BunqMeTab.cs +++ b/BunqSdk/Model/Generated/Endpoint/BunqMeTab.cs @@ -18,128 +18,162 @@ public class BunqMeTab : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/bunqme-tab"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/bunqme-tab/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/bunqme-tab"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/bunqme-tab/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/bunqme-tab"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/bunqme-tab/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/bunqme-tab"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/bunqme-tab/{2}"; + /// /// Field constants. /// public const string FIELD_BUNQME_TAB_ENTRY = "bunqme_tab_entry"; + public const string FIELD_STATUS = "status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "BunqMeTab"; - + /// /// The id of the created bunq.me. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the bunq.me was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the bunq.me was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The timestamp of when the bunq.me expired or will expire. /// [JsonProperty(PropertyName = "time_expiry")] - public string TimeExpiry { get; private set; } - + public string TimeExpiry { get; set; } + /// /// The id of the MonetaryAccount the bunq.me was sent from. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The status of the bunq.me. Can be WAITING_FOR_PAYMENT, CANCELLED or EXPIRED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The url that points to the bunq.me page. /// [JsonProperty(PropertyName = "bunqme_tab_share_url")] - public string BunqmeTabShareUrl { get; private set; } - + public string BunqmeTabShareUrl { get; set; } + /// /// The bunq.me entry containing the payment information. /// [JsonProperty(PropertyName = "bunqme_tab_entry")] - public BunqMeTabEntry BunqmeTabEntry { get; private set; } - + public BunqMeTabEntry BunqmeTabEntry { get; set; } + /// /// The list of bunq.me result Inquiries successfully made and paid. /// [JsonProperty(PropertyName = "result_inquiries")] - public List ResultInquiries { get; private set; } - + public List ResultInquiries { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The bunq.me entry containing the payment information. + /// The status of the bunq.me. Ignored in POST requests but can be used for cancelling the bunq.me by setting status as CANCELLED with a PUT request. + public static BunqResponse Create(BunqMeTabEntry bunqmeTabEntry, int? monetaryAccountId = null, + string status = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_BUNQME_TAB_ENTRY, bunqmeTabEntry}, + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int bunqMeTabId, IDictionary customHeaders = null) + /// The status of the bunq.me. Ignored in POST requests but can be used for cancelling the bunq.me by setting status as CANCELLED with a PUT request. + public static BunqResponse Update(int bunqMeTabId, int? monetaryAccountId = null, string status = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, bunqMeTabId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + bunqMeTabId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int bunqMeTabId, IDictionary customHeaders = null) + public static BunqResponse Get(int bunqMeTabId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, bunqMeTabId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + bunqMeTabId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -148,50 +182,50 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.TimeExpiry != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.BunqmeTabShareUrl != null) { return false; } - + if (this.BunqmeTabEntry != null) { return false; } - + if (this.ResultInquiries != null) { return false; } - + return true; } - + /// /// public static BunqMeTab CreateFromJsonString(string json) @@ -199,4 +233,4 @@ public static BunqMeTab CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BunqMeTabEntry.cs b/BunqSdk/Model/Generated/Endpoint/BunqMeTabEntry.cs index 2026cc2..e7c2a5d 100644 --- a/BunqSdk/Model/Generated/Endpoint/BunqMeTabEntry.cs +++ b/BunqSdk/Model/Generated/Endpoint/BunqMeTabEntry.cs @@ -15,54 +15,55 @@ public class BunqMeTabEntry : BunqModel /// Field constants. ///
public const string FIELD_AMOUNT_INQUIRED = "amount_inquired"; + public const string FIELD_DESCRIPTION = "description"; public const string FIELD_REDIRECT_URL = "redirect_url"; - - + + /// /// The uuid of the bunq.me. /// [JsonProperty(PropertyName = "uuid")] - public string Uuid { get; private set; } - + public string Uuid { get; set; } + /// /// The requested Amount. /// [JsonProperty(PropertyName = "amount_inquired")] - public Amount AmountInquired { get; private set; } - + public Amount AmountInquired { get; set; } + /// /// The LabelMonetaryAccount with the public information of the User and the MonetaryAccount that created the /// bunq.me link. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The description for the bunq.me. Maximum 9000 characters. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The status of the bunq.me. Can be WAITING_FOR_PAYMENT, CANCELLED or EXPIRED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The URL which the user is sent to when a payment is completed. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - + public string RedirectUrl { get; set; } + /// /// List of available merchants. /// [JsonProperty(PropertyName = "merchant_available")] - public List MerchantAvailable { get; private set; } - - + public List MerchantAvailable { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -71,40 +72,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.AmountInquired != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + if (this.MerchantAvailable != null) { return false; } - + return true; } - + /// /// public static BunqMeTabEntry CreateFromJsonString(string json) @@ -112,4 +113,4 @@ public static BunqMeTabEntry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultInquiry.cs b/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultInquiry.cs index 874c50e..3e5c50a 100644 --- a/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultInquiry.cs +++ b/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultInquiry.cs @@ -14,15 +14,15 @@ public class BunqMeTabResultInquiry : BunqModel /// The payment made for the Tab. ///
[JsonProperty(PropertyName = "payment")] - public Payment Payment { get; private set; } - + public Payment Payment { get; set; } + /// /// The Id of the bunq.me tab that this BunqMeTabResultInquiry belongs to. /// [JsonProperty(PropertyName = "bunq_me_tab_id")] - public int? BunqMeTabId { get; private set; } - - + public int? BunqMeTabId { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -31,15 +31,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.BunqMeTabId != null) { return false; } - + return true; } - + /// /// public static BunqMeTabResultInquiry CreateFromJsonString(string json) @@ -47,4 +47,4 @@ public static BunqMeTabResultInquiry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultResponse.cs b/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultResponse.cs index aa0658f..3ba962c 100644 --- a/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultResponse.cs +++ b/BunqSdk/Model/Generated/Endpoint/BunqMeTabResultResponse.cs @@ -14,9 +14,9 @@ public class BunqMeTabResultResponse : BunqModel /// The payment made for the bunq.me tab. ///
[JsonProperty(PropertyName = "payment")] - public Payment Payment { get; private set; } - - + public Payment Payment { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -25,10 +25,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static BunqMeTabResultResponse CreateFromJsonString(string json) @@ -36,4 +36,4 @@ public static BunqMeTabResultResponse CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Card.cs b/BunqSdk/Model/Generated/Endpoint/Card.cs index df40c18..9f25b8a 100644 --- a/BunqSdk/Model/Generated/Endpoint/Card.cs +++ b/BunqSdk/Model/Generated/Endpoint/Card.cs @@ -19,14 +19,16 @@ public class Card : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_UPDATE = "user/{0}/card/{1}"; - private const string ENDPOINT_URL_READ = "user/{0}/card/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/card"; - + protected const string ENDPOINT_URL_UPDATE = "user/{0}/card/{1}"; + + protected const string ENDPOINT_URL_READ = "user/{0}/card/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/card"; + /// /// Field constants. /// public const string FIELD_PIN_CODE = "pin_code"; + public const string FIELD_ACTIVATION_CODE = "activation_code"; public const string FIELD_STATUS = "status"; public const string FIELD_LIMIT = "limit"; @@ -35,187 +37,220 @@ public class Card : BunqModel public const string FIELD_MONETARY_ACCOUNT_CURRENT_ID = "monetary_account_current_id"; public const string FIELD_PIN_CODE_ASSIGNMENT = "pin_code_assignment"; public const string FIELD_MONETARY_ACCOUNT_ID_FALLBACK = "monetary_account_id_fallback"; - + /// /// Object type. /// + private const string OBJECT_TYPE_PUT = "CardDebit"; + private const string OBJECT_TYPE_GET = "CardDebit"; - + /// /// The id of the card. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the card's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the card's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The public UUID of the card. /// [JsonProperty(PropertyName = "public_uuid")] - public string PublicUuid { get; private set; } - + public string PublicUuid { get; set; } + /// /// The type of the card. Can be MAESTRO, MASTERCARD. /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + public string Type { get; set; } + /// /// The sub-type of the card. /// [JsonProperty(PropertyName = "sub_type")] - public string SubType { get; private set; } - + public string SubType { get; set; } + /// /// The second line of text on the card /// [JsonProperty(PropertyName = "second_line")] - public string SecondLine { get; private set; } - + public string SecondLine { get; set; } + /// /// The status to set for the card. Can be ACTIVE, DEACTIVATED, LOST, STOLEN, CANCELLED, EXPIRED or /// PIN_TRIES_EXCEEDED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The sub-status of the card. Can be NONE or REPLACED. /// [JsonProperty(PropertyName = "sub_status")] - public string SubStatus { get; private set; } - + public string SubStatus { get; set; } + /// /// The order status of the card. Can be CARD_UPDATE_REQUESTED, CARD_UPDATE_SENT, CARD_UPDATE_ACCEPTED, /// ACCEPTED_FOR_PRODUCTION or DELIVERED_TO_CUSTOMER. /// [JsonProperty(PropertyName = "order_status")] - public string OrderStatus { get; private set; } - + public string OrderStatus { get; set; } + /// /// Expiry date of the card. /// [JsonProperty(PropertyName = "expiry_date")] - public string ExpiryDate { get; private set; } - + public string ExpiryDate { get; set; } + /// /// The user's name on the card. /// [JsonProperty(PropertyName = "name_on_card")] - public string NameOnCard { get; private set; } - + public string NameOnCard { get; set; } + /// /// The last 4 digits of the PAN of the card. /// [JsonProperty(PropertyName = "primary_account_number_four_digit")] - public string PrimaryAccountNumberFourDigit { get; private set; } - + public string PrimaryAccountNumberFourDigit { get; set; } + /// /// The limits to define for the card, among CARD_LIMIT_CONTACTLESS, CARD_LIMIT_ATM, CARD_LIMIT_DIPPING and /// CARD_LIMIT_POS_ICC (e.g. 25 EUR for CARD_LIMIT_CONTACTLESS) /// [JsonProperty(PropertyName = "limit")] - public List Limit { get; private set; } - + public List Limit { get; set; } + /// /// The countries for which to grant (temporary) permissions to use the card. /// [JsonProperty(PropertyName = "mag_stripe_permission")] - public CardMagStripePermission MagStripePermission { get; private set; } - + public CardMagStripePermission MagStripePermission { get; set; } + /// /// The countries for which to grant (temporary) permissions to use the card. /// [JsonProperty(PropertyName = "country_permission")] - public List CountryPermission { get; private set; } - + public List CountryPermission { get; set; } + /// /// The monetary account this card was ordered on and the label user that owns the card. /// [JsonProperty(PropertyName = "label_monetary_account_ordered")] - public MonetaryAccountReference LabelMonetaryAccountOrdered { get; private set; } - + public MonetaryAccountReference LabelMonetaryAccountOrdered { get; set; } + /// /// The monetary account that this card is currently linked to and the label user viewing it. /// [JsonProperty(PropertyName = "label_monetary_account_current")] - public MonetaryAccountReference LabelMonetaryAccountCurrent { get; private set; } - + public MonetaryAccountReference LabelMonetaryAccountCurrent { get; set; } + /// /// Array of Types, PINs, account IDs assigned to the card. /// [JsonProperty(PropertyName = "pin_code_assignment")] - public List PinCodeAssignment { get; private set; } - + public List PinCodeAssignment { get; set; } + /// /// ID of the MA to be used as fallback for this card if insufficient balance. Fallback account is removed if /// not supplied. /// [JsonProperty(PropertyName = "monetary_account_id_fallback")] - public int? MonetaryAccountIdFallback { get; private set; } - + public int? MonetaryAccountIdFallback { get; set; } + /// /// The country that is domestic to the card. Defaults to country of residence of user. /// [JsonProperty(PropertyName = "country")] - public string Country { get; private set; } - + public string Country { get; set; } + /// /// Update the card details. Allow to change pin code, status, limits, country permissions and the monetary /// account connected to the card. When the card has been received, it can be also activated through this /// endpoint. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int cardId, IDictionary customHeaders = null) + /// The plaintext pin code. Requests require encryption to be enabled. + /// The activation code required to set status to ACTIVE initially. Can only set status to ACTIVE using activation code when order_status is ACCEPTED_FOR_PRODUCTION and status is DEACTIVATED. + /// The status to set for the card. Can be ACTIVE, DEACTIVATED, LOST, STOLEN or CANCELLED, and can only be set to LOST/STOLEN/CANCELLED when order status is ACCEPTED_FOR_PRODUCTION/DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. Can only be set to DEACTIVATED after initial activation, i.e. order_status is DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. Mind that all the possible choices (apart from ACTIVE and DEACTIVATED) are permanent and cannot be changed after. + /// The limits to define for the card, among CARD_LIMIT_CONTACTLESS, CARD_LIMIT_ATM, CARD_LIMIT_DIPPING and CARD_LIMIT_POS_ICC (e.g. 25 EUR for CARD_LIMIT_CONTACTLESS). All the limits must be provided on update. + /// Whether or not it is allowed to use the mag stripe for the card. + /// The countries for which to grant (temporary) permissions to use the card. + /// The ID of the monetary account that card transactions will use. + /// Array of Types, PINs, account IDs assigned to the card. + /// ID of the MA to be used as fallback for this card if insufficient balance. Fallback account is removed if not supplied. + public static BunqResponse Update(int cardId, string pinCode = null, string activationCode = null, + string status = null, List limit = null, CardMagStripePermission magStripePermission = null, + List countryPermission = null, int? monetaryAccountCurrentId = null, + List pinCodeAssignment = null, int? monetaryAccountIdFallback = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PIN_CODE, pinCode}, + {FIELD_ACTIVATION_CODE, activationCode}, + {FIELD_STATUS, status}, + {FIELD_LIMIT, limit}, + {FIELD_MAG_STRIPE_PERMISSION, magStripePermission}, + {FIELD_COUNTRY_PERMISSION, countryPermission}, + {FIELD_MONETARY_ACCOUNT_CURRENT_ID, monetaryAccountCurrentId}, + {FIELD_PIN_CODE_ASSIGNMENT, pinCodeAssignment}, + {FIELD_MONETARY_ACCOUNT_ID_FALLBACK, monetaryAccountIdFallback}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - requestBytes = SecurityUtils.Encrypt(apiContext, requestBytes, customHeaders); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, cardId), requestBytes, customHeaders); - - return ProcessForId(responseRaw); + requestBytes = SecurityUtils.Encrypt(GetApiContext(), requestBytes, customHeaders); + var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), cardId), requestBytes, + customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_PUT); } - + /// /// Return the details of a specific card. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int cardId, IDictionary customHeaders = null) + public static BunqResponse Get(int cardId, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, cardId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), cardId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Return all the cards available to the user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -224,110 +259,110 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.PublicUuid != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.SubType != null) { return false; } - + if (this.SecondLine != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.SubStatus != null) { return false; } - + if (this.OrderStatus != null) { return false; } - + if (this.ExpiryDate != null) { return false; } - + if (this.NameOnCard != null) { return false; } - + if (this.PrimaryAccountNumberFourDigit != null) { return false; } - + if (this.Limit != null) { return false; } - + if (this.MagStripePermission != null) { return false; } - + if (this.CountryPermission != null) { return false; } - + if (this.LabelMonetaryAccountOrdered != null) { return false; } - + if (this.LabelMonetaryAccountCurrent != null) { return false; } - + if (this.PinCodeAssignment != null) { return false; } - + if (this.MonetaryAccountIdFallback != null) { return false; } - + if (this.Country != null) { return false; } - + return true; } - + /// /// public static Card CreateFromJsonString(string json) @@ -335,4 +370,4 @@ public static Card CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardDebit.cs b/BunqSdk/Model/Generated/Endpoint/CardDebit.cs index 234d9ef..4669683 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardDebit.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardDebit.cs @@ -20,161 +20,181 @@ public class CardDebit : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/card-debit"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/card-debit"; + /// /// Field constants. /// public const string FIELD_SECOND_LINE = "second_line"; + public const string FIELD_NAME_ON_CARD = "name_on_card"; public const string FIELD_ALIAS = "alias"; public const string FIELD_TYPE = "type"; public const string FIELD_PIN_CODE_ASSIGNMENT = "pin_code_assignment"; public const string FIELD_MONETARY_ACCOUNT_ID_FALLBACK = "monetary_account_id_fallback"; - public const string FIELD_COUNTRY = "country"; - + /// /// Object type. /// private const string OBJECT_TYPE_POST = "CardDebit"; - + /// /// The id of the card. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the card was crated. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the card was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The public UUID of the card. /// [JsonProperty(PropertyName = "public_uuid")] - public string PublicUuid { get; private set; } - + public string PublicUuid { get; set; } + /// /// The type of the card. Can be MAESTRO, MASTERCARD. /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + public string Type { get; set; } + /// /// The sub_type of card. /// [JsonProperty(PropertyName = "sub_type")] - public string SubType { get; private set; } - + public string SubType { get; set; } + /// /// The second line of text on the card /// [JsonProperty(PropertyName = "second_line")] - public string SecondLine { get; private set; } - + public string SecondLine { get; set; } + /// /// The user's name as will be on the card /// [JsonProperty(PropertyName = "name_on_card")] - public string NameOnCard { get; private set; } - + public string NameOnCard { get; set; } + /// /// The last 4 digits of the PAN of the card. /// [JsonProperty(PropertyName = "primary_account_number_four_digit")] - public string PrimaryAccountNumberFourDigit { get; private set; } - + public string PrimaryAccountNumberFourDigit { get; set; } + /// /// The status to set for the card. After ordering the card it will be DEACTIVATED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The order status of the card. After ordering the card it will be NEW_CARD_REQUEST_RECEIVED. /// [JsonProperty(PropertyName = "order_status")] - public string OrderStatus { get; private set; } - + public string OrderStatus { get; set; } + /// /// The expiry date of the card. /// [JsonProperty(PropertyName = "expiry_date")] - public string ExpiryDate { get; private set; } - + public string ExpiryDate { get; set; } + /// /// The limits to define for the card (e.g. 25 EUR for CARD_LIMIT_CONTACTLESS). /// [JsonProperty(PropertyName = "limit")] - public List Limit { get; private set; } - + public List Limit { get; set; } + /// /// The countries for which to grant (temporary) permissions to use the card. /// [JsonProperty(PropertyName = "country_permission")] - public List CountryPermission { get; private set; } - + public List CountryPermission { get; set; } + /// /// The monetary account this card was ordered on and the label user that owns the card. /// [JsonProperty(PropertyName = "label_monetary_account_ordered")] - public MonetaryAccountReference LabelMonetaryAccountOrdered { get; private set; } - + public MonetaryAccountReference LabelMonetaryAccountOrdered { get; set; } + /// /// The monetary account that this card is currently linked to and the label user viewing it. /// [JsonProperty(PropertyName = "label_monetary_account_current")] - public MonetaryAccountReference LabelMonetaryAccountCurrent { get; private set; } - + public MonetaryAccountReference LabelMonetaryAccountCurrent { get; set; } + /// /// The label for the user who requested the card. /// [JsonProperty(PropertyName = "alias")] - public LabelUser Alias { get; private set; } - + public LabelUser Alias { get; set; } + /// /// Array of Types, PINs, account IDs assigned to the card. /// [JsonProperty(PropertyName = "pin_code_assignment")] - public List PinCodeAssignment { get; private set; } - + public List PinCodeAssignment { get; set; } + /// /// ID of the MA to be used as fallback for this card if insufficient balance. Fallback account is removed if /// not supplied. /// [JsonProperty(PropertyName = "monetary_account_id_fallback")] - public int? MonetaryAccountIdFallback { get; private set; } - + public int? MonetaryAccountIdFallback { get; set; } + /// /// The country that is domestic to the card. Defaults to country of residence of user. /// [JsonProperty(PropertyName = "country")] - public string Country { get; private set; } - + public string Country { get; set; } + /// /// Create a new debit card request. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The second line of text on the card, used as name/description for it. It can contain at most 17 characters and it can be empty. + /// The user's name as it will be on the card. Check 'card-name' for the available card names for a user. + /// The pointer to the monetary account that will be connected at first with the card. Its IBAN code is also the one that will be printed on the card itself. The pointer must be of type IBAN. + /// The type of card to order. Can be MAESTRO or MASTERCARD. + /// Array of Types, PINs, account IDs assigned to the card. + /// ID of the MA to be used as fallback for this card if insufficient balance. Fallback account is removed if not supplied. + public static BunqResponse Create(string secondLine, string nameOnCard, Pointer alias = null, + string type = null, List pinCodeAssignment = null, int? monetaryAccountIdFallback = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_SECOND_LINE, secondLine}, + {FIELD_NAME_ON_CARD, nameOnCard}, + {FIELD_ALIAS, alias}, + {FIELD_TYPE, type}, + {FIELD_PIN_CODE_ASSIGNMENT, pinCodeAssignment}, + {FIELD_MONETARY_ACCOUNT_ID_FALLBACK, monetaryAccountIdFallback}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - requestBytes = SecurityUtils.Encrypt(apiContext, requestBytes, customHeaders); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + requestBytes = SecurityUtils.Encrypt(GetApiContext(), requestBytes, customHeaders); + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_POST); } - - + + /// /// public override bool IsAllFieldNull() @@ -183,105 +203,105 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.PublicUuid != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.SubType != null) { return false; } - + if (this.SecondLine != null) { return false; } - + if (this.NameOnCard != null) { return false; } - + if (this.PrimaryAccountNumberFourDigit != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.OrderStatus != null) { return false; } - + if (this.ExpiryDate != null) { return false; } - + if (this.Limit != null) { return false; } - + if (this.CountryPermission != null) { return false; } - + if (this.LabelMonetaryAccountOrdered != null) { return false; } - + if (this.LabelMonetaryAccountCurrent != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.PinCodeAssignment != null) { return false; } - + if (this.MonetaryAccountIdFallback != null) { return false; } - + if (this.Country != null) { return false; } - + return true; } - + /// /// public static CardDebit CreateFromJsonString(string json) @@ -289,4 +309,4 @@ public static CardDebit CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs b/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs index 0f694a8..5b35f7d 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs @@ -18,94 +18,106 @@ public class CardGeneratedCvc2 : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/generated-cvc2"; - private const string ENDPOINT_URL_READ = "user/{0}/card/{1}/generated-cvc2/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/generated-cvc2"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/generated-cvc2"; + + protected const string ENDPOINT_URL_READ = "user/{0}/card/{1}/generated-cvc2/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/generated-cvc2"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CardGeneratedCvc2"; - + /// /// The id of the cvc code. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the cvc code's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the cvc code's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The cvc2 code. /// [JsonProperty(PropertyName = "cvc2")] - public string Cvc2 { get; private set; } - + public string Cvc2 { get; set; } + /// /// The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// Expiry time of the cvc2. /// [JsonProperty(PropertyName = "expiry_time")] - public string ExpiryTime { get; private set; } - + public string ExpiryTime { get; set; } + /// /// Generate a new CVC2 code for a card. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int cardId, IDictionary customHeaders = null) + public static BunqResponse Create(int cardId, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - requestBytes = SecurityUtils.Encrypt(apiContext, requestBytes, customHeaders); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, cardId), requestBytes, customHeaders); - + requestBytes = SecurityUtils.Encrypt(GetApiContext(), requestBytes, customHeaders); + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), cardId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the details for a specific generated CVC2 code. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int cardId, int cardGeneratedCvc2Id, IDictionary customHeaders = null) + public static BunqResponse Get(int cardId, int cardGeneratedCvc2Id, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, cardId, cardGeneratedCvc2Id), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), cardId, cardGeneratedCvc2Id), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get all generated CVC2 codes for a card. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int cardId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cardId, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, cardId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), cardId), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -114,35 +126,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Cvc2 != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.ExpiryTime != null) { return false; } - + return true; } - + /// /// public static CardGeneratedCvc2 CreateFromJsonString(string json) @@ -150,4 +162,4 @@ public static CardGeneratedCvc2 CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardName.cs b/BunqSdk/Model/Generated/Endpoint/CardName.cs index a2cc352..71e5e3d 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardName.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardName.cs @@ -19,34 +19,36 @@ public class CardName : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/card-name"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/card-name"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CardUserNameArray"; - + /// /// All possible variations (of suitable length) of user's legal name for the debit card. /// [JsonProperty(PropertyName = "possible_card_name_array")] - public List PossibleCardNameArray { get; private set; } - + public List PossibleCardNameArray { get; set; } + /// /// Return all the accepted card names for a specific user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -55,10 +57,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static CardName CreateFromJsonString(string json) @@ -66,4 +68,4 @@ public static CardName CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs b/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs index 85745a3..e64a906 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardPinChange.cs @@ -18,76 +18,82 @@ public class CardPinChange : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/pin-change"; - private const string ENDPOINT_URL_READ = "user/{0}/card/{1}/pin-change/{2}"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/pin-change"; + + protected const string ENDPOINT_URL_READ = "user/{0}/card/{1}/pin-change/{2}"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CardPinChange"; - + /// /// The id of the pin change. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The label of the card. /// [JsonProperty(PropertyName = "label_card")] - public LabelCard LabelCard { get; private set; } - + public LabelCard LabelCard { get; set; } + /// /// The monetary account this card was ordered on and the label user that owns the card. /// [JsonProperty(PropertyName = "label_monetary_account_current")] - public MonetaryAccountReference LabelMonetaryAccountCurrent { get; private set; } - + public MonetaryAccountReference LabelMonetaryAccountCurrent { get; set; } + /// /// The request date of the pin change. /// [JsonProperty(PropertyName = "time_request")] - public string TimeRequest { get; private set; } - + public string TimeRequest { get; set; } + /// /// The acceptance date of the pin change. /// [JsonProperty(PropertyName = "time_accept")] - public string TimeAccept { get; private set; } - + public string TimeAccept { get; set; } + /// /// The status of the pin change request, PIN_UPDATE_REQUESTED or PIN_UPDATE_ACCEPTED /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int cardId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cardId, IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, cardId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), cardId), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int cardId, int cardPinChangeId, IDictionary customHeaders = null) + public static BunqResponse Get(int cardId, int cardPinChangeId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, cardId, cardPinChangeId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), cardId, cardPinChangeId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -96,35 +102,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.LabelCard != null) { return false; } - + if (this.LabelMonetaryAccountCurrent != null) { return false; } - + if (this.TimeRequest != null) { return false; } - + if (this.TimeAccept != null) { return false; } - + if (this.Status != null) { return false; } - + return true; } - + /// /// public static CardPinChange CreateFromJsonString(string json) @@ -132,4 +138,4 @@ public static CardPinChange CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardReplace.cs b/BunqSdk/Model/Generated/Endpoint/CardReplace.cs index 94681e1..dd7cbcd 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardReplace.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardReplace.cs @@ -11,47 +11,59 @@ namespace Bunq.Sdk.Model.Generated.Endpoint { /// - /// It is possible to order a card replacement with the bunq API.

You can order up to three free card - /// replacements per year. Additional replacement requests will be billed.

The card replacement will have + /// It is possible to order a card replacement with the bunq API.

You can order up to one free card + /// replacement per year. Additional replacement requests will be billed.

The card replacement will have /// the same expiry date and the same pricing as the old card, but it will have a new card number. You can change - /// the description and PIN through the card replacement endpoint. + /// the description and optional the PIN through the card replacement endpoint. ///
public class CardReplace : BunqModel { /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/replace"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/replace"; + /// /// Field constants. /// public const string FIELD_PIN_CODE = "pin_code"; + public const string FIELD_SECOND_LINE = "second_line"; - - + + /// /// The id of the new card. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// Request a card replacement. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int cardId, IDictionary customHeaders = null) + /// The plaintext pin code. Requests require encryption to be enabled. + /// The second line on the card. + public static BunqResponse Create(int cardId, string pinCode = null, string secondLine = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PIN_CODE, pinCode}, + {FIELD_SECOND_LINE, secondLine}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - requestBytes = SecurityUtils.Encrypt(apiContext, requestBytes, customHeaders); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, cardId), requestBytes, customHeaders); - + requestBytes = SecurityUtils.Encrypt(GetApiContext(), requestBytes, customHeaders); + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), cardId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -60,10 +72,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static CardReplace CreateFromJsonString(string json) @@ -71,4 +83,4 @@ public static CardReplace CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CardResult.cs b/BunqSdk/Model/Generated/Endpoint/CardResult.cs index 2fec9e1..e1c5d4a 100644 --- a/BunqSdk/Model/Generated/Endpoint/CardResult.cs +++ b/BunqSdk/Model/Generated/Endpoint/CardResult.cs @@ -18,136 +18,145 @@ public class CardResult : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/card-result/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/card-result"; - + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/card-result/{2}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/card-result"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CardResult"; - + /// /// The id of the monetary account this card result links to. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The id of the card this card result links to. /// [JsonProperty(PropertyName = "card_id")] - public int? CardId { get; private set; } - + public int? CardId { get; set; } + /// /// The original amount of the message. /// [JsonProperty(PropertyName = "amount_original")] - public Amount AmountOriginal { get; private set; } - + public Amount AmountOriginal { get; set; } + /// /// The final amount of the message to be booked to the account. /// [JsonProperty(PropertyName = "amount_final")] - public Amount AmountFinal { get; private set; } - + public Amount AmountFinal { get; set; } + /// /// Why the transaction was denied, if it was denied, or just ALLOWED. /// [JsonProperty(PropertyName = "decision")] - public string Decision { get; private set; } - + public string Decision { get; set; } + /// /// Empty if allowed, otherwise a textual explanation of why it was denied. /// [JsonProperty(PropertyName = "decision_description")] - public string DecisionDescription { get; private set; } - + public string DecisionDescription { get; set; } + /// /// Empty if allowed, otherwise a textual explanation of why it was denied in user's language. /// [JsonProperty(PropertyName = "decision_description_translated")] - public string DecisionDescriptionTranslated { get; private set; } - + public string DecisionDescriptionTranslated { get; set; } + /// /// The description for this transaction to display. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The type of message that this card result is created for. /// [JsonProperty(PropertyName = "message_type")] - public string MessageType { get; private set; } - + public string MessageType { get; set; } + /// /// The way the cardholder was authorised to the POS or ATM. /// [JsonProperty(PropertyName = "authorisation_type")] - public string AuthorisationType { get; private set; } - + public string AuthorisationType { get; set; } + /// /// The city where the message originates from. /// [JsonProperty(PropertyName = "city")] - public string City { get; private set; } - + public string City { get; set; } + /// /// The monetary account label of the account that this result is created for. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The monetary account label of the counterparty. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The label of the card. /// [JsonProperty(PropertyName = "label_card")] - public LabelCard LabelCard { get; private set; } - + public LabelCard LabelCard { get; set; } + /// /// The status of the reservation if the transaction is a reservation. /// [JsonProperty(PropertyName = "reservation_status")] - public string ReservationStatus { get; private set; } - + public string ReservationStatus { get; set; } + /// /// The moment the reservation will expire. /// [JsonProperty(PropertyName = "reservation_expiry_time")] - public string ReservationExpiryTime { get; private set; } - + public string ReservationExpiryTime { get; set; } + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cardResultId, IDictionary customHeaders = null) + public static BunqResponse Get(int cardResultId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cardResultId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cardResultId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -156,85 +165,85 @@ public override bool IsAllFieldNull() { return false; } - + if (this.CardId != null) { return false; } - + if (this.AmountOriginal != null) { return false; } - + if (this.AmountFinal != null) { return false; } - + if (this.Decision != null) { return false; } - + if (this.DecisionDescription != null) { return false; } - + if (this.DecisionDescriptionTranslated != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.MessageType != null) { return false; } - + if (this.AuthorisationType != null) { return false; } - + if (this.City != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.LabelCard != null) { return false; } - + if (this.ReservationStatus != null) { return false; } - + if (this.ReservationExpiryTime != null) { return false; } - + return true; } - + /// /// public static CardResult CreateFromJsonString(string json) @@ -242,4 +251,4 @@ public static CardResult CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CashRegister.cs b/BunqSdk/Model/Generated/Endpoint/CashRegister.cs index 0537e33..3eca140 100644 --- a/BunqSdk/Model/Generated/Endpoint/CashRegister.cs +++ b/BunqSdk/Model/Generated/Endpoint/CashRegister.cs @@ -22,139 +22,195 @@ public class CashRegister : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register"; + /// /// Field constants. /// public const string FIELD_NAME = "name"; + public const string FIELD_STATUS = "status"; public const string FIELD_AVATAR_UUID = "avatar_uuid"; public const string FIELD_LOCATION = "location"; public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; public const string FIELD_TAB_TEXT_WAITING_SCREEN = "tab_text_waiting_screen"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CashRegister"; - + /// /// The id of the created CashRegister. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the CashRegister's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the CashRegister's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The name of the CashRegister. /// [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - + public string Name { get; set; } + /// /// The status of the CashRegister. Can be PENDING_APPROVAL, ACTIVE, DENIED or CLOSED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The Avatar of the CashRegister. /// [JsonProperty(PropertyName = "avatar")] - public Avatar Avatar { get; private set; } - + public Avatar Avatar { get; set; } + /// /// The geolocation of the CashRegister. Can be null. /// [JsonProperty(PropertyName = "location")] - public Geolocation Location { get; private set; } - + public Geolocation Location { get; set; } + /// /// The types of notifications that will result in a push notification or URL callback for this CashRegister. /// [JsonProperty(PropertyName = "notification_filters")] - public List NotificationFilters { get; private set; } - + public List NotificationFilters { get; set; } + /// /// The tab text for waiting screen of CashRegister. /// [JsonProperty(PropertyName = "tab_text_waiting_screen")] - public List TabTextWaitingScreen { get; private set; } - + public List TabTextWaitingScreen { get; set; } + /// /// Create a new CashRegister. Only an UserCompany can create a CashRegisters. They need to be created with /// status PENDING_APPROVAL, an bunq admin has to approve your CashRegister before you can use it. In the /// sandbox testing environment an CashRegister will be automatically approved immediately after creation. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The name of the CashRegister. Must be unique for this MonetaryAccount. + /// The status of the CashRegister. Can only be created or updated with PENDING_APPROVAL or CLOSED. + /// The UUID of the avatar of the CashRegister. Use the calls /attachment-public and /avatar to create a new Avatar and get its UUID. + /// The geolocation of the CashRegister. + /// The types of notifications that will result in a push notification or URL callback for this CashRegister. + /// The tab text for waiting screen of CashRegister. + public static BunqResponse Create(string name, string status, string avatarUuid, + int? monetaryAccountId = null, Geolocation location = null, + List notificationFilters = null, List tabTextWaitingScreen = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_NAME, name}, + {FIELD_STATUS, status}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_LOCATION, location}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_TAB_TEXT_WAITING_SCREEN, tabTextWaitingScreen}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a specific CashRegister. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, IDictionary customHeaders = null) + public static BunqResponse Get(int cashRegisterId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Modify or close an existing CashRegister. You must set the status back to PENDING_APPROVAL if you modify the /// name, avatar or location of a CashRegister. To close a cash register put its status to CLOSED. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, IDictionary customHeaders = null) + /// The name of the CashRegister. Must be unique for this MonetaryAccount. + /// The status of the CashRegister. Can only be created or updated with PENDING_APPROVAL or CLOSED. + /// The UUID of the avatar of the CashRegister. Use the calls /attachment-public and /avatar to create a new Avatar and get its UUID. + /// The geolocation of the CashRegister. + /// The types of notifications that will result in a push notification or URL callback for this CashRegister. + /// The tab text for waiting screen of CashRegister. + public static BunqResponse Update(int cashRegisterId, int? monetaryAccountId = null, string name = null, + string status = null, string avatarUuid = null, Geolocation location = null, + List notificationFilters = null, List tabTextWaitingScreen = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_NAME, name}, + {FIELD_STATUS, status}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_LOCATION, location}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_TAB_TEXT_WAITING_SCREEN, tabTextWaitingScreen}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, cashRegisterId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a collection of CashRegister for a given user and monetary account. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -163,50 +219,50 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Name != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.Avatar != null) { return false; } - + if (this.Location != null) { return false; } - + if (this.NotificationFilters != null) { return false; } - + if (this.TabTextWaitingScreen != null) { return false; } - + return true; } - + /// /// public static CashRegister CreateFromJsonString(string json) @@ -214,4 +270,4 @@ public static CashRegister CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCode.cs b/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCode.cs index b068aab..490b13b 100644 --- a/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCode.cs +++ b/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCode.cs @@ -19,115 +19,146 @@ public class CashRegisterQrCode : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code/{3}"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code/{3}"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code/{3}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code"; + /// /// Field constants. /// public const string FIELD_STATUS = "status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TokenQrCashRegister"; - + /// /// The id of the created QR code. Use this id to get the RAW content of the QR code with: /// ../qr-code/{id}/content /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the QR code's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the TokenQrCashRegister's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The status of this QR code. If the status is "ACTIVE" the QR code can be scanned to see the linked /// CashRegister and tab. If the status is "INACTIVE" the QR code does not link to a anything. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The CashRegister that is linked to the token. /// [JsonProperty(PropertyName = "cash_register")] - public CashRegister CashRegister { get; private set; } - + public CashRegister CashRegister { get; set; } + /// /// Holds the Tab object. Can be TabUsageSingle, TabUsageMultiple or null /// [JsonProperty(PropertyName = "tab_object")] - public Tab TabObject { get; private set; } - + public Tab TabObject { get; set; } + /// /// Create a new QR code for this CashRegister. You can only have one ACTIVE CashRegister QR code at the time. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, IDictionary customHeaders = null) + /// The status of the QR code. ACTIVE or INACTIVE. Only one QR code can be ACTIVE for a CashRegister at any time. Setting a QR code to ACTIVE will deactivate any other CashRegister QR codes. + public static BunqResponse Create(int cashRegisterId, string status, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, cashRegisterId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Modify a QR code in a given CashRegister. You can only have one ACTIVE CashRegister QR code at the time. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, int cashRegisterQrCodeId, IDictionary customHeaders = null) + /// The status of the QR code. ACTIVE or INACTIVE. Only one QR code can be ACTIVE for a CashRegister at any time. Setting a QR code to ACTIVE will deactivate any other CashRegister QR codes. + public static BunqResponse Update(int cashRegisterId, int cashRegisterQrCodeId, + int? monetaryAccountId = null, string status = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, cashRegisterId, cashRegisterQrCodeId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, cashRegisterQrCodeId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the information of a specific QR code. To get the RAW content of the QR code use ../qr-code/{id}/content /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, int cashRegisterQrCodeId, IDictionary customHeaders = null) + public static BunqResponse Get(int cashRegisterId, int cashRegisterQrCodeId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId, cashRegisterQrCodeId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, cashRegisterQrCodeId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a collection of QR code information from a given CashRegister /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cashRegisterId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -136,35 +167,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.CashRegister != null) { return false; } - + if (this.TabObject != null) { return false; } - + return true; } - + /// /// public static CashRegisterQrCode CreateFromJsonString(string json) @@ -172,4 +203,4 @@ public static CashRegisterQrCode CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCodeContent.cs b/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCodeContent.cs index afe87b9..fa886ff 100644 --- a/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCodeContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/CashRegisterQrCodeContent.cs @@ -17,34 +17,40 @@ public class CashRegisterQrCodeContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code/{3}/content"; - + protected const string ENDPOINT_URL_LISTING = + "user/{0}/monetary-account/{1}/cash-register/{2}/qr-code/{3}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CashRegisterQrCodeContent"; - + /// /// Show the raw contents of a QR code /// - public static BunqResponse List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, int qrCodeId, IDictionary customHeaders = null) + public static BunqResponse List(int cashRegisterId, int qrCodeId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId, qrCodeId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId, qrCodeId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static CashRegisterQrCodeContent CreateFromJsonString(string json) @@ -52,4 +58,4 @@ public static CashRegisterQrCodeContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CertificatePinned.cs b/BunqSdk/Model/Generated/Endpoint/CertificatePinned.cs index 77a8012..5023298 100644 --- a/BunqSdk/Model/Generated/Endpoint/CertificatePinned.cs +++ b/BunqSdk/Model/Generated/Endpoint/CertificatePinned.cs @@ -2,6 +2,7 @@ using Bunq.Sdk.Http; using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; using System.Text; @@ -18,88 +19,105 @@ public class CertificatePinned : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/certificate-pinned"; - private const string ENDPOINT_URL_DELETE = "user/{0}/certificate-pinned/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/certificate-pinned"; - private const string ENDPOINT_URL_READ = "user/{0}/certificate-pinned/{1}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/certificate-pinned"; + + protected const string ENDPOINT_URL_DELETE = "user/{0}/certificate-pinned/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/certificate-pinned"; + protected const string ENDPOINT_URL_READ = "user/{0}/certificate-pinned/{1}"; + /// /// Field constants. /// public const string FIELD_CERTIFICATE_CHAIN = "certificate_chain"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CertificatePinned"; - + /// /// The certificate chain in .PEM format. Certificates are glued with newline characters. /// [JsonProperty(PropertyName = "certificate_chain")] - public string CertificateChain { get; private set; } - + public string CertificateChain { get; set; } + /// /// The id generated for the pinned certificate chain. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// Pin the certificate chain. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The certificate chain in .PEM format. + public static BunqResponse Create(List certificateChain, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_CERTIFICATE_CHAIN, certificateChain}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - + /// /// Remove the pinned certificate chain with the specific ID. /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int certificatePinnedId, IDictionary customHeaders = null) + public static BunqResponse Delete(int certificatePinnedId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, certificatePinnedId), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), certificatePinnedId), + customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - + /// /// List all the pinned certificate chain for the given user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get the pinned certificate chain with the specified ID. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int certificatePinnedId, IDictionary customHeaders = null) + public static BunqResponse Get(int certificatePinnedId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, certificatePinnedId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), certificatePinnedId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -108,15 +126,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Id != null) { return false; } - + return true; } - + /// /// public static CertificatePinned CreateFromJsonString(string json) @@ -124,4 +142,4 @@ public static CertificatePinned CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs b/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs index c339d82..147e65e 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatConversation.cs @@ -19,54 +19,59 @@ public class ChatConversation : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - + /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation"; - private const string ENDPOINT_URL_READ = "user/{0}/chat-conversation/{1}"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation"; + + protected const string ENDPOINT_URL_READ = "user/{0}/chat-conversation/{1}"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ChatConversation"; - + /// /// [JsonProperty(PropertyName = "SupportConversationExternal")] - public ChatConversationSupportExternal SupportConversationExternal { get; private set; } - + public ChatConversationSupportExternal SupportConversationExternal { get; set; } + /// /// [JsonProperty(PropertyName = "ChatConversationReference")] - public ChatConversationReference ChatConversationReference { get; private set; } - + public ChatConversationReference ChatConversationReference { get; set; } + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int chatConversationId, IDictionary customHeaders = null) + public static BunqResponse Get(int chatConversationId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, chatConversationId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), chatConversationId), + new Dictionary(), customHeaders); + return FromJson(responseRaw); } - - + + /// /// public BunqModel GetReferencedObject() @@ -75,15 +80,15 @@ public BunqModel GetReferencedObject() { return this.SupportConversationExternal; } - + if (this.ChatConversationReference != null) { return this.ChatConversationReference; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -92,15 +97,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ChatConversationReference != null) { return false; } - + return true; } - + /// /// public static ChatConversation CreateFromJsonString(string json) @@ -108,4 +113,4 @@ public static ChatConversation CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs b/BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs index 0eb41fb..2ca38fd 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatConversationReference.cs @@ -13,21 +13,21 @@ public class ChatConversationReference : BunqModel /// The id of this conversation. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp the conversation reference was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp the conversation reference was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - - + public string Updated { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -36,20 +36,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + return true; } - + /// /// public static ChatConversationReference CreateFromJsonString(string json) @@ -57,4 +57,4 @@ public static ChatConversationReference CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs b/BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs index d1f1d2b..6beddb2 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatConversationSupportExternal.cs @@ -13,27 +13,27 @@ public class ChatConversationSupportExternal : BunqModel /// The id of this conversation. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the support conversation's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the support conversation's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The last message posted to this conversation if any. /// [JsonProperty(PropertyName = "last_message")] - public ChatMessage LastMessage { get; private set; } - - + public ChatMessage LastMessage { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -42,25 +42,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.LastMessage != null) { return false; } - + return true; } - + /// /// public static ChatConversationSupportExternal CreateFromJsonString(string json) @@ -68,4 +68,4 @@ public static ChatConversationSupportExternal CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs index 20a17d1..2b38e87 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessage.cs @@ -19,47 +19,49 @@ public class ChatMessage : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - + /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation/{1}/message"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/chat-conversation/{1}/message"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ChatMessage"; - + /// /// [JsonProperty(PropertyName = "ChatMessageAnnouncement")] - public ChatMessageAnnouncement ChatMessageAnnouncement { get; private set; } - + public ChatMessageAnnouncement ChatMessageAnnouncement { get; set; } + /// /// [JsonProperty(PropertyName = "ChatMessageStatus")] - public ChatMessageStatus ChatMessageStatus { get; private set; } - + public ChatMessageStatus ChatMessageStatus { get; set; } + /// /// [JsonProperty(PropertyName = "ChatMessageUser")] - public ChatMessageUser ChatMessageUser { get; private set; } - + public ChatMessageUser ChatMessageUser { get; set; } + /// /// Get all the messages that are part of a specific conversation. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int chatConversationId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int chatConversationId, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, chatConversationId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), chatConversationId), + urlParams, customHeaders); + return FromJsonList(responseRaw); } - - + + /// /// public BunqModel GetReferencedObject() @@ -68,20 +70,20 @@ public BunqModel GetReferencedObject() { return this.ChatMessageAnnouncement; } - + if (this.ChatMessageStatus != null) { return this.ChatMessageStatus; } - + if (this.ChatMessageUser != null) { return this.ChatMessageUser; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -90,20 +92,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ChatMessageStatus != null) { return false; } - + if (this.ChatMessageUser != null) { return false; } - + return true; } - + /// /// public static ChatMessage CreateFromJsonString(string json) @@ -111,4 +113,4 @@ public static ChatMessage CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs index 9c32043..28b6738 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessageAnnouncement.cs @@ -14,39 +14,39 @@ public class ChatMessageAnnouncement : BunqModel /// The id of the message. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the message was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the message was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The id of the conversation this message belongs to. /// [JsonProperty(PropertyName = "conversation_id")] - public int? ConversationId { get; private set; } - + public int? ConversationId { get; set; } + /// /// The user who initiated the action that caused this message to appear. /// [JsonProperty(PropertyName = "creator")] - public LabelUser Creator { get; private set; } - + public LabelUser Creator { get; set; } + /// /// The content of this message. /// [JsonProperty(PropertyName = "content")] - public ChatMessageContent Content { get; private set; } - - + public ChatMessageContent Content { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -55,35 +55,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.ConversationId != null) { return false; } - + if (this.Creator != null) { return false; } - + if (this.Content != null) { return false; } - + return true; } - + /// /// public static ChatMessageAnnouncement CreateFromJsonString(string json) @@ -91,4 +91,4 @@ public static ChatMessageAnnouncement CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs index bc79393..0708335 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessageAttachment.cs @@ -2,6 +2,7 @@ using Bunq.Sdk.Http; using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; using System.Text; @@ -17,36 +18,44 @@ public class ChatMessageAttachment : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/chat-conversation/{1}/message-attachment"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/chat-conversation/{1}/message-attachment"; + /// /// Field constants. /// - public const string FIELD_CLIENT_MESSAGE_UUID = "client_message_uuid"; public const string FIELD_ATTACHMENT = "attachment"; - - + + /// /// The id of the newly created chat message. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// Create a new message holding a file attachment to a specific conversation. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int chatConversationId, IDictionary customHeaders = null) + /// The attachment contained in this message. + public static BunqResponse Create(int chatConversationId, BunqId attachment, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_ATTACHMENT, attachment}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, chatConversationId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), chatConversationId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -55,10 +64,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageAttachment CreateFromJsonString(string json) @@ -66,4 +75,4 @@ public static ChatMessageAttachment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs index f8babeb..b94ca3e 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessageStatus.cs @@ -14,39 +14,39 @@ public class ChatMessageStatus : BunqModel /// The id of the message. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the message was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the message was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The id of the conversation this message belongs to. /// [JsonProperty(PropertyName = "conversation_id")] - public int? ConversationId { get; private set; } - + public int? ConversationId { get; set; } + /// /// The user who initiated the action that caused this message to appear. /// [JsonProperty(PropertyName = "creator")] - public LabelUser Creator { get; private set; } - + public LabelUser Creator { get; set; } + /// /// The content of this message. /// [JsonProperty(PropertyName = "content")] - public ChatMessageContent Content { get; private set; } - - + public ChatMessageContent Content { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -55,35 +55,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.ConversationId != null) { return false; } - + if (this.Creator != null) { return false; } - + if (this.Content != null) { return false; } - + return true; } - + /// /// public static ChatMessageStatus CreateFromJsonString(string json) @@ -91,4 +91,4 @@ public static ChatMessageStatus CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs index 5259b19..d242df5 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessageText.cs @@ -17,36 +17,44 @@ public class ChatMessageText : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/chat-conversation/{1}/message-text"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/chat-conversation/{1}/message-text"; + /// /// Field constants. /// - public const string FIELD_CLIENT_MESSAGE_UUID = "client_message_uuid"; public const string FIELD_TEXT = "text"; - - + + /// /// The id of the newly created chat message. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// Add a new text message to a specific conversation. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int chatConversationId, IDictionary customHeaders = null) + /// The textual content of this message. Cannot be empty. + public static BunqResponse Create(int chatConversationId, string text, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_TEXT, text}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, chatConversationId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), chatConversationId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -55,10 +63,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageText CreateFromJsonString(string json) @@ -66,4 +74,4 @@ public static ChatMessageText CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs b/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs index 36ea905..ee3d33c 100644 --- a/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs +++ b/BunqSdk/Model/Generated/Endpoint/ChatMessageUser.cs @@ -14,45 +14,45 @@ public class ChatMessageUser : BunqModel /// The id of the message. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the message was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the message was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The id of the conversation this message belongs to. /// [JsonProperty(PropertyName = "conversation_id")] - public int? ConversationId { get; private set; } - + public int? ConversationId { get; set; } + /// /// The user who initiated the action that caused this message to appear. /// [JsonProperty(PropertyName = "creator")] - public LabelUser Creator { get; private set; } - + public LabelUser Creator { get; set; } + /// /// The user displayed as the sender of this message. /// [JsonProperty(PropertyName = "displayed_sender")] - public LabelUser DisplayedSender { get; private set; } - + public LabelUser DisplayedSender { get; set; } + /// /// The content of this message. /// [JsonProperty(PropertyName = "content")] - public ChatMessageContent Content { get; private set; } - - + public ChatMessageContent Content { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -61,40 +61,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.ConversationId != null) { return false; } - + if (this.Creator != null) { return false; } - + if (this.DisplayedSender != null) { return false; } - + if (this.Content != null) { return false; } - + return true; } - + /// /// public static ChatMessageUser CreateFromJsonString(string json) @@ -102,4 +102,4 @@ public static ChatMessageUser CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Customer.cs b/BunqSdk/Model/Generated/Endpoint/Customer.cs index 1eb558b..b39f7e7 100644 --- a/BunqSdk/Model/Generated/Endpoint/Customer.cs +++ b/BunqSdk/Model/Generated/Endpoint/Customer.cs @@ -17,83 +17,96 @@ public class Customer : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/customer"; - private const string ENDPOINT_URL_READ = "user/{0}/customer/{1}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/customer/{1}"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/customer"; + + protected const string ENDPOINT_URL_READ = "user/{0}/customer/{1}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/customer/{1}"; + /// /// Field constants. /// public const string FIELD_BILLING_ACCOUNT_ID = "billing_account_id"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Customer"; - + /// /// The id of the customer. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the customer object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the customer object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The primary billing account account's id. /// [JsonProperty(PropertyName = "billing_account_id")] - public string BillingAccountId { get; private set; } - + public string BillingAccountId { get; set; } + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int customerId, IDictionary customHeaders = null) + public static BunqResponse Get(int customerId, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, customerId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), customerId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int customerId, IDictionary customHeaders = null) + /// The primary billing account account's id. + public static BunqResponse Update(int customerId, string billingAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_BILLING_ACCOUNT_ID, billingAccountId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, customerId), requestBytes, customHeaders); - + var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), customerId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -102,25 +115,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.BillingAccountId != null) { return false; } - + return true; } - + /// /// public static Customer CreateFromJsonString(string json) @@ -128,4 +141,4 @@ public static Customer CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CustomerLimit.cs b/BunqSdk/Model/Generated/Endpoint/CustomerLimit.cs index 63ed29b..25ee450 100644 --- a/BunqSdk/Model/Generated/Endpoint/CustomerLimit.cs +++ b/BunqSdk/Model/Generated/Endpoint/CustomerLimit.cs @@ -17,58 +17,60 @@ public class CustomerLimit : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/limit"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/limit"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CustomerLimit"; - + /// /// The limit of monetary accounts. /// [JsonProperty(PropertyName = "limit_monetary_account")] - public int? LimitMonetaryAccount { get; private set; } - + public int? LimitMonetaryAccount { get; set; } + /// /// The limit of Maestro cards. /// [JsonProperty(PropertyName = "limit_card_debit_maestro")] - public int? LimitCardDebitMaestro { get; private set; } - + public int? LimitCardDebitMaestro { get; set; } + /// /// The limit of MasterCard cards. /// [JsonProperty(PropertyName = "limit_card_debit_mastercard")] - public int? LimitCardDebitMastercard { get; private set; } - + public int? LimitCardDebitMastercard { get; set; } + /// /// The limit of wildcards, e.g. Maestro or MasterCard cards. /// [JsonProperty(PropertyName = "limit_card_debit_wildcard")] - public int? LimitCardDebitWildcard { get; private set; } - + public int? LimitCardDebitWildcard { get; set; } + /// /// The limit of free replacement cards. /// [JsonProperty(PropertyName = "limit_card_debit_replacement")] - public int? LimitCardDebitReplacement { get; private set; } - + public int? LimitCardDebitReplacement { get; set; } + /// /// Get all limits for the authenticated user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -77,30 +79,30 @@ public override bool IsAllFieldNull() { return false; } - + if (this.LimitCardDebitMaestro != null) { return false; } - + if (this.LimitCardDebitMastercard != null) { return false; } - + if (this.LimitCardDebitWildcard != null) { return false; } - + if (this.LimitCardDebitReplacement != null) { return false; } - + return true; } - + /// /// public static CustomerLimit CreateFromJsonString(string json) @@ -108,4 +110,4 @@ public static CustomerLimit CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs b/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs index cf54093..4923b69 100644 --- a/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs +++ b/BunqSdk/Model/Generated/Endpoint/CustomerStatementExport.cs @@ -19,135 +19,167 @@ public class CustomerStatementExport : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/customer-statement"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/customer-statement/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/customer-statement"; - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/customer-statement/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/customer-statement"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/customer-statement/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/customer-statement"; + protected const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/customer-statement/{2}"; + /// /// Field constants. /// public const string FIELD_STATEMENT_FORMAT = "statement_format"; + public const string FIELD_DATE_START = "date_start"; public const string FIELD_DATE_END = "date_end"; public const string FIELD_REGIONAL_FORMAT = "regional_format"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CustomerStatementExport"; - + /// /// The id of the customer statement model. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the statement model's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the statement model's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The date from when this statement shows transactions. /// [JsonProperty(PropertyName = "date_start")] - public string DateStart { get; private set; } - + public string DateStart { get; set; } + /// /// The date until which statement shows transactions. /// [JsonProperty(PropertyName = "date_end")] - public string DateEnd { get; private set; } - + public string DateEnd { get; set; } + /// /// The status of the export. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// MT940 Statement number. Unique per monetary account. /// [JsonProperty(PropertyName = "statement_number")] - public int? StatementNumber { get; private set; } - + public int? StatementNumber { get; set; } + /// /// The format of statement. /// [JsonProperty(PropertyName = "statement_format")] - public string StatementFormat { get; private set; } - + public string StatementFormat { get; set; } + /// /// The regional format of a CSV statement. /// [JsonProperty(PropertyName = "regional_format")] - public string RegionalFormat { get; private set; } - + public string RegionalFormat { get; set; } + /// /// The monetary account for which this statement was created. /// [JsonProperty(PropertyName = "alias_monetary_account")] - public MonetaryAccountReference AliasMonetaryAccount { get; private set; } - + public MonetaryAccountReference AliasMonetaryAccount { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The format type of statement. Allowed values: MT940, CSV, PDF. + /// The start date for making statements. + /// The end date for making statements. + /// Required for CSV exports. The regional format of the statement, can be UK_US (comma-separated) or EUROPEAN (semicolon-separated). + public static BunqResponse Create(string statementFormat, string dateStart, string dateEnd, + int? monetaryAccountId = null, string regionalFormat = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATEMENT_FORMAT, statementFormat}, + {FIELD_DATE_START, dateStart}, + {FIELD_DATE_END, dateEnd}, + {FIELD_REGIONAL_FORMAT, regionalFormat}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int customerStatementExportId, IDictionary customHeaders = null) + public static BunqResponse Get(int customerStatementExportId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, customerStatementExportId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + customerStatementExportId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int customerStatementExportId, IDictionary customHeaders = null) + public static BunqResponse Delete(int customerStatementExportId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, customerStatementExportId), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + customerStatementExportId), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() @@ -156,55 +188,55 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.DateStart != null) { return false; } - + if (this.DateEnd != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.StatementNumber != null) { return false; } - + if (this.StatementFormat != null) { return false; } - + if (this.RegionalFormat != null) { return false; } - + if (this.AliasMonetaryAccount != null) { return false; } - + return true; } - + /// /// public static CustomerStatementExport CreateFromJsonString(string json) @@ -212,4 +244,4 @@ public static CustomerStatementExport CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/CustomerStatementExportContent.cs b/BunqSdk/Model/Generated/Endpoint/CustomerStatementExportContent.cs index 59fff0b..9c26220 100644 --- a/BunqSdk/Model/Generated/Endpoint/CustomerStatementExportContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/CustomerStatementExportContent.cs @@ -19,33 +19,38 @@ public class CustomerStatementExportContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/customer-statement/{2}/content"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/customer-statement/{2}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CustomerStatementExportContent"; - + /// /// - public static BunqResponse List(ApiContext apiContext, int userId, int monetaryAccountId, int customerStatementId, IDictionary customHeaders = null) + public static BunqResponse List(int customerStatementId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, customerStatementId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), customerStatementId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static CustomerStatementExportContent CreateFromJsonString(string json) @@ -53,4 +58,4 @@ public static CustomerStatementExportContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Device.cs b/BunqSdk/Model/Generated/Endpoint/Device.cs index ff04ad0..9052e97 100644 --- a/BunqSdk/Model/Generated/Endpoint/Device.cs +++ b/BunqSdk/Model/Generated/Endpoint/Device.cs @@ -19,51 +19,54 @@ public class Device : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - + /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "device/{0}"; - private const string ENDPOINT_URL_LISTING = "device"; - + protected const string ENDPOINT_URL_READ = "device/{0}"; + + protected const string ENDPOINT_URL_LISTING = "device"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Device"; - + /// /// [JsonProperty(PropertyName = "DeviceServer")] - public DeviceServer DeviceServer { get; private set; } - + public DeviceServer DeviceServer { get; set; } + /// /// Get a single Device. A Device is either a DevicePhone or a DeviceServer. /// - public static BunqResponse Get(ApiContext apiContext, int deviceId, IDictionary customHeaders = null) + public static BunqResponse Get(int deviceId, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, deviceId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, deviceId), + new Dictionary(), customHeaders); + return FromJson(responseRaw); } - + /// /// Get a collection of Devices. A Device is either a DevicePhone or a DeviceServer. /// - public static BunqResponse> List(ApiContext apiContext, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); var responseRaw = apiClient.Get(ENDPOINT_URL_LISTING, urlParams, customHeaders); - + return FromJsonList(responseRaw); } - - + + /// /// public BunqModel GetReferencedObject() @@ -72,10 +75,10 @@ public BunqModel GetReferencedObject() { return this.DeviceServer; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -84,10 +87,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static Device CreateFromJsonString(string json) @@ -95,4 +98,4 @@ public static Device CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/DeviceServer.cs b/BunqSdk/Model/Generated/Endpoint/DeviceServer.cs index fadfa47..0ee6a7e 100644 --- a/BunqSdk/Model/Generated/Endpoint/DeviceServer.cs +++ b/BunqSdk/Model/Generated/Endpoint/DeviceServer.cs @@ -18,58 +18,60 @@ public class DeviceServer : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "device-server"; - private const string ENDPOINT_URL_READ = "device-server/{0}"; - private const string ENDPOINT_URL_LISTING = "device-server"; - + protected const string ENDPOINT_URL_CREATE = "device-server"; + + protected const string ENDPOINT_URL_READ = "device-server/{0}"; + protected const string ENDPOINT_URL_LISTING = "device-server"; + /// /// Field constants. /// public const string FIELD_DESCRIPTION = "description"; + public const string FIELD_SECRET = "secret"; public const string FIELD_PERMITTED_IPS = "permitted_ips"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "DeviceServer"; - + /// /// The id of the DeviceServer as created on the server. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the DeviceServer's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the DeviceServer's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The description of the DeviceServer. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The ip address which was used to create the DeviceServer. /// [JsonProperty(PropertyName = "ip")] - public string Ip { get; private set; } - + public string Ip { get; set; } + /// /// The status of the DeviceServer. Can be ACTIVE, BLOCKED, NEEDS_CONFIRMATION or OBSOLETE. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// Create a new DeviceServer providing the installation token in the header and signing the request with the /// private part of the key you used to create the installation. The API Key that you are using will be bound to @@ -78,45 +80,60 @@ public class DeviceServer : BunqModel /// more at this link https://bunq.com/en/apikey-dynamic-ip. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, IDictionary customHeaders = null) + /// The description of the DeviceServer. This is only for your own reference when reading the DeviceServer again. + /// The API key. You can request an API key in the bunq app. + /// An array of IPs (v4 or v6) this DeviceServer will be able to do calls from. These will be linked to the API key. + public static BunqResponse Create(string description, string secret, List permittedIps = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_SECRET, secret}, + {FIELD_PERMITTED_IPS, permittedIps}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); var responseRaw = apiClient.Post(ENDPOINT_URL_CREATE, requestBytes, customHeaders); - + return ProcessForId(responseRaw); } - + /// /// Get one of your DeviceServers. /// - public static BunqResponse Get(ApiContext apiContext, int deviceServerId, IDictionary customHeaders = null) + public static BunqResponse Get(int deviceServerId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, deviceServerId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, deviceServerId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a collection of all the DeviceServers you have created. /// - public static BunqResponse> List(ApiContext apiContext, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); var responseRaw = apiClient.Get(ENDPOINT_URL_LISTING, urlParams, customHeaders); - + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -125,35 +142,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Ip != null) { return false; } - + if (this.Status != null) { return false; } - + return true; } - + /// /// public static DeviceServer CreateFromJsonString(string json) @@ -161,4 +178,4 @@ public static DeviceServer CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/DraftPayment.cs b/BunqSdk/Model/Generated/Endpoint/DraftPayment.cs index 5da274d..a6bc109 100644 --- a/BunqSdk/Model/Generated/Endpoint/DraftPayment.cs +++ b/BunqSdk/Model/Generated/Endpoint/DraftPayment.cs @@ -19,128 +19,178 @@ public class DraftPayment : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/draft-payment"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/draft-payment/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/draft-payment"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/draft-payment/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/draft-payment"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/draft-payment/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/draft-payment"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/draft-payment/{2}"; + /// /// Field constants. /// public const string FIELD_STATUS = "status"; + public const string FIELD_ENTRIES = "entries"; public const string FIELD_PREVIOUS_UPDATED_TIMESTAMP = "previous_updated_timestamp"; public const string FIELD_NUMBER_OF_REQUIRED_ACCEPTS = "number_of_required_accepts"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "DraftPayment"; - + /// /// The id of the created DrafPayment. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The id of the MonetaryAccount the DraftPayment applies to. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The label of the User who created the DraftPayment. /// [JsonProperty(PropertyName = "user_alias_created")] - public LabelUser UserAliasCreated { get; private set; } - + public LabelUser UserAliasCreated { get; set; } + /// /// All responses to this draft payment. /// [JsonProperty(PropertyName = "responses")] - public List Responses { get; private set; } - + public List Responses { get; set; } + /// /// The status of the DraftPayment. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The type of the DraftPayment. /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + public string Type { get; set; } + /// /// The entries in the DraftPayment. /// [JsonProperty(PropertyName = "entries")] - public List Entries { get; private set; } - + public List Entries { get; set; } + /// /// The Payment or PaymentBatch. This will only be present after the DraftPayment has been accepted. /// [JsonProperty(PropertyName = "object")] - public DraftPaymentAnchorObject Object { get; private set; } - + public DraftPaymentAnchorObject Object { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + /// /// Create a new DraftPayment. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The list of entries in the DraftPayment. Each entry will result in a payment when the DraftPayment is accepted. + /// The number of accepts that are required for the draft payment to receive status ACCEPTED. Currently only 1 is valid. + /// The status of the DraftPayment. + /// The last updated_timestamp that you received for this DraftPayment. This needs to be provided to prevent race conditions. + public static BunqResponse Create(List entries, int? numberOfRequiredAccepts, + int? monetaryAccountId = null, string status = null, string previousUpdatedTimestamp = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_ENTRIES, entries}, + {FIELD_PREVIOUS_UPDATED_TIMESTAMP, previousUpdatedTimestamp}, + {FIELD_NUMBER_OF_REQUIRED_ACCEPTS, numberOfRequiredAccepts}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Update a DraftPayment. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int draftPaymentId, IDictionary customHeaders = null) + /// The status of the DraftPayment. + /// The list of entries in the DraftPayment. Each entry will result in a payment when the DraftPayment is accepted. + /// The last updated_timestamp that you received for this DraftPayment. This needs to be provided to prevent race conditions. + public static BunqResponse Update(int draftPaymentId, int? monetaryAccountId = null, string status = null, + List entries = null, string previousUpdatedTimestamp = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_ENTRIES, entries}, + {FIELD_PREVIOUS_UPDATED_TIMESTAMP, previousUpdatedTimestamp}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, draftPaymentId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + draftPaymentId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a listing of all DraftPayments from a given MonetaryAccount. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a specific DraftPayment. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int draftPaymentId, IDictionary customHeaders = null) + public static BunqResponse Get(int draftPaymentId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, draftPaymentId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + draftPaymentId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -149,45 +199,50 @@ public override bool IsAllFieldNull() { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.UserAliasCreated != null) { return false; } - + if (this.Responses != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.Entries != null) { return false; } - + if (this.Object != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static DraftPayment CreateFromJsonString(string json) @@ -195,4 +250,4 @@ public static DraftPayment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/DraftShareInviteApiKey.cs b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteApiKey.cs new file mode 100644 index 0000000..79b42d5 --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteApiKey.cs @@ -0,0 +1,220 @@ +using Bunq.Sdk.Context; +using Bunq.Sdk.Http; +using Bunq.Sdk.Json; +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Text; +using System; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// Used to create a draft share invite for a user with another bunq user. The user that accepts the invite can + /// share his MAs with the user that created the invite. + /// + public class DraftShareInviteApiKey : BunqModel + { + /// + /// Endpoint constants. + /// + protected const string ENDPOINT_URL_CREATE = "user/{0}/draft-share-invite-api-key"; + + protected const string ENDPOINT_URL_READ = "user/{0}/draft-share-invite-api-key/{1}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/draft-share-invite-api-key/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/draft-share-invite-api-key"; + + /// + /// Field constants. + /// + public const string FIELD_STATUS = "status"; + + public const string FIELD_SUB_STATUS = "sub_status"; + public const string FIELD_EXPIRATION = "expiration"; + + /// + /// Object type. + /// + private const string OBJECT_TYPE_GET = "DraftShareInviteApiKey"; + + private const string OBJECT_TYPE_PUT = "DraftShareInviteApiKey"; + + /// + /// The user who created the draft share invite. + /// + [JsonProperty(PropertyName = "user_alias_created")] + public LabelUser UserAliasCreated { get; set; } + + /// + /// The status of the draft share invite. Can be USED, CANCELLED and PENDING. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// The sub-status of the draft share invite. Can be NONE, ACCEPTED or REJECTED. + /// + [JsonProperty(PropertyName = "sub_status")] + public string SubStatus { get; set; } + + /// + /// The moment when this draft share invite expires. + /// + [JsonProperty(PropertyName = "expiration")] + public string Expiration { get; set; } + + /// + /// The URL redirecting user to the draft share invite in the app. Only works on mobile devices. + /// + [JsonProperty(PropertyName = "draft_share_url")] + public string DraftShareUrl { get; set; } + + /// + /// The API key generated for this DraftShareInviteApiKey. + /// + [JsonProperty(PropertyName = "api_key")] + public string ApiKey { get; set; } + + /// + /// The id of the newly created draft share invite. + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// + /// The moment when this draft share invite expires. + /// The status of the draft share invite. Can be CANCELLED (the user cancels the draft share before it's used). + /// The sub-status of the draft share invite. Can be NONE, ACCEPTED or REJECTED. + public static BunqResponse Create(string expiration, string status = null, string subStatus = null, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_EXPIRATION, expiration}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + + return ProcessForId(responseRaw); + } + + /// + /// Get the details of a specific draft of a share invite. + /// + public static BunqResponse Get(int draftShareInviteApiKeyId, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), draftShareInviteApiKeyId), + new Dictionary(), customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_GET); + } + + /// + /// Update a draft share invite. When sending status CANCELLED it is possible to cancel the draft share invite. + /// + /// The status of the draft share invite. Can be CANCELLED (the user cancels the draft share before it's used). + /// The sub-status of the draft share invite. Can be NONE, ACCEPTED or REJECTED. + /// The moment when this draft share invite expires. + public static BunqResponse Update(int draftShareInviteApiKeyId, string status = null, + string subStatus = null, string expiration = null, IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_EXPIRATION, expiration}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), draftShareInviteApiKeyId), + requestBytes, customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_PUT); + } + + /// + /// + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) + { + if (urlParams == null) urlParams = new Dictionary(); + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + + return FromJsonList(responseRaw, OBJECT_TYPE_GET); + } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.UserAliasCreated != null) + { + return false; + } + + if (this.Status != null) + { + return false; + } + + if (this.SubStatus != null) + { + return false; + } + + if (this.Expiration != null) + { + return false; + } + + if (this.DraftShareUrl != null) + { + return false; + } + + if (this.ApiKey != null) + { + return false; + } + + if (this.Id != null) + { + return false; + } + + return true; + } + + /// + /// + public static DraftShareInviteApiKey CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/DraftShareInviteApiKeyQrCodeContent.cs b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteApiKeyQrCodeContent.cs new file mode 100644 index 0000000..fe5910f --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteApiKeyQrCodeContent.cs @@ -0,0 +1,60 @@ +using Bunq.Sdk.Context; +using Bunq.Sdk.Http; +using Bunq.Sdk.Json; +using Bunq.Sdk.Model.Core; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Text; +using System; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// This call returns the raw content of the QR code that links to this draft share invite. When a bunq user scans + /// this QR code with the bunq app the draft share invite will be shown on his/her device. + /// + public class DraftShareInviteApiKeyQrCodeContent : BunqModel + { + /// + /// Endpoint constants. + /// + protected const string ENDPOINT_URL_LISTING = "user/{0}/draft-share-invite-api-key/{1}/qr-code-content"; + + /// + /// Object type. + /// + private const string OBJECT_TYPE_GET = "DraftShareInviteApiKeyQrCodeContent"; + + /// + /// Returns the raw content of the QR code that links to this draft share invite. The raw content is the binary + /// representation of a file, without any JSON wrapping. + /// + public static BunqResponse List(int draftShareInviteApiKeyId, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), draftShareInviteApiKeyId), + new Dictionary(), customHeaders); + + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); + } + + + /// + /// + public override bool IsAllFieldNull() + { + return true; + } + + /// + /// + public static DraftShareInviteApiKeyQrCodeContent CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBank.cs b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBank.cs index 60d7a35..e2d4930 100644 --- a/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBank.cs +++ b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBank.cs @@ -20,119 +20,153 @@ public class DraftShareInviteBank : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/draft-share-invite-bank"; - private const string ENDPOINT_URL_READ = "user/{0}/draft-share-invite-bank/{1}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/draft-share-invite-bank/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/draft-share-invite-bank"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/draft-share-invite-bank"; + + protected const string ENDPOINT_URL_READ = "user/{0}/draft-share-invite-bank/{1}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/draft-share-invite-bank/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/draft-share-invite-bank"; + /// /// Field constants. /// public const string FIELD_STATUS = "status"; + public const string FIELD_EXPIRATION = "expiration"; public const string FIELD_DRAFT_SHARE_SETTINGS = "draft_share_settings"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "DraftShareInviteBank"; - + /// /// The user who created the draft share invite. /// [JsonProperty(PropertyName = "user_alias_created")] - public LabelUser UserAliasCreated { get; private set; } - + public LabelUser UserAliasCreated { get; set; } + /// /// The status of the draft share invite. Can be USED, CANCELLED and PENDING. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The moment when this draft share invite expires. /// [JsonProperty(PropertyName = "expiration")] - public string Expiration { get; private set; } - + public string Expiration { get; set; } + /// /// The id of the share invite bank response this draft share belongs to. /// [JsonProperty(PropertyName = "share_invite_bank_response_id")] - public int? ShareInviteBankResponseId { get; private set; } - + public int? ShareInviteBankResponseId { get; set; } + /// /// The URL redirecting user to the draft share invite in the app. Only works on mobile devices. /// [JsonProperty(PropertyName = "draft_share_url")] - public string DraftShareUrl { get; private set; } - + public string DraftShareUrl { get; set; } + /// /// The draft share invite details. /// [JsonProperty(PropertyName = "draft_share_settings")] - public DraftShareInviteBankEntry DraftShareSettings { get; private set; } - + public DraftShareInviteEntry DraftShareSettings { get; set; } + /// /// The id of the newly created draft share invite. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The moment when this draft share invite expires. + /// The draft share invite details. + /// The status of the draft share invite. Can be CANCELLED (the user cancels the draft share before it's used). + public static BunqResponse Create(string expiration, DraftShareInviteEntry draftShareSettings, + string status = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_EXPIRATION, expiration}, + {FIELD_DRAFT_SHARE_SETTINGS, draftShareSettings}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the details of a specific draft of a share invite. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int draftShareInviteBankId, IDictionary customHeaders = null) + public static BunqResponse Get(int draftShareInviteBankId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, draftShareInviteBankId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), draftShareInviteBankId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Update a draft share invite. When sending status CANCELLED it is possible to cancel the draft share invite. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int draftShareInviteBankId, IDictionary customHeaders = null) + /// The status of the draft share invite. Can be CANCELLED (the user cancels the draft share before it's used). + /// The moment when this draft share invite expires. + /// The draft share invite details. + public static BunqResponse Update(int draftShareInviteBankId, string status = null, + string expiration = null, DraftShareInviteEntry draftShareSettings = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_EXPIRATION, expiration}, + {FIELD_DRAFT_SHARE_SETTINGS, draftShareSettings}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, draftShareInviteBankId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), draftShareInviteBankId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -141,40 +175,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Status != null) { return false; } - + if (this.Expiration != null) { return false; } - + if (this.ShareInviteBankResponseId != null) { return false; } - + if (this.DraftShareUrl != null) { return false; } - + if (this.DraftShareSettings != null) { return false; } - + if (this.Id != null) { return false; } - + return true; } - + /// /// public static DraftShareInviteBank CreateFromJsonString(string json) @@ -182,4 +216,4 @@ public static DraftShareInviteBank CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContent.cs b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContent.cs index 8587a9e..f50c726 100644 --- a/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/DraftShareInviteBankQrCodeContent.cs @@ -18,35 +18,38 @@ public class DraftShareInviteBankQrCodeContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/draft-share-invite-bank/{1}/qr-code-content"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/draft-share-invite-bank/{1}/qr-code-content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "DraftShareInviteBankQrCodeContent"; - + /// /// Returns the raw content of the QR code that links to this draft share invite. The raw content is the binary /// representation of a file, without any JSON wrapping. /// - public static BunqResponse List(ApiContext apiContext, int userId, int draftShareInviteBankId, IDictionary customHeaders = null) + public static BunqResponse List(int draftShareInviteBankId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, draftShareInviteBankId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), draftShareInviteBankId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static DraftShareInviteBankQrCodeContent CreateFromJsonString(string json) @@ -54,4 +57,4 @@ public static DraftShareInviteBankQrCodeContent CreateFromJsonString(string json return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs b/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs index 1781236..04b2c38 100644 --- a/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs +++ b/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverview.cs @@ -19,92 +19,105 @@ public class ExportAnnualOverview : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/export-annual-overview"; - private const string ENDPOINT_URL_READ = "user/{0}/export-annual-overview/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/export-annual-overview"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/export-annual-overview"; + + protected const string ENDPOINT_URL_READ = "user/{0}/export-annual-overview/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/export-annual-overview"; + /// /// Field constants. /// public const string FIELD_YEAR = "year"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ExportAnnualOverview"; - + /// /// The id of the annual overview as created on the server. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the annual overview 's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the annual overview 's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The year for which the overview is. /// [JsonProperty(PropertyName = "year")] - public int? Year { get; private set; } - + public int? Year { get; set; } + /// /// The user to which this annual overview belongs. /// [JsonProperty(PropertyName = "alias_user")] - public LabelUser AliasUser { get; private set; } - + public LabelUser AliasUser { get; set; } + /// /// Create a new annual overview for a specific year. An overview can be generated only for a past year. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The year for which the overview is. + public static BunqResponse Create(int? year, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_YEAR, year}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get an annual overview for a user by its id. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int exportAnnualOverviewId, IDictionary customHeaders = null) + public static BunqResponse Get(int exportAnnualOverviewId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, exportAnnualOverviewId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), exportAnnualOverviewId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// List all the annual overviews for a user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -113,30 +126,30 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Year != null) { return false; } - + if (this.AliasUser != null) { return false; } - + return true; } - + /// /// public static ExportAnnualOverview CreateFromJsonString(string json) @@ -144,4 +157,4 @@ public static ExportAnnualOverview CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverviewContent.cs b/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverviewContent.cs index 4456616..9fc62c3 100644 --- a/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverviewContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/ExportAnnualOverviewContent.cs @@ -18,34 +18,37 @@ public class ExportAnnualOverviewContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/export-annual-overview/{1}/content"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/export-annual-overview/{1}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ExportAnnualOverviewContent"; - + /// /// Used to retrieve the raw content of an annual overview. /// - public static BunqResponse List(ApiContext apiContext, int userId, int exportAnnualOverviewId, IDictionary customHeaders = null) + public static BunqResponse List(int exportAnnualOverviewId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, exportAnnualOverviewId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), exportAnnualOverviewId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static ExportAnnualOverviewContent CreateFromJsonString(string json) @@ -53,4 +56,4 @@ public static ExportAnnualOverviewContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/IdealMerchantTransaction.cs b/BunqSdk/Model/Generated/Endpoint/IdealMerchantTransaction.cs index 82039b6..fa2d304 100644 --- a/BunqSdk/Model/Generated/Endpoint/IdealMerchantTransaction.cs +++ b/BunqSdk/Model/Generated/Endpoint/IdealMerchantTransaction.cs @@ -18,145 +18,167 @@ public class IdealMerchantTransaction : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/ideal-merchant-transaction"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/ideal-merchant-transaction/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/ideal-merchant-transaction"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/ideal-merchant-transaction"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/ideal-merchant-transaction/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/ideal-merchant-transaction"; + /// /// Field constants. /// public const string FIELD_AMOUNT_REQUESTED = "amount_requested"; + public const string FIELD_ISSUER = "issuer"; - public const string FIELD_CALLBACK_TYPE = "callback_type"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "IdealMerchantTransaction"; - + /// /// The id of the monetary account this ideal merchant transaction links to. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The alias of the monetary account to add money to. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The alias of the monetary account the money comes from. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// In case of a successful transaction, the amount of money that will be transferred. /// [JsonProperty(PropertyName = "amount_guaranteed")] - public Amount AmountGuaranteed { get; private set; } - + public Amount AmountGuaranteed { get; set; } + /// /// The requested amount of money to add. /// [JsonProperty(PropertyName = "amount_requested")] - public Amount AmountRequested { get; private set; } - + public Amount AmountRequested { get; set; } + /// /// When the transaction will expire. /// [JsonProperty(PropertyName = "expiration")] - public string Expiration { get; private set; } - + public string Expiration { get; set; } + /// /// The BIC of the issuer. /// [JsonProperty(PropertyName = "issuer")] - public string Issuer { get; private set; } - + public string Issuer { get; set; } + /// /// The Name of the issuer. /// [JsonProperty(PropertyName = "issuer_name")] - public string IssuerName { get; private set; } - + public string IssuerName { get; set; } + /// /// The URL to visit to /// [JsonProperty(PropertyName = "issuer_authentication_url")] - public string IssuerAuthenticationUrl { get; private set; } - + public string IssuerAuthenticationUrl { get; set; } + /// /// The 'purchase ID' of the iDEAL transaction. /// [JsonProperty(PropertyName = "purchase_identifier")] - public string PurchaseIdentifier { get; private set; } - + public string PurchaseIdentifier { get; set; } + /// /// The status of the transaction. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// When the status was last updated. /// [JsonProperty(PropertyName = "status_timestamp")] - public string StatusTimestamp { get; private set; } - + public string StatusTimestamp { get; set; } + /// /// The 'transaction ID' of the iDEAL transaction. /// [JsonProperty(PropertyName = "transaction_identifier")] - public string TransactionIdentifier { get; private set; } - + public string TransactionIdentifier { get; set; } + /// /// Whether or not chat messages are allowed. /// [JsonProperty(PropertyName = "allow_chat")] - public bool? AllowChat { get; private set; } - + public bool? AllowChat { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The requested amount of money to add. + /// The BIC of the issuing bank to ask for money. + public static BunqResponse Create(Amount amountRequested, string issuer, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_AMOUNT_REQUESTED, amountRequested}, + {FIELD_ISSUER, issuer}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int idealMerchantTransactionId, IDictionary customHeaders = null) + public static BunqResponse Get(int idealMerchantTransactionId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, idealMerchantTransactionId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + idealMerchantTransactionId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -165,75 +187,75 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.AmountGuaranteed != null) { return false; } - + if (this.AmountRequested != null) { return false; } - + if (this.Expiration != null) { return false; } - + if (this.Issuer != null) { return false; } - + if (this.IssuerName != null) { return false; } - + if (this.IssuerAuthenticationUrl != null) { return false; } - + if (this.PurchaseIdentifier != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.StatusTimestamp != null) { return false; } - + if (this.TransactionIdentifier != null) { return false; } - + if (this.AllowChat != null) { return false; } - + return true; } - + /// /// public static IdealMerchantTransaction CreateFromJsonString(string json) @@ -241,4 +263,4 @@ public static IdealMerchantTransaction CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/InstallationServerPublicKey.cs b/BunqSdk/Model/Generated/Endpoint/InstallationServerPublicKey.cs index d27019a..ab0fb97 100644 --- a/BunqSdk/Model/Generated/Endpoint/InstallationServerPublicKey.cs +++ b/BunqSdk/Model/Generated/Endpoint/InstallationServerPublicKey.cs @@ -18,34 +18,36 @@ public class InstallationServerPublicKey : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "installation/{0}/server-public-key"; - + protected const string ENDPOINT_URL_LISTING = "installation/{0}/server-public-key"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ServerPublicKey"; - + /// /// The server's public key for this Installation. /// [JsonProperty(PropertyName = "server_public_key")] - public string ServerPublicKey { get; private set; } - + public string ServerPublicKey { get; set; } + /// /// Show the ServerPublicKey for this Installation. /// - public static BunqResponse> List(ApiContext apiContext, int installationId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int installationId, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, installationId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, installationId), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -54,10 +56,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static InstallationServerPublicKey CreateFromJsonString(string json) @@ -65,4 +67,4 @@ public static InstallationServerPublicKey CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Invoice.cs b/BunqSdk/Model/Generated/Endpoint/Invoice.cs index dad4ff3..babc6cb 100644 --- a/BunqSdk/Model/Generated/Endpoint/Invoice.cs +++ b/BunqSdk/Model/Generated/Endpoint/Invoice.cs @@ -18,143 +18,159 @@ public class Invoice : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/invoice"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/invoice/{2}"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/invoice"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/invoice/{2}"; + /// /// Field constants. /// public const string FIELD_STATUS = "status"; + public const string FIELD_DESCRIPTION = "description"; public const string FIELD_EXTERNAL_URL = "external_url"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Invoice"; - + /// /// The id of the invoice object. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the invoice object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the invoice object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The invoice date. /// [JsonProperty(PropertyName = "invoice_date")] - public string InvoiceDate { get; private set; } - + public string InvoiceDate { get; set; } + /// /// The invoice number. /// [JsonProperty(PropertyName = "invoice_number")] - public string InvoiceNumber { get; private set; } - + public string InvoiceNumber { get; set; } + /// /// The invoice status. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The invoice item groups. /// [JsonProperty(PropertyName = "group")] - public List Group { get; private set; } - + public List Group { get; set; } + /// /// The total discounted item price including VAT. /// [JsonProperty(PropertyName = "total_vat_inclusive")] - public Amount TotalVatInclusive { get; private set; } - + public Amount TotalVatInclusive { get; set; } + /// /// The total discounted item price excluding VAT. /// [JsonProperty(PropertyName = "total_vat_exclusive")] - public Amount TotalVatExclusive { get; private set; } - + public Amount TotalVatExclusive { get; set; } + /// /// The VAT on the total discounted item price. /// [JsonProperty(PropertyName = "total_vat")] - public Amount TotalVat { get; private set; } - + public Amount TotalVat { get; set; } + /// /// The label that's displayed to the counterparty with the invoice. Includes user. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The customer's address. /// [JsonProperty(PropertyName = "address")] - public Address Address { get; private set; } - + public Address Address { get; set; } + /// /// The label of the counterparty of the invoice. Includes user. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The company's address. /// [JsonProperty(PropertyName = "counterparty_address")] - public Address CounterpartyAddress { get; private set; } - + public Address CounterpartyAddress { get; set; } + /// /// The company's chamber of commerce number. /// [JsonProperty(PropertyName = "chamber_of_commerce_number")] - public string ChamberOfCommerceNumber { get; private set; } - + public string ChamberOfCommerceNumber { get; set; } + /// /// The company's chamber of commerce number. /// [JsonProperty(PropertyName = "vat_number")] - public string VatNumber { get; private set; } - + public string VatNumber { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int invoiceId, IDictionary customHeaders = null) + public static BunqResponse Get(int invoiceId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, invoiceId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + invoiceId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -163,85 +179,90 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.InvoiceDate != null) { return false; } - + if (this.InvoiceNumber != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.Group != null) { return false; } - + if (this.TotalVatInclusive != null) { return false; } - + if (this.TotalVatExclusive != null) { return false; } - + if (this.TotalVat != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.Address != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.CounterpartyAddress != null) { return false; } - + if (this.ChamberOfCommerceNumber != null) { return false; } - + if (this.VatNumber != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static Invoice CreateFromJsonString(string json) @@ -249,4 +270,4 @@ public static Invoice CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/InvoiceByUser.cs b/BunqSdk/Model/Generated/Endpoint/InvoiceByUser.cs index 48bb41d..f176321 100644 --- a/BunqSdk/Model/Generated/Endpoint/InvoiceByUser.cs +++ b/BunqSdk/Model/Generated/Endpoint/InvoiceByUser.cs @@ -18,136 +18,141 @@ public class InvoiceByUser : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/invoice"; - private const string ENDPOINT_URL_READ = "user/{0}/invoice/{1}"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/invoice"; + + protected const string ENDPOINT_URL_READ = "user/{0}/invoice/{1}"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Invoice"; - + /// /// The id of the invoice object. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the invoice object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the invoice object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The invoice date. /// [JsonProperty(PropertyName = "invoice_date")] - public string InvoiceDate { get; private set; } - + public string InvoiceDate { get; set; } + /// /// The invoice number. /// [JsonProperty(PropertyName = "invoice_number")] - public string InvoiceNumber { get; private set; } - + public string InvoiceNumber { get; set; } + /// /// The invoice status. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The invoice item groups. /// [JsonProperty(PropertyName = "group")] - public List Group { get; private set; } - + public List Group { get; set; } + /// /// The total discounted item price including VAT. /// [JsonProperty(PropertyName = "total_vat_inclusive")] - public Amount TotalVatInclusive { get; private set; } - + public Amount TotalVatInclusive { get; set; } + /// /// The total discounted item price excluding VAT. /// [JsonProperty(PropertyName = "total_vat_exclusive")] - public Amount TotalVatExclusive { get; private set; } - + public Amount TotalVatExclusive { get; set; } + /// /// The VAT on the total discounted item price. /// [JsonProperty(PropertyName = "total_vat")] - public Amount TotalVat { get; private set; } - + public Amount TotalVat { get; set; } + /// /// The label that's displayed to the counterparty with the invoice. Includes user. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The customer's address. /// [JsonProperty(PropertyName = "address")] - public Address Address { get; private set; } - + public Address Address { get; set; } + /// /// The label of the counterparty of the invoice. Includes user. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The company's address. /// [JsonProperty(PropertyName = "counterparty_address")] - public Address CounterpartyAddress { get; private set; } - + public Address CounterpartyAddress { get; set; } + /// /// The company's chamber of commerce number. /// [JsonProperty(PropertyName = "chamber_of_commerce_number")] - public string ChamberOfCommerceNumber { get; private set; } - + public string ChamberOfCommerceNumber { get; set; } + /// /// The company's chamber of commerce number. /// [JsonProperty(PropertyName = "vat_number")] - public string VatNumber { get; private set; } - + public string VatNumber { get; set; } + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int invoiceByUserId, IDictionary customHeaders = null) + public static BunqResponse Get(int invoiceByUserId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, invoiceByUserId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), invoiceByUserId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -156,85 +161,85 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.InvoiceDate != null) { return false; } - + if (this.InvoiceNumber != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.Group != null) { return false; } - + if (this.TotalVatInclusive != null) { return false; } - + if (this.TotalVatExclusive != null) { return false; } - + if (this.TotalVat != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.Address != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.CounterpartyAddress != null) { return false; } - + if (this.ChamberOfCommerceNumber != null) { return false; } - + if (this.VatNumber != null) { return false; } - + return true; } - + /// /// public static InvoiceByUser CreateFromJsonString(string json) @@ -242,4 +247,4 @@ public static InvoiceByUser CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs b/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs index 538dba0..74f5ee5 100644 --- a/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs +++ b/BunqSdk/Model/Generated/Endpoint/MasterCardAction.cs @@ -18,191 +18,206 @@ public class MasterCardAction : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/mastercard-action/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/mastercard-action"; - + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/mastercard-action/{2}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/mastercard-action"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "MasterCardAction"; - + /// /// The id of the MastercardAction. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The id of the monetary account this action links to. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The id of the card this action links to. /// [JsonProperty(PropertyName = "card_id")] - public int? CardId { get; private set; } - + public int? CardId { get; set; } + /// /// The amount of the transaction in local currency. /// [JsonProperty(PropertyName = "amount_local")] - public Amount AmountLocal { get; private set; } - + public Amount AmountLocal { get; set; } + /// /// The amount of the transaction in the monetary account's currency. /// [JsonProperty(PropertyName = "amount_billing")] - public Amount AmountBilling { get; private set; } - + public Amount AmountBilling { get; set; } + /// /// The original amount in local currency. /// [JsonProperty(PropertyName = "amount_original_local")] - public Amount AmountOriginalLocal { get; private set; } - + public Amount AmountOriginalLocal { get; set; } + /// /// The original amount in the monetary account's currency. /// [JsonProperty(PropertyName = "amount_original_billing")] - public Amount AmountOriginalBilling { get; private set; } - + public Amount AmountOriginalBilling { get; set; } + /// /// The fee amount as charged by the merchant, if applicable. /// [JsonProperty(PropertyName = "amount_fee")] - public Amount AmountFee { get; private set; } - + public Amount AmountFee { get; set; } + /// /// Why the transaction was denied, if it was denied, or just ALLOWED. /// [JsonProperty(PropertyName = "decision")] - public string Decision { get; private set; } - + public string Decision { get; set; } + /// /// Empty if allowed, otherwise a textual explanation of why it was denied. /// [JsonProperty(PropertyName = "decision_description")] - public string DecisionDescription { get; private set; } - + public string DecisionDescription { get; set; } + /// /// Empty if allowed, otherwise a textual explanation of why it was denied in user's language. /// [JsonProperty(PropertyName = "decision_description_translated")] - public string DecisionDescriptionTranslated { get; private set; } - + public string DecisionDescriptionTranslated { get; set; } + /// /// The description for this transaction to display. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The status in the authorisation process. /// [JsonProperty(PropertyName = "authorisation_status")] - public string AuthorisationStatus { get; private set; } - + public string AuthorisationStatus { get; set; } + /// /// The type of transaction that was delivered using the card. /// [JsonProperty(PropertyName = "authorisation_type")] - public string AuthorisationType { get; private set; } - + public string AuthorisationType { get; set; } + /// /// The type of entry mode the user used. Can be 'ATM', 'ICC', 'MAGNETIC_STRIPE' or 'E_COMMERCE'. /// [JsonProperty(PropertyName = "pan_entry_mode_user")] - public string PanEntryModeUser { get; private set; } - + public string PanEntryModeUser { get; set; } + /// /// The city where the message originates from as announced by the terminal. /// [JsonProperty(PropertyName = "city")] - public string City { get; private set; } - + public string City { get; set; } + /// /// The monetary account label of the account that this action is created for. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The monetary account label of the counterparty. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The label of the card. /// [JsonProperty(PropertyName = "label_card")] - public LabelCard LabelCard { get; private set; } - + public LabelCard LabelCard { get; set; } + /// /// If this is a tokenisation action, this shows the status of the token. /// [JsonProperty(PropertyName = "token_status")] - public string TokenStatus { get; private set; } - + public string TokenStatus { get; set; } + /// /// If this is a reservation, the moment the reservation will expire. /// [JsonProperty(PropertyName = "reservation_expiry_time")] - public string ReservationExpiryTime { get; private set; } - + public string ReservationExpiryTime { get; set; } + /// /// The type of the limit applied to validate if this MasterCardAction was within the spending limits. The /// returned string matches the limit types as defined in the card endpoint. /// [JsonProperty(PropertyName = "applied_limit")] - public string AppliedLimit { get; private set; } - + public string AppliedLimit { get; set; } + /// /// Whether or not chat messages are allowed. /// [JsonProperty(PropertyName = "allow_chat")] - public bool? AllowChat { get; private set; } - + public bool? AllowChat { get; set; } + /// /// The whitelist id for this mastercard action or null. /// [JsonProperty(PropertyName = "eligible_whitelist_id")] - public int? EligibleWhitelistId { get; private set; } - + public int? EligibleWhitelistId { get; set; } + /// /// The secure code id for this mastercard action or null. /// [JsonProperty(PropertyName = "secure_code_id")] - public int? SecureCodeId { get; private set; } - + public int? SecureCodeId { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int masterCardActionId, IDictionary customHeaders = null) + public static BunqResponse Get(int masterCardActionId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, masterCardActionId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + masterCardActionId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -211,130 +226,135 @@ public override bool IsAllFieldNull() { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.CardId != null) { return false; } - + if (this.AmountLocal != null) { return false; } - + if (this.AmountBilling != null) { return false; } - + if (this.AmountOriginalLocal != null) { return false; } - + if (this.AmountOriginalBilling != null) { return false; } - + if (this.AmountFee != null) { return false; } - + if (this.Decision != null) { return false; } - + if (this.DecisionDescription != null) { return false; } - + if (this.DecisionDescriptionTranslated != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.AuthorisationStatus != null) { return false; } - + if (this.AuthorisationType != null) { return false; } - + if (this.PanEntryModeUser != null) { return false; } - + if (this.City != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.LabelCard != null) { return false; } - + if (this.TokenStatus != null) { return false; } - + if (this.ReservationExpiryTime != null) { return false; } - + if (this.AppliedLimit != null) { return false; } - + if (this.AllowChat != null) { return false; } - + if (this.EligibleWhitelistId != null) { return false; } - + if (this.SecureCodeId != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static MasterCardAction CreateFromJsonString(string json) @@ -342,4 +362,4 @@ public static MasterCardAction CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccount.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccount.cs index 210760d..b75b836 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccount.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccount.cs @@ -22,51 +22,68 @@ public class MonetaryAccount : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - + /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account"; - + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "MonetaryAccount"; - + /// /// [JsonProperty(PropertyName = "MonetaryAccountBank")] - public MonetaryAccountBank MonetaryAccountBank { get; private set; } - + public MonetaryAccountBank MonetaryAccountBank { get; set; } + + /// + /// + [JsonProperty(PropertyName = "MonetaryAccountJoint")] + public MonetaryAccountJoint MonetaryAccountJoint { get; set; } + + /// + /// + [JsonProperty(PropertyName = "MonetaryAccountLight")] + public MonetaryAccountLight MonetaryAccountLight { get; set; } + /// /// Get a specific MonetaryAccount. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary customHeaders = null) + public static BunqResponse Get(int monetaryAccountId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId)), + new Dictionary(), customHeaders); + return FromJson(responseRaw); } - + /// /// Get a collection of all your MonetaryAccounts. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw); } - - + + /// /// public BunqModel GetReferencedObject() @@ -75,10 +92,20 @@ public BunqModel GetReferencedObject() { return this.MonetaryAccountBank; } - + + if (this.MonetaryAccountJoint != null) + { + return this.MonetaryAccountJoint; + } + + if (this.MonetaryAccountLight != null) + { + return this.MonetaryAccountLight; + } + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -87,10 +114,20 @@ public override bool IsAllFieldNull() { return false; } - + + if (this.MonetaryAccountJoint != null) + { + return false; + } + + if (this.MonetaryAccountLight != null) + { + return false; + } + return true; } - + /// /// public static MonetaryAccount CreateFromJsonString(string json) @@ -98,4 +135,4 @@ public static MonetaryAccount CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBank.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBank.cs index 9ba2388..b408283 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBank.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBank.cs @@ -22,214 +22,274 @@ public class MonetaryAccountBank : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account-bank"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account-bank/{1}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account-bank/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account-bank"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account-bank"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account-bank/{1}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account-bank/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account-bank"; + /// /// Field constants. /// public const string FIELD_CURRENCY = "currency"; + public const string FIELD_DESCRIPTION = "description"; public const string FIELD_DAILY_LIMIT = "daily_limit"; - public const string FIELD_OVERDRAFT_LIMIT = "overdraft_limit"; - public const string FIELD_ALIAS = "alias"; public const string FIELD_AVATAR_UUID = "avatar_uuid"; public const string FIELD_STATUS = "status"; public const string FIELD_SUB_STATUS = "sub_status"; public const string FIELD_REASON = "reason"; public const string FIELD_REASON_DESCRIPTION = "reason_description"; - public const string FIELD_SHARE = "share"; public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; public const string FIELD_SETTING = "setting"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "MonetaryAccountBank"; - + /// /// The id of the MonetaryAccountBank. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the MonetaryAccountBank's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the MonetaryAccountBank's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The Avatar of the MonetaryAccountBank. /// [JsonProperty(PropertyName = "avatar")] - public Avatar Avatar { get; private set; } - + public Avatar Avatar { get; set; } + /// /// The currency of the MonetaryAccountBank as an ISO 4217 formatted currency code. /// [JsonProperty(PropertyName = "currency")] - public string Currency { get; private set; } - + public string Currency { get; set; } + /// /// The description of the MonetaryAccountBank. Defaults to 'bunq account'. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The daily spending limit Amount of the MonetaryAccountBank. Defaults to 1000 EUR. Currency must match the /// MonetaryAccountBank's currency. Limited to 10000 EUR. /// [JsonProperty(PropertyName = "daily_limit")] - public Amount DailyLimit { get; private set; } - + public Amount DailyLimit { get; set; } + /// /// Total Amount of money spent today. Timezone aware. /// [JsonProperty(PropertyName = "daily_spent")] - public Amount DailySpent { get; private set; } - + public Amount DailySpent { get; set; } + /// /// The maximum Amount the MonetaryAccountBank can be 'in the red'. /// [JsonProperty(PropertyName = "overdraft_limit")] - public Amount OverdraftLimit { get; private set; } - + public Amount OverdraftLimit { get; set; } + /// /// The current balance Amount of the MonetaryAccountBank. /// [JsonProperty(PropertyName = "balance")] - public Amount Balance { get; private set; } - + public Amount Balance { get; set; } + /// /// The Aliases for the MonetaryAccountBank. /// [JsonProperty(PropertyName = "alias")] - public List Alias { get; private set; } - + public List Alias { get; set; } + /// /// The MonetaryAccountBank's public UUID. /// [JsonProperty(PropertyName = "public_uuid")] - public string PublicUuid { get; private set; } - + public string PublicUuid { get; set; } + /// /// The status of the MonetaryAccountBank. Can be: ACTIVE, BLOCKED, CANCELLED or PENDING_REOPEN /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The sub-status of the MonetaryAccountBank providing extra information regarding the status. Will be NONE for /// ACTIVE or PENDING_REOPEN, COMPLETELY or ONLY_ACCEPTING_INCOMING for BLOCKED and REDEMPTION_INVOLUNTARY, /// REDEMPTION_VOLUNTARY or PERMANENT for CANCELLED. /// [JsonProperty(PropertyName = "sub_status")] - public string SubStatus { get; private set; } - + public string SubStatus { get; set; } + /// /// The reason for voluntarily cancelling (closing) the MonetaryAccountBank, can only be OTHER. /// [JsonProperty(PropertyName = "reason")] - public string Reason { get; private set; } - + public string Reason { get; set; } + /// /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountBank. Can be any user /// provided message. /// [JsonProperty(PropertyName = "reason_description")] - public string ReasonDescription { get; private set; } - + public string ReasonDescription { get; set; } + /// /// The id of the User who owns the MonetaryAccountBank. /// [JsonProperty(PropertyName = "user_id")] - public int? UserId { get; private set; } - + public int? UserId { get; set; } + /// /// The profile of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public MonetaryAccountProfile MonetaryAccountProfile { get; private set; } - + public MonetaryAccountProfile MonetaryAccountProfile { get; set; } + /// /// The types of notifications that will result in a push notification or URL callback for this /// MonetaryAccountBank. /// [JsonProperty(PropertyName = "notification_filters")] - public List NotificationFilters { get; private set; } - + public List NotificationFilters { get; set; } + /// /// The settings of the MonetaryAccountBank. /// [JsonProperty(PropertyName = "setting")] - public MonetaryAccountSetting Setting { get; private set; } - + public MonetaryAccountSetting Setting { get; set; } + /// /// Create new MonetaryAccountBank. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The currency of the MonetaryAccountBank as an ISO 4217 formatted currency code. + /// The description of the MonetaryAccountBank. Defaults to 'bunq account'. + /// The daily spending limit Amount of the MonetaryAccountBank. Defaults to 1000 EUR. Currency must match the MonetaryAccountBank's currency. Limited to 10000 EUR. + /// The UUID of the Avatar of the MonetaryAccountBank. + /// The status of the MonetaryAccountBank. Ignored in POST requests (always set to ACTIVE) can be CANCELLED or PENDING_REOPEN in PUT requests to cancel (close) or reopen the MonetaryAccountBank. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The sub-status of the MonetaryAccountBank providing extra information regarding the status. Should be ignored for POST requests. In case of PUT requests with status CANCELLED it can only be REDEMPTION_VOLUNTARY, while with status PENDING_REOPEN it can only be NONE. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The reason for voluntarily cancelling (closing) the MonetaryAccountBank, can only be OTHER. Should only be specified if updating the status to CANCELLED. + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountBank. Can be any user provided message. Should only be specified if updating the status to CANCELLED. + /// The types of notifications that will result in a push notification or URL callback for this MonetaryAccountBank. + /// The settings of the MonetaryAccountBank. + public static BunqResponse Create(string currency, string description = null, Amount dailyLimit = null, + string avatarUuid = null, string status = null, string subStatus = null, string reason = null, + string reasonDescription = null, List notificationFilters = null, + MonetaryAccountSetting setting = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_CURRENCY, currency}, + {FIELD_DESCRIPTION, description}, + {FIELD_DAILY_LIMIT, dailyLimit}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_REASON, reason}, + {FIELD_REASON_DESCRIPTION, reasonDescription}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_SETTING, setting}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a specific MonetaryAccountBank. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountBankId, IDictionary customHeaders = null) + public static BunqResponse Get(int monetaryAccountBankId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountBankId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), monetaryAccountBankId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Update a specific existing MonetaryAccountBank. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountBankId, IDictionary customHeaders = null) + /// The description of the MonetaryAccountBank. Defaults to 'bunq account'. + /// The daily spending limit Amount of the MonetaryAccountBank. Defaults to 1000 EUR. Currency must match the MonetaryAccountBank's currency. Limited to 10000 EUR. + /// The UUID of the Avatar of the MonetaryAccountBank. + /// The status of the MonetaryAccountBank. Ignored in POST requests (always set to ACTIVE) can be CANCELLED or PENDING_REOPEN in PUT requests to cancel (close) or reopen the MonetaryAccountBank. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The sub-status of the MonetaryAccountBank providing extra information regarding the status. Should be ignored for POST requests. In case of PUT requests with status CANCELLED it can only be REDEMPTION_VOLUNTARY, while with status PENDING_REOPEN it can only be NONE. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The reason for voluntarily cancelling (closing) the MonetaryAccountBank, can only be OTHER. Should only be specified if updating the status to CANCELLED. + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountBank. Can be any user provided message. Should only be specified if updating the status to CANCELLED. + /// The types of notifications that will result in a push notification or URL callback for this MonetaryAccountBank. + /// The settings of the MonetaryAccountBank. + public static BunqResponse Update(int monetaryAccountBankId, string description = null, + Amount dailyLimit = null, string avatarUuid = null, string status = null, string subStatus = null, + string reason = null, string reasonDescription = null, List notificationFilters = null, + MonetaryAccountSetting setting = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_DAILY_LIMIT, dailyLimit}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_REASON, reason}, + {FIELD_REASON_DESCRIPTION, reasonDescription}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_SETTING, setting}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountBankId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), monetaryAccountBankId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Gets a listing of all MonetaryAccountBanks of a given user. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -238,105 +298,105 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Avatar != null) { return false; } - + if (this.Currency != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.DailyLimit != null) { return false; } - + if (this.DailySpent != null) { return false; } - + if (this.OverdraftLimit != null) { return false; } - + if (this.Balance != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.PublicUuid != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.SubStatus != null) { return false; } - + if (this.Reason != null) { return false; } - + if (this.ReasonDescription != null) { return false; } - + if (this.UserId != null) { return false; } - + if (this.MonetaryAccountProfile != null) { return false; } - + if (this.NotificationFilters != null) { return false; } - + if (this.Setting != null) { return false; } - + return true; } - + /// /// public static MonetaryAccountBank CreateFromJsonString(string json) @@ -344,4 +404,4 @@ public static MonetaryAccountBank CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs new file mode 100644 index 0000000..a5d92b6 --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJoint.cs @@ -0,0 +1,283 @@ +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// The endpoint for joint monetary accounts. + /// + public class MonetaryAccountJoint : BunqModel + { + /// + /// Field constants. + /// + public const string FIELD_CURRENCY = "currency"; + + public const string FIELD_DESCRIPTION = "description"; + public const string FIELD_DAILY_LIMIT = "daily_limit"; + public const string FIELD_OVERDRAFT_LIMIT = "overdraft_limit"; + public const string FIELD_ALIAS = "alias"; + public const string FIELD_AVATAR_UUID = "avatar_uuid"; + public const string FIELD_STATUS = "status"; + public const string FIELD_SUB_STATUS = "sub_status"; + public const string FIELD_REASON = "reason"; + public const string FIELD_REASON_DESCRIPTION = "reason_description"; + public const string FIELD_ALL_CO_OWNER = "all_co_owner"; + public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; + public const string FIELD_SETTING = "setting"; + + + /// + /// The id of the MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// The timestamp of the MonetaryAccountJoint's creation. + /// + [JsonProperty(PropertyName = "created")] + public string Created { get; set; } + + /// + /// The timestamp of the MonetaryAccountJoint's last update. + /// + [JsonProperty(PropertyName = "updated")] + public string Updated { get; set; } + + /// + /// The Avatar of the MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "avatar")] + public Avatar Avatar { get; set; } + + /// + /// The currency of the MonetaryAccountJoint as an ISO 4217 formatted currency code. + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; set; } + + /// + /// The description of the MonetaryAccountJoint. Defaults to 'bunq account'. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// The daily spending limit Amount of the MonetaryAccountJoint. Defaults to 1000 EUR. Currency must match the + /// MonetaryAccountJoint's currency. Limited to 10000 EUR. + /// + [JsonProperty(PropertyName = "daily_limit")] + public Amount DailyLimit { get; set; } + + /// + /// Total Amount of money spent today. Timezone aware. + /// + [JsonProperty(PropertyName = "daily_spent")] + public Amount DailySpent { get; set; } + + /// + /// The maximum Amount the MonetaryAccountJoint can be 'in the red'. + /// + [JsonProperty(PropertyName = "overdraft_limit")] + public Amount OverdraftLimit { get; set; } + + /// + /// The current balance Amount of the MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "balance")] + public Amount Balance { get; set; } + + /// + /// The Aliases for the MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "alias")] + public List Alias { get; set; } + + /// + /// The MonetaryAccountJoint's public UUID. + /// + [JsonProperty(PropertyName = "public_uuid")] + public string PublicUuid { get; set; } + + /// + /// The status of the MonetaryAccountJoint. Can be: ACTIVE, BLOCKED, CANCELLED or PENDING_REOPEN + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// The sub-status of the MonetaryAccountJoint providing extra information regarding the status. Will be NONE + /// for ACTIVE or PENDING_REOPEN, COMPLETELY or ONLY_ACCEPTING_INCOMING for BLOCKED and REDEMPTION_INVOLUNTARY, + /// REDEMPTION_VOLUNTARY or PERMANENT for CANCELLED. + /// + [JsonProperty(PropertyName = "sub_status")] + public string SubStatus { get; set; } + + /// + /// The reason for voluntarily cancelling (closing) the MonetaryAccountJoint, can only be OTHER. + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountJoint. Can be any user + /// provided message. + /// + [JsonProperty(PropertyName = "reason_description")] + public string ReasonDescription { get; set; } + + /// + /// The users the account will be joint with. + /// + [JsonProperty(PropertyName = "all_co_owner")] + public List AllCoOwner { get; set; } + + /// + /// The id of the User who owns the MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "user_id")] + public int? UserId { get; set; } + + /// + /// The profile of the account. + /// + [JsonProperty(PropertyName = "monetary_account_profile")] + public MonetaryAccountProfile MonetaryAccountProfile { get; set; } + + /// + /// The types of notifications that will result in a push notification or URL callback for this + /// MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "notification_filters")] + public List NotificationFilters { get; set; } + + /// + /// The settings of the MonetaryAccountJoint. + /// + [JsonProperty(PropertyName = "setting")] + public MonetaryAccountSetting Setting { get; set; } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.Id != null) + { + return false; + } + + if (this.Created != null) + { + return false; + } + + if (this.Updated != null) + { + return false; + } + + if (this.Avatar != null) + { + return false; + } + + if (this.Currency != null) + { + return false; + } + + if (this.Description != null) + { + return false; + } + + if (this.DailyLimit != null) + { + return false; + } + + if (this.DailySpent != null) + { + return false; + } + + if (this.OverdraftLimit != null) + { + return false; + } + + if (this.Balance != null) + { + return false; + } + + if (this.Alias != null) + { + return false; + } + + if (this.PublicUuid != null) + { + return false; + } + + if (this.Status != null) + { + return false; + } + + if (this.SubStatus != null) + { + return false; + } + + if (this.Reason != null) + { + return false; + } + + if (this.ReasonDescription != null) + { + return false; + } + + if (this.AllCoOwner != null) + { + return false; + } + + if (this.UserId != null) + { + return false; + } + + if (this.MonetaryAccountProfile != null) + { + return false; + } + + if (this.NotificationFilters != null) + { + return false; + } + + if (this.Setting != null) + { + return false; + } + + return true; + } + + /// + /// + public static MonetaryAccountJoint CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLight.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLight.cs new file mode 100644 index 0000000..c5e8a93 --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLight.cs @@ -0,0 +1,461 @@ +using Bunq.Sdk.Context; +using Bunq.Sdk.Http; +using Bunq.Sdk.Json; +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Text; +using System; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// With MonetaryAccountLight is a monetary account for bunq light users. Through this endpoint you can retrieve + /// information regarding your existing MonetaryAccountLights and update specific fields of an existing + /// MonetaryAccountLight. Examples of fields that can be updated are the description, the daily limit and the avatar + /// of the account. + /// + public class MonetaryAccountLight : BunqModel + { + /// + /// Endpoint constants. + /// + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account-light"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account-light/{1}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account-light/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account-light"; + + /// + /// Field constants. + /// + public const string FIELD_CURRENCY = "currency"; + + public const string FIELD_DESCRIPTION = "description"; + public const string FIELD_DAILY_LIMIT = "daily_limit"; + public const string FIELD_AVATAR_UUID = "avatar_uuid"; + public const string FIELD_STATUS = "status"; + public const string FIELD_SUB_STATUS = "sub_status"; + public const string FIELD_REASON = "reason"; + public const string FIELD_REASON_DESCRIPTION = "reason_description"; + public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; + public const string FIELD_SETTING = "setting"; + + /// + /// Object type. + /// + private const string OBJECT_TYPE_GET = "MonetaryAccountLight"; + + /// + /// The id of the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// The timestamp of the MonetaryAccountLight's creation. + /// + [JsonProperty(PropertyName = "created")] + public string Created { get; set; } + + /// + /// The timestamp of the MonetaryAccountLight's last update. + /// + [JsonProperty(PropertyName = "updated")] + public string Updated { get; set; } + + /// + /// The Avatar of the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "avatar")] + public Avatar Avatar { get; set; } + + /// + /// The currency of the MonetaryAccountLight as an ISO 4217 formatted currency code. + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; set; } + + /// + /// The description of the MonetaryAccountLight. Defaults to 'bunq account'. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// The daily spending limit Amount of the MonetaryAccountLight. Defaults to 1000 EUR. Currency must match the + /// MonetaryAccountLight's currency. Limited to 10000 EUR. + /// + [JsonProperty(PropertyName = "daily_limit")] + public Amount DailyLimit { get; set; } + + /// + /// Total Amount of money spent today. Timezone aware. + /// + [JsonProperty(PropertyName = "daily_spent")] + public Amount DailySpent { get; set; } + + /// + /// The current balance Amount of the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "balance")] + public Amount Balance { get; set; } + + /// + /// The Aliases for the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "alias")] + public List Alias { get; set; } + + /// + /// The MonetaryAccountLight's public UUID. + /// + [JsonProperty(PropertyName = "public_uuid")] + public string PublicUuid { get; set; } + + /// + /// The status of the MonetaryAccountLight. Can be: ACTIVE, BLOCKED, CANCELLED or PENDING_REOPEN + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// The sub-status of the MonetaryAccountLight providing extra information regarding the status. Will be NONE + /// for ACTIVE or PENDING_REOPEN, COMPLETELY or ONLY_ACCEPTING_INCOMING for BLOCKED and REDEMPTION_INVOLUNTARY, + /// REDEMPTION_VOLUNTARY or PERMANENT for CANCELLED. + /// + [JsonProperty(PropertyName = "sub_status")] + public string SubStatus { get; set; } + + /// + /// The reason for voluntarily cancelling (closing) the MonetaryAccountBank, can only be OTHER. + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountBank. Can be any user + /// provided message. + /// + [JsonProperty(PropertyName = "reason_description")] + public string ReasonDescription { get; set; } + + /// + /// The id of the User who owns the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "user_id")] + public int? UserId { get; set; } + + /// + /// The maximum balance Amount of the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "balance_maximum")] + public Amount BalanceMaximum { get; set; } + + /// + /// The amount of the monthly budget used. + /// + [JsonProperty(PropertyName = "budget_month_used")] + public Amount BudgetMonthUsed { get; set; } + + /// + /// The total amount of the monthly budget. + /// + [JsonProperty(PropertyName = "budget_month_maximum")] + public Amount BudgetMonthMaximum { get; set; } + + /// + /// The amount of the yearly budget used. + /// + [JsonProperty(PropertyName = "budget_year_used")] + public Amount BudgetYearUsed { get; set; } + + /// + /// The total amount of the yearly budget. + /// + [JsonProperty(PropertyName = "budget_year_maximum")] + public Amount BudgetYearMaximum { get; set; } + + /// + /// The amount of the yearly withdrawal budget used. + /// + [JsonProperty(PropertyName = "budget_withdrawal_year_used")] + public Amount BudgetWithdrawalYearUsed { get; set; } + + /// + /// The total amount of the yearly withdrawal budget. + /// + [JsonProperty(PropertyName = "budget_withdrawal_year_maximum")] + public Amount BudgetWithdrawalYearMaximum { get; set; } + + /// + /// The types of notifications that will result in a push notification or URL callback for this + /// MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "notification_filters")] + public List NotificationFilters { get; set; } + + /// + /// The settings of the MonetaryAccountLight. + /// + [JsonProperty(PropertyName = "setting")] + public MonetaryAccountSetting Setting { get; set; } + + /// + /// Create new MonetaryAccountLight. + /// + /// The currency of the MonetaryAccountLight as an ISO 4217 formatted currency code. + /// The description of the MonetaryAccountLight. Defaults to 'bunq account'. + /// The daily spending limit Amount of the MonetaryAccountLight. Defaults to 1000 EUR. Currency must match the MonetaryAccountLight's currency. Limited to 10000 EUR. + /// The UUID of the Avatar of the MonetaryAccountLight. + /// The status of the MonetaryAccountLight. Ignored in POST requests (always set to ACTIVE) can be CANCELLED or PENDING_REOPEN in PUT requests to cancel (close) or reopen the MonetaryAccountLight. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The sub-status of the MonetaryAccountLight providing extra information regarding the status. Should be ignored for POST requests and can only be REDEMPTION_VOLUNTARY for PUT requests with status CANCELLED. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The reason for voluntarily cancelling (closing) the MonetaryAccountBank, can only be OTHER. Should only be specified if updating the status to CANCELLED. + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountBank. Can be any user provided message. Should only be specified if updating the status to CANCELLED. + /// The types of notifications that will result in a push notification or URL callback for this MonetaryAccountLight. + /// The settings of the MonetaryAccountLight. + public static BunqResponse Create(string currency, string description = null, Amount dailyLimit = null, + string avatarUuid = null, string status = null, string subStatus = null, string reason = null, + string reasonDescription = null, List notificationFilters = null, + MonetaryAccountSetting setting = null, IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_CURRENCY, currency}, + {FIELD_DESCRIPTION, description}, + {FIELD_DAILY_LIMIT, dailyLimit}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_REASON, reason}, + {FIELD_REASON_DESCRIPTION, reasonDescription}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_SETTING, setting}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + + return ProcessForId(responseRaw); + } + + /// + /// Get a specific MonetaryAccountLight. + /// + public static BunqResponse Get(int monetaryAccountLightId, + IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), monetaryAccountLightId), + new Dictionary(), customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_GET); + } + + /// + /// Update a specific existing MonetaryAccountLight. + /// + /// The description of the MonetaryAccountLight. Defaults to 'bunq account'. + /// The daily spending limit Amount of the MonetaryAccountLight. Defaults to 1000 EUR. Currency must match the MonetaryAccountLight's currency. Limited to 10000 EUR. + /// The UUID of the Avatar of the MonetaryAccountLight. + /// The status of the MonetaryAccountLight. Ignored in POST requests (always set to ACTIVE) can be CANCELLED or PENDING_REOPEN in PUT requests to cancel (close) or reopen the MonetaryAccountLight. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The sub-status of the MonetaryAccountLight providing extra information regarding the status. Should be ignored for POST requests and can only be REDEMPTION_VOLUNTARY for PUT requests with status CANCELLED. When updating the status and/or sub_status no other fields can be updated in the same request (and vice versa). + /// The reason for voluntarily cancelling (closing) the MonetaryAccountBank, can only be OTHER. Should only be specified if updating the status to CANCELLED. + /// The optional free-form reason for voluntarily cancelling (closing) the MonetaryAccountBank. Can be any user provided message. Should only be specified if updating the status to CANCELLED. + /// The types of notifications that will result in a push notification or URL callback for this MonetaryAccountLight. + /// The settings of the MonetaryAccountLight. + public static BunqResponse Update(int monetaryAccountLightId, string description = null, + Amount dailyLimit = null, string avatarUuid = null, string status = null, string subStatus = null, + string reason = null, string reasonDescription = null, List notificationFilters = null, + MonetaryAccountSetting setting = null, IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_DAILY_LIMIT, dailyLimit}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_REASON, reason}, + {FIELD_REASON_DESCRIPTION, reasonDescription}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + {FIELD_SETTING, setting}, + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), monetaryAccountLightId), + requestBytes, customHeaders); + + return ProcessForId(responseRaw); + } + + /// + /// Gets a listing of all MonetaryAccountLights of a given user. + /// + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) + { + if (urlParams == null) urlParams = new Dictionary(); + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + + return FromJsonList(responseRaw, OBJECT_TYPE_GET); + } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.Id != null) + { + return false; + } + + if (this.Created != null) + { + return false; + } + + if (this.Updated != null) + { + return false; + } + + if (this.Avatar != null) + { + return false; + } + + if (this.Currency != null) + { + return false; + } + + if (this.Description != null) + { + return false; + } + + if (this.DailyLimit != null) + { + return false; + } + + if (this.DailySpent != null) + { + return false; + } + + if (this.Balance != null) + { + return false; + } + + if (this.Alias != null) + { + return false; + } + + if (this.PublicUuid != null) + { + return false; + } + + if (this.Status != null) + { + return false; + } + + if (this.SubStatus != null) + { + return false; + } + + if (this.Reason != null) + { + return false; + } + + if (this.ReasonDescription != null) + { + return false; + } + + if (this.UserId != null) + { + return false; + } + + if (this.BalanceMaximum != null) + { + return false; + } + + if (this.BudgetMonthUsed != null) + { + return false; + } + + if (this.BudgetMonthMaximum != null) + { + return false; + } + + if (this.BudgetYearUsed != null) + { + return false; + } + + if (this.BudgetYearMaximum != null) + { + return false; + } + + if (this.BudgetWithdrawalYearUsed != null) + { + return false; + } + + if (this.BudgetWithdrawalYearMaximum != null) + { + return false; + } + + if (this.NotificationFilters != null) + { + return false; + } + + if (this.Setting != null) + { + return false; + } + + return true; + } + + /// + /// + public static MonetaryAccountLight CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountProfile.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountProfile.cs index c9221e9..458892f 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountProfile.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountProfile.cs @@ -14,22 +14,23 @@ public class MonetaryAccountProfile : BunqModel /// Field constants. /// public const string FIELD_PROFILE_FILL = "profile_fill"; + public const string FIELD_PROFILE_DRAIN = "profile_drain"; - - + + /// /// The profile settings for triggering the fill of a monetary account. /// [JsonProperty(PropertyName = "profile_fill")] - public MonetaryAccountProfileFill ProfileFill { get; private set; } - + public MonetaryAccountProfileFill ProfileFill { get; set; } + /// /// The profile settings for moving excesses to a savings account /// [JsonProperty(PropertyName = "profile_drain")] - public MonetaryAccountProfileDrain ProfileDrain { get; private set; } - - + public MonetaryAccountProfileDrain ProfileDrain { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -38,15 +39,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ProfileDrain != null) { return false; } - + return true; } - + /// /// public static MonetaryAccountProfile CreateFromJsonString(string json) @@ -54,4 +55,4 @@ public static MonetaryAccountProfile CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Payment.cs b/BunqSdk/Model/Generated/Endpoint/Payment.cs index 3b8eed5..4bc8166 100644 --- a/BunqSdk/Model/Generated/Endpoint/Payment.cs +++ b/BunqSdk/Model/Generated/Endpoint/Payment.cs @@ -21,209 +21,243 @@ public class Payment : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/payment/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/payment/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment"; + /// /// Field constants. /// public const string FIELD_AMOUNT = "amount"; + public const string FIELD_COUNTERPARTY_ALIAS = "counterparty_alias"; public const string FIELD_DESCRIPTION = "description"; public const string FIELD_ATTACHMENT = "attachment"; public const string FIELD_MERCHANT_REFERENCE = "merchant_reference"; - public const string FIELD_ALLOW_BUNQTO = "allow_bunqto"; - public const string FIELD_BUNQTO_STATUS = "bunqto_status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Payment"; - + /// /// The id of the created Payment. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the Payment was done. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the Payment was last updated (will be updated when chat messages are received). /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The id of the MonetaryAccount the Payment was made to or from (depending on whether this is an incoming or /// outgoing Payment). /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The Amount transferred by the Payment. Will be negative for outgoing Payments and positive for incoming /// Payments (relative to the MonetaryAccount indicated by monetary_account_id). /// [JsonProperty(PropertyName = "amount")] - public Amount Amount { get; private set; } - + public Amount Amount { get; set; } + /// /// The LabelMonetaryAccount containing the public information of 'this' (party) side of the Payment. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The LabelMonetaryAccount containing the public information of the other (counterparty) side of the Payment. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The description for the Payment. Maximum 140 characters for Payments to external IBANs, 9000 characters for /// Payments to only other bunq MonetaryAccounts. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The type of Payment, can be BUNQ, EBA_SCT, EBA_SDD, IDEAL, SWIFT or FIS (card). /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + public string Type { get; set; } + /// /// The sub-type of the Payment, can be PAYMENT, WITHDRAWAL, REVERSAL, REQUEST, BILLING, SCT, SDD or NLO. /// [JsonProperty(PropertyName = "sub_type")] - public string SubType { get; private set; } - + public string SubType { get; set; } + /// /// The status of the bunq.to payment. /// [JsonProperty(PropertyName = "bunqto_status")] - public string BunqtoStatus { get; private set; } - + public string BunqtoStatus { get; set; } + /// /// The sub status of the bunq.to payment. /// [JsonProperty(PropertyName = "bunqto_sub_status")] - public string BunqtoSubStatus { get; private set; } - + public string BunqtoSubStatus { get; set; } + /// /// The status of the bunq.to payment. /// [JsonProperty(PropertyName = "bunqto_share_url")] - public string BunqtoShareUrl { get; private set; } - + public string BunqtoShareUrl { get; set; } + /// /// When bunq.to payment is about to expire. /// [JsonProperty(PropertyName = "bunqto_expiry")] - public string BunqtoExpiry { get; private set; } - + public string BunqtoExpiry { get; set; } + /// /// The timestamp of when the bunq.to payment was responded to. /// [JsonProperty(PropertyName = "bunqto_time_responded")] - public string BunqtoTimeResponded { get; private set; } - + public string BunqtoTimeResponded { get; set; } + /// /// The Attachments attached to the Payment. /// [JsonProperty(PropertyName = "attachment")] - public List Attachment { get; private set; } - + public List Attachment { get; set; } + /// /// Optional data included with the Payment specific to the merchant. /// [JsonProperty(PropertyName = "merchant_reference")] - public string MerchantReference { get; private set; } - + public string MerchantReference { get; set; } + /// /// The id of the PaymentBatch if this Payment was part of one. /// [JsonProperty(PropertyName = "batch_id")] - public int? BatchId { get; private set; } - + public int? BatchId { get; set; } + /// /// The id of the JobScheduled if the Payment was scheduled. /// [JsonProperty(PropertyName = "scheduled_id")] - public int? ScheduledId { get; private set; } - + public int? ScheduledId { get; set; } + /// /// A shipping Address provided with the Payment, currently unused. /// [JsonProperty(PropertyName = "address_shipping")] - public Address AddressShipping { get; private set; } - + public Address AddressShipping { get; set; } + /// /// A billing Address provided with the Payment, currently unused. /// [JsonProperty(PropertyName = "address_billing")] - public Address AddressBilling { get; private set; } - + public Address AddressBilling { get; set; } + /// /// The Geolocation where the Payment was done from. /// [JsonProperty(PropertyName = "geolocation")] - public Geolocation Geolocation { get; private set; } - + public Geolocation Geolocation { get; set; } + /// /// Whether or not chat messages are allowed. /// [JsonProperty(PropertyName = "allow_chat")] - public bool? AllowChat { get; private set; } - + public bool? AllowChat { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + /// /// Create a new Payment. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The Amount to transfer with the Payment. Must be bigger than 0 and smaller than the MonetaryAccount's balance. + /// The Alias of the party we are transferring the money to. Can be an Alias of type EMAIL or PHONE_NUMBER (for bunq MonetaryAccounts or bunq.to payments) or IBAN (for external bank account). + /// The description for the Payment. Maximum 140 characters for Payments to external IBANs, 9000 characters for Payments to only other bunq MonetaryAccounts. Field is required but can be an empty string. + /// The Attachments to attach to the Payment. + /// Optional data to be included with the Payment specific to the merchant. + public static BunqResponse Create(Amount amount, Pointer counterpartyAlias, string description, + int? monetaryAccountId = null, List attachment = null, + string merchantReference = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_AMOUNT, amount}, + {FIELD_COUNTERPARTY_ALIAS, counterpartyAlias}, + {FIELD_DESCRIPTION, description}, + {FIELD_ATTACHMENT, attachment}, + {FIELD_MERCHANT_REFERENCE, merchantReference}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a specific previous Payment. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int paymentId, IDictionary customHeaders = null) + public static BunqResponse Get(int paymentId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, paymentId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + paymentId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a listing of all Payments performed on a given MonetaryAccount (incoming and outgoing). /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -232,120 +266,125 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.Amount != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.SubType != null) { return false; } - + if (this.BunqtoStatus != null) { return false; } - + if (this.BunqtoSubStatus != null) { return false; } - + if (this.BunqtoShareUrl != null) { return false; } - + if (this.BunqtoExpiry != null) { return false; } - + if (this.BunqtoTimeResponded != null) { return false; } - + if (this.Attachment != null) { return false; } - + if (this.MerchantReference != null) { return false; } - + if (this.BatchId != null) { return false; } - + if (this.ScheduledId != null) { return false; } - + if (this.AddressShipping != null) { return false; } - + if (this.AddressBilling != null) { return false; } - + if (this.Geolocation != null) { return false; } - + if (this.AllowChat != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static Payment CreateFromJsonString(string json) @@ -353,4 +392,4 @@ public static Payment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/PaymentBatch.cs b/BunqSdk/Model/Generated/Endpoint/PaymentBatch.cs index 0086bfc..5452af2 100644 --- a/BunqSdk/Model/Generated/Endpoint/PaymentBatch.cs +++ b/BunqSdk/Model/Generated/Endpoint/PaymentBatch.cs @@ -17,84 +17,112 @@ public class PaymentBatch : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment-batch"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/payment-batch/{2}"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/payment-batch/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment-batch"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment-batch"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/payment-batch/{2}"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/payment-batch/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment-batch"; + /// /// Field constants. /// public const string FIELD_PAYMENTS = "payments"; - public const string FIELD_BUNQTO_STATUS = "bunqto_status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "PaymentBatch"; - + /// /// The list of mutations that were made. /// [JsonProperty(PropertyName = "payments")] - public List Payments { get; private set; } - + public List Payments { get; set; } + /// /// Create a payment batch by sending an array of single payment objects, that will become part of the batch. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The list of payments we want to send in a single batch. + public static BunqResponse Create(List payments, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PAYMENTS, payments}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Revoke a bunq.to payment batch. The status of all the payments will be set to REVOKED. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int paymentBatchId, IDictionary customHeaders = null) + public static BunqResponse Update(int paymentBatchId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, paymentBatchId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + paymentBatchId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Return the details of a specific payment batch. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int paymentBatchId, IDictionary customHeaders = null) + public static BunqResponse Get(int paymentBatchId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, paymentBatchId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + paymentBatchId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Return all the payment batches for a monetary account. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -103,10 +131,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static PaymentBatch CreateFromJsonString(string json) @@ -114,4 +142,4 @@ public static PaymentBatch CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs b/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs index d1fa902..9155f31 100644 --- a/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs +++ b/BunqSdk/Model/Generated/Endpoint/PaymentChat.cs @@ -17,87 +17,114 @@ public class PaymentChat : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment/{2}/chat"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/payment/{2}/chat/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment/{2}/chat"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/payment/{2}/chat"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/payment/{2}/chat/{3}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/payment/{2}/chat"; + /// /// Field constants. /// public const string FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ChatConversationPayment"; - + /// /// The id of the chat conversation. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the chat was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the chat was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The total number of unread messages in this conversation. /// [JsonProperty(PropertyName = "unread_message_count")] - public int? UnreadMessageCount { get; private set; } - + public int? UnreadMessageCount { get; set; } + /// /// Create a chat for a specific payment. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int paymentId, IDictionary customHeaders = null) + /// The id of the last read message. + public static BunqResponse Create(int paymentId, int? monetaryAccountId = null, + int? lastReadMessageId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, paymentId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + paymentId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Update the last read message in the chat of a specific payment. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int paymentId, int paymentChatId, IDictionary customHeaders = null) + /// The id of the last read message. + public static BunqResponse Update(int paymentId, int paymentChatId, int? monetaryAccountId = null, + int? lastReadMessageId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, paymentId, paymentChatId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + paymentId, paymentChatId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the chat for a specific payment. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int paymentId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int paymentId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, paymentId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), paymentId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -106,25 +133,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.UnreadMessageCount != null) { return false; } - + return true; } - + /// /// public static PaymentChat CreateFromJsonString(string json) @@ -132,4 +159,4 @@ public static PaymentChat CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/PermittedIp.cs b/BunqSdk/Model/Generated/Endpoint/PermittedIp.cs index 72c7143..157b138 100644 --- a/BunqSdk/Model/Generated/Endpoint/PermittedIp.cs +++ b/BunqSdk/Model/Generated/Endpoint/PermittedIp.cs @@ -17,87 +17,119 @@ public class PermittedIp : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/credential-password-ip/{1}/ip/{2}"; - private const string ENDPOINT_URL_CREATE = "user/{0}/credential-password-ip/{1}/ip"; - private const string ENDPOINT_URL_LISTING = "user/{0}/credential-password-ip/{1}/ip"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/credential-password-ip/{1}/ip/{2}"; - + protected const string ENDPOINT_URL_READ = "user/{0}/credential-password-ip/{1}/ip/{2}"; + + protected const string ENDPOINT_URL_CREATE = "user/{0}/credential-password-ip/{1}/ip"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/credential-password-ip/{1}/ip"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/credential-password-ip/{1}/ip/{2}"; + /// /// Field constants. /// public const string FIELD_IP = "ip"; + public const string FIELD_STATUS = "status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "PermittedIp"; - + /// /// The IP address. /// [JsonProperty(PropertyName = "ip")] - public string Ip { get; private set; } - + public string Ip { get; set; } + /// /// The status of the IP. May be "ACTIVE" or "INACTIVE". It is only possible to make requests from "ACTIVE" IP /// addresses. Only "ACTIVE" IPs will be billed. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int credentialPasswordIpId, int permittedIpId, IDictionary customHeaders = null) + public static BunqResponse Get(int credentialPasswordIpId, int permittedIpId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, credentialPasswordIpId, permittedIpId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), credentialPasswordIpId, permittedIpId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int credentialPasswordIpId, IDictionary customHeaders = null) + /// The IP address. + /// The status of the IP. May be "ACTIVE" or "INACTIVE". It is only possible to make requests from "ACTIVE" IP addresses. Only "ACTIVE" IPs will be billed. + public static BunqResponse Create(int credentialPasswordIpId, string ip, string status = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_IP, ip}, + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, credentialPasswordIpId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), credentialPasswordIpId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int credentialPasswordIpId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int credentialPasswordIpId, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, credentialPasswordIpId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), credentialPasswordIpId), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int credentialPasswordIpId, int permittedIpId, IDictionary customHeaders = null) + /// The status of the IP. May be "ACTIVE" or "INACTIVE". It is only possible to make requests from "ACTIVE" IP addresses. Only "ACTIVE" IPs will be billed. + public static BunqResponse Update(int credentialPasswordIpId, int permittedIpId, string status = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, credentialPasswordIpId, permittedIpId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), credentialPasswordIpId, permittedIpId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -106,15 +138,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Status != null) { return false; } - + return true; } - + /// /// public static PermittedIp CreateFromJsonString(string json) @@ -122,4 +154,4 @@ public static PermittedIp CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs b/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs index afc4653..06d29e7 100644 --- a/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs +++ b/BunqSdk/Model/Generated/Endpoint/PromotionDisplay.cs @@ -18,69 +18,81 @@ public class PromotionDisplay : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/promotion-display/{1}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/promotion-display/{1}"; - + protected const string ENDPOINT_URL_READ = "user/{0}/promotion-display/{1}"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/promotion-display/{1}"; + /// /// Field constants. /// public const string FIELD_STATUS = "status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "PromotionDisplay"; - + /// /// The id of the promotion. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The alias of the user you received the promotion from. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The event description of the promotion appearing on time line. /// [JsonProperty(PropertyName = "event_description")] - public string EventDescription { get; private set; } - + public string EventDescription { get; set; } + /// /// The status of the promotion. (CREATED, CLAIMED, EXPIRED, DISCARDED) /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int promotionDisplayId, IDictionary customHeaders = null) + public static BunqResponse Get(int promotionDisplayId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, promotionDisplayId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), promotionDisplayId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int promotionDisplayId, IDictionary customHeaders = null) + /// The status of the promotion. User can set it to discarded. + public static BunqResponse Update(int promotionDisplayId, string status = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, promotionDisplayId), requestBytes, customHeaders); - + var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), promotionDisplayId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -89,25 +101,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.EventDescription != null) { return false; } - + if (this.Status != null) { return false; } - + return true; } - + /// /// public static PromotionDisplay CreateFromJsonString(string json) @@ -115,4 +127,4 @@ public static PromotionDisplay CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestInquiry.cs b/BunqSdk/Model/Generated/Endpoint/RequestInquiry.cs index 6d002e6..7c0cd15 100644 --- a/BunqSdk/Model/Generated/Endpoint/RequestInquiry.cs +++ b/BunqSdk/Model/Generated/Endpoint/RequestInquiry.cs @@ -21,15 +21,17 @@ public class RequestInquiry : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/request-inquiry/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/request-inquiry/{2}"; + /// /// Field constants. /// public const string FIELD_AMOUNT_INQUIRED = "amount_inquired"; + public const string FIELD_COUNTERPARTY_ALIAS = "counterparty_alias"; public const string FIELD_DESCRIPTION = "description"; public const string FIELD_ATTACHMENT = "attachment"; @@ -42,219 +44,287 @@ public class RequestInquiry : BunqModel public const string FIELD_ALLOW_AMOUNT_HIGHER = "allow_amount_higher"; public const string FIELD_ALLOW_BUNQME = "allow_bunqme"; public const string FIELD_REDIRECT_URL = "redirect_url"; - + public const string FIELD_EVENT_ID = "event_id"; + /// /// Object type. /// private const string OBJECT_TYPE_PUT = "RequestInquiry"; + private const string OBJECT_TYPE_GET = "RequestInquiry"; - + /// /// The id of the created RequestInquiry. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the payment request's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the payment request's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The timestamp of when the payment request was responded to. /// [JsonProperty(PropertyName = "time_responded")] - public string TimeResponded { get; private set; } - + public string TimeResponded { get; set; } + /// /// The timestamp of when the payment request expired. /// [JsonProperty(PropertyName = "time_expiry")] - public string TimeExpiry { get; private set; } - + public string TimeExpiry { get; set; } + /// /// The id of the monetary account the request response applies to. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The requested amount. /// [JsonProperty(PropertyName = "amount_inquired")] - public Amount AmountInquired { get; private set; } - + public Amount AmountInquired { get; set; } + /// /// The responded amount. /// [JsonProperty(PropertyName = "amount_responded")] - public Amount AmountResponded { get; private set; } - + public Amount AmountResponded { get; set; } + /// /// The label that's displayed to the counterparty with the mutation. Includes user. /// [JsonProperty(PropertyName = "user_alias_created")] - public LabelUser UserAliasCreated { get; private set; } - + public LabelUser UserAliasCreated { get; set; } + /// /// The label that's displayed to the counterparty with the mutation. Includes user. /// [JsonProperty(PropertyName = "user_alias_revoked")] - public LabelUser UserAliasRevoked { get; private set; } - + public LabelUser UserAliasRevoked { get; set; } + /// /// The LabelMonetaryAccount with the public information of the MonetaryAccount the money was requested from. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The description of the inquiry. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The client's custom reference that was attached to the request and the mutation. /// [JsonProperty(PropertyName = "merchant_reference")] - public string MerchantReference { get; private set; } - + public string MerchantReference { get; set; } + /// /// The attachments attached to the payment. /// [JsonProperty(PropertyName = "attachment")] - public List Attachment { get; private set; } - + public List Attachment { get; set; } + /// /// The status of the request. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The id of the batch if the request was part of a batch. /// [JsonProperty(PropertyName = "batch_id")] - public int? BatchId { get; private set; } - + public int? BatchId { get; set; } + /// /// The id of the scheduled job if the request was scheduled. /// [JsonProperty(PropertyName = "scheduled_id")] - public int? ScheduledId { get; private set; } - + public int? ScheduledId { get; set; } + /// /// The minimum age the user accepting the RequestInquiry must have. /// [JsonProperty(PropertyName = "minimum_age")] - public int? MinimumAge { get; private set; } - + public int? MinimumAge { get; set; } + /// /// Whether or not an address must be provided on accept. /// [JsonProperty(PropertyName = "require_address")] - public string RequireAddress { get; private set; } - + public string RequireAddress { get; set; } + /// /// The url that points to the bunq.me request. /// [JsonProperty(PropertyName = "bunqme_share_url")] - public string BunqmeShareUrl { get; private set; } - + public string BunqmeShareUrl { get; set; } + /// /// The URL which the user is sent to after accepting or rejecting the Request. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - + public string RedirectUrl { get; set; } + /// /// The shipping address provided by the accepting user if an address was requested. /// [JsonProperty(PropertyName = "address_shipping")] - public Address AddressShipping { get; private set; } - + public Address AddressShipping { get; set; } + /// /// The billing address provided by the accepting user if an address was requested. /// [JsonProperty(PropertyName = "address_billing")] - public Address AddressBilling { get; private set; } - + public Address AddressBilling { get; set; } + /// /// The geolocation where the payment was done. /// [JsonProperty(PropertyName = "geolocation")] - public Geolocation Geolocation { get; private set; } - + public Geolocation Geolocation { get; set; } + /// /// Whether or not chat messages are allowed. /// [JsonProperty(PropertyName = "allow_chat")] - public bool? AllowChat { get; private set; } - + public bool? AllowChat { get; set; } + + /// + /// The reference to the object used for split the bill. Can be Payment, PaymentBatch, ScheduleInstance, + /// RequestResponse and MasterCardAction + /// + [JsonProperty(PropertyName = "reference_split_the_bill")] + public RequestReferenceSplitTheBillAnchorObject ReferenceSplitTheBill { get; set; } + /// /// Create a new payment request. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The Amount requested to be paid by the person the RequestInquiry is sent to. Must be bigger than 0. + /// The Alias of the party we are requesting the money from. Can be an Alias of type EMAIL, PHONE_NUMBER or IBAN. In case the EMAIL or PHONE_NUMBER Alias does not refer to a bunq monetary account, 'allow_bunqme' needs to be 'true' in order to trigger the creation of a bunq.me request. Otherwise no request inquiry will be sent. + /// The description for the RequestInquiry. Maximum 9000 characters. Field is required but can be an empty string. + /// Whether or not sending a bunq.me request is allowed. + /// The Attachments to attach to the RequestInquiry. + /// Optional data to be included with the RequestInquiry specific to the merchant. Has to be unique for the same source MonetaryAccount. + /// The status of the RequestInquiry. Ignored in POST requests but can be used for revoking (cancelling) the RequestInquiry by setting REVOKED with a PUT request. + /// The minimum age the user accepting the RequestInquiry must have. Defaults to not checking. If set, must be between 12 and 100 inclusive. + /// Whether a billing and shipping address must be provided when paying the request. Possible values are: BILLING, SHIPPING, BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. + /// [DEPRECATED] Whether or not the accepting user can give an extra tip on top of the requested Amount. Defaults to false. + /// [DEPRECATED] Whether or not the accepting user can choose to accept with a lower amount than requested. Defaults to false. + /// [DEPRECATED] Whether or not the accepting user can choose to accept with a higher amount than requested. Defaults to false. + /// The URL which the user is sent to after accepting or rejecting the Request. + /// The ID of the associated event if the request was made using 'split the bill'. + public static BunqResponse Create(Amount amountInquired, Pointer counterpartyAlias, string description, + bool? allowBunqme, int? monetaryAccountId = null, List attachment = null, + string merchantReference = null, string status = null, int? minimumAge = null, string requireAddress = null, + bool? wantTip = null, bool? allowAmountLower = null, bool? allowAmountHigher = null, + string redirectUrl = null, int? eventId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_AMOUNT_INQUIRED, amountInquired}, + {FIELD_COUNTERPARTY_ALIAS, counterpartyAlias}, + {FIELD_DESCRIPTION, description}, + {FIELD_ATTACHMENT, attachment}, + {FIELD_MERCHANT_REFERENCE, merchantReference}, + {FIELD_STATUS, status}, + {FIELD_MINIMUM_AGE, minimumAge}, + {FIELD_REQUIRE_ADDRESS, requireAddress}, + {FIELD_WANT_TIP, wantTip}, + {FIELD_ALLOW_AMOUNT_LOWER, allowAmountLower}, + {FIELD_ALLOW_AMOUNT_HIGHER, allowAmountHigher}, + {FIELD_ALLOW_BUNQME, allowBunqme}, + {FIELD_REDIRECT_URL, redirectUrl}, + {FIELD_EVENT_ID, eventId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Revoke a request for payment, by updating the status to REVOKED. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestInquiryId, IDictionary customHeaders = null) + /// The status of the RequestInquiry. Ignored in POST requests but can be used for revoking (cancelling) the RequestInquiry by setting REVOKED with a PUT request. + public static BunqResponse Update(int requestInquiryId, int? monetaryAccountId = null, + string status = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, requestInquiryId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestInquiryId), requestBytes, customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_PUT); } - + /// /// Get all payment requests for a user's monetary account. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get the details of a specific payment request, including its status. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int requestInquiryId, IDictionary customHeaders = null) + public static BunqResponse Get(int requestInquiryId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, requestInquiryId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestInquiryId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -263,130 +333,135 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.TimeResponded != null) { return false; } - + if (this.TimeExpiry != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.AmountInquired != null) { return false; } - + if (this.AmountResponded != null) { return false; } - + if (this.UserAliasCreated != null) { return false; } - + if (this.UserAliasRevoked != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.MerchantReference != null) { return false; } - + if (this.Attachment != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.BatchId != null) { return false; } - + if (this.ScheduledId != null) { return false; } - + if (this.MinimumAge != null) { return false; } - + if (this.RequireAddress != null) { return false; } - + if (this.BunqmeShareUrl != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + if (this.AddressShipping != null) { return false; } - + if (this.AddressBilling != null) { return false; } - + if (this.Geolocation != null) { return false; } - + if (this.AllowChat != null) { return false; } - + + if (this.ReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static RequestInquiry CreateFromJsonString(string json) @@ -394,4 +469,4 @@ public static RequestInquiry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestInquiryBatch.cs b/BunqSdk/Model/Generated/Endpoint/RequestInquiryBatch.cs index a755fd4..b322615 100644 --- a/BunqSdk/Model/Generated/Endpoint/RequestInquiryBatch.cs +++ b/BunqSdk/Model/Generated/Endpoint/RequestInquiryBatch.cs @@ -18,91 +18,138 @@ public class RequestInquiryBatch : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry-batch"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry-batch/{2}"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/request-inquiry-batch/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry-batch"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry-batch"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry-batch/{2}"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/request-inquiry-batch/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry-batch"; + /// /// Field constants. /// public const string FIELD_REQUEST_INQUIRIES = "request_inquiries"; + public const string FIELD_STATUS = "status"; public const string FIELD_TOTAL_AMOUNT_INQUIRED = "total_amount_inquired"; - + public const string FIELD_EVENT_ID = "event_id"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "RequestInquiryBatch"; - + /// /// The list of requests that were made. /// [JsonProperty(PropertyName = "request_inquiries")] - public List RequestInquiries { get; private set; } - + public List RequestInquiries { get; set; } + /// /// The total amount originally inquired for this batch. /// [JsonProperty(PropertyName = "total_amount_inquired")] - public Amount TotalAmountInquired { get; private set; } - + public Amount TotalAmountInquired { get; set; } + + /// + /// The reference to the object used for split the bill. Can be Payment, PaymentBatch, ScheduleInstance, + /// RequestResponse and MasterCardAction + /// + [JsonProperty(PropertyName = "reference_split_the_bill")] + public RequestReferenceSplitTheBillAnchorObject ReferenceSplitTheBill { get; set; } + /// /// Create a request batch by sending an array of single request objects, that will become part of the batch. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The list of request inquiries we want to send in 1 batch. + /// The total amount originally inquired for this batch. + /// The status of the request. + /// The ID of the associated event if the request batch was made using 'split the bill'. + public static BunqResponse Create(List requestInquiries, Amount totalAmountInquired, + int? monetaryAccountId = null, string status = null, int? eventId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_REQUEST_INQUIRIES, requestInquiries}, + {FIELD_STATUS, status}, + {FIELD_TOTAL_AMOUNT_INQUIRED, totalAmountInquired}, + {FIELD_EVENT_ID, eventId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Revoke a request batch. The status of all the requests will be set to REVOKED. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestInquiryBatchId, IDictionary customHeaders = null) + /// The status of the request. + public static BunqResponse Update(int requestInquiryBatchId, int? monetaryAccountId = null, + string status = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, requestInquiryBatchId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestInquiryBatchId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Return the details of a specific request batch. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int requestInquiryBatchId, IDictionary customHeaders = null) + public static BunqResponse Get(int requestInquiryBatchId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, requestInquiryBatchId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestInquiryBatchId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Return all the request batches for a monetary account. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -111,15 +158,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TotalAmountInquired != null) { return false; } - + + if (this.ReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static RequestInquiryBatch CreateFromJsonString(string json) @@ -127,4 +179,4 @@ public static RequestInquiryBatch CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs b/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs index 6cbab87..bbc0d97 100644 --- a/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs +++ b/BunqSdk/Model/Generated/Endpoint/RequestInquiryChat.cs @@ -20,87 +20,115 @@ public class RequestInquiryChat : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat/{3}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-inquiry/{2}/chat"; + /// /// Field constants. /// public const string FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "RequestInquiryChat"; - + /// /// The id of the newly created chat conversation. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the chat was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the chat was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The total number of messages in this conversation. /// [JsonProperty(PropertyName = "unread_message_count")] - public int? UnreadMessageCount { get; private set; } - + public int? UnreadMessageCount { get; set; } + /// /// Create a chat for a specific request inquiry. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestInquiryId, IDictionary customHeaders = null) + /// The id of the last read message. + public static BunqResponse Create(int requestInquiryId, int? monetaryAccountId = null, + int? lastReadMessageId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, requestInquiryId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestInquiryId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Update the last read message in the chat of a specific request inquiry. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestInquiryId, int requestInquiryChatId, IDictionary customHeaders = null) + /// The id of the last read message. + public static BunqResponse Update(int requestInquiryId, int requestInquiryChatId, + int? monetaryAccountId = null, int? lastReadMessageId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, requestInquiryId, requestInquiryChatId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestInquiryId, requestInquiryChatId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the chat for a specific request inquiry. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int requestInquiryId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int requestInquiryId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, requestInquiryId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), requestInquiryId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -109,25 +137,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.UnreadMessageCount != null) { return false; } - + return true; } - + /// /// public static RequestInquiryChat CreateFromJsonString(string json) @@ -135,4 +163,4 @@ public static RequestInquiryChat CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestResponse.cs b/BunqSdk/Model/Generated/Endpoint/RequestResponse.cs index d3c5969..5f30ccb 100644 --- a/BunqSdk/Model/Generated/Endpoint/RequestResponse.cs +++ b/BunqSdk/Model/Generated/Endpoint/RequestResponse.cs @@ -21,219 +21,254 @@ public class RequestResponse : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-response/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-response"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/request-response/{2}"; - + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-response/{2}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-response"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/request-response/{2}"; + /// /// Field constants. /// public const string FIELD_AMOUNT_RESPONDED = "amount_responded"; + public const string FIELD_STATUS = "status"; public const string FIELD_ADDRESS_SHIPPING = "address_shipping"; public const string FIELD_ADDRESS_BILLING = "address_billing"; - + /// /// Object type. /// private const string OBJECT_TYPE_PUT = "RequestResponse"; + private const string OBJECT_TYPE_GET = "RequestResponse"; - + /// /// The id of the Request Response. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the Request Response was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the Request Response was last updated (will be updated when chat messages are received). /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The timestamp of when the RequestResponse was responded to. /// [JsonProperty(PropertyName = "time_responded")] - public string TimeResponded { get; private set; } - + public string TimeResponded { get; set; } + /// /// The timestamp of when the RequestResponse expired or will expire. /// [JsonProperty(PropertyName = "time_expiry")] - public string TimeExpiry { get; private set; } - + public string TimeExpiry { get; set; } + /// /// The id of the MonetaryAccount the RequestResponse was received on. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The requested Amount. /// [JsonProperty(PropertyName = "amount_inquired")] - public Amount AmountInquired { get; private set; } - + public Amount AmountInquired { get; set; } + /// /// The Amount the RequestResponse was accepted with. /// [JsonProperty(PropertyName = "amount_responded")] - public Amount AmountResponded { get; private set; } - + public Amount AmountResponded { get; set; } + /// /// The status of the RequestResponse. Can be ACCEPTED, PENDING, REJECTED or REVOKED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The description for the RequestResponse provided by the requesting party. Maximum 9000 characters. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The LabelMonetaryAccount with the public information of the MonetaryAccount this RequestResponse was /// received on. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The LabelMonetaryAccount with the public information of the MonetaryAccount that is requesting money with /// this RequestResponse. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The Attachments attached to the RequestResponse. /// [JsonProperty(PropertyName = "attachment")] - public List Attachment { get; private set; } - + public List Attachment { get; set; } + /// /// The minimum age the user accepting the RequestResponse must have. /// [JsonProperty(PropertyName = "minimum_age")] - public int? MinimumAge { get; private set; } - + public int? MinimumAge { get; set; } + /// /// Whether or not an address must be provided on accept. /// [JsonProperty(PropertyName = "require_address")] - public string RequireAddress { get; private set; } - + public string RequireAddress { get; set; } + /// /// The Geolocation where the RequestResponse was created. /// [JsonProperty(PropertyName = "geolocation")] - public Geolocation Geolocation { get; private set; } - + public Geolocation Geolocation { get; set; } + /// /// The type of the RequestInquiry. Can be DIRECT_DEBIT, DIRECT_DEBIT_B2B, IDEAL, SOFORT or INTERNAL. /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + public string Type { get; set; } + /// /// The subtype of the RequestInquiry. Can be ONCE or RECURRING for DIRECT_DEBIT RequestInquiries and NONE for /// all other. /// [JsonProperty(PropertyName = "sub_type")] - public string SubType { get; private set; } - + public string SubType { get; set; } + /// /// The URL which the user is sent to after accepting or rejecting the Request. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - + public string RedirectUrl { get; set; } + /// /// The billing address provided by the accepting user if an address was requested. /// [JsonProperty(PropertyName = "address_billing")] - public Address AddressBilling { get; private set; } - + public Address AddressBilling { get; set; } + /// /// The shipping address provided by the accepting user if an address was requested. /// [JsonProperty(PropertyName = "address_shipping")] - public Address AddressShipping { get; private set; } - + public Address AddressShipping { get; set; } + /// /// Whether or not chat messages are allowed. /// [JsonProperty(PropertyName = "allow_chat")] - public bool? AllowChat { get; private set; } - + public bool? AllowChat { get; set; } + /// /// The credit scheme id provided by the counterparty for DIRECT_DEBIT inquiries. /// [JsonProperty(PropertyName = "credit_scheme_identifier")] - public string CreditSchemeIdentifier { get; private set; } - + public string CreditSchemeIdentifier { get; set; } + /// /// The mandate id provided by the counterparty for DIRECT_DEBIT inquiries. /// [JsonProperty(PropertyName = "mandate_identifier")] - public string MandateIdentifier { get; private set; } - + public string MandateIdentifier { get; set; } + /// /// The whitelist id for this action or null. /// [JsonProperty(PropertyName = "eligible_whitelist_id")] - public int? EligibleWhitelistId { get; private set; } - + public int? EligibleWhitelistId { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + /// /// Update the status to accept or reject the RequestResponse. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestResponseId, IDictionary customHeaders = null) + /// The Amount the user decides to pay. + /// The responding status of the RequestResponse. Can be ACCEPTED or REJECTED. + /// The shipping Address to return to the user who created the RequestInquiry. Should only be provided if 'require_address' is set to SHIPPING, BILLING_SHIPPING or OPTIONAL. + /// The billing Address to return to the user who created the RequestInquiry. Should only be provided if 'require_address' is set to BILLING, BILLING_SHIPPING or OPTIONAL. + public static BunqResponse Update(int requestResponseId, int? monetaryAccountId = null, + Amount amountResponded = null, string status = null, Address addressShipping = null, + Address addressBilling = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_AMOUNT_RESPONDED, amountResponded}, + {FIELD_STATUS, status}, + {FIELD_ADDRESS_SHIPPING, addressShipping}, + {FIELD_ADDRESS_BILLING, addressBilling}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, requestResponseId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestResponseId), requestBytes, customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_PUT); } - + /// /// Get all RequestResponses for a MonetaryAccount. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get the details for a specific existing RequestResponse. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int requestResponseId, IDictionary customHeaders = null) + public static BunqResponse Get(int requestResponseId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, requestResponseId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestResponseId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -242,130 +277,135 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.TimeResponded != null) { return false; } - + if (this.TimeExpiry != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.AmountInquired != null) { return false; } - + if (this.AmountResponded != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.Attachment != null) { return false; } - + if (this.MinimumAge != null) { return false; } - + if (this.RequireAddress != null) { return false; } - + if (this.Geolocation != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.SubType != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + if (this.AddressBilling != null) { return false; } - + if (this.AddressShipping != null) { return false; } - + if (this.AllowChat != null) { return false; } - + if (this.CreditSchemeIdentifier != null) { return false; } - + if (this.MandateIdentifier != null) { return false; } - + if (this.EligibleWhitelistId != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static RequestResponse CreateFromJsonString(string json) @@ -373,4 +413,4 @@ public static RequestResponse CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs b/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs index 3be154c..8ce57d9 100644 --- a/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs +++ b/BunqSdk/Model/Generated/Endpoint/RequestResponseChat.cs @@ -20,87 +20,115 @@ public class RequestResponseChat : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-response/{2}/chat"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-response/{2}/chat/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-response/{2}/chat"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/request-response/{2}/chat"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/request-response/{2}/chat/{3}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/request-response/{2}/chat"; + /// /// Field constants. /// public const string FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "RequestResponseChat"; - + /// /// The id of the newly created chat conversation. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp when the chat was created. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp when the chat was last updated. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The total number of messages in this conversation. /// [JsonProperty(PropertyName = "unread_message_count")] - public int? UnreadMessageCount { get; private set; } - + public int? UnreadMessageCount { get; set; } + /// /// Create a chat for a specific request response. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestResponseId, IDictionary customHeaders = null) + /// The id of the last read message. + public static BunqResponse Create(int requestResponseId, int? monetaryAccountId = null, + int? lastReadMessageId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, requestResponseId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestResponseId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Update the last read message in the chat of a specific request response. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int requestResponseId, int requestResponseChatId, IDictionary customHeaders = null) + /// The id of the last read message. + public static BunqResponse Update(int requestResponseId, int requestResponseChatId, + int? monetaryAccountId = null, int? lastReadMessageId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_LAST_READ_MESSAGE_ID, lastReadMessageId}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, requestResponseId, requestResponseChatId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + requestResponseId, requestResponseChatId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the chat for a specific request response. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int requestResponseId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int requestResponseId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, requestResponseId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), requestResponseId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -109,25 +137,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.UnreadMessageCount != null) { return false; } - + return true; } - + /// /// public static RequestResponseChat CreateFromJsonString(string json) @@ -135,4 +163,4 @@ public static RequestResponseChat CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/SandboxUser.cs b/BunqSdk/Model/Generated/Endpoint/SandboxUser.cs new file mode 100644 index 0000000..38aee0f --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/SandboxUser.cs @@ -0,0 +1,71 @@ +using Bunq.Sdk.Context; +using Bunq.Sdk.Http; +using Bunq.Sdk.Json; +using Bunq.Sdk.Model.Core; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Text; +using System; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// Used to create a sandbox user. + /// + public class SandboxUser : BunqModel + { + /// + /// Endpoint constants. + /// + protected const string ENDPOINT_URL_CREATE = "sandbox-user"; + + /// + /// Object type. + /// + private const string OBJECT_TYPE_POST = "ApiKey"; + + /// + /// The API key of the newly created sandbox user. + /// + [JsonProperty(PropertyName = "api_key")] + public string ApiKey { get; set; } + + /// + /// + public static BunqResponse Create(IDictionary customHeaders = null) + { + if (customHeaders == null) customHeaders = new Dictionary(); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + }; + + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); + var responseRaw = apiClient.Post(ENDPOINT_URL_CREATE, requestBytes, customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_POST); + } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.ApiKey != null) + { + return false; + } + + return true; + } + + /// + /// + public static SandboxUser CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Schedule.cs b/BunqSdk/Model/Generated/Endpoint/Schedule.cs index 3b57c2e..185d012 100644 --- a/BunqSdk/Model/Generated/Endpoint/Schedule.cs +++ b/BunqSdk/Model/Generated/Endpoint/Schedule.cs @@ -18,88 +18,98 @@ public class Schedule : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/schedule/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/schedule"; - + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/schedule/{2}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/schedule"; + /// /// Field constants. /// public const string FIELD_TIME_START = "time_start"; + public const string FIELD_TIME_END = "time_end"; public const string FIELD_RECURRENCE_UNIT = "recurrence_unit"; public const string FIELD_RECURRENCE_SIZE = "recurrence_size"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Schedule"; - + /// /// The schedule start time (UTC). /// [JsonProperty(PropertyName = "time_start")] - public string TimeStart { get; private set; } - + public string TimeStart { get; set; } + /// /// The schedule end time (UTC). /// [JsonProperty(PropertyName = "time_end")] - public string TimeEnd { get; private set; } - + public string TimeEnd { get; set; } + /// /// The schedule recurrence unit, options: ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY /// [JsonProperty(PropertyName = "recurrence_unit")] - public string RecurrenceUnit { get; private set; } - + public string RecurrenceUnit { get; set; } + /// /// The schedule recurrence size. For example size 4 and unit WEEKLY means the recurrence is every 4 weeks. /// [JsonProperty(PropertyName = "recurrence_size")] - public int? RecurrenceSize { get; private set; } - + public int? RecurrenceSize { get; set; } + /// /// The schedule status, options: ACTIVE, FINISHED, CANCELLED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The scheduled object. (Payment, PaymentBatch) /// [JsonProperty(PropertyName = "object")] - public ScheduleAnchorObject Object { get; private set; } - + public ScheduleAnchorObject Object { get; set; } + /// /// Get a specific schedule definition for a given monetary account. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int scheduleId, IDictionary customHeaders = null) + public static BunqResponse Get(int scheduleId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, scheduleId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + scheduleId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a collection of scheduled definition for a given monetary account. You can add the parameter type to /// filter the response. When type={SCHEDULE_DEFINITION_PAYMENT,SCHEDULE_DEFINITION_PAYMENT_BATCH} is provided /// only schedule definition object that relate to these definitions are returned. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -108,35 +118,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TimeEnd != null) { return false; } - + if (this.RecurrenceUnit != null) { return false; } - + if (this.RecurrenceSize != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.Object != null) { return false; } - + return true; } - + /// /// public static Schedule CreateFromJsonString(string json) @@ -144,4 +154,4 @@ public static Schedule CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ScheduleInstance.cs b/BunqSdk/Model/Generated/Endpoint/ScheduleInstance.cs index 3f83cb4..208c4c8 100644 --- a/BunqSdk/Model/Generated/Endpoint/ScheduleInstance.cs +++ b/BunqSdk/Model/Generated/Endpoint/ScheduleInstance.cs @@ -18,95 +18,121 @@ public class ScheduleInstance : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/schedule/{2}/schedule-instance/{3}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/schedule/{2}/schedule-instance/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/schedule/{2}/schedule-instance"; - + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/schedule/{2}/schedule-instance/{3}"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/schedule/{2}/schedule-instance/{3}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/schedule/{2}/schedule-instance"; + /// /// Field constants. /// public const string FIELD_STATE = "state"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ScheduledInstance"; - + /// /// The state of the scheduleInstance. (FINISHED_SUCCESSFULLY, RETRY, FAILED_USER_ERROR) /// [JsonProperty(PropertyName = "state")] - public string State { get; private set; } - + public string State { get; set; } + /// /// The schedule start time (UTC). /// [JsonProperty(PropertyName = "time_start")] - public string TimeStart { get; private set; } - + public string TimeStart { get; set; } + /// /// The schedule end time (UTC). /// [JsonProperty(PropertyName = "time_end")] - public string TimeEnd { get; private set; } - + public string TimeEnd { get; set; } + /// /// The message when the scheduled instance has run and failed due to user error. /// [JsonProperty(PropertyName = "error_message")] - public List ErrorMessage { get; private set; } - + public List ErrorMessage { get; set; } + /// /// The scheduled object. (Payment, PaymentBatch) /// [JsonProperty(PropertyName = "scheduled_object")] - public ScheduleAnchorObject ScheduledObject { get; private set; } - + public ScheduleAnchorObject ScheduledObject { get; set; } + /// /// The result object of this schedule instance. (Payment, PaymentBatch) /// [JsonProperty(PropertyName = "result_object")] - public ScheduleInstanceAnchorObject ResultObject { get; private set; } - + public ScheduleInstanceAnchorObject ResultObject { get; set; } + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int scheduleId, int scheduleInstanceId, IDictionary customHeaders = null) + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + + /// + /// + public static BunqResponse Get(int scheduleId, int scheduleInstanceId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, scheduleId, scheduleInstanceId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + scheduleId, scheduleInstanceId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int scheduleId, int scheduleInstanceId, IDictionary customHeaders = null) + /// Change the state of the scheduleInstance from FAILED_USER_ERROR to RETRY. + public static BunqResponse Update(int scheduleId, int scheduleInstanceId, int? monetaryAccountId = null, + string state = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATE, state}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, scheduleId, scheduleInstanceId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + scheduleId, scheduleInstanceId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int scheduleId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int scheduleId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, scheduleId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), scheduleId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -115,35 +141,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TimeStart != null) { return false; } - + if (this.TimeEnd != null) { return false; } - + if (this.ErrorMessage != null) { return false; } - + if (this.ScheduledObject != null) { return false; } - + if (this.ResultObject != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static ScheduleInstance CreateFromJsonString(string json) @@ -151,4 +182,4 @@ public static ScheduleInstance CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/SchedulePayment.cs b/BunqSdk/Model/Generated/Endpoint/SchedulePayment.cs index 94a0e6f..859304d 100644 --- a/BunqSdk/Model/Generated/Endpoint/SchedulePayment.cs +++ b/BunqSdk/Model/Generated/Endpoint/SchedulePayment.cs @@ -18,99 +18,140 @@ public class SchedulePayment : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/schedule-payment"; - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/schedule-payment/{2}"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/schedule-payment/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/schedule-payment"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/schedule-payment/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/schedule-payment"; + + protected const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/schedule-payment/{2}"; + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/schedule-payment/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/schedule-payment"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/schedule-payment/{2}"; + /// /// Field constants. /// public const string FIELD_PAYMENT = "payment"; + public const string FIELD_SCHEDULE = "schedule"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ScheduledPayment"; - + /// /// The payment details. /// [JsonProperty(PropertyName = "payment")] - public SchedulePaymentEntry Payment { get; private set; } - + public SchedulePaymentEntry Payment { get; set; } + /// /// The schedule details. /// [JsonProperty(PropertyName = "schedule")] - public Schedule Schedule { get; private set; } - + public Schedule Schedule { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The payment details. + /// The schedule details when creating or updating a scheduled payment. + public static BunqResponse Create(SchedulePaymentEntry payment, Schedule schedule, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PAYMENT, payment}, + {FIELD_SCHEDULE, schedule}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int schedulePaymentId, IDictionary customHeaders = null) + public static BunqResponse Delete(int schedulePaymentId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, schedulePaymentId), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + schedulePaymentId), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int schedulePaymentId, IDictionary customHeaders = null) + public static BunqResponse Get(int schedulePaymentId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, schedulePaymentId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + schedulePaymentId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int schedulePaymentId, IDictionary customHeaders = null) + /// The payment details. + /// The schedule details when creating or updating a scheduled payment. + public static BunqResponse Update(int schedulePaymentId, int? monetaryAccountId = null, + SchedulePaymentEntry payment = null, Schedule schedule = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PAYMENT, payment}, + {FIELD_SCHEDULE, schedule}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, schedulePaymentId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + schedulePaymentId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -119,15 +160,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Schedule != null) { return false; } - + return true; } - + /// /// public static SchedulePayment CreateFromJsonString(string json) @@ -135,4 +176,4 @@ public static SchedulePayment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/SchedulePaymentBatch.cs b/BunqSdk/Model/Generated/Endpoint/SchedulePaymentBatch.cs index 4dde231..8efa099 100644 --- a/BunqSdk/Model/Generated/Endpoint/SchedulePaymentBatch.cs +++ b/BunqSdk/Model/Generated/Endpoint/SchedulePaymentBatch.cs @@ -18,68 +18,101 @@ public class SchedulePaymentBatch : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/schedule-payment-batch"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/schedule-payment-batch/{2}"; - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/schedule-payment-batch/{2}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/schedule-payment-batch"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/schedule-payment-batch/{2}"; + protected const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/schedule-payment-batch/{2}"; + /// /// Field constants. /// public const string FIELD_PAYMENTS = "payments"; + public const string FIELD_SCHEDULE = "schedule"; - - + + /// /// The payment details. /// [JsonProperty(PropertyName = "payments")] - public List Payments { get; private set; } - + public List Payments { get; set; } + /// /// The schedule details. /// [JsonProperty(PropertyName = "schedule")] - public Schedule Schedule { get; private set; } - + public Schedule Schedule { get; set; } + /// /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The payment details. + /// The schedule details when creating a scheduled payment. + public static BunqResponse Create(List payments, Schedule schedule, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PAYMENTS, payments}, + {FIELD_SCHEDULE, schedule}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int schedulePaymentBatchId, IDictionary customHeaders = null) + /// The payment details. + /// The schedule details when creating a scheduled payment. + public static BunqResponse Update(int schedulePaymentBatchId, int? monetaryAccountId = null, + List payments = null, Schedule schedule = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_PAYMENTS, payments}, + {FIELD_SCHEDULE, schedule}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, schedulePaymentBatchId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + schedulePaymentBatchId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int schedulePaymentBatchId, IDictionary customHeaders = null) + public static BunqResponse Delete(int schedulePaymentBatchId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, schedulePaymentBatchId), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + schedulePaymentBatchId), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() @@ -88,15 +121,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Schedule != null) { return false; } - + return true; } - + /// /// public static SchedulePaymentBatch CreateFromJsonString(string json) @@ -104,4 +137,4 @@ public static SchedulePaymentBatch CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ScheduleUser.cs b/BunqSdk/Model/Generated/Endpoint/ScheduleUser.cs index f1fbb35..a915878 100644 --- a/BunqSdk/Model/Generated/Endpoint/ScheduleUser.cs +++ b/BunqSdk/Model/Generated/Endpoint/ScheduleUser.cs @@ -17,38 +17,40 @@ public class ScheduleUser : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/schedule"; - + protected const string ENDPOINT_URL_LISTING = "user/{0}/schedule"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ScheduleUser"; - + /// /// Get a collection of scheduled definition for all accessible monetary accounts of the user. You can add the /// parameter type to filter the response. When /// type={SCHEDULE_DEFINITION_PAYMENT,SCHEDULE_DEFINITION_PAYMENT_BATCH} is provided only schedule definition /// object that relate to these definitions are returned. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static ScheduleUser CreateFromJsonString(string json) @@ -56,4 +58,4 @@ public static ScheduleUser CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Session.cs b/BunqSdk/Model/Generated/Endpoint/Session.cs index 25923b4..5c08763 100644 --- a/BunqSdk/Model/Generated/Endpoint/Session.cs +++ b/BunqSdk/Model/Generated/Endpoint/Session.cs @@ -17,30 +17,30 @@ public class Session : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_DELETE = "session/{0}"; - - + protected const string ENDPOINT_URL_DELETE = "session/{0}"; + + /// /// Deletes the current session. /// - public static BunqResponse Delete(ApiContext apiContext, int sessionId, IDictionary customHeaders = null) + public static BunqResponse Delete(int sessionId, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, sessionId), customHeaders); - + return new BunqResponse(null, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static Session CreateFromJsonString(string json) @@ -48,4 +48,4 @@ public static Session CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ShareInviteBankAmountUsed.cs b/BunqSdk/Model/Generated/Endpoint/ShareInviteBankAmountUsed.cs index d7206ce..1dc6289 100644 --- a/BunqSdk/Model/Generated/Endpoint/ShareInviteBankAmountUsed.cs +++ b/BunqSdk/Model/Generated/Endpoint/ShareInviteBankAmountUsed.cs @@ -19,30 +19,35 @@ public class ShareInviteBankAmountUsed : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry/{2}/amount-used/{3}"; - - + protected const string ENDPOINT_URL_DELETE = + "user/{0}/monetary-account/{1}/share-invite-bank-inquiry/{2}/amount-used/{3}"; + + /// /// Reset the available budget for a bank account share. To be called without any ID at the end of the path. /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int shareInviteBankInquiryId, int shareInviteBankAmountUsedId, IDictionary customHeaders = null) + public static BunqResponse Delete(int shareInviteBankInquiryId, int shareInviteBankAmountUsedId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, shareInviteBankInquiryId, shareInviteBankAmountUsedId), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + shareInviteBankInquiryId, shareInviteBankAmountUsedId), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static ShareInviteBankAmountUsed CreateFromJsonString(string json) @@ -50,4 +55,4 @@ public static ShareInviteBankAmountUsed CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ShareInviteBankInquiry.cs b/BunqSdk/Model/Generated/Endpoint/ShareInviteBankInquiry.cs index d2240cf..d1b3019 100644 --- a/BunqSdk/Model/Generated/Endpoint/ShareInviteBankInquiry.cs +++ b/BunqSdk/Model/Generated/Endpoint/ShareInviteBankInquiry.cs @@ -20,160 +20,212 @@ public class ShareInviteBankInquiry : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry/{2}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry"; + + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry/{2}"; + protected const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry/{2}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/share-invite-bank-inquiry"; + /// /// Field constants. /// public const string FIELD_COUNTER_USER_ALIAS = "counter_user_alias"; + public const string FIELD_DRAFT_SHARE_INVITE_BANK_ID = "draft_share_invite_bank_id"; public const string FIELD_SHARE_DETAIL = "share_detail"; public const string FIELD_STATUS = "status"; public const string FIELD_SHARE_TYPE = "share_type"; public const string FIELD_START_DATE = "start_date"; public const string FIELD_END_DATE = "end_date"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ShareInviteBankInquiry"; - + /// /// The label of the monetary account that's being shared. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The user who created the share. /// [JsonProperty(PropertyName = "user_alias_created")] - public LabelUser UserAliasCreated { get; private set; } - + public LabelUser UserAliasCreated { get; set; } + /// /// The user who revoked the share. /// [JsonProperty(PropertyName = "user_alias_revoked")] - public LabelUser UserAliasRevoked { get; private set; } - + public LabelUser UserAliasRevoked { get; set; } + /// /// The label of the user to share with. /// [JsonProperty(PropertyName = "counter_user_alias")] - public LabelUser CounterUserAlias { get; private set; } - + public LabelUser CounterUserAlias { get; set; } + /// /// The id of the monetary account the share applies to. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The id of the draft share invite bank. /// [JsonProperty(PropertyName = "draft_share_invite_bank_id")] - public int? DraftShareInviteBankId { get; private set; } - + public int? DraftShareInviteBankId { get; set; } + /// /// The share details. Only one of these objects is returned. /// [JsonProperty(PropertyName = "share_detail")] - public ShareDetail ShareDetail { get; private set; } - + public ShareDetail ShareDetail { get; set; } + /// /// The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), /// ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, /// CANCELLATION_REJECTED (for canceling mutual connects) /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The share type, either STANDARD or MUTUAL. /// [JsonProperty(PropertyName = "share_type")] - public string ShareType { get; private set; } - + public string ShareType { get; set; } + /// /// The start date of this share. /// [JsonProperty(PropertyName = "start_date")] - public string StartDate { get; private set; } - + public string StartDate { get; set; } + /// /// The expiration date of this share. /// [JsonProperty(PropertyName = "end_date")] - public string EndDate { get; private set; } - + public string EndDate { get; set; } + /// /// The id of the newly created share invite. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// Create a new share inquiry for a monetary account, specifying the permission the other bunq user will have /// on it. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, IDictionary customHeaders = null) + /// The pointer of the user to share with. + /// The share details. Only one of these objects may be passed. + /// The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, CANCELLATION_REJECTED (for canceling mutual connects). + /// The id of the draft share invite bank. + /// The share type, either STANDARD or MUTUAL. + /// The start date of this share. + /// The expiration date of this share. + public static BunqResponse Create(Pointer counterUserAlias, ShareDetail shareDetail, string status, + int? monetaryAccountId = null, int? draftShareInviteBankId = null, string shareType = null, + string startDate = null, string endDate = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_COUNTER_USER_ALIAS, counterUserAlias}, + {FIELD_DRAFT_SHARE_INVITE_BANK_ID, draftShareInviteBankId}, + {FIELD_SHARE_DETAIL, shareDetail}, + {FIELD_STATUS, status}, + {FIELD_SHARE_TYPE, shareType}, + {FIELD_START_DATE, startDate}, + {FIELD_END_DATE, endDate}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get the details of a specific share inquiry. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int shareInviteBankInquiryId, IDictionary customHeaders = null) + public static BunqResponse Get(int shareInviteBankInquiryId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, shareInviteBankInquiryId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + shareInviteBankInquiryId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Update the details of a share. This includes updating status (revoking or cancelling it), granted permission /// and validity period of this share. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int shareInviteBankInquiryId, IDictionary customHeaders = null) + /// The share details. Only one of these objects may be passed. + /// The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, CANCELLATION_REJECTED (for canceling mutual connects). + /// The start date of this share. + /// The expiration date of this share. + public static BunqResponse Update(int shareInviteBankInquiryId, int? monetaryAccountId = null, + ShareDetail shareDetail = null, string status = null, string startDate = null, string endDate = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_SHARE_DETAIL, shareDetail}, + {FIELD_STATUS, status}, + {FIELD_START_DATE, startDate}, + {FIELD_END_DATE, endDate}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, shareInviteBankInquiryId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + shareInviteBankInquiryId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Get a list with all the share inquiries for a monetary account, only if the requesting user has permission /// to change the details of the various ones. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -182,65 +234,65 @@ public override bool IsAllFieldNull() { return false; } - + if (this.UserAliasCreated != null) { return false; } - + if (this.UserAliasRevoked != null) { return false; } - + if (this.CounterUserAlias != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.DraftShareInviteBankId != null) { return false; } - + if (this.ShareDetail != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.ShareType != null) { return false; } - + if (this.StartDate != null) { return false; } - + if (this.EndDate != null) { return false; } - + if (this.Id != null) { return false; } - + return true; } - + /// /// public static ShareInviteBankInquiry CreateFromJsonString(string json) @@ -248,4 +300,4 @@ public static ShareInviteBankInquiry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/ShareInviteBankResponse.cs b/BunqSdk/Model/Generated/Endpoint/ShareInviteBankResponse.cs index 005a228..496459d 100644 --- a/BunqSdk/Model/Generated/Endpoint/ShareInviteBankResponse.cs +++ b/BunqSdk/Model/Generated/Endpoint/ShareInviteBankResponse.cs @@ -19,124 +19,140 @@ public class ShareInviteBankResponse : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/share-invite-bank-response/{1}"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/share-invite-bank-response/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/share-invite-bank-response"; - + protected const string ENDPOINT_URL_READ = "user/{0}/share-invite-bank-response/{1}"; + + protected const string ENDPOINT_URL_UPDATE = "user/{0}/share-invite-bank-response/{1}"; + protected const string ENDPOINT_URL_LISTING = "user/{0}/share-invite-bank-response"; + /// /// Field constants. /// public const string FIELD_STATUS = "status"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "ShareInviteBankResponse"; - + /// /// The monetary account and user who created the share. /// [JsonProperty(PropertyName = "counter_alias")] - public MonetaryAccountReference CounterAlias { get; private set; } - + public MonetaryAccountReference CounterAlias { get; set; } + /// /// The user who cancelled the share if it has been revoked or rejected. /// [JsonProperty(PropertyName = "user_alias_cancelled")] - public LabelUser UserAliasCancelled { get; private set; } - + public LabelUser UserAliasCancelled { get; set; } + /// /// The id of the monetary account the ACCEPTED share applies to. null otherwise. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The id of the draft share invite bank. /// [JsonProperty(PropertyName = "draft_share_invite_bank_id")] - public int? DraftShareInviteBankId { get; private set; } - + public int? DraftShareInviteBankId { get; set; } + /// /// The share details. /// [JsonProperty(PropertyName = "share_detail")] - public ShareDetail ShareDetail { get; private set; } - + public ShareDetail ShareDetail { get; set; } + /// /// The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), /// ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, /// CANCELLATION_REJECTED (for canceling mutual connects) /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The share type, either STANDARD or MUTUAL. /// [JsonProperty(PropertyName = "share_type")] - public string ShareType { get; private set; } - + public string ShareType { get; set; } + /// /// The start date of this share. /// [JsonProperty(PropertyName = "start_date")] - public string StartDate { get; private set; } - + public string StartDate { get; set; } + /// /// The expiration date of this share. /// [JsonProperty(PropertyName = "end_date")] - public string EndDate { get; private set; } - + public string EndDate { get; set; } + /// /// The description of this share. It is basically the monetary account description. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// Return the details of a specific share a user was invited to. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int shareInviteBankResponseId, IDictionary customHeaders = null) + public static BunqResponse Get(int shareInviteBankResponseId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, shareInviteBankResponseId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), shareInviteBankResponseId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Accept or reject a share a user was invited to. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int shareInviteBankResponseId, IDictionary customHeaders = null) + /// The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, CANCELLATION_REJECTED (for canceling mutual connects) + public static BunqResponse Update(int shareInviteBankResponseId, string status = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, shareInviteBankResponseId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), shareInviteBankResponseId), + requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Return all the shares a user was invited to. /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -145,55 +161,55 @@ public override bool IsAllFieldNull() { return false; } - + if (this.UserAliasCancelled != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.DraftShareInviteBankId != null) { return false; } - + if (this.ShareDetail != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.ShareType != null) { return false; } - + if (this.StartDate != null) { return false; } - + if (this.EndDate != null) { return false; } - + if (this.Description != null) { return false; } - + return true; } - + /// /// public static ShareInviteBankResponse CreateFromJsonString(string json) @@ -201,4 +217,4 @@ public static ShareInviteBankResponse CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Tab.cs b/BunqSdk/Model/Generated/Endpoint/Tab.cs index 2bb697d..e80eeba 100644 --- a/BunqSdk/Model/Generated/Endpoint/Tab.cs +++ b/BunqSdk/Model/Generated/Endpoint/Tab.cs @@ -1,8 +1,8 @@ using Bunq.Sdk.Context; -using Bunq.Sdk.Exception; using Bunq.Sdk.Http; using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; using System.Text; @@ -11,102 +11,130 @@ namespace Bunq.Sdk.Model.Generated.Endpoint { /// - /// Once your CashRegister has been activated you can use it to create Tabs. A Tab is a template for a payment. In - /// contrast to requests a Tab is not pointed towards a specific user. Any user can pay the Tab as long as it is - /// made visible by you. The creation of a Tab happens with /tab-usage-single or /tab-usage-multiple. A - /// TabUsageSingle is a Tab that can be paid once. A TabUsageMultiple is a Tab that can be paid multiple times by - /// different users. + /// Used to read a single publicly visible tab. /// - public class Tab : BunqModel, IAnchorObjectInterface + public class Tab : BunqModel { - /// - /// Error constants. - /// - private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab"; - + protected const string ENDPOINT_URL_READ = "tab/{0}"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "Tab"; - + /// + /// The uuid of the tab. /// - [JsonProperty(PropertyName = "TabUsageSingle")] - public TabUsageSingle TabUsageSingle { get; private set; } - + [JsonProperty(PropertyName = "uuid")] + public string Uuid { get; set; } + /// + /// The label of the party that owns this tab. /// - [JsonProperty(PropertyName = "TabUsageMultiple")] - public TabUsageMultiple TabUsageMultiple { get; private set; } - + [JsonProperty(PropertyName = "alias")] + public MonetaryAccountReference Alias { get; set; } + /// - /// Get a specific tab. This returns a TabUsageSingle or TabUsageMultiple. + /// The avatar of this tab. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId, tabUuid), new Dictionary(), customHeaders); - - return FromJson(responseRaw); - } - + [JsonProperty(PropertyName = "avatar")] + public string Avatar { get; set; } + /// - /// Get a collection of tabs. + /// The reference of the tab, as defined by the owner. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, IDictionary urlParams = null, IDictionary customHeaders = null) + [JsonProperty(PropertyName = "reference")] + public string Reference { get; set; } + + /// + /// The short description of the tab. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// The status of the tab. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// The moment when this tab expires. + /// + [JsonProperty(PropertyName = "expiration")] + public string Expiration { get; set; } + + /// + /// The total amount of the tab. + /// + [JsonProperty(PropertyName = "amount_total")] + public Amount AmountTotal { get; set; } + + /// + /// Get a publicly visible tab. + /// + public static BunqResponse Get(string tabUuid, IDictionary customHeaders = null) { - if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId), urlParams, customHeaders); - - return FromJsonList(responseRaw); + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, tabUuid), new Dictionary(), + customHeaders); + + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// - public BunqModel GetReferencedObject() + public override bool IsAllFieldNull() { - if (this.TabUsageSingle != null) + if (this.Uuid != null) { - return this.TabUsageSingle; + return false; } - - if (this.TabUsageMultiple != null) + + if (this.Alias != null) { - return this.TabUsageMultiple; + return false; } - - throw new BunqException(ERROR_NULL_FIELDS); - } - - /// - /// - public override bool IsAllFieldNull() - { - if (this.TabUsageSingle != null) + + if (this.Avatar != null) { return false; } - - if (this.TabUsageMultiple != null) + + if (this.Reference != null) + { + return false; + } + + if (this.Description != null) { return false; } - + + if (this.Status != null) + { + return false; + } + + if (this.Expiration != null) + { + return false; + } + + if (this.AmountTotal != null) + { + return false; + } + return true; } - + /// /// public static Tab CreateFromJsonString(string json) @@ -114,4 +142,4 @@ public static Tab CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabAttachmentTab.cs b/BunqSdk/Model/Generated/Endpoint/TabAttachmentTab.cs index 4f706fc..2c70fd9 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabAttachmentTab.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabAttachmentTab.cs @@ -18,51 +18,53 @@ public class TabAttachmentTab : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "tab/{0}/attachment/{1}"; - + protected const string ENDPOINT_URL_READ = "tab/{0}/attachment/{1}"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TabAttachmentTab"; - + /// /// The id of the attachment. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the attachment's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the attachment's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The attachment. /// [JsonProperty(PropertyName = "attachment")] - public Attachment Attachment { get; private set; } - + public Attachment Attachment { get; set; } + /// /// Get a specific attachment. The header of the response contains the content-type of the attachment. /// - public static BunqResponse Get(ApiContext apiContext, string tabUuid, int tabAttachmentTabId, IDictionary customHeaders = null) + public static BunqResponse Get(string tabUuid, int tabAttachmentTabId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, tabUuid, tabAttachmentTabId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, tabUuid, tabAttachmentTabId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -71,25 +73,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Attachment != null) { return false; } - + return true; } - + /// /// public static TabAttachmentTab CreateFromJsonString(string json) @@ -97,4 +99,4 @@ public static TabAttachmentTab CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabAttachmentTabContent.cs b/BunqSdk/Model/Generated/Endpoint/TabAttachmentTabContent.cs index 07c7511..420fc63 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabAttachmentTabContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabAttachmentTabContent.cs @@ -18,34 +18,36 @@ public class TabAttachmentTabContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "tab/{0}/attachment/{1}/content"; - + protected const string ENDPOINT_URL_LISTING = "tab/{0}/attachment/{1}/content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TabAttachmentTabContent"; - + /// /// Get the raw content of a specific attachment. /// - public static BunqResponse List(ApiContext apiContext, string tabUuid, int attachmentId, IDictionary customHeaders = null) + public static BunqResponse List(string tabUuid, int attachmentId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, tabUuid, attachmentId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, tabUuid, attachmentId), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static TabAttachmentTabContent CreateFromJsonString(string json) @@ -53,4 +55,4 @@ public static TabAttachmentTabContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabItem.cs b/BunqSdk/Model/Generated/Endpoint/TabItem.cs index 4b5820b..c2050fe 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabItem.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabItem.cs @@ -14,46 +14,46 @@ public class TabItem : BunqModel /// The id of the tab item. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The item's brief description. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The item's EAN code. /// [JsonProperty(PropertyName = "ean_code")] - public string EanCode { get; private set; } - + public string EanCode { get; set; } + /// /// A struct with an AttachmentPublic UUID that used as an avatar for the TabItem. /// [JsonProperty(PropertyName = "avatar_attachment")] - public AttachmentPublic AvatarAttachment { get; private set; } - + public AttachmentPublic AvatarAttachment { get; set; } + /// /// A list of AttachmentTab attached to the TabItem. /// [JsonProperty(PropertyName = "tab_attachment")] - public List TabAttachment { get; private set; } - + public List TabAttachment { get; set; } + /// /// The quantity of the item. Formatted as a number containing up to 15 digits, up to 15 decimals and using a /// dot. /// [JsonProperty(PropertyName = "quantity")] - public string Quantity { get; private set; } - + public string Quantity { get; set; } + /// /// The money amount of the item. /// [JsonProperty(PropertyName = "amount")] - public Amount Amount { get; private set; } - - + public Amount Amount { get; set; } + + /// /// public override bool IsAllFieldNull() @@ -62,40 +62,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Description != null) { return false; } - + if (this.EanCode != null) { return false; } - + if (this.AvatarAttachment != null) { return false; } - + if (this.TabAttachment != null) { return false; } - + if (this.Quantity != null) { return false; } - + if (this.Amount != null) { return false; } - + return true; } - + /// /// public static TabItem CreateFromJsonString(string json) @@ -103,4 +103,4 @@ public static TabItem CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabItemShop.cs b/BunqSdk/Model/Generated/Endpoint/TabItemShop.cs index 9877d9a..230622f 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabItemShop.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabItemShop.cs @@ -22,138 +22,207 @@ public class TabItemShop : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item/{4}"; - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item/{4}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item/{4}"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item"; + + protected const string ENDPOINT_URL_UPDATE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item/{4}"; + + protected const string ENDPOINT_URL_DELETE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item/{4}"; + + protected const string ENDPOINT_URL_LISTING = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item"; + + protected const string ENDPOINT_URL_READ = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item/{4}"; + /// /// Field constants. /// public const string FIELD_DESCRIPTION = "description"; + public const string FIELD_EAN_CODE = "ean_code"; public const string FIELD_AVATAR_ATTACHMENT_UUID = "avatar_attachment_uuid"; public const string FIELD_TAB_ATTACHMENT = "tab_attachment"; public const string FIELD_QUANTITY = "quantity"; public const string FIELD_AMOUNT = "amount"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TabItem"; - + /// /// The id of the created TabItem. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The TabItem's brief description. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The TabItem's EAN code. /// [JsonProperty(PropertyName = "ean_code")] - public string EanCode { get; private set; } - + public string EanCode { get; set; } + /// /// A struct with an AttachmentPublic UUID that used as an avatar for the TabItem. /// [JsonProperty(PropertyName = "avatar_attachment")] - public AttachmentPublic AvatarAttachment { get; private set; } - + public AttachmentPublic AvatarAttachment { get; set; } + /// /// A list of AttachmentTab attached to the TabItem. /// [JsonProperty(PropertyName = "tab_attachment")] - public List TabAttachment { get; private set; } - + public List TabAttachment { get; set; } + /// /// The quantity of the TabItem. /// [JsonProperty(PropertyName = "quantity")] - public double? Quantity { get; private set; } - + public double? Quantity { get; set; } + /// /// The money amount of the TabItem. /// [JsonProperty(PropertyName = "amount")] - public Amount Amount { get; private set; } - + public Amount Amount { get; set; } + /// /// Create a new TabItem for a given Tab. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, IDictionary customHeaders = null) + /// The TabItem's brief description. Can't be empty and must be no longer than 100 characters + /// The TabItem's EAN code. + /// An AttachmentPublic UUID that used as an avatar for the TabItem. + /// A list of AttachmentTab attached to the TabItem. + /// The quantity of the TabItem. Formatted as a number containing up to 15 digits, up to 15 decimals and using a dot. + /// The money amount of the TabItem. Will not change the value of the corresponding Tab. + public static BunqResponse Create(int cashRegisterId, string tabUuid, string description, + int? monetaryAccountId = null, string eanCode = null, string avatarAttachmentUuid = null, + List tabAttachment = null, string quantity = null, Amount amount = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_EAN_CODE, eanCode}, + {FIELD_AVATAR_ATTACHMENT_UUID, avatarAttachmentUuid}, + {FIELD_TAB_ATTACHMENT, tabAttachment}, + {FIELD_QUANTITY, quantity}, + {FIELD_AMOUNT, amount}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, cashRegisterId, tabUuid), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Modify a TabItem from a given Tab. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, int tabItemShopId, IDictionary customHeaders = null) + /// The TabItem's brief description. Can't be empty and must be no longer than 100 characters + /// The TabItem's EAN code. + /// An AttachmentPublic UUID that used as an avatar for the TabItem. + /// A list of AttachmentTab attached to the TabItem. + /// The quantity of the TabItem. Formatted as a number containing up to 15 digits, up to 15 decimals and using a dot. + /// The money amount of the TabItem. Will not change the value of the corresponding Tab. + public static BunqResponse Update(int cashRegisterId, string tabUuid, int tabItemShopId, + int? monetaryAccountId = null, string description = null, string eanCode = null, + string avatarAttachmentUuid = null, List tabAttachment = null, string quantity = null, + Amount amount = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_EAN_CODE, eanCode}, + {FIELD_AVATAR_ATTACHMENT_UUID, avatarAttachmentUuid}, + {FIELD_TAB_ATTACHMENT, tabAttachment}, + {FIELD_QUANTITY, quantity}, + {FIELD_AMOUNT, amount}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, cashRegisterId, tabUuid, tabItemShopId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid, tabItemShopId), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - + /// /// Delete a specific TabItem from a Tab. /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, int tabItemShopId, IDictionary customHeaders = null) + public static BunqResponse Delete(int cashRegisterId, string tabUuid, int tabItemShopId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, cashRegisterId, tabUuid, tabItemShopId), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid, tabItemShopId), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - + /// /// Get a collection of TabItems from a given Tab. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cashRegisterId, string tabUuid, + int? monetaryAccountId = null, IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId, tabUuid), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId, tabUuid), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a specific TabItem from a given Tab. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, int tabItemShopId, IDictionary customHeaders = null) + public static BunqResponse Get(int cashRegisterId, string tabUuid, int tabItemShopId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId, tabUuid, tabItemShopId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid, tabItemShopId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -162,40 +231,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Description != null) { return false; } - + if (this.EanCode != null) { return false; } - + if (this.AvatarAttachment != null) { return false; } - + if (this.TabAttachment != null) { return false; } - + if (this.Quantity != null) { return false; } - + if (this.Amount != null) { return false; } - + return true; } - + /// /// public static TabItemShop CreateFromJsonString(string json) @@ -203,4 +272,4 @@ public static TabItemShop CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabItemShopBatch.cs b/BunqSdk/Model/Generated/Endpoint/TabItemShopBatch.cs index b82a050..df17b61 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabItemShopBatch.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabItemShopBatch.cs @@ -17,35 +17,47 @@ public class TabItemShopBatch : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item-batch"; - + protected const string ENDPOINT_URL_CREATE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-item-batch"; + /// /// Field constants. /// public const string FIELD_TAB_ITEMS = "tab_items"; - - + + /// /// The list of tab items in the batch. /// [JsonProperty(PropertyName = "tab_items")] - public List TabItems { get; private set; } - + public List TabItems { get; set; } + /// /// Create tab items as a batch. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, IDictionary customHeaders = null) + /// The list of tab items we want to create in a single batch. Limited to 50 items per batch. + public static BunqResponse Create(int cashRegisterId, string tabUuid, List tabItems, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_TAB_ITEMS, tabItems}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, cashRegisterId, tabUuid), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid), requestBytes, customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -54,10 +66,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static TabItemShopBatch CreateFromJsonString(string json) @@ -65,4 +77,4 @@ public static TabItemShopBatch CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabQrCodeContent.cs b/BunqSdk/Model/Generated/Endpoint/TabQrCodeContent.cs index 6f9fd30..e9b93a9 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabQrCodeContent.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabQrCodeContent.cs @@ -18,35 +18,41 @@ public class TabQrCodeContent : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/qr-code-content"; - + protected const string ENDPOINT_URL_LISTING = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/qr-code-content"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TabQrCodeContent"; - + /// /// Returns the raw content of the QR code that links to this Tab. The raw content is the binary representation /// of a file, without any JSON wrapping. /// - public static BunqResponse List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, IDictionary customHeaders = null) + public static BunqResponse List(int cashRegisterId, string tabUuid, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId, tabUuid), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId, tabUuid), + new Dictionary(), customHeaders); + return new BunqResponse(responseRaw.BodyBytes, responseRaw.Headers); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static TabQrCodeContent CreateFromJsonString(string json) @@ -54,4 +60,4 @@ public static TabQrCodeContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabResultInquiry.cs b/BunqSdk/Model/Generated/Endpoint/TabResultInquiry.cs index 5e2053f..5795ade 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabResultInquiry.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabResultInquiry.cs @@ -18,54 +18,67 @@ public class TabResultInquiry : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-result-inquiry/{4}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-result-inquiry"; - + protected const string ENDPOINT_URL_READ = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-result-inquiry/{4}"; + + protected const string ENDPOINT_URL_LISTING = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab/{3}/tab-result-inquiry"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TabResultInquiry"; - + /// /// The Tab details. /// [JsonProperty(PropertyName = "tab")] - public Tab Tab { get; private set; } - + public Tab Tab { get; set; } + /// /// The payment made for the Tab. /// [JsonProperty(PropertyName = "payment")] - public Payment Payment { get; private set; } - + public Payment Payment { get; set; } + /// /// Used to view a single TabResultInquiry belonging to a tab. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, int tabResultInquiryId, IDictionary customHeaders = null) + public static BunqResponse Get(int cashRegisterId, string tabUuid, int tabResultInquiryId, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId, tabUuid, tabResultInquiryId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUuid, tabResultInquiryId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Used to view a list of TabResultInquiry objects belonging to a tab. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUuid, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cashRegisterId, string tabUuid, + int? monetaryAccountId = null, IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId, tabUuid), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId, tabUuid), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -74,15 +87,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Payment != null) { return false; } - + return true; } - + /// /// public static TabResultInquiry CreateFromJsonString(string json) @@ -90,4 +103,4 @@ public static TabResultInquiry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabResultResponse.cs b/BunqSdk/Model/Generated/Endpoint/TabResultResponse.cs index 43c127b..a660548 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabResultResponse.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabResultResponse.cs @@ -2,6 +2,7 @@ using Bunq.Sdk.Http; using Bunq.Sdk.Json; using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; using Newtonsoft.Json; using System.Collections.Generic; using System.Text; @@ -18,54 +19,69 @@ public class TabResultResponse : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/tab-result-response/{2}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/tab-result-response"; - + protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/tab-result-response/{2}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/tab-result-response"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "TabResultResponse"; - + /// /// The Tab details. /// [JsonProperty(PropertyName = "tab")] - public Tab Tab { get; private set; } - + public Tab Tab { get; set; } + /// /// The payment made for the Tab. /// [JsonProperty(PropertyName = "payment")] - public Payment Payment { get; private set; } - + public Payment Payment { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + /// /// Used to view a single TabResultResponse belonging to a tab. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int tabResultResponseId, IDictionary customHeaders = null) + public static BunqResponse Get(int tabResultResponseId, int? monetaryAccountId = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, tabResultResponseId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + tabResultResponseId), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Used to view a list of TabResultResponse objects belonging to a tab. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -74,15 +90,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Payment != null) { return false; } - + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + return true; } - + /// /// public static TabResultResponse CreateFromJsonString(string json) @@ -90,4 +111,4 @@ public static TabResultResponse CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabUsageMultiple.cs b/BunqSdk/Model/Generated/Endpoint/TabUsageMultiple.cs index f409fc7..41f8425 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabUsageMultiple.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabUsageMultiple.cs @@ -23,16 +23,26 @@ public class TabUsageMultiple : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple/{3}"; - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple/{3}"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple"; - + protected const string ENDPOINT_URL_CREATE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple"; + + protected const string ENDPOINT_URL_UPDATE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple/{3}"; + + protected const string ENDPOINT_URL_DELETE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple/{3}"; + + protected const string ENDPOINT_URL_READ = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple/{3}"; + + protected const string ENDPOINT_URL_LISTING = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-multiple"; + /// /// Field constants. /// public const string FIELD_DESCRIPTION = "description"; + public const string FIELD_STATUS = "status"; public const string FIELD_AMOUNT_TOTAL = "amount_total"; public const string FIELD_ALLOW_AMOUNT_HIGHER = "allow_amount_higher"; @@ -44,190 +54,260 @@ public class TabUsageMultiple : BunqModel public const string FIELD_VISIBILITY = "visibility"; public const string FIELD_EXPIRATION = "expiration"; public const string FIELD_TAB_ATTACHMENT = "tab_attachment"; - + /// /// Object type. /// private const string OBJECT_TYPE_POST = "Uuid"; + private const string OBJECT_TYPE_PUT = "Uuid"; private const string OBJECT_TYPE_GET = "TabUsageMultiple"; - + /// /// The uuid of the created TabUsageMultiple. /// [JsonProperty(PropertyName = "uuid")] - public string Uuid { get; private set; } - + public string Uuid { get; set; } + /// /// The timestamp of the Tab's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the Tab's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The description of the TabUsageMultiple. Maximum 9000 characters. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The status of the Tab. Can be OPEN, PAYABLE or CLOSED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The total amount of the Tab. /// [JsonProperty(PropertyName = "amount_total")] - public Amount AmountTotal { get; private set; } - + public Amount AmountTotal { get; set; } + /// /// The token used to redirect mobile devices directly to the bunq app. Because they can't scan a QR code. /// [JsonProperty(PropertyName = "qr_code_token")] - public string QrCodeToken { get; private set; } - + public string QrCodeToken { get; set; } + /// /// The URL redirecting user to the tab payment in the bunq app. Only works on mobile devices. /// [JsonProperty(PropertyName = "tab_url")] - public string TabUrl { get; private set; } - + public string TabUrl { get; set; } + /// /// The visibility of a Tab. A Tab can be visible trough NearPay, the QR code of the CashRegister and its own QR /// code. /// [JsonProperty(PropertyName = "visibility")] - public TabVisibility Visibility { get; private set; } - + public TabVisibility Visibility { get; set; } + /// /// The minimum age of the user paying the Tab. /// [JsonProperty(PropertyName = "minimum_age")] - public bool? MinimumAge { get; private set; } - + public bool? MinimumAge { get; set; } + /// /// Whether or not an billing and shipping address must be provided when paying the Tab. /// [JsonProperty(PropertyName = "require_address")] - public string RequireAddress { get; private set; } - + public string RequireAddress { get; set; } + /// /// The URL which the user is sent to after paying the Tab. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - + public string RedirectUrl { get; set; } + /// /// The moment when this Tab expires. /// [JsonProperty(PropertyName = "expiration")] - public string Expiration { get; private set; } - + public string Expiration { get; set; } + /// /// The alias of the party that owns this tab. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The location of the cash register that created this tab. /// [JsonProperty(PropertyName = "cash_register_location")] - public Geolocation CashRegisterLocation { get; private set; } - + public Geolocation CashRegisterLocation { get; set; } + /// /// The tab items of this tab. /// [JsonProperty(PropertyName = "tab_item")] - public List TabItem { get; private set; } - + public List TabItem { get; set; } + /// /// An array of attachments that describe the tab. Viewable through the GET /// /tab/{tabid}/attachment/{attachmentid}/content endpoint. /// [JsonProperty(PropertyName = "tab_attachment")] - public List TabAttachment { get; private set; } - + public List TabAttachment { get; set; } + /// /// Create a TabUsageMultiple. On creation the status must be set to OPEN /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, IDictionary customHeaders = null) + /// The description of the TabUsageMultiple. Maximum 9000 characters. Field is required but can be an empty string. + /// The status of the TabUsageMultiple. On creation the status must be set to OPEN. You can change the status from OPEN to PAYABLE. If the TabUsageMultiple gets paid the status will remain PAYABLE. + /// The total amount of the Tab. Must be a positive amount. As long as the tab has the status OPEN you can change the total amount. This amount is not affected by the amounts of the TabItems. However, if you've created any TabItems for a Tab the sum of the amounts of these items must be equal to the total_amount of the Tab when you change its status to PAYABLE + /// [DEPRECATED] Whether or not a higher amount can be paid. + /// [DEPRECATED] Whether or not a lower amount can be paid. + /// [DEPRECATED] Whether or not the user paying the Tab should be asked if he wants to give a tip. When want_tip is set to true, allow_amount_higher must also be set to true and allow_amount_lower must be false. + /// The minimum age of the user paying the Tab. + /// Whether a billing and shipping address must be provided when paying the Tab. Possible values are: BILLING, SHIPPING, BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. + /// The URL which the user is sent to after paying the Tab. + /// The visibility of a Tab. A Tab can be visible trough NearPay, the QR code of the CashRegister and its own QR code. + /// The moment when this Tab expires. Can be at most 365 days into the future. + /// An array of attachments that describe the tab. Uploaded through the POST /user/{userid}/attachment-tab endpoint. + public static BunqResponse Create(int cashRegisterId, string description, string status, + Amount amountTotal, int? monetaryAccountId = null, bool? allowAmountHigher = null, + bool? allowAmountLower = null, bool? wantTip = null, int? minimumAge = null, string requireAddress = null, + string redirectUrl = null, TabVisibility visibility = null, string expiration = null, + List tabAttachment = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_DESCRIPTION, description}, + {FIELD_STATUS, status}, + {FIELD_AMOUNT_TOTAL, amountTotal}, + {FIELD_ALLOW_AMOUNT_HIGHER, allowAmountHigher}, + {FIELD_ALLOW_AMOUNT_LOWER, allowAmountLower}, + {FIELD_WANT_TIP, wantTip}, + {FIELD_MINIMUM_AGE, minimumAge}, + {FIELD_REQUIRE_ADDRESS, requireAddress}, + {FIELD_REDIRECT_URL, redirectUrl}, + {FIELD_VISIBILITY, visibility}, + {FIELD_EXPIRATION, expiration}, + {FIELD_TAB_ATTACHMENT, tabAttachment}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, cashRegisterId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId), requestBytes, customHeaders); + return ProcessForUuid(responseRaw); } - + /// /// Modify a specific TabUsageMultiple. You can change the amount_total, status and visibility. Once you change /// the status to PAYABLE the TabUsageMultiple will expire after a year (default). If you've created any /// TabItems for a Tab the sum of the amounts of these items must be equal to the total_amount of the Tab when /// you change its status to PAYABLE. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, string tabUsageMultipleUuid, IDictionary customHeaders = null) + /// The status of the TabUsageMultiple. On creation the status must be set to OPEN. You can change the status from OPEN to PAYABLE. If the TabUsageMultiple gets paid the status will remain PAYABLE. + /// The total amount of the Tab. Must be a positive amount. As long as the tab has the status OPEN you can change the total amount. This amount is not affected by the amounts of the TabItems. However, if you've created any TabItems for a Tab the sum of the amounts of these items must be equal to the total_amount of the Tab when you change its status to PAYABLE + /// The visibility of a Tab. A Tab can be visible trough NearPay, the QR code of the CashRegister and its own QR code. + /// The moment when this Tab expires. Can be at most 365 days into the future. + /// An array of attachments that describe the tab. Uploaded through the POST /user/{userid}/attachment-tab endpoint. + public static BunqResponse Update(int cashRegisterId, string tabUsageMultipleUuid, + int? monetaryAccountId = null, string status = null, Amount amountTotal = null, + TabVisibility visibility = null, string expiration = null, List tabAttachment = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_AMOUNT_TOTAL, amountTotal}, + {FIELD_VISIBILITY, visibility}, + {FIELD_EXPIRATION, expiration}, + {FIELD_TAB_ATTACHMENT, tabAttachment}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, cashRegisterId, tabUsageMultipleUuid), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUsageMultipleUuid), requestBytes, customHeaders); + return ProcessForUuid(responseRaw); } - + /// /// Close a specific TabUsageMultiple. /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUsageMultipleUuid, IDictionary customHeaders = null) + public static BunqResponse Delete(int cashRegisterId, string tabUsageMultipleUuid, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, cashRegisterId, tabUsageMultipleUuid), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUsageMultipleUuid), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - + /// /// Get a specific TabUsageMultiple. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUsageMultipleUuid, IDictionary customHeaders = null) + public static BunqResponse Get(int cashRegisterId, string tabUsageMultipleUuid, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId, tabUsageMultipleUuid), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUsageMultipleUuid), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a collection of TabUsageMultiple. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cashRegisterId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -236,90 +316,90 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.AmountTotal != null) { return false; } - + if (this.QrCodeToken != null) { return false; } - + if (this.TabUrl != null) { return false; } - + if (this.Visibility != null) { return false; } - + if (this.MinimumAge != null) { return false; } - + if (this.RequireAddress != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + if (this.Expiration != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CashRegisterLocation != null) { return false; } - + if (this.TabItem != null) { return false; } - + if (this.TabAttachment != null) { return false; } - + return true; } - + /// /// public static TabUsageMultiple CreateFromJsonString(string json) @@ -327,4 +407,4 @@ public static TabUsageMultiple CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TabUsageSingle.cs b/BunqSdk/Model/Generated/Endpoint/TabUsageSingle.cs index 01b0eb7..08cbf30 100644 --- a/BunqSdk/Model/Generated/Endpoint/TabUsageSingle.cs +++ b/BunqSdk/Model/Generated/Endpoint/TabUsageSingle.cs @@ -23,16 +23,25 @@ public class TabUsageSingle : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single"; - private const string ENDPOINT_URL_UPDATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single/{3}"; - private const string ENDPOINT_URL_DELETE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single/{3}"; - private const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single/{3}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single"; + + protected const string ENDPOINT_URL_UPDATE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single/{3}"; + + protected const string ENDPOINT_URL_DELETE = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single/{3}"; + + protected const string ENDPOINT_URL_READ = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single/{3}"; + + protected const string ENDPOINT_URL_LISTING = + "user/{0}/monetary-account/{1}/cash-register/{2}/tab-usage-single"; + /// /// Field constants. /// public const string FIELD_MERCHANT_REFERENCE = "merchant_reference"; + public const string FIELD_DESCRIPTION = "description"; public const string FIELD_STATUS = "status"; public const string FIELD_AMOUNT_TOTAL = "amount_total"; @@ -45,201 +54,274 @@ public class TabUsageSingle : BunqModel public const string FIELD_VISIBILITY = "visibility"; public const string FIELD_EXPIRATION = "expiration"; public const string FIELD_TAB_ATTACHMENT = "tab_attachment"; - + /// /// Object type. /// private const string OBJECT_TYPE_POST = "Uuid"; + private const string OBJECT_TYPE_PUT = "Uuid"; private const string OBJECT_TYPE_GET = "TabUsageSingle"; - + /// /// The uuid of the created TabUsageSingle. /// [JsonProperty(PropertyName = "uuid")] - public string Uuid { get; private set; } - + public string Uuid { get; set; } + /// /// The timestamp of the Tab's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the Tab's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The merchant reference of the Tab, as defined by the owner. /// [JsonProperty(PropertyName = "merchant_reference")] - public string MerchantReference { get; private set; } - + public string MerchantReference { get; set; } + /// /// The description of the TabUsageMultiple. Maximum 9000 characters. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The status of the Tab. Can be OPEN, WAITING_FOR_PAYMENT, PAID or CANCELED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The total amount of the Tab. /// [JsonProperty(PropertyName = "amount_total")] - public Amount AmountTotal { get; private set; } - + public Amount AmountTotal { get; set; } + /// /// The amount that has been paid for this Tab. /// [JsonProperty(PropertyName = "amount_paid")] - public Amount AmountPaid { get; private set; } - + public Amount AmountPaid { get; set; } + /// /// The token used to redirect mobile devices directly to the bunq app. Because they can't scan a QR code. /// [JsonProperty(PropertyName = "qr_code_token")] - public string QrCodeToken { get; private set; } - + public string QrCodeToken { get; set; } + /// /// The URL redirecting user to the tab payment in the bunq app. Only works on mobile devices. /// [JsonProperty(PropertyName = "tab_url")] - public string TabUrl { get; private set; } - + public string TabUrl { get; set; } + /// /// The visibility of a Tab. A Tab can be visible trough NearPay, the QR code of the CashRegister and its own QR /// code. /// [JsonProperty(PropertyName = "visibility")] - public TabVisibility Visibility { get; private set; } - + public TabVisibility Visibility { get; set; } + /// /// The minimum age of the user paying the Tab. /// [JsonProperty(PropertyName = "minimum_age")] - public bool? MinimumAge { get; private set; } - + public bool? MinimumAge { get; set; } + /// /// Whether or not an billing and shipping address must be provided when paying the Tab. /// [JsonProperty(PropertyName = "require_address")] - public string RequireAddress { get; private set; } - + public string RequireAddress { get; set; } + /// /// The URL which the user is sent to after paying the Tab. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - + public string RedirectUrl { get; set; } + /// /// The moment when this Tab expires. /// [JsonProperty(PropertyName = "expiration")] - public string Expiration { get; private set; } - + public string Expiration { get; set; } + /// /// The alias of the party that owns this tab. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The location of the cash register that created this tab. /// [JsonProperty(PropertyName = "cash_register_location")] - public Geolocation CashRegisterLocation { get; private set; } - + public Geolocation CashRegisterLocation { get; set; } + /// /// The tab items of this tab. /// [JsonProperty(PropertyName = "tab_item")] - public List TabItem { get; private set; } - + public List TabItem { get; set; } + /// /// An array of attachments that describe the tab. Uploaded through the POST /user/{userid}/attachment-tab /// endpoint. /// [JsonProperty(PropertyName = "tab_attachment")] - public List TabAttachment { get; private set; } - + public List TabAttachment { get; set; } + /// /// Create a TabUsageSingle. The initial status must be OPEN /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, IDictionary customHeaders = null) + /// The description of the Tab. Maximum 9000 characters. Field is required but can be an empty string. + /// The status of the Tab. On creation the status must be set to OPEN. You can change the status from OPEN to WAITING_FOR_PAYMENT. + /// The total amount of the Tab. Must be a positive amount. As long as the tab has the status OPEN you can change the total amount. This amount is not affected by the amounts of the TabItems. However, if you've created any TabItems for a Tab the sum of the amounts of these items must be equal to the total_amount of the Tab when you change its status to WAITING_FOR_PAYMENT. + /// The reference of the Tab, as defined by the owner. This reference will be set for any payment that is generated by this tab. Must be unique among all the owner's tabs for the used monetary account. + /// [DEPRECATED] Whether or not a higher amount can be paid. + /// [DEPRECATED] Whether or not a lower amount can be paid. + /// [DEPRECATED] Whether or not the user paying the Tab should be asked if he wants to give a tip. When want_tip is set to true, allow_amount_higher must also be set to true and allow_amount_lower must be false. + /// The minimum age of the user paying the Tab. + /// Whether a billing and shipping address must be provided when paying the Tab. Possible values are: BILLING, SHIPPING, BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. + /// The URL which the user is sent to after paying the Tab. + /// The visibility of a Tab. A Tab can be visible trough NearPay, the QR code of the CashRegister and its own QR code. + /// The moment when this Tab expires. Can be at most 1 hour into the future. + /// An array of attachments that describe the tab. Uploaded through the POST /user/{userid}/attachment-tab endpoint. + public static BunqResponse Create(int cashRegisterId, string description, string status, + Amount amountTotal, int? monetaryAccountId = null, string merchantReference = null, + bool? allowAmountHigher = null, bool? allowAmountLower = null, bool? wantTip = null, int? minimumAge = null, + string requireAddress = null, string redirectUrl = null, TabVisibility visibility = null, + string expiration = null, List tabAttachment = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_MERCHANT_REFERENCE, merchantReference}, + {FIELD_DESCRIPTION, description}, + {FIELD_STATUS, status}, + {FIELD_AMOUNT_TOTAL, amountTotal}, + {FIELD_ALLOW_AMOUNT_HIGHER, allowAmountHigher}, + {FIELD_ALLOW_AMOUNT_LOWER, allowAmountLower}, + {FIELD_WANT_TIP, wantTip}, + {FIELD_MINIMUM_AGE, minimumAge}, + {FIELD_REQUIRE_ADDRESS, requireAddress}, + {FIELD_REDIRECT_URL, redirectUrl}, + {FIELD_VISIBILITY, visibility}, + {FIELD_EXPIRATION, expiration}, + {FIELD_TAB_ATTACHMENT, tabAttachment}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, monetaryAccountId, cashRegisterId), requestBytes, customHeaders); - + var responseRaw = + apiClient.Post( + string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId), requestBytes, customHeaders); + return ProcessForUuid(responseRaw); } - + /// /// Modify a specific TabUsageSingle. You can change the amount_total, status and visibility. Once you change /// the status to WAITING_FOR_PAYMENT the TabUsageSingle will expire after 5 minutes (default) or up to 1 hour /// if a different expiration is provided. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userId, int monetaryAccountId, int cashRegisterId, string tabUsageSingleUuid, IDictionary customHeaders = null) + /// The status of the Tab. On creation the status must be set to OPEN. You can change the status from OPEN to WAITING_FOR_PAYMENT. + /// The total amount of the Tab. Must be a positive amount. As long as the tab has the status OPEN you can change the total amount. This amount is not affected by the amounts of the TabItems. However, if you've created any TabItems for a Tab the sum of the amounts of these items must be equal to the total_amount of the Tab when you change its status to WAITING_FOR_PAYMENT. + /// The visibility of a Tab. A Tab can be visible trough NearPay, the QR code of the CashRegister and its own QR code. + /// The moment when this Tab expires. Can be at most 1 hour into the future. + /// An array of attachments that describe the tab. Uploaded through the POST /user/{userid}/attachment-tab endpoint. + public static BunqResponse Update(int cashRegisterId, string tabUsageSingleUuid, + int? monetaryAccountId = null, string status = null, Amount amountTotal = null, + TabVisibility visibility = null, string expiration = null, List tabAttachment = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_STATUS, status}, + {FIELD_AMOUNT_TOTAL, amountTotal}, + {FIELD_VISIBILITY, visibility}, + {FIELD_EXPIRATION, expiration}, + {FIELD_TAB_ATTACHMENT, tabAttachment}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userId, monetaryAccountId, cashRegisterId, tabUsageSingleUuid), requestBytes, customHeaders); - + var responseRaw = + apiClient.Put( + string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUsageSingleUuid), requestBytes, customHeaders); + return ProcessForUuid(responseRaw); } - + /// /// Cancel a specific TabUsageSingle. /// - public static BunqResponse Delete(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUsageSingleUuid, IDictionary customHeaders = null) + public static BunqResponse Delete(int cashRegisterId, string tabUsageSingleUuid, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Delete(string.Format(ENDPOINT_URL_DELETE, userId, monetaryAccountId, cashRegisterId, tabUsageSingleUuid), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Delete( + string.Format(ENDPOINT_URL_DELETE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUsageSingleUuid), customHeaders); + return new BunqResponse(null, responseRaw.Headers); } - + /// /// Get a specific TabUsageSingle. /// - public static BunqResponse Get(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, string tabUsageSingleUuid, IDictionary customHeaders = null) + public static BunqResponse Get(int cashRegisterId, string tabUsageSingleUuid, + int? monetaryAccountId = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, monetaryAccountId, cashRegisterId, tabUsageSingleUuid), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), + cashRegisterId, tabUsageSingleUuid), new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Get a collection of TabUsageSingle. /// - public static BunqResponse> List(ApiContext apiContext, int userId, int monetaryAccountId, int cashRegisterId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(int cashRegisterId, int? monetaryAccountId = null, + IDictionary urlParams = null, IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, monetaryAccountId, cashRegisterId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get( + string.Format(ENDPOINT_URL_LISTING, DetermineUserId(), + DetermineMonetaryAccountId(monetaryAccountId), cashRegisterId), urlParams, customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -248,100 +330,100 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.MerchantReference != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.AmountTotal != null) { return false; } - + if (this.AmountPaid != null) { return false; } - + if (this.QrCodeToken != null) { return false; } - + if (this.TabUrl != null) { return false; } - + if (this.Visibility != null) { return false; } - + if (this.MinimumAge != null) { return false; } - + if (this.RequireAddress != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + if (this.Expiration != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CashRegisterLocation != null) { return false; } - + if (this.TabItem != null) { return false; } - + if (this.TabAttachment != null) { return false; } - + return true; } - + /// /// public static TabUsageSingle CreateFromJsonString(string json) @@ -349,4 +431,4 @@ public static TabUsageSingle CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs b/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs index a2f0489..14e9eb7 100644 --- a/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs +++ b/BunqSdk/Model/Generated/Endpoint/TokenQrRequestIdeal.cs @@ -22,161 +22,170 @@ public class TokenQrRequestIdeal : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/token-qr-request-ideal"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/token-qr-request-ideal"; + /// /// Field constants. /// public const string FIELD_TOKEN = "token"; - + /// /// Object type. /// private const string OBJECT_TYPE_POST = "RequestResponse"; - + /// /// The id of the RequestResponse. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of when the RequestResponse was responded to. /// [JsonProperty(PropertyName = "time_responded")] - public string TimeResponded { get; private set; } - + public string TimeResponded { get; set; } + /// /// The timestamp of when the RequestResponse expired or will expire. /// [JsonProperty(PropertyName = "time_expiry")] - public string TimeExpiry { get; private set; } - + public string TimeExpiry { get; set; } + /// /// The id of the MonetaryAccount the RequestResponse was received on. /// [JsonProperty(PropertyName = "monetary_account_id")] - public int? MonetaryAccountId { get; private set; } - + public int? MonetaryAccountId { get; set; } + /// /// The requested Amount. /// [JsonProperty(PropertyName = "amount_inquired")] - public Amount AmountInquired { get; private set; } - + public Amount AmountInquired { get; set; } + /// /// The Amount the RequestResponse was accepted with. /// [JsonProperty(PropertyName = "amount_responded")] - public Amount AmountResponded { get; private set; } - + public Amount AmountResponded { get; set; } + /// /// The LabelMonetaryAccount with the public information of the MonetaryAccount this RequestResponse was /// received on. /// [JsonProperty(PropertyName = "alias")] - public MonetaryAccountReference Alias { get; private set; } - + public MonetaryAccountReference Alias { get; set; } + /// /// The LabelMonetaryAccount with the public information of the MonetaryAccount that is requesting money with /// this RequestResponse. /// [JsonProperty(PropertyName = "counterparty_alias")] - public MonetaryAccountReference CounterpartyAlias { get; private set; } - + public MonetaryAccountReference CounterpartyAlias { get; set; } + /// /// The description for the RequestResponse provided by the requesting party. Maximum 9000 characters. /// [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + public string Description { get; set; } + /// /// The Attachments attached to the RequestResponse. /// [JsonProperty(PropertyName = "attachment")] - public List Attachment { get; private set; } - + public List Attachment { get; set; } + /// /// The status of the created RequestResponse. Can only be PENDING. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The minimum age the user accepting the RequestResponse must have. /// [JsonProperty(PropertyName = "minimum_age")] - public int? MinimumAge { get; private set; } - + public int? MinimumAge { get; set; } + /// /// Whether or not an address must be provided on accept. /// [JsonProperty(PropertyName = "require_address")] - public string RequireAddress { get; private set; } - + public string RequireAddress { get; set; } + /// /// The shipping address provided by the accepting user if an address was requested. /// [JsonProperty(PropertyName = "address_shipping")] - public Address AddressShipping { get; private set; } - + public Address AddressShipping { get; set; } + /// /// The billing address provided by the accepting user if an address was requested. /// [JsonProperty(PropertyName = "address_billing")] - public Address AddressBilling { get; private set; } - + public Address AddressBilling { get; set; } + /// /// The Geolocation where the RequestResponse was created. /// [JsonProperty(PropertyName = "geolocation")] - public Geolocation Geolocation { get; private set; } - + public Geolocation Geolocation { get; set; } + /// /// The URL which the user is sent to after accepting or rejecting the Request. /// [JsonProperty(PropertyName = "redirect_url")] - public string RedirectUrl { get; private set; } - + public string RedirectUrl { get; set; } + /// /// The type of the RequestResponse. Can be only be IDEAL. /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + public string Type { get; set; } + /// /// The subtype of the RequestResponse. Can be only be NONE. /// [JsonProperty(PropertyName = "sub_type")] - public string SubType { get; private set; } - + public string SubType { get; set; } + /// /// Whether or not chat messages are allowed. /// [JsonProperty(PropertyName = "allow_chat")] - public bool? AllowChat { get; private set; } - + public bool? AllowChat { get; set; } + /// /// The whitelist id for this action or null. /// [JsonProperty(PropertyName = "eligible_whitelist_id")] - public int? EligibleWhitelistId { get; private set; } - + public int? EligibleWhitelistId { get; set; } + /// /// Create a request from an ideal transaction. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The token passed from a site or read from a QR code. + public static BunqResponse Create(string token, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_TOKEN, token}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_POST); } - - + + /// /// public override bool IsAllFieldNull() @@ -185,110 +194,110 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TimeResponded != null) { return false; } - + if (this.TimeExpiry != null) { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + if (this.AmountInquired != null) { return false; } - + if (this.AmountResponded != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Attachment != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.MinimumAge != null) { return false; } - + if (this.RequireAddress != null) { return false; } - + if (this.AddressShipping != null) { return false; } - + if (this.AddressBilling != null) { return false; } - + if (this.Geolocation != null) { return false; } - + if (this.RedirectUrl != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.SubType != null) { return false; } - + if (this.AllowChat != null) { return false; } - + if (this.EligibleWhitelistId != null) { return false; } - + return true; } - + /// /// public static TokenQrRequestIdeal CreateFromJsonString(string json) @@ -296,4 +305,4 @@ public static TokenQrRequestIdeal CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/TokenQrRequestSofort.cs b/BunqSdk/Model/Generated/Endpoint/TokenQrRequestSofort.cs index 03769bf..b91e866 100644 --- a/BunqSdk/Model/Generated/Endpoint/TokenQrRequestSofort.cs +++ b/BunqSdk/Model/Generated/Endpoint/TokenQrRequestSofort.cs @@ -17,40 +17,49 @@ public class TokenQrRequestSofort : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_CREATE = "user/{0}/token-qr-request-sofort"; - + protected const string ENDPOINT_URL_CREATE = "user/{0}/token-qr-request-sofort"; + /// /// Field constants. /// public const string FIELD_TOKEN = "token"; - + /// /// Object type. /// private const string OBJECT_TYPE_POST = "RequestResponse"; - + /// /// Create a request from an SOFORT transaction. /// - public static BunqResponse Create(ApiContext apiContext, IDictionary requestMap, int userId, IDictionary customHeaders = null) + /// The token passed from a site or read from a QR code. + public static BunqResponse Create(string token, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_TOKEN, token}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); - + var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, DetermineUserId()), requestBytes, + customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_POST); } - - + + /// /// public override bool IsAllFieldNull() { return true; } - + /// /// public static TokenQrRequestSofort CreateFromJsonString(string json) @@ -58,4 +67,4 @@ public static TokenQrRequestSofort CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/User.cs b/BunqSdk/Model/Generated/Endpoint/User.cs index accd0ec..3b1cae8 100644 --- a/BunqSdk/Model/Generated/Endpoint/User.cs +++ b/BunqSdk/Model/Generated/Endpoint/User.cs @@ -20,61 +20,64 @@ public class User : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - + /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}"; - private const string ENDPOINT_URL_LISTING = "user"; - + protected const string ENDPOINT_URL_READ = "user/{0}"; + + protected const string ENDPOINT_URL_LISTING = "user"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "User"; - + /// /// [JsonProperty(PropertyName = "UserLight")] - public UserLight UserLight { get; private set; } - + public UserLight UserLight { get; set; } + /// /// [JsonProperty(PropertyName = "UserPerson")] - public UserPerson UserPerson { get; private set; } - + public UserPerson UserPerson { get; set; } + /// /// [JsonProperty(PropertyName = "UserCompany")] - public UserCompany UserCompany { get; private set; } - + public UserCompany UserCompany { get; set; } + /// /// Get a specific user. /// - public static BunqResponse Get(ApiContext apiContext, int userId, IDictionary customHeaders = null) + public static BunqResponse Get(IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId()), + new Dictionary(), customHeaders); + return FromJson(responseRaw); } - + /// /// Get a collection of all available users. /// - public static BunqResponse> List(ApiContext apiContext, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); var responseRaw = apiClient.Get(ENDPOINT_URL_LISTING, urlParams, customHeaders); - + return FromJsonList(responseRaw); } - - + + /// /// public BunqModel GetReferencedObject() @@ -83,20 +86,20 @@ public BunqModel GetReferencedObject() { return this.UserLight; } - + if (this.UserPerson != null) { return this.UserPerson; } - + if (this.UserCompany != null) { return this.UserCompany; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -105,20 +108,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.UserPerson != null) { return false; } - + if (this.UserCompany != null) { return false; } - + return true; } - + /// /// public static User CreateFromJsonString(string json) @@ -126,4 +129,4 @@ public static User CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/UserCompany.cs b/BunqSdk/Model/Generated/Endpoint/UserCompany.cs index 2935ef9..223f7df 100644 --- a/BunqSdk/Model/Generated/Endpoint/UserCompany.cs +++ b/BunqSdk/Model/Generated/Endpoint/UserCompany.cs @@ -20,13 +20,15 @@ public class UserCompany : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user-company/{0}"; - private const string ENDPOINT_URL_UPDATE = "user-company/{0}"; - + protected const string ENDPOINT_URL_READ = "user-company/{0}"; + + protected const string ENDPOINT_URL_UPDATE = "user-company/{0}"; + /// /// Field constants. /// public const string FIELD_NAME = "name"; + public const string FIELD_PUBLIC_NICK_NAME = "public_nick_name"; public const string FIELD_AVATAR_UUID = "avatar_uuid"; public const string FIELD_ADDRESS_MAIN = "address_main"; @@ -40,231 +42,272 @@ public class UserCompany : BunqModel public const string FIELD_SUB_STATUS = "sub_status"; public const string FIELD_SESSION_TIMEOUT = "session_timeout"; public const string FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login"; - public const string FIELD_COUNTER_BANK_IBAN = "counter_bank_iban"; public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "UserCompany"; - + /// /// The id of the modified company. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the company object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the company object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The company's public UUID. /// [JsonProperty(PropertyName = "public_uuid")] - public string PublicUuid { get; private set; } - + public string PublicUuid { get; set; } + /// /// The company name. /// [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - + public string Name { get; set; } + /// /// The company's display name. /// [JsonProperty(PropertyName = "display_name")] - public string DisplayName { get; private set; } - + public string DisplayName { get; set; } + /// /// The company's public nick name. /// [JsonProperty(PropertyName = "public_nick_name")] - public string PublicNickName { get; private set; } - + public string PublicNickName { get; set; } + /// /// The aliases of the account. /// [JsonProperty(PropertyName = "alias")] - public List Alias { get; private set; } - + public List Alias { get; set; } + /// /// The company's chamber of commerce number. /// [JsonProperty(PropertyName = "chamber_of_commerce_number")] - public string ChamberOfCommerceNumber { get; private set; } - + public string ChamberOfCommerceNumber { get; set; } + /// /// The type of business entity. /// [JsonProperty(PropertyName = "type_of_business_entity")] - public string TypeOfBusinessEntity { get; private set; } - + public string TypeOfBusinessEntity { get; set; } + /// /// The sector of industry. /// [JsonProperty(PropertyName = "sector_of_industry")] - public string SectorOfIndustry { get; private set; } - + public string SectorOfIndustry { get; set; } + /// /// The company's other bank account IBAN, through which we verify it. /// [JsonProperty(PropertyName = "counter_bank_iban")] - public string CounterBankIban { get; private set; } - + public string CounterBankIban { get; set; } + /// /// The company's avatar. /// [JsonProperty(PropertyName = "avatar")] - public Avatar Avatar { get; private set; } - + public Avatar Avatar { get; set; } + /// /// The company's main address. /// [JsonProperty(PropertyName = "address_main")] - public Address AddressMain { get; private set; } - + public Address AddressMain { get; set; } + /// /// The company's postal address. /// [JsonProperty(PropertyName = "address_postal")] - public Address AddressPostal { get; private set; } - + public Address AddressPostal { get; set; } + /// /// The version of the terms of service accepted by the user. /// [JsonProperty(PropertyName = "version_terms_of_service")] - public string VersionTermsOfService { get; private set; } - + public string VersionTermsOfService { get; set; } + /// /// The existing bunq user alias for the company's director. /// [JsonProperty(PropertyName = "director_alias")] - public LabelUser DirectorAlias { get; private set; } - + public LabelUser DirectorAlias { get; set; } + /// /// The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country /// code, seperated by an underscore. /// [JsonProperty(PropertyName = "language")] - public string Language { get; private set; } - + public string Language { get; set; } + /// /// The country as an ISO 3166-1 alpha-2 country code.. /// [JsonProperty(PropertyName = "country")] - public string Country { get; private set; } - + public string Country { get; set; } + /// /// The person's preferred region. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country /// code, seperated by an underscore. /// [JsonProperty(PropertyName = "region")] - public string Region { get; private set; } - + public string Region { get; set; } + /// /// The names of the company's ultimate beneficiary owners. Minimum zero, maximum four. /// [JsonProperty(PropertyName = "ubo")] - public List Ubo { get; private set; } - + public List Ubo { get; set; } + /// /// The user status. Can be: ACTIVE, SIGNUP, RECOVERY. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, APPROVAL_DIRECTOR, APPROVAL_PARENT, /// APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or SUBMIT. /// [JsonProperty(PropertyName = "sub_status")] - public string SubStatus { get; private set; } - + public string SubStatus { get; set; } + /// /// The setting for the session timeout of the company in seconds. /// [JsonProperty(PropertyName = "session_timeout")] - public int? SessionTimeout { get; private set; } - + public int? SessionTimeout { get; set; } + /// /// Card ids used for centralized card limits. /// [JsonProperty(PropertyName = "card_ids")] - public List CardIds { get; private set; } - + public List CardIds { get; set; } + /// /// The centralized limits for user's cards. /// [JsonProperty(PropertyName = "card_limits")] - public List CardLimits { get; private set; } - + public List CardLimits { get; set; } + /// /// The amount the company can pay in the session without asking for credentials. /// [JsonProperty(PropertyName = "daily_limit_without_confirmation_login")] - public Amount DailyLimitWithoutConfirmationLogin { get; private set; } - + public Amount DailyLimitWithoutConfirmationLogin { get; set; } + /// /// The types of notifications that will result in a push notification or URL callback for this UserCompany. /// [JsonProperty(PropertyName = "notification_filters")] - public List NotificationFilters { get; private set; } - + public List NotificationFilters { get; set; } + /// /// The customer profile of the company. /// [JsonProperty(PropertyName = "customer")] - public Customer Customer { get; private set; } - + public Customer Customer { get; set; } + /// /// The customer limits of the company. /// [JsonProperty(PropertyName = "customer_limit")] - public CustomerLimit CustomerLimit { get; private set; } - + public CustomerLimit CustomerLimit { get; set; } + /// /// The subscription of the company. /// [JsonProperty(PropertyName = "billing_contract")] - public List BillingContract { get; private set; } - + public List BillingContract { get; set; } + /// /// Get a specific company. /// - public static BunqResponse Get(ApiContext apiContext, int userCompanyId, IDictionary customHeaders = null) + public static BunqResponse Get(IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userCompanyId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId()), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Modify a specific company's data. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userCompanyId, IDictionary customHeaders = null) + /// The company name. + /// The company's nick name. + /// The public UUID of the company's avatar. + /// The user's main address. + /// The company's postal address. + /// The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. + /// The person's preferred region. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. + /// The country where the company is registered. + /// The names and birth dates of the company's ultimate beneficiary owners. Minimum zero, maximum four. + /// The company's chamber of commerce number. + /// The user status. Can be: ACTIVE, SIGNUP, RECOVERY. + /// The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or SUBMIT. + /// The setting for the session timeout of the company in seconds. + /// The amount the company can pay in the session without asking for credentials. + /// The types of notifications that will result in a push notification or URL callback for this UserCompany. + public static BunqResponse Update(string name = null, string publicNickName = null, + string avatarUuid = null, Address addressMain = null, Address addressPostal = null, string language = null, + string region = null, string country = null, List ubo = null, string chamberOfCommerceNumber = null, + string status = null, string subStatus = null, int? sessionTimeout = null, + Amount dailyLimitWithoutConfirmationLogin = null, List notificationFilters = null, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_NAME, name}, + {FIELD_PUBLIC_NICK_NAME, publicNickName}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_ADDRESS_MAIN, addressMain}, + {FIELD_ADDRESS_POSTAL, addressPostal}, + {FIELD_LANGUAGE, language}, + {FIELD_REGION, region}, + {FIELD_COUNTRY, country}, + {FIELD_UBO, ubo}, + {FIELD_CHAMBER_OF_COMMERCE_NUMBER, chamberOfCommerceNumber}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_SESSION_TIMEOUT, sessionTimeout}, + {FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN, dailyLimitWithoutConfirmationLogin}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userCompanyId), requestBytes, customHeaders); - + var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -273,160 +316,160 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.PublicUuid != null) { return false; } - + if (this.Name != null) { return false; } - + if (this.DisplayName != null) { return false; } - + if (this.PublicNickName != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.ChamberOfCommerceNumber != null) { return false; } - + if (this.TypeOfBusinessEntity != null) { return false; } - + if (this.SectorOfIndustry != null) { return false; } - + if (this.CounterBankIban != null) { return false; } - + if (this.Avatar != null) { return false; } - + if (this.AddressMain != null) { return false; } - + if (this.AddressPostal != null) { return false; } - + if (this.VersionTermsOfService != null) { return false; } - + if (this.DirectorAlias != null) { return false; } - + if (this.Language != null) { return false; } - + if (this.Country != null) { return false; } - + if (this.Region != null) { return false; } - + if (this.Ubo != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.SubStatus != null) { return false; } - + if (this.SessionTimeout != null) { return false; } - + if (this.CardIds != null) { return false; } - + if (this.CardLimits != null) { return false; } - + if (this.DailyLimitWithoutConfirmationLogin != null) { return false; } - + if (this.NotificationFilters != null) { return false; } - + if (this.Customer != null) { return false; } - + if (this.CustomerLimit != null) { return false; } - + if (this.BillingContract != null) { return false; } - + return true; } - + /// /// public static UserCompany CreateFromJsonString(string json) @@ -434,4 +477,4 @@ public static UserCompany CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/UserCredentialPasswordIp.cs b/BunqSdk/Model/Generated/Endpoint/UserCredentialPasswordIp.cs index a18fd86..3d0346a 100644 --- a/BunqSdk/Model/Generated/Endpoint/UserCredentialPasswordIp.cs +++ b/BunqSdk/Model/Generated/Endpoint/UserCredentialPasswordIp.cs @@ -20,82 +20,88 @@ public class UserCredentialPasswordIp : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user/{0}/credential-password-ip/{1}"; - private const string ENDPOINT_URL_LISTING = "user/{0}/credential-password-ip"; - + protected const string ENDPOINT_URL_READ = "user/{0}/credential-password-ip/{1}"; + + protected const string ENDPOINT_URL_LISTING = "user/{0}/credential-password-ip"; + /// /// Object type. /// private const string OBJECT_TYPE_GET = "CredentialPasswordIp"; - + /// /// The id of the credential. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the credential object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the credential object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The status of the credential. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// When the status is PENDING_FIRST_USE: when the credential expires. /// [JsonProperty(PropertyName = "expiry_time")] - public string ExpiryTime { get; private set; } - + public string ExpiryTime { get; set; } + /// /// When the status is PENDING_FIRST_USE: the value of the token. /// [JsonProperty(PropertyName = "token_value")] - public string TokenValue { get; private set; } - + public string TokenValue { get; set; } + /// /// When the status is ACTIVE: the details of the device that may use the credential. /// [JsonProperty(PropertyName = "permitted_device")] - public PermittedDevice PermittedDevice { get; private set; } - + public PermittedDevice PermittedDevice { get; set; } + /// /// - public static BunqResponse Get(ApiContext apiContext, int userId, int userCredentialPasswordIpId, IDictionary customHeaders = null) + public static BunqResponse Get(int userCredentialPasswordIpId, + IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, userCredentialPasswordIpId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = + apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), userCredentialPasswordIpId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// - public static BunqResponse> List(ApiContext apiContext, int userId, IDictionary urlParams = null, IDictionary customHeaders = null) + public static BunqResponse> List(IDictionary urlParams = null, + IDictionary customHeaders = null) { if (urlParams == null) urlParams = new Dictionary(); if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId), urlParams, customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, DetermineUserId()), urlParams, + customHeaders); + return FromJsonList(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -104,40 +110,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.ExpiryTime != null) { return false; } - + if (this.TokenValue != null) { return false; } - + if (this.PermittedDevice != null) { return false; } - + return true; } - + /// /// public static UserCredentialPasswordIp CreateFromJsonString(string json) @@ -145,4 +151,4 @@ public static UserCredentialPasswordIp CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/UserLight.cs b/BunqSdk/Model/Generated/Endpoint/UserLight.cs index 4c04e8e..8fe9174 100644 --- a/BunqSdk/Model/Generated/Endpoint/UserLight.cs +++ b/BunqSdk/Model/Generated/Endpoint/UserLight.cs @@ -18,16 +18,16 @@ public class UserLight : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user-light/{0}"; - + protected const string ENDPOINT_URL_READ = "user-light/{0}"; + /// /// Field constants. /// public const string FIELD_FIRST_NAME = "first_name"; + public const string FIELD_MIDDLE_NAME = "middle_name"; public const string FIELD_LAST_NAME = "last_name"; public const string FIELD_PUBLIC_NICK_NAME = "public_nick_name"; - public const string FIELD_COUNTER_BANK_IBAN = "counter_bank_iban"; public const string FIELD_ADDRESS_MAIN = "address_main"; public const string FIELD_ADDRESS_POSTAL = "address_postal"; public const string FIELD_AVATAR_UUID = "avatar_uuid"; @@ -51,221 +51,222 @@ public class UserLight : BunqModel public const string FIELD_SESSION_TIMEOUT = "session_timeout"; public const string FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login"; public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "UserPerson"; - + /// /// The id of the user. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the user object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the user object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The user's public UUID. /// [JsonProperty(PropertyName = "public_uuid")] - public string PublicUuid { get; private set; } - + public string PublicUuid { get; set; } + /// /// The user's first name. /// [JsonProperty(PropertyName = "first_name")] - public string FirstName { get; private set; } - + public string FirstName { get; set; } + /// /// The user's middle name. /// [JsonProperty(PropertyName = "middle_name")] - public string MiddleName { get; private set; } - + public string MiddleName { get; set; } + /// /// The user's last name. /// [JsonProperty(PropertyName = "last_name")] - public string LastName { get; private set; } - + public string LastName { get; set; } + /// /// The user's legal name. /// [JsonProperty(PropertyName = "legal_name")] - public string LegalName { get; private set; } - + public string LegalName { get; set; } + /// /// The display name for the user. /// [JsonProperty(PropertyName = "display_name")] - public string DisplayName { get; private set; } - + public string DisplayName { get; set; } + /// /// The public nick name for the user. /// [JsonProperty(PropertyName = "public_nick_name")] - public string PublicNickName { get; private set; } - + public string PublicNickName { get; set; } + /// /// The aliases of the user. /// [JsonProperty(PropertyName = "alias")] - public List Alias { get; private set; } - + public List Alias { get; set; } + /// /// The user's social security number. /// [JsonProperty(PropertyName = "social_security_number")] - public string SocialSecurityNumber { get; private set; } - + public string SocialSecurityNumber { get; set; } + /// /// The user's tax residence numbers for different countries. /// [JsonProperty(PropertyName = "tax_resident")] - public List TaxResident { get; private set; } - + public List TaxResident { get; set; } + /// /// The type of identification document the user registered with. /// [JsonProperty(PropertyName = "document_type")] - public string DocumentType { get; private set; } - + public string DocumentType { get; set; } + /// /// The identification document number the user registered with. /// [JsonProperty(PropertyName = "document_number")] - public string DocumentNumber { get; private set; } - + public string DocumentNumber { get; set; } + /// /// The country which issued the identification document the user registered with. /// [JsonProperty(PropertyName = "document_country_of_issuance")] - public string DocumentCountryOfIssuance { get; private set; } - + public string DocumentCountryOfIssuance { get; set; } + /// /// The user's main address. /// [JsonProperty(PropertyName = "address_main")] - public Address AddressMain { get; private set; } - + public Address AddressMain { get; set; } + /// /// The user's postal address. /// [JsonProperty(PropertyName = "address_postal")] - public Address AddressPostal { get; private set; } - + public Address AddressPostal { get; set; } + /// /// The user's date of birth. Accepts ISO8601 date formats. /// [JsonProperty(PropertyName = "date_of_birth")] - public string DateOfBirth { get; private set; } - + public string DateOfBirth { get; set; } + /// /// The user's place of birth. /// [JsonProperty(PropertyName = "place_of_birth")] - public string PlaceOfBirth { get; private set; } - + public string PlaceOfBirth { get; set; } + /// /// The user's country of birth. Formatted as a SO 3166-1 alpha-2 country code. /// [JsonProperty(PropertyName = "country_of_birth")] - public string CountryOfBirth { get; private set; } - + public string CountryOfBirth { get; set; } + /// /// The user's nationality. Formatted as a SO 3166-1 alpha-2 country code. /// [JsonProperty(PropertyName = "nationality")] - public string Nationality { get; private set; } - + public string Nationality { get; set; } + /// /// The user's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country /// code, seperated by an underscore. /// [JsonProperty(PropertyName = "language")] - public string Language { get; private set; } - + public string Language { get; set; } + /// /// The user's preferred region. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, /// seperated by an underscore. /// [JsonProperty(PropertyName = "region")] - public string Region { get; private set; } - + public string Region { get; set; } + /// /// The user's gender. Can be MALE, FEMALE or UNKNOWN. /// [JsonProperty(PropertyName = "gender")] - public string Gender { get; private set; } - + public string Gender { get; set; } + /// /// The user's avatar. /// [JsonProperty(PropertyName = "avatar")] - public Avatar Avatar { get; private set; } - + public Avatar Avatar { get; set; } + /// /// The version of the terms of service accepted by the user. /// [JsonProperty(PropertyName = "version_terms_of_service")] - public string VersionTermsOfService { get; private set; } - + public string VersionTermsOfService { get; set; } + /// /// The user status. The user status. Can be: ACTIVE, BLOCKED, SIGNUP, DENIED or ABORTED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, APPROVAL_PARENT, AWAITING_PARENT, APPROVAL_SUPPORT, /// COUNTER_IBAN, IDEAL or SUBMIT. /// [JsonProperty(PropertyName = "sub_status")] - public string SubStatus { get; private set; } - + public string SubStatus { get; set; } + /// /// The setting for the session timeout of the user in seconds. /// [JsonProperty(PropertyName = "session_timeout")] - public int? SessionTimeout { get; private set; } - + public int? SessionTimeout { get; set; } + /// /// The amount the user can pay in the session without asking for credentials. /// [JsonProperty(PropertyName = "daily_limit_without_confirmation_login")] - public Amount DailyLimitWithoutConfirmationLogin { get; private set; } - + public Amount DailyLimitWithoutConfirmationLogin { get; set; } + /// /// The types of notifications that will result in a push notification or URL callback for this UserLight. /// [JsonProperty(PropertyName = "notification_filters")] - public List NotificationFilters { get; private set; } - + public List NotificationFilters { get; set; } + /// /// Get a specific bunq light user. /// - public static BunqResponse Get(ApiContext apiContext, int userLightId, IDictionary customHeaders = null) + public static BunqResponse Get(int userLightId, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userLightId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userLightId), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - - + + /// /// public override bool IsAllFieldNull() @@ -274,165 +275,165 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.PublicUuid != null) { return false; } - + if (this.FirstName != null) { return false; } - + if (this.MiddleName != null) { return false; } - + if (this.LastName != null) { return false; } - + if (this.LegalName != null) { return false; } - + if (this.DisplayName != null) { return false; } - + if (this.PublicNickName != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.SocialSecurityNumber != null) { return false; } - + if (this.TaxResident != null) { return false; } - + if (this.DocumentType != null) { return false; } - + if (this.DocumentNumber != null) { return false; } - + if (this.DocumentCountryOfIssuance != null) { return false; } - + if (this.AddressMain != null) { return false; } - + if (this.AddressPostal != null) { return false; } - + if (this.DateOfBirth != null) { return false; } - + if (this.PlaceOfBirth != null) { return false; } - + if (this.CountryOfBirth != null) { return false; } - + if (this.Nationality != null) { return false; } - + if (this.Language != null) { return false; } - + if (this.Region != null) { return false; } - + if (this.Gender != null) { return false; } - + if (this.Avatar != null) { return false; } - + if (this.VersionTermsOfService != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.SubStatus != null) { return false; } - + if (this.SessionTimeout != null) { return false; } - + if (this.DailyLimitWithoutConfirmationLogin != null) { return false; } - + if (this.NotificationFilters != null) { return false; } - + return true; } - + /// /// public static UserLight CreateFromJsonString(string json) @@ -440,4 +441,4 @@ public static UserLight CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/UserPerson.cs b/BunqSdk/Model/Generated/Endpoint/UserPerson.cs index b93212e..63e3789 100644 --- a/BunqSdk/Model/Generated/Endpoint/UserPerson.cs +++ b/BunqSdk/Model/Generated/Endpoint/UserPerson.cs @@ -20,13 +20,15 @@ public class UserPerson : BunqModel /// /// Endpoint constants. /// - private const string ENDPOINT_URL_READ = "user-person/{0}"; - private const string ENDPOINT_URL_UPDATE = "user-person/{0}"; - + protected const string ENDPOINT_URL_READ = "user-person/{0}"; + + protected const string ENDPOINT_URL_UPDATE = "user-person/{0}"; + /// /// Field constants. /// public const string FIELD_FIRST_NAME = "first_name"; + public const string FIELD_MIDDLE_NAME = "middle_name"; public const string FIELD_LAST_NAME = "last_name"; public const string FIELD_PUBLIC_NICK_NAME = "public_nick_name"; @@ -53,231 +55,302 @@ public class UserPerson : BunqModel public const string FIELD_CARD_IDS = "card_ids"; public const string FIELD_CARD_LIMITS = "card_limits"; public const string FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login"; - public const string FIELD_COUNTER_BANK_IBAN = "counter_bank_iban"; public const string FIELD_NOTIFICATION_FILTERS = "notification_filters"; - + /// /// Object type. /// private const string OBJECT_TYPE_GET = "UserPerson"; - + /// /// The id of the modified person object. /// [JsonProperty(PropertyName = "id")] - public int? Id { get; private set; } - + public int? Id { get; set; } + /// /// The timestamp of the person object's creation. /// [JsonProperty(PropertyName = "created")] - public string Created { get; private set; } - + public string Created { get; set; } + /// /// The timestamp of the person object's last update. /// [JsonProperty(PropertyName = "updated")] - public string Updated { get; private set; } - + public string Updated { get; set; } + /// /// The person's public UUID. /// [JsonProperty(PropertyName = "public_uuid")] - public string PublicUuid { get; private set; } - + public string PublicUuid { get; set; } + /// /// The person's first name. /// [JsonProperty(PropertyName = "first_name")] - public string FirstName { get; private set; } - + public string FirstName { get; set; } + /// /// The person's middle name. /// [JsonProperty(PropertyName = "middle_name")] - public string MiddleName { get; private set; } - + public string MiddleName { get; set; } + /// /// The person's last name. /// [JsonProperty(PropertyName = "last_name")] - public string LastName { get; private set; } - + public string LastName { get; set; } + /// /// The person's legal name. /// [JsonProperty(PropertyName = "legal_name")] - public string LegalName { get; private set; } - + public string LegalName { get; set; } + /// /// The display name for the person. /// [JsonProperty(PropertyName = "display_name")] - public string DisplayName { get; private set; } - + public string DisplayName { get; set; } + /// /// The public nick name for the person. /// [JsonProperty(PropertyName = "public_nick_name")] - public string PublicNickName { get; private set; } - + public string PublicNickName { get; set; } + /// /// The aliases of the user. /// [JsonProperty(PropertyName = "alias")] - public List Alias { get; private set; } - + public List Alias { get; set; } + /// /// The user's tax residence numbers for different countries. /// [JsonProperty(PropertyName = "tax_resident")] - public List TaxResident { get; private set; } - + public List TaxResident { get; set; } + /// /// The type of identification document the person registered with. /// [JsonProperty(PropertyName = "document_type")] - public string DocumentType { get; private set; } - + public string DocumentType { get; set; } + /// /// The identification document number the person registered with. /// [JsonProperty(PropertyName = "document_number")] - public string DocumentNumber { get; private set; } - + public string DocumentNumber { get; set; } + /// /// The country which issued the identification document the person registered with. /// [JsonProperty(PropertyName = "document_country_of_issuance")] - public string DocumentCountryOfIssuance { get; private set; } - + public string DocumentCountryOfIssuance { get; set; } + /// /// The person's main address. /// [JsonProperty(PropertyName = "address_main")] - public Address AddressMain { get; private set; } - + public Address AddressMain { get; set; } + /// /// The person's postal address. /// [JsonProperty(PropertyName = "address_postal")] - public Address AddressPostal { get; private set; } - + public Address AddressPostal { get; set; } + /// /// The person's date of birth. Accepts ISO8601 date formats. /// [JsonProperty(PropertyName = "date_of_birth")] - public string DateOfBirth { get; private set; } - + public string DateOfBirth { get; set; } + /// /// The person's place of birth. /// [JsonProperty(PropertyName = "place_of_birth")] - public string PlaceOfBirth { get; private set; } - + public string PlaceOfBirth { get; set; } + /// /// The person's country of birth. Formatted as a SO 3166-1 alpha-2 country code. /// [JsonProperty(PropertyName = "country_of_birth")] - public string CountryOfBirth { get; private set; } - + public string CountryOfBirth { get; set; } + /// /// The person's nationality. Formatted as a SO 3166-1 alpha-2 country code. /// [JsonProperty(PropertyName = "nationality")] - public string Nationality { get; private set; } - + public string Nationality { get; set; } + /// /// The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country /// code, seperated by an underscore. /// [JsonProperty(PropertyName = "language")] - public string Language { get; private set; } - + public string Language { get; set; } + /// /// The person's preferred region. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country /// code, seperated by an underscore. /// [JsonProperty(PropertyName = "region")] - public string Region { get; private set; } - + public string Region { get; set; } + /// /// The person's gender. Can be MALE, FEMALE or UNKNOWN. /// [JsonProperty(PropertyName = "gender")] - public string Gender { get; private set; } - + public string Gender { get; set; } + /// /// The user's avatar. /// [JsonProperty(PropertyName = "avatar")] - public Avatar Avatar { get; private set; } - + public Avatar Avatar { get; set; } + /// /// The version of the terms of service accepted by the user. /// [JsonProperty(PropertyName = "version_terms_of_service")] - public string VersionTermsOfService { get; private set; } - + public string VersionTermsOfService { get; set; } + /// /// The user status. The user status. Can be: ACTIVE, BLOCKED, SIGNUP, RECOVERY, DENIED or ABORTED. /// [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - + public string Status { get; set; } + /// /// The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, APPROVAL_DIRECTOR, APPROVAL_PARENT, /// APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or SUBMIT. /// [JsonProperty(PropertyName = "sub_status")] - public string SubStatus { get; private set; } - + public string SubStatus { get; set; } + /// /// The setting for the session timeout of the user in seconds. /// [JsonProperty(PropertyName = "session_timeout")] - public int? SessionTimeout { get; private set; } - + public int? SessionTimeout { get; set; } + /// /// The amount the user can pay in the session without asking for credentials. /// [JsonProperty(PropertyName = "daily_limit_without_confirmation_login")] - public Amount DailyLimitWithoutConfirmationLogin { get; private set; } - + public Amount DailyLimitWithoutConfirmationLogin { get; set; } + /// /// The types of notifications that will result in a push notification or URL callback for this UserPerson. /// [JsonProperty(PropertyName = "notification_filters")] - public List NotificationFilters { get; private set; } - + public List NotificationFilters { get; set; } + /// /// Get a specific person. /// - public static BunqResponse Get(ApiContext apiContext, int userPersonId, IDictionary customHeaders = null) + public static BunqResponse Get(IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userPersonId), new Dictionary(), customHeaders); - + + var apiClient = new ApiClient(GetApiContext()); + var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId()), + new Dictionary(), customHeaders); + return FromJson(responseRaw, OBJECT_TYPE_GET); } - + /// /// Modify a specific person object's data. /// - public static BunqResponse Update(ApiContext apiContext, IDictionary requestMap, int userPersonId, IDictionary customHeaders = null) + /// The person's first name. + /// The person's middle name. + /// The person's last name. + /// The person's public nick name. + /// The user's main address. + /// The person's postal address. + /// The public UUID of the user's avatar. + /// The user's tax residence numbers for different countries. + /// The type of identification document the person registered with. + /// The identification document number the person registered with. + /// The country which issued the identification document the person registered with. + /// The reference to the uploaded picture/scan of the front side of the identification document. + /// The reference to the uploaded picture/scan of the back side of the identification document. + /// The person's date of birth. Accepts ISO8601 date formats. + /// The person's place of birth. + /// The person's country of birth. Formatted as a SO 3166-1 alpha-2 country code. + /// The person's nationality. Formatted as a SO 3166-1 alpha-2 country code. + /// The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. + /// The person's preferred region. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. + /// The person's gender. Can be: MALE, FEMALE and UNKNOWN. + /// The user status. You are not allowed to update the status via PUT. + /// The user sub-status. Can be updated to SUBMIT if status is RECOVERY. + /// The legal guardian of the user. Required for minors. + /// The setting for the session timeout of the user in seconds. + /// Card ids used for centralized card limits. + /// The centralized limits for user's cards. + /// The amount the user can pay in the session without asking for credentials. + /// The types of notifications that will result in a push notification or URL callback for this UserPerson. + public static BunqResponse Update(string firstName = null, string middleName = null, + string lastName = null, string publicNickName = null, Address addressMain = null, + Address addressPostal = null, string avatarUuid = null, List taxResident = null, + string documentType = null, string documentNumber = null, string documentCountryOfIssuance = null, + int? documentFrontAttachmentId = null, int? documentBackAttachmentId = null, string dateOfBirth = null, + string placeOfBirth = null, string countryOfBirth = null, string nationality = null, string language = null, + string region = null, string gender = null, string status = null, string subStatus = null, + Pointer legalGuardianAlias = null, int? sessionTimeout = null, List cardIds = null, + List cardLimits = null, Amount dailyLimitWithoutConfirmationLogin = null, + List notificationFilters = null, IDictionary customHeaders = null) { if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(apiContext); + + var apiClient = new ApiClient(GetApiContext()); + + var requestMap = new Dictionary + { + {FIELD_FIRST_NAME, firstName}, + {FIELD_MIDDLE_NAME, middleName}, + {FIELD_LAST_NAME, lastName}, + {FIELD_PUBLIC_NICK_NAME, publicNickName}, + {FIELD_ADDRESS_MAIN, addressMain}, + {FIELD_ADDRESS_POSTAL, addressPostal}, + {FIELD_AVATAR_UUID, avatarUuid}, + {FIELD_TAX_RESIDENT, taxResident}, + {FIELD_DOCUMENT_TYPE, documentType}, + {FIELD_DOCUMENT_NUMBER, documentNumber}, + {FIELD_DOCUMENT_COUNTRY_OF_ISSUANCE, documentCountryOfIssuance}, + {FIELD_DOCUMENT_FRONT_ATTACHMENT_ID, documentFrontAttachmentId}, + {FIELD_DOCUMENT_BACK_ATTACHMENT_ID, documentBackAttachmentId}, + {FIELD_DATE_OF_BIRTH, dateOfBirth}, + {FIELD_PLACE_OF_BIRTH, placeOfBirth}, + {FIELD_COUNTRY_OF_BIRTH, countryOfBirth}, + {FIELD_NATIONALITY, nationality}, + {FIELD_LANGUAGE, language}, + {FIELD_REGION, region}, + {FIELD_GENDER, gender}, + {FIELD_STATUS, status}, + {FIELD_SUB_STATUS, subStatus}, + {FIELD_LEGAL_GUARDIAN_ALIAS, legalGuardianAlias}, + {FIELD_SESSION_TIMEOUT, sessionTimeout}, + {FIELD_CARD_IDS, cardIds}, + {FIELD_CARD_LIMITS, cardLimits}, + {FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN, dailyLimitWithoutConfirmationLogin}, + {FIELD_NOTIFICATION_FILTERS, notificationFilters}, + }; + var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); - var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, userPersonId), requestBytes, customHeaders); - + var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId()), requestBytes, + customHeaders); + return ProcessForId(responseRaw); } - - + + /// /// public override bool IsAllFieldNull() @@ -286,160 +359,160 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Created != null) { return false; } - + if (this.Updated != null) { return false; } - + if (this.PublicUuid != null) { return false; } - + if (this.FirstName != null) { return false; } - + if (this.MiddleName != null) { return false; } - + if (this.LastName != null) { return false; } - + if (this.LegalName != null) { return false; } - + if (this.DisplayName != null) { return false; } - + if (this.PublicNickName != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.TaxResident != null) { return false; } - + if (this.DocumentType != null) { return false; } - + if (this.DocumentNumber != null) { return false; } - + if (this.DocumentCountryOfIssuance != null) { return false; } - + if (this.AddressMain != null) { return false; } - + if (this.AddressPostal != null) { return false; } - + if (this.DateOfBirth != null) { return false; } - + if (this.PlaceOfBirth != null) { return false; } - + if (this.CountryOfBirth != null) { return false; } - + if (this.Nationality != null) { return false; } - + if (this.Language != null) { return false; } - + if (this.Region != null) { return false; } - + if (this.Gender != null) { return false; } - + if (this.Avatar != null) { return false; } - + if (this.VersionTermsOfService != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.SubStatus != null) { return false; } - + if (this.SessionTimeout != null) { return false; } - + if (this.DailyLimitWithoutConfirmationLogin != null) { return false; } - + if (this.NotificationFilters != null) { return false; } - + return true; } - + /// /// public static UserPerson CreateFromJsonString(string json) @@ -447,4 +520,4 @@ public static UserPerson CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/Whitelist.cs b/BunqSdk/Model/Generated/Endpoint/Whitelist.cs new file mode 100644 index 0000000..4a5f364 --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/Whitelist.cs @@ -0,0 +1,26 @@ +using Bunq.Sdk.Model.Core; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// Whitelist a Request so that when one comes in, it is automatically accepted. + /// + public class Whitelist : BunqModel + { + /// + /// + public override bool IsAllFieldNull() + { + return true; + } + + /// + /// + public static Whitelist CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs b/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs new file mode 100644 index 0000000..347b1a5 --- /dev/null +++ b/BunqSdk/Model/Generated/Endpoint/WhitelistResult.cs @@ -0,0 +1,94 @@ +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Object; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Endpoint +{ + /// + /// Whitelist an SDD so that when one comes in, it is automatically accepted. + /// + public class WhitelistResult : BunqModel + { + /// + /// The ID of the whitelist entry. + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// The account from which payments will be deducted when a transaction is matched with this whitelist. + /// + [JsonProperty(PropertyName = "monetary_account_paying_id")] + public int? MonetaryAccountPayingId { get; set; } + + /// + /// The status of the WhitelistResult. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// The corresponding whitelist. + /// + [JsonProperty(PropertyName = "whitelist")] + public Whitelist Whitelist { get; set; } + + /// + /// The details of the external object the event was created for. + /// + [JsonProperty(PropertyName = "object")] + public BunqModel Object { get; set; } + + /// + /// The reference to the object used for split the bill. Can be RequestInquiry or RequestInquiryBatch + /// + [JsonProperty(PropertyName = "request_reference_split_the_bill")] + public List RequestReferenceSplitTheBill { get; set; } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.Id != null) + { + return false; + } + + if (this.MonetaryAccountPayingId != null) + { + return false; + } + + if (this.Status != null) + { + return false; + } + + if (this.Whitelist != null) + { + return false; + } + + if (this.Object != null) + { + return false; + } + + if (this.RequestReferenceSplitTheBill != null) + { + return false; + } + + return true; + } + + /// + /// + public static WhitelistResult CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Amount.cs b/BunqSdk/Model/Generated/Object/Amount.cs index 9dad7be..575c3cb 100644 --- a/BunqSdk/Model/Generated/Object/Amount.cs +++ b/BunqSdk/Model/Generated/Object/Amount.cs @@ -13,20 +13,20 @@ public class Amount : BunqModel /// [JsonProperty(PropertyName = "value")] public string Value { get; set; } - + /// /// The currency of the amount. It is an ISO 4217 formatted currency code. /// [JsonProperty(PropertyName = "currency")] public string Currency { get; set; } - + public Amount(string value, string currency) { Value = value; Currency = currency; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,15 +35,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Currency != null) { return false; } - + return true; } - + /// /// public static Amount CreateFromJsonString(string json) @@ -51,4 +51,4 @@ public static Amount CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/AnchoredObject.cs b/BunqSdk/Model/Generated/Object/AnchoredObject.cs index 357cbb7..a45c193 100644 --- a/BunqSdk/Model/Generated/Object/AnchoredObject.cs +++ b/BunqSdk/Model/Generated/Object/AnchoredObject.cs @@ -14,99 +14,99 @@ public class AnchoredObject : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - + + /// /// [JsonProperty(PropertyName = "CardDebit")] public CardDebit CardDebit { get; set; } - + /// /// [JsonProperty(PropertyName = "CardPinChange")] public CardPinChange CardPinChange { get; set; } - + /// /// [JsonProperty(PropertyName = "CardResult")] public CardResult CardResult { get; set; } - + /// /// [JsonProperty(PropertyName = "DraftPayment")] public DraftPayment DraftPayment { get; set; } - + /// /// [JsonProperty(PropertyName = "IdealMerchantTransaction")] public IdealMerchantTransaction IdealMerchantTransaction { get; set; } - + /// /// [JsonProperty(PropertyName = "Invoice")] public Invoice Invoice { get; set; } - + /// /// [JsonProperty(PropertyName = "Payment")] public Payment Payment { get; set; } - + /// /// [JsonProperty(PropertyName = "PaymentBatch")] public PaymentBatch PaymentBatch { get; set; } - + /// /// [JsonProperty(PropertyName = "PromotionDisplay")] public PromotionDisplay PromotionDisplay { get; set; } - + /// /// [JsonProperty(PropertyName = "RequestInquiryBatch")] public RequestInquiryBatch RequestInquiryBatch { get; set; } - + /// /// [JsonProperty(PropertyName = "RequestInquiry")] public RequestInquiry RequestInquiry { get; set; } - + /// /// [JsonProperty(PropertyName = "RequestResponse")] public RequestResponse RequestResponse { get; set; } - + /// /// [JsonProperty(PropertyName = "ScheduledPaymentBatch")] public SchedulePaymentBatch ScheduledPaymentBatch { get; set; } - + /// /// [JsonProperty(PropertyName = "ScheduledPayment")] public SchedulePayment ScheduledPayment { get; set; } - + /// /// [JsonProperty(PropertyName = "ScheduledInstance")] public ScheduleInstance ScheduledInstance { get; set; } - + /// /// [JsonProperty(PropertyName = "ShareInviteBankInquiry")] public ShareInviteBankInquiry ShareInviteBankInquiry { get; set; } - + /// /// [JsonProperty(PropertyName = "ShareInviteBankResponse")] public ShareInviteBankResponse ShareInviteBankResponse { get; set; } - + /// /// [JsonProperty(PropertyName = "UserCredentialPasswordIp")] public UserCredentialPasswordIp UserCredentialPasswordIp { get; set; } - - + + /// /// public BunqModel GetReferencedObject() @@ -115,95 +115,95 @@ public BunqModel GetReferencedObject() { return this.CardDebit; } - + if (this.CardPinChange != null) { return this.CardPinChange; } - + if (this.CardResult != null) { return this.CardResult; } - + if (this.DraftPayment != null) { return this.DraftPayment; } - + if (this.IdealMerchantTransaction != null) { return this.IdealMerchantTransaction; } - + if (this.Invoice != null) { return this.Invoice; } - + if (this.Payment != null) { return this.Payment; } - + if (this.PaymentBatch != null) { return this.PaymentBatch; } - + if (this.PromotionDisplay != null) { return this.PromotionDisplay; } - + if (this.RequestInquiryBatch != null) { return this.RequestInquiryBatch; } - + if (this.RequestInquiry != null) { return this.RequestInquiry; } - + if (this.RequestResponse != null) { return this.RequestResponse; } - + if (this.ScheduledPaymentBatch != null) { return this.ScheduledPaymentBatch; } - + if (this.ScheduledPayment != null) { return this.ScheduledPayment; } - + if (this.ScheduledInstance != null) { return this.ScheduledInstance; } - + if (this.ShareInviteBankInquiry != null) { return this.ShareInviteBankInquiry; } - + if (this.ShareInviteBankResponse != null) { return this.ShareInviteBankResponse; } - + if (this.UserCredentialPasswordIp != null) { return this.UserCredentialPasswordIp; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -212,95 +212,95 @@ public override bool IsAllFieldNull() { return false; } - + if (this.CardPinChange != null) { return false; } - + if (this.CardResult != null) { return false; } - + if (this.DraftPayment != null) { return false; } - + if (this.IdealMerchantTransaction != null) { return false; } - + if (this.Invoice != null) { return false; } - + if (this.Payment != null) { return false; } - + if (this.PaymentBatch != null) { return false; } - + if (this.PromotionDisplay != null) { return false; } - + if (this.RequestInquiryBatch != null) { return false; } - + if (this.RequestInquiry != null) { return false; } - + if (this.RequestResponse != null) { return false; } - + if (this.ScheduledPaymentBatch != null) { return false; } - + if (this.ScheduledPayment != null) { return false; } - + if (this.ScheduledInstance != null) { return false; } - + if (this.ShareInviteBankInquiry != null) { return false; } - + if (this.ShareInviteBankResponse != null) { return false; } - + if (this.UserCredentialPasswordIp != null) { return false; } - + return true; } - + /// /// public static AnchoredObject CreateFromJsonString(string json) @@ -308,4 +308,4 @@ public static AnchoredObject CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Attachment.cs b/BunqSdk/Model/Generated/Object/Attachment.cs index b30e70d..55cc30f 100644 --- a/BunqSdk/Model/Generated/Object/Attachment.cs +++ b/BunqSdk/Model/Generated/Object/Attachment.cs @@ -13,14 +13,14 @@ public class Attachment : BunqModel /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + /// /// The content type of the attachment's file. /// [JsonProperty(PropertyName = "content_type")] public string ContentType { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ContentType != null) { return false; } - + return true; } - + /// /// public static Attachment CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static Attachment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/AttachmentMonetaryAccountPayment.cs b/BunqSdk/Model/Generated/Object/AttachmentMonetaryAccountPayment.cs index 0832e22..204d48d 100644 --- a/BunqSdk/Model/Generated/Object/AttachmentMonetaryAccountPayment.cs +++ b/BunqSdk/Model/Generated/Object/AttachmentMonetaryAccountPayment.cs @@ -13,19 +13,19 @@ public class AttachmentMonetaryAccountPayment : BunqModel /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } - + /// /// The id of the MonetaryAccount this Attachment is attached from. /// [JsonProperty(PropertyName = "monetary_account_id")] public int? MonetaryAccountId { get; set; } - + public AttachmentMonetaryAccountPayment(int? id) { Id = id; } - - + + /// /// public override bool IsAllFieldNull() @@ -34,15 +34,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + return true; } - + /// /// public static AttachmentMonetaryAccountPayment CreateFromJsonString(string json) @@ -50,4 +50,4 @@ public static AttachmentMonetaryAccountPayment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/AttachmentPublic.cs b/BunqSdk/Model/Generated/Object/AttachmentPublic.cs index b8563e7..4efce35 100644 --- a/BunqSdk/Model/Generated/Object/AttachmentPublic.cs +++ b/BunqSdk/Model/Generated/Object/AttachmentPublic.cs @@ -13,20 +13,20 @@ public class AttachmentPublic : BunqModel /// [JsonProperty(PropertyName = "uuid")] public string Uuid { get; set; } - + /// /// The description of the attachment. /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + /// /// The content type of the attachment's file. /// [JsonProperty(PropertyName = "content_type")] public string ContentType { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,20 +35,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Description != null) { return false; } - + if (this.ContentType != null) { return false; } - + return true; } - + /// /// public static AttachmentPublic CreateFromJsonString(string json) @@ -56,4 +56,4 @@ public static AttachmentPublic CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/AttachmentTab.cs b/BunqSdk/Model/Generated/Object/AttachmentTab.cs index 0bba174..069c863 100644 --- a/BunqSdk/Model/Generated/Object/AttachmentTab.cs +++ b/BunqSdk/Model/Generated/Object/AttachmentTab.cs @@ -13,20 +13,20 @@ public class AttachmentTab : BunqModel /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } - + /// /// The description of the attachment. /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + /// /// The content type of the attachment's file. /// [JsonProperty(PropertyName = "content_type")] public string ContentType { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,20 +35,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Description != null) { return false; } - + if (this.ContentType != null) { return false; } - + return true; } - + /// /// public static AttachmentTab CreateFromJsonString(string json) @@ -56,4 +56,4 @@ public static AttachmentTab CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Avatar.cs b/BunqSdk/Model/Generated/Object/Avatar.cs index 2b02c4f..b6de06d 100644 --- a/BunqSdk/Model/Generated/Object/Avatar.cs +++ b/BunqSdk/Model/Generated/Object/Avatar.cs @@ -13,25 +13,25 @@ public class Avatar : BunqModel /// [JsonProperty(PropertyName = "uuid")] public string Uuid { get; set; } - + /// /// The public UUID of object this avatar is anchored to. /// [JsonProperty(PropertyName = "anchor_uuid")] public string AnchorUuid { get; set; } - + /// /// The actual image information of this avatar. /// [JsonProperty(PropertyName = "image")] public List Image { get; set; } - + public Avatar(string uuid) { Uuid = uuid; } - - + + /// /// public override bool IsAllFieldNull() @@ -40,20 +40,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.AnchorUuid != null) { return false; } - + if (this.Image != null) { return false; } - + return true; } - + /// /// public static Avatar CreateFromJsonString(string json) @@ -61,4 +61,4 @@ public static Avatar CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/BudgetRestriction.cs b/BunqSdk/Model/Generated/Object/BudgetRestriction.cs index a37c411..c339f30 100644 --- a/BunqSdk/Model/Generated/Object/BudgetRestriction.cs +++ b/BunqSdk/Model/Generated/Object/BudgetRestriction.cs @@ -13,14 +13,14 @@ public class BudgetRestriction : BunqModel /// [JsonProperty(PropertyName = "amount")] public Amount Amount { get; set; } - + /// /// The duration for a budget restriction. Valid values are DAILY, WEEKLY, MONTHLY, YEARLY. /// [JsonProperty(PropertyName = "frequency")] public string Frequency { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Frequency != null) { return false; } - + return true; } - + /// /// public static BudgetRestriction CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static BudgetRestriction CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/BunqId.cs b/BunqSdk/Model/Generated/Object/BunqId.cs index 2e6cf9c..5ead736 100644 --- a/BunqSdk/Model/Generated/Object/BunqId.cs +++ b/BunqSdk/Model/Generated/Object/BunqId.cs @@ -13,13 +13,13 @@ public class BunqId : BunqModel /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } - + public BunqId(int? id) { Id = id; } - - + + /// /// public override bool IsAllFieldNull() @@ -28,10 +28,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static BunqId CreateFromJsonString(string json) @@ -39,4 +39,4 @@ public static BunqId CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/BunqMeMerchantAvailable.cs b/BunqSdk/Model/Generated/Object/BunqMeMerchantAvailable.cs index 46e08f5..09c2079 100644 --- a/BunqSdk/Model/Generated/Object/BunqMeMerchantAvailable.cs +++ b/BunqSdk/Model/Generated/Object/BunqMeMerchantAvailable.cs @@ -13,14 +13,14 @@ public class BunqMeMerchantAvailable : BunqModel /// [JsonProperty(PropertyName = "merchant_type")] public string MerchantType { get; set; } - + /// /// Whether or not the merchant is available for the user. /// [JsonProperty(PropertyName = "available")] public bool? Available { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Available != null) { return false; } - + return true; } - + /// /// public static BunqMeMerchantAvailable CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static BunqMeMerchantAvailable CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CardCountryPermission.cs b/BunqSdk/Model/Generated/Object/CardCountryPermission.cs index 9b1e199..a6bac3e 100644 --- a/BunqSdk/Model/Generated/Object/CardCountryPermission.cs +++ b/BunqSdk/Model/Generated/Object/CardCountryPermission.cs @@ -13,25 +13,25 @@ public class CardCountryPermission : BunqModel /// [JsonProperty(PropertyName = "country")] public string Country { get; set; } - + /// /// Expiry time of this rule. /// [JsonProperty(PropertyName = "expiry_time")] public string ExpiryTime { get; set; } - + /// /// The id of the card country permission entry. /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } - + public CardCountryPermission(string country) { Country = country; } - - + + /// /// public override bool IsAllFieldNull() @@ -40,20 +40,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Country != null) { return false; } - + if (this.ExpiryTime != null) { return false; } - + return true; } - + /// /// public static CardCountryPermission CreateFromJsonString(string json) @@ -61,4 +61,4 @@ public static CardCountryPermission CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CardLimit.cs b/BunqSdk/Model/Generated/Object/CardLimit.cs index f5b8586..1b28c17 100644 --- a/BunqSdk/Model/Generated/Object/CardLimit.cs +++ b/BunqSdk/Model/Generated/Object/CardLimit.cs @@ -13,34 +13,34 @@ public class CardLimit : BunqModel /// [JsonProperty(PropertyName = "daily_limit")] public string DailyLimit { get; set; } - + /// /// Currency for the daily limit. /// [JsonProperty(PropertyName = "currency")] public string Currency { get; set; } - + /// /// The type of transaction for the limit. Can be CARD_LIMIT_ATM, CARD_LIMIT_CONTACTLESS, CARD_LIMIT_DIPPING or /// CARD_LIMIT_POS_ICC. /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - + /// /// The id of the card limit entry. /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } - + public CardLimit(string dailyLimit, string currency, string type) { DailyLimit = dailyLimit; Currency = currency; Type = type; } - - + + /// /// public override bool IsAllFieldNull() @@ -49,25 +49,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.DailyLimit != null) { return false; } - + if (this.Currency != null) { return false; } - + if (this.Type != null) { return false; } - + return true; } - + /// /// public static CardLimit CreateFromJsonString(string json) @@ -75,4 +75,4 @@ public static CardLimit CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CardMagStripePermission.cs b/BunqSdk/Model/Generated/Object/CardMagStripePermission.cs index 9fb72d8..2944daf 100644 --- a/BunqSdk/Model/Generated/Object/CardMagStripePermission.cs +++ b/BunqSdk/Model/Generated/Object/CardMagStripePermission.cs @@ -13,8 +13,8 @@ public class CardMagStripePermission : BunqModel /// [JsonProperty(PropertyName = "expiry_time")] public string ExpiryTime { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -23,10 +23,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static CardMagStripePermission CreateFromJsonString(string json) @@ -34,4 +34,4 @@ public static CardMagStripePermission CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CardPinAssignment.cs b/BunqSdk/Model/Generated/Object/CardPinAssignment.cs index 38a31b2..dc40968 100644 --- a/BunqSdk/Model/Generated/Object/CardPinAssignment.cs +++ b/BunqSdk/Model/Generated/Object/CardPinAssignment.cs @@ -13,27 +13,27 @@ public class CardPinAssignment : BunqModel /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - + /// /// The 4 digit PIN to be assigned to this account. /// [JsonProperty(PropertyName = "pin_code")] public string PinCode { get; set; } - + /// /// The ID of the monetary account to assign to this pin for the card. /// [JsonProperty(PropertyName = "monetary_account_id")] public int? MonetaryAccountId { get; set; } - + public CardPinAssignment(string type, string pinCode, int? monetaryAccountId) { Type = type; PinCode = pinCode; MonetaryAccountId = monetaryAccountId; } - - + + /// /// public override bool IsAllFieldNull() @@ -42,15 +42,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.MonetaryAccountId != null) { return false; } - + return true; } - + /// /// public static CardPinAssignment CreateFromJsonString(string json) @@ -58,4 +58,4 @@ public static CardPinAssignment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Certificate.cs b/BunqSdk/Model/Generated/Object/Certificate.cs index 84cc32e..71af29b 100644 --- a/BunqSdk/Model/Generated/Object/Certificate.cs +++ b/BunqSdk/Model/Generated/Object/Certificate.cs @@ -13,13 +13,13 @@ public class Certificate : BunqModel /// [JsonProperty(PropertyName = "certificate")] public string CertificateString { get; set; } - + public Certificate(string certificateString) { CertificateString = certificateString; } - - + + /// /// public override bool IsAllFieldNull() @@ -28,10 +28,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static Certificate CreateFromJsonString(string json) @@ -39,4 +39,4 @@ public static Certificate CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContent.cs b/BunqSdk/Model/Generated/Object/ChatMessageContent.cs index 1d609fa..b469d3b 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContent.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContent.cs @@ -13,44 +13,44 @@ public class ChatMessageContent : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - + + /// /// [JsonProperty(PropertyName = "ChatMessageContentAnchorEvent")] public ChatMessageContentAnchorEvent ChatMessageContentAnchorEvent { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessageContentAttachment")] public ChatMessageContentAttachment ChatMessageContentAttachment { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessageContentGeolocation")] public ChatMessageContentGeolocation ChatMessageContentGeolocation { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessageContentStatusConversationTitle")] public ChatMessageContentStatusConversationTitle ChatMessageContentStatusConversationTitle { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessageContentStatusConversation")] public ChatMessageContentStatusConversation ChatMessageContentStatusConversation { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessageContentStatusMembership")] public ChatMessageContentStatusMembership ChatMessageContentStatusMembership { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessageContentText")] public ChatMessageContentText ChatMessageContentText { get; set; } - - + + /// /// public BunqModel GetReferencedObject() @@ -59,40 +59,40 @@ public BunqModel GetReferencedObject() { return this.ChatMessageContentAnchorEvent; } - + if (this.ChatMessageContentAttachment != null) { return this.ChatMessageContentAttachment; } - + if (this.ChatMessageContentGeolocation != null) { return this.ChatMessageContentGeolocation; } - + if (this.ChatMessageContentStatusConversationTitle != null) { return this.ChatMessageContentStatusConversationTitle; } - + if (this.ChatMessageContentStatusConversation != null) { return this.ChatMessageContentStatusConversation; } - + if (this.ChatMessageContentStatusMembership != null) { return this.ChatMessageContentStatusMembership; } - + if (this.ChatMessageContentText != null) { return this.ChatMessageContentText; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -101,40 +101,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ChatMessageContentAttachment != null) { return false; } - + if (this.ChatMessageContentGeolocation != null) { return false; } - + if (this.ChatMessageContentStatusConversationTitle != null) { return false; } - + if (this.ChatMessageContentStatusConversation != null) { return false; } - + if (this.ChatMessageContentStatusMembership != null) { return false; } - + if (this.ChatMessageContentText != null) { return false; } - + return true; } - + /// /// public static ChatMessageContent CreateFromJsonString(string json) @@ -142,4 +142,4 @@ public static ChatMessageContent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs index 6933408..b151485 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentAnchorEvent.cs @@ -17,8 +17,8 @@ public class ChatMessageContentAnchorEvent : BunqModel /// [JsonProperty(PropertyName = "anchored_object")] public AnchoredObject AnchoredObject { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -27,10 +27,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageContentAnchorEvent CreateFromJsonString(string json) @@ -38,4 +38,4 @@ public static ChatMessageContentAnchorEvent CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs index 335dd05..3fbce1c 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentAttachment.cs @@ -13,8 +13,8 @@ public class ChatMessageContentAttachment : BunqModel /// [JsonProperty(PropertyName = "attachment")] public Attachment Attachment { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -23,10 +23,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageContentAttachment CreateFromJsonString(string json) @@ -34,4 +34,4 @@ public static ChatMessageContentAttachment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs index 0a04397..10113ca 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentGeolocation.cs @@ -13,8 +13,8 @@ public class ChatMessageContentGeolocation : BunqModel /// [JsonProperty(PropertyName = "geolocation")] public Geolocation Geolocation { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -23,10 +23,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageContentGeolocation CreateFromJsonString(string json) @@ -34,4 +34,4 @@ public static ChatMessageContentGeolocation CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs index b65e93a..ccde762 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversation.cs @@ -13,8 +13,8 @@ public class ChatMessageContentStatusConversation : BunqModel /// [JsonProperty(PropertyName = "action")] public string Action { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -23,10 +23,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageContentStatusConversation CreateFromJsonString(string json) @@ -34,4 +34,4 @@ public static ChatMessageContentStatusConversation CreateFromJsonString(string j return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs index ccfb7e4..c989bae 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusConversationTitle.cs @@ -13,8 +13,8 @@ public class ChatMessageContentStatusConversationTitle : BunqModel /// [JsonProperty(PropertyName = "title")] public string Title { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -23,10 +23,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageContentStatusConversationTitle CreateFromJsonString(string json) @@ -34,4 +34,4 @@ public static ChatMessageContentStatusConversationTitle CreateFromJsonString(str return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs index b06fc4b..097cc20 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentStatusMembership.cs @@ -13,14 +13,14 @@ public class ChatMessageContentStatusMembership : BunqModel /// [JsonProperty(PropertyName = "action")] public string Action { get; set; } - + /// /// The member over which the action has occurred. /// [JsonProperty(PropertyName = "member")] public LabelUser Member { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Member != null) { return false; } - + return true; } - + /// /// public static ChatMessageContentStatusMembership CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static ChatMessageContentStatusMembership CreateFromJsonString(string jso return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs b/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs index 1a81f4c..6ebfd95 100644 --- a/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs +++ b/BunqSdk/Model/Generated/Object/ChatMessageContentText.cs @@ -13,8 +13,8 @@ public class ChatMessageContentText : BunqModel /// [JsonProperty(PropertyName = "text")] public string Text { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -23,10 +23,10 @@ public override bool IsAllFieldNull() { return false; } - + return true; } - + /// /// public static ChatMessageContentText CreateFromJsonString(string json) @@ -34,4 +34,4 @@ public static ChatMessageContentText CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/CoOwner.cs b/BunqSdk/Model/Generated/Object/CoOwner.cs new file mode 100644 index 0000000..58b7f93 --- /dev/null +++ b/BunqSdk/Model/Generated/Object/CoOwner.cs @@ -0,0 +1,53 @@ +using Bunq.Sdk.Model.Core; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Object +{ + /// + /// + public class CoOwner : BunqModel + { + /// + /// The Alias of the co-owner. + /// + [JsonProperty(PropertyName = "alias")] + public List Alias { get; set; } + + /// + /// Can be: ACCEPTED, REJECTED, PENDING or REVOKED + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + public CoOwner(List alias) + { + Alias = alias; + } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.Alias != null) + { + return false; + } + + if (this.Status != null) + { + return false; + } + + return true; + } + + /// + /// + public static CoOwner CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/DraftPaymentAnchorObject.cs b/BunqSdk/Model/Generated/Object/DraftPaymentAnchorObject.cs index 1ff2cf3..0802254 100644 --- a/BunqSdk/Model/Generated/Object/DraftPaymentAnchorObject.cs +++ b/BunqSdk/Model/Generated/Object/DraftPaymentAnchorObject.cs @@ -14,19 +14,19 @@ public class DraftPaymentAnchorObject : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - + + /// /// [JsonProperty(PropertyName = "Payment")] public Payment Payment { get; set; } - + /// /// [JsonProperty(PropertyName = "PaymentBatch")] public PaymentBatch PaymentBatch { get; set; } - - + + /// /// public BunqModel GetReferencedObject() @@ -35,15 +35,15 @@ public BunqModel GetReferencedObject() { return this.Payment; } - + if (this.PaymentBatch != null) { return this.PaymentBatch; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -52,15 +52,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.PaymentBatch != null) { return false; } - + return true; } - + /// /// public static DraftPaymentAnchorObject CreateFromJsonString(string json) @@ -68,4 +68,4 @@ public static DraftPaymentAnchorObject CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/DraftPaymentEntry.cs b/BunqSdk/Model/Generated/Object/DraftPaymentEntry.cs index 124fa6b..a6a5d2e 100644 --- a/BunqSdk/Model/Generated/Object/DraftPaymentEntry.cs +++ b/BunqSdk/Model/Generated/Object/DraftPaymentEntry.cs @@ -13,65 +13,59 @@ public class DraftPaymentEntry : BunqModel /// [JsonProperty(PropertyName = "amount")] public Amount Amount { get; set; } - + /// /// The LabelMonetaryAccount containing the public information of the other (counterparty) side of the /// DraftPayment. /// [JsonProperty(PropertyName = "counterparty_alias")] public MonetaryAccountReference CounterpartyAlias { get; set; } - + /// /// The description for the DraftPayment. Maximum 140 characters for DraftPayments to external IBANs, 9000 /// characters for DraftPayments to only other bunq MonetaryAccounts. /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + /// /// Optional data to be included with the Payment specific to the merchant. /// [JsonProperty(PropertyName = "merchant_reference")] public string MerchantReference { get; set; } - + /// /// The Attachments attached to the DraftPayment. /// [JsonProperty(PropertyName = "attachment")] public List Attachment { get; set; } - - /// - /// Whether or not sending a bunq.to payment is allowed. - /// - [JsonProperty(PropertyName = "allow_bunqto")] - public bool? AllowBunqto { get; set; } - + /// /// The id of the draft payment entry. /// [JsonProperty(PropertyName = "id")] public int? Id { get; set; } - + /// /// The LabelMonetaryAccount containing the public information of 'this' (party) side of the DraftPayment. /// [JsonProperty(PropertyName = "alias")] public MonetaryAccountReference Alias { get; set; } - + /// /// The type of the draft payment entry. /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - + public DraftPaymentEntry(Amount amount, MonetaryAccountReference counterpartyAlias, string description) { Amount = amount; CounterpartyAlias = counterpartyAlias; Description = description; } - - + + /// /// public override bool IsAllFieldNull() @@ -80,45 +74,45 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Amount != null) { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.MerchantReference != null) { return false; } - + if (this.Type != null) { return false; } - + if (this.Attachment != null) { return false; } - + return true; } - + /// /// public static DraftPaymentEntry CreateFromJsonString(string json) @@ -126,4 +120,4 @@ public static DraftPaymentEntry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/DraftPaymentResponse.cs b/BunqSdk/Model/Generated/Object/DraftPaymentResponse.cs index 0a881f1..ed3219f 100644 --- a/BunqSdk/Model/Generated/Object/DraftPaymentResponse.cs +++ b/BunqSdk/Model/Generated/Object/DraftPaymentResponse.cs @@ -13,14 +13,14 @@ public class DraftPaymentResponse : BunqModel /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } - + /// /// The user that responded to the DraftPayment. /// [JsonProperty(PropertyName = "user_alias_created")] public LabelUser UserAliasCreated { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.UserAliasCreated != null) { return false; } - + return true; } - + /// /// public static DraftPaymentResponse CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static DraftPaymentResponse CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/DraftShareInviteEntry.cs b/BunqSdk/Model/Generated/Object/DraftShareInviteEntry.cs new file mode 100644 index 0000000..608cb14 --- /dev/null +++ b/BunqSdk/Model/Generated/Object/DraftShareInviteEntry.cs @@ -0,0 +1,64 @@ +using Bunq.Sdk.Model.Core; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Object +{ + /// + /// + public class DraftShareInviteEntry : BunqModel + { + /// + /// The share details. Only one of these objects is returned. + /// + [JsonProperty(PropertyName = "share_detail")] + public ShareDetail ShareDetail { get; set; } + + /// + /// The start date of this share. + /// + [JsonProperty(PropertyName = "start_date")] + public string StartDate { get; set; } + + /// + /// The expiration date of this share. + /// + [JsonProperty(PropertyName = "end_date")] + public string EndDate { get; set; } + + public DraftShareInviteEntry(ShareDetail shareDetail) + { + ShareDetail = shareDetail; + } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.ShareDetail != null) + { + return false; + } + + if (this.StartDate != null) + { + return false; + } + + if (this.EndDate != null) + { + return false; + } + + return true; + } + + /// + /// + public static DraftShareInviteEntry CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Error.cs b/BunqSdk/Model/Generated/Object/Error.cs index 3e57f5f..50b07ce 100644 --- a/BunqSdk/Model/Generated/Object/Error.cs +++ b/BunqSdk/Model/Generated/Object/Error.cs @@ -13,14 +13,14 @@ public class Error : BunqModel /// [JsonProperty(PropertyName = "error_description")] public string ErrorDescription { get; set; } - + /// /// The error description (in the user language). /// [JsonProperty(PropertyName = "error_description_translated")] public string ErrorDescriptionTranslated { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ErrorDescriptionTranslated != null) { return false; } - + return true; } - + /// /// public static Error CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static Error CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Geolocation.cs b/BunqSdk/Model/Generated/Object/Geolocation.cs index dca8fa7..578409f 100644 --- a/BunqSdk/Model/Generated/Object/Geolocation.cs +++ b/BunqSdk/Model/Generated/Object/Geolocation.cs @@ -13,26 +13,26 @@ public class Geolocation : BunqModel /// [JsonProperty(PropertyName = "latitude")] public double? Latitude { get; set; } - + /// /// The longitude for a geolocation restriction. /// [JsonProperty(PropertyName = "longitude")] public double? Longitude { get; set; } - + /// /// The altitude for a geolocation restriction. /// [JsonProperty(PropertyName = "altitude")] public double? Altitude { get; set; } - + /// /// The radius for a geolocation restriction. /// [JsonProperty(PropertyName = "radius")] public double? Radius { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -41,25 +41,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Longitude != null) { return false; } - + if (this.Altitude != null) { return false; } - + if (this.Radius != null) { return false; } - + return true; } - + /// /// public static Geolocation CreateFromJsonString(string json) @@ -67,4 +67,4 @@ public static Geolocation CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Image.cs b/BunqSdk/Model/Generated/Object/Image.cs index 5c95a76..dc38e36 100644 --- a/BunqSdk/Model/Generated/Object/Image.cs +++ b/BunqSdk/Model/Generated/Object/Image.cs @@ -13,26 +13,26 @@ public class Image : BunqModel /// [JsonProperty(PropertyName = "attachment_public_uuid")] public string AttachmentPublicUuid { get; set; } - + /// /// The content-type as a MIME filetype. /// [JsonProperty(PropertyName = "content_type")] public string ContentType { get; set; } - + /// /// The image height in pixels. /// [JsonProperty(PropertyName = "height")] public int? Height { get; set; } - + /// /// The image width in pixels. /// [JsonProperty(PropertyName = "width")] public int? Width { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -41,25 +41,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ContentType != null) { return false; } - + if (this.Height != null) { return false; } - + if (this.Width != null) { return false; } - + return true; } - + /// /// public static Image CreateFromJsonString(string json) @@ -67,4 +67,4 @@ public static Image CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/InvoiceItem.cs b/BunqSdk/Model/Generated/Object/InvoiceItem.cs index 85598e1..4839b7c 100644 --- a/BunqSdk/Model/Generated/Object/InvoiceItem.cs +++ b/BunqSdk/Model/Generated/Object/InvoiceItem.cs @@ -13,56 +13,56 @@ public class InvoiceItem : BunqModel /// [JsonProperty(PropertyName = "billing_date")] public string BillingDate { get; set; } - + /// /// The price description. /// [JsonProperty(PropertyName = "type_description")] public string TypeDescription { get; set; } - + /// /// The translated price description. /// [JsonProperty(PropertyName = "type_description_translated")] public string TypeDescriptionTranslated { get; set; } - + /// /// The unit item price excluding VAT. /// [JsonProperty(PropertyName = "unit_vat_exclusive")] public Amount UnitVatExclusive { get; set; } - + /// /// The unit item price including VAT. /// [JsonProperty(PropertyName = "unit_vat_inclusive")] public Amount UnitVatInclusive { get; set; } - + /// /// The VAT tax fraction. /// [JsonProperty(PropertyName = "vat")] public double? Vat { get; set; } - + /// /// The number of items priced. /// [JsonProperty(PropertyName = "quantity")] public double? Quantity { get; set; } - + /// /// The item price excluding VAT. /// [JsonProperty(PropertyName = "total_vat_exclusive")] public Amount TotalVatExclusive { get; set; } - + /// /// The item price including VAT. /// [JsonProperty(PropertyName = "total_vat_inclusive")] public Amount TotalVatInclusive { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -71,50 +71,50 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TypeDescription != null) { return false; } - + if (this.TypeDescriptionTranslated != null) { return false; } - + if (this.UnitVatExclusive != null) { return false; } - + if (this.UnitVatInclusive != null) { return false; } - + if (this.Vat != null) { return false; } - + if (this.Quantity != null) { return false; } - + if (this.TotalVatExclusive != null) { return false; } - + if (this.TotalVatInclusive != null) { return false; } - + return true; } - + /// /// public static InvoiceItem CreateFromJsonString(string json) @@ -122,4 +122,4 @@ public static InvoiceItem CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/InvoiceItemGroup.cs b/BunqSdk/Model/Generated/Object/InvoiceItemGroup.cs index 39d6d97..37fed9f 100644 --- a/BunqSdk/Model/Generated/Object/InvoiceItemGroup.cs +++ b/BunqSdk/Model/Generated/Object/InvoiceItemGroup.cs @@ -13,44 +13,44 @@ public class InvoiceItemGroup : BunqModel /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - + /// /// The description of the type of the invoice item group. /// [JsonProperty(PropertyName = "type_description")] public string TypeDescription { get; set; } - + /// /// The translated description of the type of the invoice item group. /// [JsonProperty(PropertyName = "type_description_translated")] public string TypeDescriptionTranslated { get; set; } - + /// /// The identifier of the invoice item group. /// [JsonProperty(PropertyName = "instance_description")] public string InstanceDescription { get; set; } - + /// /// The unit item price excluding VAT. /// [JsonProperty(PropertyName = "product_vat_exclusive")] public Amount ProductVatExclusive { get; set; } - + /// /// The unit item price including VAT. /// [JsonProperty(PropertyName = "product_vat_inclusive")] public Amount ProductVatInclusive { get; set; } - + /// /// The invoice items in the group. /// [JsonProperty(PropertyName = "item")] public InvoiceItem Item { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -59,40 +59,40 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TypeDescription != null) { return false; } - + if (this.TypeDescriptionTranslated != null) { return false; } - + if (this.InstanceDescription != null) { return false; } - + if (this.ProductVatExclusive != null) { return false; } - + if (this.ProductVatInclusive != null) { return false; } - + if (this.Item != null) { return false; } - + return true; } - + /// /// public static InvoiceItemGroup CreateFromJsonString(string json) @@ -100,4 +100,4 @@ public static InvoiceItemGroup CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Issuer.cs b/BunqSdk/Model/Generated/Object/Issuer.cs index 670f154..a56c2c6 100644 --- a/BunqSdk/Model/Generated/Object/Issuer.cs +++ b/BunqSdk/Model/Generated/Object/Issuer.cs @@ -13,19 +13,19 @@ public class Issuer : BunqModel /// [JsonProperty(PropertyName = "bic")] public string Bic { get; set; } - + /// /// The name of the bank. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } - + public Issuer(string bic) { Bic = bic; } - - + + /// /// public override bool IsAllFieldNull() @@ -34,15 +34,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Name != null) { return false; } - + return true; } - + /// /// public static Issuer CreateFromJsonString(string json) @@ -50,4 +50,4 @@ public static Issuer CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/LabelCard.cs b/BunqSdk/Model/Generated/Object/LabelCard.cs index b438bf7..3864f92 100644 --- a/BunqSdk/Model/Generated/Object/LabelCard.cs +++ b/BunqSdk/Model/Generated/Object/LabelCard.cs @@ -13,38 +13,38 @@ public class LabelCard : BunqModel /// [JsonProperty(PropertyName = "uuid")] public string Uuid { get; set; } - + /// /// The type of the card. /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - + /// /// The second line on the card. /// [JsonProperty(PropertyName = "second_line")] public string SecondLine { get; set; } - + /// /// The date this card will expire. /// [JsonProperty(PropertyName = "expiry_date")] public string ExpiryDate { get; set; } - + /// /// The status of the card. /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } - + /// /// The owner of this card. /// [JsonProperty(PropertyName = "label_user")] public LabelUser LabelUser { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -53,35 +53,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Type != null) { return false; } - + if (this.SecondLine != null) { return false; } - + if (this.ExpiryDate != null) { return false; } - + if (this.Status != null) { return false; } - + if (this.LabelUser != null) { return false; } - + return true; } - + /// /// public static LabelCard CreateFromJsonString(string json) @@ -89,4 +89,4 @@ public static LabelCard CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/LabelMonetaryAccount.cs b/BunqSdk/Model/Generated/Object/LabelMonetaryAccount.cs index ebea690..870050d 100644 --- a/BunqSdk/Model/Generated/Object/LabelMonetaryAccount.cs +++ b/BunqSdk/Model/Generated/Object/LabelMonetaryAccount.cs @@ -13,56 +13,56 @@ public class LabelMonetaryAccount : BunqModel /// [JsonProperty(PropertyName = "iban")] public string Iban { get; set; } - + /// /// The name to display with this monetary account. /// [JsonProperty(PropertyName = "display_name")] public string DisplayName { get; set; } - + /// /// The avatar of the monetary account. /// [JsonProperty(PropertyName = "avatar")] public Avatar Avatar { get; set; } - + /// /// The user this monetary account belongs to. /// [JsonProperty(PropertyName = "label_user")] public LabelUser LabelUser { get; set; } - + /// /// The country of the user. Formatted as a ISO 3166-1 alpha-2 country code. /// [JsonProperty(PropertyName = "country")] public string Country { get; set; } - + /// /// Bunq.me pointer with type and value. /// [JsonProperty(PropertyName = "bunq_me")] public MonetaryAccountReference BunqMe { get; set; } - + /// /// Whether or not the monetary account is light. /// [JsonProperty(PropertyName = "is_light")] public bool? IsLight { get; set; } - + /// /// The BIC used for a SWIFT payment. /// [JsonProperty(PropertyName = "swift_bic")] public string SwiftBic { get; set; } - + /// /// The account number used for a SWIFT payment. May or may not be an IBAN. /// [JsonProperty(PropertyName = "swift_account_number")] public string SwiftAccountNumber { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -71,50 +71,50 @@ public override bool IsAllFieldNull() { return false; } - + if (this.DisplayName != null) { return false; } - + if (this.Avatar != null) { return false; } - + if (this.LabelUser != null) { return false; } - + if (this.Country != null) { return false; } - + if (this.BunqMe != null) { return false; } - + if (this.IsLight != null) { return false; } - + if (this.SwiftBic != null) { return false; } - + if (this.SwiftAccountNumber != null) { return false; } - + return true; } - + /// /// public static LabelMonetaryAccount CreateFromJsonString(string json) @@ -122,4 +122,4 @@ public static LabelMonetaryAccount CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/LabelUser.cs b/BunqSdk/Model/Generated/Object/LabelUser.cs index 0c44e91..bbbcfe6 100644 --- a/BunqSdk/Model/Generated/Object/LabelUser.cs +++ b/BunqSdk/Model/Generated/Object/LabelUser.cs @@ -13,39 +13,39 @@ public class LabelUser : BunqModel /// [JsonProperty(PropertyName = "uuid")] public string Uuid { get; set; } - + /// /// The name to be displayed for this user, as it was given on the request. /// [JsonProperty(PropertyName = "display_name")] public string DisplayName { get; set; } - + /// /// The country of the user. 000 stands for "unknown" /// [JsonProperty(PropertyName = "country")] public string Country { get; set; } - + /// /// The current avatar of the user. /// [JsonProperty(PropertyName = "avatar")] public Avatar Avatar { get; set; } - + /// /// The current nickname of the user. /// [JsonProperty(PropertyName = "public_nick_name")] public string PublicNickName { get; set; } - + public LabelUser(string uuid, string displayName, string country) { Uuid = uuid; DisplayName = displayName; Country = country; } - - + + /// /// public override bool IsAllFieldNull() @@ -54,30 +54,30 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Avatar != null) { return false; } - + if (this.PublicNickName != null) { return false; } - + if (this.DisplayName != null) { return false; } - + if (this.Country != null) { return false; } - + return true; } - + /// /// public static LabelUser CreateFromJsonString(string json) @@ -85,4 +85,4 @@ public static LabelUser CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/MonetaryAccountProfileDrain.cs b/BunqSdk/Model/Generated/Object/MonetaryAccountProfileDrain.cs index c16665c..9a9fa3d 100644 --- a/BunqSdk/Model/Generated/Object/MonetaryAccountProfileDrain.cs +++ b/BunqSdk/Model/Generated/Object/MonetaryAccountProfileDrain.cs @@ -13,34 +13,35 @@ public class MonetaryAccountProfileDrain : BunqModel /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } - + /// /// The goal balance. /// [JsonProperty(PropertyName = "balance_preferred")] public Amount BalancePreferred { get; set; } - + /// /// The high threshold balance. /// [JsonProperty(PropertyName = "balance_threshold_high")] public Amount BalanceThresholdHigh { get; set; } - + /// /// The savings monetary account. /// [JsonProperty(PropertyName = "savings_account_alias")] public MonetaryAccountReference SavingsAccountAlias { get; set; } - - public MonetaryAccountProfileDrain(string status, Amount balancePreferred, Amount balanceThresholdHigh, MonetaryAccountReference savingsAccountAlias) + + public MonetaryAccountProfileDrain(string status, Amount balancePreferred, Amount balanceThresholdHigh, + MonetaryAccountReference savingsAccountAlias) { Status = status; BalancePreferred = balancePreferred; BalanceThresholdHigh = balanceThresholdHigh; SavingsAccountAlias = savingsAccountAlias; } - - + + /// /// public override bool IsAllFieldNull() @@ -49,25 +50,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.BalancePreferred != null) { return false; } - + if (this.BalanceThresholdHigh != null) { return false; } - + if (this.SavingsAccountAlias != null) { return false; } - + return true; } - + /// /// public static MonetaryAccountProfileDrain CreateFromJsonString(string json) @@ -75,4 +76,4 @@ public static MonetaryAccountProfileDrain CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/MonetaryAccountProfileFill.cs b/BunqSdk/Model/Generated/Object/MonetaryAccountProfileFill.cs index 316c49d..e465388 100644 --- a/BunqSdk/Model/Generated/Object/MonetaryAccountProfileFill.cs +++ b/BunqSdk/Model/Generated/Object/MonetaryAccountProfileFill.cs @@ -13,40 +13,41 @@ public class MonetaryAccountProfileFill : BunqModel /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } - + /// /// The goal balance. /// [JsonProperty(PropertyName = "balance_preferred")] public Amount BalancePreferred { get; set; } - + /// /// The low threshold balance. /// [JsonProperty(PropertyName = "balance_threshold_low")] public Amount BalanceThresholdLow { get; set; } - + /// /// The method used to fill the monetary account. Currently only iDEAL is supported, and it is the default one. /// [JsonProperty(PropertyName = "method_fill")] public string MethodFill { get; set; } - + /// /// The bank the fill is supposed to happen from, with BIC and bank name. /// [JsonProperty(PropertyName = "issuer")] public Issuer Issuer { get; set; } - - public MonetaryAccountProfileFill(string status, Amount balancePreferred, Amount balanceThresholdLow, string methodFill) + + public MonetaryAccountProfileFill(string status, Amount balancePreferred, Amount balanceThresholdLow, + string methodFill) { Status = status; BalancePreferred = balancePreferred; BalanceThresholdLow = balanceThresholdLow; MethodFill = methodFill; } - - + + /// /// public override bool IsAllFieldNull() @@ -55,30 +56,30 @@ public override bool IsAllFieldNull() { return false; } - + if (this.BalancePreferred != null) { return false; } - + if (this.BalanceThresholdLow != null) { return false; } - + if (this.MethodFill != null) { return false; } - + if (this.Issuer != null) { return false; } - + return true; } - + /// /// public static MonetaryAccountProfileFill CreateFromJsonString(string json) @@ -86,4 +87,4 @@ public static MonetaryAccountProfileFill CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/MonetaryAccountSetting.cs b/BunqSdk/Model/Generated/Object/MonetaryAccountSetting.cs index ad03684..b928280 100644 --- a/BunqSdk/Model/Generated/Object/MonetaryAccountSetting.cs +++ b/BunqSdk/Model/Generated/Object/MonetaryAccountSetting.cs @@ -13,20 +13,20 @@ public class MonetaryAccountSetting : BunqModel /// [JsonProperty(PropertyName = "color")] public string Color { get; set; } - + /// /// The status of the avatar. Can be either AVATAR_DEFAULT, AVATAR_CUSTOM or AVATAR_UNDETERMINED. /// [JsonProperty(PropertyName = "default_avatar_status")] public string DefaultAvatarStatus { get; set; } - + /// /// The chat restriction. Possible values are ALLOW_INCOMING or BLOCK_INCOMING /// [JsonProperty(PropertyName = "restriction_chat")] public string RestrictionChat { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,20 +35,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.DefaultAvatarStatus != null) { return false; } - + if (this.RestrictionChat != null) { return false; } - + return true; } - + /// /// public static MonetaryAccountSetting CreateFromJsonString(string json) @@ -56,4 +56,4 @@ public static MonetaryAccountSetting CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/NotificationAnchorObject.cs b/BunqSdk/Model/Generated/Object/NotificationAnchorObject.cs index b1b1ea3..e124d3b 100644 --- a/BunqSdk/Model/Generated/Object/NotificationAnchorObject.cs +++ b/BunqSdk/Model/Generated/Object/NotificationAnchorObject.cs @@ -14,119 +14,119 @@ public class NotificationAnchorObject : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - + + /// /// [JsonProperty(PropertyName = "BunqMeFundraiserResult")] public BunqMeFundraiserResult BunqMeFundraiserResult { get; set; } - + /// /// [JsonProperty(PropertyName = "BunqMeTab")] public BunqMeTab BunqMeTab { get; set; } - + /// /// [JsonProperty(PropertyName = "BunqMeTabResultInquiry")] public BunqMeTabResultInquiry BunqMeTabResultInquiry { get; set; } - + /// /// [JsonProperty(PropertyName = "BunqMeTabResultResponse")] public BunqMeTabResultResponse BunqMeTabResultResponse { get; set; } - + /// /// [JsonProperty(PropertyName = "ChatMessage")] public ChatMessage ChatMessage { get; set; } - + /// /// [JsonProperty(PropertyName = "DraftPayment")] public DraftPayment DraftPayment { get; set; } - + /// /// [JsonProperty(PropertyName = "IdealMerchantTransaction")] public IdealMerchantTransaction IdealMerchantTransaction { get; set; } - + /// /// [JsonProperty(PropertyName = "Invoice")] public Invoice Invoice { get; set; } - + /// /// [JsonProperty(PropertyName = "MasterCardAction")] public MasterCardAction MasterCardAction { get; set; } - + /// /// [JsonProperty(PropertyName = "MonetaryAccount")] public MonetaryAccount MonetaryAccount { get; set; } - + /// /// [JsonProperty(PropertyName = "Payment")] public Payment Payment { get; set; } - + /// /// [JsonProperty(PropertyName = "PaymentBatch")] public PaymentBatch PaymentBatch { get; set; } - + /// /// [JsonProperty(PropertyName = "RequestInquiry")] public RequestInquiry RequestInquiry { get; set; } - + /// /// [JsonProperty(PropertyName = "RequestInquiryBatch")] public RequestInquiryBatch RequestInquiryBatch { get; set; } - + /// /// [JsonProperty(PropertyName = "RequestResponse")] public RequestResponse RequestResponse { get; set; } - + /// /// [JsonProperty(PropertyName = "ShareInviteBankInquiry")] public ShareInviteBankInquiry ShareInviteBankInquiry { get; set; } - + /// /// [JsonProperty(PropertyName = "ShareInviteBankResponse")] public ShareInviteBankResponse ShareInviteBankResponse { get; set; } - + /// /// [JsonProperty(PropertyName = "ScheduledPayment")] public SchedulePayment ScheduledPayment { get; set; } - + /// /// [JsonProperty(PropertyName = "ScheduledInstance")] public ScheduleInstance ScheduledInstance { get; set; } - + /// /// [JsonProperty(PropertyName = "TabResultInquiry")] public TabResultInquiry TabResultInquiry { get; set; } - + /// /// [JsonProperty(PropertyName = "TabResultResponse")] public TabResultResponse TabResultResponse { get; set; } - + /// /// [JsonProperty(PropertyName = "User")] public User User { get; set; } - - + + /// /// public BunqModel GetReferencedObject() @@ -135,115 +135,115 @@ public BunqModel GetReferencedObject() { return this.BunqMeFundraiserResult; } - + if (this.BunqMeTab != null) { return this.BunqMeTab; } - + if (this.BunqMeTabResultInquiry != null) { return this.BunqMeTabResultInquiry; } - + if (this.BunqMeTabResultResponse != null) { return this.BunqMeTabResultResponse; } - + if (this.ChatMessage != null) { return this.ChatMessage; } - + if (this.DraftPayment != null) { return this.DraftPayment; } - + if (this.IdealMerchantTransaction != null) { return this.IdealMerchantTransaction; } - + if (this.Invoice != null) { return this.Invoice; } - + if (this.MasterCardAction != null) { return this.MasterCardAction; } - + if (this.MonetaryAccount != null) { return this.MonetaryAccount; } - + if (this.Payment != null) { return this.Payment; } - + if (this.PaymentBatch != null) { return this.PaymentBatch; } - + if (this.RequestInquiry != null) { return this.RequestInquiry; } - + if (this.RequestInquiryBatch != null) { return this.RequestInquiryBatch; } - + if (this.RequestResponse != null) { return this.RequestResponse; } - + if (this.ShareInviteBankInquiry != null) { return this.ShareInviteBankInquiry; } - + if (this.ShareInviteBankResponse != null) { return this.ShareInviteBankResponse; } - + if (this.ScheduledPayment != null) { return this.ScheduledPayment; } - + if (this.ScheduledInstance != null) { return this.ScheduledInstance; } - + if (this.TabResultInquiry != null) { return this.TabResultInquiry; } - + if (this.TabResultResponse != null) { return this.TabResultResponse; } - + if (this.User != null) { return this.User; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -252,115 +252,115 @@ public override bool IsAllFieldNull() { return false; } - + if (this.BunqMeTab != null) { return false; } - + if (this.BunqMeTabResultInquiry != null) { return false; } - + if (this.BunqMeTabResultResponse != null) { return false; } - + if (this.ChatMessage != null) { return false; } - + if (this.DraftPayment != null) { return false; } - + if (this.IdealMerchantTransaction != null) { return false; } - + if (this.Invoice != null) { return false; } - + if (this.MasterCardAction != null) { return false; } - + if (this.MonetaryAccount != null) { return false; } - + if (this.Payment != null) { return false; } - + if (this.PaymentBatch != null) { return false; } - + if (this.RequestInquiry != null) { return false; } - + if (this.RequestInquiryBatch != null) { return false; } - + if (this.RequestResponse != null) { return false; } - + if (this.ShareInviteBankInquiry != null) { return false; } - + if (this.ShareInviteBankResponse != null) { return false; } - + if (this.ScheduledPayment != null) { return false; } - + if (this.ScheduledInstance != null) { return false; } - + if (this.TabResultInquiry != null) { return false; } - + if (this.TabResultResponse != null) { return false; } - + if (this.User != null) { return false; } - + return true; } - + /// /// public static NotificationAnchorObject CreateFromJsonString(string json) @@ -368,4 +368,4 @@ public static NotificationAnchorObject CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/NotificationFilter.cs b/BunqSdk/Model/Generated/Object/NotificationFilter.cs index 0436521..b530d1a 100644 --- a/BunqSdk/Model/Generated/Object/NotificationFilter.cs +++ b/BunqSdk/Model/Generated/Object/NotificationFilter.cs @@ -14,14 +14,14 @@ public class NotificationFilter : BunqModel /// [JsonProperty(PropertyName = "notification_delivery_method")] public string NotificationDeliveryMethod { get; set; } - + /// /// The target of notifications that match this notification filter. For URL notification filters this is the /// URL to which the callback will be made. For PUSH notifications filters this should always be null. /// [JsonProperty(PropertyName = "notification_target")] public string NotificationTarget { get; set; } - + /// /// The notification category that will match this notification filter. Possible choices are BILLING, /// CARD_TRANSACTION_FAILED, CARD_TRANSACTION_SUCCESSFUL, CHAT, DRAFT_PAYMENT, IDEAL, SOFORT, @@ -30,15 +30,15 @@ public class NotificationFilter : BunqModel /// [JsonProperty(PropertyName = "category")] public string Category { get; set; } - + public NotificationFilter(string notificationDeliveryMethod, string notificationTarget, string category) { NotificationDeliveryMethod = notificationDeliveryMethod; NotificationTarget = notificationTarget; Category = category; } - - + + /// /// public override bool IsAllFieldNull() @@ -47,20 +47,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.NotificationTarget != null) { return false; } - + if (this.Category != null) { return false; } - + return true; } - + /// /// public static NotificationFilter CreateFromJsonString(string json) @@ -68,4 +68,4 @@ public static NotificationFilter CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/NotificationUrl.cs b/BunqSdk/Model/Generated/Object/NotificationUrl.cs index b0ed810..430bece 100644 --- a/BunqSdk/Model/Generated/Object/NotificationUrl.cs +++ b/BunqSdk/Model/Generated/Object/NotificationUrl.cs @@ -12,23 +12,23 @@ public class NotificationUrl : BunqModel /// [JsonProperty(PropertyName = "target_url")] public string TargetUrl { get; set; } - + /// /// [JsonProperty(PropertyName = "category")] public string Category { get; set; } - + /// /// [JsonProperty(PropertyName = "event_type")] public string EventType { get; set; } - + /// /// [JsonProperty(PropertyName = "object")] public NotificationAnchorObject Object { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -37,25 +37,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Category != null) { return false; } - + if (this.EventType != null) { return false; } - + if (this.Object != null) { return false; } - + return true; } - + /// /// public static NotificationUrl CreateFromJsonString(string json) @@ -63,4 +63,4 @@ public static NotificationUrl CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/PermittedDevice.cs b/BunqSdk/Model/Generated/Object/PermittedDevice.cs index 1092bf3..e70915b 100644 --- a/BunqSdk/Model/Generated/Object/PermittedDevice.cs +++ b/BunqSdk/Model/Generated/Object/PermittedDevice.cs @@ -13,14 +13,14 @@ public class PermittedDevice : BunqModel /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + /// /// The IP address of the device that may use the credential. /// [JsonProperty(PropertyName = "ip")] public string Ip { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -29,15 +29,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Ip != null) { return false; } - + return true; } - + /// /// public static PermittedDevice CreateFromJsonString(string json) @@ -45,4 +45,4 @@ public static PermittedDevice CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Pointer.cs b/BunqSdk/Model/Generated/Object/Pointer.cs index 7f6d4ed..6060633 100644 --- a/BunqSdk/Model/Generated/Object/Pointer.cs +++ b/BunqSdk/Model/Generated/Object/Pointer.cs @@ -13,26 +13,26 @@ public class Pointer : BunqModel /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - + /// /// The alias value. /// [JsonProperty(PropertyName = "value")] public string Value { get; set; } - + /// /// The alias name. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } - + public Pointer(string type, string value) { Type = type; Value = value; } - - + + /// /// public override bool IsAllFieldNull() @@ -41,20 +41,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Value != null) { return false; } - + if (this.Name != null) { return false; } - + return true; } - + /// /// public static Pointer CreateFromJsonString(string json) @@ -62,4 +62,4 @@ public static Pointer CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/RequestInquiryReference.cs b/BunqSdk/Model/Generated/Object/RequestInquiryReference.cs new file mode 100644 index 0000000..5cd2689 --- /dev/null +++ b/BunqSdk/Model/Generated/Object/RequestInquiryReference.cs @@ -0,0 +1,48 @@ +using Bunq.Sdk.Model.Core; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Object +{ + /// + /// + public class RequestInquiryReference : BunqModel + { + /// + /// The type of request inquiry. Can be RequestInquiry or RequestInquiryBatch. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// The id of the request inquiry (batch). + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + + /// + /// + public override bool IsAllFieldNull() + { + if (this.Type != null) + { + return false; + } + + if (this.Id != null) + { + return false; + } + + return true; + } + + /// + /// + public static RequestInquiryReference CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/RequestReferenceSplitTheBillAnchorObject.cs b/BunqSdk/Model/Generated/Object/RequestReferenceSplitTheBillAnchorObject.cs new file mode 100644 index 0000000..78cb664 --- /dev/null +++ b/BunqSdk/Model/Generated/Object/RequestReferenceSplitTheBillAnchorObject.cs @@ -0,0 +1,176 @@ +using Bunq.Sdk.Exception; +using Bunq.Sdk.Model.Core; +using Bunq.Sdk.Model.Generated.Endpoint; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Bunq.Sdk.Model.Generated.Object +{ + /// + /// + public class RequestReferenceSplitTheBillAnchorObject : BunqModel, IAnchorObjectInterface + { + /// + /// Error constants. + /// + private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; + + + /// + /// + [JsonProperty(PropertyName = "BillingInvoice")] + public Invoice BillingInvoice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "DraftPayment")] + public DraftPayment DraftPayment { get; set; } + + /// + /// + [JsonProperty(PropertyName = "MasterCardAction")] + public MasterCardAction MasterCardAction { get; set; } + + /// + /// + [JsonProperty(PropertyName = "Payment")] + public Payment Payment { get; set; } + + /// + /// + [JsonProperty(PropertyName = "PaymentBatch")] + public PaymentBatch PaymentBatch { get; set; } + + /// + /// + [JsonProperty(PropertyName = "RequestResponse")] + public RequestResponse RequestResponse { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ScheduleInstance")] + public ScheduleInstance ScheduleInstance { get; set; } + + /// + /// + [JsonProperty(PropertyName = "TabResultResponse")] + public TabResultResponse TabResultResponse { get; set; } + + /// + /// + [JsonProperty(PropertyName = "WhitelistResult")] + public WhitelistResult WhitelistResult { get; set; } + + + /// + /// + public BunqModel GetReferencedObject() + { + if (this.BillingInvoice != null) + { + return this.BillingInvoice; + } + + if (this.DraftPayment != null) + { + return this.DraftPayment; + } + + if (this.MasterCardAction != null) + { + return this.MasterCardAction; + } + + if (this.Payment != null) + { + return this.Payment; + } + + if (this.PaymentBatch != null) + { + return this.PaymentBatch; + } + + if (this.RequestResponse != null) + { + return this.RequestResponse; + } + + if (this.ScheduleInstance != null) + { + return this.ScheduleInstance; + } + + if (this.TabResultResponse != null) + { + return this.TabResultResponse; + } + + if (this.WhitelistResult != null) + { + return this.WhitelistResult; + } + + throw new BunqException(ERROR_NULL_FIELDS); + } + + /// + /// + public override bool IsAllFieldNull() + { + if (this.BillingInvoice != null) + { + return false; + } + + if (this.DraftPayment != null) + { + return false; + } + + if (this.MasterCardAction != null) + { + return false; + } + + if (this.Payment != null) + { + return false; + } + + if (this.PaymentBatch != null) + { + return false; + } + + if (this.RequestResponse != null) + { + return false; + } + + if (this.ScheduleInstance != null) + { + return false; + } + + if (this.TabResultResponse != null) + { + return false; + } + + if (this.WhitelistResult != null) + { + return false; + } + + return true; + } + + /// + /// + public static RequestReferenceSplitTheBillAnchorObject CreateFromJsonString(string json) + { + return BunqModel.CreateFromJsonString(json); + } + } +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ScheduleAnchorObject.cs b/BunqSdk/Model/Generated/Object/ScheduleAnchorObject.cs index 611c974..5628776 100644 --- a/BunqSdk/Model/Generated/Object/ScheduleAnchorObject.cs +++ b/BunqSdk/Model/Generated/Object/ScheduleAnchorObject.cs @@ -14,19 +14,19 @@ public class ScheduleAnchorObject : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - + + /// /// [JsonProperty(PropertyName = "Payment")] public Payment Payment { get; set; } - + /// /// [JsonProperty(PropertyName = "PaymentBatch")] public PaymentBatch PaymentBatch { get; set; } - - + + /// /// public BunqModel GetReferencedObject() @@ -35,15 +35,15 @@ public BunqModel GetReferencedObject() { return this.Payment; } - + if (this.PaymentBatch != null) { return this.PaymentBatch; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -52,15 +52,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.PaymentBatch != null) { return false; } - + return true; } - + /// /// public static ScheduleAnchorObject CreateFromJsonString(string json) @@ -68,4 +68,4 @@ public static ScheduleAnchorObject CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ScheduleInstanceAnchorObject.cs b/BunqSdk/Model/Generated/Object/ScheduleInstanceAnchorObject.cs index 4bda358..f1534e0 100644 --- a/BunqSdk/Model/Generated/Object/ScheduleInstanceAnchorObject.cs +++ b/BunqSdk/Model/Generated/Object/ScheduleInstanceAnchorObject.cs @@ -14,19 +14,19 @@ public class ScheduleInstanceAnchorObject : BunqModel, IAnchorObjectInterface /// Error constants. /// private const string ERROR_NULL_FIELDS = "All fields of an extended model or object are null."; - - + + /// /// [JsonProperty(PropertyName = "Payment")] public Payment Payment { get; set; } - + /// /// [JsonProperty(PropertyName = "PaymentBatch")] public PaymentBatch PaymentBatch { get; set; } - - + + /// /// public BunqModel GetReferencedObject() @@ -35,15 +35,15 @@ public BunqModel GetReferencedObject() { return this.Payment; } - + if (this.PaymentBatch != null) { return this.PaymentBatch; } - + throw new BunqException(ERROR_NULL_FIELDS); } - + /// /// public override bool IsAllFieldNull() @@ -52,15 +52,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.PaymentBatch != null) { return false; } - + return true; } - + /// /// public static ScheduleInstanceAnchorObject CreateFromJsonString(string json) @@ -68,4 +68,4 @@ public static ScheduleInstanceAnchorObject CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/SchedulePaymentEntry.cs b/BunqSdk/Model/Generated/Object/SchedulePaymentEntry.cs index e03ce25..4ce8a8f 100644 --- a/BunqSdk/Model/Generated/Object/SchedulePaymentEntry.cs +++ b/BunqSdk/Model/Generated/Object/SchedulePaymentEntry.cs @@ -14,52 +14,52 @@ public class SchedulePaymentEntry : BunqModel /// [JsonProperty(PropertyName = "amount")] public Amount Amount { get; set; } - + /// /// The LabelMonetaryAccount containing the public information of the other (counterparty) side of the Payment. /// [JsonProperty(PropertyName = "counterparty_alias")] public MonetaryAccountReference CounterpartyAlias { get; set; } - + /// /// The description for the Payment. Maximum 140 characters for Payments to external IBANs, 9000 characters for /// Payments to only other bunq MonetaryAccounts. /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + /// /// The Attachments attached to the Payment. /// [JsonProperty(PropertyName = "attachment")] public List Attachment { get; set; } - + /// /// Optional data included with the Payment specific to the merchant. /// [JsonProperty(PropertyName = "merchant_reference")] public string MerchantReference { get; set; } - + /// /// Whether or not sending a bunq.to payment is allowed. Mandatory for publicApi. /// [JsonProperty(PropertyName = "allow_bunqto")] public bool? AllowBunqto { get; set; } - + /// /// The LabelMonetaryAccount containing the public information of 'this' (party) side of the Payment. /// [JsonProperty(PropertyName = "alias")] public MonetaryAccountReference Alias { get; set; } - + public SchedulePaymentEntry(Amount amount, MonetaryAccountReference counterpartyAlias, string description) { Amount = amount; CounterpartyAlias = counterpartyAlias; Description = description; } - - + + /// /// public override bool IsAllFieldNull() @@ -68,35 +68,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Alias != null) { return false; } - + if (this.CounterpartyAlias != null) { return false; } - + if (this.Description != null) { return false; } - + if (this.Attachment != null) { return false; } - + if (this.MerchantReference != null) { return false; } - + return true; } - + /// /// public static SchedulePaymentEntry CreateFromJsonString(string json) @@ -104,4 +104,4 @@ public static SchedulePaymentEntry CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ShareDetail.cs b/BunqSdk/Model/Generated/Object/ShareDetail.cs index 8f8bf66..ebd6fa3 100644 --- a/BunqSdk/Model/Generated/Object/ShareDetail.cs +++ b/BunqSdk/Model/Generated/Object/ShareDetail.cs @@ -13,21 +13,21 @@ public class ShareDetail : BunqModel /// [JsonProperty(PropertyName = "ShareDetailPayment")] public ShareDetailPayment Payment { get; set; } - + /// /// The share details for viewing a share. In the response 'read_only' is replaced by 'ShareDetailReadOnly'. /// [JsonProperty(PropertyName = "ShareDetailReadOnly")] public ShareDetailReadOnly ReadOnly { get; set; } - + /// /// The share details for a draft payment share. Remember to replace 'draft_payment' with /// 'ShareDetailDraftPayment' before sending a request. /// [JsonProperty(PropertyName = "ShareDetailDraftPayment")] public ShareDetailDraftPayment DraftPayment { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -36,20 +36,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ReadOnly != null) { return false; } - + if (this.DraftPayment != null) { return false; } - + return true; } - + /// /// public static ShareDetail CreateFromJsonString(string json) @@ -57,4 +57,4 @@ public static ShareDetail CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ShareDetailDraftPayment.cs b/BunqSdk/Model/Generated/Object/ShareDetailDraftPayment.cs index 602f3b7..49883ff 100644 --- a/BunqSdk/Model/Generated/Object/ShareDetailDraftPayment.cs +++ b/BunqSdk/Model/Generated/Object/ShareDetailDraftPayment.cs @@ -13,34 +13,35 @@ public class ShareDetailDraftPayment : BunqModel /// [JsonProperty(PropertyName = "make_draft_payments")] public bool? MakeDraftPayments { get; set; } - + /// /// If set to true, the invited user will be able to view the account balance. /// [JsonProperty(PropertyName = "view_balance")] public bool? ViewBalance { get; set; } - + /// /// If set to true, the invited user will be able to view events from before the share was active. /// [JsonProperty(PropertyName = "view_old_events")] public bool? ViewOldEvents { get; set; } - + /// /// If set to true, the invited user will be able to view events starting from the time the share became active. /// [JsonProperty(PropertyName = "view_new_events")] public bool? ViewNewEvents { get; set; } - - public ShareDetailDraftPayment(bool? makeDraftPayments, bool? viewBalance, bool? viewOldEvents, bool? viewNewEvents) + + public ShareDetailDraftPayment(bool? makeDraftPayments, bool? viewBalance, bool? viewOldEvents, + bool? viewNewEvents) { MakeDraftPayments = makeDraftPayments; ViewBalance = viewBalance; ViewOldEvents = viewOldEvents; ViewNewEvents = viewNewEvents; } - - + + /// /// public override bool IsAllFieldNull() @@ -49,25 +50,25 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ViewBalance != null) { return false; } - + if (this.ViewOldEvents != null) { return false; } - + if (this.ViewNewEvents != null) { return false; } - + return true; } - + /// /// public static ShareDetailDraftPayment CreateFromJsonString(string json) @@ -75,4 +76,4 @@ public static ShareDetailDraftPayment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ShareDetailPayment.cs b/BunqSdk/Model/Generated/Object/ShareDetailPayment.cs index 913b658..f0cbd44 100644 --- a/BunqSdk/Model/Generated/Object/ShareDetailPayment.cs +++ b/BunqSdk/Model/Generated/Object/ShareDetailPayment.cs @@ -13,37 +13,37 @@ public class ShareDetailPayment : BunqModel /// [JsonProperty(PropertyName = "make_payments")] public bool? MakePayments { get; set; } - + /// /// If set to true, the invited user will be able to make draft payments from the shared account. /// [JsonProperty(PropertyName = "make_draft_payments")] public bool? MakeDraftPayments { get; set; } - + /// /// If set to true, the invited user will be able to view the account balance. /// [JsonProperty(PropertyName = "view_balance")] public bool? ViewBalance { get; set; } - + /// /// If set to true, the invited user will be able to view events from before the share was active. /// [JsonProperty(PropertyName = "view_old_events")] public bool? ViewOldEvents { get; set; } - + /// /// If set to true, the invited user will be able to view events starting from the time the share became active. /// [JsonProperty(PropertyName = "view_new_events")] public bool? ViewNewEvents { get; set; } - + /// /// The budget restriction. /// [JsonProperty(PropertyName = "budget")] public BudgetRestriction Budget { get; set; } - + public ShareDetailPayment(bool? makePayments, bool? viewBalance, bool? viewOldEvents, bool? viewNewEvents) { MakePayments = makePayments; @@ -51,8 +51,8 @@ public ShareDetailPayment(bool? makePayments, bool? viewBalance, bool? viewOldEv ViewOldEvents = viewOldEvents; ViewNewEvents = viewNewEvents; } - - + + /// /// public override bool IsAllFieldNull() @@ -61,35 +61,35 @@ public override bool IsAllFieldNull() { return false; } - + if (this.MakeDraftPayments != null) { return false; } - + if (this.ViewBalance != null) { return false; } - + if (this.ViewOldEvents != null) { return false; } - + if (this.ViewNewEvents != null) { return false; } - + if (this.Budget != null) { return false; } - + return true; } - + /// /// public static ShareDetailPayment CreateFromJsonString(string json) @@ -97,4 +97,4 @@ public static ShareDetailPayment CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/ShareDetailReadOnly.cs b/BunqSdk/Model/Generated/Object/ShareDetailReadOnly.cs index ea8aad1..721d0e1 100644 --- a/BunqSdk/Model/Generated/Object/ShareDetailReadOnly.cs +++ b/BunqSdk/Model/Generated/Object/ShareDetailReadOnly.cs @@ -13,27 +13,27 @@ public class ShareDetailReadOnly : BunqModel /// [JsonProperty(PropertyName = "view_balance")] public bool? ViewBalance { get; set; } - + /// /// If set to true, the invited user will be able to view events from before the share was active. /// [JsonProperty(PropertyName = "view_old_events")] public bool? ViewOldEvents { get; set; } - + /// /// If set to true, the invited user will be able to view events starting from the time the share became active. /// [JsonProperty(PropertyName = "view_new_events")] public bool? ViewNewEvents { get; set; } - + public ShareDetailReadOnly(bool? viewBalance, bool? viewOldEvents, bool? viewNewEvents) { ViewBalance = viewBalance; ViewOldEvents = viewOldEvents; ViewNewEvents = viewNewEvents; } - - + + /// /// public override bool IsAllFieldNull() @@ -42,20 +42,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.ViewOldEvents != null) { return false; } - + if (this.ViewNewEvents != null) { return false; } - + return true; } - + /// /// public static ShareDetailReadOnly CreateFromJsonString(string json) @@ -63,4 +63,4 @@ public static ShareDetailReadOnly CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/TabTextWaitingScreen.cs b/BunqSdk/Model/Generated/Object/TabTextWaitingScreen.cs index f6a8ea7..5a653d0 100644 --- a/BunqSdk/Model/Generated/Object/TabTextWaitingScreen.cs +++ b/BunqSdk/Model/Generated/Object/TabTextWaitingScreen.cs @@ -13,20 +13,20 @@ public class TabTextWaitingScreen : BunqModel /// [JsonProperty(PropertyName = "language")] public string Language { get; set; } - + /// /// Tab text /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } - + public TabTextWaitingScreen(string language, string description) { Language = language; Description = description; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,15 +35,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.Description != null) { return false; } - + return true; } - + /// /// public static TabTextWaitingScreen CreateFromJsonString(string json) @@ -51,4 +51,4 @@ public static TabTextWaitingScreen CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/TabVisibility.cs b/BunqSdk/Model/Generated/Object/TabVisibility.cs index 7a28800..febae7a 100644 --- a/BunqSdk/Model/Generated/Object/TabVisibility.cs +++ b/BunqSdk/Model/Generated/Object/TabVisibility.cs @@ -13,27 +13,27 @@ public class TabVisibility : BunqModel /// [JsonProperty(PropertyName = "cash_register_qr_code")] public bool? CashRegisterQrCode { get; set; } - + /// /// When true the tab will be visible through its own QR code. Use ../tab/{tab-id}/qr-code-content to get the /// raw content of this QR code /// [JsonProperty(PropertyName = "tab_qr_code")] public bool? TabQrCode { get; set; } - + /// /// The location of the Tab in NearPay. /// [JsonProperty(PropertyName = "location")] public Geolocation Location { get; set; } - + public TabVisibility(bool? cashRegisterQrCode, bool? tabQrCode) { CashRegisterQrCode = cashRegisterQrCode; TabQrCode = tabQrCode; } - - + + /// /// public override bool IsAllFieldNull() @@ -42,20 +42,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TabQrCode != null) { return false; } - + if (this.Location != null) { return false; } - + return true; } - + /// /// public static TabVisibility CreateFromJsonString(string json) @@ -63,4 +63,4 @@ public static TabVisibility CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/TaxResident.cs b/BunqSdk/Model/Generated/Object/TaxResident.cs index c1e253c..64ecb4d 100644 --- a/BunqSdk/Model/Generated/Object/TaxResident.cs +++ b/BunqSdk/Model/Generated/Object/TaxResident.cs @@ -13,20 +13,20 @@ public class TaxResident : BunqModel /// [JsonProperty(PropertyName = "country")] public string Country { get; set; } - + /// /// The tax number. /// [JsonProperty(PropertyName = "tax_number")] public string TaxNumber { get; set; } - + public TaxResident(string country, string taxNumber) { Country = country; TaxNumber = taxNumber; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,15 +35,15 @@ public override bool IsAllFieldNull() { return false; } - + if (this.TaxNumber != null) { return false; } - + return true; } - + /// /// public static TaxResident CreateFromJsonString(string json) @@ -51,4 +51,4 @@ public static TaxResident CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file diff --git a/BunqSdk/Model/Generated/Object/Ubo.cs b/BunqSdk/Model/Generated/Object/Ubo.cs index 368aa58..5e846f8 100644 --- a/BunqSdk/Model/Generated/Object/Ubo.cs +++ b/BunqSdk/Model/Generated/Object/Ubo.cs @@ -13,20 +13,20 @@ public class Ubo : BunqModel /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } - + /// /// The date of birth of the ultimate beneficiary owner. /// [JsonProperty(PropertyName = "date_of_birth")] public string DateOfBirth { get; set; } - + /// /// The nationality of the ultimate beneficiary owner. /// [JsonProperty(PropertyName = "nationality")] public string Nationality { get; set; } - - + + /// /// public override bool IsAllFieldNull() @@ -35,20 +35,20 @@ public override bool IsAllFieldNull() { return false; } - + if (this.DateOfBirth != null) { return false; } - + if (this.Nationality != null) { return false; } - + return true; } - + /// /// public static Ubo CreateFromJsonString(string json) @@ -56,4 +56,4 @@ public static Ubo CreateFromJsonString(string json) return BunqModel.CreateFromJsonString(json); } } -} +} \ No newline at end of file