suspendOnSuccess

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

Author

skydoves (Jaewoong Eum)

A suspension 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 suspend fun <T, V> ApiResponse<T>.suspendOnSuccess(mapper: ApiSuccessModelMapper<T, V>, crossinline onResult: suspend V.() -> Unit): ApiResponse<T>

Author

skydoves (Jaewoong Eum)

A suspension 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.