1
Append Block Children
One script reply has been approved by the moderators Verified
Created by fatona3bh6e 683 days ago Viewed 4223 times
0
Submitted by adam186 Deno
Verified 360 days ago
1
import { Client } from "npm:@notionhq/client";
2
import type { BlockObjectRequest } from "npm:@notionhq/client/2.2.4/build/src/api-endpoints.js";
3

4
/**
5
 * Learn more at
6
 * https://developers.notion.com/reference/patch-block-children
7
 */
8
type Notion = {
9
  token: string;
10
};
11
export async function main(
12
  auth: Notion,
13
  block_id: string,
14
  children: object[] = [],
15
) {
16
  const client = new Client({ auth: auth.token });
17
  return await client.blocks.children.append({
18
    block_id,
19
    children: children as BlockObjectRequest,
20
  });
21
}
22