0.2.0 • Published 4 years ago

notase v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

notase

Easily use a Notion table as a database.

Installation

const { getDataFromNotion } = require('notase');

getDataFromNotion('YOUR API TOKEN', 'YOUR DATABASE ID')
  .then((data) => {
    // data will be all the rows in your table, an array of objects with each column as a property
  });

Parsers

Default parsers are provided for the main data types (title, rich_text, multi_select, number, url, files) but can be customized if a third argument is passed.

This is in no way exhaustive and is mainly what's needed for personal use, so feel free to use your own column parsers.

Methods

getDataFromNotion(notionApiToken, notionDatabaseId, parsers) ⇒ Promise.<Array.<T>>

Gets all the desired database data from Notion. It will read all pages until the full table is ready and return the parsed content.

Kind: global function
Returns: Promise.<Array.<T>> - The parsed database results

ParamTypeDefaultDescription
notionApiTokenstringNotion's API token
notionDatabaseIdstringNotion database ID to get results from
parsersRecord.<string, function()>ParsersThe custom parsers for your needs