Dom*_*áha 5 notion-api notion-js
请问有没有办法可以方便的获取数据库的页数?
由于我没有找到任何端点,因此我想出了这个不太好的解决方案:
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)
我错过了文档中的某些内容吗?