Notion API client for dart.
See the ROADMAP file to see what is coming next.
Important: The methods return a NotionResponse
. You can find how to use it in its documentation.
You only have to create a new instance of the NotionClient
class and all the API requests will be available as class methods.
NotionClient notion = NotionClient(token: 'YOUR SECRET TOKEN FROM INTEGRATIONS PAGE');
You can also use individual request group class like NotionPagesClient
or NotionDatabasesClient
. They are used like the main client but the methods are class methods instead of class properties methods.
Example
// With main class
NotionClient notion = NotionClient(token: 'YOUR_TOKEN');
notion.databases.fetchAll();
// With individual class
NotionDatabasesClient databases = NotionDatabasesClient(token: 'YOUR_TOKEN');
databases.fetchAll();
To see more examples go here.
// Create children instance:
Children children = Children().addAll([
Heading(text: Text('Test')),
Paragraph(texts: [
Text('Lorem ipsum (A)'),
Text('Lorem ipsum (B)',
annotations: TextAnnotations(
bold: true,
underline: true,
color: ColorsTypes.Orange,
))
])
]);
// Send the instance to Notion
notion.blocks.append(
to: 'YOUR_BLOCK_ID',
children: children,
);
// Create a page instance
Page page = Page(
parent: Parent.database(id: 'YOUR_DATABASE_ID'),
title: Text('NotionClient (v1): Page test'),
);
// Send the instance to Notion.
notion.pages.create(page);
Release date: 25/Jun/2021
- Fix any error
Please help, I don't even know if what I'm doing is right.