onProcedure
inline fun <T> ApiResponse<T>.onProcedure( crossinline onSuccess: ApiResponse.Success<T>.() -> Unit, crossinline onError: ApiResponse.Failure.Error<T>.() -> Unit, crossinline onException: ApiResponse.Failure.Exception<T>.() -> Unit): ApiResponse<T>
Content copied to clipboard
Author
skydoves (Jaewoong Eum)
A scope function that will be executed for handling successful, error, exception responses. This function receives and handles ApiResponse.onSuccess, ApiResponse.onError, and ApiResponse.onException in one scope.
Return
The original ApiResponse.
Parameters
onSuccess
A scope function that would be executed for handling successful responses if the request succeeds.
onError
A scope function that would be executed for handling error responses if the request failed.
onException
A scope function that would be executed for handling exception responses if the request get an exception.