v2-share.yaml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-share.yaml
  2. get:
  3. summary: '列出 share'
  4. tags:
  5. - share
  6. operationId: get_api_v2_share
  7. description: 实现:`ShareController@index`
  8. parameters:
  9. -
  10. name: view
  11. in: query
  12. schema:
  13. type: string
  14. enum:
  15. - res
  16. - group
  17. -
  18. name: id
  19. in: query
  20. schema:
  21. type: string
  22. -
  23. name: offset
  24. in: query
  25. schema:
  26. type: string
  27. -
  28. name: limit
  29. in: query
  30. schema:
  31. type: string
  32. -
  33. name: search
  34. in: query
  35. description: 搜索关键字
  36. schema:
  37. type: string
  38. -
  39. name: order
  40. in: query
  41. description: 排序字段
  42. schema:
  43. type: string
  44. -
  45. name: dir
  46. in: query
  47. description: 排序方向
  48. schema:
  49. type: string
  50. enum:
  51. - desc
  52. - asc
  53. responses:
  54. 200:
  55. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  56. content:
  57. application/json:
  58. schema:
  59. type: object
  60. properties:
  61. ok:
  62. type: boolean
  63. message:
  64. type: string
  65. data:
  66. type: object
  67. properties:
  68. rows:
  69. type: array
  70. items:
  71. type: object
  72. properties: { id: { type: integer }, res_id: { type: integer }, res_type: { type: string }, collaborator_type: { type: string }, power: { type: string }, res_name: { type: string }, owner: { type: string }, created_at: { type: string }, updated_at: { type: string }, user: { type: string }, group: { type: string } }
  73. count:
  74. type: integer
  75. 401:
  76. $ref: '../../main.yaml#/components/responses/Unauthorized'
  77. 422:
  78. $ref: '../../main.yaml#/components/responses/ValidationError'
  79. post:
  80. summary: 为资源添加协作者。
  81. tags:
  82. - share
  83. operationId: post_api_v2_share
  84. description: |-
  85. 只有资源拥有者能调用(与 update / destroy 的「power > 20」同口径)。
  86. 资源归属按 res_type 到对应表里查,查不到即拒绝——客户端谎报 res_type
  87. 只会让自己被拒,不会绕过校验。
  88. 实现:`ShareController@store`
  89. requestBody:
  90. required: true
  91. content:
  92. application/json:
  93. schema:
  94. type: object
  95. properties:
  96. res_id:
  97. type: string
  98. description: '资源 uid'
  99. res_type:
  100. type: integer
  101. description: '资源类型:2 channel、3 文章、4 文集、6 工作流、7 项目、8 AI 模型'
  102. user_id:
  103. type: array
  104. description: '协作者 uid 列表(用户或群组)'
  105. user_type:
  106. type: string
  107. description: 协作者类型
  108. enum:
  109. - user
  110. - group
  111. role:
  112. type: string
  113. description: 协作者角色
  114. enum:
  115. - manager
  116. - editor
  117. - reader
  118. required:
  119. - res_id
  120. - res_type
  121. - user_id
  122. - user_type
  123. - role
  124. responses:
  125. 200:
  126. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  127. content:
  128. application/json:
  129. schema:
  130. type: object
  131. properties:
  132. ok:
  133. type: boolean
  134. message:
  135. type: string
  136. data:
  137. type: object
  138. 401:
  139. $ref: '../../main.yaml#/components/responses/Unauthorized'
  140. 422:
  141. $ref: '../../main.yaml#/components/responses/ValidationError'