Skip to main content
openbridge.collections.list().after(cursor)
Sets the cursor for forward pagination. Use to fetch the next page.

Parameters

ParamTypeRequiredDescription
cursorstringYespageInfo.endCursor from previous response

Returns

CollectionListBuilder (chainable)

Examples

Basic pagination

// First page
const page1 = await openbridge.collections.list().limit(10)

// Next page
if (page1.pageInfo.hasNextPage) {
    const page2 = await openbridge.collections
        .list()
        .limit(10)
        .after(page1.pageInfo.endCursor)
}
const page1 = await openbridge.collections.list().search('sale').limit(10)

const page2 = await openbridge.collections
    .list()
    .search('sale')
    .limit(10)
    .after(page1.pageInfo.endCursor)

Load all collections

async function loadAll() {
    const all = []
    let cursor = null
    let hasMore = true

    while (hasMore) {
        let query = openbridge.collections.list().limit(100)
        if (cursor) query = query.after(cursor)

        const { items, pageInfo } = await query

        all.push(...items)
        hasMore = pageInfo.hasNextPage
        cursor = pageInfo.endCursor
    }

    return all
}