| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-share.yaml
- get:
- summary: '列出 share'
- tags:
- - share
- operationId: get_api_v2_share
- description: 实现:`ShareController@index`
- parameters:
- -
- name: view
- in: query
- schema:
- type: string
- enum:
- - res
- - group
- -
- name: id
- in: query
- schema:
- type: string
- -
- name: offset
- in: query
- schema:
- type: string
- -
- name: limit
- in: query
- schema:
- type: string
- -
- name: search
- in: query
- description: 搜索关键字
- schema:
- type: string
- -
- name: order
- in: query
- description: 排序字段
- schema:
- type: string
- -
- name: dir
- in: query
- description: 排序方向
- schema:
- type: string
- enum:
- - desc
- - asc
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- rows:
- type: array
- items:
- type: object
- 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 } }
- count:
- type: integer
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- post:
- summary: 为资源添加协作者。
- tags:
- - share
- operationId: post_api_v2_share
- description: |-
- 只有资源拥有者能调用(与 update / destroy 的「power > 20」同口径)。
- 资源归属按 res_type 到对应表里查,查不到即拒绝——客户端谎报 res_type
- 只会让自己被拒,不会绕过校验。
- 实现:`ShareController@store`
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- res_id:
- type: string
- description: '资源 uid'
- res_type:
- type: integer
- description: '资源类型:2 channel、3 文章、4 文集、6 工作流、7 项目、8 AI 模型'
- user_id:
- type: array
- description: '协作者 uid 列表(用户或群组)'
- user_type:
- type: string
- description: 协作者类型
- enum:
- - user
- - group
- role:
- type: string
- description: 协作者角色
- enum:
- - manager
- - editor
- - reader
- required:
- - res_id
- - res_type
- - user_id
- - user_type
- - role
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
|