Crates.io | notionrs |
lib.rs | notionrs |
version | 1.0.0-alpha.21 |
source | src |
created_at | 2024-10-22 19:22:04.968679 |
updated_at | 2024-12-12 11:16:20.024076 |
description | A Notion API client that provides type-safe request serialization and response deserialization |
homepage | |
repository | https://github.com/46ki75/notionrs |
max_upload_size | |
id | 1419149 |
size | 757,087 |
Status: Alpha Release! (Under Construction) 🚧
This project is currently under active development and is not yet ready for production use. Features and API stability may change without notice. Contributions and feedback are welcome!
As part of the alpha release, the following features are available. Please note that API changes may occur before the official release.
Below is a basic example. (More detailed documentation is coming soon, so please stay tuned!)
use notionrs::{
block::{Block, ParagraphBlock},
error::Error,
Client, RichText,
};
#[tokio::main]
async fn main() -> Result<(), Error> {
dotenvy::dotenv().ok();
let client = Client::new();
// Here, we're retrieving the ID from an environment variable,
// but you can change the method of retrieval to suit your needs.
let block_id = std::env::var("NOTION_PAGE_ID").unwrap();
let block = Block::Paragraph {
paragraph: ParagraphBlock::new()
.rich_text(vec![RichText::from("Time to start with Notion in Rust")]),
};
let request = client
.append_block_children()
.block_id(block_id.clone())
.children(vec![block]);
let response = request.send().await?;
println!("{:?}", response);
Ok(())
}