v3-discussions-discussion.yaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. sentence:
  86. type: object
  87. properties:
  88. book: { type: integer }
  89. paragraph: { type: integer }
  90. word_start: { type: integer }
  91. word_end: { type: integer }
  92. description: 仅在部分查询口径下返回。
  93. editor:
  94. type: object
  95. properties:
  96. id: { type: string }
  97. nickName: { type: string }
  98. userName: { type: string }
  99. realName: { type: string }
  100. sn: { type: integer }
  101. avatar: { type: string }
  102. roles: { type: array, items: { type: string } }
  103. nullable: true
  104. co_editor:
  105. type: object
  106. properties:
  107. id: { type: string }
  108. nickName: { type: string }
  109. userName: { type: string }
  110. realName: { type: string }
  111. sn: { type: integer }
  112. avatar: { type: string }
  113. roles: { type: array, items: { type: string } }
  114. nullable: true
  115. abilities:
  116. type: object
  117. properties:
  118. update: { type: boolean }
  119. delete: { type: boolean }
  120. close: { type: boolean }
  121. reply: { type: boolean }
  122. created_at:
  123. type: string
  124. updated_at:
  125. type: string
  126. deleted_at:
  127. type: string
  128. nullable: true
  129. 422:
  130. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  131. delete:
  132. summary: 删除话题或回复(软删除)
  133. tags:
  134. - discussions
  135. operationId: delete_api_v3_discussions_discussion_
  136. description: |-
  137. 作者本人或挂靠对象的管理者(句子 / 逐词所在 channel、文章的编辑者)能删;
  138. v2 只允许作者。删话题不动回复:有回复的话题以墓碑形式留在列表里。
  139. 返回删除后的资源(200),不是 204——软删的资源并没有消失。
  140. 实现:`V3\DiscussionController@destroy`
  141. security:
  142. -
  143. bearerAuth: []
  144. parameters:
  145. -
  146. name: discussion
  147. in: path
  148. required: true
  149. schema:
  150. type: string
  151. description: '话题或回复的 uuid'
  152. responses:
  153. 200:
  154. description: 成功
  155. content:
  156. application/json:
  157. schema:
  158. type: object
  159. properties:
  160. data:
  161. type: object
  162. properties:
  163. id:
  164. type: string
  165. target_type:
  166. type: string
  167. target_id:
  168. type: string
  169. parent_id:
  170. type: string
  171. nullable: true
  172. type:
  173. type: string
  174. severity:
  175. type: string
  176. nullable: true
  177. status:
  178. type: string
  179. title:
  180. type: string
  181. nullable: true
  182. content:
  183. type: string
  184. nullable: true
  185. content_type:
  186. type: string
  187. html:
  188. type: string
  189. description: 仅在部分查询口径下返回。
  190. summary:
  191. type: string
  192. description: 仅在部分查询口径下返回。
  193. tpl_id:
  194. type: string
  195. nullable: true
  196. pos_start:
  197. type: integer
  198. nullable: true
  199. pos_end:
  200. type: integer
  201. nullable: true
  202. quote_exact:
  203. type: string
  204. nullable: true
  205. quote_prefix:
  206. type: string
  207. nullable: true
  208. quote_suffix:
  209. type: string
  210. nullable: true
  211. reply_count:
  212. type: integer
  213. description: 仅在部分查询口径下返回。
  214. sentence:
  215. type: object
  216. properties:
  217. book: { type: integer }
  218. paragraph: { type: integer }
  219. word_start: { type: integer }
  220. word_end: { type: integer }
  221. description: 仅在部分查询口径下返回。
  222. editor:
  223. type: object
  224. properties:
  225. id: { type: string }
  226. nickName: { type: string }
  227. userName: { type: string }
  228. realName: { type: string }
  229. sn: { type: integer }
  230. avatar: { type: string }
  231. roles: { type: array, items: { type: string } }
  232. nullable: true
  233. co_editor:
  234. type: object
  235. properties:
  236. id: { type: string }
  237. nickName: { type: string }
  238. userName: { type: string }
  239. realName: { type: string }
  240. sn: { type: integer }
  241. avatar: { type: string }
  242. roles: { type: array, items: { type: string } }
  243. nullable: true
  244. abilities:
  245. type: object
  246. properties:
  247. update: { type: boolean }
  248. delete: { type: boolean }
  249. close: { type: boolean }
  250. reply: { type: boolean }
  251. created_at:
  252. type: string
  253. updated_at:
  254. type: string
  255. deleted_at:
  256. type: string
  257. nullable: true
  258. 401:
  259. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  260. 403:
  261. description: 既不是作者,也不是挂靠对象的管理者
  262. content:
  263. application/problem+json:
  264. schema:
  265. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  266. 422:
  267. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  268. patch:
  269. summary: 修改话题或回复(局部更新)
  270. tags:
  271. - discussions
  272. operationId: patch_api_v3_discussions_discussion_
  273. description: |-
  274. 只改传了的字段。title / status / type / severity 只对话题有效,回复传了 422。
  275. 作者或对象的管理者(句子、逐词所在 channel 的编辑者,文章的编辑者)可改;
  276. 改 type 时回复跟着改,新类型不收原来的 severity 时 severity 清空(锚点保留,改回可带锚点的类型时恢复);
  277. 改成 glossary 须挂在句子上、且是该句的管理者。
  278. 批注:没有 status,type 只能在 note / commentary 之间改(不能与评论线程互转),
  279. 正文不能清空,可改锚点。
  280. 改了内容(标题、正文、锚点)时 co_editor 跟着这次写入走:人亲自改则清空,AI 代改则换成该模型;
  281. 只改 status / type / severity 不动 co_editor。
  282. 实现:`V3\DiscussionController@update`
  283. security:
  284. -
  285. bearerAuth: []
  286. parameters:
  287. -
  288. name: discussion
  289. in: path
  290. required: true
  291. schema:
  292. type: string
  293. description: '话题或回复的 uuid'
  294. requestBody:
  295. required: false
  296. content:
  297. application/json:
  298. schema:
  299. type: object
  300. properties:
  301. title:
  302. type: string
  303. description: 标题(只限话题)
  304. content:
  305. type: string
  306. description: 正文(markdown)
  307. status:
  308. type: string
  309. description: 状态(只限话题)
  310. enum:
  311. - active
  312. - close
  313. type:
  314. type: string
  315. description: 类型(只限话题;评论线程与批注不能互转)
  316. enum:
  317. - discussion
  318. - qa
  319. - help
  320. - issue
  321. - glossary
  322. - note
  323. - commentary
  324. severity:
  325. type: string
  326. description: '严重程度(只限话题),null 表示清空'
  327. enum:
  328. - error
  329. - warning
  330. - suggestion
  331. - urgent
  332. - normal
  333. pos_start:
  334. type: integer
  335. description: '锚点起始偏移(只限 note / commentary / issue / glossary)'
  336. pos_end:
  337. type: integer
  338. description: '锚点结束偏移(只限 note / commentary / issue / glossary)'
  339. quote_exact:
  340. type: string
  341. description: '锚定的原文片段(只限 note / commentary / issue / glossary)'
  342. quote_prefix:
  343. type: string
  344. description: '锚定片段前的上下文(只限 note / commentary / issue / glossary)'
  345. quote_suffix:
  346. type: string
  347. description: '锚定片段后的上下文(只限 note / commentary / issue / glossary)'
  348. responses:
  349. 200:
  350. description: 成功
  351. content:
  352. application/json:
  353. schema:
  354. type: object
  355. properties:
  356. data:
  357. type: object
  358. properties:
  359. id:
  360. type: string
  361. target_type:
  362. type: string
  363. target_id:
  364. type: string
  365. parent_id:
  366. type: string
  367. nullable: true
  368. type:
  369. type: string
  370. severity:
  371. type: string
  372. nullable: true
  373. status:
  374. type: string
  375. title:
  376. type: string
  377. nullable: true
  378. content:
  379. type: string
  380. nullable: true
  381. content_type:
  382. type: string
  383. html:
  384. type: string
  385. description: 仅在部分查询口径下返回。
  386. summary:
  387. type: string
  388. description: 仅在部分查询口径下返回。
  389. tpl_id:
  390. type: string
  391. nullable: true
  392. pos_start:
  393. type: integer
  394. nullable: true
  395. pos_end:
  396. type: integer
  397. nullable: true
  398. quote_exact:
  399. type: string
  400. nullable: true
  401. quote_prefix:
  402. type: string
  403. nullable: true
  404. quote_suffix:
  405. type: string
  406. nullable: true
  407. reply_count:
  408. type: integer
  409. description: 仅在部分查询口径下返回。
  410. sentence:
  411. type: object
  412. properties:
  413. book: { type: integer }
  414. paragraph: { type: integer }
  415. word_start: { type: integer }
  416. word_end: { type: integer }
  417. description: 仅在部分查询口径下返回。
  418. editor:
  419. type: object
  420. properties:
  421. id: { type: string }
  422. nickName: { type: string }
  423. userName: { type: string }
  424. realName: { type: string }
  425. sn: { type: integer }
  426. avatar: { type: string }
  427. roles: { type: array, items: { type: string } }
  428. nullable: true
  429. co_editor:
  430. type: object
  431. properties:
  432. id: { type: string }
  433. nickName: { type: string }
  434. userName: { type: string }
  435. realName: { type: string }
  436. sn: { type: integer }
  437. avatar: { type: string }
  438. roles: { type: array, items: { type: string } }
  439. nullable: true
  440. abilities:
  441. type: object
  442. properties:
  443. update: { type: boolean }
  444. delete: { type: boolean }
  445. close: { type: boolean }
  446. reply: { type: boolean }
  447. created_at:
  448. type: string
  449. updated_at:
  450. type: string
  451. deleted_at:
  452. type: string
  453. nullable: true
  454. 401:
  455. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  456. 403:
  457. description: 没有修改权限
  458. content:
  459. application/problem+json:
  460. schema:
  461. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  462. 422:
  463. $ref: '../../main.yaml#/components/responses/ProblemValidation'