-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserDescribe.proto
96 lines (81 loc) · 1.66 KB
/
userDescribe.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
syntax = "proto3";
package main;
option go_package = "./user";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
// The user service definition with http transcoding
service UserService {
rpc CreateUser(CreateUserReq) returns (CreateUserRes) {
// Define HTTP mapping.
option (google.api.http) = {
post: "/users"
body: "*"
};
}
rpc ReadUser(ReadUserReq) returns (ReadUserRes) {
option (google.api.http) = {
get: "/users/{id}"
};
}
rpc UpdateUser(UpdateUserReq) returns (UpdateUserRes) {
option (google.api.http) = {
put: "/users/{id}"
body: "user"
};
}
rpc DeleteUser(DeleteUserReq) returns (DeleteUserRes) {
option (google.api.http) = {
delete: "/users/{id}"
};
}
rpc ListUsers(google.protobuf.Empty) returns (ListUsersRes) {
option (google.api.http) = {
get: "/user"
};
}
}
message User {
string id = 1;
string firstname = 2;
string lastname = 3;
int32 age = 4;
string email = 5;
}
// Defintion of request and respone for each services
message CreateUserReq {
string firstname = 1;
string lastname = 2;
int32 age = 3;
string email = 4;
}
message CreateUserRes {
string id = 1;
}
message UpdateUserReqBody {
string firstname = 2;
string lastname = 3;
int32 age = 4;
string email = 5;
}
message UpdateUserReq {
string id = 1;
UpdateUserReqBody user = 2;
}
message UpdateUserRes {
User user = 1;
}
message ReadUserReq {
string id = 1;
}
message ReadUserRes {
User user = 1;
}
message DeleteUserReq {
string id = 1;
}
message DeleteUserRes {
bool success = 1;
}
message ListUsersRes {
repeated User users = 1;
}