-
Notifications
You must be signed in to change notification settings - Fork 144
/
echo.proto
65 lines (56 loc) · 1.94 KB
/
echo.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
// In general, while you can use proto2 (the current default protocol buffers
// version), we recommend that you use proto3 with gRPC as it lets you use the
// full range of gRPC-supported languages, as well as avoiding compatibility
// issues with proto2 clients talking to proto3 servers and vice versa.
syntax = "proto3";
// The package name determines the name of the directories that truss creates
// for `package echo;` truss will create the directory "echo-service".
package echo;
import "github.com/metaverse/truss/deftree/googlethirdparty/annotations.proto";
service Echo {
// Echo "echos" the incoming string
rpc Echo (EchoRequest) returns (EchoResponse) {
option (google.api.http) = {
// All fields (In) are query parameters of the http request unless otherwise specified
get: "/echo"
additional_bindings {
// Trailing slashes are different routes
get: "/echo/"
}
};
}
// Louder "echos" the incoming string with `Loudness` additional exclamation marks
rpc Louder (LouderRequest) returns (EchoResponse) {
option (google.api.http) = {
custom {
kind: "HEAD"
// Loudness is accepted in the http path
path: "/louder/{Loudness}"
}
additional_bindings {
post: "/louder/{Loudness}"
// All other fields (In) are located in the body of the http/json request
body: "*"
}
};
}
// LouderGet is the same as Louder, but pulls fields other than Loudness (i.e. In) from query params instead of POST
rpc LouderGet (LouderRequest) returns (EchoResponse) {
option (google.api.http) = {
// Loudness is accepted in the http path
get: "/louder/{Loudness}"
};
}
}
message EchoRequest {
string In = 1;
}
message LouderRequest {
// In is the string to echo back
string In = 1;
// Loudness is the number of exclamations marks to add to the echoed string
int32 Loudness = 2;
}
message EchoResponse {
string Out = 1;
}