return_ method

Future<GoogleExampleLibraryagentV1Book> return_(
  1. String name, {
  2. String? $fields,
})

Return a book to the library.

Returns the book if it is returned to the library successfully. Returns error if the book does not belong to the library or the users didn't borrow before.

Request parameters:

name - Required. The name of the book to return. Value must have pattern ^shelves/\[^/\]+/books/\[^/\]+$.

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

Completes with a GoogleExampleLibraryagentV1Book.

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<GoogleExampleLibraryagentV1Book> return_(
  core.String name, {
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':return';

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