v3-discussions.yaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-discussions.yaml
  2. get:
  3. summary: 列出某个对象上的话题
  4. tags:
  5. - discussions
  6. operationId: get_api_v3_discussions
  7. description: |-
  8. 只列话题(不含回复),删除了但还有回复的话题以墓碑出现(deleted_at 有值、内容为空)。
  9. 未登录看不到协作类话题(discussion / issue);basic 角色在自己无权管理的对象上只看得到
  10. 自己发起的协作类话题。各状态的数量与「能发起哪些类型」见 `GET /v3/discussions/summary`。
  11. 不传 type 时只列评论线程(discussion / qa / help / issue),批注要显式 type=note / commentary。
  12. 实现:`V3\DiscussionController@index`
  13. security:
  14. - { }
  15. -
  16. bearerAuth: []
  17. parameters:
  18. -
  19. name: per_page
  20. in: query
  21. schema:
  22. type: integer
  23. default: 15
  24. description: '每页数量,最大 200'
  25. -
  26. name: target_type
  27. in: query
  28. schema:
  29. type: string
  30. enum:
  31. - sentence
  32. - wbw
  33. - article
  34. - term
  35. - task
  36. description: 挂靠对象的类型
  37. required: true
  38. -
  39. name: target_id
  40. in: query
  41. schema:
  42. type: string
  43. description: '挂靠对象的 uuid'
  44. required: true
  45. -
  46. name: type
  47. in: query
  48. schema:
  49. type: string
  50. enum:
  51. - discussion
  52. - qa
  53. - help
  54. - issue
  55. - note
  56. - commentary
  57. description: 类型,不传则只列评论线程
  58. -
  59. name: status
  60. in: query
  61. schema:
  62. type: string
  63. enum:
  64. - active
  65. - close
  66. description: 话题状态,不传则两种都要
  67. -
  68. name: severity
  69. in: query
  70. schema:
  71. type: string
  72. description: 严重程度,逗号分隔多选
  73. example: 'error,warning'
  74. -
  75. name: sort
  76. in: query
  77. schema:
  78. type: string
  79. enum:
  80. - created_at
  81. - '-created_at'
  82. - updated_at
  83. - '-updated_at'
  84. default: '-created_at'
  85. description: '排序,前缀 - 表示倒序'
  86. -
  87. name: page
  88. in: query
  89. schema:
  90. type: integer
  91. default: 1
  92. description: 页码
  93. responses:
  94. 200:
  95. description: 成功
  96. content:
  97. application/json:
  98. schema:
  99. type: object
  100. properties:
  101. data:
  102. type: array
  103. items:
  104. type: object
  105. properties:
  106. id:
  107. type: string
  108. target_type:
  109. type: string
  110. target_id:
  111. type: string
  112. parent_id:
  113. type: string
  114. nullable: true
  115. type:
  116. type: string
  117. severity:
  118. type: string
  119. nullable: true
  120. status:
  121. type: string
  122. title:
  123. type: string
  124. nullable: true
  125. content:
  126. type: string
  127. nullable: true
  128. content_type:
  129. type: string
  130. html:
  131. type: string
  132. description: 仅在部分查询口径下返回。
  133. summary:
  134. type: string
  135. description: 仅在部分查询口径下返回。
  136. tpl_id:
  137. type: string
  138. nullable: true
  139. pos_start:
  140. type: integer
  141. nullable: true
  142. pos_end:
  143. type: integer
  144. nullable: true
  145. quote_exact:
  146. type: string
  147. nullable: true
  148. quote_prefix:
  149. type: string
  150. nullable: true
  151. quote_suffix:
  152. type: string
  153. nullable: true
  154. reply_count:
  155. type: integer
  156. description: 仅在部分查询口径下返回。
  157. editor:
  158. type: object
  159. properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
  160. nullable: true
  161. co_editor:
  162. type: object
  163. properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
  164. nullable: true
  165. abilities:
  166. type: object
  167. properties: { update: { type: boolean }, delete: { type: boolean }, close: { type: boolean }, reply: { type: boolean } }
  168. created_at:
  169. type: string
  170. updated_at:
  171. type: string
  172. deleted_at:
  173. type: string
  174. nullable: true
  175. meta:
  176. $ref: '../../main.yaml#/components/schemas/PaginationMeta'
  177. 422:
  178. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  179. post:
  180. summary: 发起话题或新建批注
  181. tags:
  182. - discussions
  183. operationId: post_api_v3_discussions
  184. description: |-
  185. discussion / issue 登录即可发;qa / help 只能发在文章上,且只有文章的编辑者能发。
  186. severity 的取值随 type:issue 为 error / warning / suggestion,help 为 urgent / normal,
  187. 其它类型不收。默认会通知对象的作者(站内信 + webhook),`notify=false` 关闭。
  188. 批注(note / commentary)只能加在句子上,且只有该句所在 channel 的编辑者能加;
  189. 标题可省、正文必填,commentary 的正文必须是义注句子模板 `{{book-para-start-end}}`
  190. (可多句并列);可带锚点 pos_* / quote_*(评论线程传了 422);不发通知。
  191. 实现:`V3\DiscussionController@store`
  192. security:
  193. -
  194. bearerAuth: []
  195. requestBody:
  196. required: true
  197. content:
  198. application/json:
  199. schema:
  200. type: object
  201. properties:
  202. target_type:
  203. type: string
  204. description: 挂靠对象的类型
  205. enum:
  206. - sentence
  207. - wbw
  208. - article
  209. - term
  210. - task
  211. target_id:
  212. type: string
  213. description: '挂靠对象的 uuid'
  214. type:
  215. type: string
  216. description: 类型
  217. enum:
  218. - discussion
  219. - qa
  220. - help
  221. - issue
  222. - note
  223. - commentary
  224. default: discussion
  225. title:
  226. type: string
  227. description: '标题,最长 256 字符;评论线程必填,批注可省'
  228. content:
  229. type: string
  230. description: 正文(markdown);批注必填
  231. severity:
  232. type: string
  233. description: 严重程度
  234. enum:
  235. - error
  236. - warning
  237. - suggestion
  238. - urgent
  239. - normal
  240. pos_start:
  241. type: integer
  242. description: 批注锚点在句子文本中的起始偏移(只限批注)
  243. pos_end:
  244. type: integer
  245. description: 批注锚点的结束偏移,批注插在这里(只限批注)
  246. quote_exact:
  247. type: string
  248. description: 锚定的原文片段(只限批注)
  249. quote_prefix:
  250. type: string
  251. description: 锚定片段前的上下文,用于重新定位(只限批注)
  252. quote_suffix:
  253. type: string
  254. description: 锚定片段后的上下文,用于重新定位(只限批注)
  255. tpl_id:
  256. type: string
  257. description: '话题模板(文章)的 uuid'
  258. notify:
  259. type: boolean
  260. description: 是否发通知(批注不发)
  261. default: true
  262. required:
  263. - target_type
  264. - target_id
  265. responses:
  266. 200:
  267. description: 成功
  268. content:
  269. application/json:
  270. schema:
  271. type: object
  272. properties:
  273. data:
  274. type: object
  275. properties:
  276. id:
  277. type: string
  278. target_type:
  279. type: string
  280. target_id:
  281. type: string
  282. parent_id:
  283. type: string
  284. nullable: true
  285. type:
  286. type: string
  287. severity:
  288. type: string
  289. nullable: true
  290. status:
  291. type: string
  292. title:
  293. type: string
  294. nullable: true
  295. content:
  296. type: string
  297. nullable: true
  298. content_type:
  299. type: string
  300. html:
  301. type: string
  302. description: 仅在部分查询口径下返回。
  303. summary:
  304. type: string
  305. description: 仅在部分查询口径下返回。
  306. tpl_id:
  307. type: string
  308. nullable: true
  309. pos_start:
  310. type: integer
  311. nullable: true
  312. pos_end:
  313. type: integer
  314. nullable: true
  315. quote_exact:
  316. type: string
  317. nullable: true
  318. quote_prefix:
  319. type: string
  320. nullable: true
  321. quote_suffix:
  322. type: string
  323. nullable: true
  324. reply_count:
  325. type: integer
  326. description: 仅在部分查询口径下返回。
  327. editor:
  328. type: object
  329. properties:
  330. id: { type: string }
  331. nickName: { type: string }
  332. userName: { type: string }
  333. realName: { type: string }
  334. sn: { type: integer }
  335. avatar: { type: string }
  336. roles: { type: array, items: { type: string } }
  337. nullable: true
  338. co_editor:
  339. type: object
  340. properties:
  341. id: { type: string }
  342. nickName: { type: string }
  343. userName: { type: string }
  344. realName: { type: string }
  345. sn: { type: integer }
  346. avatar: { type: string }
  347. roles: { type: array, items: { type: string } }
  348. nullable: true
  349. abilities:
  350. type: object
  351. properties:
  352. update: { type: boolean }
  353. delete: { type: boolean }
  354. close: { type: boolean }
  355. reply: { type: boolean }
  356. created_at:
  357. type: string
  358. updated_at:
  359. type: string
  360. deleted_at:
  361. type: string
  362. nullable: true
  363. 201:
  364. description: 创建成功
  365. content:
  366. application/json:
  367. schema:
  368. type: object
  369. properties:
  370. data:
  371. type: object
  372. properties:
  373. id:
  374. type: string
  375. target_type:
  376. type: string
  377. target_id:
  378. type: string
  379. parent_id:
  380. type: string
  381. nullable: true
  382. type:
  383. type: string
  384. severity:
  385. type: string
  386. nullable: true
  387. status:
  388. type: string
  389. title:
  390. type: string
  391. nullable: true
  392. content:
  393. type: string
  394. nullable: true
  395. content_type:
  396. type: string
  397. html:
  398. type: string
  399. description: 仅在部分查询口径下返回。
  400. summary:
  401. type: string
  402. description: 仅在部分查询口径下返回。
  403. tpl_id:
  404. type: string
  405. nullable: true
  406. pos_start:
  407. type: integer
  408. nullable: true
  409. pos_end:
  410. type: integer
  411. nullable: true
  412. quote_exact:
  413. type: string
  414. nullable: true
  415. quote_prefix:
  416. type: string
  417. nullable: true
  418. quote_suffix:
  419. type: string
  420. nullable: true
  421. reply_count:
  422. type: integer
  423. description: 仅在部分查询口径下返回。
  424. editor:
  425. type: object
  426. properties:
  427. id: { type: string }
  428. nickName: { type: string }
  429. userName: { type: string }
  430. realName: { type: string }
  431. sn: { type: integer }
  432. avatar: { type: string }
  433. roles: { type: array, items: { type: string } }
  434. nullable: true
  435. co_editor:
  436. type: object
  437. properties:
  438. id: { type: string }
  439. nickName: { type: string }
  440. userName: { type: string }
  441. realName: { type: string }
  442. sn: { type: integer }
  443. avatar: { type: string }
  444. roles: { type: array, items: { type: string } }
  445. nullable: true
  446. abilities:
  447. type: object
  448. properties:
  449. update: { type: boolean }
  450. delete: { type: boolean }
  451. close: { type: boolean }
  452. reply: { type: boolean }
  453. created_at:
  454. type: string
  455. updated_at:
  456. type: string
  457. deleted_at:
  458. type: string
  459. nullable: true
  460. 401:
  461. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  462. 403:
  463. description: 当前用户不能在这个对象上发起这种类型的话题
  464. content:
  465. application/problem+json:
  466. schema:
  467. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  468. 422:
  469. $ref: '../../main.yaml#/components/responses/ProblemValidation'