Created
June 14, 2018 09:38
-
-
Save Marchuck/d48bc5d0f78d65681b9cc19c6c509c31 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
class GetPeopleUseCase(private val api: StarWarsApi) { | |
fun execute(page: Int): Deferred<List<Person?>?> { | |
return async { transform(page) } | |
} | |
private suspend fun transform(page: Int): List<Person?> { | |
val response = api.getPeople(page).await() | |
return response.results ?: emptyList() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment