-
Notifications
You must be signed in to change notification settings - Fork 1
/
greeting.proto
58 lines (50 loc) · 1.86 KB
/
greeting.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
syntax ="proto3";
import "protosupport/v1/protosupport.proto";
package greeting.v1;
option go_package="greeting/v1;greeting";
// Greeting is a microservice with a very simple job, return a greeting in
// language selected from the Tongue enum.
service Greeting {
// This option binds the type "GreetErr" to this Greeting service and
// code generated will use GreetErr as the type for error retuns.
option (protosupport.v1.error_id_name) = "GreetErr";
// FetchGreeting returns a greeting in the language given by the
// Request, field "tongue".
rpc FetchGreeting(FetchGreetingRequest) returns (FetchGreetingResponse);
}
// which language do you want?
enum Tongue{
Unspecified = 0;
English = 1;
French = 2;
German = 3;
}
// The first four values of any error enum are to be as shown below.
enum GreetErr{
option (protosupport.v1.parigot_error) = true;
NoError = 0; // required
// Dispatch error occurs when we are trying to call a service
// implemented elsewhere. This error indicates that the process
// of the call itself had problems, not the execution of the
// service's method.
DispatchError = 1; // required
// UnmarshalFailed is used to indicate that in unmarshaling
// a request or result, the protobuf layer returned an error.
UnmarshalFailed = 2; // required
// MarshalFailed is used to indicate that in unmarshaling
// a request or result, the protobuf layer returned an error.
MarshalFailed = 3; // required
// FetchGreeting returns this when the parameter presented to
// it is not a language in it's list.
UnknownLang = 4;
}
// FetchGreet is called to retreive a common greeting, like
// Bonjuor in french.
message FetchGreetingRequest {
Tongue tongue = 1;
}
// FetchGreetingResponse is returned to a caller who sent a request
// to the FetchGreeting endpoint.
message FetchGreetingResponse {
string greeting = 1;
}