Phase 4b: remote use cases (FetchLibraries, FetchBooks, SearchBooks)
This commit is contained in:
parent
2a6b8a219d
commit
2f9431f6e6
3 changed files with 61 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Book's Story — free and open-source Material You eBook reader.
|
||||
* Copyright (C) 2024-2026 Acclorite
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.dueattendant149.bookshelf.domain.use_case.remote
|
||||
|
||||
import org.dueattendant149.bookshelf.domain.model.library.Book
|
||||
import org.dueattendant149.bookshelf.domain.repository.RemoteLibraryRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class FetchBooksUseCase
|
||||
@Inject
|
||||
constructor(
|
||||
private val repository: RemoteLibraryRepository,
|
||||
) {
|
||||
suspend operator fun invoke(libraryId: String): Result<List<Book>> =
|
||||
repository.getBooks(libraryId)
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Book's Story — free and open-source Material You eBook reader.
|
||||
* Copyright (C) 2024-2026 Acclorite
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.dueattendant149.bookshelf.domain.use_case.remote
|
||||
|
||||
import org.dueattendant149.bookshelf.domain.model.remote.RemoteLibrary
|
||||
import org.dueattendant149.bookshelf.domain.repository.RemoteLibraryRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class FetchLibrariesUseCase
|
||||
@Inject
|
||||
constructor(
|
||||
private val repository: RemoteLibraryRepository,
|
||||
) {
|
||||
suspend operator fun invoke(): Result<List<RemoteLibrary>> = repository.getLibraries()
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Book's Story — free and open-source Material You eBook reader.
|
||||
* Copyright (C) 2024-2026 Acclorite
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.dueattendant149.bookshelf.domain.use_case.remote
|
||||
|
||||
import org.dueattendant149.bookshelf.domain.model.library.Book
|
||||
import org.dueattendant149.bookshelf.domain.repository.RemoteLibraryRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class SearchBooksUseCase
|
||||
@Inject
|
||||
constructor(
|
||||
private val repository: RemoteLibraryRepository,
|
||||
) {
|
||||
suspend operator fun invoke(
|
||||
libraryId: String,
|
||||
query: String,
|
||||
): Result<List<Book>> = repository.searchLibrary(libraryId, query)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue