Created
October 5, 2022 07:58
-
-
Save danailalexiev/502c11a02c7ba5935080f60da8b756d0 to your computer and use it in GitHub Desktop.
Kotlin Multiplatform JS Interop
This file contains 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
interface JokeClient { | |
suspend fun getRandomJoke(category: JokeCategory? = null): Result<Joke> | |
suspend fun getJokeCategories(): Result<List<JokeCategory>> | |
suspend fun findJoke(query: String): Result<JokeSearchResult> | |
} | |
internal class JokeClientImpl (private val apiClient: ApiClient) : | |
JokeClient { | |
override suspend fun getRandomJoke(category: JokeCategory?): Result<Joke> = | |
apiClient.getRandomJoke(category) | |
override suspend fun getJokeCategories(): Result<List<JokeCategory>> = | |
apiClient.getJokeCategories() | |
override suspend fun findJoke(query: String): Result<JokeSearchResult> = | |
apiClient.findJoke(query) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment