Package library
Overview ▹
Index ▹
func RegisterLibraryServiceServer ¶
func RegisterLibraryServiceServer(s *grpc.Server, srv LibraryServiceServer)
type Book ¶
A single book in the library.
type Book struct { // 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. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The name of the book author. Author string `protobuf:"bytes,2,opt,name=author" json:"author,omitempty"` // The title of the book. Title string `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"` // Value indicating whether the book has been read. Read bool `protobuf:"varint,4,opt,name=read" json:"read,omitempty"` }
func (*Book) Descriptor ¶
func (*Book) Descriptor() ([]byte, []int)
func (*Book) GetAuthor ¶
func (m *Book) GetAuthor() string
func (*Book) GetName ¶
func (m *Book) GetName() string
func (*Book) GetRead ¶
func (m *Book) GetRead() bool
func (*Book) GetTitle ¶
func (m *Book) GetTitle() string
func (*Book) ProtoMessage ¶
func (*Book) ProtoMessage()
func (*Book) Reset ¶
func (m *Book) Reset()
func (*Book) String ¶
func (m *Book) String() string
type CreateBookRequest ¶
Request message for LibraryService.CreateBook.
type CreateBookRequest struct { // The name of the shelf in which the book is created. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The book to create. Book *Book `protobuf:"bytes,2,opt,name=book" json:"book,omitempty"` }
func (*CreateBookRequest) Descriptor ¶
func (*CreateBookRequest) Descriptor() ([]byte, []int)
func (*CreateBookRequest) GetBook ¶
func (m *CreateBookRequest) GetBook() *Book
func (*CreateBookRequest) GetName ¶
func (m *CreateBookRequest) GetName() string
func (*CreateBookRequest) ProtoMessage ¶
func (*CreateBookRequest) ProtoMessage()
func (*CreateBookRequest) Reset ¶
func (m *CreateBookRequest) Reset()
func (*CreateBookRequest) String ¶
func (m *CreateBookRequest) String() string
type CreateShelfRequest ¶
Request message for LibraryService.CreateShelf.
type CreateShelfRequest struct {
// The shelf to create.
Shelf *Shelf `protobuf:"bytes,1,opt,name=shelf" json:"shelf,omitempty"`
}
func (*CreateShelfRequest) Descriptor ¶
func (*CreateShelfRequest) Descriptor() ([]byte, []int)
func (*CreateShelfRequest) GetShelf ¶
func (m *CreateShelfRequest) GetShelf() *Shelf
func (*CreateShelfRequest) ProtoMessage ¶
func (*CreateShelfRequest) ProtoMessage()
func (*CreateShelfRequest) Reset ¶
func (m *CreateShelfRequest) Reset()
func (*CreateShelfRequest) String ¶
func (m *CreateShelfRequest) String() string
type DeleteBookRequest ¶
Request message for LibraryService.DeleteBook.
type DeleteBookRequest struct {
// The name of the book to delete.
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}
func (*DeleteBookRequest) Descriptor ¶
func (*DeleteBookRequest) Descriptor() ([]byte, []int)
func (*DeleteBookRequest) GetName ¶
func (m *DeleteBookRequest) GetName() string
func (*DeleteBookRequest) ProtoMessage ¶
func (*DeleteBookRequest) ProtoMessage()
func (*DeleteBookRequest) Reset ¶
func (m *DeleteBookRequest) Reset()
func (*DeleteBookRequest) String ¶
func (m *DeleteBookRequest) String() string
type DeleteShelfRequest ¶
Request message for LibraryService.DeleteShelf.
type DeleteShelfRequest struct {
// The name of the shelf to delete.
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}
func (*DeleteShelfRequest) Descriptor ¶
func (*DeleteShelfRequest) Descriptor() ([]byte, []int)
func (*DeleteShelfRequest) GetName ¶
func (m *DeleteShelfRequest) GetName() string
func (*DeleteShelfRequest) ProtoMessage ¶
func (*DeleteShelfRequest) ProtoMessage()
func (*DeleteShelfRequest) Reset ¶
func (m *DeleteShelfRequest) Reset()
func (*DeleteShelfRequest) String ¶
func (m *DeleteShelfRequest) String() string
type GetBookRequest ¶
Request message for LibraryService.GetBook.
type GetBookRequest struct {
// The name of the book to retrieve.
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}
func (*GetBookRequest) Descriptor ¶
func (*GetBookRequest) Descriptor() ([]byte, []int)
func (*GetBookRequest) GetName ¶
func (m *GetBookRequest) GetName() string
func (*GetBookRequest) ProtoMessage ¶
func (*GetBookRequest) ProtoMessage()
func (*GetBookRequest) Reset ¶
func (m *GetBookRequest) Reset()
func (*GetBookRequest) String ¶
func (m *GetBookRequest) String() string
type GetShelfRequest ¶
Request message for LibraryService.GetShelf.
type GetShelfRequest struct {
// The name of the shelf to retrieve.
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}
func (*GetShelfRequest) Descriptor ¶
func (*GetShelfRequest) Descriptor() ([]byte, []int)
func (*GetShelfRequest) GetName ¶
func (m *GetShelfRequest) GetName() string
func (*GetShelfRequest) ProtoMessage ¶
func (*GetShelfRequest) ProtoMessage()
func (*GetShelfRequest) Reset ¶
func (m *GetShelfRequest) Reset()
func (*GetShelfRequest) String ¶
func (m *GetShelfRequest) String() string
type LibraryServiceClient ¶
type LibraryServiceClient interface { // Creates a shelf, and returns the new Shelf. CreateShelf(ctx context.Context, in *CreateShelfRequest, opts ...grpc.CallOption) (*Shelf, error) // Gets a shelf. Returns NOT_FOUND if the shelf does not exist. GetShelf(ctx context.Context, in *GetShelfRequest, opts ...grpc.CallOption) (*Shelf, error) // Lists shelves. The order is unspecified but deterministic. Newly created // shelves will not necessarily be added to the end of this list. ListShelves(ctx context.Context, in *ListShelvesRequest, opts ...grpc.CallOption) (*ListShelvesResponse, error) // Deletes a shelf. Returns NOT_FOUND if the shelf does not exist. DeleteShelf(ctx context.Context, in *DeleteShelfRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) // 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. MergeShelves(ctx context.Context, in *MergeShelvesRequest, opts ...grpc.CallOption) (*Shelf, error) // Creates a book, and returns the new Book. CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error) // Gets a book. Returns NOT_FOUND if the book does not exist. GetBook(ctx context.Context, in *GetBookRequest, opts ...grpc.CallOption) (*Book, error) // 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. ListBooks(ctx context.Context, in *ListBooksRequest, opts ...grpc.CallOption) (*ListBooksResponse, error) // Deletes a book. Returns NOT_FOUND if the book does not exist. DeleteBook(ctx context.Context, in *DeleteBookRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) // Updates a book. Returns INVALID_ARGUMENT if the name of the book // is non-empty and does equal the previous name. UpdateBook(ctx context.Context, in *UpdateBookRequest, opts ...grpc.CallOption) (*Book, error) // 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. MoveBook(ctx context.Context, in *MoveBookRequest, opts ...grpc.CallOption) (*Book, error) }
func NewLibraryServiceClient ¶
func NewLibraryServiceClient(cc *grpc.ClientConn) LibraryServiceClient
type LibraryServiceServer ¶
type LibraryServiceServer interface { // Creates a shelf, and returns the new Shelf. CreateShelf(context.Context, *CreateShelfRequest) (*Shelf, error) // Gets a shelf. Returns NOT_FOUND if the shelf does not exist. GetShelf(context.Context, *GetShelfRequest) (*Shelf, error) // Lists shelves. The order is unspecified but deterministic. Newly created // shelves will not necessarily be added to the end of this list. ListShelves(context.Context, *ListShelvesRequest) (*ListShelvesResponse, error) // Deletes a shelf. Returns NOT_FOUND if the shelf does not exist. DeleteShelf(context.Context, *DeleteShelfRequest) (*google_protobuf1.Empty, error) // 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. MergeShelves(context.Context, *MergeShelvesRequest) (*Shelf, error) // Creates a book, and returns the new Book. CreateBook(context.Context, *CreateBookRequest) (*Book, error) // Gets a book. Returns NOT_FOUND if the book does not exist. GetBook(context.Context, *GetBookRequest) (*Book, error) // 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. ListBooks(context.Context, *ListBooksRequest) (*ListBooksResponse, error) // Deletes a book. Returns NOT_FOUND if the book does not exist. DeleteBook(context.Context, *DeleteBookRequest) (*google_protobuf1.Empty, error) // Updates a book. Returns INVALID_ARGUMENT if the name of the book // is non-empty and does equal the previous name. UpdateBook(context.Context, *UpdateBookRequest) (*Book, error) // 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. MoveBook(context.Context, *MoveBookRequest) (*Book, error) }
type ListBooksRequest ¶
Request message for LibraryService.ListBooks.
type ListBooksRequest struct { // The name of the shelf whose books we'd like to list. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Requested page size. Server may return fewer books than requested. // If unspecified, server will pick an appropriate default. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` // 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. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` }
func (*ListBooksRequest) Descriptor ¶
func (*ListBooksRequest) Descriptor() ([]byte, []int)
func (*ListBooksRequest) GetName ¶
func (m *ListBooksRequest) GetName() string
func (*ListBooksRequest) GetPageSize ¶
func (m *ListBooksRequest) GetPageSize() int32
func (*ListBooksRequest) GetPageToken ¶
func (m *ListBooksRequest) GetPageToken() string
func (*ListBooksRequest) ProtoMessage ¶
func (*ListBooksRequest) ProtoMessage()
func (*ListBooksRequest) Reset ¶
func (m *ListBooksRequest) Reset()
func (*ListBooksRequest) String ¶
func (m *ListBooksRequest) String() string
type ListBooksResponse ¶
Response message for LibraryService.ListBooks.
type ListBooksResponse struct { // The list of books. Books []*Book `protobuf:"bytes,1,rep,name=books" json:"books,omitempty"` // 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. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` }
func (*ListBooksResponse) Descriptor ¶
func (*ListBooksResponse) Descriptor() ([]byte, []int)
func (*ListBooksResponse) GetBooks ¶
func (m *ListBooksResponse) GetBooks() []*Book
func (*ListBooksResponse) GetNextPageToken ¶
func (m *ListBooksResponse) GetNextPageToken() string
func (*ListBooksResponse) ProtoMessage ¶
func (*ListBooksResponse) ProtoMessage()
func (*ListBooksResponse) Reset ¶
func (m *ListBooksResponse) Reset()
func (*ListBooksResponse) String ¶
func (m *ListBooksResponse) String() string
type ListShelvesRequest ¶
Request message for LibraryService.ListShelves.
type ListShelvesRequest struct { // Requested page size. Server may return fewer shelves than requested. // If unspecified, server will pick an appropriate default. PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` // 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. PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` }
func (*ListShelvesRequest) Descriptor ¶
func (*ListShelvesRequest) Descriptor() ([]byte, []int)
func (*ListShelvesRequest) GetPageSize ¶
func (m *ListShelvesRequest) GetPageSize() int32
func (*ListShelvesRequest) GetPageToken ¶
func (m *ListShelvesRequest) GetPageToken() string
func (*ListShelvesRequest) ProtoMessage ¶
func (*ListShelvesRequest) ProtoMessage()
func (*ListShelvesRequest) Reset ¶
func (m *ListShelvesRequest) Reset()
func (*ListShelvesRequest) String ¶
func (m *ListShelvesRequest) String() string
type ListShelvesResponse ¶
Response message for LibraryService.ListShelves.
type ListShelvesResponse struct { // The list of shelves. Shelves []*Shelf `protobuf:"bytes,1,rep,name=shelves" json:"shelves,omitempty"` // 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. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` }
func (*ListShelvesResponse) Descriptor ¶
func (*ListShelvesResponse) Descriptor() ([]byte, []int)
func (*ListShelvesResponse) GetNextPageToken ¶
func (m *ListShelvesResponse) GetNextPageToken() string
func (*ListShelvesResponse) GetShelves ¶
func (m *ListShelvesResponse) GetShelves() []*Shelf
func (*ListShelvesResponse) ProtoMessage ¶
func (*ListShelvesResponse) ProtoMessage()
func (*ListShelvesResponse) Reset ¶
func (m *ListShelvesResponse) Reset()
func (*ListShelvesResponse) String ¶
func (m *ListShelvesResponse) String() string
type MergeShelvesRequest ¶
Describes the shelf being removed (other_shelf_name) and updated (name) in this merge.
type MergeShelvesRequest struct { // The name of the shelf we're adding books to. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The name of the shelf we're removing books from and deleting. OtherShelfName string `protobuf:"bytes,2,opt,name=other_shelf_name,json=otherShelfName" json:"other_shelf_name,omitempty"` }
func (*MergeShelvesRequest) Descriptor ¶
func (*MergeShelvesRequest) Descriptor() ([]byte, []int)
func (*MergeShelvesRequest) GetName ¶
func (m *MergeShelvesRequest) GetName() string
func (*MergeShelvesRequest) GetOtherShelfName ¶
func (m *MergeShelvesRequest) GetOtherShelfName() string
func (*MergeShelvesRequest) ProtoMessage ¶
func (*MergeShelvesRequest) ProtoMessage()
func (*MergeShelvesRequest) Reset ¶
func (m *MergeShelvesRequest) Reset()
func (*MergeShelvesRequest) String ¶
func (m *MergeShelvesRequest) String() string
type MoveBookRequest ¶
Describes what book to move (name) and what shelf we're moving it to (other_shelf_name).
type MoveBookRequest struct { // The name of the book to move. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The name of the destination shelf. OtherShelfName string `protobuf:"bytes,2,opt,name=other_shelf_name,json=otherShelfName" json:"other_shelf_name,omitempty"` }
func (*MoveBookRequest) Descriptor ¶
func (*MoveBookRequest) Descriptor() ([]byte, []int)
func (*MoveBookRequest) GetName ¶
func (m *MoveBookRequest) GetName() string
func (*MoveBookRequest) GetOtherShelfName ¶
func (m *MoveBookRequest) GetOtherShelfName() string
func (*MoveBookRequest) ProtoMessage ¶
func (*MoveBookRequest) ProtoMessage()
func (*MoveBookRequest) Reset ¶
func (m *MoveBookRequest) Reset()
func (*MoveBookRequest) String ¶
func (m *MoveBookRequest) String() string
type Shelf ¶
A Shelf contains a collection of books with a theme.
type Shelf struct { // The resource name of the shelf. // Shelf names have the form `shelves/{shelf_id}`. // The name is ignored when creating a shelf. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The theme of the shelf Theme string `protobuf:"bytes,2,opt,name=theme" json:"theme,omitempty"` }
func (*Shelf) Descriptor ¶
func (*Shelf) Descriptor() ([]byte, []int)
func (*Shelf) GetName ¶
func (m *Shelf) GetName() string
func (*Shelf) GetTheme ¶
func (m *Shelf) GetTheme() string
func (*Shelf) ProtoMessage ¶
func (*Shelf) ProtoMessage()
func (*Shelf) Reset ¶
func (m *Shelf) Reset()
func (*Shelf) String ¶
func (m *Shelf) String() string
type UpdateBookRequest ¶
Request message for LibraryService.UpdateBook.
type UpdateBookRequest struct { // The name of the book to update. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The book to update with. The name must match or be empty. Book *Book `protobuf:"bytes,2,opt,name=book" json:"book,omitempty"` }
func (*UpdateBookRequest) Descriptor ¶
func (*UpdateBookRequest) Descriptor() ([]byte, []int)
func (*UpdateBookRequest) GetBook ¶
func (m *UpdateBookRequest) GetBook() *Book
func (*UpdateBookRequest) GetName ¶
func (m *UpdateBookRequest) GetName() string
func (*UpdateBookRequest) ProtoMessage ¶
func (*UpdateBookRequest) ProtoMessage()
func (*UpdateBookRequest) Reset ¶
func (m *UpdateBookRequest) Reset()
func (*UpdateBookRequest) String ¶
func (m *UpdateBookRequest) String() string