github.com/erda-project/erda-infra@v1.0.10-0.20240327085753-f3a249292aeb/examples/service/protocol/user.proto (about) 1 syntax = "proto3"; 2 3 package erda.infra.example; 4 import "google/api/annotations.proto"; 5 option go_package = "github.com/erda-project/erda-infra/examples/service/protocol/pb"; 6 7 // The user service definition. 8 service UserService { 9 10 // get user 11 rpc GetUser (GetUserRequest) returns (GetUserResponse) { 12 option (google.api.http) = { 13 get: "/api/user/{id}", 14 }; 15 } 16 17 // update user 18 rpc UpdateUser (UpdateUserRequest) returns (UpdateUserResponse) { 19 option (google.api.http) = { 20 put: "/api/user/{user.id}", 21 }; 22 } 23 24 } 25 26 message User { 27 int64 id = 1; 28 string name = 2; 29 int32 age = 3; 30 repeated int64 books = 4; 31 } 32 33 message GetUserRequest { 34 string id = 1; 35 } 36 37 message GetUserResponse { 38 bool success = 1; 39 User data = 2; 40 } 41 42 message UpdateUserRequest { 43 User user = 1; 44 } 45 46 message UpdateUserResponse { 47 bool success = 1; 48 }