paginate

fun <T> paginate(items: List<T>, cursor: String?, pageSize: Int): Pair<List<T>, String?>

Returns a sub-list of items plus a nextCursor if there's another page.