0
Retrieve Block Children
One script reply has been approved by the moderators Verified
Created by adam186 338 days ago Viewed 2297 times
0
Submitted by adam186 Deno
Verified 338 days ago
1
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
2
import { Client } from "npm:@notionhq/client";
3

4
/**
5
 * Learn more at
6
 * https://developers.notion.com/reference/get-block-children
7
 */
8
type Notion = {
9
  token: string;
10
};
11
export async function main(
12
  auth: Notion,
13
  block_id: string,
14
  start_cursor?: string,
15
  page_size?: number,
16
) {
17
  const client = new Client({ auth: auth.token });
18
  const args = removeObjectEmptyFields({
19
    block_id,
20
    start_cursor,
21
    page_size,
22
  });
23
  return await client.blocks.children.list(args);
24
}
25