-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharticle.api
More file actions
112 lines (104 loc) · 3.35 KB
/
Copy patharticle.api
File metadata and controls
112 lines (104 loc) · 3.35 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
syntax = "v1"
type (
// Article structure
Article {
Id string `json:"id"`
Title string `json:"title"`
Brief string `json:"brief"`
Content string `json:"content"`
CoverImageUrl string `json:"cover_image_url"`
ManualTypeTag string `json:"manual_type_tag"`
SecondaryTags []string `json:"secondary_tags"`
AuthorId string `json:"author_id"`
CreateTime int64 `json:"create_time"`
UpdateTime int64 `json:"update_time"`
Status int32 `json:"status"`
ViewCount int32 `json:"view_count"`
LikeCount int32 `json:"like_count"`
CommentCount int32 `json:"comment_count"`
ShareCount int32 `json:"share_count"`
ExtInfo map[string]string `json:"ext_info"`
}
CreateArticleReq {
Title string `json:"title"`
Brief string `json:"brief,optional"`
Content string `json:"content"`
CoverImageUrl string `json:"cover_image_url,optional"`
ManualTypeTag string `json:"manual_type_tag,optional"`
SecondaryTags []string `json:"secondary_tags,optional"`
}
CreateArticleResp {
ArticleId string `json:"article_id"`
}
GetArticleReq {
ArticleId string `path:"id"`
IncrView bool `form:"incr_view,optional"`
}
GetArticleResp {
Article Article `json:"article"`
}
UpdateArticleReq {
ArticleId string `path:"id"`
Title string `json:"title,optional"`
Brief string `json:"brief,optional"`
Content string `json:"content,optional"`
CoverImageUrl string `json:"cover_image_url,optional"`
ManualTypeTag string `json:"manual_type_tag,optional"`
SecondaryTags []string `json:"secondary_tags,optional"`
Status int32 `json:"status,optional"`
}
UpdateArticleResp {
Success bool `json:"success"`
}
DeleteArticleReq {
ArticleId string `path:"id"`
}
DeleteArticleResp {
Success bool `json:"success"`
}
ListArticlesReq {
ManualTypeTag string `form:"manual_type_tag,optional"`
SecondaryTag string `form:"secondary_tag,optional"`
RelatedGameId string `form:"related_game_id,optional"`
AuthorId string `form:"author_id,optional"`
Page int32 `form:"page,default=1"`
PageSize int32 `form:"page_size,default=20"`
SortBy string `form:"sort_by,default=create_time"`
Desc bool `form:"desc,default=true"`
}
ListArticlesResp {
Articles []Article `json:"articles"`
Total int64 `json:"total"`
Page int32 `json:"page"`
PageSize int32 `json:"page_size"`
}
UploadImageReq {}
UploadImageResp {
ImageUrl string `json:"image_url"`
}
)
@server (
prefix: v1
group: article
jwt: Auth
)
service article-api {
@handler CreateArticle
post /article (CreateArticleReq) returns (CreateArticleResp)
@handler UpdateArticle
put /article/:id (UpdateArticleReq) returns (UpdateArticleResp)
@handler DeleteArticle
delete /article/:id (DeleteArticleReq) returns (DeleteArticleResp)
}
@server (
prefix: v1
group: article
)
service article-api {
@handler GetArticle
get /article/:id (GetArticleReq) returns (GetArticleResp)
@handler ListArticles
get /articles (ListArticlesReq) returns (ListArticlesResp)
@handler UploadImage
post /upload (UploadImageReq) returns (UploadImageResp)
}