list method

Future<Volumes> list(
  1. String userId,
  2. String shelf, {
  3. int? maxResults,
  4. bool? showPreorders,
  5. String? source,
  6. int? startIndex,
  7. String? $fields,
})

Retrieves volumes in a specific bookshelf for the specified user.

Request parameters:

userId - ID of user for whom to retrieve bookshelf volumes.

shelf - ID of bookshelf to retrieve volumes.

maxResults - Maximum number of results to return

showPreorders - Set to true to show pre-ordered books. Defaults to false.

source - String to identify the originator of this request.

startIndex - Index of the first element 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 userId,
  core.String shelf, {
  core.int? maxResults,
  core.bool? showPreorders,
  core.String? source,
  core.int? startIndex,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (showPreorders != null) 'showPreorders': ['${showPreorders}'],
    if (source != null) 'source': [source],
    if (startIndex != null) 'startIndex': ['${startIndex}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'books/v1/users/' +
      commons.escapeVariable('$userId') +
      '/bookshelves/' +
      commons.escapeVariable('$shelf') +
      '/volumes';

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