华为云用户手册

  • 响应示例 状态码: 200 OK { "result" : { "name" : "master", "commit" : { "id" : "3b68902cf0eb7de3d5c8757e4a990bc3fe0af349", "short_id" : "3b68902c", "title" : "新建文件", "created_at" : "2022-03-08T03:14:39.000Z", "parent_ids" : [ "08618c900a4048aae7e4cd88913d3d521eae02eb" ], "message" : "新建文件", "author_name" : "repo", "committer_name" : "repo", "committed_date" : "2022-03-08T03:14:39.000Z" }, "protected" : true, "developers_can_push" : false, "developers_can_merge" : false, "master_can_push" : false, "master_can_merge" : false, "no_one_can_push" : true, "no_one_can_merge" : true, "in_an_opened_merge_request" : false }, "status" : "success" }
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result AddProtectResponse object 响应结果 status String 响应状态 表6 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表7 AddProtectResponse 参数 参数类型 描述 name String 分支名称 commit CommitRepoV2 object 提交信息 protected Boolean 是否保护 developers_can_push Boolean 是否允许开发者提交 developers_can_merge Boolean 是否允许开发者合并 master_can_push Boolean 是否允许管理员提交 master_can_merge Boolean 是否允许管理员合并 no_one_can_push Boolean 没有人允许提交 no_one_can_merge Boolean 没有人允许合并 in_an_opened_merge_request Boolean 是否在一个打开的合并请求 表8 CommitRepoV2 参数 参数类型 描述 id String 提交对应的SHA id short_id String 提交对应的短SHA id created_at String 创建时间 title String 提交标题 parent_ids Array of strings 父提交id message String 提交信息 author_name String 作者 committer_name String 提交作者 committed_date String 提交时间
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 access_level 是 AddProtectAccessLevel object 新建保护分支权限 表4 AddProtectAccessLevel 参数 是否必选 参数类型 描述 push_access_level 是 Integer 提交权限 0:任何人不允许提交,30:开发者及管理员可提交,40:管理员可提交 枚举值: 0 30 40 merge_access_level 是 Integer 合并权限 0:任何人不允许合并,30:开发者及管理员可合并,40:管理员可合并,合并权限必须大于等于提交权限 枚举值: 0 30 40
  • 响应示例 状态码: 200 OK { "result" : { "iid" : 1, "approval_merge_request_approvers" : [ { "nick_name" : "emily", "name" : "emily", "id" : 7513, "state" : "optional", "username" : "0c1de3e61c80d56b1f7dc01164788784" }, { "nick_name" : "lmptest02", "name" : "lmptest02", "id" : 7745, "state" : "optional", "username" : "2ef8c2c835424e988ff33a8339ee1cb4" } ], "description" : "merge \"branch123\" into \"master\"\n新建文件 dsadsad11", "created_at" : "2021-12-08T16:34:49.000+08:00", "title" : "tesafrds.", "source_branch" : "branch123", "updated_at" : "2021-12-09T11:21:02.000+08:00", "id" : 6670, "state" : "opened", "closed_at" : "2021-12-08T16:34:50.000+08:00", "author" : { "name" : "repo", "id" : 6879, "state" : "active", "username" : "e0c068bf68c44bfab87b763ff85da277" }, "is_source_branch_exist" : true, "target_branch" : "master", "merge_status" : "unchecked", "merge_request_diff" : { "merge_request_id" : 6670, "head_commit_sha" : "715fc146292edc31a588fbc74349a2b8d18dbc27", "updated_at" : "2021-12-09T11:20:58.000+08:00", "start_commit_sha" : "02f0482056d3b949699eb69683914466c84529af", "created_at" : "2021-12-09T11:20:58.000+08:00", "base_commit_sha" : "6e90282f6334433a9fe3be809a7c1eed1afbf10b", "commits_count" : 2 }, "devcloud_source_branch" : "branch123", "merge_request_assignee_list" : [ { "name" : "六月飞雪", "id" : 6743, "state" : "active", "username" : "a618e34bd5704be3ae3395dfede06041" }, { "name" : "管理员总账户", "id" : 6747, "state" : "active", "username" : "42dd0277cfb048dea856e4ee352e937d" } ], "merged_at" : "2023-08-14T20:51:51.000+08:00", "merged_by" : { "id" : "9124,", "name" : "CodeHub_beta_dev", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "avatar_url" : "", "web_url" : "https://devcloud.cn-north-7.ulanqab.huawei.com/c369c68f1ff84679b5a8ed904d8bff1c" }, "merge_request_related_work_items" : [ { "id" : 7343, "user_id" : "9124", "repo_id" : 2111746921, "merge_request_id" : 20637, "target_branch" : "master", "source_branch" : "test123", "merge_request_url" : "https://devcloud.cn-north-7.ulanqab.huawei.com/codehub/2111746921/18/mergedetail?source=test123&target=master", "merge_request_state" : "opened", "related_id" : "6437435", "related_title" : "msm-0115-1000", "related_url" : "https://devcloud.cn-north-7.ulanqab.huawei.com/projectman/scrum/e76c13e86364438d9183ca2f395371e1/task/detail/6437435", "result" : 1, "create_at" : "2023-09-18T20:29:59.000+08:00", "update_at" : "2023-09-18T20:29:59.000+08:00" } ] }, "status" : "success" }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result MergeInfoResult object 响应结果 status String 响应状态 表4 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表5 MergeInfoResult 参数 参数类型 描述 approval_merge_request_approvers Array of ApprovalMergeRequestApproversItem objects 评审人 author Author object 作者 closed_at String 关闭时间 created_at String 创建时间 description String 合并请求描述 devcloud_source_branch String 源分支 id Double 合并请求id iid Double 当前仓库内合并请求序号 is_source_branch_exist Boolean 源分支是否存在 merge_request_assignee_list Array of MergeRequestAssigneeListItem objects 检视人 merge_request_diff MergeRequestDiff object 合并差异 merge_status String 是否可以被合并 source_branch String 源分支 state String 合并请求状态 target_branch String 目标分支 title String 标题 updated_at String 更新时间 merged_at String 合并时间 merged_by MergedByUser object 合并人 merge_request_related_work_items Array of MergeRequestRelatedWorkItem objects 关联工作项 表6 ApprovalMergeRequestApproversItem 参数 参数类型 描述 id Double 用户id name String 用户名 nick_name String 用户昵称 state String 用户状态 username String 用户iamId 表7 Author 参数 参数类型 描述 id Double 用户id name String 用户名 state String 用户状态 username String 用户iamId avatar_url String 头像url web_url String web url 表8 MergeRequestAssigneeListItem 参数 参数类型 描述 id Double 用户id name String 用户名 state String 用户状态 username String 用户iamId 表9 MergeRequestDiff 参数 参数类型 描述 id Double 合并请求差异id state String 合并请求状态 merge_request_id Double 合并请求id created_at String 创建时间 updated_at String 更新时间 base_commit_sha String base提交 real_size Double 实际大小 head_commit_sha String head提交 start_commit_sha String start提交 commits_count Double 提交数 external_diff String 外部差异 external_diff_store Double 外部存储差异 stored_externally Boolean 是否存在外部存储 added_lines Double 新增行数 removed_lines Double 删除行数 表10 MergedByUser 参数 参数类型 描述 id Double 用户id name String 用户名 state String 用户状态 username String 用户iamId avatar_url String 头像url web_url String 主页url 表11 MergeRequestRelatedWorkItem 参数 参数类型 描述 id Double id user_id String 用户id repo_id Double 仓库id merge_request_id Double 合并请求id target_branch String 目标分支 source_branch String 源分支 merge_request_title String 合并请求标题 merge_request_url String 合并请求url merge_request_state String 合并请求状态 related_id String 关联工作项id related_title String 关联工作项标题 related_url String 关联工作项url result Double 查询结果 create_at String 创建时间 update_at String 更新时间
  • Repository 接口 说明 获取分支目录下的文件 获取分支目录下的文件。 获取仓库统计数据 获取仓库统计数据。 获取一个仓库下特定分支的图片文件 获取一个仓库下特定分支的图片文件。 修改被流水线引用的仓库状态 修改被流水线引用的仓库状态。 判断用户是否有仓库的管理员权限 判断用户是否有仓库的管理员权限。 设置仓库是公开状态还是私有状态 设置仓库是公开状态还是私有状态。 获取一个仓库下特定分支指定文件内容 获取一个仓库下特定分支指定文件内容。 获取公开示例模板列表 获取公开示例模板列表。 创建仓库 用指定的名称在指定项目上创建仓库。传入参数:仓库名、模板id、是否导入项目成员、归属项目。 根据仓库名组名获取仓库短id,用以拼接与commitid对应提交详情页面url 获取仓库短id,用于获取仓库详情页面url。 根据组名和仓库名查询某仓库某分支对应的提交 根据仓库组名、仓库名和分支获取提交列表。 查询某仓库对应的分支 根据仓库id获取指定仓库的分支列表。 根据仓库id查询仓库某分支对应的提交,提供更多可选参数 根据仓库id查询仓库某分支对应的提交。 添加部署密钥 添加部署密钥。 删除仓库部署密钥 删除仓库部署密钥。 获取仓库上一次的提交统计信息 获取仓库上一次的提交统计信息。 仓库统计 根据仓库短id,查询仓库的代码提交记录统计。 删除仓库 根据仓库32位uuid删除指定的仓库。 查看仓库的创建状态 获取仓库状态。 查询某仓库的标签列表 查询指定仓库对应的分支。 新建标签 新建标签。 查询某个仓库的详细信息 根据仓库UUID获取仓库信息仓库信息。返回 包含id,name,组名,仓库访问URL。 获取代码提交行数 获取指定日期内代码仓指定分支的代码提交行数。 下载仓库 按照指定格式下载仓库。 新建保护分支 新建保护分支。 获取仓库分支列表 获取仓库分支列表。 获取仓库合并请求列表 获取仓库合并请求列表。 获取仓库合并请求详情 获取仓库合并请求详情。
  • Commit 接口 说明 查询某个仓库的提交信息 根据仓库短ID获取提交信息,支持根据文件路径,查询这个路径下所有的commits列表。 创建提交 能够一次提交位于不同目录的多个文件,目录不存在时,能自动创建目录。支持强制覆盖选项,当选择强制覆盖标志为true时,忽略冲突,强制提交。 查询某个仓库的特定提交信息 获取由commit id或分支或标记的名称标识的特定提交。 查询某个仓库的提交差异信息 根据commit id查询提交差异信息。
  • V2Project 接口 说明 查询用户的所有仓库 获取用户的所有仓库信息。 创建项目、仓库 创建项目后,创建仓库组由后台生成方式 传入参数:仓库名、模板id、是否导入项目成员、归属项目。 创建项目并fork仓库 创建仓库后fork仓库 传入参数:仓库名、是否导入项目成员、归属项目。 查询项目下的所有仓库 获取仓库列表,模糊查询支持范围,如果未传入project uuid,则支持按仓库名或项目名模糊查询,否则,只按仓库名模糊匹配。 分支关联工作项 分支关联工作项。
  • 响应示例 状态码: 200 OK { "result" : { "total" : 14, "repositories" : { "repository_uuid" : "d0457f74cc5b43d989ded7248f71b4e5", "repository_id" : 468480, "repository_name" : "CreatRepository_2qD5i", "ssh_url" : "git@repo.alpha.devcloud.inhuawei.com:Demo00228/CreatRepository_2qD5i.git", "https_url" : "https://repo.alpha.devcloud.inhuawei.com/Demo00228/CreatRepository_2qD5i.git", "group_name" : "Demo00228", "web_url" : "https://alpha.devcloud.inhuawei.com/repo/468480/home", "visibility_level" : 0, "created_at" : "2019-10-15 09:40:26", "updated_at" : "2019-10-15 09:40:26", "repository_size" : "0.06M", "lfs_size" : "0.00M", "creator_name" : "repo", "domain_name" : "repo", "star" : false, "status" : 0, "is_owner" : 1, "iam_user_uuid" : "a618e34bd5704be3ae3395dfede06041", "project_uuid" : "4838955a48e2492bbe44b31bc4c272f6", "project_is_deleted" : "false", "userRole" : null } }, "status" : "success" }
  • URI GET /v2/projects/{project_uuid}/repositories 表1 路径参数 参数 是否必选 参数类型 描述 project_uuid 是 String 项目ID,获取方式请参见获取项目ID。 表2 Query参数 参数 是否必选 参数类型 描述 page_index 否 Integer 分页索引,从1开始计数 page_size 否 Integer 每页条目数 search 否 String 搜索关键字
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result RepoListInfoV2 object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 RepoListInfoV2 参数 参数类型 描述 repositories Array of RepoInfoV2 objects 仓库列表 total Integer 仓库总数 表7 RepoInfoV2 参数 参数类型 描述 created_at String 创建时间 creator_name String 创建者的用户名,在用户是租户的情况下,用户名和租户名相等 domain_name String 创建者的租户名 group_name String 仓库组名(克隆地址中域名后面仓库名前的一段 示例:git@repo.alpha.devcloud.inhuawei.com:Demo00228/testword.git 组名:Demo00228 ) https_url String 使用 https 克隆仓库时所使用的 url iam_user_uuid String 用户的 iam user uuid is_owner Integer 当前用户是否是仓库的创建者,1:是,0:不是 lfs_size String 仓库 LFS 容量,单位为M,大于 1024M 则单位为 G project_is_deleted String 项目是否被删除 project_uuid String 项目ID,获取方式请参见获取项目ID。 repository_id Integer 仓库主键id repository_name String 仓库名 repository_size String 仓库总容量 = 仓库 LFS 容量 + git 库容量,单位为M,大于 1024M 则单位为 G repository_uuid String 仓库uuid(由CreateRepository接口返回) ssh_url String 使用 ssh 方式克隆仓库时所使用的 url star Boolean 当前用户是否收藏该仓库 status Integer 仓库状态, 0:仓库正常创建成功 1:仓库创建中 2:创建失败 3:仓库冻结 4:仓库已经关闭 updated_at String 更新时间 userRole Integer 用户在仓库中的权限:20:只读成员 30:普通成员 40:管理员 visibility_level Integer 是否可见:0私有仓库,20公有仓库 web_url String web url 路径,访问它将跳转至仓库详情页
  • 响应示例 状态码: 200 OK { "result" : { "repos" : [ { "uuid" : "36f532939c4b4e2191c10f5353ccf34c", "repo_id" : 487773, "repo_name" : "DDDDDDDD", "ssh_url" : "git@repo.alpha.devcloud.inhuawei.com:CHEN_TEST00001/DDDDDDDD.git", "code_url" : "https://repo.alpha.devcloud.inhuawei.com/CHEN_TEST00001/DDDDDDDD.git", "detail_url" : "https://alpha.devcloud.inhuawei.com/repo/487773/home" } ], "total_count" : 100 }, "status" : "success" }
  • URI GET /v2/projects/{project_uuid}/repositories/template-status 表1 路径参数 参数 是否必选 参数类型 描述 project_uuid 是 String 项目ID,获取方式请参见获取项目ID。 表2 Query参数 参数 是否必选 参数类型 描述 page_no 否 Integer 分页页数 page_size 否 Integer 每页数据数
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result TemplateListInfo object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 TemplateListInfo 参数 参数类型 描述 repos Array of DevstarRepoInfo objects 仓库列表 total_count Integer 仓库总数 表7 DevstarRepoInfo 参数 参数类型 描述 uuid String 仓库的uuid repo_id String 仓库ID repo_name String 仓库名称 ssh_url String 仓库SSH地址 code_url String 仓库HTTPS地址 detail_url String 仓库预览地址
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 template_type 是 String 模板类型 code_title 否 String 代码模板名称 creator_name 否 String 创建者名称 code_description 否 String 代码模板描述 languages 否 Array of strings 模板语言 plateform 否 Array of strings 模板平台 entertype 否 Array of strings 模板类型
  • 请求示例 PUT https://{endpoint}/v2/repositories/{repository_uuid}/template-status { "template_type": "SHARE", "code_title": "exampleTitle", "creator_name": "exampleName", "code_description": "exampleDescription", "languages": ['Java'], "plateform": ['Console'], "entertype": ['AI'] }
  • 响应示例 状态码: 200 OK { "result" : { "total" : 29, "repositories" : { "repository_uuid" : "0bf1e7ceb5b341318cb72b42901abe54", "repository_id" : 468564, "repository_name" : "test", "ssh_url" : "git@repo.alpha.devcloud.inhuawei.com:test_new00001/test.git", "https_url" : "https://repo.alpha.devcloud.inhuawei.com/test_new00001/test.git", "group_name" : "test_new00001", "web_url" : "https://alpha.devcloud.inhuawei.com/repo/468564/home", "visibility_level" : 0, "created_at" : "2019-10-15 11:00:11", "updated_at" : "2019-10-15 11:00:11", "repository_size" : "0.05M", "lfs_size" : "0.00M", "creator_name" : "repo", "domain_name" : "repo", "star" : true, "status" : 0, "is_owner" : 1, "iam_user_uuid" : "a618e34bd5704be3ae3395dfede06041", "project_uuid" : "dc19b3ca6f334ce894a1ec467689797d", "project_is_deleted" : "false", "userRole" : null } }, "status" : "success" }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result RepoListInfoV2 object 响应结果 status String 响应状态 表4 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表5 RepoListInfoV2 参数 参数类型 描述 repositories Array of RepoInfoV2 objects 仓库列表 total Integer 仓库总数 表6 RepoInfoV2 参数 参数类型 描述 created_at String 创建时间 creator_name String 创建者的用户名,在用户是租户的情况下,用户名和租户名相等 domain_name String 创建者的租户名 group_name String 仓库组名(克隆地址中域名后面仓库名前的一段 示例:git@repo.alpha.devcloud.inhuawei.com:Demo00228/testword.git 组名:Demo00228 ) https_url String 使用 https 克隆仓库时所使用的 url iam_user_uuid String 用户的 iam user uuid is_owner Integer 当前用户是否是仓库的创建者,1:是,0:不是 lfs_size String 仓库 LFS 容量,单位为M,大于 1024M 则单位为 G project_is_deleted String 项目是否被删除 project_uuid String 项目ID,获取方式请参见获取项目ID。 repository_id Integer 仓库主键id repository_name String 仓库名 repository_size String 仓库总容量 = 仓库 LFS 容量 + git 库容量,单位为M,大于 1024M 则单位为 G repository_uuid String 仓库uuid(由CreateRepository接口返回) ssh_url String 使用 ssh 方式克隆仓库时所使用的 url star Boolean 当前用户是否收藏该仓库 status Integer 仓库状态, 0:仓库正常创建成功 1:仓库创建中 2:创建失败 3:仓库冻结 4:仓库已经关闭 updated_at String 更新时间 userRole Integer 用户在仓库中的权限:20:只读成员 30:普通成员 40:管理员 visibility_level Integer 是否可见:0私有仓库,20公有仓库 web_url String web url 路径,访问它将跳转至仓库详情页
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result Repository object 响应结果 status String 响应状态 表4 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表5 Repository 参数 参数类型 描述 repository_uuid String 创建仓库的UUID 最小长度:32 最大长度:32
  • 请求示例 POST https://{endpoint}/v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions { "body" : "检视意见内容", "position" : { "new_path" : "a.txt", "old_path" : "a.txt", "new_line" : 1, "old_line" : -1 }, "severity" : "suggestion" }
  • 响应示例 状态码: 200 OK { "result" : { "id" : "b7d95c35c08e0b328bfbafd45408bd2ac28b73f9", "individual_note" : false, "notes" : [ { "id" : 2111886200, "type" : "DiffNote", "body" : "检视意见内容", "author" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "created_at" : "2023-06-01T17:05:12.000+08:00", "updated_at" : "2023-06-01T17:05:12.000+08:00", "system" : false, "noteable_id" : 19387, "noteable_type" : "MergeRequest", "resolvable" : true, "is_reply" : true, "noteable_iid" : 2, "discussion_id" : "8bbe6d4e797169c4c1ce56507fdf1abc11f95601", "project" : "DevOpsqlcylxm00004/project-test", "diff_file" : "7", "diff" : "@@ -0,0 +1,0 @@\n+7", "archived" : false, "review_categories" : "regulations", "review_categories_cn" : "编程军规问题", "review_categories_en" : "Regulations", "review_modules" : "aaa,bbb", "severity" : "suggestion", "assignee" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "proposer" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "position" : { "base_sha" : "973bcc0211c32dbaa8473561c6767f74e1a81471", "start_sha" : "973bcc0211c32dbaa8473561c6767f74e1a81471", "head_sha" : "f5bf0230f9b996ed6c0d64d2b2fef789d91b164c", "old_path" : "7", "new_path" : "7", "position_type" : "text", "new_line" : 1 }, "resolved" : false, "is_outdated" : false } ], "project_id" : 2111699786, "noteable_type" : "MergeRequest", "project_full_path" : "DevOpsqlcylxm00004/project-test", "a_mode" : "0", "b_mode" : "100644", "deleted_file" : false, "new_file" : true, "resolved" : false, "archived" : false, "review_categories" : "regulations", "review_categories_cn" : "编程军规问题", "review_categories_en" : "Regulations", "review_modules" : "aaa,bbb", "severity" : "suggestion", "severity_cn" : "建议", "severity_en" : "Suggestion", "assignee" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "proposer" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "diff_file" : "@@ -0,0 +1,0 @@\n+7", "added_lines" : 1, "removed_lines" : 0 }, "status" : "success" }
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result MergeRequestDiscussionDto object 响应结果 status String 响应状态 表6 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表7 MergeRequestDiscussionDto 参数 参数类型 描述 id String 评论id individual_note Boolean individual_note notes Array of NoteDto objects 主评和回复列表 数组长度:0 - 1 project_id Integer 仓库id 最小值:1 最大值:2147483647 noteable_type String 目标类型 commit_id String 关联的提交id project_full_path String 仓库路径 a_mode String 变更前文件模式 b_mode String 变更后文件模式 deleted_file Boolean 此次变更是否删除文件 new_file Boolean 此次变更是否新增文件 resolved Boolean 检视意见是否解决 archived Boolean 检视意见是否存档 review_categories String 检视意见分类 review_categories_cn String 检视意见分类中文名 review_categories_en String 检视意见分类英文名 review_modules String 检视意见模块 severity String 严重程度 severity_cn String 严重程度中文名 severity_en String 严重程度英文名 assignee UserBasicDto object 指派人 proposer UserBasicDto object 提出人 merge_request_version_params MergeRequestVersionParamsDto object MR版本信息 diff_file String 变更文件 added_lines Integer 新增行数 最小值:1 最大值:2147483647 removed_lines Integer 删除行数 最小值:1 最大值:2147483647 表8 NoteDto 参数 参数类型 描述 id Integer note id 最小值:1 最大值:2147483647 type String note类型 body String 检视意见内容 attachment String 附件 author UserBasicDto object 作者 created_at String 创建时间 updated_at String 更新时间 system Boolean 是否是系统生成的日志 noteable_id Integer 目标id 最小值:1 最大值:2147483647 noteable_type String 目标类型 commit_id String 关联的提交id resolvable Boolean 是否可解决 is_reply Boolean 是否是回复 resolved_by UserBasicDto object 解决人 noteable_iid Integer 目标iid 最小值:1 最大值:2147483647 discussion_id String 讨论id project String 所属项目 diff_file String 变更文件 diff String 变更内容 archived Boolean 是否存档 review_categories String 检视意见分类 review_categories_cn String 检视意见分类中文名 review_categories_en String 检视意见分类英文名 review_modules String 检视意见模块 severity String 严重程度 severity_cn String 严重程度中文名 severity_en String 严重程度英文名 file_path String 文件路径 line String 行号 assignee UserBasicDto object 指派人 proposer UserBasicDto object 提出人 position PositionDto object 关联的代码位置 resolved Boolean 是否解决 is_outdated Boolean 是否过时 表9 PositionDto 参数 参数类型 描述 base_sha String 源分支base提交节点 start_sha String 目标分支最新提交节点 head_sha String 源分支最新提交节点 old_path String 修改前文件路径 new_path String 修改后文件路径 position_type String 变更类型 old_line Integer 修改前行号 new_line Integer 修改后行号 表10 UserBasicDto 参数 参数类型 描述 id Integer 用户id 最小值:1 最大值:2147483647 name String 姓名 username String 用户名 state String 状态 avatar_url String 头像url avatar_path String 头像路径 email String 邮箱 name_cn String 中文名 web_url String 主页 nick_name String 昵称 tenant_name String 租户名称 表11 MergeRequestVersionParamsDto 参数 参数类型 描述 diff_id Integer MR最新变更id 最小值:1 最大值:2147483647 start_sha String 目标分支最新提交 commit_id String 源分支最新提交
  • URI POST /v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions 表1 路径参数 参数 是否必选 参数类型 描述 repository_id 是 Integer 仓库短id 最小值:1 最大值:2147483647 merge_request_iid 是 Integer 合并请求iid 最小值:1 最大值:2147483647
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 body 是 String 检视意见内容 severity 否 String 严重程度 assignee_id 否 String 指派人id review_categories 否 String 检视意见分类 review_modules 否 String 检视意见模块 proposer_id 否 String 提出人id position 否 PositionDto object 代码位置信息 表4 PositionDto 参数 是否必选 参数类型 描述 base_sha 否 String 源分支base提交节点 start_sha 否 String 目标分支最新提交节点 head_sha 否 String 源分支最新提交节点 old_path 否 String 修改前文件路径 new_path 否 String 修改后文件路径 position_type 否 String 变更类型 old_line 否 Integer 修改前行号 new_line 否 Integer 修改后行号
  • 响应示例 状态码: 200 OK { "result" : [ { "diff" : "@@ -1,4 +1,7 @@\n y_mr_0721\n+\n+![CloudIDE成功运行](./image/截图.PNG)\n+\n edwwd\n # css \n **hhrh**", "old_path" : "README.md", "new_path" : "README.md", "a_mode" : "100644", "b_mode" : "100644", "new_file" : false, "renamed_file" : false, "deleted_file" : false } ], "status" : "success" }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result Array of DiffCommitInfo objects 差异列表 status String 响应状态 表4 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表5 DiffCommitInfo 参数 参数类型 描述 old_path String 变更前文件路径 new_path String 变更后文件路径 a_mode String 变更前文件模式 b_mode String 变更后文件模式 new_file Boolean 此次变更是否新增文件 renamed_file Boolean 此次变更是否重命名文件 deleted_file Boolean 此次变更是否删除文件 diff Boolean 差异信息
  • 响应示例 状态码: 200 OK { "result" : { "id" : "85a0a9d5c6e43bc9c3e443ac01f789e24eeef02b", "title" : "some commit message", "message" : "some commit message", "short_id" : "85a0a9d5", "author_name" : "repo", "author_email" : null, "committer_name" : "repo", "committer_email" : null, "created_at" : "2021-09-26T03:44:51.000Z", "parent_ids" : [ "5c114bb316dff4d4a046e09a5c44c816f2433140" ], "committed_date" : "2021-09-26T03:44:51.000Z", "authored_date" : null, "stats" : { "additions" : 1, "deletions" : 0, "total" : 1 }, "last_pipeline" : { "id" : 292811, "sha" : "2202af08836f0afd762d1b151d15ac510b974bdf", "ref" : "master", "status" : "running", "web_url" : "https://repo.devcloud.cn-north-208.ulanqab.huawei.com/Pipeline_Beta_sdcs00001/202107171926/pipelines/292811" } }, "status" : "success" }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result SpecificCommitInfo object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 SpecificCommitInfo 参数 参数类型 描述 id String 提交对应的SHA id short_id String 提交对应的短SHA id title String 提交标题 author_name String 作者 author_email String 作者邮箱 committer_name String 提交作者 committer_email String 提交作者邮箱 created_at String 创建时间 message String 提交信息 parent_ids Array of strings 父提交id committed_date String 提交时间 authored_date String 作者提交时间 stats stats object 变更行数 last_pipeline last_pipeline object 流水线信息 表7 stats 参数 参数类型 描述 additions Integer 变更增加的行数 deletions Integer 变更删除的行数 total Integer 变更的总行数 表8 last_pipeline 参数 参数类型 描述 id Integer 流水线id sha String 提交对应的SHA id ref String 分支名 status String 流水线状态 web_url String 流水线url
  • URI GET /v2/projects/{repo_id}/repository/commits/{sha} 表1 路径参数 参数 是否必选 参数类型 描述 repo_id 是 Integer 仓库短id sha 是 String commit id,仓库的branch名或tag名 表2 Query参数 参数 是否必选 参数类型 描述 stats 否 Boolean 包括提交统计信息。默认值为true
  • 响应示例 状态码: 200 OK { "result" : { "id" : "b7d95c35c08e0b328bfbafd45408bd2ac28b73f9", "individual_note" : false, "notes" : [ { "id" : 2111886200, "type" : "DiffNote", "body" : "检视意见内容", "author" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "created_at" : "2023-06-01T17:05:12.000+08:00", "updated_at" : "2023-06-01T17:05:12.000+08:00", "system" : false, "noteable_id" : 19387, "noteable_type" : "MergeRequest", "resolvable" : true, "is_reply" : true, "noteable_iid" : 2, "discussion_id" : "8bbe6d4e797169c4c1ce56507fdf1abc11f95601", "project" : "DevOpsqlcylxm00004/project-test", "diff_file" : "7", "diff" : "@@ -0,0 +1,0 @@\n+7", "archived" : false, "review_categories" : "regulations", "review_categories_cn" : "编程军规问题", "review_categories_en" : "Regulations", "review_modules" : "aaa,bbb", "severity" : "suggestion", "assignee" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "proposer" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "position" : { "base_sha" : "973bcc0211c32dbaa8473561c6767f74e1a81471", "start_sha" : "973bcc0211c32dbaa8473561c6767f74e1a81471", "head_sha" : "f5bf0230f9b996ed6c0d64d2b2fef789d91b164c", "old_path" : "7", "new_path" : "7", "position_type" : "text", "new_line" : 1 }, "resolved" : false, "is_outdated" : false } ], "project_id" : 2111699786, "noteable_type" : "MergeRequest", "project_full_path" : "DevOpsqlcylxm00004/project-test", "a_mode" : "0", "b_mode" : "100644", "deleted_file" : false, "new_file" : true, "resolved" : false, "archived" : false, "review_categories" : "regulations", "review_categories_cn" : "编程军规问题", "review_categories_en" : "Regulations", "review_modules" : "aaa,bbb", "severity" : "suggestion", "severity_cn" : "建议", "severity_en" : "Suggestion", "assignee" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "proposer" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "diff_file" : "@@ -0,0 +1,0 @@\n+7", "added_lines" : 1, "removed_lines" : 0 }, "status" : "success" }
共100000条