Skip to content

Instantly share code, notes, and snippets.

Created June 8, 2023 04:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
ApiResult definiation
sealed class ApiResult<out T> {
// HTTP 200
data class Success<T>(val data: T) : ApiResult<T>()
// HTTP 400..500
data class Failure(val code: Int, val message: String): ApiResult<Nothing>()
// Socket timeout, write in Demo, IO, , JSON parsing, NPE etc
data class NetworkError(val throwable: Throwable, val message: String, val networkErrorExceptions: ClassifiedNetworkErrorExceptions) : ApiResult<Nothing>()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment