diff options
author | 2021-05-16 22:16:11 -0700 | |
---|---|---|
committer | 2021-05-16 22:38:43 -0700 | |
commit | ddeced347b45f66e8dfdbaff0cae6da50a600539 (patch) | |
tree | 7c9bfe080710d477cd0bb8dfea13ae7ac6b63040 /src/lib.rs | |
parent | bb1f98f8e126658a658409fd1b317ae66148cfa6 (diff) | |
download | notion-ddeced347b45f66e8dfdbaff0cae6da50a600539.tar.gz notion-ddeced347b45f66e8dfdbaff0cae6da50a600539.tar.zst notion-ddeced347b45f66e8dfdbaff0cae6da50a600539.zip |
all blocks
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 25 |
1 files changed, 10 insertions, 15 deletions
@@ -111,7 +111,7 @@ impl NotionApi { Ok(NotionApi::make_json_request( self.client.get(&format!( "https://api.notion.com/v1/blocks/{block_id}/children", - block_id = block_id.id().id() + block_id = block_id.id() )) ).await?) } @@ -123,8 +123,8 @@ mod tests { use crate::models::search::{ DatabaseQuery, FilterCondition, FilterProperty, FilterValue, NotionSearch, TextCondition, }; - use crate::models::Object; - use crate::NotionApi; + use crate::models::{Object, BlockId}; + use crate::{NotionApi, Identifiable}; fn test_token() -> String { let token = { @@ -225,19 +225,14 @@ mod tests { }) .await?; - for page in search_response.results() { - let response = api - .get_block_children(page) - .await?; - } - + println!("{:?}", search_response.results.len()); - // let db = response.results()[0].clone(); - // - // // todo: fix this clone issue - // let db_result = api.get_database(db.clone()).await?; - // - // assert_eq!(db, db_result); + for object in search_response.results { + let _block = match object { + Object::Page { page } => api.get_block_children(BlockId::from(page.id())).await.unwrap(), + _ => panic!("Should not have received anything but pages!") + }; + } Ok(()) } |