Skip to content

Commit e85fbca

Browse files
Merge pull request #263 from notion-dotnet/246-fix-text-property-filter
Fix database property filters 🔨
2 parents 5c2970d + 5cb1c5d commit e85fbca

File tree

15 files changed

+763
-625
lines changed

15 files changed

+763
-625
lines changed
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
using System;
2-
using Newtonsoft.Json;
3-
4-
namespace Notion.Client
5-
{
6-
public class CheckboxFilter : SinglePropertyFilter
7-
{
8-
[JsonProperty("checkbox")]
9-
public Condition Checkbox { get; set; }
10-
11-
public CheckboxFilter(
12-
string propertyName,
13-
bool? equal = null,
14-
bool? doesNotEqual = null)
15-
{
16-
Property = propertyName;
17-
Checkbox = new Condition(equal: equal, doesNotEqual: doesNotEqual);
18-
}
19-
20-
public class Condition
21-
{
22-
[JsonProperty("equals")]
23-
public bool? Equal { get; set; }
24-
25-
[JsonProperty("does_not_equal")]
26-
public bool? DoesNotEqual { get; set; }
27-
28-
public Condition(Nullable<bool> equal = null, Nullable<bool> doesNotEqual = null)
29-
{
30-
Equal = equal;
31-
DoesNotEqual = doesNotEqual;
32-
}
33-
}
34-
}
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Notion.Client
5+
{
6+
public class CheckboxFilter : SinglePropertyFilter
7+
{
8+
[JsonProperty("checkbox")]
9+
public Condition Checkbox { get; set; }
10+
11+
public CheckboxFilter(
12+
string propertyName,
13+
bool? equal = null,
14+
bool? doesNotEqual = null)
15+
{
16+
Property = propertyName;
17+
Checkbox = new Condition(equal: equal, doesNotEqual: doesNotEqual);
18+
}
19+
20+
public class Condition
21+
{
22+
[JsonProperty("equals")]
23+
public bool? Equal { get; set; }
24+
25+
[JsonProperty("does_not_equal")]
26+
public bool? DoesNotEqual { get; set; }
27+
28+
public Condition(Nullable<bool> equal = null, Nullable<bool> doesNotEqual = null)
29+
{
30+
Equal = equal;
31+
DoesNotEqual = doesNotEqual;
32+
}
33+
}
34+
}
3535
}
Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,124 @@
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("date")]
11-
public Condition Date { get; set; }
12-
13-
public DateFilter(
14-
string propertyName,
15-
DateTime? equal = null,
16-
DateTime? before = null,
17-
DateTime? after = null,
18-
DateTime? onOrBefore = null,
19-
DateTime? onOrAfter = null,
20-
Dictionary<string, object> pastWeek = null,
21-
Dictionary<string, object> pastMonth = null,
22-
Dictionary<string, object> pastYear = null,
23-
Dictionary<string, object> nextWeek = null,
24-
Dictionary<string, object> nextMonth = null,
25-
Dictionary<string, object> nextYear = null,
26-
bool? isEmpty = null,
27-
bool? isNotEmpty = null)
28-
{
29-
Property = propertyName;
30-
Date = new Condition(
31-
equal: equal,
32-
before: before,
33-
after: after,
34-
onOrBefore: onOrBefore,
35-
onOrAfter: onOrAfter,
36-
pastWeek: pastWeek,
37-
pastMonth: pastMonth,
38-
pastYear: pastYear,
39-
nextWeek: nextWeek,
40-
nextMonth: nextMonth,
41-
nextYear: nextYear,
42-
isEmpty: isEmpty,
43-
isNotEmpty: isNotEmpty
44-
);
45-
}
46-
47-
public class Condition
48-
{
49-
[JsonProperty("equals")]
50-
[JsonConverter(typeof(IsoDateTimeConverter))]
51-
public DateTime? Equal { get; set; }
52-
53-
[JsonProperty("before")]
54-
[JsonConverter(typeof(IsoDateTimeConverter))]
55-
public DateTime? Before { get; set; }
56-
57-
[JsonProperty("after")]
58-
[JsonConverter(typeof(IsoDateTimeConverter))]
59-
public DateTime? After { get; set; }
60-
61-
[JsonProperty("on_or_before")]
62-
[JsonConverter(typeof(IsoDateTimeConverter))]
63-
public DateTime? OnOrBefore { get; set; }
64-
65-
[JsonProperty("on_or_after")]
66-
[JsonConverter(typeof(IsoDateTimeConverter))]
67-
public DateTime? OnOrAfter { get; set; }
68-
69-
[JsonProperty("past_week")]
70-
public Dictionary<string, object> PastWeek { get; set; }
71-
72-
[JsonProperty("past_month")]
73-
public Dictionary<string, object> PastMonth { get; set; }
74-
75-
[JsonProperty("past_year")]
76-
public Dictionary<string, object> PastYear { get; set; }
77-
78-
[JsonProperty("next_week")]
79-
public Dictionary<string, object> NextWeek { get; set; }
80-
81-
[JsonProperty("next_month")]
82-
public Dictionary<string, object> NextMonth { get; set; }
83-
84-
[JsonProperty("next_year")]
85-
public Dictionary<string, object> NextYear { get; set; }
86-
87-
[JsonProperty("is_empty")]
88-
public bool? IsEmpty { get; set; }
89-
90-
[JsonProperty("is_not_empty")]
91-
public bool? IsNotEmpty { get; set; }
92-
93-
public Condition(
94-
DateTime? equal = null,
95-
DateTime? before = null,
96-
DateTime? after = null,
97-
DateTime? onOrBefore = null,
98-
DateTime? onOrAfter = null,
99-
Dictionary<string, object> pastWeek = null,
100-
Dictionary<string, object> pastMonth = null,
101-
Dictionary<string, object> pastYear = null,
102-
Dictionary<string, object> nextWeek = null,
103-
Dictionary<string, object> nextMonth = null,
104-
Dictionary<string, object> nextYear = null,
105-
bool? isEmpty = null,
106-
bool? isNotEmpty = null)
107-
{
108-
Equal = equal;
109-
Before = before;
110-
After = after;
111-
OnOrBefore = onOrBefore;
112-
OnOrAfter = onOrAfter;
113-
PastWeek = pastWeek;
114-
PastMonth = pastMonth;
115-
PastYear = pastYear;
116-
NextWeek = nextWeek;
117-
NextMonth = nextMonth;
118-
NextYear = nextYear;
119-
IsEmpty = isEmpty;
120-
IsNotEmpty = isNotEmpty;
121-
}
122-
}
123-
}
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("date")]
11+
public Condition Date { get; set; }
12+
13+
public DateFilter(
14+
string propertyName,
15+
DateTime? equal = null,
16+
DateTime? before = null,
17+
DateTime? after = null,
18+
DateTime? onOrBefore = null,
19+
DateTime? onOrAfter = null,
20+
Dictionary<string, object> pastWeek = null,
21+
Dictionary<string, object> pastMonth = null,
22+
Dictionary<string, object> pastYear = null,
23+
Dictionary<string, object> nextWeek = null,
24+
Dictionary<string, object> nextMonth = null,
25+
Dictionary<string, object> nextYear = null,
26+
bool? isEmpty = null,
27+
bool? isNotEmpty = null)
28+
{
29+
Property = propertyName;
30+
Date = new Condition(
31+
equal: equal,
32+
before: before,
33+
after: after,
34+
onOrBefore: onOrBefore,
35+
onOrAfter: onOrAfter,
36+
pastWeek: pastWeek,
37+
pastMonth: pastMonth,
38+
pastYear: pastYear,
39+
nextWeek: nextWeek,
40+
nextMonth: nextMonth,
41+
nextYear: nextYear,
42+
isEmpty: isEmpty,
43+
isNotEmpty: isNotEmpty
44+
);
45+
}
46+
47+
public class Condition
48+
{
49+
[JsonProperty("equals")]
50+
[JsonConverter(typeof(IsoDateTimeConverter))]
51+
public DateTime? Equal { get; set; }
52+
53+
[JsonProperty("before")]
54+
[JsonConverter(typeof(IsoDateTimeConverter))]
55+
public DateTime? Before { get; set; }
56+
57+
[JsonProperty("after")]
58+
[JsonConverter(typeof(IsoDateTimeConverter))]
59+
public DateTime? After { get; set; }
60+
61+
[JsonProperty("on_or_before")]
62+
[JsonConverter(typeof(IsoDateTimeConverter))]
63+
public DateTime? OnOrBefore { get; set; }
64+
65+
[JsonProperty("on_or_after")]
66+
[JsonConverter(typeof(IsoDateTimeConverter))]
67+
public DateTime? OnOrAfter { get; set; }
68+
69+
[JsonProperty("past_week")]
70+
public Dictionary<string, object> PastWeek { get; set; }
71+
72+
[JsonProperty("past_month")]
73+
public Dictionary<string, object> PastMonth { get; set; }
74+
75+
[JsonProperty("past_year")]
76+
public Dictionary<string, object> PastYear { get; set; }
77+
78+
[JsonProperty("next_week")]
79+
public Dictionary<string, object> NextWeek { get; set; }
80+
81+
[JsonProperty("next_month")]
82+
public Dictionary<string, object> NextMonth { get; set; }
83+
84+
[JsonProperty("next_year")]
85+
public Dictionary<string, object> NextYear { get; set; }
86+
87+
[JsonProperty("is_empty")]
88+
public bool? IsEmpty { get; set; }
89+
90+
[JsonProperty("is_not_empty")]
91+
public bool? IsNotEmpty { get; set; }
92+
93+
public Condition(
94+
DateTime? equal = null,
95+
DateTime? before = null,
96+
DateTime? after = null,
97+
DateTime? onOrBefore = null,
98+
DateTime? onOrAfter = null,
99+
Dictionary<string, object> pastWeek = null,
100+
Dictionary<string, object> pastMonth = null,
101+
Dictionary<string, object> pastYear = null,
102+
Dictionary<string, object> nextWeek = null,
103+
Dictionary<string, object> nextMonth = null,
104+
Dictionary<string, object> nextYear = null,
105+
bool? isEmpty = null,
106+
bool? isNotEmpty = null)
107+
{
108+
Equal = equal;
109+
Before = before;
110+
After = after;
111+
OnOrBefore = onOrBefore;
112+
OnOrAfter = onOrAfter;
113+
PastWeek = pastWeek;
114+
PastMonth = pastMonth;
115+
PastYear = pastYear;
116+
NextWeek = nextWeek;
117+
NextMonth = nextMonth;
118+
NextYear = nextYear;
119+
IsEmpty = isEmpty;
120+
IsNotEmpty = isNotEmpty;
121+
}
122+
}
123+
}
124124
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class EmailFilter : SinglePropertyFilter
6+
{
7+
[JsonProperty("email")]
8+
public TextFilter.Condition Email { get; set; }
9+
10+
public EmailFilter(
11+
string propertyName,
12+
string equal = null,
13+
string doesNotEqual = null,
14+
string contains = null,
15+
string doesNotContain = null,
16+
string startsWith = null,
17+
string endsWith = null,
18+
bool? isEmpty = null,
19+
bool? isNotEmpty = null)
20+
{
21+
Property = propertyName;
22+
Email = new TextFilter.Condition(
23+
equal: equal,
24+
doesNotEqual: doesNotEqual,
25+
contains: contains,
26+
doesNotContain: doesNotContain,
27+
startsWith: startsWith,
28+
endsWith: endsWith,
29+
isEmpty: isEmpty,
30+
isNotEmpty: isNotEmpty
31+
);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)