|
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 | + } |
124 | 124 | } |
0 commit comments