github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/examples/library/apipb/library.proto (about) 1 // https://cloud.google.com/apis/design/resource_names 2 syntax = "proto3"; 3 4 package larking.examples.library; 5 6 import "google/api/annotations.proto"; 7 8 option go_package = "github.com/emcfarlane/larking/examples/library/apipb;apipb"; 9 10 service Library { 11 rpc GetBook(GetBookRequest) returns (Book) { 12 option (google.api.http) = { 13 get : "/v1/{name=shelves/*/books/*}" 14 }; 15 }; 16 rpc CreateBook(CreateBookRequest) returns (Book) { 17 option (google.api.http) = { 18 post : "/v1/{parent=shelves/*}/books" 19 body : "book" 20 }; 21 }; 22 } 23 24 message Book { 25 // Resource name of the book. It must have the format of "shelves/*/books/*". 26 // For example: "shelves/shelf1/books/book2". 27 string name = 1; 28 29 string title = 2; 30 string author = 3; 31 string cover_image = 4; 32 } 33 34 message GetBookRequest { 35 // Resource name of a book. For example: "shelves/shelf1/books/book2". 36 string name = 1; 37 } 38 39 message CreateBookRequest { 40 // Resource name of the parent resource where to create the book. 41 // For example: "shelves/shelf1". 42 string parent = 1; 43 // The Book resource to be created. Client must not set the `Book.name` field. 44 Book book = 2; 45 }