Crate notion_rs[][src]

notion-rs: Rust Wrappers around the Notion.so note-taking application.

This crate provides useful wrappers and Notion’s unofficial API.

This crate has not been yet updated for the upcoming offical API release!

Once this API is released, you’ll be able to perform authorization, reads, and writes valid notion workspaces.

For now, if you have your TokenV2, then you too can read and write to a notion workspace.

#[async_std::main]
async fn main() {
    // Don't commit your token to git!
    let token = std::env::var("NOTION_TOKEN_V2").unwrap();

    let mut client = notion_rs::builder(token.as_str()).build();

    let blocks = client
        .get_page("https://www.notion.so/157765353f2c4705bd45474e5ba8b46c")
        .await
        .unwrap();

    println!("{:#?}", blocks);
}

Usage

Most functionality of this crate is managed by the NotionClient, NotionQuery, and NotionBlock.

  • NotionBlock: A single block in a notion workspace. Has an enum-based type
  • NotionQuery: Craft HTTP queries to the Notion API endpoint.
  • NotionClient: Wrap a Reqwest HTTP client with functionaity

Structs

ClientConfig

The ClientConfig provides some configuration options to a NotionClient

NotionBlock
NotionClient

This struct provides access to the Notion.so API via a Reqwest client.

Enums

BlockData

Internal data for Notion Blocks Note that every field might not be captured

NotionEndpoint
NotionQuery

Functions

builder

Create a new ClientBuilder to generate a new `NotionClient