Skip to content

Instantly share code, notes, and snippets.

@DenisBronx
Created April 16, 2020 23:24
Show Gist options
  • Save DenisBronx/81647016d56075373b1ea46e2d69aa82 to your computer and use it in GitHub Desktop.
Save DenisBronx/81647016d56075373b1ea46e2d69aa82 to your computer and use it in GitHub Desktop.
class AlbumRepositoryImpl(
private val albumApiService: AlbumApiService,
private val albumDataMapper: Mapper<NetworkAlbum, Album>
) : AlbumRepository {
override fun getAlbumById(id: String): Single<SimpleResult<Album>> {
return albumApiService.getAlbumById(id).map {
it.fold(
success = { dto -> Result.Success(albumDataMapper.map(dto)) },
failure = { throwable -> Result.Failure(throwable) }
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment