Last active
November 11, 2022 11:08
-
-
Save douglasiacovelli/1760aaa071aaf3061e8093fb3c763b50 to your computer and use it in GitHub Desktop.
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 Repository { | |
suspend fun getRedditPosts(): ResultWrapper<String> | |
} | |
class RepositoryImpl(private val service: RedditService, | |
private val dispatcher: CoroutineDispatcher = Dispatchers.IO) : Repository { | |
override suspend fun getRedditPosts(): ResultWrapper<RedditPosts> { | |
return safeApiCall(dispatcher) { service.getRedditPosts().toRedditPosts() } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello. Thank you for great article. Can you answer the question please.
What is function toRedditPosts()? The function is not described in your article https://link.medium.com/3dBffo9Ri1