From 19d87e6ee3ae44c5b1c853adf00329a894778b06 Mon Sep 17 00:00:00 2001 From: Jake Swenson Date: Sun, 16 May 2021 22:23:37 -0700 Subject: feat: adding proper error type with snafu (#8) --- src/models/search.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/models/search.rs') diff --git a/src/models/search.rs b/src/models/search.rs index 6acf847..6de3c8a 100644 --- a/src/models/search.rs +++ b/src/models/search.rs @@ -17,13 +17,6 @@ pub enum SortTimestamp { LastEditedTime, } -#[derive(Serialize, Debug, Eq, PartialEq, Hash, Copy, Clone)] -#[serde(rename_all = "snake_case")] -pub enum DatabaseSortTimestamp { - CreatedTime, - LastEditedTime, -} - #[derive(Serialize, Debug, Eq, PartialEq, Hash, Copy, Clone)] #[serde(rename_all = "snake_case")] pub enum FilterValue { @@ -276,15 +269,22 @@ pub struct FilterCondition { pub condition: PropertyCondition, } +#[derive(Serialize, Debug, Eq, PartialEq, Hash, Copy, Clone)] +#[serde(rename_all = "snake_case")] +pub enum DatabaseSortTimestamp { + CreatedTime, + LastEditedTime, +} + #[derive(Serialize, Debug, Eq, PartialEq, Clone)] pub struct DatabaseSort { // Todo: Should property and timestamp be mutually exclusive? (i.e a flattened enum?) // the documentation is not clear: // https://developers.notion.com/reference/post-database-query#post-database-query-sort - property: Option, + pub property: Option, /// The name of the timestamp to sort against. - timestamp: Option, - direction: SortDirection, + pub timestamp: Option, + pub direction: SortDirection, } #[derive(Serialize, Debug, Eq, PartialEq, Default)] @@ -322,13 +322,13 @@ impl From for SearchRequest { timestamp, } => SearchRequest { sort: Some(Sort { - direction, timestamp, + direction, }), ..Default::default() }, - NotionSearch::Filter { value, property } => SearchRequest { - filter: Some(Filter { value, property }), + NotionSearch::Filter { property, value } => SearchRequest { + filter: Some(Filter { property, value }), ..Default::default() }, } -- cgit v1.2.3