getBooks method
Search books in ISBNdb
Implementation
Future<BookQueryResult> getBooks(
String query, {
int page = 1,
int pageSize = 20,
int? year,
int? edition,
bool? shouldMatchAll,
String? language,
BookColumn? column,
DateTime? publishedFrom,
DateTime? publishedTo,
@Deprecated('No longer supported by ISBNdb API contract.') int? offset,
}) async {
final path = "books/$query";
final queryParameters = <String, Object?>{
"page": page,
"pageSize": pageSize,
"year": year,
"edition": edition,
"shouldMatchAll": shouldMatchAll,
"language": language,
"column": column?.name,
"publishedFrom": _formatQueryDate(publishedFrom),
"publishedTo": _formatQueryDate(publishedTo),
}..removeWhere((_, value) => value == null);
final response = await _get(path, queryParameters: queryParameters);
return _parseModel(
method: "GET",
path: path,
parser: () => BookQueryResult.fromJson(response),
);
}