v3-discussions-discussion.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-discussions-discussion.yaml
  2. get:
  3. summary: 获取单条话题或回复
  4. tags:
  5. - discussions
  6. operationId: get_api_v3_discussions_discussion_
  7. description: |-
  8. 删除了但还有回复的话题返回墓碑;删除了的回复、删除了且没有回复的话题返回 404。
  9. 当前用户看不见的话题同样 404。
  10. 实现:`V3\DiscussionController@show`
  11. security:
  12. - { }
  13. -
  14. bearerAuth: []
  15. parameters:
  16. -
  17. name: discussion
  18. in: path
  19. required: true
  20. schema:
  21. type: string
  22. description: '话题或回复的 uuid'
  23. responses:
  24. 200:
  25. description: 成功
  26. content:
  27. application/json:
  28. schema:
  29. type: object
  30. properties:
  31. data:
  32. type: object
  33. properties:
  34. id:
  35. type: string
  36. target_type:
  37. type: string
  38. target_id:
  39. type: string
  40. parent_id:
  41. type: string
  42. nullable: true
  43. type:
  44. type: string
  45. severity:
  46. type: string
  47. nullable: true
  48. status:
  49. type: string
  50. title:
  51. type: string
  52. nullable: true
  53. content:
  54. type: string
  55. nullable: true
  56. content_type:
  57. type: string
  58. html:
  59. type: string
  60. description: 仅在部分查询口径下返回。
  61. summary:
  62. type: string
  63. description: 仅在部分查询口径下返回。
  64. tpl_id:
  65. type: string
  66. nullable: true
  67. pos_start:
  68. type: integer
  69. nullable: true
  70. pos_end:
  71. type: integer
  72. nullable: true
  73. quote_exact:
  74. type: string
  75. nullable: true
  76. quote_prefix:
  77. type: string
  78. nullable: true
  79. quote_suffix:
  80. type: string
  81. nullable: true
  82. reply_count:
  83. type: integer
  84. description: 仅在部分查询口径下返回。
  85. editor:
  86. type: object
  87. properties:
  88. id: { type: string }
  89. nickName: { type: string }
  90. userName: { type: string }
  91. realName: { type: string }
  92. sn: { type: integer }
  93. avatar: { type: string }
  94. roles: { type: array, items: { type: string } }
  95. nullable: true
  96. co_editor:
  97. type: object
  98. properties:
  99. id: { type: string }
  100. nickName: { type: string }
  101. userName: { type: string }
  102. realName: { type: string }
  103. sn: { type: integer }
  104. avatar: { type: string }
  105. roles: { type: array, items: { type: string } }
  106. nullable: true
  107. abilities:
  108. type: object
  109. properties:
  110. update: { type: boolean }
  111. delete: { type: boolean }
  112. close: { type: boolean }
  113. reply: { type: boolean }
  114. created_at:
  115. type: string
  116. updated_at:
  117. type: string
  118. deleted_at:
  119. type: string
  120. nullable: true
  121. 422:
  122. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  123. delete:
  124. summary: 删除话题或回复(软删除)
  125. tags:
  126. - discussions
  127. operationId: delete_api_v3_discussions_discussion_
  128. description: |-
  129. 作者本人或挂靠对象的管理者(句子 / 逐词所在 channel、文章的编辑者)能删;
  130. v2 只允许作者。删话题不动回复:有回复的话题以墓碑形式留在列表里。
  131. 返回删除后的资源(200),不是 204——软删的资源并没有消失。
  132. 实现:`V3\DiscussionController@destroy`
  133. security:
  134. -
  135. bearerAuth: []
  136. parameters:
  137. -
  138. name: discussion
  139. in: path
  140. required: true
  141. schema:
  142. type: string
  143. description: '话题或回复的 uuid'
  144. responses:
  145. 200:
  146. description: 成功
  147. content:
  148. application/json:
  149. schema:
  150. type: object
  151. properties:
  152. data:
  153. type: object
  154. properties:
  155. id:
  156. type: string
  157. target_type:
  158. type: string
  159. target_id:
  160. type: string
  161. parent_id:
  162. type: string
  163. nullable: true
  164. type:
  165. type: string
  166. severity:
  167. type: string
  168. nullable: true
  169. status:
  170. type: string
  171. title:
  172. type: string
  173. nullable: true
  174. content:
  175. type: string
  176. nullable: true
  177. content_type:
  178. type: string
  179. html:
  180. type: string
  181. description: 仅在部分查询口径下返回。
  182. summary:
  183. type: string
  184. description: 仅在部分查询口径下返回。
  185. tpl_id:
  186. type: string
  187. nullable: true
  188. pos_start:
  189. type: integer
  190. nullable: true
  191. pos_end:
  192. type: integer
  193. nullable: true
  194. quote_exact:
  195. type: string
  196. nullable: true
  197. quote_prefix:
  198. type: string
  199. nullable: true
  200. quote_suffix:
  201. type: string
  202. nullable: true
  203. reply_count:
  204. type: integer
  205. description: 仅在部分查询口径下返回。
  206. editor:
  207. type: object
  208. properties:
  209. id: { type: string }
  210. nickName: { type: string }
  211. userName: { type: string }
  212. realName: { type: string }
  213. sn: { type: integer }
  214. avatar: { type: string }
  215. roles: { type: array, items: { type: string } }
  216. nullable: true
  217. co_editor:
  218. type: object
  219. properties:
  220. id: { type: string }
  221. nickName: { type: string }
  222. userName: { type: string }
  223. realName: { type: string }
  224. sn: { type: integer }
  225. avatar: { type: string }
  226. roles: { type: array, items: { type: string } }
  227. nullable: true
  228. abilities:
  229. type: object
  230. properties:
  231. update: { type: boolean }
  232. delete: { type: boolean }
  233. close: { type: boolean }
  234. reply: { type: boolean }
  235. created_at:
  236. type: string
  237. updated_at:
  238. type: string
  239. deleted_at:
  240. type: string
  241. nullable: true
  242. 401:
  243. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  244. 403:
  245. description: 既不是作者,也不是挂靠对象的管理者
  246. content:
  247. application/problem+json:
  248. schema:
  249. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  250. 422:
  251. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  252. patch:
  253. summary: 修改话题或回复(局部更新)
  254. tags:
  255. - discussions
  256. operationId: patch_api_v3_discussions_discussion_
  257. description: |-
  258. 只改传了的字段。title / status / type / severity 只对话题有效,回复传了 422。
  259. 作者或对象的管理者(句子、逐词所在 channel 的编辑者,文章的编辑者)可改;
  260. 改 type 时回复跟着改,新类型不收原来的 severity 时 severity 清空。
  261. 批注:没有 status,type 只能在 note / commentary 之间改(不能与评论线程互转),
  262. 正文不能清空,可改锚点。
  263. 改了内容(标题、正文、锚点)时 co_editor 跟着这次写入走:人亲自改则清空,AI 代改则换成该模型;
  264. 只改 status / type / severity 不动 co_editor。
  265. 实现:`V3\DiscussionController@update`
  266. security:
  267. -
  268. bearerAuth: []
  269. parameters:
  270. -
  271. name: discussion
  272. in: path
  273. required: true
  274. schema:
  275. type: string
  276. description: '话题或回复的 uuid'
  277. requestBody:
  278. required: false
  279. content:
  280. application/json:
  281. schema:
  282. type: object
  283. properties:
  284. title:
  285. type: string
  286. description: 标题(只限话题)
  287. content:
  288. type: string
  289. description: 正文(markdown)
  290. status:
  291. type: string
  292. description: 状态(只限话题)
  293. enum:
  294. - active
  295. - close
  296. type:
  297. type: string
  298. description: 类型(只限话题;评论线程与批注不能互转)
  299. enum:
  300. - discussion
  301. - qa
  302. - help
  303. - issue
  304. - note
  305. - commentary
  306. severity:
  307. type: string
  308. description: '严重程度(只限话题),null 表示清空'
  309. enum:
  310. - error
  311. - warning
  312. - suggestion
  313. - urgent
  314. - normal
  315. pos_start:
  316. type: integer
  317. description: 锚点起始偏移(只限批注)
  318. pos_end:
  319. type: integer
  320. description: 锚点结束偏移(只限批注)
  321. quote_exact:
  322. type: string
  323. description: 锚定的原文片段(只限批注)
  324. quote_prefix:
  325. type: string
  326. description: 锚定片段前的上下文(只限批注)
  327. quote_suffix:
  328. type: string
  329. description: 锚定片段后的上下文(只限批注)
  330. responses:
  331. 200:
  332. description: 成功
  333. content:
  334. application/json:
  335. schema:
  336. type: object
  337. properties:
  338. data:
  339. type: object
  340. properties:
  341. id:
  342. type: string
  343. target_type:
  344. type: string
  345. target_id:
  346. type: string
  347. parent_id:
  348. type: string
  349. nullable: true
  350. type:
  351. type: string
  352. severity:
  353. type: string
  354. nullable: true
  355. status:
  356. type: string
  357. title:
  358. type: string
  359. nullable: true
  360. content:
  361. type: string
  362. nullable: true
  363. content_type:
  364. type: string
  365. html:
  366. type: string
  367. description: 仅在部分查询口径下返回。
  368. summary:
  369. type: string
  370. description: 仅在部分查询口径下返回。
  371. tpl_id:
  372. type: string
  373. nullable: true
  374. pos_start:
  375. type: integer
  376. nullable: true
  377. pos_end:
  378. type: integer
  379. nullable: true
  380. quote_exact:
  381. type: string
  382. nullable: true
  383. quote_prefix:
  384. type: string
  385. nullable: true
  386. quote_suffix:
  387. type: string
  388. nullable: true
  389. reply_count:
  390. type: integer
  391. description: 仅在部分查询口径下返回。
  392. editor:
  393. type: object
  394. properties:
  395. id: { type: string }
  396. nickName: { type: string }
  397. userName: { type: string }
  398. realName: { type: string }
  399. sn: { type: integer }
  400. avatar: { type: string }
  401. roles: { type: array, items: { type: string } }
  402. nullable: true
  403. co_editor:
  404. type: object
  405. properties:
  406. id: { type: string }
  407. nickName: { type: string }
  408. userName: { type: string }
  409. realName: { type: string }
  410. sn: { type: integer }
  411. avatar: { type: string }
  412. roles: { type: array, items: { type: string } }
  413. nullable: true
  414. abilities:
  415. type: object
  416. properties:
  417. update: { type: boolean }
  418. delete: { type: boolean }
  419. close: { type: boolean }
  420. reply: { type: boolean }
  421. created_at:
  422. type: string
  423. updated_at:
  424. type: string
  425. deleted_at:
  426. type: string
  427. nullable: true
  428. 401:
  429. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  430. 403:
  431. description: 没有修改权限
  432. content:
  433. application/problem+json:
  434. schema:
  435. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  436. 422:
  437. $ref: '../../main.yaml#/components/responses/ProblemValidation'