1.1.0
馃帀 Released a new version 1.1.0! 馃帀
What's New?
- Now we can retrieve the encapsulated success data from the
ApiResponsedirectly using the below functionalities.
getOrNull
Returns the encapsulated data if this instance represents ApiResponse.Success or returns null if this is failed.
val data: List<Poster>? = disneyService.fetchDisneyPosterList().getOrNull()getOrElse
Returns the encapsulated data if this instance represents ApiResponse.Success or returns a default value if this is failed.
val data: List<Poster>? = disneyService.fetchDisneyPosterList().getOrElse(emptyList())getOrThrow
Returns the encapsulated data if this instance represents ApiResponse.Success or throws the encapsulated Throwable exception if this is failed.
try {
val data: List<Poster>? = disneyService.fetchDisneyPosterList().getOrThrow()
} catch (e: Exception) {
e.printStackTrace()
}