UNPKG

@udus/notion-renderer

Version:
19 lines (18 loc) 621 B
import { callAPIWithBackOff } from "../../utils/api.js"; export const listBlockChildren = async (client, args) => { const result = await callAPIWithBackOff(client.blocks.children.list, args); if (!result.ok) { return result; } let blockList = result.data.results; if (result.data.next_cursor) { const nextResults = await listBlockChildren(client, { ...args, start_cursor: result.data.next_cursor, }); if (nextResults.ok) { blockList = [...blockList, ...nextResults.data]; } } return { ok: true, data: blockList }; };