forked from layotto/protoc-gen-p6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog.proto
51 lines (40 loc) · 1.01 KB
/
blog.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
syntax = "proto3";
option go_package = "github.com/layotto/protoc-gen-p6/example/api/product/app/v1/blog;blog";
package product.app.v1.blog;
import "google/api/annotations.proto";
// BlogService is a blog demo
service BlogService {
rpc GetArticles(GetArticlesReq) returns (GetArticlesResp) {
option (google.api.http) = {
get: "/v1/articles"
additional_bindings {
get: "/v1/author/{author_id}/articles"
}
};
}
rpc CreateArticle(Article) returns (Article) {
option (google.api.http) = {
post: "/v1/author/{author_id}/articles"
};
}
}
message GetArticlesReq {
// @inject_tag: form:"title"
string title = 1;
// @inject_tag: form:"page"
int32 page = 2;
// @inject_tag: form:"page_size"
int32 page_size = 3;
// @inject_tag: form:"author_id" uri:"author_id"
int32 author_id = 4;
}
message GetArticlesResp {
int64 total = 1;
repeated Article articles = 2;
}
message Article {
string title = 1;
string content = 2;
// @inject_tag: form:"author_id" uri:"author_id"
int32 author_id = 3;
}