list method

Future<Volumes> list(
  1. String q, {
  2. String? download,
  3. String? filter,
  4. String? langRestrict,
  5. String? libraryRestrict,
  6. String? maxAllowedMaturityRating,
  7. int? maxResults,
  8. String? orderBy,
  9. String? partner,
  10. String? printType,
  11. String? projection,
  12. bool? showPreorders,
  13. String? source,
  14. int? startIndex,
  15. String? $fields,
})

Performs a book search.

Request parameters:

q - Full-text search query string.

download - Restrict to volumes by download availability. Possible string values are:

  • "DOWNLOAD_UNDEFINED"
  • "EPUB" : All volumes with epub.

filter - Filter search results. Possible string values are:

  • "FILTER_UNDEFINED"
  • "ebooks" : All Google eBooks.
  • "free-ebooks" : Google eBook with full volume text viewability.
  • "full" : Public can view entire volume text.
  • "paid-ebooks" : Google eBook with a price.
  • "partial" : Public able to see parts of text.

langRestrict - Restrict results to books with this language code.

libraryRestrict - Restrict search to this user's library. Possible string values are:

  • "LIBRARY_RESTRICT_UNDEFINED"
  • "my-library" : Restrict to the user's library, any shelf.
  • "no-restrict" : Do not restrict based on user's library.

maxAllowedMaturityRating - The maximum allowed maturity rating of returned recommendations. Books with a higher maturity rating are filtered out. Possible string values are:

  • "MAX_ALLOWED_MATURITY_RATING_UNDEFINED"
  • "MATURE" : Show books which are rated mature or lower.
  • "not-mature" : Show books which are rated not mature.

maxResults - Maximum number of results to return. Value must be between "0" and "40".

orderBy - Sort search results. Possible string values are:

  • "ORDER_BY_UNDEFINED"
  • "newest" : Most recently published.
  • "relevance" : Relevance to search terms.

partner - Restrict and brand results for partner ID.

printType - Restrict to books or magazines. Possible string values are:

  • "PRINT_TYPE_UNDEFINED"
  • "ALL" : All volume content types.
  • "BOOKS" : Just books.
  • "MAGAZINES" : Just magazines.

projection - Restrict information returned to a set of selected fields. Possible string values are:

  • "PROJECTION_UNDEFINED"
  • "FULL" : Includes all volume data.
  • "LITE" : Includes a subset of fields in volumeInfo and accessInfo.

showPreorders - Set to true to show books available for preorder. Defaults to false.

source - String to identify the originator of this request.

startIndex - Index of the first result to return (starts at 0)

$fields - Selector specifying which fields to include in a partial response.

Completes with a Volumes.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Volumes> list(
  core.String q, {
  core.String? download,
  core.String? filter,
  core.String? langRestrict,
  core.String? libraryRestrict,
  core.String? maxAllowedMaturityRating,
  core.int? maxResults,
  core.String? orderBy,
  core.String? partner,
  core.String? printType,
  core.String? projection,
  core.bool? showPreorders,
  core.String? source,
  core.int? startIndex,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'q': [q],
    if (download != null) 'download': [download],
    if (filter != null) 'filter': [filter],
    if (langRestrict != null) 'langRestrict': [langRestrict],
    if (libraryRestrict != null) 'libraryRestrict': [libraryRestrict],
    if (maxAllowedMaturityRating != null)
      'maxAllowedMaturityRating': [maxAllowedMaturityRating],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (partner != null) 'partner': [partner],
    if (printType != null) 'printType': [printType],
    if (projection != null) 'projection': [projection],
    if (showPreorders != null) 'showPreorders': ['${showPreorders}'],
    if (source != null) 'source': [source],
    if (startIndex != null) 'startIndex': ['${startIndex}'],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'books/v1/volumes';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Volumes.fromJson(response_ as core.Map<core.String, core.dynamic>);
}