刘洪青 | 4720585 | 2020-08-14 13:39:30 +0800 | [diff] [blame^] | 1 | # 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 | # |
| 15 | openapi: 3.0.2 |
| 16 | info: |
| 17 | title: Communicate Center Platform Open APIs |
| 18 | version: v1 |
| 19 | description: '通信服务 - 平台开放接口' |
| 20 | servers: |
| 21 | - url: '${POA_SERVER_URL}/apis/communicate/v1' |
| 22 | description: '正式环境' |
| 23 | tags: |
| 24 | - name: Communication |
| 25 | description: '通信' |
| 26 | paths: |
| 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 | |
| 114 | components: |
| 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: '异常响应' |
| 150 | required: |
| 151 | - code |
| 152 | - message |
| 153 | properties: |
| 154 | code: |
| 155 | title: 异常代码 |
| 156 | type: integer |
| 157 | format: int32 |
| 158 | default: -1 |
| 159 | message: |
| 160 | title: 异常信息 |
| 161 | type: string |
| 162 | default: "未知错误" |
| 163 | |
| 164 | # Entity |
| 165 | |
| 166 | BaseEntity: |
| 167 | title: 实体 - 基类 |
| 168 | type: object |
| 169 | properties: |
| 170 | id: |
| 171 | title: ID |
| 172 | type: string |
| 173 | #companyId: |
| 174 | # title: 'Company ID, 固定 1' |
| 175 | # type: string |
| 176 | # default: '1' |
| 177 | #deleted: |
| 178 | # title: 是否删除 |
| 179 | # type: boolean |
| 180 | # default: false |
| 181 | #addAccount: |
| 182 | # title: 创建人 |
| 183 | # type: string |
| 184 | #addTime: |
| 185 | # title: 创建时间 |
| 186 | # type: string |
| 187 | # format: date-time |
| 188 | #editAccount: |
| 189 | # title: 修改人 |
| 190 | # type: string |
| 191 | #editTime: |
| 192 | # title: 修改时间 |
| 193 | # type: string |
| 194 | # format: date-time |
| 195 | #deleteAccount: |
| 196 | # title: 删除人 |
| 197 | # type: string |
| 198 | #deleteTime: |
| 199 | # title: 删除时间 |
| 200 | # type: string |
| 201 | # format: date-time |
| 202 | |
| 203 | |
| 204 | # DTO |
| 205 | Communication: |
| 206 | title: DTO - 通信数据 |
| 207 | type: object |
| 208 | properties: |
| 209 | from: |
| 210 | title: 来源 |
| 211 | type: string |
| 212 | to: |
| 213 | title: 接收帐号 |
| 214 | type: string |
| 215 | payload: |
| 216 | title: 数据载荷 |
| 217 | allOf: |
| 218 | - $ref: '#/components/schemas/CommunicationPayload' |
| 219 | |
| 220 | CommunicationPayload: |
| 221 | title: DTO - 通信数据载荷 |
| 222 | type: object |
| 223 | properties: |
| 224 | subject: |
| 225 | title: 主题 |
| 226 | type: string |
| 227 | template: |
| 228 | title: 模板 |
| 229 | type: string |
| 230 | data: |
| 231 | title: 数据(Map<String, String>) |
| 232 | type: object |
| 233 | additionalProperties: |
| 234 | type: string |
| 235 | |
| 236 | # type: array |
| 237 | # items: |
| 238 | # title: 数据项 |
| 239 | # type: object |
| 240 | # properties: |
| 241 | # key: |
| 242 | # title: 键 |
| 243 | # type: string |
| 244 | # value: |
| 245 | # title: 值 |
| 246 | # type: string |
| 247 | |
| 248 | |
| 249 | # Request VO |
| 250 | CommunicationSendRequest: |
| 251 | title: 请求数据 - 发送请求 |
| 252 | allOf: |
| 253 | - $ref: '#/components/schemas/Communication' |
| 254 | |
| 255 | |
| 256 | # Response Data |
| 257 | CommunicationSendResponseData: |
| 258 | title: 响应数据 - 发送响应 |
| 259 | type: object |
| 260 | properties: |
| 261 | sendStatus: |
| 262 | title: 发送状态 |
| 263 | type: string |
| 264 | sendResult: |
| 265 | title: 发送结果 |
| 266 | type: string |
| 267 | |
| 268 | |
| 269 | # Response VO |
| 270 | |
| 271 | ApiDataResponse: |
| 272 | title: 响应 |
| 273 | properties: |
| 274 | code: |
| 275 | title: 响应代码 |
| 276 | type: integer |
| 277 | format: int32 |
| 278 | default: 0 |
| 279 | message: |
| 280 | title: 响应信息 |
| 281 | type: string |
| 282 | data: |
| 283 | title: 响应数据 |
| 284 | type: object |
| 285 | |
| 286 | DefaultApiDataResponse: |
| 287 | allOf: |
| 288 | - $ref: '#/components/schemas/ApiDataResponse' |
| 289 | - type: object |
| 290 | title: 响应 |
| 291 | properties: |
| 292 | data: |
| 293 | title: 响应数据 |
| 294 | type: object |
| 295 | |
| 296 | CommunicationSendResponse: |
| 297 | allOf: |
| 298 | - $ref: '#/components/schemas/DefaultApiDataResponse' |
| 299 | - type: object |
| 300 | title: 响应 |
| 301 | properties: |
| 302 | data: |
| 303 | allOf: |
| 304 | - $ref: '#/components/schemas/CommunicationSendResponseData' |