Commit 29881ae8 authored by tammam.alsoleman's avatar tammam.alsoleman

Create book.proto

parent 46b5fd21
syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.ds.proto";
enum BookType {
UNKNOWN = 0;
FICTION = 1;
SCIENCE = 2;
TECHNOLOGY = 3;
HISTORY = 4;
}
message Author {
string name = 1;
string country = 2;
string email = 3;
}
message Publisher {
string name = 1;
string city = 2;
int32 established_year = 3;
}
message Book {
string title = 1;
Author author = 2; // nested message
string isbn = 3;
int32 publication_year = 4;
BookType type = 5; // enum
Publisher publisher = 6; // nested message
repeated string genres = 7; // repeated field
double price = 8;
bool available = 9;
int32 page_count = 10;
}
message Library {
repeated Book books = 1;
}
service LibraryService {
rpc AddBook(Book) returns (OperationResponse);
rpc FindBooks(SearchRequest) returns (Library);
rpc GetBook(BookRequest) returns (Book);
}
message OperationResponse {
bool success = 1;
string message = 2;
string book_id = 3;
}
message SearchRequest {
string query = 1;
BookType type = 2;
}
message BookRequest {
string isbn = 1;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment