diff options
author | 2021-05-15 23:55:19 -0700 | |
---|---|---|
committer | 2021-05-16 22:17:54 -0700 | |
commit | e1005f715bde3fb260d97a1a08e3e1de358471d6 (patch) | |
tree | e4d8baeb42d9fd74699aec99c9804aa67571f4db /src/lib.rs | |
parent | a2dc79a5079d6286ebd148cf25a00e5dd013efdc (diff) | |
download | notion-e1005f715bde3fb260d97a1a08e3e1de358471d6.tar.gz notion-e1005f715bde3fb260d97a1a08e3e1de358471d6.tar.zst notion-e1005f715bde3fb260d97a1a08e3e1de358471d6.zip |
wip
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1,10 +1,10 @@ use crate::models::search::{DatabaseQuery, SearchRequest}; -use crate::models::{Database, DatabaseId, ListResponse, Object, Page}; +use crate::models::{Database, DatabaseId, ListResponse, Object, Page, Block}; use reqwest::header::{HeaderMap, HeaderValue}; use reqwest::{header, Client, ClientBuilder, RequestBuilder}; use serde::de::DeserializeOwned; -mod models; +pub mod models; const NOTION_API_VERSION: &'static str = "2021-05-13"; @@ -103,6 +103,18 @@ impl NotionApi { ) .await?) } + + pub async fn get_block_children<T: Identifiable>( + &self, + block_id: T + ) -> Result<ListResponse<Block>, NotionApiClientError> { + Ok(NotionApi::make_json_request( + self.client.get(&format!( + "https://api.notion.com/v1/blocks/{block_id}/children", + block_id = block_id.id(). + )) + ).await?) + } } #[cfg(test)] |