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

1303 lines
33 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": {
"/user/repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "获取当前用户拥有指定权限及其以上权限的仓库。List repositories owned by the current user with the specified permissions or higher.",
"operationId": "GetRepos",
"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 repositories",
"name": "search",
"in": "query"
},
{
"enum": [
"private",
"public",
"secret"
],
"type": "string",
"description": "RType",
"name": "filter_type",
"in": "query"
},
{
"enum": [
"Reporter",
"Developer",
"Master",
"Owner"
],
"type": "string",
"default": "Owner",
"description": "最小仓库权限默认owner。Minima repository permissions",
"name": "role",
"in": "query"
},
{
"enum": [
"KnowledgeBase"
],
"type": "string",
"description": "仓库类型标记逗号分隔。Repository type flags, comma separated",
"name": "flags",
"in": "query"
},
{
"enum": [
"active",
"archived"
],
"type": "string",
"description": "仓库状态。Repository status",
"name": "status",
"in": "query"
},
{
"enum": [
"created_at",
"last_updated_at",
"stars",
"slug_path",
"forks"
],
"type": "string",
"default": "last_updated_at",
"description": "Order field",
"name": "order_by",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "排序顺序。Ordering.",
"name": "desc",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4User"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/users/{username}/pinned-repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "获取指定用户的用户仓库墙。 Get a list of repositories that the specified user has pinned.",
"operationId": "GetPinnedRepoByID",
"parameters": [
{
"type": "string",
"description": "User Name",
"name": "username",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4User"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/users/{username}/repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "获取指定用户有指定以上权限并且客人态可见的仓库。List repositories where the specified user has the specified permission level or higher and are visible to guests.",
"operationId": "GetReposByUserName",
"parameters": [
{
"type": "string",
"description": "UserName",
"name": "username",
"in": "path",
"required": true
},
{
"type": "string",
"default": "",
"description": "Filter by repositories",
"name": "search",
"in": "query"
},
{
"enum": [
"private",
"public",
"secret"
],
"type": "string",
"description": "Repositories type",
"name": "filter_type",
"in": "query"
},
{
"enum": [
"KnowledgeBase"
],
"type": "string",
"description": "仓库类型标记逗号分隔。Repository type flags, comma separated",
"name": "flags",
"in": "query"
},
{
"enum": [
"active",
"archived"
],
"type": "string",
"description": "仓库状态。Repository status",
"name": "status",
"in": "query"
},
{
"enum": [
"Reporter",
"Developer",
"Master",
"Owner"
],
"type": "string",
"default": "Owner",
"description": "最小仓库权限默认owner。Minima repository permissions.",
"name": "role",
"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"
},
{
"type": "boolean",
"default": false,
"description": "排序顺序。Ordering.",
"name": "desc",
"in": "query"
},
{
"enum": [
"created_at",
"last_updated_at",
"stars",
"slug_path",
"forks"
],
"type": "string",
"default": "last_updated_at",
"description": "Order field",
"name": "order_by",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4User"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/{repo}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "获取指定仓库信息。Get information for the specified repository.",
"operationId": "GetByID",
"parameters": [
{
"type": "string",
"description": "repo path",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "repo",
"schema": {
"$ref": "#/definitions/dto.Repos4User"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-basic-info:r"
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "删除指定仓库。Delete the specified repository.",
"operationId": "DeleteRepo",
"parameters": [
{
"type": "string",
"description": "repo path",
"name": "repo",
"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. \nrepo-delete:rw"
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "更新仓库信息, 可更新的内容为: 仓库简介, 仓库站点, 仓库主题, 开源许可证。updates repository details including description, website URL,topics and license type.",
"operationId": "UpdateRepo",
"parameters": [
{
"type": "string",
"description": "repo path",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "request body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RepoPatch"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-manage:rw"
}
},
"/{repo}/-/forks": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "获取指定仓库的 fork 列表。Get fork list for specified repository.",
"operationId": "ListForksRepos",
"parameters": [
{
"type": "string",
"description": "仓库路径。Repository path.",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "boolean",
"default": false,
"description": "是否从fork根节点开始展示。Whether to start from the root node of the fork.",
"name": "start_from_root",
"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.ListForks"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-base-info:r"
}
},
"/{repo}/-/settings/set_visibility": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "改变仓库可见性。Update visibility of repository.",
"operationId": "SetRepoVisibility",
"parameters": [
{
"type": "string",
"description": "repo path",
"name": "repo",
"in": "path",
"required": true
},
{
"enum": [
"Private",
"Public",
"Secret"
],
"type": "string",
"description": "仓库可见性",
"name": "visibility",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-manage:rw"
}
},
"/{repo}/-/transfer": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "转移仓库。Transfer a repository.",
"operationId": "TransferRepo",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "repo",
"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. \nrepo-manage:rw,repo-code:rw"
}
},
"/{slug}/-/pinned-repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "获取指定组织的仓库墙列表。List the pinned repositories of a group.",
"operationId": "GetPinnedRepoByGroup",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "slug",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4UserBase"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:r"
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "更新指定组织仓库墙。Update the pinned repositories of a group.",
"operationId": "SetPinnedRepoByGroup",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "slug",
"in": "path",
"required": true
},
{
"description": "repo path",
"name": "request",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4UserBase"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-manage:rw"
}
},
"/{slug}/-/repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "查询组织下访问用户有权限查看到仓库。List the repositories that the user has access to.",
"operationId": "GetGroupSubRepos",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "slug",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
},
{
"enum": [
"private",
"public",
"secret"
],
"type": "string",
"description": "Repositories type",
"name": "filter_type",
"in": "query"
},
{
"enum": [
"KnowledgeBase"
],
"type": "string",
"description": "仓库类型标记逗号分隔。Repository type flags, comma separated",
"name": "flags",
"in": "query"
},
{
"enum": [
"active",
"archived"
],
"type": "string",
"description": "仓库状态。Repository status",
"name": "status",
"in": "query"
},
{
"enum": [
"created_at",
"last_updated_at",
"stars",
"slug_path",
"forks"
],
"type": "string",
"default": "last_updated_at",
"description": "Order field",
"name": "order_by",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Ordering",
"name": "desc",
"in": "query"
},
{
"enum": [
"all",
"sub",
"grand"
],
"type": "string",
"description": "查全部/查询直接属于当前组织的仓库/查询子组织的仓库。Get all/Get repos belong to current org or sub-organization",
"name": "descendant",
"in": "query"
},
{
"type": "string",
"description": "Key word",
"name": "search",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4User"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-resource:r"
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "创建仓库。Create repositories.",
"operationId": "CreateRepo",
"parameters": [
{
"type": "string",
"description": "Group slug",
"name": "slug",
"in": "path",
"required": true
},
{
"description": "repo information",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateRepoReq"
}
}
],
"responses": {
"201": {
"description": "Created"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \ngroup-resource:rw"
}
},
"/{slug}/-/settings/archive": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "仓库归档。Archive a repository.",
"operationId": "ArchiveRepo",
"parameters": [
{
"type": "string",
"description": "repo path",
"name": "slug",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-manage:rw,repo-code:rw"
}
},
"/{slug}/-/settings/unarchive": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Repositories"
],
"summary": "解除仓库归档。Unarchive a repository.",
"operationId": "UnArchiveRepo",
"parameters": [
{
"type": "string",
"description": "repo path",
"name": "slug",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-manage:rw,repo-code:rw"
}
}
},
"definitions": {
"dto.Repos4User": {
"type": "object",
"properties": {
"access": {
"allOf": [
{
"$ref": "#/definitions/constant.AccessRole"
}
],
"readOnly": true
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"display_module": {
"$ref": "#/definitions/constant.RepoDisplayModule"
},
"flags": {
"$ref": "#/definitions/flags.Repo"
},
"fork_count": {
"type": "integer"
},
"forked_from_repo": {
"description": "预留",
"allOf": [
{
"$ref": "#/definitions/dto.Slugs"
}
]
},
"freeze": {
"type": "boolean",
"readOnly": true
},
"id": {
"type": "string"
},
"language": {
"description": "仓库程序语言,预留",
"type": "string"
},
"languages": {
"description": "仓库语言",
"allOf": [
{
"$ref": "#/definitions/dto.RepoLanguage"
}
]
},
"last_update_nickname": {
"description": "最新代码更新人姓名",
"type": "string"
},
"last_update_username": {
"description": "最新代码更新人账户名",
"type": "string"
},
"last_updated_at": {
"description": "最新代码更新时间",
"allOf": [
{
"$ref": "#/definitions/convert.NullTime"
}
]
},
"license": {
"type": "string"
},
"mark_count": {
"type": "integer"
},
"name": {
"type": "string"
},
"open_issue_count": {
"description": "开启的issue数",
"type": "integer"
},
"open_pull_request_count": {
"description": "开启的pull request数",
"type": "integer"
},
"path": {
"description": "完整仓库路径",
"type": "string"
},
"pinned": {
"type": "boolean"
},
"pinned_time": {
"type": "string"
},
"second_languages": {
"description": "第二语言",
"allOf": [
{
"$ref": "#/definitions/dto.RepoLanguage"
}
]
},
"site": {
"type": "string"
},
"star_count": {
"type": "integer"
},
"star_time": {
"type": "string"
},
"stared": {
"type": "boolean"
},
"status": {
"allOf": [
{
"$ref": "#/definitions/constant.RepoStatus"
}
],
"readOnly": true
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
}
},
"topics": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"visibility_level": {
"$ref": "#/definitions/constant.Visibility"
},
"web_url": {
"type": "string"
}
}
},
"dto.RepoPatch": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"license": {
"type": "string"
},
"site": {
"type": "string"
},
"topics": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"dto.ListForks": {
"type": "object",
"properties": {
"fork_tree_count": {
"type": "integer"
},
"forks": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Forks"
}
}
}
},
"dto.TransferSlugReq": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"target": {
"type": "string"
}
}
},
"dto.Repos4UserBase": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"display_module": {
"$ref": "#/definitions/constant.RepoDisplayModule"
},
"flags": {
"$ref": "#/definitions/flags.Repo"
},
"fork_count": {
"type": "integer"
},
"forked_from_repo": {
"description": "预留",
"allOf": [
{
"$ref": "#/definitions/dto.Slugs"
}
]
},
"freeze": {
"type": "boolean",
"readOnly": true
},
"id": {
"type": "string"
},
"language": {
"description": "仓库程序语言,预留",
"type": "string"
},
"languages": {
"description": "仓库语言",
"allOf": [
{
"$ref": "#/definitions/dto.RepoLanguage"
}
]
},
"last_update_nickname": {
"description": "最新代码更新人姓名",
"type": "string"
},
"last_update_username": {
"description": "最新代码更新人账户名",
"type": "string"
},
"last_updated_at": {
"description": "最新代码更新时间",
"allOf": [
{
"$ref": "#/definitions/convert.NullTime"
}
]
},
"license": {
"type": "string"
},
"mark_count": {
"type": "integer"
},
"name": {
"type": "string"
},
"open_issue_count": {
"description": "开启的issue数",
"type": "integer"
},
"open_pull_request_count": {
"description": "开启的pull request数",
"type": "integer"
},
"path": {
"description": "完整仓库路径",
"type": "string"
},
"second_languages": {
"description": "第二语言",
"allOf": [
{
"$ref": "#/definitions/dto.RepoLanguage"
}
]
},
"site": {
"type": "string"
},
"star_count": {
"type": "integer"
},
"status": {
"allOf": [
{
"$ref": "#/definitions/constant.RepoStatus"
}
],
"readOnly": true
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
}
},
"topics": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"visibility_level": {
"$ref": "#/definitions/constant.Visibility"
},
"web_url": {
"type": "string"
}
}
},
"dto.CreateRepoReq": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"license": {
"type": "string"
},
"name": {
"type": "string"
},
"visibility": {
"type": "string",
"default": "public",
"enum": [
"public",
"private",
"secret"
]
}
}
},
"constant.RepoDisplayModule": {
"type": "object",
"properties": {
"activity": {
"description": "仓库动态",
"type": "boolean"
},
"contributors": {
"description": "仓库贡献者",
"type": "boolean"
},
"release": {
"description": "仓库版本",
"type": "boolean"
}
}
},
"flags.Repo": {
"description": "仓库特性标记,内容为枚举的组合,英文逗号分割",
"type": "string",
"enum": [
"Unknown",
"KnowledgeBase"
],
"x-enum-comments": {
"KnowledgeBase": "KnowledgeBase 知识库",
"Unknown": "Unknown 未知"
},
"x-enum-descriptions": [
"Unknown 未知",
"KnowledgeBase 知识库"
],
"x-enum-varnames": [
"Unknown",
"KnowledgeBase"
]
},
"constant.Visibility": {
"type": "string",
"enum": [
"Private",
"Public",
"Secret"
],
"x-enum-comments": {
"VisibilityPrivate": "VisibilityPrivate 私有仓库 - 仓库的访问必须显式授予每个用户",
"VisibilityPublic": "VisibilityPublic 公共仓库 - 可以不经任何身份验证克隆该项目",
"VisibilitySecret": "VisibilitySecret 加密仓库 - 仓库特定角色身份才能读取解密"
},
"x-enum-descriptions": [
"VisibilityPrivate 私有仓库 - 仓库的访问必须显式授予每个用户",
"VisibilityPublic 公共仓库 - 可以不经任何身份验证克隆该项目",
"VisibilitySecret 加密仓库 - 仓库特定角色身份才能读取解密"
],
"x-enum-varnames": [
"VisibilityPrivate",
"VisibilityPublic",
"VisibilitySecret"
]
}
}
}