kotlin-hands-on / jvm-js-fullstack

https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform/
121 stars 148 forks source link

Suggestion : Great example #2

Open ideaBlender opened 4 years ago

ideaBlender commented 4 years ago

Could not find anywhere to leave a thank you for creating this. Ty its awesome.

Just a suggestion for the team, with the type coupling between client/server we could really use some documentation on how to create a serializable sealed class for the server results.

Something like this:

@Serializable
sealed class ApiResponse {
    data class Success<out T : Any>(val value: T) : ApiResponse()
    object Failure : ApiResponse()
    object InFlight : ApiResponse()
}