ApiResponseSuspendOperator

abstract class ApiResponseSuspendOperator<T> : SandwichOperator

Author

skydoves (Jaewoong Eum)

ApiResponseSuspendOperator operates on an ApiResponse which should be handled in the suspension scope. This allows you to handle success and error response instead of the com.skydoves.sandwich.suspendOnSuccess, com.skydoves.sandwich.suspendOnError, com.skydoves.sandwich.suspendOnException transformers. This operator can be applied globally as a singleton instance, or on each ApiResponse one by one.

Constructors

Link copied to clipboard
fun ApiResponseSuspendOperator()

Functions

Link copied to clipboard
abstract suspend fun onError(apiResponse: ApiResponse.Failure.Error<T>)

Operates the ApiResponse.Failure.Error for handling error responses if the request failed.

Link copied to clipboard
abstract suspend fun onException(apiResponse: ApiResponse.Failure.Exception<T>)

Operates the ApiResponse.Failure.Exception for handling exception responses if the request get an exception.

Link copied to clipboard
abstract suspend fun onSuccess(apiResponse: ApiResponse.Success<T>)

Operates the ApiResponse.Success for handling successful responses if the request succeeds.