Skip to content

Instantly share code, notes, and snippets.

@wellingtoncosta
Created February 12, 2019 15:30
Show Gist options
  • Save wellingtoncosta/a7af62466c5be424125dff59b850781a to your computer and use it in GitHub Desktop.
Save wellingtoncosta/a7af62466c5be424125dff59b850781a to your computer and use it in GitHub Desktop.
class UserDataRepository(
private val api: GithubApi
) : UserRepository {
override suspend fun getAll() = withContext(IO) {
async { api.getAll().await().map { it.toModel() } }
}
override suspend fun getByUsername(username: String) = withContext(IO) {
async { api.getByUsername(username).await().toModel() }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment