Skip to content

Fix database property filters #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
using System;
using Newtonsoft.Json;
namespace Notion.Client
{
public class CheckboxFilter : SinglePropertyFilter
{
[JsonProperty("checkbox")]
public Condition Checkbox { get; set; }
public CheckboxFilter(
string propertyName,
bool? equal = null,
bool? doesNotEqual = null)
{
Property = propertyName;
Checkbox = new Condition(equal: equal, doesNotEqual: doesNotEqual);
}
public class Condition
{
[JsonProperty("equals")]
public bool? Equal { get; set; }
[JsonProperty("does_not_equal")]
public bool? DoesNotEqual { get; set; }
public Condition(Nullable<bool> equal = null, Nullable<bool> doesNotEqual = null)
{
Equal = equal;
DoesNotEqual = doesNotEqual;
}
}
}
using System;
using Newtonsoft.Json;

namespace Notion.Client
{
public class CheckboxFilter : SinglePropertyFilter
{
[JsonProperty("checkbox")]
public Condition Checkbox { get; set; }

public CheckboxFilter(
string propertyName,
bool? equal = null,
bool? doesNotEqual = null)
{
Property = propertyName;
Checkbox = new Condition(equal: equal, doesNotEqual: doesNotEqual);
}

public class Condition
{
[JsonProperty("equals")]
public bool? Equal { get; set; }

[JsonProperty("does_not_equal")]
public bool? DoesNotEqual { get; set; }

public Condition(Nullable<bool> equal = null, Nullable<bool> doesNotEqual = null)
{
Equal = equal;
DoesNotEqual = doesNotEqual;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,124 +1,124 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Notion.Client
{
public class DateFilter : SinglePropertyFilter
{
[JsonProperty("date")]
public Condition Date { get; set; }
public DateFilter(
string propertyName,
DateTime? equal = null,
DateTime? before = null,
DateTime? after = null,
DateTime? onOrBefore = null,
DateTime? onOrAfter = null,
Dictionary<string, object> pastWeek = null,
Dictionary<string, object> pastMonth = null,
Dictionary<string, object> pastYear = null,
Dictionary<string, object> nextWeek = null,
Dictionary<string, object> nextMonth = null,
Dictionary<string, object> nextYear = null,
bool? isEmpty = null,
bool? isNotEmpty = null)
{
Property = propertyName;
Date = new Condition(
equal: equal,
before: before,
after: after,
onOrBefore: onOrBefore,
onOrAfter: onOrAfter,
pastWeek: pastWeek,
pastMonth: pastMonth,
pastYear: pastYear,
nextWeek: nextWeek,
nextMonth: nextMonth,
nextYear: nextYear,
isEmpty: isEmpty,
isNotEmpty: isNotEmpty
);
}
public class Condition
{
[JsonProperty("equals")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? Equal { get; set; }
[JsonProperty("before")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? Before { get; set; }
[JsonProperty("after")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? After { get; set; }
[JsonProperty("on_or_before")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? OnOrBefore { get; set; }
[JsonProperty("on_or_after")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? OnOrAfter { get; set; }
[JsonProperty("past_week")]
public Dictionary<string, object> PastWeek { get; set; }
[JsonProperty("past_month")]
public Dictionary<string, object> PastMonth { get; set; }
[JsonProperty("past_year")]
public Dictionary<string, object> PastYear { get; set; }
[JsonProperty("next_week")]
public Dictionary<string, object> NextWeek { get; set; }
[JsonProperty("next_month")]
public Dictionary<string, object> NextMonth { get; set; }
[JsonProperty("next_year")]
public Dictionary<string, object> NextYear { get; set; }
[JsonProperty("is_empty")]
public bool? IsEmpty { get; set; }
[JsonProperty("is_not_empty")]
public bool? IsNotEmpty { get; set; }
public Condition(
DateTime? equal = null,
DateTime? before = null,
DateTime? after = null,
DateTime? onOrBefore = null,
DateTime? onOrAfter = null,
Dictionary<string, object> pastWeek = null,
Dictionary<string, object> pastMonth = null,
Dictionary<string, object> pastYear = null,
Dictionary<string, object> nextWeek = null,
Dictionary<string, object> nextMonth = null,
Dictionary<string, object> nextYear = null,
bool? isEmpty = null,
bool? isNotEmpty = null)
{
Equal = equal;
Before = before;
After = after;
OnOrBefore = onOrBefore;
OnOrAfter = onOrAfter;
PastWeek = pastWeek;
PastMonth = pastMonth;
PastYear = pastYear;
NextWeek = nextWeek;
NextMonth = nextMonth;
NextYear = nextYear;
IsEmpty = isEmpty;
IsNotEmpty = isNotEmpty;
}
}
}
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Notion.Client
{
public class DateFilter : SinglePropertyFilter
{
[JsonProperty("date")]
public Condition Date { get; set; }

public DateFilter(
string propertyName,
DateTime? equal = null,
DateTime? before = null,
DateTime? after = null,
DateTime? onOrBefore = null,
DateTime? onOrAfter = null,
Dictionary<string, object> pastWeek = null,
Dictionary<string, object> pastMonth = null,
Dictionary<string, object> pastYear = null,
Dictionary<string, object> nextWeek = null,
Dictionary<string, object> nextMonth = null,
Dictionary<string, object> nextYear = null,
bool? isEmpty = null,
bool? isNotEmpty = null)
{
Property = propertyName;
Date = new Condition(
equal: equal,
before: before,
after: after,
onOrBefore: onOrBefore,
onOrAfter: onOrAfter,
pastWeek: pastWeek,
pastMonth: pastMonth,
pastYear: pastYear,
nextWeek: nextWeek,
nextMonth: nextMonth,
nextYear: nextYear,
isEmpty: isEmpty,
isNotEmpty: isNotEmpty
);
}

public class Condition
{
[JsonProperty("equals")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? Equal { get; set; }

[JsonProperty("before")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? Before { get; set; }

[JsonProperty("after")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? After { get; set; }

[JsonProperty("on_or_before")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? OnOrBefore { get; set; }

[JsonProperty("on_or_after")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime? OnOrAfter { get; set; }

[JsonProperty("past_week")]
public Dictionary<string, object> PastWeek { get; set; }

[JsonProperty("past_month")]
public Dictionary<string, object> PastMonth { get; set; }

[JsonProperty("past_year")]
public Dictionary<string, object> PastYear { get; set; }

[JsonProperty("next_week")]
public Dictionary<string, object> NextWeek { get; set; }

[JsonProperty("next_month")]
public Dictionary<string, object> NextMonth { get; set; }

[JsonProperty("next_year")]
public Dictionary<string, object> NextYear { get; set; }

[JsonProperty("is_empty")]
public bool? IsEmpty { get; set; }

[JsonProperty("is_not_empty")]
public bool? IsNotEmpty { get; set; }

public Condition(
DateTime? equal = null,
DateTime? before = null,
DateTime? after = null,
DateTime? onOrBefore = null,
DateTime? onOrAfter = null,
Dictionary<string, object> pastWeek = null,
Dictionary<string, object> pastMonth = null,
Dictionary<string, object> pastYear = null,
Dictionary<string, object> nextWeek = null,
Dictionary<string, object> nextMonth = null,
Dictionary<string, object> nextYear = null,
bool? isEmpty = null,
bool? isNotEmpty = null)
{
Equal = equal;
Before = before;
After = after;
OnOrBefore = onOrBefore;
OnOrAfter = onOrAfter;
PastWeek = pastWeek;
PastMonth = pastMonth;
PastYear = pastYear;
NextWeek = nextWeek;
NextMonth = nextMonth;
NextYear = nextYear;
IsEmpty = isEmpty;
IsNotEmpty = isNotEmpty;
}
}
}
}
34 changes: 34 additions & 0 deletions Src/Notion.Client/Models/Filters/EmailFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Newtonsoft.Json;

namespace Notion.Client
{
public class EmailFilter : SinglePropertyFilter
{
[JsonProperty("email")]
public TextFilter.Condition Email { get; set; }

public EmailFilter(
string propertyName,
string equal = null,
string doesNotEqual = null,
string contains = null,
string doesNotContain = null,
string startsWith = null,
string endsWith = null,
bool? isEmpty = null,
bool? isNotEmpty = null)
{
Property = propertyName;
Email = new TextFilter.Condition(
equal: equal,
doesNotEqual: doesNotEqual,
contains: contains,
doesNotContain: doesNotContain,
startsWith: startsWith,
endsWith: endsWith,
isEmpty: isEmpty,
isNotEmpty: isNotEmpty
);
}
}
}
Loading