Simple Notion
Easy to use library to read Notion DataBase using the NotionAPI.
Disclaimer
Please note that this library is not officially supported by the Notion team.
Features
- Read Data-Base
Getting Started
API Client
To start you need to get access to the API using the NotionClient.
let mut client = crate default;
// Added the full URL of the database page:
client.set_url;
// And you need to pass your integration token
client.set_token;
Get the DataBase
Now you have the access, and need to download the data-base.
// Get the Raw Json data-base
let data_base = client.get_table_sync.unwrap;
Parse the data-base
You will convert each element to an enum named DataType. To do it you need the NotionResponseParser
// Take the data_base as input
let parser = crate new;
Let's simplify
Now you have have the data-base and the parser. So you can create a NotionDataBase.
let data_table = crate new;
Access an element
Great! You have done the setup, let's use it.
// Getting the element.
let element = parser.parse_element;
// Priting the result
println!;
Some other useful functions
// Get the Vec<String> of all lines titles
data_table.get_line_list;
// Get the Vec<String> of all columns names
data_table.get_column_list;
// Parse the full data-base to a Vec<Vec<DataType>>
data_table.get_all