notion_api 1.0.0-beta2 copy "notion_api: ^1.0.0-beta2" to clipboard
notion_api: ^1.0.0-beta2 copied to clipboard

outdated

A wrapper for the public beta Notion API to manage it like a Notion SDK package for dart.

Notion API client for dart.

CI

See the ROADMAP file to see what is coming next.

Usage #

Important: The methods return a NotionResponse. You can find how to use it in its documentation.

NotionClient class #

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');

Individual classes #

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();

Some examples #

To see more examples go here.

Append blocks children #

// 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 #

// 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);

Next release #

v1.0.0: #

Release date: 25/Jun/2021

Changes #

  • Fix any error

Contributions #

Please help, I don't even know if what I'm doing is right.

27
likes
0
pub points
46%
popularity

Publisher

unverified uploader

A wrapper for the public beta Notion API to manage it like a Notion SDK package for dart.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http

More

Packages that depend on notion_api