Files
cnb/docs/api-groups/organizations/api.json
2026-01-16 13:03:57 +08:00

1095 lines
32 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"swagger": "2.0",
"info": {
"title": "CNB OPENAPI",
"contact": {
"name": "Open API Support",
"url": "https://docs.cnb.cool/",
"email": "cnb@tencent.com"
},
"version": "1.0"
},
"paths": {
"/groups": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "创建新组织。Create new organization.",
"operationId": "CreateOrganization",
"parameters": [
{
"description": "group information",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateGroupReq"
}
}
],
"responses": {
"201": {
"description": "Created"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:rw"
}
},
"/user/groups": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "获取当前用户拥有权限的顶层组织列表。Get top-level organizations list that the current user has access to.",
"operationId": "ListTopGroups",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"default": "",
"description": "Filter by organizations.",
"name": "search",
"in": "query"
},
{
"enum": [
"Guest",
"Reporter",
"Developer",
"Master",
"Owner"
],
"type": "string",
"description": "Filter by role.",
"name": "role",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.OrganizationAccess"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/user/groups/{slug}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "查询当前用户在指定组织下拥有指定权限的子组织列表。Get the list of sub-organizations that the current user has access to in the specified organization.",
"operationId": "ListGroups",
"parameters": [
{
"type": "string",
"description": "Group slug",
"name": "slug",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
},
{
"type": "integer",
"description": "access level",
"name": "access",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.OrganizationAccess"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/users/{username}/groups": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "获取指定用户拥有权限的顶层组织列表。 Get a list of top-level organizations that the specified user has permissions to access.",
"operationId": "GetGroupsByUserID",
"parameters": [
{
"type": "string",
"description": "UserName",
"name": "username",
"in": "path",
"required": true
},
{
"type": "string",
"default": "",
"description": "Filter organizations.",
"name": "search",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.OrganizationUnion"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/{group}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "获取指定组织信息。Get information for the specified organization.",
"operationId": "GetGroup",
"parameters": [
{
"type": "string",
"description": "group path",
"name": "group",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "group",
"schema": {
"$ref": "#/definitions/dto.OrganizationAccess"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-resource:r"
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "更新组织信息, 可更新的内容为: 组织描述, 组织展示名称, 组织网站, 组织联系邮箱。Updates organization information including: description, display name, website URL and contact email.",
"operationId": "UpdateOrganization",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "group",
"in": "path",
"required": true
},
{
"description": "group information to update",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateGroupReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:rw"
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "删除指定组织。Delete the specified organization.",
"operationId": "DeleteOrganization",
"parameters": [
{
"type": "string",
"description": "group path",
"name": "group",
"in": "path",
"required": true
},
{
"type": "string",
"description": "微信身份验证票据首次请求不传会返回新票据。WeChat auth ticket, will return new ticket if not provided in first request.",
"name": "x-cnb-identity-ticket",
"in": "header"
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-delete:rw"
}
},
"/{group}/-/transfer": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "转移组织。Transfer an organization.",
"operationId": "TransferGroup",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "group",
"in": "path",
"required": true
},
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TransferSlugReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:rw"
}
},
"/{group}/-/upload/logos": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Organizations"
],
"summary": "发起一个上传 logo 的请求返回上传文件的url请使用 put 发起流式上传。Initiate a request to upload logo,returns upload URL.Use PUT to initiate a stream upload.",
"operationId": "UploadLogos",
"parameters": [
{
"type": "string",
"description": "group",
"name": "group",
"in": "path",
"required": true
},
{
"description": "UploadRequestParams",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UploadRequestParams"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.UploadAssetsResponse"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:rw"
}
},
"/{slug}/-/settings": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "获取指定组织的配置详情。Get the configuration details for the specified organization.",
"operationId": "GetGroupSetting",
"parameters": [
{
"type": "string",
"description": "group path",
"name": "slug",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.OrganizationSettingWithParent"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:r"
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "更新指定组织的配置。Updates the configuration for the specified organization.",
"operationId": "UpdateGroupSetting",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "slug",
"in": "path",
"required": true
},
{
"description": "group information to update",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupSettingReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:rw"
}
},
"/{slug}/-/sub-groups": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Organizations"
],
"summary": "获取指定组织下的子组织列表。Get the list of sub-organizations under the specified organization.",
"operationId": "ListSubgroups",
"parameters": [
{
"type": "string",
"description": "Slug",
"name": "slug",
"in": "path",
"required": true
},
{
"type": "string",
"default": "",
"description": "Filter organization",
"name": "search",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.OrganizationUnion"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-resource:r"
}
}
},
"definitions": {
"dto.CreateGroupReq": {
"type": "object",
"properties": {
"bind_domain": {
"description": "BindDomain 根组织绑定的域名",
"type": "string"
},
"description": {
"type": "string"
},
"path": {
"type": "string"
},
"remark": {
"type": "string"
}
}
},
"dto.OrganizationAccess": {
"type": "object",
"properties": {
"access_role": {
"description": "AccessRole 用户在当前资源的最大权限",
"allOf": [
{
"$ref": "#/definitions/constant.AccessRole"
}
]
},
"all_member_count": {
"type": "integer"
},
"all_sub_group_count": {
"description": "下面所有层级子组织",
"type": "integer"
},
"all_sub_mission_count": {
"description": "下面所有层级子任务",
"type": "integer"
},
"all_sub_registry_count": {
"type": "integer"
},
"all_sub_repo_count": {
"description": "下面所有层级子仓库",
"type": "integer"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"domain": {
"type": "string"
},
"email": {
"type": "string"
},
"follow_count": {
"type": "integer"
},
"freeze": {
"type": "boolean",
"readOnly": true
},
"has_sub_group": {
"type": "boolean"
},
"id": {
"type": "string"
},
"member_count": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"pinned": {
"type": "boolean"
},
"pinned_time": {
"type": "string"
},
"readme_repo_path": {
"type": "string",
"readOnly": true
},
"remark": {
"type": "string"
},
"site": {
"type": "string"
},
"sub_group_count": {
"description": "下一级子组织数量",
"type": "integer"
},
"sub_mission_count": {
"type": "integer"
},
"sub_registry_count": {
"type": "integer"
},
"sub_repo_count": {
"description": "下一级子仓库",
"type": "integer"
},
"updated_at": {
"type": "string"
},
"wechat_mp": {
"type": "string"
}
}
},
"dto.OrganizationUnion": {
"type": "object",
"properties": {
"all_member_count": {
"type": "integer"
},
"all_sub_group_count": {
"description": "下面所有层级子组织",
"type": "integer"
},
"all_sub_mission_count": {
"description": "下面所有层级子任务",
"type": "integer"
},
"all_sub_registry_count": {
"type": "integer"
},
"all_sub_repo_count": {
"description": "下面所有层级子仓库",
"type": "integer"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"domain": {
"type": "string"
},
"email": {
"type": "string"
},
"follow_count": {
"type": "integer"
},
"freeze": {
"type": "boolean",
"readOnly": true
},
"has_sub_group": {
"type": "boolean"
},
"id": {
"type": "string"
},
"member_count": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"pinned": {
"type": "boolean"
},
"pinned_time": {
"type": "string"
},
"readme_repo_path": {
"type": "string",
"readOnly": true
},
"remark": {
"type": "string"
},
"site": {
"type": "string"
},
"sub_group_count": {
"description": "下一级子组织数量",
"type": "integer"
},
"sub_mission_count": {
"type": "integer"
},
"sub_registry_count": {
"type": "integer"
},
"sub_repo_count": {
"description": "下一级子仓库",
"type": "integer"
},
"updated_at": {
"type": "string"
},
"wechat_mp": {
"type": "string"
}
}
},
"dto.UpdateGroupReq": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"domain": {
"type": "string"
},
"email": {
"type": "string"
},
"readme_repo_id": {
"type": "integer"
},
"readme_repo_path": {
"type": "string"
},
"remark": {
"type": "string"
},
"site": {
"type": "string"
},
"wechat_mp": {
"type": "string"
}
}
},
"dto.TransferSlugReq": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"target": {
"type": "string"
}
}
},
"dto.UploadRequestParams": {
"type": "object",
"properties": {
"ext": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"dto.UploadAssetsResponse": {
"type": "object",
"properties": {
"assets": {
"$ref": "#/definitions/dto.Assets"
},
"form": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"token": {
"description": "后续调用 confirm 接口用的",
"type": "string"
},
"upload_url": {
"type": "string"
}
}
},
"dto.OrganizationSettingWithParent": {
"type": "object",
"properties": {
"can_show_members": {
"description": "上级group设置了hide_members为1则下级都不能显示",
"type": "boolean"
},
"can_show_sub_groups": {
"description": "上级group设置了hide_sub_groups为1则下级都不能显示",
"type": "boolean"
},
"can_show_watermark": {
"type": "boolean"
},
"email_verification": {
"type": "array",
"items": {
"type": "string"
}
},
"group_protection": {
"type": "integer"
},
"hide_members": {
"description": "是否对外隐藏组织成员0 - 否, 1 - 是",
"type": "integer"
},
"hide_sub_groups": {
"description": "是否对外隐藏子组织0 - 否, 1 - 是",
"type": "integer"
},
"root_email_verification": {
"type": "array",
"items": {
"type": "string"
}
},
"root_group_protection": {
"type": "boolean"
},
"root_values": {
"$ref": "#/definitions/organization.SettingValue"
},
"show_private_repo_watermark": {
"type": "integer"
},
"values": {
"$ref": "#/definitions/organization.SettingValue"
}
}
},
"dto.GroupSettingReq": {
"type": "object",
"properties": {
"email_verification": {
"description": "组织限制指定邮箱认证才能加入",
"type": "array",
"items": {
"type": "string"
}
},
"group_protection": {
"description": "组织保护开关0 - 关闭1 - 打开",
"type": "integer"
},
"hide_members": {
"description": "是否对外隐藏组织成员0 - 否, 1 - 是",
"type": "integer"
},
"hide_sub_groups": {
"description": "是否对外隐藏子组织0 - 否, 1 - 是",
"type": "integer"
},
"show_private_repo_watermark": {
"description": "是否对外显示私有仓库水印0 - 否, 1 - 是",
"type": "integer"
},
"values": {
"description": "SettingValue 组织设置值,多个选项,用逗号拼接。可选值来自 SettingNamesArray 的值e.g. disable_organization_readme,cloud_native_dev_only",
"type": "string"
}
}
},
"dto.Assets": {
"type": "object",
"properties": {
"content_type": {
"type": "string"
},
"ext": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"name": {
"type": "string"
},
"path": {
"type": "string",
"example": "/{slug}/-/assets/xxx/xxx/xxxx-xxx.png"
},
"size": {
"type": "integer"
}
}
},
"organization.SettingValue": {
"description": "配置值,内容为枚举的组合,英文逗号分割",
"type": "string",
"enum": [
"disable_organization_readme",
"cloud_native_dev_only",
"user_root_group_branch_protection_only",
"forbid_redefine_branch_protection",
"enable_tapd_access",
"enable_show_private_mission_water_mark",
"prevent_organization_creation",
"prevent_repository_creation",
"prevent_mission_creation",
"prevent_registry_creation",
"disable_invitation",
"prevent_visibility_modification",
"prevent_resource_deletion",
"prevent_repository_archival",
"prevent_organization_transfer",
"prevent_repository_transfer",
"prevent_mission_transfer",
"prevent_registry_transfer",
"use_group_git_quota",
"use_group_git_object_limit",
"enable_add_member_only_root",
"use_root_group_git_push_limit",
"enable_add_member",
"enable_change_member_role_only_root"
],
"x-enum-comments": {
"CloudNativeDevOnly": "CloudNativeDevOnly 仅可使用云原生开发, 以组织设置为准",
"DisableInvitation": "DisableInvitation 禁止邀请成员",
"DisableOrganizationReadme": "DisableOrganizationReadme 是否关闭组织介绍页, 以组织设置为准",
"EnableShowPrivateMissionWaterMark": "EnableShowPrivateMissionWaterMark 打开后,私有任务集会显示水印",
"EnableTAPDAccess": "EnableTAPDAccess 打开后,允许 TAPD 访问组织下的资源, 以组织设置为准",
"ForbidRedefineBranchProtection": "ForbidRedefineBranchProtection 打开后,禁止仓库修改保护分支规则,以根组织设置为准",
"PreventMissionCreation": "PreventMissionCreation 禁止创建任务集",
"PreventMissionTransfer": "PreventMissionTransfer 禁止转移任务集",
"PreventOrganizationCreation": "PreventOrganizationCreation 禁止创建组织",
"PreventOrganizationTransfer": "PreventOrganizationTransfer 禁止转移组织",
"PreventRegistryCreation": "PreventRegistryCreation 禁止创建制品库",
"PreventRegistryTransfer": "PreventRegistryTransfer 禁止转移制品库",
"PreventRepositoryArchival": "PreventRepositoryArchival 禁止归档仓库",
"PreventRepositoryCreation": "PreventRepositoryCreation 禁止创建仓库",
"PreventRepositoryTransfer": "PreventRepositoryTransfer 禁止转移仓库",
"PreventResourceDeletion": "PreventResourceDeletion 禁止删除资源",
"PreventVisibilityModification": "PreventVisibilityModification 禁止修改资源可见性",
"UseGroupGitObjectLimit": "UseGroupGitObjectLimit 是否使用组织的仓库对象限制",
"UseGroupGitQuota": "UseGroupGitQuota 是否使用组织的仓库配额",
"UseRootGroupBranchProtectionOnly": "UseRootGroupBranchProtectionOnly 支持重写分支保护规则,打开时,如果保护分支规则有冲突的时候,可以覆盖根组织的规则",
"UseRootGroupGitPushLimit": "UseRootGroupGitPushLimit 开启根组织推送限制选项",
"enableAddMember": "enableAddMember 开启后, 允许子组织管理员和负责人添加成员到其负责的组织/仓库/制品库/任务集",
"enableAddMemberOnlyRoot": "enableAddMemberOnlyRoot 开启后, 仅根组织管理员和负责人可添加成员加入根组织下所有子组织和仓库",
"enableChangeMemberRoleOnlyRoot": "enableChangeMemberRoleOnlyRoot 开启后, 仅根组织管理员和负责人可修改成员角色"
},
"x-enum-descriptions": [
"DisableOrganizationReadme 是否关闭组织介绍页, 以组织设置为准",
"CloudNativeDevOnly 仅可使用云原生开发, 以组织设置为准",
"UseRootGroupBranchProtectionOnly 支持重写分支保护规则,打开时,如果保护分支规则有冲突的时候,可以覆盖根组织的规则",
"ForbidRedefineBranchProtection 打开后,禁止仓库修改保护分支规则,以根组织设置为准",
"EnableTAPDAccess 打开后,允许 TAPD 访问组织下的资源, 以组织设置为准",
"EnableShowPrivateMissionWaterMark 打开后,私有任务集会显示水印",
"PreventOrganizationCreation 禁止创建组织",
"PreventRepositoryCreation 禁止创建仓库",
"PreventMissionCreation 禁止创建任务集",
"PreventRegistryCreation 禁止创建制品库",
"DisableInvitation 禁止邀请成员",
"PreventVisibilityModification 禁止修改资源可见性",
"PreventResourceDeletion 禁止删除资源",
"PreventRepositoryArchival 禁止归档仓库",
"PreventOrganizationTransfer 禁止转移组织",
"PreventRepositoryTransfer 禁止转移仓库",
"PreventMissionTransfer 禁止转移任务集",
"PreventRegistryTransfer 禁止转移制品库",
"UseGroupGitQuota 是否使用组织的仓库配额",
"UseGroupGitObjectLimit 是否使用组织的仓库对象限制",
"enableAddMemberOnlyRoot 开启后, 仅根组织管理员和负责人可添加成员加入根组织下所有子组织和仓库",
"UseRootGroupGitPushLimit 开启根组织推送限制选项",
"enableAddMember 开启后, 允许子组织管理员和负责人添加成员到其负责的组织/仓库/制品库/任务集",
"enableChangeMemberRoleOnlyRoot 开启后, 仅根组织管理员和负责人可修改成员角色"
],
"x-enum-varnames": [
"DisableOrganizationReadme",
"CloudNativeDevOnly",
"UseRootGroupBranchProtectionOnly",
"ForbidRedefineBranchProtection",
"EnableTAPDAccess",
"EnableShowPrivateMissionWaterMark",
"PreventOrganizationCreation",
"PreventRepositoryCreation",
"PreventMissionCreation",
"PreventRegistryCreation",
"DisableInvitation",
"PreventVisibilityModification",
"PreventResourceDeletion",
"PreventRepositoryArchival",
"PreventOrganizationTransfer",
"PreventRepositoryTransfer",
"PreventMissionTransfer",
"PreventRegistryTransfer",
"UseGroupGitQuota",
"UseGroupGitObjectLimit",
"enableAddMemberOnlyRoot",
"UseRootGroupGitPushLimit",
"enableAddMember",
"enableChangeMemberRoleOnlyRoot"
]
}
}
}