Created
October 5, 2022 07:44
-
-
Save danailalexiev/9cadc5cfd40d4cf0cb9e313fe71a0141 to your computer and use it in GitHub Desktop.
Kotlin Multiplatform Android 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