From 86a7606e3acf707f3dd632df631a8b96ffa71dc8 Mon Sep 17 00:00:00 2001 From: andrederoos Date: Thu, 7 Aug 2025 13:55:29 +0200 Subject: [PATCH] include conversion of int to long in the PaginationConverter and fix the incorrect generated MonetaryAccount objects --- BunqSdk/BunqSdk.csproj | 2 +- BunqSdk/Json/PaginationConverter.cs | 10 +-- .../Endpoint/FeatureAnnouncementApiObject.cs | 79 ++++++++++++------- .../Endpoint/MonetaryAccountApiObject.cs | 2 +- .../Endpoint/MonetaryAccountBankApiObject.cs | 2 +- .../Endpoint/MonetaryAccountCardApiObject.cs | 2 +- .../MonetaryAccountExternalApiObject.cs | 2 +- ...MonetaryAccountExternalSavingsApiObject.cs | 2 +- .../MonetaryAccountInvestmentApiObject.cs | 2 +- .../Endpoint/MonetaryAccountJointApiObject.cs | 2 +- .../Endpoint/MonetaryAccountLightApiObject.cs | 2 +- .../MonetaryAccountSavingsApiObject.cs | 2 +- .../MonetaryAccountSwitchServiceApiObject.cs | 2 +- 13 files changed, 65 insertions(+), 46 deletions(-) diff --git a/BunqSdk/BunqSdk.csproj b/BunqSdk/BunqSdk.csproj index 9d84782..9cc141c 100644 --- a/BunqSdk/BunqSdk.csproj +++ b/BunqSdk/BunqSdk.csproj @@ -8,7 +8,7 @@ Bunq.Sdk - 1.14.18 + 1.28.2 Bunq.Sdk diff --git a/BunqSdk/Json/PaginationConverter.cs b/BunqSdk/Json/PaginationConverter.cs index fcce3c9..d4105aa 100644 --- a/BunqSdk/Json/PaginationConverter.cs +++ b/BunqSdk/Json/PaginationConverter.cs @@ -51,9 +51,9 @@ private static T GetValueOrNull(IDictionary dictionary, string key return dictionary.ContainsKey(key) ? dictionary[key] : default(T); } - private static IDictionary ParsePaginationBody(JObject responseJson) + private static IDictionary ParsePaginationBody(JObject responseJson) { - var paginationBody = new Dictionary(); + var paginationBody = new Dictionary(); UpdatePaginationBodyFromResponseField( paginationBody, Pagination.PARAM_OLDER_ID, @@ -79,7 +79,7 @@ private static T GetValueOrNull(IDictionary dictionary, string key return paginationBody; } - private static void UpdatePaginationBodyFromResponseField(IDictionary paginationBody, + private static void UpdatePaginationBodyFromResponseField(IDictionary paginationBody, string idField, JObject responseJson, string responseField, string responseParam) { var responseToken = responseJson[responseField]; @@ -90,12 +90,12 @@ private static void UpdatePaginationBodyFromResponseField(IDictionary - /// view for updating the feature display. + /// view for creating the feature announcement. /// public class FeatureAnnouncementApiObject : BunqModel { /// - /// Endpoint constants. + /// Field constants. /// - protected const string ENDPOINT_URL_READ = "user/{0}/feature-announcement/{1}"; + public const string FIELD_AVATAR_UUID = "avatar_uuid"; + public const string FIELD_TITLE = "title"; + public const string FIELD_SUB_TITLE = "sub_title"; + public const string FIELD_STATUS = "status"; + public const string FIELD_FEATURE_ACCESS_ID = "feature_access_id"; + public const string FIELD_CONTENT_TYPE = "content_type"; - /// - /// Object type. - /// - private const string OBJECT_TYPE_GET = "FeatureAnnouncement"; /// - /// The Avatar of the event overview. + /// The avatar uuid. /// - [JsonProperty(PropertyName = "avatar")] - public AvatarObject Avatar { get; set; } + [JsonProperty(PropertyName = "avatar_uuid")] + public string AvatarUuid { get; set; } /// - /// The event overview title of the feature display + /// The event title of the feature announcement. /// [JsonProperty(PropertyName = "title")] - public string Title { get; set; } + public List Title { get; set; } /// - /// The event overview subtitle of the feature display + /// The event sub title of the feature announcement. /// [JsonProperty(PropertyName = "sub_title")] - public string SubTitle { get; set; } + public List SubTitle { get; set; } + /// + /// The status of the feature announcement. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } /// - /// The type of the feature announcement so apps can override with their own stuff if desired + /// The feature access id that controls the feature announcement. + /// + [JsonProperty(PropertyName = "feature_access_id")] + public string FeatureAccessId { get; set; } + /// + /// The content type of the feature announcement. + /// + [JsonProperty(PropertyName = "content_type")] + public string ContentType { get; set; } + /// + /// The Avatar of the event overview. + /// + [JsonProperty(PropertyName = "avatar")] + public AvatarObject Avatar { get; set; } + /// + /// The type of the feature announcement. /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } - /// + /// The event sub title of the feature announcement. /// - public static BunqResponse Get(long featureAnnouncementId, IDictionary customHeaders = null) - { - if (customHeaders == null) customHeaders = new Dictionary(); - - var apiClient = new ApiClient(GetApiContext()); - var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, DetermineUserId(), featureAnnouncementId), new Dictionary(), customHeaders); - - return FromJson(responseRaw, OBJECT_TYPE_GET); - } + [JsonProperty(PropertyName = "all_feature_announcement_content")] + public List AllFeatureAnnouncementContent { get; set; } /// @@ -83,6 +92,16 @@ public override bool IsAllFieldNull() return false; } + if (this.Status != null) + { + return false; + } + + if (this.AllFeatureAnnouncementContent != null) + { + return false; + } + return true; } diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountApiObject.cs index 2816824..9321fb9 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountApiObject.cs @@ -48,7 +48,7 @@ public class MonetaryAccountApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The settings of the MonetaryAccount. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBankApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBankApiObject.cs index 950c57b..a76f625 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBankApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountBankApiObject.cs @@ -165,7 +165,7 @@ public class MonetaryAccountBankApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The ids of the AutoSave. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountCardApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountCardApiObject.cs index 78f621b..0459de0 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountCardApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountCardApiObject.cs @@ -105,7 +105,7 @@ public class MonetaryAccountCardApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The settings of the MonetaryAccount. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalApiObject.cs index d1dd433..382ba6c 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalApiObject.cs @@ -161,7 +161,7 @@ public class MonetaryAccountExternalApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The ids of the AutoSave. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalSavingsApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalSavingsApiObject.cs index 35634d5..597ffcb 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalSavingsApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountExternalSavingsApiObject.cs @@ -162,7 +162,7 @@ public class MonetaryAccountExternalSavingsApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The ids of the AutoSave. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountInvestmentApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountInvestmentApiObject.cs index 7a99f75..b492872 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountInvestmentApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountInvestmentApiObject.cs @@ -157,7 +157,7 @@ public class MonetaryAccountInvestmentApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The ids of the AutoSave. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJointApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJointApiObject.cs index dc98342..1256cc4 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJointApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountJointApiObject.cs @@ -157,7 +157,7 @@ public class MonetaryAccountJointApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The ids of the AutoSave. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLightApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLightApiObject.cs index cbbc2a5..282a179 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLightApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountLightApiObject.cs @@ -175,7 +175,7 @@ public class MonetaryAccountLightApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The budgets of the MonetaryAccount. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSavingsApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSavingsApiObject.cs index 8a6532d..6bef717 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSavingsApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSavingsApiObject.cs @@ -156,7 +156,7 @@ public class MonetaryAccountSavingsApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The progress in percentages for the Savings Goal set for this MonetaryAccountSavings. /// diff --git a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSwitchServiceApiObject.cs b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSwitchServiceApiObject.cs index 9523162..881c4ed 100644 --- a/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSwitchServiceApiObject.cs +++ b/BunqSdk/Model/Generated/Endpoint/MonetaryAccountSwitchServiceApiObject.cs @@ -54,7 +54,7 @@ public class MonetaryAccountSwitchServiceApiObject : BunqModel /// The profiles of the account. /// [JsonProperty(PropertyName = "monetary_account_profile")] - public List MonetaryAccountProfile { get; set; } + public MonetaryAccountProfileApiObject MonetaryAccountProfile { get; set; } /// /// The settings of the MonetaryAccount. ///