aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorGravatar Jake Swenson <jake@jakeswenson.com> 2021-05-14 07:33:45 -0700
committerGravatar Jake Swenson <jake@jakeswenson.com> 2021-05-14 07:33:45 -0700
commit8a6ee9bca902db076be12745967a69c7c184e044 (patch)
tree480244bde1110a33bf4bcd7f18b2406ff7bc8571 /src/lib.rs
parentb22ae2cf8a9e2b6af1a54f79ecdb31ad4d2c31c5 (diff)
downloadnotion-8a6ee9bca902db076be12745967a69c7c184e044.tar.gz
notion-8a6ee9bca902db076be12745967a69c7c184e044.tar.zst
notion-8a6ee9bca902db076be12745967a69c7c184e044.zip
split models
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 53e639f..7fbaa15 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,5 @@
use crate::models::search::SearchRequest;
use crate::models::{Database, ListResponse};
-use std::collections::HashMap;
mod models;
@@ -54,11 +53,15 @@ mod tests {
use crate::NotionApi;
const TEST_TOKEN: &'static str = include_str!(".api_token");
+ fn test_client() -> NotionApi {
+ NotionApi {
+ token: TEST_TOKEN.trim().to_string(),
+ }
+ }
+
#[tokio::test]
async fn list_databases() -> Result<(), Box<dyn std::error::Error>> {
- let api = NotionApi {
- token: TEST_TOKEN.to_string(),
- };
+ let api = test_client();
dbg!(api.list_databases().await?);
@@ -67,9 +70,7 @@ mod tests {
#[tokio::test]
async fn search() -> Result<(), Box<dyn std::error::Error>> {
- let api = NotionApi {
- token: TEST_TOKEN.to_string(),
- };
+ let api = test_client();
dbg!(
api.search(NotionSearch::Filter {