openapi.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. openapi: 3.1.0
  2. info:
  3. title: yuban-server business capability API
  4. version: 1.0.0
  5. servers:
  6. - url: https://business-api.yuban.co
  7. paths:
  8. /health:
  9. get:
  10. operationId: health
  11. responses:
  12. '200':
  13. description: Service is healthy
  14. /recording-transcription/jobs:
  15. post:
  16. operationId: createRecordingTranscriptionJob
  17. security:
  18. - bearerAuth: []
  19. parameters:
  20. - in: header
  21. name: Idempotency-Key
  22. schema:
  23. type: string
  24. requestBody:
  25. required: true
  26. content:
  27. application/json:
  28. schema:
  29. $ref: '#/components/schemas/CreateRecordingTranscriptionJob'
  30. responses:
  31. '202':
  32. description: Job accepted
  33. content:
  34. application/json:
  35. schema:
  36. $ref: '#/components/schemas/JobResponse'
  37. /recording-transcription/jobs/{jobId}:
  38. parameters:
  39. - $ref: '#/components/parameters/JobId'
  40. get:
  41. operationId: getRecordingTranscriptionJob
  42. security:
  43. - bearerAuth: []
  44. responses:
  45. '200':
  46. description: Current job state
  47. content:
  48. application/json:
  49. schema:
  50. $ref: '#/components/schemas/JobResponse'
  51. /recording-transcription/jobs/{jobId}/cancel:
  52. parameters:
  53. - $ref: '#/components/parameters/JobId'
  54. post:
  55. operationId: cancelRecordingTranscriptionJob
  56. security:
  57. - bearerAuth: []
  58. responses:
  59. '200':
  60. description: Job cancelled or already terminal
  61. content:
  62. application/json:
  63. schema:
  64. $ref: '#/components/schemas/JobResponse'
  65. /recording-transcription/jobs/{jobId}/retry:
  66. parameters:
  67. - $ref: '#/components/parameters/JobId'
  68. post:
  69. operationId: retryRecordingTranscriptionJob
  70. security:
  71. - bearerAuth: []
  72. responses:
  73. '202':
  74. description: A new attempt was created
  75. content:
  76. application/json:
  77. schema:
  78. $ref: '#/components/schemas/JobResponse'
  79. components:
  80. securitySchemes:
  81. bearerAuth:
  82. type: http
  83. scheme: bearer
  84. parameters:
  85. JobId:
  86. in: path
  87. name: jobId
  88. required: true
  89. schema:
  90. type: string
  91. format: uuid
  92. schemas:
  93. CreateRecordingTranscriptionJob:
  94. type: object
  95. required: [audioUrl]
  96. additionalProperties: false
  97. properties:
  98. audioUrl:
  99. type: string
  100. format: uri
  101. chatVoiceId:
  102. type: string
  103. maxLength: 64
  104. durationMs:
  105. type: integer
  106. minimum: 1
  107. roleType:
  108. type: integer
  109. enum: [0, 1]
  110. default: 1
  111. roleNum:
  112. type: integer
  113. minimum: 0
  114. maximum: 10
  115. default: 0
  116. requestId:
  117. type: string
  118. maxLength: 200
  119. JobResponse:
  120. type: object
  121. required: [success, job]
  122. properties:
  123. success:
  124. type: boolean
  125. const: true
  126. reused:
  127. type: boolean
  128. job:
  129. $ref: '#/components/schemas/Job'
  130. Job:
  131. type: object
  132. required: [id, status, stage, progress, createdAt, updatedAt, expiresAt]
  133. properties:
  134. id:
  135. type: string
  136. format: uuid
  137. status:
  138. type: string
  139. enum: [queued, running, retry_wait, completed, failed, cancelled]
  140. stage:
  141. type: string
  142. progress:
  143. type: integer
  144. minimum: 0
  145. maximum: 100
  146. createdAt:
  147. type: string
  148. format: date-time
  149. updatedAt:
  150. type: string
  151. format: date-time
  152. heartbeatAt:
  153. type: [string, 'null']
  154. format: date-time
  155. attempt:
  156. type: integer
  157. minimum: 0
  158. parentJobId:
  159. type: [string, 'null']
  160. format: uuid
  161. nextRetryAt:
  162. type: [string, 'null']
  163. format: date-time
  164. queuePosition:
  165. type: [integer, 'null']
  166. minimum: 1
  167. canRetry:
  168. type: boolean
  169. expiresAt:
  170. type: string
  171. format: date-time
  172. result:
  173. $ref: '#/components/schemas/TranscriptionResult'
  174. error:
  175. $ref: '#/components/schemas/Error'
  176. TranscriptionResult:
  177. type: object
  178. required: [text, segments, charCount, sha256]
  179. properties:
  180. text:
  181. type: string
  182. segments:
  183. type: array
  184. items:
  185. $ref: '#/components/schemas/Segment'
  186. charCount:
  187. type: integer
  188. sha256:
  189. type: string
  190. pattern: '^[0-9a-f]{64}$'
  191. canonicalPersisted:
  192. type: boolean
  193. Segment:
  194. type: object
  195. required: [text]
  196. properties:
  197. text:
  198. type: string
  199. startMs:
  200. type: [integer, 'null']
  201. endMs:
  202. type: [integer, 'null']
  203. speakerId:
  204. type: [string, 'null']
  205. Error:
  206. type: object
  207. required: [code, message, retryable]
  208. properties:
  209. code:
  210. type: string
  211. message:
  212. type: string
  213. retryable:
  214. type: boolean