Skip to content

Instantly share code, notes, and snippets.

@ngallazzi
Created January 8, 2021 15:13
Show Gist options
  • Save ngallazzi/71814752bbe989c7f20e1a4124b37f74 to your computer and use it in GitHub Desktop.
Save ngallazzi/71814752bbe989c7f20e1a4124b37f74 to your computer and use it in GitHub Desktop.
class BooksRepositoryImpl(
private val localDataSource: BooksLocalDataSource,
private val remoteDataSource: BooksRemoteDataSource
) : BooksRepository {
override suspend fun getRemoteBooks(author: String): Result<List<Volume>> {
return remoteDataSource.getBooks(author)
}
override suspend fun getBookmarks(): Flow<List<Volume>> {
return localDataSource.getBookmarks()
}
override suspend fun bookmark(book: Volume) {
localDataSource.bookmark(book)
}
override suspend fun unbookmark(book: Volume) {
localDataSource.unbookmark(book)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment