Response

data class Response<TYPE, PROGRESS>(status: Response.Status, data: TYPE?, progress: PROGRESS?, exception: Throwable?)

A Generic data holder that contains both the data and the status of the process that generates the data.

This is to be used on Observables types such as LiveData or ObservableData.

Constructors

Response
Link copied to clipboard
fun <TYPE, PROGRESS> Response(status: Response.Status, data: TYPE?, progress: PROGRESS?, exception: Throwable?)

Types

Companion
Link copied to clipboard
object Companion
Status
Link copied to clipboard
enum Status : Enum<Response.Status>

Representation of the status of the process generating this data.

Properties

data
Link copied to clipboard
val data: TYPE?

Current data of this process. Usually the result of an API call or async operation.

exception
Link copied to clipboard
val exception: Throwable?

Current failure of this process.

progress
Link copied to clipboard
val progress: PROGRESS?

Current progress of this process.

status
Link copied to clipboard
val status: Response.Status

Current status of this process.

Extensions

map
Link copied to clipboard
fun <I, O, P> Response<I, P>?.map(mapper: (I?) -> O?): Response<O, P>?

Maps the Response.data from one type to another. Keeps Response.status, Response.progress and Response.exception unchanged.