小编Dom*_*áha的帖子

如何获取数据库中的页数

请问有没有办法可以方便的获取数据库的页数?

由于我没有找到任何端点,因此我想出了这个不太好的解决方案:

  let count = 0
  let hasMore = true
  let nextCursor = undefined

  while (hasMore) {
    const result: QueryDatabaseResponse = await notion.databases.query({
      database_id: databaseId,
      start_cursor: nextCursor ?? undefined,
    })
    count += result.results.length
    hasMore = result.has_more
    nextCursor = result.next_cursor
  }
Run Code Online (Sandbox Code Playgroud)

我错过了文档中的某些内容吗?

notion-api notion-js

5
推荐指数
0
解决办法
909
查看次数

标签 统计

notion-api ×1

notion-js ×1