-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadmin_center.api
More file actions
233 lines (190 loc) · 4.71 KB
/
Copy pathadmin_center.api
File metadata and controls
233 lines (190 loc) · 4.71 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
syntax = "v1"
info (
title: "Admin Center API"
desc: "管理员中心 HTTP 网关,对接 AdminService gRPC"
version: "1.0.0"
)
type UserInfo {
Uid int64 `json:"uid,string"`
Username string `json:"username"`
Status int64 `json:"status"`
Email string `json:"email,omitempty"`
Extrainfo map[string]string `json:"extra_info,omitempty"`
}
type AdminInfo {
Uid int64 `json:"uid,string"`
Username string `json:"username"`
Email string `json:"email"`
Extrainfo map[string]string `json:"extra_info,omitempty"`
}
type GetUserReq {
Uid int64 `form:"uid,string"`
}
type GetUserResp {
User UserInfo `json:"user,omitempty"`
Found bool `json:"found"`
}
type GetSelfReq {}
type GetSelfResp {
Admin AdminInfo `json:"admin"`
}
type LogoutReq {}
type LogoutResp {
Success bool `json:"success"`
}
type CreateAdminReq {
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email,omitempty"`
InviteCode string `json:"invite_code"`
Extrainfo map[string]string `json:"extra_info,omitempty"`
}
type CreateAdminResp {
Uid int64 `json:"uid,string"`
}
type CreateInviteReq {}
type CreateInviteResp {
InviteCode string `json:"invite_code"`
ExpiresAt int64 `json:"expires_at"`
}
type LoginReq {
Username string `json:"username"`
Password string `json:"password"`
}
type LoginResp {
Token string `json:"token"`
}
type DeleteUserReq {
Uid int64 `json:"uid,string"`
}
type DeleteUserResp {
Success bool `json:"success"`
}
type ResetUserPasswordReq {
Uid int64 `json:"uid,string"`
}
type ResetUserPasswordResp {
Success bool `json:"success"`
}
type UpdateSelfReq {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Email string `json:"email,omitempty"`
Extrainfo map[string]string `json:"extra_info,omitempty"`
}
type UpdateSelfResp {
Success bool `json:"success"`
Admin AdminInfo `json:"admin"`
}
type UpdateUserReq {
Uid int64 `json:"uid,string"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Email string `json:"email,omitempty"`
Extrainfo map[string]string `json:"extra_info,omitempty"`
}
type UpdateUserResp {
Success bool `json:"success"`
User UserInfo `json:"user"`
}
type GetUserListReq {
Page int64 `form:"page,default=1"`
PageSize int64 `form:"page_size,default=20"`
Keyword string `form:"keyword,omitempty"`
}
type GetUserListResp {
List []UserInfo `json:"list"`
Total int64 `json:"total"`
}
type BanUserReq {
Uid int64 `json:"uid,string"`
}
type BanUserResp {
Success bool `json:"success"`
}
type UnBanUserReq {
Uid int64 `json:"uid,string"`
}
type UnBanUserResp {
Success bool `json:"success"`
}
@server (
prefix: "/admincenter/v1"
group: "admin"
)
service admincenter {
@doc (
create: "创建"
)
@handler create
post /admin/create (CreateAdminReq) returns (CreateAdminResp)
@doc (
login: "登录"
)
@handler login
post /admin/login (LoginReq) returns (LoginResp)
}
//需要登录的服务,用jwt
@server (
prefix: "/admincenter/v1"
group: "admin"
jwt: AdminAuth
middleware: CheckBlacklistMiddleware
)
service admincenter {
@doc (
getuser: "查询用户"
)
@handler getuser
get /admin/getuser (GetUserReq) returns (GetUserResp)
@doc (
getself: "查看自己"
)
@handler getself
get /admin/getself (GetSelfReq) returns (GetSelfResp)
@doc (
logout: "登出"
)
@handler logout
post /admin/logout (LogoutReq) returns (LogoutResp)
@doc (
createinvite: "生成管理员邀请码"
)
@handler createinvite
post /admin/invite/create (CreateInviteReq) returns (CreateInviteResp)
@doc (
getuserlist: "获取指定用户列表"
)
@handler getuserlist
get /admin/getuserlist (GetUserListReq) returns (GetUserListResp)
@doc (
delete: "删除用户"
)
@handler delete
delete /admin/delete (DeleteUserReq) returns (DeleteUserResp)
@doc (
update: "修改个人信息"
)
@handler update
post /admin/update (UpdateSelfReq) returns (UpdateSelfResp)
@doc (
resetuserpassword: "重置user密码"
)
@handler resetuserpassword
post /admin/resetuserpassword (ResetUserPasswordReq) returns (ResetUserPasswordResp)
@doc (
updateuser: "修改用户信息"
)
@handler updateuser
post /admin/updateuser (UpdateUserReq) returns (UpdateUserResp)
@doc (
banuser: "封禁用户"
)
@handler banuser
post /admin/banuser (BanUserReq) returns (BanUserResp)
@doc (
unbanuser: "解封用户"
)
@handler unbanuser
post /admin/unbanuser (UnBanUserReq) returns (UnBanUserResp)
}