search method
Perform query search, optional type filter (e.g. 'boardgame').
Throws:
BggRequestPendingExceptionif API returns 202BggNetworkExceptionon network errorsBggParsingExceptionon XML parse errors
Implementation
Future<SearchResults> search({
required String query,
String? type,
}) async {
try {
final xmlString = await _api.fetchSearch(query: query, type: type);
final root = XmlDocument.parse(xmlString).rootElement;
return SearchResults.fromXml(root);
} on BggException {
rethrow;
} catch (_) {
throw BggParsingException();
}
}