Skip to content

Instantly share code, notes, and snippets.

@douglasiacovelli
Last active November 11, 2022 11:08
Show Gist options
  • Save douglasiacovelli/1760aaa071aaf3061e8093fb3c763b50 to your computer and use it in GitHub Desktop.
Save douglasiacovelli/1760aaa071aaf3061e8093fb3c763b50 to your computer and use it in GitHub Desktop.
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() }
}
}
@Hestonic
Copy link

Hestonic commented Nov 11, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment