0
Retrieve Page
One script reply has been approved by the moderators Verified
Created by sebastienhorse 893 days ago Viewed 10693 times
0
Submitted by adam186 Deno
Verified 570 days ago
1
import { Client } from "npm:@notionhq/client";
2

3
/**
4
 * Learn more at
5
 * https://developers.notion.com/reference/retrieve-a-page
6
 */
7
type Notion = {
8
  token: string;
9
};
10
export async function main(
11
  auth: Notion,
12
  page_id: string,
13
  filter_properties?: string[],
14
) {
15
  const client = new Client({ auth: auth.token });
16
  if (!filter_properties?.filter(Boolean).length) {
17
    filter_properties = undefined;
18
  }
19
  return await client.pages.retrieve({
20
    page_id,
21
    filter_properties,
22
  });
23
}
24