1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Libraryagent\Resource;
19
20use Google\Service\Libraryagent\GoogleExampleLibraryagentV1Book;
21use Google\Service\Libraryagent\GoogleExampleLibraryagentV1ListBooksResponse;
22
23/**
24 * The "books" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $libraryagentService = new Google\Service\Libraryagent(...);
28 *   $books = $libraryagentService->books;
29 *  </code>
30 */
31class ShelvesBooks extends \Google\Service\Resource
32{
33  /**
34   * Borrow a book from the library. Returns the book if it is borrowed
35   * successfully. Returns NOT_FOUND if the book does not exist in the library.
36   * Returns quota exceeded error if the amount of books borrowed exceeds
37   * allocation quota in any dimensions. (books.borrow)
38   *
39   * @param string $name Required. The name of the book to borrow.
40   * @param array $optParams Optional parameters.
41   * @return GoogleExampleLibraryagentV1Book
42   */
43  public function borrow($name, $optParams = [])
44  {
45    $params = ['name' => $name];
46    $params = array_merge($params, $optParams);
47    return $this->call('borrow', [$params], GoogleExampleLibraryagentV1Book::class);
48  }
49  /**
50   * Gets a book. Returns NOT_FOUND if the book does not exist. (books.get)
51   *
52   * @param string $name Required. The name of the book to retrieve.
53   * @param array $optParams Optional parameters.
54   * @return GoogleExampleLibraryagentV1Book
55   */
56  public function get($name, $optParams = [])
57  {
58    $params = ['name' => $name];
59    $params = array_merge($params, $optParams);
60    return $this->call('get', [$params], GoogleExampleLibraryagentV1Book::class);
61  }
62  /**
63   * Lists books in a shelf. The order is unspecified but deterministic. Newly
64   * created books will not necessarily be added to the end of this list. Returns
65   * NOT_FOUND if the shelf does not exist. (books.listShelvesBooks)
66   *
67   * @param string $parent Required. The name of the shelf whose books we'd like
68   * to list.
69   * @param array $optParams Optional parameters.
70   *
71   * @opt_param int pageSize Requested page size. Server may return fewer books
72   * than requested. If unspecified, server will pick an appropriate default.
73   * @opt_param string pageToken A token identifying a page of results the server
74   * should return. Typically, this is the value of
75   * ListBooksResponse.next_page_token. returned from the previous call to
76   * `ListBooks` method.
77   * @return GoogleExampleLibraryagentV1ListBooksResponse
78   */
79  public function listShelvesBooks($parent, $optParams = [])
80  {
81    $params = ['parent' => $parent];
82    $params = array_merge($params, $optParams);
83    return $this->call('list', [$params], GoogleExampleLibraryagentV1ListBooksResponse::class);
84  }
85  /**
86   * Return a book to the library. Returns the book if it is returned to the
87   * library successfully. Returns error if the book does not belong to the
88   * library or the users didn't borrow before. (books.returnShelvesBooks)
89   *
90   * @param string $name Required. The name of the book to return.
91   * @param array $optParams Optional parameters.
92   * @return GoogleExampleLibraryagentV1Book
93   */
94  public function returnShelvesBooks($name, $optParams = [])
95  {
96    $params = ['name' => $name];
97    $params = array_merge($params, $optParams);
98    return $this->call('return', [$params], GoogleExampleLibraryagentV1Book::class);
99  }
100}
101
102// Adding a class alias for backwards compatibility with the previous class name.
103class_alias(ShelvesBooks::class, 'Google_Service_Libraryagent_Resource_ShelvesBooks');
104