Skip to main content

books

Creates, updates, deletes, gets or lists a books resource.

Overview

Namebooks
TypeResource
Idgoogle.libraryagent.books

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe resource name of the book. Book names have the form shelves/{shelf_id}/books/{book_id}. The name is ignored when creating a book.
authorstringThe name of the book author.
readbooleanValue indicating whether the book has been read.
titlestringThe title of the book.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectshelvesId, booksIdGets a book. Returns NOT_FOUND if the book does not exist.
listselectshelvesIdpageSize, pageTokenLists books in a shelf. The order is unspecified but deterministic. Newly created books will not necessarily be added to the end of this list. Returns NOT_FOUND if the shelf does not exist.
borrowexecshelvesId, booksIdBorrow 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.
returnexecshelvesId, booksIdReturn 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.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
booksIdstring
shelvesIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Gets a book. Returns NOT_FOUND if the book does not exist.

SELECT
name,
author,
read,
title
FROM google.libraryagent.books
WHERE shelvesId = '{{ shelvesId }}' -- required
AND booksId = '{{ booksId }}' -- required;

Lifecycle Methods

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.

EXEC google.libraryagent.books.borrow 
@shelvesId='{{ shelvesId }}' --required,
@booksId='{{ booksId }}' --required;