1.0.0 • Published 3 years ago

notion-augment v1.0.0

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

notion-augment

Augment your Notion databases on command, à la Man-Computer Symbiosis.

usage

const augment = require("notion-augment");

require("dotenv").config();

function concatenateTitle(arr) {
  return arr.map((i) => i.text.content).join("");
}

augment(
  {
    token: process.env.NOTION_TOKEN,
    database: process.env.NOTION_DATABASE_ID,
    sorts: [],
  },
  (row) => {
    const seed = concatenateTitle(row.properties.Seed.title);
    const url = `https://hashpng.jordanscales.com/circles/685/360/${seed}.png`;
    // https://developers.notion.com/reference/patch-page
    return {
      Art: {
        files: [
          {
            type: "external",
            name: `${seed}.png`,
            external: { url },
          },
        ],
      },
    };
  }
);

augment