-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.proto
48 lines (40 loc) · 1.21 KB
/
api.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
syntax = "proto3";
package protos.web;
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "testproj/app/core/hellow";
message HellowRequest { string body = 1; }
// HellowResponse represents the response for both POST and GET endpoints
message HellowResponse {
bool success = 1;
string data = 2;
repeated string errors = 3;
}
// HellowGetRequest represents the request for the Hellow GET endpoint
message HellowGetRequest { string name = 1; }
service HellowService {
// PostHellow handles the POST /hellow endpoint
rpc PostHellow(HellowRequest) returns (HellowResponse) {
option (google.api.http) = {
post : "/hellow"
body : "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary : "Post a request body."
parameters : {
headers : {
name : "X-Request-ID"
description : "Unique request ID"
type : STRING
required : true
}
}
};
}
// GetHellow handles the GET /hellow/:name endpoint
rpc GetHellow(HellowGetRequest) returns (HellowResponse) {
option (google.api.http) = {
get : "/hellow/{name}"
};
}
}