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 Filter
9+ {
10+
11+ }
12+
13+ public class SinglePropertyFilter : Filter
14+ {
15+ public string Property { get ; set ; }
16+ }
17+
18+ public class TextFilter : SinglePropertyFilter
19+ {
20+ [ JsonProperty ( "equals" ) ]
21+ public string Equal { get ; set ; }
22+
23+ [ JsonProperty ( "does_not_equal" ) ]
24+ public string DoesNotEqual { get ; set ; }
25+
26+ public string Contains { get ; set ; }
27+
28+ [ JsonProperty ( "does_not_contain" ) ]
29+ public string DoesNotContain { get ; set ; }
30+
31+
32+ [ JsonProperty ( "starts_with" ) ]
33+ public string StartsWith { get ; set ; }
34+
35+ [ JsonProperty ( "ends_with" ) ]
36+ public string EndsWith { get ; set ; }
37+
38+ [ JsonProperty ( "is_empty" ) ]
39+ public bool IsEmpty => true ;
40+
41+ [ JsonProperty ( "is_not_empty" ) ]
42+ public bool IsNotEmpty => true ;
43+ }
44+
45+ public class NumberFilter : SinglePropertyFilter
46+ {
47+ [ JsonProperty ( "equals" ) ]
48+ public double Equal { get ; set ; }
49+
50+ [ JsonProperty ( "does_not_equal" ) ]
51+ public double DoesNotEqual { get ; set ; }
52+
53+ [ JsonProperty ( "greater_than" ) ]
54+ public double GreaterThan { get ; set ; }
55+
56+ [ JsonProperty ( "less_than" ) ]
57+ public double LessThan { get ; set ; }
58+
59+ [ JsonProperty ( "greater_than_or_equal_to" ) ]
60+ public double GreaterThanOrEqualTo { get ; set ; }
61+
62+ [ JsonProperty ( "less_than_or_equal_to" ) ]
63+ public double LessThanOrEqualTo { get ; set ; }
64+
65+ [ JsonProperty ( "is_empty" ) ]
66+ public bool IsEmpty => true ;
67+
68+ [ JsonProperty ( "is_not_empty" ) ]
69+ public bool IsNotEmpty => true ;
70+ }
71+
72+ public class CheckboxFilter : SinglePropertyFilter
73+ {
74+ [ JsonProperty ( "equals" ) ]
75+ public bool Equal { get ; set ; }
76+
77+ [ JsonProperty ( "does_not_equal" ) ]
78+ public bool DoesNotEqual { get ; set ; }
79+ }
80+
81+ public class SelectFilter : SinglePropertyFilter
82+ {
83+ [ JsonProperty ( "equals" ) ]
84+ public string Equal { get ; set ; }
85+
86+ [ JsonProperty ( "does_not_equal" ) ]
87+ public string DoesNotEqual { get ; set ; }
88+
89+ [ JsonProperty ( "is_empty" ) ]
90+ public bool IsEmpty => true ;
91+
92+ [ JsonProperty ( "is_not_empty" ) ]
93+ public bool IsNotEmpty => true ;
94+ }
95+
96+ public class MultiSelectFilter : SinglePropertyFilter
97+ {
98+ public string Contains { get ; set ; }
99+
100+ [ JsonProperty ( "does_not_contain" ) ]
101+ public string DoesNotContain { get ; set ; }
102+
103+ [ JsonProperty ( "is_empty" ) ]
104+ public bool IsEmpty => true ;
105+
106+ [ JsonProperty ( "is_not_empty" ) ]
107+ public bool IsNotEmpty => true ;
108+ }
109+
110+ public class DateFilter : SinglePropertyFilter
111+ {
112+ [ JsonProperty ( "equals" ) ]
113+ [ JsonConverter ( typeof ( IsoDateTimeConverter ) ) ]
114+ public DateTime Equal { get ; set ; }
115+
116+ [ JsonProperty ( "before" ) ]
117+ [ JsonConverter ( typeof ( IsoDateTimeConverter ) ) ]
118+ public DateTime Before { get ; set ; }
119+
120+ [ JsonProperty ( "after" ) ]
121+ [ JsonConverter ( typeof ( IsoDateTimeConverter ) ) ]
122+ public DateTime After { get ; set ; }
123+
124+ [ JsonProperty ( "on_or_before" ) ]
125+ [ JsonConverter ( typeof ( IsoDateTimeConverter ) ) ]
126+ public DateTime OnOrBefore { get ; set ; }
127+
128+ [ JsonProperty ( "on_or_after" ) ]
129+ [ JsonConverter ( typeof ( IsoDateTimeConverter ) ) ]
130+ public DateTime OnOrAfter { get ; set ; }
131+
132+ [ JsonProperty ( "past_week" ) ]
133+ public Dictionary < string , object > PastWeek { get ; set ; }
134+
135+ [ JsonProperty ( "past_month" ) ]
136+ public Dictionary < string , object > PastMonth { get ; set ; }
137+
138+ [ JsonProperty ( "past_year" ) ]
139+ public Dictionary < string , object > PastYear { get ; set ; }
140+
141+ [ JsonProperty ( "next_week" ) ]
142+ public Dictionary < string , object > NextWeek { get ; set ; }
143+
144+ [ JsonProperty ( "next_month" ) ]
145+ public Dictionary < string , object > NextMonth { get ; set ; }
146+
147+ [ JsonProperty ( "next_year" ) ]
148+ public Dictionary < string , object > NextYear { get ; set ; }
149+
150+ [ JsonProperty ( "is_empty" ) ]
151+ public bool IsEmpty => true ;
152+
153+ [ JsonProperty ( "is_not_empty" ) ]
154+ public bool IsNotEmpty => true ;
155+ }
156+
157+ public class PeopleFilter : SinglePropertyFilter
158+ {
159+ public string Contains { get ; set ; }
160+
161+ [ JsonProperty ( "does_not_contain" ) ]
162+ public string DoesNotContain { get ; set ; }
163+
164+ [ JsonProperty ( "is_empty" ) ]
165+ public bool IsEmpty => true ;
166+
167+ [ JsonProperty ( "is_not_empty" ) ]
168+ public bool IsNotEmpty => true ;
169+ }
170+
171+ public class FilesFilter : SinglePropertyFilter
172+ {
173+ [ JsonProperty ( "is_empty" ) ]
174+ public bool IsEmpty => true ;
175+
176+ [ JsonProperty ( "is_not_empty" ) ]
177+ public bool IsNotEmpty => true ;
178+ }
179+
180+ public class RelationFilter : SinglePropertyFilter
181+ {
182+ public string Contains { get ; set ; }
183+
184+ [ JsonProperty ( "does_not_contain" ) ]
185+ public string DoesNotContain { get ; set ; }
186+
187+ [ JsonProperty ( "is_empty" ) ]
188+ public bool IsEmpty => true ;
189+
190+ [ JsonProperty ( "is_not_empty" ) ]
191+ public bool IsNotEmpty => true ;
192+ }
193+
194+ public class FormulaFilter : SinglePropertyFilter
195+ {
196+ public TextFilter Text { get ; set ; }
197+ public CheckboxFilter checkbox { get ; set ; }
198+ public NumberFilter number { get ; set ; }
199+ public DateFilter date { get ; set ; }
200+ }
201+
202+
203+ public class CompoundFilter : Filter
204+ {
205+ public List < Filter > Or { get ; set ; }
206+ public List < Filter > And { get ; set ; }
207+ }
208+ }
0 commit comments