Pager

class Pager<T>(val name: String, val pageSize: Int? = null, request: suspend (String?) -> Triple<List<T>?, String?, HttpResponse?>) : Flow<T>

A generic pagination class that implements Flow of T items.

Exposes page-level properties via byPage() flow, or collects all items seamlessly via collect(). This flow is cold, stateless, and thread-safe.

Constructors

Link copied to clipboard
constructor(name: String, pageSize: Int? = null, request: suspend (String?) -> Triple<List<T>?, String?, HttpResponse?>)

Properties

Link copied to clipboard
Link copied to clipboard
val pageSize: Int? = null

Functions

Link copied to clipboard
fun byPage(): Flow<Page<T>>

Returns a Flow that emits Page objects, allowing granular access to page-level metadata such as Page.nextPageToken and Page.sdkHttpResponse.

Link copied to clipboard
open suspend override fun collect(collector: FlowCollector<T>)

Collects and emits all items across all available pages.