getBooks method
Search books in ISBNdb.
ISBNdb rejects pageSize values greater than 100 with HTTP 400.
thema accepts up to five codes, all of which must match, including
narrower classifications. Searches using it return at most 1,000 books.
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,
List<String>? thema,
@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),
"thema": thema?.join(','),
}..removeWhere((_, value) => value == null);
final response = await _get(path, queryParameters: queryParameters);
return _parseModel(
method: "GET",
path: path,
parser: () => BookQueryResult.fromJson(response),
);
}