NetworkResponse

sealed class NetworkResponse<out T : Any>

Inheritors

Types

Link copied to clipboard
data class Error(val kException: KaliumException) : NetworkResponse<Nothing>
Link copied to clipboard
data class Success<out T : Any>(val value: T, val headers: Map<String, String?>, val httpCode: Int) : NetworkResponse<T>

Functions

Link copied to clipboard
internal inline fun <T : Any, R : Any> NetworkResponse<T>.flatMap(fn: (NetworkResponse.Success<T>) -> NetworkResponse<R>): NetworkResponse<R>
Link copied to clipboard
fun <T : Any> NetworkResponse<T>.isSuccessful(): Boolean
Link copied to clipboard
internal inline fun <T : Any, U : Any> NetworkResponse<T>.mapSuccess(mapping: (T) -> U): NetworkResponse<U>

If the request is successful, perform mapping and create a new Success with its result

Link copied to clipboard
internal inline fun <T : Any> NetworkResponse<T>.onFailure(fn: (NetworkResponse.Error) -> Unit): NetworkResponse<T>
Link copied to clipboard
internal inline fun <T : Any> NetworkResponse<T>.onSuccess(fn: (NetworkResponse.Success<T>) -> Unit): NetworkResponse<T>