-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAPI.yaml
278 lines (263 loc) · 6.65 KB
/
API.yaml
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
swagger: "2.0"
info:
version: 0.0.1
title: TStunnel API
description: the first edtion API for TStunnel
schemes:
- http
host: 120.79.254.77
basePath: /api
tags:
- name: "auth"
description: 验证权限
- name: "admin"
description: 管理界面
- name: "user"
description: 发送消息
paths:
/signin/:
post:
tags:
- "auth"
summary: 验证登陆
description: 虽然不存在用户、管理员,但是进入管理页面需要验证身份,其中验证内容写死。
username = "TStunnel", password = "Ilovemuxi"
parameters:
- name: signin
in: body
description: 使用已知用户名和密码登陆
required: true
schema:
required:
- username
- password
properties:
username:
type: string
password:
type: string
responses:
200:
description: 登陆成功
schema:
required:
- token
properties:
token:
type: string
401:
description: 用户名或密码错误
/admin/pages/{pageNumber}/:
get:
tags:
- "admin"
summary: 管理界面
description: 显示待操作的消息,每次返回十五条消息
parameters:
- in: header
name: token
description: 表识管理员身份
required: true
type: string
- in: path
name: pageNumber
description: 需要显示第几页
required: true
type: integer
responses:
200:
description: 返回待发送的消息
schema:
type: array
items:
required:
- id
- sent_content
- sent_name
- sent_time
- sent_address
- sent_status
properties:
id:
type: integer
sent_content:
type: string
sent_name:
type: string
sent_time:
type: string
sent_address:
type: string
sent_status:
type: string
403:
description: Forbidden
/admin/pages/{pageNumber}/time/{time}/:
get:
tags:
- "admin"
summary: 管理界面
description: 按时间选择显示待操作的消息,每次返回十五条消息
parameters:
- in: header
name: token
description: 表识管理员身份
required: true
type: string
- in: path
name: pageNumber
description: 需要显示第几页
required: true
type: integer
- in: path
name: time
description: 发送的时间
required: true
type: string
responses:
200:
description: 返回待发送的消息
schema:
type: array
items:
required:
- id
- sent_content
- sent_name
- sent_time
- sent_address
- sent_status
properties:
id:
type: integer
sent_content:
type: string
sent_name:
type: string
sent_time:
type: string
sent_address:
type: string
sent_status:
type: string
403:
description: Forbidden
/sent/{message_id}/:
post:
tags:
- "admin"
summary: 单条发送信息或邮件
description: 批量发送由前端实现,即批量发送返回多次请求。
parameters:
- in: header
name: token
description: 标识管理员身份
required: true
type: string
- in: path
name: message_id
description: 所要发送的消息的ID
required: true
type: integer
responses:
200:
description: OK
403:
description: Forbidden
500:
description: server error
/admin/message/{message_id}/:
delete:
tags:
- "admin"
summary: 删除不和谐的消息
description: 如果要实现批量删除,可由发送一样由前端实现
parameters:
- in: header
name: token
description: 标识管理员身份
required: true
type: string
- in: path
name: message_id
description: 所要删除的消息的ID
required: true
type: integer
responses:
200:
description: OK
403:
description: Forbidden
500:
description: server error
/message/:
post:
tags:
- "user"
summary: 用户发送消息
description: 用户界面
parameters:
- name: message
in: body
description: 消息全部内容
required: true
schema:
required:
- sent_content
- sent_name
- sent_time
- sent_address
- soundfile
- picturefile
properties:
sent_content:
type: string
sent_name:
type: string
sent_time:
type: string
sent_address:
type: string
soundfile:
type: file
picturefile:
type: file
responses:
201:
description: OK
500:
description: server error
400:
description: Bad Request
definitions:
Message:
required:
- id
- sent_content
- sent_way
- sent_name
- sent_time
- sent_address
- sent_status
properties:
id:
description: 消息ID
type: integer
sent_content:
description: 消息内容
type: string
sent_way:
description: 发送方式,1:短信,2:邮箱。emmmm.....没钱,默认2
type: integer
sent_name:
description: 发送者的名字
type: string
sent_time:
description: 发送时间 格式:year-month-day 例:2018-05-01
type: string
sent_address:
description: 发送地址
type: string
sent_status:
description: 发送状态,1:未发送,2:已发送,3:发送失败
type: integer