34 lines
818 B
Dart
34 lines
818 B
Dart
import '../api/knowledge_api.dart';
|
|
import '../models/knowledge_item.dart';
|
|
|
|
class KnowledgeRepository {
|
|
final KnowledgeApi _api;
|
|
const KnowledgeRepository(this._api);
|
|
|
|
Future<(List<int>, int)> fetchIds({
|
|
String? noteType,
|
|
List<String> tags = const [],
|
|
String sort = 'modified',
|
|
String? q,
|
|
int limit = 50,
|
|
int offset = 0,
|
|
}) =>
|
|
_api.fetchIds(
|
|
noteType: noteType,
|
|
tags: tags,
|
|
sort: sort,
|
|
q: q,
|
|
limit: limit,
|
|
offset: offset,
|
|
);
|
|
|
|
Future<List<KnowledgeItem>> fetchBatch(List<int> ids) =>
|
|
_api.fetchBatch(ids);
|
|
|
|
Future<Map<String, int>> fetchCounts({List<String> tags = const []}) =>
|
|
_api.fetchCounts(tags: tags);
|
|
|
|
Future<List<String>> fetchTags({String? noteType}) =>
|
|
_api.fetchTags(noteType: noteType);
|
|
}
|