Last active
March 5, 2022 15:35
-
-
Save Kashif-E/d5c90ca04574945f808121aff1612dfb to your computer and use it in GitHub Desktop.
Parallel API calls With HOF part 2
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 repository{ | |
fun getItems( ) { | |
try { | |
CoroutineScope(Dispatchers.IO).launch { | |
val humanResponse = async { | |
apiService.getHumans() | |
} | |
val reptileResponse = async { | |
apiServices.getReptiles() | |
} | |
val birdResponse = async { | |
apiServices.getBirds( | |
) | |
} | |
} | |
} catch (e: Exception) { | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment