diff --git a/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs b/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs
index 60cd7122..7e1189a6 100644
--- a/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs
+++ b/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs
@@ -8,7 +8,6 @@ public class SearchSort
{
public SearchDirection Direction { get; set; }
- [JsonConverter(typeof(IsoDateTimeConverter))]
- public DateTime Timestamp { get; set; }
+ public string Timestamp { get; set; }
}
}
diff --git a/Test/Notion.UnitTests/Notion.UnitTests.csproj b/Test/Notion.UnitTests/Notion.UnitTests.csproj
index d7525cb2..8b4c91e4 100644
--- a/Test/Notion.UnitTests/Notion.UnitTests.csproj
+++ b/Test/Notion.UnitTests/Notion.UnitTests.csproj
@@ -78,6 +78,9 @@
Always
+
+ Always
+
diff --git a/Test/Notion.UnitTests/SearchClientTest.cs b/Test/Notion.UnitTests/SearchClientTest.cs
new file mode 100644
index 00000000..aa506572
--- /dev/null
+++ b/Test/Notion.UnitTests/SearchClientTest.cs
@@ -0,0 +1,71 @@
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using FluentAssertions;
+using Notion.Client;
+using WireMock.ResponseBuilders;
+using Xunit;
+
+namespace Notion.UnitTests
+{
+ public class SearchClientTest : ApiTestBase
+ {
+ private readonly SearchClient _client;
+
+ public SearchClientTest()
+ {
+ _client = new SearchClient(new RestClient(ClientOptions));
+ }
+
+ [Fact]
+ public async Task Search()
+ {
+ // Arrange
+ var path = ApiEndpoints.SearchApiUrls.Search();
+ var jsonData = await File.ReadAllTextAsync("data/search/SearchResponse.json");
+
+ Server.Given(CreatePostRequestBuilder(path))
+ .RespondWith(
+ Response.Create()
+ .WithStatusCode(200)
+ .WithBody(jsonData)
+ );
+
+ SearchParameters searchParameters = new SearchParameters()
+ {
+ Query = "External tasks",
+ Sort = new SearchSort
+ {
+ Direction = SearchDirection.Ascending,
+ Timestamp = "last_edited_time"
+ }
+ };
+
+ // Act
+ var searchResult = await _client.SearchAsync(searchParameters);
+
+ // Assert
+ var results = searchResult.Results;
+
+ results.Should().SatisfyRespectively(
+ obj =>
+ {
+ obj.Object.Should().Be(ObjectType.Database);
+
+ var database = (Database)obj;
+ database.Properties.Should().HaveCount(2);
+ },
+ obj =>
+ {
+ obj.Object.Should().Be(ObjectType.Page);
+
+ var page = (Page)obj;
+ page.IsArchived.Should().BeFalse();
+ page.Properties.Should().HaveCount(1);
+ page.Parent.Should().BeAssignableTo();
+ ((DatabaseParent)page.Parent).DatabaseId.Should().Be("e6c6f8ff-c70e-4970-91ba-98f03e0d7fc6");
+ }
+ );
+ }
+ }
+}
diff --git a/Test/Notion.UnitTests/data/search/SearchResponse.json b/Test/Notion.UnitTests/data/search/SearchResponse.json
new file mode 100644
index 00000000..107adcb3
--- /dev/null
+++ b/Test/Notion.UnitTests/data/search/SearchResponse.json
@@ -0,0 +1,82 @@
+{
+ "has_more": false,
+ "next_cursor": null,
+ "object": "list",
+ "results": [
+ {
+ "created_time": "2021-04-22T22:23:26.080Z",
+ "id": "e6c6f8ff-c70e-4970-91ba-98f03e0d7fc6",
+ "last_edited_time": "2021-04-23T04:21:00.000Z",
+ "object": "database",
+ "properties": {
+ "Name": {
+ "id": "title",
+ "title": {},
+ "type": "title"
+ },
+ "Task Type": {
+ "id": "vd@l",
+ "multi_select": {
+ "options": []
+ },
+ "type": "multi_select"
+ }
+ },
+ "title": [
+ {
+ "annotations": {
+ "bold": false,
+ "code": false,
+ "color": "default",
+ "italic": false,
+ "strikethrough": false,
+ "underline": false
+ },
+ "href": null,
+ "plain_text": "Tasks",
+ "text": {
+ "content": "Tasks",
+ "link": null
+ },
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "archived": false,
+ "created_time": "2021-04-23T04:21:00.000Z",
+ "id": "4f555b50-3a9b-49cb-924c-3746f4ca5522",
+ "last_edited_time": "2021-04-23T04:21:00.000Z",
+ "object": "page",
+ "parent": {
+ "database_id": "e6c6f8ff-c70e-4970-91ba-98f03e0d7fc6",
+ "type": "database_id"
+ },
+ "properties": {
+ "Name": {
+ "id": "title",
+ "title": [
+ {
+ "annotations": {
+ "bold": false,
+ "code": false,
+ "color": "default",
+ "italic": false,
+ "strikethrough": false,
+ "underline": false
+ },
+ "href": null,
+ "plain_text": "Task 1",
+ "text": {
+ "content": "Task1 1",
+ "link": null
+ },
+ "type": "text"
+ }
+ ],
+ "type": "title"
+ }
+ }
+ }
+ ]
+}