PagingKeyConfig

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class PagingKeyConfig(val keySize: Int, val mapper: KClass<*>)

Author

skydoves (Jaewoong Eum)

Since

1.0.0

PagingKeyConfig contains the paging configurations on the service interface method to give information to the internal PagingCallAdapter.

@GET("pokemon")
@PagingKeyConfig(
keySize = 20,
mapper = PokemonPagingMapper::class
)
public suspend fun fetchPokemonList(
@Query("limit") limit: Int = 20,
@PagingKey @Query("offset") offset: Int = 0
): NetworkPagingSource<PokemonResponse, Pokemon>

Constructors

Link copied to clipboard
fun PagingKeyConfig(keySize: Int, mapper: KClass<*>)

Properties

Link copied to clipboard
val keySize: Int

Key size decides the size of the paging. This key size will be multiplied by the paging key value and decides the next paging offset.

Link copied to clipboard
val mapper: KClass<*>

Maps the response type to the list of a paging item, which must extends PagingMapper.