Add auto complete. Close #24

This commit is contained in:
2025-08-10 15:33:28 +08:00
parent 5dad6910fc
commit 1cf4da66ad
6 changed files with 566 additions and 113 deletions

View File

@@ -583,4 +583,13 @@ class Network {
return Res.fromErrorRes(res);
}
}
Future<Res<List<Tag>>> getAutoCompleteTags(String keyword) async {
var res = await apiGet("/v2/search/autocomplete?merge_plain_keyword_results=true&word=${Uri.encodeComponent(keyword)}");
if (res.success) {
return Res((res.data["tags"] as List).map((e) => Tag.fromJson(e)).toList());
} else {
return Res.error(res.errorMessage);
}
}
}