1# Generated with protoc-gen-openapi
2# https://github.com/googleapis/gnostic/tree/master/apps/protoc-gen-openapi
3
4openapi: 3.0.3
5info:
6    title: LibraryService
7    description: 'This API represents a simple digital library.  It lets you manage Shelf resources and Book resources in the library. It defines the following resource model: - The API has a collection of [Shelf][google.example.library.v1.Shelf]   resources, named `shelves/*` - Each Shelf has a collection of [Book][google.example.library.v1.Book]   resources, named `shelves/*/books/*`'
8    version: 0.0.1
9paths:
10    /v1/shelves:
11        get:
12            summary: Lists shelves. The order is unspecified but deterministic. Newly created shelves will not necessarily be added to the end of this list.
13            operationId: LibraryService_ListShelves
14            parameters:
15                - name: page_size
16                  in: query
17                  description: Requested page size. Server may return fewer shelves than requested. If unspecified, server will pick an appropriate default.
18                  schema:
19                    type: string
20                - name: page_token
21                  in: query
22                  description: A token identifying a page of results the server should return. Typically, this is the value of [ListShelvesResponse.next_page_token][google.example.library.v1.ListShelvesResponse.next_page_token] returned from the previous call to `ListShelves` method.
23                  schema:
24                    type: string
25            responses:
26                "200":
27                    description: OK
28                    content:
29                        application/json:
30                            schema:
31                                $ref: '#/components/schemas/ListShelvesResponse'
32        post:
33            summary: Creates a shelf, and returns the new Shelf.
34            operationId: LibraryService_CreateShelf
35            requestBody:
36                content:
37                    application/json:
38                        schema:
39                            $ref: '#/components/schemas/Shelf'
40                required: true
41            responses:
42                "200":
43                    description: OK
44                    content:
45                        application/json:
46                            schema:
47                                $ref: '#/components/schemas/Shelf'
48    /v1/shelves/{shelf}:
49        get:
50            summary: Gets a shelf. Returns NOT_FOUND if the shelf does not exist.
51            operationId: LibraryService_GetShelf
52            parameters:
53                - name: shelf
54                  in: path
55                  description: The shelf id.
56                  required: true
57                  schema:
58                    type: string
59            responses:
60                "200":
61                    description: OK
62                    content:
63                        application/json:
64                            schema:
65                                $ref: '#/components/schemas/Shelf'
66        delete:
67            summary: Deletes a shelf. Returns NOT_FOUND if the shelf does not exist.
68            operationId: LibraryService_DeleteShelf
69            parameters:
70                - name: shelf
71                  in: path
72                  description: The shelf id.
73                  required: true
74                  schema:
75                    type: string
76            responses:
77                "200":
78                    description: OK
79                    content:
80                        application/json:
81                            schema:
82                                $ref: '#/components/schemas/Empty'
83    /v1/shelves/{shelf}/books:
84        get:
85            summary: 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.
86            operationId: LibraryService_ListBooks
87            parameters:
88                - name: shelf
89                  in: path
90                  description: The shelf id.
91                  required: true
92                  schema:
93                    type: string
94                - name: page_size
95                  in: query
96                  description: Requested page size. Server may return fewer books than requested. If unspecified, server will pick an appropriate default.
97                  schema:
98                    type: string
99                - name: page_token
100                  in: query
101                  description: A token identifying a page of results the server should return. Typically, this is the value of [ListBooksResponse.next_page_token][google.example.library.v1.ListBooksResponse.next_page_token]. returned from the previous call to `ListBooks` method.
102                  schema:
103                    type: string
104            responses:
105                "200":
106                    description: OK
107                    content:
108                        application/json:
109                            schema:
110                                $ref: '#/components/schemas/ListBooksResponse'
111        post:
112            summary: Creates a book, and returns the new Book.
113            operationId: LibraryService_CreateBook
114            parameters:
115                - name: shelf
116                  in: path
117                  description: The shelf id.
118                  required: true
119                  schema:
120                    type: string
121            requestBody:
122                content:
123                    application/json:
124                        schema:
125                            $ref: '#/components/schemas/Book'
126                required: true
127            responses:
128                "200":
129                    description: OK
130                    content:
131                        application/json:
132                            schema:
133                                $ref: '#/components/schemas/Book'
134    /v1/shelves/{shelf}/books/{book}:
135        get:
136            summary: Gets a book. Returns NOT_FOUND if the book does not exist.
137            operationId: LibraryService_GetBook
138            parameters:
139                - name: shelf
140                  in: path
141                  description: The shelf id.
142                  required: true
143                  schema:
144                    type: string
145                - name: book
146                  in: path
147                  description: The book id.
148                  required: true
149                  schema:
150                    type: string
151            responses:
152                "200":
153                    description: OK
154                    content:
155                        application/json:
156                            schema:
157                                $ref: '#/components/schemas/Book'
158        put:
159            summary: Updates a book. Returns INVALID_ARGUMENT if the name of the book is non-empty and does not equal the existing name.
160            operationId: LibraryService_UpdateBook
161            parameters:
162                - name: shelf
163                  in: path
164                  description: The shelf id.
165                  required: true
166                  schema:
167                    type: string
168                - name: book
169                  in: path
170                  description: The book id.
171                  required: true
172                  schema:
173                    type: string
174                - name: name
175                  in: query
176                  description: The name of the book to update.
177                  schema:
178                    type: string
179            requestBody:
180                content:
181                    application/json:
182                        schema:
183                            $ref: '#/components/schemas/Book'
184                required: true
185            responses:
186                "200":
187                    description: OK
188                    content:
189                        application/json:
190                            schema:
191                                $ref: '#/components/schemas/Book'
192        delete:
193            summary: Deletes a book. Returns NOT_FOUND if the book does not exist.
194            operationId: LibraryService_DeleteBook
195            parameters:
196                - name: shelf
197                  in: path
198                  description: The shelf id.
199                  required: true
200                  schema:
201                    type: string
202                - name: book
203                  in: path
204                  description: The book id.
205                  required: true
206                  schema:
207                    type: string
208            responses:
209                "200":
210                    description: OK
211                    content:
212                        application/json:
213                            schema:
214                                $ref: '#/components/schemas/Empty'
215    /v1/shelves/{shelf}/books/{book}:move:
216        post:
217            summary: Moves a book to another shelf, and returns the new book. The book id of the new book may not be the same as the original book.
218            operationId: LibraryService_MoveBook
219            parameters:
220                - name: shelf
221                  in: path
222                  description: The shelf id.
223                  required: true
224                  schema:
225                    type: string
226                - name: book
227                  in: path
228                  description: The book id.
229                  required: true
230                  schema:
231                    type: string
232            requestBody:
233                content:
234                    application/json:
235                        schema:
236                            $ref: '#/components/schemas/MoveBookRequest'
237                required: true
238            responses:
239                "200":
240                    description: OK
241                    content:
242                        application/json:
243                            schema:
244                                $ref: '#/components/schemas/Book'
245    /v1/shelves/{shelf}:merge:
246        post:
247            summary: Merges two shelves by adding all books from the shelf named `other_shelf_name` to shelf `name`, and deletes `other_shelf_name`. Returns the updated shelf. The book ids of the moved books may not be the same as the original books. Returns NOT_FOUND if either shelf does not exist. This call is a no-op if the specified shelves are the same.
248            operationId: LibraryService_MergeShelves
249            parameters:
250                - name: shelf
251                  in: path
252                  description: The shelf id.
253                  required: true
254                  schema:
255                    type: string
256            requestBody:
257                content:
258                    application/json:
259                        schema:
260                            $ref: '#/components/schemas/MergeShelvesRequest'
261                required: true
262            responses:
263                "200":
264                    description: OK
265                    content:
266                        application/json:
267                            schema:
268                                $ref: '#/components/schemas/Shelf'
269components:
270    schemas:
271        Book:
272            properties:
273                name:
274                    type: string
275                    description: 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.
276                author:
277                    type: string
278                    description: The name of the book author.
279                title:
280                    type: string
281                    description: The title of the book.
282                read:
283                    type: boolean
284                    description: Value indicating whether the book has been read.
285                create_time:
286                    readOnly: true
287                    type: string
288                    description: Creation timestamp.
289                    format: RFC3339
290                update_time:
291                    readOnly: true
292                    type: string
293                    description: Last update timestamp.
294                    format: RFC3339
295            description: A single book in the library.
296        Empty:
297            properties: {}
298            description: 'A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:     service Foo {       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);     } The JSON representation for `Empty` is empty JSON object `{}`.'
299        ListBooksResponse:
300            properties:
301                books:
302                    type: array
303                    items:
304                        $ref: '#/components/schemas/Book'
305                    description: The list of books.
306                next_page_token:
307                    type: string
308                    description: A token to retrieve next page of results. Pass this value in the [ListBooksRequest.page_token][google.example.library.v1.ListBooksRequest.page_token] field in the subsequent call to `ListBooks` method to retrieve the next page of results.
309            description: Response message for LibraryService.ListBooks.
310        ListShelvesResponse:
311            properties:
312                shelves:
313                    type: array
314                    items:
315                        $ref: '#/components/schemas/Shelf'
316                    description: The list of shelves.
317                next_page_token:
318                    type: string
319                    description: A token to retrieve next page of results. Pass this value in the [ListShelvesRequest.page_token][google.example.library.v1.ListShelvesRequest.page_token] field in the subsequent call to `ListShelves` method to retrieve the next page of results.
320            description: Response message for LibraryService.ListShelves.
321        MergeShelvesRequest:
322            properties:
323                name:
324                    type: string
325                    description: The name of the shelf we're adding books to.
326                other_shelf_name:
327                    type: string
328                    description: The name of the shelf we're removing books from and deleting.
329            description: Describes the shelf being removed (other_shelf_name) and updated (name) in this merge.
330        MoveBookRequest:
331            properties:
332                name:
333                    type: string
334                    description: The name of the book to move.
335                other_shelf_name:
336                    type: string
337                    description: The name of the destination shelf.
338            description: Describes what book to move (name) and what shelf we're moving it to (other_shelf_name).
339        Shelf:
340            properties:
341                name:
342                    type: string
343                    description: The resource name of the shelf. Shelf names have the form `shelves/{shelf_id}`. The name is ignored when creating a shelf.
344                theme:
345                    type: string
346                    description: The theme of the shelf
347                create_time:
348                    readOnly: true
349                    type: string
350                    description: Creation timestamp.
351                    format: RFC3339
352                update_time:
353                    readOnly: true
354                    type: string
355                    description: Last update timestamp.
356                    format: RFC3339
357            description: A Shelf contains a collection of books with a theme.
358