# 项目成员
如果使用 project_full_path,确保 project_full_path 编码过,例子:/api/v3/projects/tencent/code--> /api/v3/projects/tencent%2Fcode (/ 编码 %2F)
# 权限说明
组/项目的权限access_level包括:
GUEST = 10
FOLLOWER = 15
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
# 获取项目成员列表
在项目中获取所有的成员列表。
GET /api/v3/projects/:id/members
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| page | integer | 页数 (默认值:1) |
| per_page | integer | 每页列出成员数 (默认值 20) |
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| query | string (可选) | 搜索成员的字符串 |
返回值:
[ {
"id": 11323,
"username": "git-user1",
"web_url": "https://git.tencent.com/u/git-user1",
"name": "git-user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/111323/a75ba2727c7a409cab1d15dd993149aa.jpg",
"access_level": 30,
"expires_at":null
} ]
# 获取项目有权限的成员列表
在项目中获取所有有权限的成员列表。
GET /api/v3/projects/:id/members/all
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| page | integer | 页数 (默认值:1) |
| per_page | integer | 每页列出成员数 (默认值 20) |
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| query | string (可选) | 搜索成员的字符串 |
返回值:
[ {
"id": 11323,
"username": "git-user1",
"web_url": "https://git.tencent.com/u/git-user1",
"name": "git-user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/111323/a75ba2727c7a409cab1d15dd993149aa.jpg",
"access_level": 30,
"expires_at": null
} ]
# 增加项目成员
增加一个项目成员。这个方法是幂等的,即多次增加同一个成员结果是一致的。
限制规则:
拥有
master权限的用户允许新增access_level为:10,15,20,30,40的成员。拥有
owner权限的用户允许新增access_level为:10,15,20,30,40,50的成员。不允许为
owner权限的成员设置过期时间。
POST /api/v3/projects/:id/members
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_id | integer | 增加的用户的 ID |
| access_level | integer | 项目访问级别 |
| expires_at | yyyy-MM-ddZ(可选) | 用户权限到期时间,例如 2019-03-25+0000 或 2019-03-25+0800 如在 Path 中使用需要转义:2019-03-25%2B0800 |
| reason | string(可选) | 操作理由备注,xxxx |
返回值:
{
"id": 5520,
"username": "git-zhou",
"web_url": "https://git.tencent.com/u/git-zhou",
"name": "git-zhou",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/5520/a75ba2727c7a409cab1d15dd993149aa.jpg",
"access_level": 30,
"expires_at":"2019-09-25T16:00:00+0000"
}
# 修改项目成员
更新一个指定项目成员的 访问级别。
限制规则:
拥有
master权限的用户允许修改access_level为:10,15,20,30,40的成员,且不允许修改 access_level 为50。拥有
owner权限的用户允许修改access_level为:10,15,20,30,40,50的成员。不允许为
owner权限的成员设置过期时间。
PUT /api/v3/projects/:id/members/:user_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_id | integer | 用户的 ID |
| access_level | integer | 项目访问级别 |
| expires_at | yyyy-MM-ddZ(可选) | 用户权限到期时间,例如 2019-03-25+0000 或 2019-03-25+0800 如在 Path 中使用需要转义:2019-03-25%2B0800 |
| reason | string(可选) | 操作理由备注,xxxx |
返回值:
{
"id": 5520,
"username": "git-zhou",
"web_url": "https://git.tencent.com/u/git-zhou",
"name": "git-zhou",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/5520/a75ba2727c7a409cab1d15dd993149aa.jpg",
"access_level": 30,
"expires_at": null
}
# 删除项目成员
在项目内删除一个指定的成员。
限制规则:
拥有
master权限的用户允许删除access_level为:10,15,20,30,40的成员。拥有
owner权限的用户允许删除access_level为:10,15,20,30,40,50的成员。无法删除个人项目中的最后一名 owner。
DELETE /api/v3/projects/:id/members/:user_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
| user_id | integer | 用户的 ID |
返回值:
200 或相关状态码
# 获取项目内的某个指定成员信息
在项目内获取某个指定的成员。
GET /api/v3/projects/:id/members/:user_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_id | integer | 成员的 ID |
返回值:
{
"id": 5520,
"username": "git-zhou",
"web_url": "https://git.tencent.com/u/git-zhou",
"name": "git-zhou",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/5520/a75ba2727c7a409cab1d15dd993149aa.jpg",
"access_level": 40,
"expires_at": null
}
# 获取项目内的某个有权限的成员信息
在项目内获取某个有权限的成员信息。
GET /api/v3/projects/:id/members/all/:user_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_id | integer | 成员的 ID |
返回值:
{
"id": 5520,
"username": "git-zhou",
"web_url": "https://git.tencent.com/u/git-zhou",
"name": "git-zhou",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/5520/a75ba2727c7a409cab1d15dd993149aa.jpg",
"access_level": 40,
"expires_at": null
}
# 批量操作项目成员
# 批量新增项目成员
POST api/v3/projects/:id/members/multi
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_ids | List<Integer> | 成员的 ID |
| usernames | List<String> | 用户名称 |
| access_level | integer | 项目访问级别 |
| expires_at | yyyy-MM-ddZ(可选) | 用户权限到期时间,例如 2019-03-25+0000 或 2019-03-25+0800 如在 Path 中使用需要转义:2019-03-25%2B0800 |
| reason | string(可选) | 操作理由备注,xxxx |
说明:user_ids 与 usernames 这两个参数必须有一个不为空
返回值:
200或相关状态码
# 批量修改项目成员
PUT /api/v3/projects/:id/members/multi
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_ids | List<Integer> | 成员的 ID |
| usernames | List<String> | 用户名称 |
| access_level | integer | 项目访问级别 |
| expires_at | yyyy-MM-ddZ(可选) | 用户权限到期时间,例如 2019-03-25+0000 或 2019-03-25+0800 如在 Path 中使用需要转义:2019-03-25%2B0800 |
| reason | string(可选) | 操作理由备注,xxxx |
说明:user_ids 与 usernames 这两个参数必须有一个不为空
返回值:
200或相关状态码
# 批量删除项目成员
DELETE /api/v3/projects/:id/members/multi
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_ids | List<Integer> | 成员的 ID |
| usernames | List<String> | 用户名称 |
说明:user_ids 与 usernames 这两个参数必须有一个不为空
返回值:
200或相关状态码
# 项目
1、内部版本
私有项目,visibility_level = 0,项目的访问必须显式授予每个用户
公共项目,visibility_level = 10,任何登录用户都可以克隆该项目
2、非内部版本
私有项目,visibility_level = 0,项目的访问必须显式授予每个用户
内部项目,visibility_level = 10,任何登录用户都可以克隆该项目
3、如果使用 project_full_path,确保 project_full_path 编码过,例子:/api/v3/projects/tencent/code--> /api/v3/projects/tencent%2Fcode (/ 编码 %2F)
# 项目可见度级别
工蜂 Git 系统的项目级别有私有、内部、公共三种。
你能够通过定义项目visibility_level属性来决定项目级别。
# 腾讯版本关于可见度的值
私有。
visibility_level是0。 项目只能够被显示授权的用户访问。内部。
visibility_level是10. 项目能够被所有的登录用户克隆。在腾讯内部就是“内源项目”。
# 非腾讯版本关于可见度的值
- 私有。
visibility_level是0. 项目只能够被显示授权的用户访问。
# 开源可见性
public_visibility为开源可见性,包括
- 110 : 全部可见
- 90 : 不支持 clone 与下载
# 创建项目
创建一个自己的项目
POST /api/v3/projects
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| name | string | 项目名 |
| path | string(可选) | 项目版本库路径,默认:path = name |
| fork_enabled | boolean(可选) | 项目是否可以被 fork, 默认:false |
| namespace_id | integer(可选) | 项目所属命名空间,默认用户的命名空间 |
| description | string(可选) | 项目描述 |
| create_from_id | integer or string(可选) | 项目 ID 或 项目全路径 project_full_path |
注意:namespace_id != null 时需要用户拥有在指定命名空间中创建项目的权限
返回值:
{
"id": 32833,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-29T07:49:48+0000",
"description": "git_user1",
"id": 15302,
"name": "git_user1",
"owner_id": 13525,
"path": "git_user1",
"updated_at": "2017-01-29T07:49:48+0000"
},
"owner": {
"id": 13525,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/13525/fec6c477729445df9a6e0a4a05b4a86c.png"
},
"name": "testapi",
"name_with_namespace": "git_user1/testapi",
"path": "testapi",
"path_with_namespace": "git_user1/testapi",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/testapi.git",
"http_url_to_repo": "http://git.tencent.com/git/git_user1/testapi.git",
"https_url_to_repo": "https://git.tencent.com/git/git_user1/testapi.git",
"web_url": "https://git.tencent.com/git_user1/testapi",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:25:53+0000",
"last_activity_at": "201-08-13T07:25:53+0000",
"creator_id": 13525,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/32833",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false
}
# 编辑项目
修改项目设置
PUT /api/v3/projects/:id
修改成功,返回修改后的项目信息;参数错误,返回 400
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| name | string(可选) | 项目名 |
| fork_enabled | boolean(可选) | 项目是否可以被 fork, 默认:false |
| description | string(可选) | 项目描述 |
| default_branch | string(可选) | 项目默认分支 |
| limit_file_size | float(可选) | 文件大小限制,单位:MB |
| limit_lfs_file_size | float(可选) | LFS 文件大小限制,单位:MB |
| issues_enabled | boolean(可选) | 议题配置 |
| merge_requests_enabled | boolean(可选) | 合并请求配置 |
| wiki_enabled | boolean(可选) | 维基配置 |
| review_enabled | boolean(可选) | 评审配置 |
| tag_name_regex | string(可选) | 推送或创建 tag 规则 |
| tag_create_push_level | integer(可选) | 推送或创建 tag 权限 |
| template_repository | boolean(可选) | 项目是否设置为模板仓库,默认:false |
注意:
tag_create_push_level = 0 任何不能推送或创建 tag
tag_create_push_level = 30 DEVELOPER 以上角色才能推送或创建 tag
tag_create_push_level = 40 MASTER 以上角色才能推送或创建 tag
返回值:
{
"id": 32833,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-29T07:49:48+0000",
"description": "git_user1",
"id": 15302,
"name": "git_user1",
"owner_id": 13525,
"path": "git_user1",
"updated_at": "2017-01-29T07:49:48+0000"
},
"owner": {
"id": 13525,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/13525/fec6c477729445df9a6e0a4a05b4a86c.png"
},
"name": "testapp",
"name_with_namespace": "git_user1/testapp",
"path": "testapi",
"path_with_namespace": "git_user1/testapi",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/testapi.git",
"http_url_to_repo": "http://git.tencent.com/git/git_user1/testapi.git",
"https_url_to_repo": "https://git.tencent.com/git/git_user1/testapi.git",
"web_url": "https://git.tencent.com/git_user1/testapi",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"allow_revert": true,
"allow_cherry_pick": true,
"tag_name_regex": null,
"tag_create_push_level": 30,
"branch_name_regex": null,
"auto_intelligent_review_enabled": false,
"auto_intelligent_review_description_enabled": false,
"created_at": "2017-08-13T07:25:53+0000",
"last_activity_at": "201-08-13T07:25:53+0000",
"creator_id": 13525,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/32833",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"allow_skip_reviewer": false,
"allow_skip_owner": false,
"allow_skip_mr_check": false
}
# 获取项目列表
返回用户的授权项目列表 (用户为项目组或者项目成员),支持搜索、分页
GET /api/v3/projects
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string(可选) | 搜索条件,模糊匹配path,name,description |
| archived | boolean(可选) | 归档状态,archived = true限制为查询归档项目,默认不区分归档状态 |
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,activity 排序(默认created_at) |
| sort | string(可选) | 排序方式,允许asc,desc(默认 desc) |
| owned | boolean(可选) | 若为 true,返回的是当前用户个人 namespace 下的 project,以及 owner 为当前用户的 group 下的所有 project |
| min_access_level | integer(可选) | 指定最小访问级别,返回的 project 列表中,当前用户的 project 访问级别大于或者等于指定值 |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
| type | string | 项目类型(默认值:GIT,可选值 GIT/SVN) |
返回值:
[
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"type": "GIT",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"permissions": {
"project_access": {
"access_level": null
},
"share_group_access": {
"access_level": null
},
"group_access": {
"access_level": 10
}
}
},
]
# 获取所有有权限访问的项目列表 (搜索结果按相关度进行排序)
返回用户所有有权限访问的项目列表 (包括用户被授权的项目以及公开项目),支持搜索、分页。搜索结果按照搜索相关度进行排序
GET /api/v3/projects/accessable
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string(可选) | 搜索条件,模糊匹配path,name |
| archived | boolean(可选) | 归档状态,archived = true限制为查询归档项目,默认不区分归档状态 |
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,activity 排序(默认created_at) |
| sort | string(可选) | 排序方式,允许asc,desc(默认 desc) |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
返回值:
[
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"permissions": {
"project_access": {
"access_level": null
},
"share_group_access": {
"access_level": null
},
"group_access": {
"access_level": 10
}
}
},
]
# 获取项目列表 (搜索结果按相关度进行排序)
返回用户的授权项目列表 (用户为项目组或者项目成员),支持搜索、分页。搜索结果按照搜索相关度进行排序
GET /api/v3/projects/list_authorized_projects
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string(可选) | 搜索条件,模糊匹配path,name |
| archived | boolean(可选) | 归档状态,archived = true限制为查询归档项目,默认不区分归档状态 |
| my_pushed | boolean(可选) | 我是否提交过,my_pushed = true限制为查询我近六个月有提交的项目,不传或传false则此参数不生效 |
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,activity 排序(默认created_at) |
| sort | string(可选) | 排序方式,允许asc,desc(默认 desc) |
| owned | boolean(可选) | 若为 true,返回的是当前用户个人 namespace 下的 project,以及 owner 为当前用户的 group 下的所有 project |
| min_access_level | integer(可选) | 指定最小访问级别,返回的 project 列表中,当前用户的 project 访问级别大于或者等于指定值 |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
返回值:
[
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"permissions": {
"project_access": {
"access_level": null
},
"share_group_access": {
"access_level": null
},
"group_access": {
"access_level": 10
}
}
}
]
# 获取用户拥有的项目列表
返回用户拥有的项目列表,支持搜索、分页
GET /api/v3/projects/owned
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string(可选) | 搜索条件,模糊匹配path, name |
| archived | boolean(可选) | 归档状态,archived = true限制为查询归档项目,默认不区分归档状态 |
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,last_activity_at排序(默认created_at) |
| sort | string(可选) | 排序方式,允许 asc or desc(默认 desc) |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
返回值:
[
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false
}
]
# 获取所有公有项目列表
返回所有公有项目列表,包括开源项目和内部公开项目,支持分页
GET /api/v3/projects/public
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,last_activity_at排序(默认created_at) |
| sort | string(可选) | 排序方式,允许 asc or desc(默认 desc) |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
返回值:
[
{
"id": 9845735,
"description": null,
"public": false,
"archived": false,
"visibility_level": 10,
"public_visibility": 100,
"namespace": {
"created_at": "2016-12-16T01:47:55+0000",
"description": "git_helper_01",
"id": 9767,
"name": "git_helper_01",
"owner_id": 8771,
"path": "git_helper_01",
"updated_at": "2016-12-16T01:47:55+0000"
},
"owner": {
"id": 8771,
"username": "git_helper_01",
"web_url": "https://git.tencent.com/u/git_helper_01",
"name": "git_helper_01",
"state": "active",
"avatar_url": "https://git.tencent.com/uploads/user/avatar/8771/3301e9f989b94482802104bb08cf7150.gif"
},
"name": "xinghai-9ac9d73e6ae411e99b436c0b8463cf48",
"name_with_namespace": "git_helper_01/xinghai-9ac9d73e6ae411e99b436c0b8463cf48",
"path": "xinghai-9ac9d73e6ae411e99b436c0b8463cf48",
"path_with_namespace": "git_helper_01/xinghai-9ac9d73e6ae411e99b436c0b8463cf48",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_helper_01/xinghai-9ac9d73e6ae411e99b436c0b8463cf48.git",
"http_url_to_repo": "http://git.tencent.com/git_helper_01/xinghai-9ac9d73e6ae411e99b436c0b8463cf48.git",
"https_url_to_repo": "https://git.tencent.com/git_helper_01/xinghai-9ac9d73e6ae411e99b436c0b8463cf48.git",
"web_url": "https://git.tencent.com/git_helper_01/xinghai-9ac9d73e6ae411e99b436c0b8463cf48",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": true,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2019-04-30T01:01:53+0000",
"last_activity_at": "2019-04-30T01:01:53+0000",
"creator_id": 8771,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/9845735",
"watchs_count": 1,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 51200,
"limit_size": 512000,
"limit_file_size": 512,
"limit_lfs_size": 512000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false
}
]
# 获取内源项目列表
返回内源项目列表,支持搜索、分页
GET /api/v3/projects/inner_source
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string(可选) | 搜索条件,模糊匹配path,name |
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,last_activity_at排序(默认created_at) |
| sort | string(可选) | 排序方式,允许asc,desc(默认 desc) |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
返回值:
[
{
"id": 128278,
"description": "",
"public": false,
"archived": false,
"visibility_level": 10,
"public_visibility": 100,
"namespace": {
"created_at": "2018-08-30T02:35:11+0000",
"description": "",
"id": 76373,
"name": "test-namespace",
"owner_id": null,
"path": "a",
"updated_at": "2018-09-30T07:06:00+0000"
},
"name": "repo",
"name_with_namespace": "test-namespace/repo",
"path": "repo",
"path_with_namespace": "test-namespace/repo",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:test-namespace/repo.git",
"http_url_to_repo": "http://git.tencent.com/test-namespace/repo.git",
"https_url_to_repo": "https://git.tencent.com/test-namespace/repo.git",
"web_url": "https://git.tencent.com/test-namespace/repo",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": true,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2018-12-28T01:56:55+0000",
"last_activity_at": "2018-12-28T01:57:35+0000",
"creator_id": 18604,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/128278",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 512000,
"limit_size": 512000,
"limit_file_size": 512,
"limit_lfs_size": 512000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 1,
"repository_size": 0.001,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false
}
]
# 项目归档
该操作会将项目版本库标记为只读,不能向已归档的项目提交代码。
POST /api/v3/projects/:id/projects/archive
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
{
"id": 1000,
"description": "test",
"public": false,
"archived": true,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2019-09-11T07:24:58+0000",
"description": "test",
"id": 126814,
"name": "噢噢噢噢噢",
"owner_id": null,
"path": "911",
"updated_at": "2019-09-11T10:59:07+0000"
},
"name": "9.12",
"name_with_namespace": "噢噢噢噢噢/9.12",
"path": "9.12",
"path_with_namespace": "911/9.12",
"default_branch": "11-14",
"ssh_url_to_repo": "git@git.tencent.com:911/9.12.git",
"http_url_to_repo": "http://git.tencent.com/911/9.12.git",
"https_url_to_repo": "https://git.tencent.com/911/9.12.git",
"web_url": "https://git.tencent.com/911/9.12",
"tag_list": [
"ssssssssssssssssssss"
],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": true,
"tag_name_regex": null,
"tag_create_push_level": 30,
"branch_name_regex": null,
"created_at": "2019-09-12T01:33:37+0000",
"last_activity_at": "2019-11-25T02:28:28+0000",
"creator_id": 76291,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/197299/thumb_0-0-240-240_2589f6f4efba4e6eabe8eeacb804a5d9.gif",
"watchs_count": 3,
"stars_count": 2,
"forks_count": 2,
"config_storage": {
"limit_lfs_file_size": 51200.0,
"limit_size": 512000.0,
"limit_file_size": 512.0,
"limit_lfs_size": 51200.0
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 7,
"repository_size": 0.089,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"suggestion_reviewers": [],
"necessary_reviewers": [],
"path_reviewer_rules": "",
"approver_rule": 1,
"necessary_approver_rule": 0,
"can_approve_by_creator": true,
"auto_create_review_after_push": false,
"forbidden_modify_rule": false,
"push_reset_enabled": false,
"merge_request_template": null,
"file_owner_path_rules": ""
}
# 取消项目归档
取消项目归档后,版本库标记为可用。用户可以向该项目提交代码。
POST /api/v3/projects/:id/projects/unarchive
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
{
"id": 1000,
"description": "test",
"public": false,
"archived": true,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2019-09-11T07:24:58+0000",
"description": "test",
"id": 126814,
"name": "噢噢噢噢噢",
"owner_id": null,
"path": "911",
"updated_at": "2019-09-11T10:59:07+0000"
},
"name": "9.12",
"name_with_namespace": "噢噢噢噢噢/9.12",
"path": "9.12",
"path_with_namespace": "911/9.12",
"default_branch": "11-14",
"ssh_url_to_repo": "git@git.tencent.com:911/9.12.git",
"http_url_to_repo": "http://git.tencent.com/911/9.12.git",
"https_url_to_repo": "https://git.tencent.com/911/9.12.git",
"web_url": "https://git.tencent.com/911/9.12",
"tag_list": [
"ssssssssssssssssssss"
],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": true,
"tag_name_regex": null,
"tag_create_push_level": 30,
"branch_name_regex": null,
"created_at": "2019-09-12T01:33:37+0000",
"last_activity_at": "2019-11-25T02:28:28+0000",
"creator_id": 76291,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/197299/thumb_0-0-240-240_2589f6f4efba4e6eabe8eeacb804a5d9.gif",
"watchs_count": 3,
"stars_count": 2,
"forks_count": 2,
"config_storage": {
"limit_lfs_file_size": 51200.0,
"limit_size": 512000.0,
"limit_file_size": 512.0,
"limit_lfs_size": 51200.0
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 7,
"repository_size": 0.089,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"suggestion_reviewers": [],
"necessary_reviewers": [],
"path_reviewer_rules": "",
"approver_rule": 1,
"necessary_approver_rule": 0,
"can_approve_by_creator": true,
"auto_create_review_after_push": false,
"forbidden_modify_rule": false,
"push_reset_enabled": false,
"merge_request_template": null,
"file_owner_path_rules": ""
}
# 删除项目
删除项目,会自动删除关联的资源(如议题、合并请求、标签等等)
DELETE /api/v3/projects/:id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
200 或相关状态码
# 获取项目详细信息
根据 ID 或 NAMESPACE_PATH/PROJECT_PATH 返回项目的详细信息,至少需要有该项目的 guest 权限
GET /api/v3/projects/:id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
返回值:
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"suggestion_reviewers": [
{
"id": 80041,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
],
"necessary_reviewers": [],
"path_reviewer_rules": "",
"approver_rule": 1,
"necessary_approver_rule": 0,
"commit_mr_check": false,
"review_check": false,
"can_approve_by_creator": true,
"auto_create_review_after_push": true,
"forbidden_modify_rule": false,
"force_add_labels_in_note": false,
"resolved_check": false,
"push_reset_enabled": false,
"merge_request_template": null,
"file_owner_path_rules": "*.js review owner=username1,username2",
"allow_skip_reviewer": false,
"allow_skip_owner": false,
"allow_skip_mr_check": false
}
# 获取项目保密性设置相关信息
获取项目保密性设置相关信息,需要有该项目的 guest 及以上权限
GET /api/v3/projects/:id/config/confidential_info
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
返回值:
{
"id": 1,
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"confidential_level": 80, // 保密等级 -1(未设置)10(非保密项目)80(秘密)90(机密)100(绝密)
"allow_ai_coding_tool": false // 是否允许使用AI编程工具 null(未设置)true(允许)false(禁止)
}
# 修改项目保密等级
修改指定项目的保密等级,需要有该项目的 owner 权限
PUT /api/v3/projects/:id/config/confidential_level
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
| confidential_level | integer | 保密等级 取值范围 10(非保密项目)80(秘密)90(机密)100(绝密) |
返回值:
{
"id": 1,
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"confidential_level": 80,
"allow_ai_coding_tool": false
}
# 修改AI编程工具限制策略
修改指定项目的AI编程工具限制策略,需要有该项目的 owner 权限
PUT /api/v3/projects/:id/config/confidential_policy
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
| allow_ai_coding_tool | integer | 是否允许使用AI编程工具 取值范围 true(允许)false(禁止) |
返回值:
{
"id": 1,
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"confidential_level": 80,
"allow_ai_coding_tool": false
}
# 获取项目推送规则
根据 ID 或 NAMESPACE_PATH/PROJECT_PATH返回项目的推送规则,至少需要有该项目的master权限
GET /api/v3/projects/:id/push_rule
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
返回值:
{
"project_id": 8922,
"committer_restrict": 0
}
# 修改项目推送规则
修改指定项目的推送规则,至少需要有该项目的 master 权限
PUT /api/v3/projects/:id/push_rule
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | id = 项目 ID 或 项目全路径 project_full_path |
| committer_restrict | integer | 限制级别,有效值:0,10,20 0:无限制 10:仅接受系统内合法用户的提交 20:推送人必须与提交人一致 |
返回值:
{
"project_id": 8922,
"committer_restrict": 10
}
# 上传文件
上传一个文件到指定项目(不是提交到版本库!),该文件可用于项目内的 issue、review 的描述、评论。
注意: 需要 Content-type 设置为:multipart/form-data,否则无法正常上传附件 工蜂会对文件名进行特殊字符的过滤,最终上传的文件名以返回值中的 alt 字段为准
POST /api/v3/projects/:id/uploads
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| file | - | 单个附件 |
返回值:
{
"alt": "aaa.png",
"markdown": "",
"url": "/uploads/3CB57590ED4F4666B711F3169218AA65/aaa.png"
}
说明: markdown路径是相对于项目路径的,在项目内使用 markdown 语法时会自动添加扩展
# 获取项目的 share group 列表
获取项目中所有的 sharegroup
GET /api/v3/projects/:id/shares
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
[
{
"project_id": 29799,
"group_id": 74393,
"group_access": 20,
"created_at": "2017-03-11T07:32:17+0000",
"updated_at": "2017-03-11T07:32:17+0000"
},
{
"project_id": 29799,
"group_id": 220053,
"group_access": 30,
"created_at": "2018-01-04T03:52:19+0000",
"updated_at": "2018-01-04T03:52:19+0000"
}
]
# 获取用户的 shared project 列表
获取当前用户受邀项目列表,支持搜索、分页
GET /api/v3/projects/shared
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string(可选) | 搜索条件,模糊匹配path,name |
| order_by | string(可选) | 排序字段,允许按 id,name,path,created_at,updated_at,last_activity_at排序(默认created_at) |
| sort | string(可选) | 排序方式,允许asc,desc(默认 desc) |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值:20,最大值:100) |
返回值:
[
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false,
"permissions": {
"project_access": {
"access_level": null
},
"share_group_access": {
"access_level": null
},
"group_access": {
"access_level": 10
}
}
},
]
# 与组共享项目
允许与组共享项目
POST /api/v3/projects/:id/share
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| group_id | integer | 要与之共享的组的 id |
| group_access | integer | 授予组的权限级别 |
返回值:
200 或相关状态码
# 删除组中共享项目链接
从组中取消共享项目。
DELETE /api/v3/projects/:id/share/:group_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| group_id | integer | 组的 id |
返回值:
200 或相关状态码
# 通过名称搜索项目
过滤用户授权的项目列表,支持分页,如果是管理员,支持过滤所有项目
GET /api/v3/projects
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| search | string | 搜索条件,模糊匹配path, name. |
| with_archived | boolean(可选) | 归档状态,with_archived = true限制为查询归档项目,默认不区分 |
| with_push | boolean(可选) | 推送状态,with_push = true限制为查询推送过的项目,默认不区分 |
| abandoned | boolean(可选) | 活跃状态,abandoned = true限制为查询最近半年更新过的项目,默认全部 |
| visibility_levels | string(可选) | 项目可视范围,默认visibility_levels = "0, 10, 20" |
| order_by | string(可选) | 排序字段,允许按id,name,path,created_at,updated_at,last_activity_at排序(默认created_at) |
| sort | string(可选) | 排序方式,允许asc,desc(默认 desc) |
| page | integer(可选) | 页数(默认:1) |
| per_page | integer(可选) | 默认页面大小(默认值: 20,最大值: 100) |
注意:当用户为非管理员时, with_archived、with_push、abandoned、visibility_levels过滤参数不生效
返回值:
[
{
"id": 8922,
"description": null,
"public": false,
"archived": false,
"visibility_level": 0,
"public_visibility": 100,
"namespace": {
"created_at": "2017-01-16T08:29:43+0000",
"description": "git_user1",
"id": 11323,
"name": "git_user1",
"owner_id": 11323,
"path": "git_user1",
"updated_at": "2017-01-16T08:29:43+0000"
},
"owner": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
},
"name": "test-01",
"name_with_namespace": "git_user1/test-01",
"path": "test-01",
"path_with_namespace": "git_user1/test-01",
"default_branch": "master",
"ssh_url_to_repo": "git@git.tencent.com:git_user1/test-01.git",
"http_url_to_repo": "http://git.tencent.com/git_user1/test-01.git",
"https_url_to_repo": "https://git.tencent.com/git_user1/test-01.git",
"web_url": "https://git.tencent.com/git_user1/test-01",
"tag_list": [],
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": true,
"review_enabled": true,
"fork_enabled": false,
"tag_name_regex": null,
"tag_create_push_level": 30,
"created_at": "2017-08-13T07:37:14+0000",
"last_activity_at": "2017-08-13T07:37:14+0000",
"creator_id": 11323,
"avatar_url": "https://git.tencent.com/uploads/project/avatar/70703",
"watchs_count": 0,
"stars_count": 0,
"forks_count": 0,
"config_storage": {
"limit_lfs_file_size": 500,
"limit_size": 100000,
"limit_file_size": 100000,
"limit_lfs_size": 100000
},
"config_confidential": {
"level": -1,
"allow_ai_coding_tool": true
},
"forked_from_project": "Forked Project not found",
"statistics": {
"commit_count": 0,
"repository_size": 0,
"lfs_repository_size": 0
},
"created_from_id": null,
"template_repository": false
}
]
# 查询项目的事件列表
查询项目的事件列表
GET /api/v3/projects/:id/events
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| user_id_or_name | integer 或 string(可选) | 用户的 ID 或用户名 |
| before | Date(可选) | 日期,包含 before 以前创建的 events。格式:yyyy-MM-dd'T'HH :mm :ssZ。例如 2019-03-25T00:10:19+0000 或 2019-03-25T00:10:19+0800,参数在 params 中需要转码:“2019-03-25T00:10:19%2B0800" |
| after | Date(可选) | 日期,包含 after 以后创建的 events。格式:yyyy-MM-dd'T'HH :mm :ssZ。例如 2019-03-25T00:10:19+0000 或 2019-03-25T00:10:19+0800,参数在 params 中需要转码:“2019-03-25T00:10:19%2B0800" |
| actions | integer(可选) | 命令的属性,可选参数:1~10,15 |
| target_type | string(可选) | 事件类型,可选参数:Issue, MergeRequest, Review, Milestone, note, Project, tag, branch, tagBranch |
| ref | string(可选) | 引用,当 push 事件时才有效,参数 branch 或 tag:refs/heads/branch_name, refs/tags/tag_name |
| page | integer | 页数(默认值:1) |
| per_page | integer | 默认页面大小(默认值: 20,最大值: 100) |
actions 参数说明:
CREATED=1,UPDATED=2,CLOSED=3,REOPENED=4,PUSHED=5,COMMENTED=6,MERGED=7,JOINED=8,LEFT=9,DESTROYED=10,WIKI_PUSHED=15
返回值:
[
{
"title": null,
"project_id": 28,
"action_name": "CREATED",
"target_id": 387,
"target_type": "MergeRequest",
"author_id": 11323,
"author_username": "luci",
"created_at": "2017-09-25T08:46:28+0000",
"target_title": null,
"data": {}
},
{
"title": null,
"project_id": 28,
"action_name": "COMMENTED",
"target_id": 732,
"target_type": "note",
"author_id": 11323,
"author_username": "luci",
"created_at": "2017-09-24T08:46:28+0000",
"target_title": null,
"data": {}
},
]
# 标星
如果使用 project_full_path,确保 project_full_path 编码过,例子:/api/v3/projects/tencent/code--> /api/v3/projects/tencent%2Fcode (/ 编码 %2F)
# 对指定项目标星
对指定项目进行标星
PUT /api/v3/projects/:id/star
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
true 或 flase
# 取消对指定项目标星
取消当前用户对指定项目标星
DELETE /api/v3/projects/:id/star
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
200 或相关状态码
# 查看对指定项目是否标星
查看当前用户对指定项目是否标星
GET /api/v3/projects/:id/star
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
true 或 flase
# 获取标星项目列表
获取对指定项目的标星用户列表
GET /api/v3/projects/:id/stars
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| page | integer(可选) | 页数(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值: 20,最大值: 100) |
返回值:
[
{
"project_id": 2654,
"user": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2727c7a409cab1d15dd993149aa.jpg"
}
}
]