notion-dotnet / notion-sdk-net

A Notion SDK for .Net
MIT License
181 stars 46 forks source link

Body validation fail when using TimestampLastEditedTimeFilter in DB querry. #365

Closed adrianhrinko closed 12 months ago

adrianhrinko commented 1 year ago

The issue: When querying a database with the TimestampLastEditedTimeFilter, body validation fails as the Timestamp value should contain "last_edited_time" instead of "last_modified_time".

To reproduce:

var dateFilter = new DateFilter("When", onOrAfter: DateTime.Now);
var editedFilter = new LastEditedTimeFilter(onOrAfter: DateTime.Today);
var queryParams = new DatabasesQueryParameters { Filter = new CompoundFilter(and: new Filter[] {dateFilter, editedFilter}.ToList()) };
 var pages = await client.Databases.QueryAsync(databaseId, queryParams);

https://github.com/notion-dotnet/notion-sdk-net/blob/f5c40c6d4f958649ff216fcbf82de760f22efafc/Src/Notion.Client/Models/Filters/TimestampLastEditedTimeFilter.cs#L42

Fix: Replace "last_modified_time" with "last_edited_time". It works for me.

KoditkarVedant commented 1 year ago

Do you think it has something to with the Notion-Version we use? I wonder if that field was renamed recently. Would you like to submit a PR?

Dmitry-VF commented 1 year ago

I ran into the same issue. @KoditkarVedant if you are interested in a fix, please see my pull request: https://github.com/notion-dotnet/notion-sdk-net/pull/369

KoditkarVedant commented 1 year ago

@Dmitry-VF Thank you for providing the fix. I will try to take a look at this following weekend. I'm just not able to spend time on this project for the past few months.

KoditkarVedant commented 12 months ago

This has been released as part of 4.2.0