Edits history of script submission #22477 for ' Append Block Children (notion)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { Client } from "@notionhq/client";
    import type { BlockObjectRequest } from "@notionhq/client/build/src/api-endpoints";
    
    /**
     * Learn more at
     * https://developers.notion.com/reference/patch-block-children
     */
    type Notion = {
      token: string;
    };
    export async function main(
      auth: Notion,
      block_id: string,
      children: object[] = [],
    ) {
      const client = new Client({ auth: auth.token });
      return await client.blocks.children.append({
        block_id,
        children: children as BlockObjectRequest,
      });
    }
    

    Submitted by hugo989 7 days ago