Last active
December 18, 2018 14:06
-
-
Save leandroBorgesFerreira/903eb6f89418b7fdec08aa9b24457449 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class RepositoryDataSource<F>( | |
| private val async: Async<F>, | |
| private val apiClient: ApiClient | |
| ) { | |
| fun fetchAllRepositories(): Kind<F, List<Repository>> = | |
| async.run { | |
| apiClient.getRepositories("Java", "star", 1) | |
| .async(this) | |
| .flatMap { response -> response.unwrapBody(this) } | |
| .map { dto -> dto.items } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment