Retrieve Page

Script notion Verified

by sebastienhorse ยท 6/6/2022

The script

Submitted by hugo989 Bun
Verified 4 days ago
1
import { Client } from "@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

Other submissions
  • Submitted by adam186 Deno
    Created 396 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