...
1syntax = "proto3";
2option go_package = "examplepb";
3
4// Echo Service
5//
6// Echo Service API consists of a single service which returns
7// a message.
8package grpc.gateway.examples.internal.examplepb;
9
10import "google/api/annotations.proto";
11
12// Embedded represents a message embedded in SimpleMessage.
13message Embedded {
14 oneof mark {
15 int64 progress = 1;
16 string note = 2;
17 }
18}
19
20// SimpleMessage represents a simple message sent to the Echo service.
21message SimpleMessage {
22 // Id represents the message identifier.
23 string id = 1;
24 int64 num = 2;
25 oneof code {
26 int64 line_num = 3;
27 string lang = 4;
28 }
29 Embedded status = 5;
30 oneof ext {
31 int64 en = 6;
32 Embedded no = 7;
33 }
34}
35
36// Echo service responds to incoming echo requests.
37service EchoService {
38 // Echo method receives a simple message and returns it.
39 //
40 // The message posted as the id parameter will also be
41 // returned.
42 rpc Echo(SimpleMessage) returns (SimpleMessage) {
43 option (google.api.http) = {
44 post: "/v1/example/echo/{id}"
45 additional_bindings {
46 get: "/v1/example/echo/{id}/{num}"
47 }
48 additional_bindings {
49 get: "/v1/example/echo/{id}/{num}/{lang}"
50 }
51 additional_bindings {
52 get: "/v1/example/echo1/{id}/{line_num}/{status.note}"
53 }
54 additional_bindings {
55 get: "/v1/example/echo2/{no.note}"
56 }
57 };
58 }
59 // EchoBody method receives a simple message and returns it.
60 rpc EchoBody(SimpleMessage) returns (SimpleMessage) {
61 option (google.api.http) = {
62 post: "/v1/example/echo_body"
63 body: "*"
64 };
65 }
66 // EchoDelete method receives a simple message and returns it.
67 rpc EchoDelete(SimpleMessage) returns (SimpleMessage) {
68 option (google.api.http) = {
69 delete: "/v1/example/echo_delete"
70 };
71 }
72}
View as plain text