2022年04月21日
https://github.com/ParadiseHell/one/blob/main/src/main/kotlin/org/paradisehell/one/RetrofitProxy.kt
Example
// call `proxyRetrofit` after `Retrofit#create`, in this method it will handle// exception automatically.val service = retrofit.create(WanAndroidService::class.java).proxyRetrofit()// testservice.test().onSuccess { println("execute test success ==> $it") }.onFailure { println("execute test() failure ==> $it") }// userInfo.onFailureThen { service.userInfo() }?.onSuccess { println("execute userInfo success ==> $it") }?.onFailure { println("execute userInfo() failure ==> $it") }// banner?.onFailureThen { service.banner() }?.onSuccess { println("execute banner() success ==> $it") }?.onFailure { println("execute banner() failure ==> $it") }
