Functions

archive-page

fn (page-id: Str): Map
fn (page-id: Str, opts: Map): Map

PATCH /pages/{id} with archived: true - Move a page to the trash.

Example

::notion::pages/archive-page("59833787-2cf9-4fdf-8782-e53db20768a5")

create-database-page

fn (database-id: Str, properties: Map): Map
fn (database-id: Str, properties: Map, opts: Map): Map

POST /pages with a database parent - Add a row to a database. properties uses the database's property shapes.

Example

::notion::pages/create-database-page("d9824bdc-8445-4327-be8b-5b47500af6ce", {
  Name: {title: ::notion/rich-text("Ship web-search")},
  Status: {status: {name: "In progress"}},
  Priority: {number: 2}
})

create-page

fn (parent-page-id: Str, title: Str): Map
fn (parent-page-id: Str, title: Str, children: Vec): Map
fn (parent-page-id: Str, title: Str, children: Vec, opts: Map): Map

POST /pages - Create a page under a parent page, with a title and optional content blocks (build them with the ::notion block helpers). For database rows use create-database-page.

Example

page ::notion::pages/create-page("59833787-2cf9-4fdf-8782-e53db20768a5", "Retro notes", [
  ::notion/heading(2, "What went well"),
  ::notion/bullet("The webhook primitives held up")
])
page.url

get-page

fn (page-id: Str): Map
fn (page-id: Str, opts: Map): Map

GET /pages/{id} - A page's properties (not its content — use ::notion::blocks/get-children for that).

Example

page ::notion::pages/get-page("59833787-2cf9-4fdf-8782-e53db20768a5")
page.properties

update-page

fn (page-id: Str, properties: Map): Map
fn (page-id: Str, properties: Map, opts: Map): Map

PATCH /pages/{id} - Update page properties (same shapes as create-database-page); {archived: true} moves a page to the trash via archive-page.

Example

::notion::pages/update-page("59833787-2cf9-4fdf-8782-e53db20768a5", {
  Status: {status: {name: "Done"}}
})