v3-terms-term.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-terms-term.yaml
  2. get:
  3. summary: 术语详情
  4. tags:
  5. - terms
  6. operationId: get_api_v3_terms_term_
  7. description: |-
  8. 带渲染后的「摘要 + 正文」(`body`)。channel 里的术语跟 channel 的可见性,studio 级的谁都能看。
  9. 响应带 `ETag` 头(与 `etag` 字段相同),修改时放进 `If-Match`。
  10. 实现:`V3\TermController@show`
  11. security:
  12. - { }
  13. -
  14. bearerAuth: []
  15. parameters:
  16. -
  17. name: term
  18. in: path
  19. required: true
  20. schema:
  21. type: string
  22. description: '术语 id(guid)'
  23. -
  24. name: channels
  25. in: query
  26. schema:
  27. type: string
  28. description: '正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel'
  29. -
  30. name: mode
  31. in: query
  32. schema:
  33. type: string
  34. enum:
  35. - read
  36. - edit
  37. default: read
  38. description: 正文模式
  39. -
  40. name: format
  41. in: query
  42. schema:
  43. type: string
  44. enum:
  45. - tree
  46. - html
  47. default: tree
  48. description: '正文格式:tree 给节点树 `body`,html 给 HTML 字符串 `html`(WebView 显示用)'
  49. responses:
  50. 200:
  51. description: 成功
  52. content:
  53. application/json:
  54. schema:
  55. type: object
  56. properties:
  57. data:
  58. type: object
  59. properties:
  60. id:
  61. type: string
  62. word:
  63. type: string
  64. tag:
  65. type: string
  66. nullable: true
  67. meaning:
  68. type: string
  69. other_meaning:
  70. type: string
  71. nullable: true
  72. language:
  73. type: string
  74. channel_id:
  75. type: string
  76. nullable: true
  77. channel:
  78. type: object
  79. properties:
  80. id: { type: string }
  81. name: { type: string }
  82. nullable: true
  83. owner_id:
  84. type: string
  85. quality:
  86. type: string
  87. nullable: true
  88. content_type:
  89. type: string
  90. summary:
  91. type: string
  92. nullable: true
  93. note:
  94. type: string
  95. nullable: true
  96. redirect:
  97. type: string
  98. nullable: true
  99. categories:
  100. type: array
  101. items:
  102. type: string
  103. summary_text:
  104. type: string
  105. body:
  106. type: array
  107. items:
  108. $ref: '../../main.yaml#/components/schemas/MarkupNode'
  109. description: 仅在部分查询口径下返回。
  110. html:
  111. type: string
  112. description: 仅在部分查询口径下返回。
  113. editor:
  114. type: object
  115. properties:
  116. id: { type: string }
  117. nickName: { type: string }
  118. userName: { type: string }
  119. realName: { type: string }
  120. sn: { type: integer }
  121. avatar: { type: string }
  122. roles: { type: array, items: { type: string } }
  123. nullable: true
  124. co_editor:
  125. type: object
  126. properties:
  127. id: { type: string }
  128. nickName: { type: string }
  129. userName: { type: string }
  130. realName: { type: string }
  131. sn: { type: integer }
  132. avatar: { type: string }
  133. roles: { type: array, items: { type: string } }
  134. nullable: true
  135. etag:
  136. type: string
  137. abilities:
  138. type: object
  139. properties:
  140. update: { type: boolean }
  141. delete: { type: boolean }
  142. created_at:
  143. type: string
  144. updated_at:
  145. type: string
  146. deleted_at:
  147. type: string
  148. nullable: true
  149. 403:
  150. description: '所在 channel 看不见'
  151. content:
  152. application/problem+json:
  153. schema:
  154. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  155. 422:
  156. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  157. patch:
  158. summary: 改术语
  159. tags:
  160. - terms
  161. operationId: patch_api_v3_terms_term_
  162. description: |-
  163. 只改传了的字段;word / tag 不能改(要改就新建一条,把旧的 redirect 过去)。必须带请求头
  164. `If-Match`(取自详情的 `etag` / `ETag`):不带 428,这条在你编辑期间被改过 412(响应里给出最新的 `etag`)。
  165. 分类从 note 的 `{{category|…}}` 重新抽取。channel 里的术语跟 channel 的写权限,studio 级的要团队 editor 以上。
  166. 实现:`V3\TermController@update`
  167. security:
  168. -
  169. bearerAuth: []
  170. parameters:
  171. -
  172. name: term
  173. in: path
  174. required: true
  175. schema:
  176. type: string
  177. description: '术语 id(guid)'
  178. requestBody:
  179. required: false
  180. content:
  181. application/json:
  182. schema:
  183. type: object
  184. properties:
  185. meaning:
  186. type: string
  187. description: 释义
  188. other_meaning:
  189. type: string
  190. nullable: true
  191. description: 其它释义
  192. note:
  193. type: string
  194. nullable: true
  195. description: 正文
  196. summary:
  197. type: string
  198. nullable: true
  199. description: '摘要,格式与 note 相同'
  200. quality:
  201. type: string
  202. nullable: true
  203. description: 质量
  204. enum:
  205. - featured
  206. - standard
  207. - draft
  208. - pending
  209. content_type:
  210. type: string
  211. description: 正文方言
  212. enum:
  213. - markdown
  214. - markdown-e2
  215. redirect:
  216. type: string
  217. nullable: true
  218. description: '重定向到 word 或 word@tag'
  219. language:
  220. type: string
  221. description: '语言(只有 studio 级术语能改)'
  222. responses:
  223. 200:
  224. description: 成功
  225. content:
  226. application/json:
  227. schema:
  228. type: object
  229. properties:
  230. data:
  231. type: object
  232. properties:
  233. id:
  234. type: string
  235. word:
  236. type: string
  237. tag:
  238. type: string
  239. nullable: true
  240. meaning:
  241. type: string
  242. other_meaning:
  243. type: string
  244. nullable: true
  245. language:
  246. type: string
  247. channel_id:
  248. type: string
  249. nullable: true
  250. channel:
  251. type: object
  252. properties:
  253. id: { type: string }
  254. name: { type: string }
  255. nullable: true
  256. owner_id:
  257. type: string
  258. quality:
  259. type: string
  260. nullable: true
  261. content_type:
  262. type: string
  263. summary:
  264. type: string
  265. nullable: true
  266. note:
  267. type: string
  268. nullable: true
  269. redirect:
  270. type: string
  271. nullable: true
  272. categories:
  273. type: array
  274. items:
  275. type: string
  276. summary_text:
  277. type: string
  278. body:
  279. type: array
  280. items:
  281. $ref: '../../main.yaml#/components/schemas/MarkupNode'
  282. description: 仅在部分查询口径下返回。
  283. html:
  284. type: string
  285. description: 仅在部分查询口径下返回。
  286. editor:
  287. type: object
  288. properties:
  289. id: { type: string }
  290. nickName: { type: string }
  291. userName: { type: string }
  292. realName: { type: string }
  293. sn: { type: integer }
  294. avatar: { type: string }
  295. roles: { type: array, items: { type: string } }
  296. nullable: true
  297. co_editor:
  298. type: object
  299. properties:
  300. id: { type: string }
  301. nickName: { type: string }
  302. userName: { type: string }
  303. realName: { type: string }
  304. sn: { type: integer }
  305. avatar: { type: string }
  306. roles: { type: array, items: { type: string } }
  307. nullable: true
  308. etag:
  309. type: string
  310. abilities:
  311. type: object
  312. properties:
  313. update: { type: boolean }
  314. delete: { type: boolean }
  315. created_at:
  316. type: string
  317. updated_at:
  318. type: string
  319. deleted_at:
  320. type: string
  321. nullable: true
  322. 401:
  323. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  324. 403:
  325. description: 不能修改
  326. content:
  327. application/problem+json:
  328. schema:
  329. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  330. 412:
  331. description: 这条在你编辑期间被改过
  332. content:
  333. application/problem+json:
  334. schema:
  335. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  336. 422:
  337. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  338. 428:
  339. description: '没带 If-Match'
  340. content:
  341. application/problem+json:
  342. schema:
  343. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  344. delete:
  345. summary: 删术语
  346. tags:
  347. - terms
  348. operationId: delete_api_v3_terms_term_
  349. description: |-
  350. 软删除,返回被删的术语。拥有者本人或团队 owner 能删;AI 模型不能删。
  351. 实现:`V3\TermController@destroy`
  352. security:
  353. -
  354. bearerAuth: []
  355. parameters:
  356. -
  357. name: term
  358. in: path
  359. required: true
  360. schema:
  361. type: string
  362. description: '术语 id(guid)'
  363. responses:
  364. 200:
  365. description: 成功
  366. content:
  367. application/json:
  368. schema:
  369. type: object
  370. properties:
  371. data:
  372. type: object
  373. properties:
  374. id:
  375. type: string
  376. word:
  377. type: string
  378. tag:
  379. type: string
  380. nullable: true
  381. meaning:
  382. type: string
  383. other_meaning:
  384. type: string
  385. nullable: true
  386. language:
  387. type: string
  388. channel_id:
  389. type: string
  390. nullable: true
  391. channel:
  392. type: object
  393. properties:
  394. id: { type: string }
  395. name: { type: string }
  396. nullable: true
  397. owner_id:
  398. type: string
  399. quality:
  400. type: string
  401. nullable: true
  402. content_type:
  403. type: string
  404. summary:
  405. type: string
  406. nullable: true
  407. note:
  408. type: string
  409. nullable: true
  410. redirect:
  411. type: string
  412. nullable: true
  413. categories:
  414. type: array
  415. items:
  416. type: string
  417. summary_text:
  418. type: string
  419. body:
  420. type: array
  421. items:
  422. $ref: '../../main.yaml#/components/schemas/MarkupNode'
  423. description: 仅在部分查询口径下返回。
  424. html:
  425. type: string
  426. description: 仅在部分查询口径下返回。
  427. editor:
  428. type: object
  429. properties:
  430. id: { type: string }
  431. nickName: { type: string }
  432. userName: { type: string }
  433. realName: { type: string }
  434. sn: { type: integer }
  435. avatar: { type: string }
  436. roles: { type: array, items: { type: string } }
  437. nullable: true
  438. co_editor:
  439. type: object
  440. properties:
  441. id: { type: string }
  442. nickName: { type: string }
  443. userName: { type: string }
  444. realName: { type: string }
  445. sn: { type: integer }
  446. avatar: { type: string }
  447. roles: { type: array, items: { type: string } }
  448. nullable: true
  449. etag:
  450. type: string
  451. abilities:
  452. type: object
  453. properties:
  454. update: { type: boolean }
  455. delete: { type: boolean }
  456. created_at:
  457. type: string
  458. updated_at:
  459. type: string
  460. deleted_at:
  461. type: string
  462. nullable: true
  463. 401:
  464. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  465. 403:
  466. description: 不能删除
  467. content:
  468. application/problem+json:
  469. schema:
  470. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  471. 422:
  472. $ref: '../../main.yaml#/components/responses/ProblemValidation'