mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-26 12:59:30 +00:00
search for books
This commit is contained in:
parent
a1e238fc25
commit
d372a6b096
12 changed files with 963 additions and 88 deletions
23
lib/features/explore/providers/search_result_provider.dart
Normal file
23
lib/features/explore/providers/search_result_provider.dart
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:shelfsdk/audiobookshelf_api.dart';
|
||||
import 'package:whispering_pages/api/api_provider.dart';
|
||||
import 'package:whispering_pages/settings/api_settings_provider.dart';
|
||||
|
||||
part 'search_result_provider.g.dart';
|
||||
|
||||
/// The provider for the search result.
|
||||
@riverpod
|
||||
FutureOr<LibrarySearchResponse?> searchResult(
|
||||
SearchResultRef ref,
|
||||
String query, {
|
||||
int limit = 25,
|
||||
}) async {
|
||||
final api = ref.watch(authenticatedApiProvider);
|
||||
final apiSettings = ref.watch(apiSettingsProvider);
|
||||
|
||||
return await api.libraries.search(
|
||||
libraryId: apiSettings.activeLibraryId!,
|
||||
query: query,
|
||||
limit: limit,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue