Success

data class Success<out T : Any>(val value: T, val headers: Map<String, String?>, val httpCode: Int) : NetworkResponse<T>

Constructors

Link copied to clipboard
internal constructor(value: T, httpResponse: <Error class: unknown class>)
constructor(value: T, headers: Map<String, String?>, httpCode: Int)

Properties

Link copied to clipboard
val cookies: Map<String, String>
Link copied to clipboard
val headers: Map<String, String?>
Link copied to clipboard
val httpCode: Int
Link copied to clipboard
val value: 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>