Skip to content

Commit 9c9028e

Browse files
committed
♻️ Makes filter conditions a nested filters class
1 parent cb7ab54 commit 9c9028e

File tree

10 files changed

+143
-144
lines changed

10 files changed

+143
-144
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ namespace Notion.Client
55
{
66
public class CheckboxFilter : SinglePropertyFilter
77
{
8-
public CheckboxFilterCondition Checkbox { get; set; }
9-
}
8+
public Condition Checkbox { get; set; }
109

11-
public class CheckboxFilterCondition
12-
{
13-
[JsonProperty("equals")]
14-
public Nullable<bool> Equal { get; set; }
10+
public class Condition
11+
{
12+
[JsonProperty("equals")]
13+
public Nullable<bool> Equal { get; set; }
1514

16-
[JsonProperty("does_not_equal")]
17-
public Nullable<bool> DoesNotEqual { get; set; }
15+
[JsonProperty("does_not_equal")]
16+
public Nullable<bool> DoesNotEqual { get; set; }
17+
}
1818
}
1919
}

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

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,53 @@ namespace Notion.Client
77
{
88
public class DateFilter : SinglePropertyFilter
99
{
10-
public DateFilterCondition Date { get; set; }
11-
}
10+
public Condition Date { get; set; }
1211

13-
public class DateFilterCondition
14-
{
15-
[JsonProperty("equals")]
16-
[JsonConverter(typeof(IsoDateTimeConverter))]
17-
public Nullable<DateTime> Equal { get; set; }
12+
public class Condition
13+
{
14+
[JsonProperty("equals")]
15+
[JsonConverter(typeof(IsoDateTimeConverter))]
16+
public Nullable<DateTime> Equal { get; set; }
1817

19-
[JsonProperty("before")]
20-
[JsonConverter(typeof(IsoDateTimeConverter))]
21-
public Nullable<DateTime> Before { get; set; }
18+
[JsonProperty("before")]
19+
[JsonConverter(typeof(IsoDateTimeConverter))]
20+
public Nullable<DateTime> Before { get; set; }
2221

23-
[JsonProperty("after")]
24-
[JsonConverter(typeof(IsoDateTimeConverter))]
25-
public Nullable<DateTime> After { get; set; }
22+
[JsonProperty("after")]
23+
[JsonConverter(typeof(IsoDateTimeConverter))]
24+
public Nullable<DateTime> After { get; set; }
2625

27-
[JsonProperty("on_or_before")]
28-
[JsonConverter(typeof(IsoDateTimeConverter))]
29-
public Nullable<DateTime> OnOrBefore { get; set; }
26+
[JsonProperty("on_or_before")]
27+
[JsonConverter(typeof(IsoDateTimeConverter))]
28+
public Nullable<DateTime> OnOrBefore { get; set; }
3029

31-
[JsonProperty("on_or_after")]
32-
[JsonConverter(typeof(IsoDateTimeConverter))]
33-
public Nullable<DateTime> OnOrAfter { get; set; }
30+
[JsonProperty("on_or_after")]
31+
[JsonConverter(typeof(IsoDateTimeConverter))]
32+
public Nullable<DateTime> OnOrAfter { get; set; }
3433

35-
[JsonProperty("past_week")]
36-
public Dictionary<string, object> PastWeek { get; set; }
34+
[JsonProperty("past_week")]
35+
public Dictionary<string, object> PastWeek { get; set; }
3736

38-
[JsonProperty("past_month")]
39-
public Dictionary<string, object> PastMonth { get; set; }
37+
[JsonProperty("past_month")]
38+
public Dictionary<string, object> PastMonth { get; set; }
4039

41-
[JsonProperty("past_year")]
42-
public Dictionary<string, object> PastYear { get; set; }
40+
[JsonProperty("past_year")]
41+
public Dictionary<string, object> PastYear { get; set; }
4342

44-
[JsonProperty("next_week")]
45-
public Dictionary<string, object> NextWeek { get; set; }
43+
[JsonProperty("next_week")]
44+
public Dictionary<string, object> NextWeek { get; set; }
4645

47-
[JsonProperty("next_month")]
48-
public Dictionary<string, object> NextMonth { get; set; }
46+
[JsonProperty("next_month")]
47+
public Dictionary<string, object> NextMonth { get; set; }
4948

50-
[JsonProperty("next_year")]
51-
public Dictionary<string, object> NextYear { get; set; }
49+
[JsonProperty("next_year")]
50+
public Dictionary<string, object> NextYear { get; set; }
5251

53-
[JsonProperty("is_empty")]
54-
public Nullable<bool> IsEmpty { get; set; }
52+
[JsonProperty("is_empty")]
53+
public Nullable<bool> IsEmpty { get; set; }
5554

56-
[JsonProperty("is_not_empty")]
57-
public Nullable<bool> IsNotEmpty { get; set; }
55+
[JsonProperty("is_not_empty")]
56+
public Nullable<bool> IsNotEmpty { get; set; }
57+
}
5858
}
5959
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ namespace Notion.Client
66

77
public class FilesFilter : SinglePropertyFilter
88
{
9-
public FilesFilterCondition Files { get; set; }
10-
}
9+
public Condition Files { get; set; }
1110

12-
public class FilesFilterCondition
13-
{
14-
[JsonProperty("is_empty")]
15-
public Nullable<bool> IsEmpty { get; set; }
11+
public class Condition
12+
{
13+
[JsonProperty("is_empty")]
14+
public Nullable<bool> IsEmpty { get; set; }
1615

17-
[JsonProperty("is_not_empty")]
18-
public Nullable<bool> IsNotEmpty { get; set; }
16+
[JsonProperty("is_not_empty")]
17+
public Nullable<bool> IsNotEmpty { get; set; }
18+
}
1919
}
2020
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ namespace Notion.Client
22
{
33
public class FormulaFilter : SinglePropertyFilter
44
{
5-
public FormulaFilterCondition Formula { get; set; }
6-
}
5+
public Condition Formula { get; set; }
76

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; }
7+
public class Condition
8+
{
9+
public TextFilter.Condition Text { get; set; }
10+
public CheckboxFilter.Condition Checkbox { get; set; }
11+
public NumberFilter.Condition Number { get; set; }
12+
public DateFilter.Condition Date { get; set; }
13+
}
1414
}
1515
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ namespace Notion.Client
66
public class MultiSelectFilter : SinglePropertyFilter
77
{
88
[JsonProperty("multi_select")]
9-
public MultiSelectFilterCondition MultiSelect { get; set; }
10-
}
9+
public Condition MultiSelect { get; set; }
1110

12-
public class MultiSelectFilterCondition
13-
{
14-
public string Contains { get; set; }
11+
public class Condition
12+
{
13+
public string Contains { get; set; }
1514

16-
[JsonProperty("does_not_contain")]
17-
public string DoesNotContain { get; set; }
15+
[JsonProperty("does_not_contain")]
16+
public string DoesNotContain { get; set; }
1817

19-
[JsonProperty("is_empty")]
20-
public Nullable<bool> IsEmpty { get; set; }
18+
[JsonProperty("is_empty")]
19+
public Nullable<bool> IsEmpty { get; set; }
2120

22-
[JsonProperty("is_not_empty")]
23-
public Nullable<bool> IsNotEmpty { get; set; }
21+
[JsonProperty("is_not_empty")]
22+
public Nullable<bool> IsNotEmpty { get; set; }
23+
}
2424
}
2525
}

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@ namespace Notion.Client
55
{
66
public class NumberFilter : SinglePropertyFilter
77
{
8-
public NumberFilterCondition Number { get; set; }
9-
}
8+
public Condition Number { get; set; }
109

11-
public class NumberFilterCondition
12-
{
13-
[JsonProperty("equals")]
14-
public Nullable<double> Equal { get; set; }
10+
public class Condition
11+
{
12+
[JsonProperty("equals")]
13+
public Nullable<double> Equal { get; set; }
1514

16-
[JsonProperty("does_not_equal")]
17-
public Nullable<double> DoesNotEqual { get; set; }
15+
[JsonProperty("does_not_equal")]
16+
public Nullable<double> DoesNotEqual { get; set; }
1817

19-
[JsonProperty("greater_than")]
20-
public Nullable<double> GreaterThan { get; set; }
18+
[JsonProperty("greater_than")]
19+
public Nullable<double> GreaterThan { get; set; }
2120

22-
[JsonProperty("less_than")]
23-
public Nullable<double> LessThan { get; set; }
21+
[JsonProperty("less_than")]
22+
public Nullable<double> LessThan { get; set; }
2423

25-
[JsonProperty("greater_than_or_equal_to")]
26-
public Nullable<double> GreaterThanOrEqualTo { get; set; }
24+
[JsonProperty("greater_than_or_equal_to")]
25+
public Nullable<double> GreaterThanOrEqualTo { get; set; }
2726

28-
[JsonProperty("less_than_or_equal_to")]
29-
public Nullable<double> LessThanOrEqualTo { get; set; }
27+
[JsonProperty("less_than_or_equal_to")]
28+
public Nullable<double> LessThanOrEqualTo { get; set; }
3029

31-
[JsonProperty("is_empty")]
32-
public Nullable<bool> IsEmpty { get; set; }
30+
[JsonProperty("is_empty")]
31+
public Nullable<bool> IsEmpty { get; set; }
3332

34-
[JsonProperty("is_not_empty")]
35-
public Nullable<bool> IsNotEmpty { get; set; }
33+
[JsonProperty("is_not_empty")]
34+
public Nullable<bool> IsNotEmpty { get; set; }
35+
}
3636
}
3737
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ namespace Notion.Client
55
{
66
public class PeopleFilter : SinglePropertyFilter
77
{
8-
public PeopleFilterCondition People { get; set; }
9-
}
8+
public Condition People { get; set; }
109

11-
public class PeopleFilterCondition
12-
{
13-
public string Contains { get; set; }
10+
public class Condition
11+
{
12+
public string Contains { get; set; }
1413

15-
[JsonProperty("does_not_contain")]
16-
public string DoesNotContain { get; set; }
14+
[JsonProperty("does_not_contain")]
15+
public string DoesNotContain { get; set; }
1716

18-
[JsonProperty("is_empty")]
19-
public Nullable<bool> IsEmpty { get; set; }
17+
[JsonProperty("is_empty")]
18+
public Nullable<bool> IsEmpty { get; set; }
2019

21-
[JsonProperty("is_not_empty")]
22-
public Nullable<bool> IsNotEmpty { get; set; }
20+
[JsonProperty("is_not_empty")]
21+
public Nullable<bool> IsNotEmpty { get; set; }
22+
}
2323
}
2424
}

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@
33

44
namespace Notion.Client
55
{
6-
76
public class RelationFilter : SinglePropertyFilter
87
{
9-
public RelationFilterCondition Relation { get; set; }
10-
}
8+
public Condition Relation { get; set; }
119

12-
public class RelationFilterCondition
13-
{
14-
public string Contains { get; set; }
10+
public class Condition
11+
{
12+
public string Contains { get; set; }
1513

16-
[JsonProperty("does_not_contain")]
17-
public string DoesNotContain { get; set; }
14+
[JsonProperty("does_not_contain")]
15+
public string DoesNotContain { get; set; }
1816

19-
[JsonProperty("is_empty")]
20-
public Nullable<bool> IsEmpty { get; set; }
17+
[JsonProperty("is_empty")]
18+
public Nullable<bool> IsEmpty { get; set; }
2119

22-
[JsonProperty("is_not_empty")]
23-
public Nullable<bool> IsNotEmpty { get; set; }
20+
[JsonProperty("is_not_empty")]
21+
public Nullable<bool> IsNotEmpty { get; set; }
22+
}
2423
}
2524
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ namespace Notion.Client
55
{
66
public class SelectFilter : SinglePropertyFilter
77
{
8-
public SelectFilterCondition Select { get; set; }
9-
}
8+
public Condition Select { get; set; }
109

11-
public class SelectFilterCondition
12-
{
13-
[JsonProperty("equals")]
14-
public string Equal { get; set; }
10+
public class Condition
11+
{
12+
[JsonProperty("equals")]
13+
public string Equal { get; set; }
1514

16-
[JsonProperty("does_not_equal")]
17-
public string DoesNotEqual { get; set; }
15+
[JsonProperty("does_not_equal")]
16+
public string DoesNotEqual { get; set; }
1817

19-
[JsonProperty("is_empty")]
20-
public Nullable<bool> IsEmpty { get; set; }
18+
[JsonProperty("is_empty")]
19+
public Nullable<bool> IsEmpty { get; set; }
2120

22-
[JsonProperty("is_not_empty")]
23-
public Nullable<bool> IsNotEmpty { get; set; }
21+
[JsonProperty("is_not_empty")]
22+
public Nullable<bool> IsNotEmpty { get; set; }
23+
}
2424
}
2525
}

0 commit comments

Comments
 (0)