Skip to content

Instantly share code, notes, and snippets.

@agustarc
Created August 15, 2019 11:09
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 agustarc/7d8fbf31e1f25ef0f9a38fd94247f31e to your computer and use it in GitHub Desktop.
Save agustarc/7d8fbf31e1f25ef0f9a38fd94247f31e to your computer and use it in GitHub Desktop.
interface ImagesRepository {
fun getImages(params: Map<String, String>): Single<Result<ImagesResponse>>
}
internal class ImagesRepositoryImpl(private val source: ImageDataSource) : ImagesRepository {
override fun getImages(params: Map<String, String>): Single<Result<ImagesResponse>> {
return source.getImages(params)
.map { Result.success(it) }
.compose(applyRetryPolicy(TIMEOUT) { Single.just(Result.failure(it)) })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment