Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Base datasource for Kitsu items
abstract class KitsuLimitOffsetNetworkDataSource<T> protected constructor(
val dataProvider: KitsuRestApi) : TiledDataSource<T>() {
var queryFilter: String = ""
override fun countItems(): Int = DataSource.COUNT_UNDEFINED
protected abstract fun convertToItems(items: KitsuResponse, size: Int): List<T>
override fun loadRange(startPosition: Int, loadCount: Int): List<T>? {
val response = dataProvider.getKitsu(queryFilter, startPosition, loadCount).execute().body()
return convertToItems(response,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.