hey folks.
how to mapping result from Ktor request into sealed class like bellow
Copy code
sealed class NetworkResponse<out S : Any, out E : Any> {
data class Success<S : Any>(
val body: S,
val code: Int
) : NetworkResponse<S, Nothing>()
data class Error<E : Any>(
val errorBody: E,
val code: Int
) : NetworkResponse<Nothing, E>()
data class Failure(val error: Exception) : NetworkResponse<Nothing, Nothing>()
}
e
edenman
06/27/2021, 6:46 AM
I just do
client.request(builder).body<String>()
and then do the parsing myself to decide if i should return