Skip to content

Workspaces API ​

Workspace endpoints 用于管理 workspaces、members 和 workspace avatar。

GET /api/workspaces ​

返回当前 account 可访问的 workspaces 列表。

参数:无。

Payload: 无。

响应:WorkspaceViewShort[]。

GET /api/workspaces/:fullname ​

返回一个 workspace。

参数:

参数位置说明
fullnamePathWorkspace fullname.

Payload: 无。

响应:WorkspaceView。

PUT /api/workspaces/:fullname ​

创建新 workspace 或更新已有 workspace。

参数:

参数位置说明
fullnamePathWorkspace fullname. 必须与 payload.fullname 一致。

Payload:

字段必填说明
fullname是Workspace fullname.
createOnly否如果为 true,当 workspace 已存在时 endpoint 会返回错误。
resetInvite否重新生成 invite state。
tags否Tags 数组。
labels否String labels 对象。
meta.title否workspace 的可见名称。
meta.avatar否Avatar URL。

响应:WorkspaceView。

DELETE /api/workspaces/:fullname ​

删除 workspace。

参数:

参数位置说明
fullnamePathWorkspace fullname.

Payload: 无。

响应:OperationResult。

POST /api/workspaces/:fullname/avatar ​

上传 workspace avatar。

参数:

参数位置说明
fullnamePathWorkspace fullname.

Payload:

字段必填说明
filename是原始文件名。
contentType是图片 MIME type。
data是Base64 图片数据。

响应:HTTP 200 OK。

字段必填说明
url是已上传 avatar 的 URL。相同值会保存到 workspace.meta.avatar。
fileName是保存后的文件名。
extension是文件扩展名。
size是文件大小,单位为字节。
workspace是更新后的 WorkspaceView,包含新的 avatar metadata。

GET /api/workspaces/:workspace/acl ​

返回 workspace members/ACL entries 列表。

参数:

参数位置说明
workspacePathWorkspace fullname.

Payload: 无。

响应:WorkspaceAclEntry[]。

POST /api/workspaces/:workspace/acl ​

创建 invite 或 ACL entry。

参数:

参数位置说明
workspacePathWorkspace fullname.

Payload:

字段必填说明
invite是Invite id/token.

响应:HTTP 204 No Content,响应体为空。

PUT /api/workspaces/:workspace/acl/:entryId ​

修改 member role。

参数:

参数位置说明
workspacePathWorkspace fullname.
entryIdPathACL entry id.

Payload:

字段必填说明
level是owner、admin、developer、user 之一。

响应:HTTP 204 No Content,响应体为空。

DELETE /api/workspaces/:workspace/acl/:entryId ​

删除 member/ACL entry。

参数:

参数位置说明
workspacePathWorkspace fullname.
entryIdPathACL entry id.

Payload: 无。

响应:OperationResult。