ApiResponseOperator

abstract class ApiResponseOperator<T> : SandwichOperator

Author

skydoves (Jaewoong Eum)

ApiResponseOperator operates on an ApiResponse and return an ApiResponse. This allows you to handle success and error response instead of the com.skydoves.sandwich.onSuccess, com.skydoves.sandwich.onError, com.skydoves.sandwich.onException transformers. This operator can be applied globally as a singleton instance, or on each ApiResponse one by one.

Constructors

Link copied to clipboard
fun ApiResponseOperator()

Functions

Link copied to clipboard
abstract 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 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 fun onSuccess(apiResponse: ApiResponse.Success<T>)

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