Last active
December 18, 2018 14:05
-
-
Save leandroBorgesFerreira/f08ca1d6c83f0b63b6df825d069d8e2d 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 apiClient: ApiClient, | |
| async: Async<F> | |
| ) : Async<F> by async { | |
| fun fetchAllRepositories(): Kind<F, List<Repository>> = | |
| 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