aboutsummaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/models')
-rw-r--r--src/models/error.rs10
-rw-r--r--src/models/paging.rs5
-rw-r--r--src/models/properties/tests.rs2
-rw-r--r--src/models/search.rs5
-rw-r--r--src/models/tests.rs56
5 files changed, 49 insertions, 29 deletions
diff --git a/src/models/error.rs b/src/models/error.rs
index e382719..db5ff3f 100644
--- a/src/models/error.rs
+++ b/src/models/error.rs
@@ -12,7 +12,10 @@ impl StatusCode {
}
impl Display for StatusCode {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ fn fmt(
+ &self,
+ f: &mut Formatter<'_>,
+ ) -> std::fmt::Result {
self.0.fmt(f)
}
}
@@ -46,7 +49,10 @@ pub enum ErrorCode {
}
impl Display for ErrorCode {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ fn fmt(
+ &self,
+ f: &mut Formatter<'_>,
+ ) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
diff --git a/src/models/paging.rs b/src/models/paging.rs
index 0f42f23..c38ae11 100644
--- a/src/models/paging.rs
+++ b/src/models/paging.rs
@@ -13,5 +13,8 @@ pub struct Paging {
}
pub trait Pageable {
- fn start_from(self, starting_point: Option<PagingCursor>) -> Self;
+ fn start_from(
+ self,
+ starting_point: Option<PagingCursor>,
+ ) -> Self;
}
diff --git a/src/models/properties/tests.rs b/src/models/properties/tests.rs
index 022f080..86bead8 100644
--- a/src/models/properties/tests.rs
+++ b/src/models/properties/tests.rs
@@ -3,7 +3,7 @@ use chrono::NaiveDate;
#[test]
fn verify_date_parsing() {
- let date = NaiveDate::from_ymd(2021, 01, 02);
+ let date = NaiveDate::from_ymd_opt(2021, 01, 02).unwrap();
let result = serde_json::to_string(&DateOrDateTime::Date(date)).unwrap();
let parsed: DateOrDateTime = serde_json::from_str(&result).unwrap();
println!("{:?}", parsed);
diff --git a/src/models/search.rs b/src/models/search.rs
index e7d8189..ab7567f 100644
--- a/src/models/search.rs
+++ b/src/models/search.rs
@@ -301,7 +301,10 @@ pub struct DatabaseQuery {
}
impl Pageable for DatabaseQuery {
- fn start_from(self, starting_point: Option<PagingCursor>) -> Self {
+ fn start_from(
+ self,
+ starting_point: Option<PagingCursor>,
+ ) -> Self {
DatabaseQuery {
paging: Some(Paging {
start_cursor: starting_point,
diff --git a/src/models/tests.rs b/src/models/tests.rs
index 67e952d..1f41991 100644
--- a/src/models/tests.rs
+++ b/src/models/tests.rs
@@ -62,30 +62,38 @@ fn rich_text() {
fn rich_text_mention_user_person() {
let rich_text_mention_user_person: RichText =
serde_json::from_str(include_str!("tests/rich_text_mention_user_person.json")).unwrap();
- assert_eq!(rich_text_mention_user_person, RichText::Mention {
- rich_text: RichTextCommon {
- plain_text: "@John Doe".to_string(),
- href: None,
- annotations: Some(Annotations {
- bold: Some(false),
- code: Some(false),
- color: Some(TextColor::Default),
- italic: Some(false),
- strikethrough: Some(false),
- underline: Some(false),
- }),
- },
- mention: MentionObject::User {
- user: User::Person {
- common: UserCommon {
- id: UserId::from_str("1118608e-35e8-4fa3-aef7-a4ced85ce8e0").unwrap(),
- name: Some("John Doe".to_string()),
- avatar_url: Some("https://secure.notion-static.com/e6a352a8-8381-44d0-a1dc-9ed80e62b53d.jpg".to_string()),
- },
- person: Person { email: "john.doe@gmail.com".to_string() },
- }
- },
- })
+ assert_eq!(
+ rich_text_mention_user_person,
+ RichText::Mention {
+ rich_text: RichTextCommon {
+ plain_text: "@John Doe".to_string(),
+ href: None,
+ annotations: Some(Annotations {
+ bold: Some(false),
+ code: Some(false),
+ color: Some(TextColor::Default),
+ italic: Some(false),
+ strikethrough: Some(false),
+ underline: Some(false),
+ }),
+ },
+ mention: MentionObject::User {
+ user: User::Person {
+ common: UserCommon {
+ id: UserId::from_str("1118608e-35e8-4fa3-aef7-a4ced85ce8e0").unwrap(),
+ name: Some("John Doe".to_string()),
+ avatar_url: Some(
+ "https://secure.notion-static.com/e6a352a8-8381-44d0-a1dc-9ed80e62b53d.jpg"
+ .to_string()
+ ),
+ },
+ person: Person {
+ email: "john.doe@gmail.com".to_string()
+ },
+ }
+ },
+ }
+ )
}
#[test]