diff options
author | 2021-05-15 10:27:52 -0700 | |
---|---|---|
committer | 2021-05-15 10:28:02 -0700 | |
commit | a5fccf17f6cf477426c17216b1bc7628e0434d79 (patch) | |
tree | 533eea69fbf6a9431827e2e209e0c56738468bd8 /src/models | |
parent | 371a3e49ffe52c2684030f4d3cb669a3aac2b3ca (diff) | |
download | notion-a5fccf17f6cf477426c17216b1bc7628e0434d79.tar.gz notion-a5fccf17f6cf477426c17216b1bc7628e0434d79.tar.zst notion-a5fccf17f6cf477426c17216b1bc7628e0434d79.zip |
working database queries
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/search.rs | 10 | ||||
-rw-r--r-- | src/models/tests/query_result.json | 43 |
2 files changed, 48 insertions, 5 deletions
diff --git a/src/models/search.rs b/src/models/search.rs index 09a74b4..7b14aa2 100644 --- a/src/models/search.rs +++ b/src/models/search.rs @@ -72,19 +72,19 @@ pub enum PropertyCondition { #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct FilterCondition { - property: String, + pub property: String, #[serde(flatten)] - condition: PropertyCondition, + pub condition: PropertyCondition, } #[derive(Serialize, Debug, Eq, PartialEq, Default)] pub struct DatabaseQuery { #[serde(skip_serializing_if = "Option::is_none")] - sorts: Option<Sort>, + pub sorts: Option<Sort>, #[serde(skip_serializing_if = "Option::is_none")] - filter: Option<FilterCondition>, + pub filter: Option<FilterCondition>, #[serde(flatten)] - paging: Option<Paging>, + pub paging: Option<Paging>, } #[derive(Debug, Eq, PartialEq)] diff --git a/src/models/tests/query_result.json b/src/models/tests/query_result.json new file mode 100644 index 0000000..56b8834 --- /dev/null +++ b/src/models/tests/query_result.json @@ -0,0 +1,43 @@ +{ + "object": "list", + "results": [ + { + "object": "page", + "id": "bb85a889-3eb3-4146-9325-80508fb5e23d", + "created_time": "2021-05-15T17:16:51.364Z", + "last_edited_time": "2021-05-15T17:16:00.000Z", + "parent": { + "type": "database_id", + "database_id": "5d794de0-2224-49d3-86f9-3540db13d884" + }, + "archived": false, + "properties": { + "Name": { + "id": "title", + "type": "title", + "title": [ + { + "type": "text", + "text": { + "content": "First", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "First", + "href": null + } + ] + } + } + } + ], + "next_cursor": null, + "has_more": false +} |