Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created April 11, 2022 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/19888072039dc3eaeeafdfcc852b646f to your computer and use it in GitHub Desktop.
Save skydoves/19888072039dc3eaeeafdfcc852b646f to your computer and use it in GitHub Desktop.
handle_api_data_layer
interface PosterService {
@GET("DisneyPosters.json")
suspend fun fetchPosters(): Response<List<Poster>>
}
class PosterRemoteDataSource(
private val posterService: PosterService
) {
suspend operator fun invoke(): NetworkResult<List<Poster>> =
handleApi { posterService.fetchPosters() }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment