Skip to content

Instantly share code, notes, and snippets.

@0xZhangKe
Created June 26, 2022 14:32
Show Gist options
  • Select an option

  • Save 0xZhangKe/2e66be9a759ac08e13a2f63d8ac2e8dc to your computer and use it in GitHub Desktop.

Select an option

Save 0xZhangKe/2e66be9a759ac08e13a2f63d8ac2e8dc to your computer and use it in GitHub Desktop.
class ResponseCall<S, E : ErrorResponse.ErrorEntryWithMessage>(
private val delegate: Call<S>,
private val responseInstance: Response<S, E>,
private val errorConverter: Converter<ResponseBody, E>
) : Call<Response<S, E>> {
override fun enqueue(callback: Callback<Response<S, E>>) {
TODO("Not yet implemented")
}
override fun isExecuted(): Boolean = delegate.isExecuted
override fun clone(): Call<Response<S, E>> {
return ResponseCall(delegate.clone(), responseInstance, errorConverter)
}
override fun cancel() {
delegate.cancel()
}
override fun isCanceled(): Boolean = delegate.isCanceled
override fun execute(): retrofit2.Response<Response<S, E>> {
throw UnsupportedOperationException("ResponseCall not support execute")
}
override fun request(): Request = delegate.request()
override fun timeout(): Timeout = delegate.timeout()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment