io.paymenthighway.sdk.util / CallbackResultConvert

CallbackResultConvert

class CallbackResultConvert<T : ApiResultInterface, R> : Callback<T>

Helper for connecting the Retrofit2 Callback into Result completion with a convertion of the data received

Parameters

T - the type of the data for success operation

R - the type of the data returned after transformation

completion - sdk callback result

convert - convert function to transform the received data R in the completion data T

Constructors

<init>

CallbackResultConvert(completion: (Result<R, Exception>) -> Unit, convert: (T) -> Result<R, Exception>)

Helper for connecting the Retrofit2 Callback into Result completion with a convertion of the data received

Properties

completion

val completion: (Result<R, Exception>) -> Unit

sdk callback result

convert

val convert: (T) -> Result<R, Exception>

convert function to transform the received data R in the completion data T

Functions

onFailure

fun onFailure(call: Call<T>, t: Throwable): Unit

Implementation of the Retrofit2 onFailure Callback

onResponse

fun onResponse(call: Call<T>, response: Response<T>): Unit

Implementation of the Retrofit2 onResponse Callback