Skip to content

Commit 27e1749

Browse files
committed
🚚 Moved filters to separate files
1 parent 6e6b6ef commit 27e1749

File tree

12 files changed

+244
-208
lines changed

12 files changed

+244
-208
lines changed

‎Src/Notion.Client/Models/Filter.cs‎

Lines changed: 0 additions & 208 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class CheckboxFilter : SinglePropertyFilter
6+
{
7+
[JsonProperty("equals")]
8+
public bool Equal { get; set; }
9+
10+
[JsonProperty("does_not_equal")]
11+
public bool DoesNotEqual { get; set; }
12+
}
13+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
6+
namespace Notion.Client
7+
{
8+
public class DateFilter : SinglePropertyFilter
9+
{
10+
[JsonProperty("equals")]
11+
[JsonConverter(typeof(IsoDateTimeConverter))]
12+
public DateTime Equal { get; set; }
13+
14+
[JsonProperty("before")]
15+
[JsonConverter(typeof(IsoDateTimeConverter))]
16+
public DateTime Before { get; set; }
17+
18+
[JsonProperty("after")]
19+
[JsonConverter(typeof(IsoDateTimeConverter))]
20+
public DateTime After { get; set; }
21+
22+
[JsonProperty("on_or_before")]
23+
[JsonConverter(typeof(IsoDateTimeConverter))]
24+
public DateTime OnOrBefore { get; set; }
25+
26+
[JsonProperty("on_or_after")]
27+
[JsonConverter(typeof(IsoDateTimeConverter))]
28+
public DateTime OnOrAfter { get; set; }
29+
30+
[JsonProperty("past_week")]
31+
public Dictionary<string, object> PastWeek { get; set; }
32+
33+
[JsonProperty("past_month")]
34+
public Dictionary<string, object> PastMonth { get; set; }
35+
36+
[JsonProperty("past_year")]
37+
public Dictionary<string, object> PastYear { get; set; }
38+
39+
[JsonProperty("next_week")]
40+
public Dictionary<string, object> NextWeek { get; set; }
41+
42+
[JsonProperty("next_month")]
43+
public Dictionary<string, object> NextMonth { get; set; }
44+
45+
[JsonProperty("next_year")]
46+
public Dictionary<string, object> NextYear { get; set; }
47+
48+
[JsonProperty("is_empty")]
49+
public bool IsEmpty => true;
50+
51+
[JsonProperty("is_not_empty")]
52+
public bool IsNotEmpty => true;
53+
}
54+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class FilesFilter : SinglePropertyFilter
6+
{
7+
[JsonProperty("is_empty")]
8+
public bool IsEmpty => true;
9+
10+
[JsonProperty("is_not_empty")]
11+
public bool IsNotEmpty => true;
12+
}
13+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Collections.Generic;
2+
3+
namespace Notion.Client
4+
{
5+
public class Filter
6+
{
7+
8+
}
9+
10+
public class SinglePropertyFilter : Filter
11+
{
12+
public string Property { get; set; }
13+
}
14+
15+
public class CompoundFilter : Filter
16+
{
17+
public List<Filter> Or { get; set; }
18+
public List<Filter> And { get; set; }
19+
}
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Notion.Client
2+
{
3+
public class FormulaFilter : SinglePropertyFilter
4+
{
5+
public TextFilter Text { get; set; }
6+
public CheckboxFilter checkbox { get; set; }
7+
public NumberFilter number { get; set; }
8+
public DateFilter date { get; set; }
9+
}
10+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class MultiSelectFilter : SinglePropertyFilter
6+
{
7+
public string Contains { get; set; }
8+
9+
[JsonProperty("does_not_contain")]
10+
public string DoesNotContain { get; set; }
11+
12+
[JsonProperty("is_empty")]
13+
public bool IsEmpty => true;
14+
15+
[JsonProperty("is_not_empty")]
16+
public bool IsNotEmpty => true;
17+
}
18+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class NumberFilter : SinglePropertyFilter
6+
{
7+
[JsonProperty("equals")]
8+
public double Equal { get; set; }
9+
10+
[JsonProperty("does_not_equal")]
11+
public double DoesNotEqual { get; set; }
12+
13+
[JsonProperty("greater_than")]
14+
public double GreaterThan { get; set; }
15+
16+
[JsonProperty("less_than")]
17+
public double LessThan { get; set; }
18+
19+
[JsonProperty("greater_than_or_equal_to")]
20+
public double GreaterThanOrEqualTo { get; set; }
21+
22+
[JsonProperty("less_than_or_equal_to")]
23+
public double LessThanOrEqualTo { get; set; }
24+
25+
[JsonProperty("is_empty")]
26+
public bool IsEmpty => true;
27+
28+
[JsonProperty("is_not_empty")]
29+
public bool IsNotEmpty => true;
30+
}
31+
}

0 commit comments

Comments
 (0)