pub struct Notion {
pub api_key: String,
pub database_id: String,
}
Expand description
Notion API client
Fields§
§api_key: String
Notion API key: set from the NOTION_API_KEY
environment variable
database_id: String
Notion database ID: set from the NOTION_DATABASE_ID
environment variable
Implementations§
Source§impl Notion
impl Notion
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Notion API client.
environment variables are read from the .env
file.
Sourcepub async fn retrieve_a_database(&self) -> Result<Database>
pub async fn retrieve_a_database(&self) -> Result<Database>
Sourcepub async fn query_database(&self, filter: QueryFilter) -> Result<PageResponse>
pub async fn query_database(&self, filter: QueryFilter) -> Result<PageResponse>
Sourcepub async fn create_a_page(&self, page: &Page) -> Result<Page>
pub async fn create_a_page(&self, page: &Page) -> Result<Page>
Sourcepub async fn archive_a_page(
&self,
page_id: String,
parent_id: String,
parent_type: ParentType,
) -> Result<Page>
pub async fn archive_a_page( &self, page_id: String, parent_id: String, parent_type: ParentType, ) -> Result<Page>
Sourcepub async fn append_block_children(
&self,
parent_id: String,
blocks: Vec<Block>,
) -> Result<BlockResponse>
pub async fn append_block_children( &self, parent_id: String, blocks: Vec<Block>, ) -> Result<BlockResponse>
§Append block children
Because the Notion API only allows appending 100 blocks at a time, this method will split the blocks into chunks of 100 and append them to the parent block.
§Arguments:
- parent_id: String
- blocks:
BlockBody
§Return:
BlockResponse
struct
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Notion
impl RefUnwindSafe for Notion
impl Send for Notion
impl Sync for Notion
impl Unpin for Notion
impl UnwindSafe for Notion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more