blob: f66f09ce760311cf9fda859db15b1a636fb19edf [file] [log] [blame]
刘洪青47205852020-08-14 13:39:30 +08001# communicate-center-poa.v1.yaml
2#
3# 1. 创建服务
4# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services' -H 'Content-Type: application/json' -d '{"id": "communicate", "origin": "http://communicate-center-poa-svc.communicate-center.svc.cluster.local:8080", "name": "通信服务", "description": "通信服务"}'
5#
6# 2. 创建版本
7# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/communicate/apiVersions/v1'
8#
9# 3. 上传OAS Yaml
10# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/communicate/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @communicate-center-poa.v1.yaml
11#
12# 4. 发布版本
13# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/communicate/apiVersions/v1/publish'
14#
15openapi: 3.0.2
16info:
17 title: Communicate Center Platform Open APIs
18 version: v1
19 description: '通信服务 - 平台开放接口'
20servers:
21 - url: '${POA_SERVER_URL}/apis/communicate/v1'
刘洪青6b495a42020-11-16 16:28:40 +080022 description: '生产环境'
刘洪青47205852020-08-14 13:39:30 +080023tags:
24 - name: Communication
25 description: '通信'
26paths:
27
28 '/communications/{communicationLogId}/sendStatus':
29 get:
30 summary: 检查发送状态
31 description: 检查发送状态
32 operationId: checkSendStatus
33 tags:
34 - Communication
35 security:
36 - oauth2:
37 - "communicate:v1:communicationCheck"
38 parameters:
39 - name: communicationLogId
40 in: path
41 required: true
42 description: 通信记录ID
43 schema:
44 type: string
45 responses:
46 '200':
47 description: 发送状态
48 content:
49 application/json:
50 schema:
51 $ref: '#/components/schemas/CommunicationSendResponse'
52 default:
53 $ref: '#/components/responses/DefaultErrorResponse'
54
55 '/communications/sendMail':
56 post:
57 summary: 发送邮件
58 description: 发送邮件
59 operationId: sendMail
60 tags:
61 - Communication
62 security:
63 - oauth2:
64 - "communicate:v1:communicationSend"
65 requestBody:
66 description: 发送请求数据
67 required: true
68 content:
69 application/json:
70 schema:
71 $ref: '#/components/schemas/CommunicationSendRequest'
72 responses:
73 '200':
74 description: 发送状态
75 content:
76 application/json:
77 schema:
78 $ref: '#/components/schemas/CommunicationSendResponse'
79 default:
80 $ref: '#/components/responses/DefaultErrorResponse'
81
82
83 '/communications/sendSms':
84 post:
85 summary: 发送短信
86 description: 发送短信
87 operationId: sendSms
88 tags:
89 - Communication
90 security:
91 - oauth2:
92 - "communicate:v1:communicationSend"
93 requestBody:
94 description: 发送请求数据
95 required: true
96 content:
97 application/json:
98 schema:
99 $ref: '#/components/schemas/CommunicationSendRequest'
100 responses:
101 '200':
102 description: 发送状态
103 content:
104 application/json:
105 schema:
106 $ref: '#/components/schemas/CommunicationSendResponse'
107 default:
108 $ref: '#/components/responses/DefaultErrorResponse'
109
110
111
112
113
114components:
115
116 # Security Schemes
117
118 securitySchemes:
119 oauth2:
120 type: oauth2
121 flows:
122 clientCredentials:
123 tokenUrl: ${POA_SERVER_URL}/oauth2/token
124 scopes:
125 "communicate:v1:communicationCheck": "检查"
126 "communicate:v1:communicationSend": "发送"
127
128
129 responses:
130 'ErrorResponse400':
131 description: unexpected error
132 content:
133 application/json:
134 schema:
135 $ref: '#/components/schemas/ApiErrorResponse'
136
137 DefaultErrorResponse:
138 description: unexpected error
139 content:
140 application/json:
141 schema:
142 $ref: '#/components/schemas/ApiErrorResponse'
143
144 schemas:
145
146 # Error
147
148 ApiErrorResponse:
149 title: '异常响应'
刘洪青f3b5fc82021-01-11 23:54:40 +0800150 type: object
刘洪青47205852020-08-14 13:39:30 +0800151 required:
152 - code
153 - message
154 properties:
155 code:
156 title: 异常代码
157 type: integer
158 format: int32
159 default: -1
160 message:
161 title: 异常信息
162 type: string
163 default: "未知错误"
164
165 # Entity
166
167 BaseEntity:
168 title: 实体 - 基类
169 type: object
170 properties:
171 id:
172 title: ID
173 type: string
174 #companyId:
175 # title: 'Company ID, 固定 1'
176 # type: string
177 # default: '1'
178 #deleted:
179 # title: 是否删除
180 # type: boolean
181 # default: false
182 #addAccount:
183 # title: 创建人
184 # type: string
185 #addTime:
186 # title: 创建时间
187 # type: string
188 # format: date-time
189 #editAccount:
190 # title: 修改人
191 # type: string
192 #editTime:
193 # title: 修改时间
194 # type: string
195 # format: date-time
196 #deleteAccount:
197 # title: 删除人
198 # type: string
199 #deleteTime:
200 # title: 删除时间
201 # type: string
202 # format: date-time
203
204
205 # DTO
206 Communication:
207 title: DTO - 通信数据
208 type: object
209 properties:
210 from:
211 title: 来源
212 type: string
213 to:
214 title: 接收帐号
215 type: string
216 payload:
217 title: 数据载荷
218 allOf:
219 - $ref: '#/components/schemas/CommunicationPayload'
220
221 CommunicationPayload:
222 title: DTO - 通信数据载荷
223 type: object
224 properties:
225 subject:
226 title: 主题
227 type: string
228 template:
229 title: 模板
230 type: string
231 data:
232 title: 数据(Map<String, String>
233 type: object
234 additionalProperties:
235 type: string
236
237 # type: array
238 # items:
239 # title: 数据项
240 # type: object
241 # properties:
242 # key:
243 # title: 键
244 # type: string
245 # value:
246 # title: 值
247 # type: string
248
249
250 # Request VO
251 CommunicationSendRequest:
252 title: 请求数据 - 发送请求
253 allOf:
254 - $ref: '#/components/schemas/Communication'
255
256
257 # Response Data
258 CommunicationSendResponseData:
259 title: 响应数据 - 发送响应
260 type: object
261 properties:
262 sendStatus:
263 title: 发送状态
264 type: string
265 sendResult:
266 title: 发送结果
267 type: string
268
269
270 # Response VO
271
272 ApiDataResponse:
273 title: 响应
刘洪青f3b5fc82021-01-11 23:54:40 +0800274 type: object
刘洪青47205852020-08-14 13:39:30 +0800275 properties:
276 code:
277 title: 响应代码
278 type: integer
279 format: int32
280 default: 0
281 message:
282 title: 响应信息
283 type: string
284 data:
285 title: 响应数据
286 type: object
287
288 DefaultApiDataResponse:
289 allOf:
290 - $ref: '#/components/schemas/ApiDataResponse'
291 - type: object
292 title: 响应
293 properties:
294 data:
295 title: 响应数据
296 type: object
297
298 CommunicationSendResponse:
299 allOf:
300 - $ref: '#/components/schemas/DefaultApiDataResponse'
301 - type: object
302 title: 响应
303 properties:
304 data:
305 allOf:
306 - $ref: '#/components/schemas/CommunicationSendResponseData'