Created
April 16, 2020 23:27
-
-
Save DenisBronx/7d468f11bca15358d06e1d97def07327 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 AlbumRepositoryImpl( | |
private val albumApiService: AlbumApiService, | |
private val mapAlbumDto: (NetworkAlbum) -> Album | |
) : AlbumRepository { | |
override fun getAlbumById(id: String): Single<SimpleResult<Album>> { | |
return albumApiService.getAlbumById(id).map { | |
it.fold( | |
success = { dto -> Result.Success(mapAlbumDto(dto)) }, | |
failure = { throwable -> Result.Failure(throwable) } | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment