DataSource

interface DataSource<T>

Author

skydoves (Jaewoong Eum)

An abstract interface design for data sources.

Types

Link copied to clipboard
enum ConcatStrategy : Enum<DataSource.ConcatStrategy>

A concat strategy for determining to request continuously or stop when the first request got failed.

Functions

Link copied to clipboard
abstract fun combine(call: Call<T>, callback: Callback<T>?): DataSource<T>

combine a call and a callback to the DataSource.

Link copied to clipboard
abstract fun <R> concat(dataSource: DataSource<R>): DataSource<R>

concat an another DataSource and request API calls sequentially. we can determine request continuously the concat DataSource or stop when failed using ConcatStrategy.

Link copied to clipboard
abstract fun invalidate()

invalidate cached data and retry counts, request again API call.

Link copied to clipboard
abstract fun joinDisposable(disposable: CompositeDisposable): DataSource<T>

joins onto CompositeDisposable as a disposable.

Link copied to clipboard
abstract fun observeResponse(observer: ResponseObserver<T>): DataSource<T>

observes a ApiResponse value from the API call request.

Link copied to clipboard
abstract fun request(): DataSource<T>

request API call and response to the callback.

Link copied to clipboard
abstract fun retry(retryCount: Int, interval: Long): DataSource<T>

retry fetching data few times with time interval when the request gets failure.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <T> DataSource<T>.toResponseDataSource(): ResponseDataSource<T>