v3-discussions.yaml 19 KB

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