Skip to content
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

Add StatusFilter #329

Closed
JakoMenkveld opened this issue Sep 27, 2022 · 1 comment · Fixed by #330
Closed

Add StatusFilter #329

JakoMenkveld opened this issue Sep 27, 2022 · 1 comment · Fixed by #330
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@JakoMenkveld
Copy link

Please add a StatusFilter to allow filtering on properties of type "Status":

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;
			}
		}
	}
}
@KoditkarVedant
Copy link
Contributor

@JakoMenkveld I will try to spend some time over the weekend. If you want to open PR - I'll be very happy to accept it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants