# Generated with protoc-gen-openapi # https://github.com/google/gnostic/tree/master/apps/protoc-gen-openapi openapi: 3.0.3 info: title: LibraryService API 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/*` version: 0.0.1 paths: /v1/shelves: get: tags: - LibraryService summary: ListShelves description: |- Lists shelves. The order is unspecified but deterministic. Newly created shelves will not necessarily be added to the end of this list. operationId: LibraryService_ListShelves parameters: - name: page_size in: query description: Requested page size. Server may return fewer shelves than requested. If unspecified, server will pick an appropriate default. schema: type: integer format: int32 - name: page_token in: query 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. schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListShelvesResponse' post: tags: - LibraryService summary: CreateShelf description: Creates a shelf, and returns the new Shelf. operationId: LibraryService_CreateShelf requestBody: content: application/json: schema: $ref: '#/components/schemas/Shelf' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Shelf' /v1/shelves/{shelf}: get: tags: - LibraryService summary: GetShelf description: Gets a shelf. Returns NOT_FOUND if the shelf does not exist. operationId: LibraryService_GetShelf parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Shelf' delete: tags: - LibraryService summary: DeleteShelf description: Deletes a shelf. Returns NOT_FOUND if the shelf does not exist. operationId: LibraryService_DeleteShelf parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string responses: "200": description: OK content: {} /v1/shelves/{shelf}/books: get: tags: - LibraryService summary: ListBooks description: |- 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. operationId: LibraryService_ListBooks parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string - name: page_size in: query description: Requested page size. Server may return fewer books than requested. If unspecified, server will pick an appropriate default. schema: type: integer format: int32 - name: page_token in: query 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. schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListBooksResponse' post: tags: - LibraryService summary: CreateBook description: Creates a book, and returns the new Book. operationId: LibraryService_CreateBook parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Book' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Book' /v1/shelves/{shelf}/books/{book}: get: tags: - LibraryService summary: GetBook description: Gets a book. Returns NOT_FOUND if the book does not exist. operationId: LibraryService_GetBook parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string - name: book in: path description: The book id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Book' put: tags: - LibraryService summary: UpdateBook description: |- Updates a book. Returns INVALID_ARGUMENT if the name of the book is non-empty and does not equal the existing name. operationId: LibraryService_UpdateBook parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string - name: book in: path description: The book id. required: true schema: type: string - name: name in: query description: The name of the book to update. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Book' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Book' delete: tags: - LibraryService summary: DeleteBook description: Deletes a book. Returns NOT_FOUND if the book does not exist. operationId: LibraryService_DeleteBook parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string - name: book in: path description: The book id. required: true schema: type: string responses: "200": description: OK content: {} /v1/shelves/{shelf}/books/{book}:move: post: tags: - LibraryService summary: MoveBook description: |- 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. operationId: LibraryService_MoveBook parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string - name: book in: path description: The book id. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/MoveBookRequest' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Book' /v1/shelves/{shelf}:merge: post: tags: - LibraryService summary: MergeShelves description: |- 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. operationId: LibraryService_MergeShelves parameters: - name: shelf in: path description: The shelf id. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/MergeShelvesRequest' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Shelf' components: schemas: Book: properties: name: pattern: ^shelves/[a-z2-7]{26}/books/[a-z2-7]{26}$ type: string 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. author: type: string description: The name of the book author. title: type: string description: The title of the book. read: type: boolean description: Value indicating whether the book has been read. borrow_time: readOnly: true type: string description: The previous borrowing timestamp. format: date-time created_at: readOnly: true type: string description: The creation date and time. format: date-time updated_at: readOnly: true type: string description: The last update date and time. format: date-time description: A single book in the library. ListBooksResponse: properties: books: type: array items: $ref: '#/components/schemas/Book' description: The list of books. next_page_token: type: string 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. description: Response message for LibraryService.ListBooks. ListShelvesResponse: properties: shelves: type: array items: $ref: '#/components/schemas/Shelf' description: The list of shelves. next_page_token: type: string 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. description: Response message for LibraryService.ListShelves. MergeShelvesRequest: properties: name: type: string description: The name of the shelf we're adding books to. other_shelf_name: type: string description: The name of the shelf we're removing books from and deleting. description: Describes the shelf being removed (other_shelf_name) and updated (name) in this merge. MoveBookRequest: properties: name: type: string description: The name of the book to move. other_shelf_name: type: string description: The name of the destination shelf. description: Describes what book to move (name) and what shelf we're moving it to (other_shelf_name). Shelf: properties: name: pattern: ^shelves/[a-z2-7]{26}$ type: string description: The resource name of the shelf. Shelf names have the form `shelves/{shelf_id}`. The name is ignored when creating a shelf. theme: type: string description: The theme of the shelf next_sort_at: readOnly: true type: string description: The next sorting date. format: date created_at: readOnly: true type: string description: The creation date and time. format: date-time updated_at: readOnly: true type: string description: The last update date and time. format: date-time description: A Shelf contains a collection of books with a theme. tags: - name: LibraryService