v2-channel.yaml 6.6 KB

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