onSuccess

inline fun <T> ApiResponse<T>.onSuccess(crossinline onResult: ApiResponse.Success<T>.() -> Unit): ApiResponse<T>

Author

skydoves (Jaewoong Eum)

A scope function that would be executed for handling successful responses if the request succeeds.

Return

The original ApiResponse.

Parameters

onResult

The receiver function that receiving ApiResponse.Success if the request succeeds.


inline fun <T, V> ApiResponse<T>.onSuccess(mapper: ApiSuccessModelMapper<T, V>, crossinline onResult: V.() -> Unit): ApiResponse<T>

Author

skydoves (Jaewoong Eum)

A scope function that would be executed for handling successful responses if the request succeeds with a ApiSuccessModelMapper.

Return

The original ApiResponse.

Parameters

mapper

The ApiSuccessModelMapper for mapping ApiResponse.Success response as a custom V instance model.

onResult

The receiver function that receiving ApiResponse.Success if the request succeeds.