in ci/delete-packages-from-space/build.gradle.kts [85:98]
suspend fun <T> forAllInAllBatches(
getBatch: suspend (BatchInfo) -> Batch<T>,
fn: suspend (T) -> Unit
) {
for (batchInfo in batches()) {
val batch = getBatch(batchInfo)
for (element in batch.data) {
fn(element)
}
if (batch.data.isEmpty() || (batch.next.toIntOrNull() ?: 0) >= (batch.totalCount ?: 0)) return
}
}