v2-discussion.yaml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-discussion.yaml
  2. get:
  3. summary: '列出讨论 / 批注'
  4. tags:
  5. - discussion
  6. operationId: get_api_v2_discussion
  7. description: |
  8. 已被 v3 取代,保留仅为 dashboard-v4 兼容,待 v4 下线后删除:
  9. - `view=question` / `view=res_id` / `view=question-by-topic` → `GET /v3/discussions?target_type=&target_id=`
  10. - `view=answer` → `GET /v3/discussions/{discussion}/replies`
  11. - 响应里的 `active` / `close` / `can_create` → `GET /v3/discussions/summary`
  12. - `view=topic-by-user`、`view=all` 与课程参数(`course` / `show_student`)在 v3 暂无对应端点
  13. parameters:
  14. -
  15. name: view
  16. in: query
  17. schema:
  18. type: string
  19. enum:
  20. - question
  21. - question-by-topic
  22. - answer
  23. - res_id
  24. - topic-by-user
  25. - all
  26. description: 查询口径。question=按资源查顶级讨论;question-by-topic=按某条讨论所属资源查同资源讨论;answer=查某讨论的回复;res_id=某资源的顶级节点及其直接子节点;topic-by-user=当前用户发表的全部顶级讨论;all=全部顶级讨论
  27. required: true
  28. -
  29. name: id
  30. in: query
  31. schema:
  32. type: string
  33. description: '资源 uid(question/res_id)、讨论 id(question-by-topic/answer)'
  34. required: true
  35. -
  36. name: status
  37. in: query
  38. schema:
  39. type: string
  40. enum:
  41. - active
  42. - close
  43. default: active
  44. description: '状态过滤;res_id 与 topic-by-user 口径支持逗号分隔多选'
  45. -
  46. name: type
  47. in: query
  48. schema:
  49. type: string
  50. enum:
  51. - discussion
  52. - qa
  53. - help
  54. - note
  55. - commentary
  56. default: discussion
  57. description: 讨论类型
  58. -
  59. name: res_type
  60. in: query
  61. schema:
  62. type: string
  63. enum:
  64. - sentence
  65. - wbw
  66. - article
  67. description: 资源类型,影响权限判断与学员提问聚合
  68. -
  69. name: course
  70. in: query
  71. schema:
  72. type: string
  73. description: '课程 uid,配合 show_student 聚合学员提问'
  74. -
  75. name: show_student
  76. in: query
  77. schema:
  78. type: string
  79. enum:
  80. - 'true'
  81. - 'false'
  82. description: '是否把学员 channel 上的同位置提问一并返回'
  83. -
  84. name: order
  85. in: query
  86. schema:
  87. type: string
  88. default: created_at
  89. description: 排序字段
  90. -
  91. name: dir
  92. in: query
  93. schema:
  94. type: string
  95. enum:
  96. - asc
  97. - desc
  98. default: desc
  99. description: 排序方向
  100. -
  101. name: offset
  102. in: query
  103. schema:
  104. type: integer
  105. default: 0
  106. description: 跳过的记录数
  107. -
  108. name: limit
  109. in: query
  110. schema:
  111. type: integer
  112. default: 100
  113. description: 返回条数上限
  114. -
  115. name: search
  116. in: query
  117. description: 搜索关键字
  118. schema:
  119. type: string
  120. responses:
  121. 200:
  122. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  123. content:
  124. application/json:
  125. schema:
  126. type: object
  127. properties:
  128. ok:
  129. type: boolean
  130. message:
  131. type: string
  132. data:
  133. type: object
  134. properties:
  135. rows:
  136. type: array
  137. items:
  138. type: object
  139. properties: { id: { type: integer }, title: { type: string }, content: { type: string }, content_type: { type: string }, parent: { type: string }, status: { type: integer }, editor: { type: string }, res_id: { type: integer }, res_type: { type: string }, type: { type: integer }, tpl_id: { type: integer }, children_count: { type: integer }, created_at: { type: string }, updated_at: { type: string }, pos_start: { type: string }, pos_end: { type: string }, quote_exact: { type: string }, quote_prefix: { type: string }, quote_suffix: { type: string }, html: { type: string }, summary: { type: string } }
  140. count:
  141. type: integer
  142. 401:
  143. $ref: '../../main.yaml#/components/responses/Unauthorized'
  144. 422:
  145. $ref: '../../main.yaml#/components/responses/ValidationError'
  146. deprecated: true
  147. post:
  148. summary: '发表讨论 / 批注或回复'
  149. tags:
  150. - discussion
  151. operationId: post_api_v2_discussion
  152. description: |
  153. 已被 v3 取代,保留仅为 dashboard-v4 兼容,待 v4 下线后删除:
  154. 不带 `parent` → `POST /v3/discussions`;带 `parent` → `POST /v3/discussions/{discussion}/replies`。
  155. requestBody:
  156. required: true
  157. content:
  158. application/json:
  159. schema:
  160. type: object
  161. properties:
  162. parent:
  163. type: string
  164. description: '父讨论 id,传入表示这是一条回复'
  165. res_id:
  166. type: string
  167. description: '关联资源 uid(有 parent 时忽略并继承父节点)'
  168. res_type:
  169. type: string
  170. description: '关联资源类型(有 parent 时忽略并继承父节点)'
  171. enum:
  172. - sentence
  173. - wbw
  174. - article
  175. type:
  176. type: string
  177. description: 讨论类型
  178. enum:
  179. - discussion
  180. - qa
  181. - help
  182. - note
  183. - commentary
  184. default: discussion
  185. tpl_id:
  186. type: string
  187. description: '模板 id'
  188. title:
  189. type: string
  190. description: 标题(可选)
  191. content:
  192. type: string
  193. description: 正文内容
  194. content_type:
  195. type: string
  196. description: 正文格式
  197. default: markdown
  198. pos_start:
  199. type: integer
  200. description: 锚点在资源文本中的起始偏移,非负整数
  201. pos_end:
  202. type: integer
  203. description: 锚点在资源文本中的结束偏移,非负整数
  204. quote_exact:
  205. type: string
  206. description: 锚定的原文片段
  207. quote_prefix:
  208. type: string
  209. description: 锚定片段前的上下文,用于重新定位
  210. quote_suffix:
  211. type: string
  212. description: 锚定片段后的上下文,用于重新定位
  213. notification:
  214. type: boolean
  215. description: 是否推送消息队列通知
  216. default: true
  217. required:
  218. - res_id
  219. - res_type
  220. responses:
  221. 200:
  222. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  223. content:
  224. application/json:
  225. schema:
  226. type: object
  227. properties:
  228. ok:
  229. type: boolean
  230. message:
  231. type: string
  232. data:
  233. type: object
  234. properties:
  235. id:
  236. type: integer
  237. title:
  238. type: string
  239. content:
  240. type: string
  241. content_type:
  242. type: string
  243. parent:
  244. type: string
  245. status:
  246. type: integer
  247. editor:
  248. type: string
  249. res_id:
  250. type: integer
  251. res_type:
  252. type: string
  253. type:
  254. type: integer
  255. tpl_id:
  256. type: integer
  257. children_count:
  258. type: integer
  259. created_at:
  260. type: string
  261. updated_at:
  262. type: string
  263. pos_start:
  264. type: string
  265. pos_end:
  266. type: string
  267. quote_exact:
  268. type: string
  269. quote_prefix:
  270. type: string
  271. quote_suffix:
  272. type: string
  273. html:
  274. type: string
  275. summary:
  276. type: string
  277. 401:
  278. $ref: '../../main.yaml#/components/responses/Unauthorized'
  279. 422:
  280. $ref: '../../main.yaml#/components/responses/ValidationError'
  281. deprecated: true