Last active
May 4, 2020 12:17
-
-
Save viggin543/9d2bffa37d9360c6f475f99f1d6f426d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BananaService { | |
| fun getBanana(id: String): Banana { | |
| return Banana(Color.YELLOW, 0.5, id) | |
| } | |
| fun createBanana(banana: CreateBanana) : Banana { | |
| return Banana(Color.GREEN, 0.5, "random id") | |
| } | |
| } | |
| data class Banana(val color: Color, | |
| val price: Double, | |
| val id: String, | |
| val nickname: String? = null | |
| ) | |
| data class CreateBanana( | |
| val color: String, | |
| val price: Double, | |
| val nickname: String? = null | |
| ) | |
| data class ApiError(val error: String) | |
| enum class Color { | |
| GREEN, YELLOW, BROWN | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment