https://kotlinlang.org logo
#android
Title
# android
c

carlos cdmp

12/13/2019, 10:41 AM
Has someone built a datatype adapter for retrofit? similar to the suspend native one but like
fun getModel() : Either<Model, APIError>
b

bezrukov

12/13/2019, 10:44 AM
isn't
Response<Model>
what you want?
Copy code
if (response.isSuccessful) {
  // response.body() <- Model
} else {
  // response.code() <- Api code
}
c

carlos cdmp

12/13/2019, 10:48 AM
I´m using the suspend fun right now, and in the case of error I´m handling the error and building the datatype
it´s kinda different
Wanted to make it automatic from the service interface with an adapter