-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #330 from JakoMenkveld/main
Added StatusFilter 🎉
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class StatusFilter : SinglePropertyFilter, IRollupSubPropertyFilter | ||
{ | ||
[JsonProperty("status")] | ||
public Condition Status { get; set; } | ||
|
||
public StatusFilter( | ||
string propertyName, | ||
string equal = null, | ||
string doesNotEqual = null, | ||
bool? isEmpty = null, | ||
bool? isNotEmpty = null) | ||
{ | ||
Property = propertyName; | ||
Status = new Condition( | ||
equal: equal, | ||
doesNotEqual: doesNotEqual, | ||
isEmpty: isEmpty, | ||
isNotEmpty: isNotEmpty | ||
); | ||
} | ||
|
||
public class Condition | ||
{ | ||
[JsonProperty("equals")] | ||
public string Equal { get; set; } | ||
|
||
[JsonProperty("does_not_equal")] | ||
public string DoesNotEqual { get; set; } | ||
|
||
[JsonProperty("is_empty")] | ||
public bool? IsEmpty { get; set; } | ||
|
||
[JsonProperty("is_not_empty")] | ||
public bool? IsNotEmpty { get; set; } | ||
|
||
public Condition( | ||
string equal = null, | ||
string doesNotEqual = null, | ||
bool? isEmpty = null, | ||
bool? isNotEmpty = null) | ||
{ | ||
Equal = equal; | ||
DoesNotEqual = doesNotEqual; | ||
IsEmpty = isEmpty; | ||
IsNotEmpty = isNotEmpty; | ||
} | ||
} | ||
} | ||
} |