v2-channel.yaml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-channel.yaml
  2. get:
  3. summary: '列出 channel(译文集)'
  4. tags:
  5. - channel
  6. operationId: get_api_v2_channel
  7. description: |
  8. 各 view 的去向:
  9. - `public` / `system` → `GET /v3/channels`(`system=true`)
  10. - `studio`(含 `view2`、`collaborator`)/ `studio-all` → `GET /v3/studios/{studio}/channels?relation=own|shared|all`
  11. - `user-edit` → `GET /v3/channels/editable`(搜索参数是 `search`)
  12. - `paragraphs` → `GET /v3/tipitaka-paragraph-channels/{book}/{para}`
  13. - `id`、`user-in-chapter` 没有消费者,不迁
  14. 保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
  15. parameters:
  16. -
  17. name: book
  18. in: query
  19. schema:
  20. type: integer
  21. description: 'view=user-in-chapter 时的典籍 id;传入后会联查该章节的翻译进度'
  22. -
  23. name: view
  24. in: query
  25. schema:
  26. type: string
  27. enum:
  28. - public
  29. - studio
  30. - studio-all
  31. - user-edit
  32. - user-in-chapter
  33. - system
  34. - paragraphs
  35. - id
  36. description: 查询口径
  37. required: true
  38. -
  39. name: name
  40. in: query
  41. schema:
  42. type: string
  43. description: 'studio 名称,view=studio / studio-all 时必填'
  44. -
  45. name: view2
  46. in: query
  47. schema:
  48. type: string
  49. default: my
  50. description: 'view=studio 时的二级口径:my=我的,其余值=协作的'
  51. -
  52. name: collaborator
  53. in: query
  54. schema:
  55. type: string
  56. default: all
  57. description: 'view=studio 且 view2 为协作时,按协作者 uid 过滤'
  58. -
  59. name: para
  60. in: query
  61. schema:
  62. type: string
  63. description: 'view=user-in-chapter 时的段落号'
  64. -
  65. name: book_id
  66. in: query
  67. schema:
  68. type: integer
  69. description: 'view=paragraphs 时的典籍 id'
  70. -
  71. name: id
  72. in: query
  73. schema:
  74. type: string
  75. description: 'view=id 时的 channel uid 列表,逗号分隔'
  76. -
  77. name: paragraph
  78. in: query
  79. schema:
  80. type: string
  81. description: '联查 progress_chapters 时的段落号,与 book 配合使用'
  82. -
  83. name: search
  84. in: query
  85. schema:
  86. type: string
  87. -
  88. name: type
  89. in: query
  90. schema:
  91. type: integer
  92. description: '按 channel 类型过滤'
  93. -
  94. name: updated_at
  95. in: query
  96. schema:
  97. type: string
  98. description: 只返回该时间之后更新的记录,用于离线包增量同步
  99. example: '2023-09-18T05:39:51.000000Z'
  100. -
  101. name: created_at
  102. in: query
  103. schema:
  104. type: string
  105. description: 只返回该时间之后新建的记录
  106. -
  107. name: order
  108. in: query
  109. schema:
  110. type: string
  111. default: created_at
  112. -
  113. name: dir
  114. in: query
  115. schema:
  116. type: string
  117. default: desc
  118. -
  119. name: offset
  120. in: query
  121. schema:
  122. type: string
  123. -
  124. name: limit
  125. in: query
  126. schema:
  127. type: string
  128. -
  129. name: progress
  130. in: query
  131. schema:
  132. type: string
  133. description: '传入则在每行附带 final 逐句完成情况,依赖 book 与 para'
  134. responses:
  135. 200:
  136. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  137. content:
  138. application/json:
  139. schema:
  140. type: object
  141. properties:
  142. ok:
  143. type: boolean
  144. message:
  145. type: string
  146. data:
  147. type: object
  148. properties:
  149. rows:
  150. type: array
  151. items:
  152. type: object
  153. count:
  154. type: integer
  155. 401:
  156. $ref: '../../main.yaml#/components/responses/Unauthorized'
  157. 422:
  158. $ref: '../../main.yaml#/components/responses/ValidationError'
  159. deprecated: true
  160. post:
  161. summary: '新建 channel'
  162. tags:
  163. - channel
  164. operationId: post_api_v2_channel
  165. description: |
  166. 已被 `POST /v3/studios/{studio}/channels` 取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
  167. requestBody:
  168. required: true
  169. content:
  170. application/json:
  171. schema:
  172. type: object
  173. properties:
  174. studio:
  175. type: string
  176. description: '所属 studio 名称'
  177. name:
  178. type: string
  179. description: 'channel 名称,在同一 studio 内唯一'
  180. type:
  181. type: integer
  182. description: 'channel 类型'
  183. lang:
  184. type: string
  185. description: 译文语言代码
  186. example: zh-Hans
  187. required:
  188. - studio
  189. - name
  190. - type
  191. - lang
  192. responses:
  193. 200:
  194. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  195. content:
  196. application/json:
  197. schema:
  198. type: object
  199. properties:
  200. ok:
  201. type: boolean
  202. message:
  203. type: string
  204. data:
  205. type: object
  206. 401:
  207. $ref: '../../main.yaml#/components/responses/Unauthorized'
  208. 422:
  209. $ref: '../../main.yaml#/components/responses/ValidationError'
  210. deprecated: true
  211. patch:
  212. summary: '局部更新 channel'
  213. tags:
  214. - channel
  215. operationId: patch_api_v2_channel
  216. description: |-
  217. 只更新请求体中出现的字段。系统 channel 不可修改;非 owner 需要 30 以上的协作权限。
  218. 实现:`ChannelController@patch`
  219. requestBody:
  220. required: false
  221. content:
  222. application/json:
  223. schema:
  224. type: object
  225. properties:
  226. id:
  227. type: string
  228. name:
  229. type: string
  230. description: 'channel 名称'
  231. type:
  232. type: integer
  233. description: 'channel 类型'
  234. summary:
  235. type: string
  236. description: 简介
  237. lang:
  238. type: string
  239. description: 译文语言代码
  240. status:
  241. type: integer
  242. description: '状态。30 为全网公开'
  243. config:
  244. type: string
  245. description: 'channel 配置'
  246. responses:
  247. 200:
  248. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  249. content:
  250. application/json:
  251. schema:
  252. type: object
  253. properties:
  254. ok:
  255. type: boolean
  256. message:
  257. type: string
  258. data:
  259. type: object
  260. 401:
  261. $ref: '../../main.yaml#/components/responses/Unauthorized'
  262. 422:
  263. $ref: '../../main.yaml#/components/responses/ValidationError'