books
Creates, updates, deletes, gets or lists a books
resource.
Overview
Name | books |
Type | Resource |
Id | google.libraryagent.books |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The resource name of the book. Book names have the form shelves/{shelf_id}/books/{book_id} . The name is ignored when creating a book. |
author | string | The name of the book author. |
read | boolean | Value indicating whether the book has been read. |
title | string | The title of the book. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The resource name of the book. Book names have the form shelves/{shelf_id}/books/{book_id} . The name is ignored when creating a book. |
author | string | The name of the book author. |
read | boolean | Value indicating whether the book has been read. |
title | string | The title of the book. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | shelvesId , booksId | Gets a book. Returns NOT_FOUND if the book does not exist. | |
list | select | shelvesId | pageSize , pageToken | Lists 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. |
borrow | exec | shelvesId , booksId | 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. | |
return | exec | shelvesId , booksId | 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. |
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.
Name | Datatype | Description |
---|---|---|
booksId | string | |
shelvesId | string | |
pageSize | integer (int32) | |
pageToken | string |
SELECT
examples
- get
- list
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;
Lists 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.
SELECT
name,
author,
read,
title
FROM google.libraryagent.books
WHERE shelvesId = '{{ shelvesId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
Lifecycle Methods
- borrow
- return
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;
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.
EXEC google.libraryagent.books.return
@shelvesId='{{ shelvesId }}' --required,
@booksId='{{ booksId }}' --required;