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

Is SearchFilter necessary? #161

Open
state303 opened this issue Sep 24, 2023 · 1 comment
Open

Is SearchFilter necessary? #161

state303 opened this issue Sep 24, 2023 · 1 comment

Comments

@state303
Copy link

First of all,
thank you for the repo! I am very much enjoying it.

Currently, I am testing some workloads with Search.Do function that requires a SearchFilter.

Notion API does not require for us to specify any filter (basically omit,) but I think there must be other reasons you have enforced it not to be nil. However, the objects we retrieve from the Search.Do function do provide the ObjectType, which could hint us the type of the object, meaning that we could possibly skip the SearchFilter if that is nil.

So... if there's any chance, could I post PR with the following and the some tests:

  1. SearchFilter can be nil
  2. Search.Do() will no longer reference nil pointer that were supposed* to be a SearchFilter instance.

But as always, I would like to learn the reason.
Thank you!

@mttschltz
Copy link

I just came across this too. I want to omit the filter to search both page and database objects (which works with the sample curl request in the Notion docs).

But when omitting filter, e.g.

resp, err := client.Search.Do(c.Request().Context(),
	&notionapi.SearchRequest{
		Query: "test",
	})

the API returns the error "body failed validation: body.filter.property should be '\"object\"', instead was '\"\"'." because the request is sent with the body "{\"query\":\"test\",\"filter\":{\"value\":\"\",\"property\":\"\"}}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants