From 5d67e3a59b2b2408ab6e18fb7b6b7c82d18a32a1 Mon Sep 17 00:00:00 2001 From: Jako Menkveld Date: Wed, 28 Sep 2022 13:32:54 +0200 Subject: [PATCH] Added StatusFilter --- .../Models/Filters/StatusFilter.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Src/Notion.Client/Models/Filters/StatusFilter.cs diff --git a/Src/Notion.Client/Models/Filters/StatusFilter.cs b/Src/Notion.Client/Models/Filters/StatusFilter.cs new file mode 100644 index 00000000..7ed9b23f --- /dev/null +++ b/Src/Notion.Client/Models/Filters/StatusFilter.cs @@ -0,0 +1,53 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class StatusFilter : SinglePropertyFilter, IRollupSubPropertyFilter + { + [JsonProperty("status")] + public Condition Status { get; set; } + + public StatusFilter( + string propertyName, + string equal = null, + string doesNotEqual = null, + bool? isEmpty = null, + bool? isNotEmpty = null) + { + Property = propertyName; + Status = new Condition( + equal: equal, + doesNotEqual: doesNotEqual, + isEmpty: isEmpty, + isNotEmpty: isNotEmpty + ); + } + + public class Condition + { + [JsonProperty("equals")] + public string Equal { get; set; } + + [JsonProperty("does_not_equal")] + public string DoesNotEqual { get; set; } + + [JsonProperty("is_empty")] + public bool? IsEmpty { get; set; } + + [JsonProperty("is_not_empty")] + public bool? IsNotEmpty { get; set; } + + public Condition( + string equal = null, + string doesNotEqual = null, + bool? isEmpty = null, + bool? isNotEmpty = null) + { + Equal = equal; + DoesNotEqual = doesNotEqual; + IsEmpty = isEmpty; + IsNotEmpty = isNotEmpty; + } + } + } +}