适用版本 | 中心版、Region版 |
服务接入点与授权信息
产品 | 资源 | 所需权限 |
代码管理 | 代码仓库 | 读写 |
请求语法
中心版
PUT https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}Region版
PUT https://{domain}/oapi/v1/codeup/repositories/{repositoryId}请求头
参数 | 类型 | 是否必填 | 描述 | 示例值 |
x-yunxiao-token | string | 是 | 个人访问令牌。 | pt-0fh3****0fbG_35af****0484 |
请求参数
参数 | 类型 | 位置 | 是否必填 | 描述 | 示例值 |
organizationId | string | path |
| 组织 ID。 | 60d54f3daccf2bbd6659f3ad |
repositoryId | string | path | 是 | 代码库 ID 或者 URL-Encoder 编码的全路径。 | 2813489或者60de7a6852743a5162b5f957%2FDemoRepo |
| - | object | body | 否 | ||
default_branch | string | body | 否 | 默认分支。 | master |
description | string | body | 否 | 代码库描述,最长65535个字符。 | 描述内容 |
name | string | body | 否 | 代码库名称。 | demo-repo |
repositoryTags | array[string] | body | 否 | 代码库标签名称列表。 | ["标签1", "标签2"] |
visibility | string | body | 否 | 可见性:private(私有)、internal(组织内公开),可能的值:[private internal]。 | private |
请求示例
中心版
curl -X 'PUT' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489或者60de7a6852743a5162b5f957%2FDemoRepo' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"default_branch": "master",
"description": "描述内容",
"name": "demo-repo",
"repositoryTags": ["标签1", "标签2"],
"visibility": "private"
}'Region版
curl -X 'PUT' \
'https://{domain}/oapi/v1/codeup/repositories/2813489或者60de7a6852743a5162b5f957%2FDemoRepo' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"default_branch": "master",
"description": "描述内容",
"name": "demo-repo",
"repositoryTags": ["标签1", "标签2"],
"visibility": "private"
}'返回参数
参数 | 类型 | 描述 | 示例值 |
| - | object | PUT 更新代码库接口响应;字段与 GET 详情基本一致,但顶层 accessLevel 为权限数值(与 GET 的枚举字符串区分)。 | |
accessLevel | integer | 当前用户在该代码库上的权限等级,可能的值:[20 30 40]。 | 40 |
adminSettingLanguage | string | 仓库主要编程语言。 | Java |
allowPush | boolean | 是否允许推送。 | true |
archived | boolean | 是否归档。 | false |
avatarUrl | string | 代码库头像地址。 | https://example/example/w/100/h/100 |
cloneDownloadControlGray | boolean | 克隆/下载控制组织维度灰度开关。 | false |
createdAt | string | 创建时间。 | 2024-10-05T15:30:45Z |
creatorId | integer | 创建者 user id。 | 无业务实际意义 |
creatorUid | string | 代码库创建者(云效用户 ID)。 | 5f8b3b3b3b3b3b3b3b3b3b3b |
defaultBranch | string | 代码库默认分支。 | master |
demoProject | boolean | 是否是 demo 库。 | false |
description | string | 代码库描述。 | 代码库的描述内容 |
enableCloneDownloadControl | boolean | 是否开启代码克隆下载管控。 | false |
forkCount | integer | fork 数量。 | 1 |
httpUrlToRepo | string | HTTP 地址。 | https://example.com/example_org/example.git |
id | integer | 代码库 ID。 | 1 |
lastActivityAt | string | 最后活跃时间。 | 2024-10-05T15:30:45Z |
name | string | 代码库名称。 | demo-repo |
nameWithNamespace | string | 代码库完整名称(含完整组名称)。 | 60de7a6852743a5162b5f957 / DemoRepo |
| namespace | object | ||
avatar | string | 头像地址。 | https://example/example/w/100/h/100 |
createdAt | string | 创建时间。 | 2024-10-05T15:30:45Z |
description | string | 描述。 | 描述内容 |
id | integer | ID。 | 1 |
name | string | 名称。 | demo-namespace |
ownerId | integer | 归属者 ID。 | 无业务实际意义 |
path | string | 路径。 | demo-namespace |
updatedAt | string | 更新时间。 | 2024-10-05T15:30:45Z |
visibility | string | 可见性:private(私有)、internal(组织内公开),可能的值:[private internal]。 | private |
openCloneDownloadControl | boolean | 是否开启克隆下载控制。 | false |
| owner | object | ||
avatarUrl | string | 用户头像地址。 | https://example/example/w/100/h/100 |
string | 用户邮箱。 | username@example.com | |
id | integer | 无业务意义主键 ID。 | 1 |
name | string | 用户名称。 | codeup-name |
state | string | 用户状态,可为{active, blocked}。 | active |
userId | string | 云效用户 ID。 | 62c795xxxb468af8 |
username | string | 用户登录名。 | codeup-username |
webUrl | string | 页面访问地址。 | xxx |
path | string | 代码库路径。 | demo-repo |
pathWithNamespace | string | 代码库完整路径(含完整组路径)。 | 60de7a6852743a5162b5f957/DemoRepo |
| permissions | object | 权限简介。 | |
| groupAccess | object | ||
accessLevel | integer | 组权限,可选{20-浏览者,30-开发者,40-管理员}。 | 30 |
notificationLevel | integer | 保留信息。 | xxx |
| projectAccess | object | ||
accessLevel | integer | 库权限,可选{20-浏览者,30-开发者,40-管理员}。 | 30 |
notificationLevel | integer | 保留信息。 | xxx |
projectType | integer | 代码库类型,默认为空或者0。 | 0 |
| repositoryTags | array | 代码库标签列表。 | |
| - | object | 代码库标签。 | |
tagColor | string | 标签颜色。 | #C4C6CF |
tagName | string | 标签名称。 | 标签1 |
sshUrlToRepo | string | 仓库 ssh 克隆地址。 | git@example:example_org/example.git |
starCount | integer | 收藏数量。 | 1 |
updatedAt | string | 更新时间。 | 2024-10-05T15:30:45Z |
visibility | string | 可见性:private(私有)、internal(组织内公开),可能的值:[private internal]。 | private |
webUrl | string | 页面访问时的 URL。 | https://example.com/example/example_demo |
返回示例
{
"accessLevel": 40,
"adminSettingLanguage": "Java",
"allowPush": true,
"archived": false,
"avatarUrl": "https://example/example/w/100/h/100",
"cloneDownloadControlGray": false,
"createdAt": "2024-10-05T15:30:45Z",
"creatorId": 无业务实际意义,
"creatorUid": "5f8b3b3b3b3b3b3b3b3b3b3b",
"defaultBranch": "master",
"demoProject": false,
"description": "代码库的描述内容",
"enableCloneDownloadControl": false,
"forkCount": 1,
"httpUrlToRepo": "https://example.com/example_org/example.git",
"id": 1,
"lastActivityAt": "2024-10-05T15:30:45Z",
"name": "demo-repo",
"nameWithNamespace": "60de7a6852743a5162b5f957 / DemoRepo",
"namespace": {
"avatar": "https://example/example/w/100/h/100",
"createdAt": "2024-10-05T15:30:45Z",
"description": "描述内容",
"id": 1,
"name": "demo-namespace",
"ownerId": 无业务实际意义,
"path": "demo-namespace",
"updatedAt": "2024-10-05T15:30:45Z",
"visibility": "private"
},
"openCloneDownloadControl": false,
"owner": {
"avatarUrl": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username",
"webUrl": "xxx"
},
"path": "demo-repo",
"pathWithNamespace": "60de7a6852743a5162b5f957/DemoRepo",
"permissions": {
"groupAccess": {
"accessLevel": 30,
"notificationLevel": xxx
},
"projectAccess": {
"accessLevel": 30,
"notificationLevel": xxx
}
},
"projectType": 0,
"repositoryTags": [
{
"tagColor": "#C4C6CF",
"tagName": "标签1"
}
],
"sshUrlToRepo": "git@example:example_org/example.git",
"starCount": 1,
"updatedAt": "2024-10-05T15:30:45Z",
"visibility": "private",
"webUrl": "https://example.com/example/example_demo"
}错误码
访问错误码中心查看 API 相关错误码。