Skip to content

//NetworkResponseAdapter/com.haroldadmin.cnradapter

Package com.haroldadmin.cnradapter

Types

Name Summary
CompletableResponse [jvm]
typealias CompletableResponse<E> = NetworkResponse<Unit, E>
An alias for a NetworkResponse with no expected response body (Unit).
Useful for specifying return types of API calls that do not return a useful value.
NetworkResponse [jvm]
interface NetworkResponse<S, E>
Represents the result of a network request made using Retrofit. It can be either in a success state or an error state, depending on the result of the request.
NetworkResponseAdapterFactory [jvm]
class NetworkResponseAdapterFactory : CallAdapter.Factory
A Call Adapter Factory for Retrofit service methods that return NetworkResponse<S, E> or Deferred<NetworkResponse<S, E>>.

Functions

Name Summary
executeWithRetry [jvm]
inline suspend fun <T : Any, U : Any> executeWithRetry(times: Int = 10, initialDelay: Long = 100, maxDelay: Long = 1000, factor: Double = 2.0, block: suspend () -> NetworkResponse<T, U>): NetworkResponse<T, U>
Retries the given block for the specified number of times in the case of NetworkResponse.NetworkError
invoke [jvm]
operator fun <T : Any, U : Any> NetworkResponse<T, U>.invoke(): T?
Overloaded invoke operator to get the successful body or null in NetworkResponse class