Notion API list endpoints return results across multiple cursor-based response pages. Given the already fetched responses in request order, implement a helper that combines the results arrays into one list and stops when a response has no next_cursor.
Implement collect_notion_results(responses). The input is a list of dictionaries matching the relevant Notion API response shape:
results is a list of items, which may be empty.next_cursor is either a string cursor or null when there are no more pages.Return one list containing all results from the first page through the page whose next_cursor is null. Ignore any responses after that terminal page. Preserve the original order of every result, including duplicates.
results list and a next_cursor valuenext_cursor is either a string or nulldef collect_notion_results(responses):