-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathapi.mustache
More file actions
58 lines (50 loc) · 1.75 KB
/
api.mustache
File metadata and controls
58 lines (50 loc) · 1.75 KB
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
{{>partial_header}}
syntax = "proto3";
package {{#lambda.lowercase}}{{{packageName}}}.{{{apiPackage}}}.{{{classname}}};{{/lambda.lowercase}}
{{#customOptionsApi}}
{{{.}}}
{{/customOptionsApi}}
import "google/protobuf/empty.proto";
{{#imports}}
{{#import}}
import public "{{{import}}}.proto";
{{/import}}
{{/imports}}
service {{classname}} {
{{#operations}}
{{#operation}}
{{#description}}
// {{{.}}}
{{/description}}
rpc {{operationId}} ({{#hasParams}}{{operationId}}Request{{/hasParams}}{{^hasParams}}google.protobuf.Empty{{/hasParams}}) returns ({{#vendorExtensions.x-grpc-response}}{{.}}{{/vendorExtensions.x-grpc-response}}{{^vendorExtensions.x-grpc-response}}{{operationId}}Response{{/vendorExtensions.x-grpc-response}});
{{/operation}}
{{/operations}}
}
{{#operations}}
{{#operation}}
{{#hasParams}}
message {{operationId}}Request {
{{#allParams}}
{{#description}}
// {{{.}}}
{{/description}}
{{#vendorExtensions.x-protobuf-type}}{{.}} {{/vendorExtensions.x-protobuf-type}}{{vendorExtensions.x-protobuf-data-type}} {{paramName}} = {{vendorExtensions.x-protobuf-index}}{{#vendorExtensions.x-protobuf-json-name}} [json_name="{{vendorExtensions.x-protobuf-json-name}}"]{{/vendorExtensions.x-protobuf-json-name}};
{{/allParams}}
}
{{/hasParams}}
{{^vendorExtensions.x-grpc-response}}
message {{operationId}}Response {
{{{vendorExtensions.x-grpc-response-type}}} data = 1;
}
{{/vendorExtensions.x-grpc-response}}
{{#supportMultipleResponses}}
message {{operationId}}Response {
oneof response {
{{#responses}}
{{{vendorExtensions.x-oneOf-response-type}}} {{vendorExtensions.x-oneOf-response-name}}_{{code}} = {{vendorExtensions.x-oneOf-response-index}};
{{/responses}}
}
}
{{/supportMultipleResponses}}
{{/operation}}
{{/operations}}