Package-level declarations

Types

Link copied to clipboard
interface Call<T : Any>

A pending operation waiting to be ran.

Link copied to clipboard
class CoroutineCall<T : Any>(scope: CoroutineScope, suspendingTask: suspend CoroutineScope.() -> Result<T>) : Call<T>
Link copied to clipboard
class DistinctCall<T : Any>(scope: CoroutineScope, callBuilder: () -> Call<T>, onFinished: () -> Unit) : Call<T>

Reusable wrapper around Call which delivers a single result to all subscribers.

Link copied to clipboard
class ReturnOnErrorCall<T : Any>(originalCall: Call<T>, scope: CoroutineScope, onErrorReturn: suspend (originalError: StreamError) -> Result<T>) : Call<T>

A wrapper around Call that swallows the error and emits new data from onErrorReturn.

Link copied to clipboard

The CoroutineContext.Element which holds ongoing calls until those get finished.

Functions

Link copied to clipboard
fun <T : Any> Call<T>.doOnResult(scope: CoroutineScope, function: suspend (Result<T>) -> Unit): Call<T>

Run the given function before running the Call.

Link copied to clipboard
fun <T : Any> Call<T>.doOnStart(scope: CoroutineScope, function: suspend () -> Unit): Call<T>

Run the given function before running the Call.

Link copied to clipboard
fun <T : Any> Call<T>.enqueue(onSuccess: (T) -> Unit = onSuccessStub, onError: (StreamError) -> Unit = onErrorStub)
Link copied to clipboard

Forces a regular call to be used instead of DistinctCall.

Link copied to clipboard
fun <T : Any> Call<T>.launch(scope: CoroutineScope)

Launches a call using coroutines scope.

Link copied to clipboard
fun <T : Any, K : Any> Call<T>.map(mapper: (T) -> K): Call<K>

Maps a Call type to a transformed Call.

Link copied to clipboard
fun <T : Any> Call<T>.onErrorReturn(scope: CoroutineScope, function: suspend (originalError: StreamError) -> Result<T>): ReturnOnErrorCall<T>

Wraps this Call into ReturnOnErrorCall to return an item specified by side effect function when it encounters an error.

Link copied to clipboard
fun <T : Any> Call<T>.retry(scope: CoroutineScope, retryPolicy: RetryPolicy): Call<T>

Wraps the original call with RetryCall wrapper. Allows to retry the original call based on RetryPolicy

Link copied to clipboard
fun <T : Any> Call<T>.share(scope: CoroutineScope, identifier: () -> Int): Call<T>

Shares the existing Call instance for the specified identifier. If no existing call found the new Call instance will be provided.

Link copied to clipboard
Link copied to clipboard
fun <T : Any> Call<T>.withPrecondition(scope: CoroutineScope, precondition: suspend () -> Result<Unit>): Call<T>

Run the Call if the given precondition is Result.Success.

Link copied to clipboard
fun <T : Any, K : Any> Call<T>.zipWith(call: Call<K>): Call<Pair<T, K>>

Zips a Call of T and a given call of K.