blob: 9f6336aca3629c96d5afeb442503997235de13c6 [file] [log] [blame]
刘洪青6aa11c92020-11-16 15:59:46 +08001# user-data-service-thirdparty-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": "userThirdparty", "origin": "http://user-data-service-poa-svc.user-data-service.svc.cluster.local:8080", "name": "用户服务(第三方应用)", "description": "用户服务(第三方应用)"}'
5# https://user-api.supwisdom.com
6#
7# 2. 创建版本
8# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/userThirdparty/apiVersions/v1'
9#
10# 3. 上传OAS Yaml
11# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/userThirdparty/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @user-data-service-thirdparty-poa.v1.yaml
12#
13# 4. 发布版本
14# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/userThirdparty/apiVersions/v1/publish'
15#
16openapi: 3.0.2
17info:
18 title: User Data Service (Third Party) Platform Open APIs
19 version: v1
20 description: '用户服务(第三方应用) - 平台开放接口'
21servers:
刘洪青6b495a42020-11-16 16:28:40 +080022 - url: '${POA_SERVER_URL}/apis/userThirdparty/v1'
23 description: '生产环境'
刘洪青6aa11c92020-11-16 15:59:46 +080024tags:
25 - name: AdminAppGroup
26 description: '应用的用户组(普通)管理'
27
28paths:
29
30 '/application/{applicationId}/groups':
31 post:
32 summary: 创建应用的用户组(普通)
33 operationId: createAppGroup
34 tags:
35 - AdminAppGroup
36 security:
37 - oauth2:
38 - "userThirdparty:v1:adminAppGroupWrite"
39 parameters:
40 - name: applicationId
41 in: path
42 required: true
43 description: 应用标识
44 schema:
45 type: string
46 requestBody:
47 description: 用户组(普通)创建请求
48 required: true
49 content:
50 application/json:
51 schema:
52 $ref: '#/components/schemas/AdminAppGroupCreateRequest'
53 responses:
54 '200':
55 description: 用户组(普通)创建响应
56 content:
57 application/json:
58 schema:
59 $ref: '#/components/schemas/AdminAppGroupCreateResponse'
60 default:
61 $ref: '#/components/responses/DefaultErrorResponse'
62
63 '/application/{applicationId}/groups/{groupId}':
64 get:
65 summary: 获取应用的用户组(普通)
66 operationId: getAppGroup
67 tags:
68 - AdminAppGroup
69 security:
70 - oauth2:
71 - "userThirdparty:v1:adminAppGroupWrite"
72 parameters:
73 - name: applicationId
74 in: path
75 required: true
76 description: 应用标识
77 schema:
78 type: string
79 - name: groupId
80 in: path
81 required: true
82 description: 用户组ID
83 schema:
84 type: string
85 responses:
86 '200':
87 description: 用户组(普通)获取响应
88 content:
89 application/json:
90 schema:
91 $ref: '#/components/schemas/AdminAppGroupGetResponse'
92 default:
93 $ref: '#/components/responses/DefaultErrorResponse'
94
95 put:
96 summary: 获取应用的用户组(普通)
97 operationId: updateAppGroup
98 tags:
99 - AdminAppGroup
100 security:
101 - oauth2:
102 - "userThirdparty:v1:adminAppGroupWrite"
103 parameters:
104 - name: applicationId
105 in: path
106 required: true
107 description: 应用标识
108 schema:
109 type: string
110 - name: groupId
111 in: path
112 required: true
113 description: 用户组ID
114 schema:
115 type: string
116 requestBody:
117 description: 用户组(普通)更新请求
118 required: true
119 content:
120 application/json:
121 schema:
122 $ref: '#/components/schemas/AdminAppGroupUpdateRequest'
123 responses:
124 '200':
125 description: 用户组(普通)获取响应
126 content:
127 application/json:
128 schema:
129 $ref: '#/components/schemas/AdminAppGroupUpdateResponse'
130 default:
131 $ref: '#/components/responses/DefaultErrorResponse'
132
133 delete:
134 summary: 删除应用的用户组(普通)
135 operationId: deleteAppGroup
136 tags:
137 - AdminAppGroup
138 security:
139 - oauth2:
140 - "userThirdparty:v1:adminAppGroupWrite"
141 parameters:
142 - name: applicationId
143 in: path
144 required: true
145 description: 应用标识
146 schema:
147 type: string
148 - name: groupId
149 in: path
150 required: true
151 description: 用户组ID
152 schema:
153 type: string
154 responses:
155 '200':
156 description: 用户组(普通)删除响应
157 content:
158 application/json:
159 schema:
160 $ref: '#/components/schemas/AdminAppGroupDeleteResponse'
161 default:
162 $ref: '#/components/responses/DefaultErrorResponse'
163
164
165 '/application/{applicationId}/groups/{groupId}/accounts':
166 post:
167 summary: 关联应用的用户组(普通)帐号
168 operationId: relateAppGroupAccounts
169 tags:
170 - AdminAppGroup
171 security:
172 - oauth2:
173 - "userThirdparty:v1:adminAppGroupWrite"
174 parameters:
175 - name: applicationId
176 in: path
177 required: true
178 description: 应用标识
179 schema:
180 type: string
181 - name: groupId
182 in: path
183 required: true
184 description: 用户组ID
185 schema:
186 type: string
187 requestBody:
188 description: 用户组(普通)关联帐号请求
189 required: true
190 content:
191 application/json:
192 schema:
193 $ref: '#/components/schemas/AdminAppGroupRelateAccountsRequest'
194 responses:
195 '200':
196 description: 用户组(普通)关联帐号响应
197 content:
198 application/json:
199 schema:
200 $ref: '#/components/schemas/AdminAppGroupRelateAccountsResponse'
201 default:
202 $ref: '#/components/responses/DefaultErrorResponse'
203
204
205components:
206
207 # Security Schemes
208
209 securitySchemes:
210 oauth2:
211 type: oauth2
212 flows:
213 clientCredentials:
刘洪青6b495a42020-11-16 16:28:40 +0800214 tokenUrl: ${POA_SERVER_URL}/oauth2/token
刘洪青6aa11c92020-11-16 15:59:46 +0800215 scopes:
216 "userThirdparty:v1:adminAppGroupWrite": "写入应用的用户组(普通)"
217
218
219 responses:
220 'ErrorResponse400':
221 description: unexpected error
222 content:
223 application/json:
224 schema:
225 $ref: '#/components/schemas/ErrorResponse'
226
227 DefaultErrorResponse:
228 description: unexpected error
229 content:
230 application/json:
231 schema:
232 $ref: '#/components/schemas/ErrorResponse'
233
234
235 schemas:
236
237 # Error
238
239 ErrorResponse:
240 title: '异常响应'
241 required:
242 - code
243 - message
244 properties:
245 code:
246 title: 异常代码
247 type: integer
248 format: int32
249 default: -1
250 message:
251 title: 异常信息
252 type: string
253 default: "未知错误"
254
255
256 # Entity
257
258 BaseEntity:
259 title: 实体 - 基类
260 type: object
261 properties:
262 id:
263 title: ID
264 type: string
265
266 # DictionaryType:
267 # title: 实体 - 字典
268 # allOf:
269 # - $ref: '#/components/schemas/BaseEntity'
270 # - type: object
271 # title: 实体属性
272 # properties:
273 # code:
274 # title: 代码
275 # type: string
276 # name:
277 # title: 名称
278 # type: string
279 # enable:
280 # title: 是否启用
281 # type: boolean
282 # default: true
283 # sort:
284 # title: 排序
285 # type: integer
286 # format: int64
287 # multiLevel:
288 # title: 是否多层级
289 # type: boolean
290
291 Dictionary:
292 title: 实体 - 字典
293 allOf:
294 - $ref: '#/components/schemas/BaseEntity'
295 - type: object
296 title: 实体属性
297 properties:
298 code:
299 title: 代码
300 type: string
301 name:
302 title: 名称
303 type: string
304 enable:
305 title: 是否启用
306 type: boolean
307 default: true
308 sort:
309 title: 排序
310 type: integer
311 format: int64
312 # dictionaryType:
313 # title: 字典类型
314 # allOf:
315 # - $ref: '#/components/schemas/DictionaryType'
316 # parentDictionary:
317 # title: 父字典
318 # allOf:
319 # - $ref: '#/components/schemas/Dictionary'
320
321
322 Group:
323 title: 实体 - 用户组
324 allOf:
325 - $ref: '#/components/schemas/BaseEntity'
326 - type: object
327 title: 实体属性
328 properties:
329 code:
330 title: 代码
331 type: string
332 name:
333 title: 名称
334 type: string
335 description:
336 title: 描述
337 type: string
338 type:
339 title: 类型
340 type: string
341 state:
342 title: 状态(0:正常,1:冻结,2:注销)
343 type: integer
344 format: int32
345 sort:
346 title: 排序
347 type: integer
348 format: int32
349 isDataCenter:
350 title: 是否来源数据中心
351 type: boolean
352 common:
353 title: 是否公共
354 type: boolean
355 category:
356 title: 类别
357 allOf:
358 - $ref: '#/components/schemas/Dictionary'
359 applicationId:
360 title: 所属应用标识
361 type: string
362 businessDomainId:
363 title: 所属业务域ID
364 type: string
365 systemId:
366 title: 所属系统ID
367 type: string
368
369
370 # Request VO
371 AdminAppGroupCreateRequest:
372 title: 用户组(普通)创建请求
373 properties:
374 code:
375 title: 代码
376 type: string
377 name:
378 title: 名称
379 type: string
380 description:
381 title: 描述
382 type: string
383 state:
384 title: 状态(0:正常,1:冻结,2:注销)
385 type: integer
386 format: int32
387 categoryCode:
388 title: 类别(字典代码)
389 type: string
390
391
392 AdminAppGroupUpdateRequest:
393 title: 用户组(普通)更新请求
394 properties:
395 code:
396 title: 代码
397 type: string
398 name:
399 title: 名称
400 type: string
401 description:
402 title: 描述
403 type: string
404 state:
405 title: 状态(0:正常,1:冻结,2:注销)
406 type: integer
407 format: int32
408 categoryCode:
409 title: 类别(字典代码)
410 type: string
411
412
413 AdminAppGroupRelateAccountsRequest:
414 title: 用户组(普通)关联帐号请求
415 properties:
416 addAccountIds:
417 title: 添加的帐号IDs
418 type: array
419 items:
420 title: 账号Id
421 type: string
422 delAccountIds:
423 title: 移除的帐号IDs
424 type: array
425 items:
426 title: 账号Id
427 type: string
428
429
430 # Response VO
431
432 AbstractApiResponse:
433 title: 响应
434 properties:
435 code:
436 title: 响应代码
437 type: integer
438 format: int32
439 default: 0
440 message:
441 title: 响应信息
442 type: string
443 DefaultApiResponse:
444 allOf:
445 - $ref: '#/components/schemas/AbstractApiResponse'
446 - type: object
447 title: 响应数据
448 properties:
449 data:
450 title: 响应数据
451 type: object
452
453
454
455 AdminAppGroupGetResponse:
456 allOf:
457 - $ref: '#/components/schemas/DefaultApiResponse'
458 - type: object
459 title: 响应数据
460 properties:
461 data:
462 allOf:
463 - type: object
464 title: 结果
465 properties:
466 message:
467 title: 结果说明
468 type: string
469 group:
470 title: 用户组(普通)
471 allOf:
472 - $ref: '#/components/schemas/Group'
473
474 AdminAppGroupCreateResponse:
475 allOf:
476 - $ref: '#/components/schemas/DefaultApiResponse'
477 - type: object
478 title: 响应数据
479 properties:
480 data:
481 allOf:
482 - type: object
483 title: 结果
484 properties:
485 message:
486 title: 结果说明
487 type: string
488 group:
489 title: 用户组(普通)
490 allOf:
491 - $ref: '#/components/schemas/Group'
492
493 AdminAppGroupUpdateResponse:
494 allOf:
495 - $ref: '#/components/schemas/DefaultApiResponse'
496 - type: object
497 title: 响应数据
498 properties:
499 data:
500 allOf:
501 - type: object
502 title: 结果
503 properties:
504 message:
505 title: 结果说明
506 type: string
507 group:
508 title: 用户组(普通)
509 allOf:
510 - $ref: '#/components/schemas/Group'
511
512
513 AdminAppGroupDeleteResponse:
514 allOf:
515 - $ref: '#/components/schemas/DefaultApiResponse'
516 - type: object
517 title: 响应数据
518 properties:
519 data:
520 allOf:
521 - type: object
522 title: 结果
523 properties:
524 message:
525 title: 结果说明
526 type: string
527
528
529 AdminAppGroupRelateAccountsResponse:
530 allOf:
531 - $ref: '#/components/schemas/DefaultApiResponse'
532 - type: object
533 title: 响应数据
534 properties:
535 data:
536 allOf:
537 - type: object
538 title: 结果
539 properties:
540 message:
541 title: 结果说明
542 type: string
543