v2-terms.yaml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-terms.yaml
  2. get:
  3. summary: '列出术语(dhamma term)'
  4. tags:
  5. - terms
  6. operationId: get_api_v2_terms
  7. description: |
  8. 各 view 的去向:
  9. - `channel` → `GET /v3/channels/{channel}/terms`
  10. - `studio` / `user` → `GET /v3/studios/{studio}/terms`(`{studio}` 一律 uuid;`general=true` 只要 studio 级术语)
  11. - `word` → `GET /v3/terms?word=`(只列看得见的;`with_body=true` 带渲染后的正文)
  12. - `create-by-channel` 不迁:v6 改为「按词查 + channel 详情」两次调用
  13. - `show`、`tag`、`hot-meaning` 没有消费者,不迁
  14. 保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
  15. parameters:
  16. -
  17. name: view
  18. in: query
  19. schema:
  20. type: string
  21. enum:
  22. - create-by-channel
  23. - studio
  24. - channel
  25. - show
  26. - user
  27. - word
  28. - tag
  29. - hot-meaning
  30. description: 查询口径
  31. required: true
  32. -
  33. name: channel
  34. in: query
  35. schema:
  36. type: string
  37. description: 'view=create-by-channel 时必填,目标 channel 的 uid, 用于确定语言、同 studio 的 channel 列表与 studio 信息'
  38. -
  39. name: word
  40. in: query
  41. schema:
  42. type: string
  43. description: 'view=create-by-channel 时为要新建的术语词形; view=word 时为逗号分隔的词或义项列表,按 word 或 meaning 命中'
  44. -
  45. name: name
  46. in: query
  47. schema:
  48. type: string
  49. description: 'view=studio 时必填,studio 名称,须与当前用户的 studio 一致'
  50. -
  51. name: id
  52. in: query
  53. schema:
  54. type: string
  55. description: 'view=channel 时为 channel id(uid);view=show 时为术语主键 id'
  56. -
  57. name: search
  58. in: query
  59. schema:
  60. type: string
  61. description: '关键字,按 word、word_en 前缀匹配或 meaning 模糊匹配'
  62. -
  63. name: tag
  64. in: query
  65. schema:
  66. type: string
  67. description: 'view=tag 时必填,逗号分隔的 tag 列表'
  68. -
  69. name: language
  70. in: query
  71. schema:
  72. type: string
  73. description: 'view=hot-meaning 时必填,统计该语言下每个词出现次数最多的义项'
  74. -
  75. name: order
  76. in: query
  77. schema:
  78. type: string
  79. default: updated_at
  80. description: 排序字段
  81. -
  82. name: dir
  83. in: query
  84. schema:
  85. type: string
  86. enum:
  87. - asc
  88. - desc
  89. default: desc
  90. description: 排序方向
  91. -
  92. name: offset
  93. in: query
  94. schema:
  95. type: integer
  96. default: 0
  97. description: 分页偏移量
  98. -
  99. name: limit
  100. in: query
  101. schema:
  102. type: integer
  103. default: 1000
  104. description: 每页条数
  105. -
  106. name: mode
  107. in: query
  108. schema:
  109. type: string
  110. default: read
  111. description: '渲染 note/summary 的模式,透传给 Markdown 渲染器'
  112. -
  113. name: format
  114. in: query
  115. schema:
  116. type: string
  117. enum:
  118. - react
  119. - html
  120. - text
  121. default: react
  122. description: 'note 的渲染输出格式'
  123. -
  124. name: community_summary
  125. in: query
  126. schema:
  127. type: boolean
  128. description: '传入该参数时,自身没有 note 的术语会回落到社区 channel 的解释作为 summary'
  129. -
  130. name: exp
  131. in: query
  132. schema:
  133. type: boolean
  134. description: 传入该参数时附带编辑者截至本条更新时间的累计经验值(秒)
  135. responses:
  136. 200:
  137. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  138. content:
  139. application/json:
  140. schema:
  141. type: object
  142. properties:
  143. ok:
  144. type: boolean
  145. message:
  146. type: string
  147. data:
  148. type: object
  149. properties:
  150. rows:
  151. type: array
  152. items:
  153. type: object
  154. properties: { id: { type: integer }, guid: { type: string }, word: { type: string }, word_en: { type: string }, meaning: { type: string }, other_meaning: { type: string }, tag: { type: string }, note: { type: string }, language: { type: string }, channel_id: { type: integer }, channal: { type: string }, studio: { type: string }, editor: { type: string }, created_at: { type: string }, updated_at: { type: string }, mode: { type: string }, format: { type: string }, studioId: { type: string }, channel: { type: string }, html: { type: string }, summary_is_community: { type: string }, summary: { type: string }, role: { type: string }, exp: { type: string } }
  155. count:
  156. type: integer
  157. 401:
  158. $ref: '../../main.yaml#/components/responses/Unauthorized'
  159. 422:
  160. $ref: '../../main.yaml#/components/responses/ValidationError'
  161. deprecated: true
  162. post:
  163. summary: 新建术语
  164. tags:
  165. - terms
  166. operationId: post_api_v2_terms
  167. description: |
  168. 已被取代:带 channel 的 → `POST /v3/channels/{channel}/terms`;studio 级(不带 channel)→ `POST /v3/studios/{studio}/terms`。
  169. v3 的 AI 代写走 `X-Agent-Grant` 请求头,不再收 body 里的 `access_token`。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
  170. requestBody:
  171. required: true
  172. content:
  173. application/json:
  174. schema:
  175. type: object
  176. properties:
  177. word:
  178. type: string
  179. description: '术语词形,同时用于生成 word_en'
  180. meaning:
  181. type: string
  182. description: 主要义项
  183. tag:
  184. type: string
  185. description: 标签,参与查重
  186. channel:
  187. type: string
  188. description: 'channel uid。给出则建 channel 级术语,否则建 studio 级术语'
  189. language:
  190. type: string
  191. description: '语言。仅 studio 级术语生效,channel 级会被 channel 语言覆盖'
  192. other_meaning:
  193. type: string
  194. description: 其他义项,逗号分隔
  195. note:
  196. type: string
  197. description: 术语解释,Markdown
  198. access_token:
  199. type: string
  200. description: 'channel access token,供 AI 模型等非 owner 身份验证 channel 编辑权'
  201. studioId:
  202. type: string
  203. description: 'studio 的 uuid,不传 channel 时必填(或改用 studioName)'
  204. studioName:
  205. type: string
  206. description: 'studio 名称,未给 studioId 时用它换取 studioId'
  207. required:
  208. - word
  209. - meaning
  210. responses:
  211. 200:
  212. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  213. content:
  214. application/json:
  215. schema:
  216. type: object
  217. properties:
  218. ok:
  219. type: boolean
  220. message:
  221. type: string
  222. data:
  223. type: object
  224. properties:
  225. id:
  226. type: integer
  227. guid:
  228. type: string
  229. word:
  230. type: string
  231. word_en:
  232. type: string
  233. meaning:
  234. type: string
  235. other_meaning:
  236. type: string
  237. tag:
  238. type: string
  239. note:
  240. type: string
  241. language:
  242. type: string
  243. channel_id:
  244. type: integer
  245. channal:
  246. type: string
  247. studio:
  248. type: string
  249. editor:
  250. type: string
  251. created_at:
  252. type: string
  253. updated_at:
  254. type: string
  255. mode:
  256. type: string
  257. format:
  258. type: string
  259. studioId:
  260. type: string
  261. channel:
  262. type: string
  263. html:
  264. type: string
  265. summary_is_community:
  266. type: string
  267. summary:
  268. type: string
  269. role:
  270. type: string
  271. exp:
  272. type: string
  273. 401:
  274. $ref: '../../main.yaml#/components/responses/Unauthorized'
  275. 422:
  276. $ref: '../../main.yaml#/components/responses/ValidationError'
  277. deprecated: true