?
ThreadListPage
TypeBundles one page of the thread list: a batch of summaries plus a cursor.
What listThreads returns: a page of thread summaries plus a nextCursor. Pass the cursor back to listThreads for the next page, and stop when it comes back null.
ThreadListPage.ts
interface ThreadListPage { threads: ThreadSummary[] nextCursor: string | null }
Fields
threads
ThreadSummary[]
This page of thread summaries, newest first.
nextCursor
string | null
Pass to listThreads for the next page, or null when there are no more.
Follow the cursor
let cursor: string | undefined; do { const page: ThreadListPage = await chat.listThreads(cursor); render(page.threads); cursor = page.nextCursor ?? undefined; } while (cursor);