Skip to content

Commit 6894aa3

Browse files
committed
🐛 Fix filters formats and property nullability
1 parent e5db124 commit 6894aa3

File tree

10 files changed

+94
-33
lines changed

10 files changed

+94
-33
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
56
public class CheckboxFilter : SinglePropertyFilter
7+
{
8+
public CheckboxFilterCondition Checkbox { get; set; }
9+
}
10+
11+
public class CheckboxFilterCondition
612
{
713
[JsonProperty("equals")]
8-
public bool Equal { get; set; }
14+
public Nullable<bool> Equal { get; set; }
915

1016
[JsonProperty("does_not_equal")]
11-
public bool DoesNotEqual { get; set; }
17+
public Nullable<bool> DoesNotEqual { get; set; }
1218
}
1319
}

Src/Notion.Client/Models/Filters/Date.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,31 @@
66
namespace Notion.Client
77
{
88
public class DateFilter : SinglePropertyFilter
9+
{
10+
public DateFilterCondition Date { get; set; }
11+
}
12+
13+
public class DateFilterCondition
914
{
1015
[JsonProperty("equals")]
1116
[JsonConverter(typeof(IsoDateTimeConverter))]
12-
public DateTime Equal { get; set; }
17+
public Nullable<DateTime> Equal { get; set; }
1318

1419
[JsonProperty("before")]
1520
[JsonConverter(typeof(IsoDateTimeConverter))]
16-
public DateTime Before { get; set; }
21+
public Nullable<DateTime> Before { get; set; }
1722

1823
[JsonProperty("after")]
1924
[JsonConverter(typeof(IsoDateTimeConverter))]
20-
public DateTime After { get; set; }
25+
public Nullable<DateTime> After { get; set; }
2126

2227
[JsonProperty("on_or_before")]
2328
[JsonConverter(typeof(IsoDateTimeConverter))]
24-
public DateTime OnOrBefore { get; set; }
29+
public Nullable<DateTime> OnOrBefore { get; set; }
2530

2631
[JsonProperty("on_or_after")]
2732
[JsonConverter(typeof(IsoDateTimeConverter))]
28-
public DateTime OnOrAfter { get; set; }
33+
public Nullable<DateTime> OnOrAfter { get; set; }
2934

3035
[JsonProperty("past_week")]
3136
public Dictionary<string, object> PastWeek { get; set; }
@@ -46,9 +51,9 @@ public class DateFilter : SinglePropertyFilter
4651
public Dictionary<string, object> NextYear { get; set; }
4752

4853
[JsonProperty("is_empty")]
49-
public bool IsEmpty => true;
54+
public Nullable<bool> IsEmpty { get; set; }
5055

5156
[JsonProperty("is_not_empty")]
52-
public bool IsNotEmpty => true;
57+
public Nullable<bool> IsNotEmpty { get; set; }
5358
}
5459
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
6+
57
public class FilesFilter : SinglePropertyFilter
8+
{
9+
public FilesFilterCondition Files { get; set; }
10+
}
11+
12+
public class FilesFilterCondition
613
{
714
[JsonProperty("is_empty")]
8-
public bool IsEmpty => true;
15+
public Nullable<bool> IsEmpty { get; set; }
916

1017
[JsonProperty("is_not_empty")]
11-
public bool IsNotEmpty => true;
18+
public Nullable<bool> IsNotEmpty { get; set; }
1219
}
1320
}

Src/Notion.Client/Models/Filters/Formula.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ namespace Notion.Client
22
{
33
public class FormulaFilter : SinglePropertyFilter
44
{
5-
public TextFilter Text { get; set; }
6-
public CheckboxFilter checkbox { get; set; }
7-
public NumberFilter number { get; set; }
8-
public DateFilter date { get; set; }
5+
public FormulaFilterCondition Formula { get; set; }
6+
}
7+
8+
public class FormulaFilterCondition
9+
{
10+
public TextFilterCondition Text { get; set; }
11+
public CheckboxFilterCondition Checkbox { get; set; }
12+
public NumberFilterCondition Number { get; set; }
13+
public DateFilterCondition Date { get; set; }
914
}
1015
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
56
public class MultiSelectFilter : SinglePropertyFilter
7+
{
8+
[JsonProperty("multi_select")]
9+
public MultiSelectFilterCondition MultiSelect { get; set; }
10+
}
11+
12+
public class MultiSelectFilterCondition
613
{
714
public string Contains { get; set; }
815

916
[JsonProperty("does_not_contain")]
1017
public string DoesNotContain { get; set; }
1118

1219
[JsonProperty("is_empty")]
13-
public bool IsEmpty => true;
20+
public Nullable<bool> IsEmpty { get; set; }
1421

1522
[JsonProperty("is_not_empty")]
16-
public bool IsNotEmpty => true;
23+
public Nullable<bool> IsNotEmpty { get; set; }
1724
}
1825
}
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
56
public class NumberFilter : SinglePropertyFilter
7+
{
8+
public NumberFilterCondition Number { get; set; }
9+
}
10+
11+
public class NumberFilterCondition
612
{
713
[JsonProperty("equals")]
8-
public double Equal { get; set; }
14+
public Nullable<double> Equal { get; set; }
915

1016
[JsonProperty("does_not_equal")]
11-
public double DoesNotEqual { get; set; }
17+
public Nullable<double> DoesNotEqual { get; set; }
1218

1319
[JsonProperty("greater_than")]
14-
public double GreaterThan { get; set; }
20+
public Nullable<double> GreaterThan { get; set; }
1521

1622
[JsonProperty("less_than")]
17-
public double LessThan { get; set; }
23+
public Nullable<double> LessThan { get; set; }
1824

1925
[JsonProperty("greater_than_or_equal_to")]
20-
public double GreaterThanOrEqualTo { get; set; }
26+
public Nullable<double> GreaterThanOrEqualTo { get; set; }
2127

2228
[JsonProperty("less_than_or_equal_to")]
23-
public double LessThanOrEqualTo { get; set; }
29+
public Nullable<double> LessThanOrEqualTo { get; set; }
2430

2531
[JsonProperty("is_empty")]
26-
public bool IsEmpty => true;
32+
public Nullable<bool> IsEmpty { get; set; }
2733

2834
[JsonProperty("is_not_empty")]
29-
public bool IsNotEmpty => true;
35+
public Nullable<bool> IsNotEmpty { get; set; }
3036
}
3137
}
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
56
public class PeopleFilter : SinglePropertyFilter
7+
{
8+
public PeopleFilterCondition People { get; set; }
9+
}
10+
11+
public class PeopleFilterCondition
612
{
713
public string Contains { get; set; }
814

915
[JsonProperty("does_not_contain")]
1016
public string DoesNotContain { get; set; }
1117

1218
[JsonProperty("is_empty")]
13-
public bool IsEmpty => true;
19+
public Nullable<bool> IsEmpty { get; set; }
1420

1521
[JsonProperty("is_not_empty")]
16-
public bool IsNotEmpty => true;
22+
public Nullable<bool> IsNotEmpty { get; set; }
1723
}
1824
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
6+
57
public class RelationFilter : SinglePropertyFilter
8+
{
9+
public RelationFilterCondition Relation { get; set; }
10+
}
11+
12+
public class RelationFilterCondition
613
{
714
public string Contains { get; set; }
815

916
[JsonProperty("does_not_contain")]
1017
public string DoesNotContain { get; set; }
1118

1219
[JsonProperty("is_empty")]
13-
public bool IsEmpty => true;
20+
public Nullable<bool> IsEmpty { get; set; }
1421

1522
[JsonProperty("is_not_empty")]
16-
public bool IsNotEmpty => true;
23+
public Nullable<bool> IsNotEmpty { get; set; }
1724
}
1825
}
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
56
public class SelectFilter : SinglePropertyFilter
7+
{
8+
public SelectFilterCondition Select { get; set; }
9+
}
10+
11+
public class SelectFilterCondition
612
{
713
[JsonProperty("equals")]
814
public string Equal { get; set; }
@@ -11,9 +17,9 @@ public class SelectFilter : SinglePropertyFilter
1117
public string DoesNotEqual { get; set; }
1218

1319
[JsonProperty("is_empty")]
14-
public bool IsEmpty => true;
20+
public Nullable<bool> IsEmpty { get; set; }
1521

1622
[JsonProperty("is_not_empty")]
17-
public bool IsNotEmpty => true;
23+
public Nullable<bool> IsNotEmpty { get; set; }
1824
}
1925
}

Src/Notion.Client/Models/Filters/Text.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
using System;
12
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
56
public class TextFilter : SinglePropertyFilter
7+
{
8+
public TextFilterCondition Text { get; set; }
9+
}
10+
11+
public class TextFilterCondition
612
{
713
[JsonProperty("equals")]
814
public string Equal { get; set; }
@@ -22,9 +28,9 @@ public class TextFilter : SinglePropertyFilter
2228
public string EndsWith { get; set; }
2329

2430
[JsonProperty("is_empty")]
25-
public bool IsEmpty => true;
31+
public Nullable<bool> IsEmpty { get; set; }
2632

2733
[JsonProperty("is_not_empty")]
28-
public bool IsNotEmpty => true;
34+
public Nullable<bool> IsNotEmpty { get; set; }
2935
}
3036
}

0 commit comments

Comments
 (0)