| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package mypackage.books.v1; |
| 4 |
|
| 5 |
import "google/protobuf/empty.proto"; |
| 6 |
import "google/api/field_behavior.proto"; |
| 7 |
|
| 8 |
import "google/api/annotations.proto"; |
| 9 |
|
| 10 |
option go_package = "mypackage.books.v1/books"; |
| 11 |
|
| 12 |
// Book service |
| 13 |
service BooksService { |
| 14 |
// Get a book. |
| 15 |
rpc GetBook(GetBookRequest) returns (Book) { |
| 16 |
option (google.api.http) = { |
| 17 |
get: "/resources/store/v1/{name=books/*}" |
| 18 |
}; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
// The definition of a book resource. |
| 23 |
message Book { |
| 24 |
// The name of the book. |
| 25 |
// Format: books/{book}. |
| 26 |
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; |
| 27 |
|
| 28 |
// The display name of the book. |
| 29 |
string display_name = 2 [(google.api.field_behavior) = REQUIRED]; |
| 30 |
|
| 31 |
// The authors of the book. |
| 32 |
repeated string authors = 3 [(google.api.field_behavior) = REQUIRED]; |
| 33 |
|
| 34 |
// The publisher of the book |
| 35 |
string publisher = 4 [(google.api.field_behavior) = OPTIONAL]; |
| 36 |
} |
| 37 |
|
| 38 |
// Request message for [play.me.resources.books.v1.BooksService.GetBook]. |
| 39 |
message GetBookRequest { |
| 40 |
// The book name is the unique identifier across organisations. |
| 41 |
// Format: books/{book} |
| 42 |
string name = 1 [(google.api.field_behavior) = REQUIRED]; |
| 43 |
} |
| 44 |
|
| 45 |
// From https://alis.build/guides/how-to-guides/make-your-first-request.html#book-repository-example |