From 8fc28489095a964fe306228bd780640b8c973a95 Mon Sep 17 00:00:00 2001 From: Marian Zagoruiko Date: Mon, 13 Jan 2025 12:59:57 +0200 Subject: [PATCH] fix: allow setting properties to null --- .gitignore | 2 ++ Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs | 2 +- Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs | 2 +- .../Models/PropertyValue/PhoneNumberPropertyValue.cs | 2 +- Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs | 2 +- Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c6d337c2..5072687a 100644 --- a/.gitignore +++ b/.gitignore @@ -354,3 +354,5 @@ MigrationBackup/ # Rider .idea/ + +.DS_Store diff --git a/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs index 5a8e2c7a..a8ac4806 100644 --- a/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs @@ -12,7 +12,7 @@ public class EmailPropertyValue : PropertyValue /// /// Describes an email address. /// - [JsonProperty("email")] + [JsonProperty("email", NullValueHandling = NullValueHandling.Include)] public string Email { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs index 15f9c768..a709e4f5 100644 --- a/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs @@ -12,7 +12,7 @@ public class NumberPropertyValue : PropertyValue /// /// Value of number /// - [JsonProperty("number")] + [JsonProperty("number", NullValueHandling = NullValueHandling.Include)] public double? Number { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs index 79a24dac..f7c37a19 100644 --- a/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs @@ -12,7 +12,7 @@ public class PhoneNumberPropertyValue : PropertyValue /// /// Phone number value /// - [JsonProperty("phone_number")] + [JsonProperty("phone_number", NullValueHandling = NullValueHandling.Include)] public string PhoneNumber { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs index 29a64ef7..921ff810 100644 --- a/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs @@ -47,7 +47,7 @@ public enum StatusColor public override PropertyValueType Type => PropertyValueType.Status; - [JsonProperty("status")] + [JsonProperty("status", NullValueHandling = NullValueHandling.Include)] public Data Status { get; set; } public class Data diff --git a/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs index 5fc8f8bb..91b5f71c 100644 --- a/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs @@ -12,7 +12,7 @@ public class UrlPropertyValue : PropertyValue /// /// Describes a web address /// - [JsonProperty("url")] + [JsonProperty("url", NullValueHandling = NullValueHandling.Include)] public string Url { get; set; } } }