borrow method
Borrow a book from the library.
Returns the book if it is borrowed successfully. Returns NOT_FOUND if the book does not exist in the library. Returns quota exceeded error if the amount of books borrowed exceeds allocation quota in any dimensions.
Request parameters:
name
- Required. The name of the book to borrow.
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> borrow(
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') + ':borrow';
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
);
return GoogleExampleLibraryagentV1Book.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}