华为云用户手册

  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result CreateCommitResponseBody object 差异列表 status String 响应状态 表6 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表7 CreateCommitResponseBody 参数 参数类型 描述 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 统计信息 表8 stats 参数 参数类型 描述 additions Integer 变更增加的行数 deletions Integer 变更删除的行数 total Integer 变更的总行数
  • 响应示例 状态码: 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 } }, "status" : "success"}
  • 请求示例 POST https://{endpoint}/v2/projects/859341/repository/commits{ "branch" : "master", "commit_message" : "some commit message", "actions" : [ { "action" : "create", "file_path" : "test001.txt", "content" : "some content" } ]}
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 branch 是 String 目标分支 commit_message 是 String 提交信息 start_branch 否 String 创建分支时,新的分支名 actions 是 Array of CommitAction objects 提交处理列表 author_email 否 String 提交作者的电子邮件地址 author_name 否 String 提交作者的名称 stats 否 Boolean 是否包括提交统计信息。默认值为true force 否 Boolean 是否覆盖目标分支。当true时,使用基于start_branch的新提交覆盖目标分支 表4 CommitAction 参数 是否必选 参数类型 描述 action 是 String 要执行的操作:create、delete、move、update、chmod file_path 是 String 文件的完整路径。例如lib/class.rb previous_path 否 String 要移动的文件的原始完整路径。例如lib/class1.rb。仅在move操作时生效 content 否 String 文件内容,create和update操作时必须。未指定内容的移动操作将保留现有文件内容,内容的任何其他值将覆盖文件内容。 encoding 否 String 文件编码:text、base64。默认为text last_commit_id 否 String 最后一个已知的提交ID。仅在update、move、delete操作时生效 execute_filemode 否 Boolean 启用或者禁用文件的执行模式。仅在chmod操作时生效
  • URI DELETE /v1/repositories/{group_name}/{repository_name}/hooks/{hook_id} 表1 路径参数 参数 是否必选 参数类型 描述 group_name 是 String 组名(克隆地址中域名后面项目名前的一段 示例:git@repo.alpha.devcloud.inhuawei.com:Demo00228/testword.git 组名:Demo00228 ) hook_id 是 Integer 通过id删除指定仓库的hook repository_name 是 String 仓库名
  • 响应参数 状态码: 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 仓库预览地址
  • 响应示例 状态码: 200 OK { "result" : { "repos" : [ { "uuid" : "36f532939c4b4e2191c10f5353ccf34c", "repo_id" : 487773, "repo_name" : "DDDDDDDD", "ssh_url" : "git@codehub.alpha.devcloud.inhuawei.com:CHEN_TEST00001/DDDDDDDD.git", "code_url" : "https://codehub.alpha.devcloud.inhuawei.com/CHEN_TEST00001/DDDDDDDD.git", "detail_url" : "https://alpha.devcloud.inhuawei.com/codehub/487773/home" } ], "total_count" : 100 }, "status" : "success"}
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result BranchResponse object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 BranchResponse 参数 参数类型 描述 branches Array of BranchesItem objects 分支信息 total Double 总数 表7 BranchesItem 参数 参数类型 描述 commit CommitV2 object 提交信息 diverging_commit_counts DivergingCommitCounts object 提交差异数量 name String 分支名 表8 CommitV2 参数 参数类型 描述 committed_date String 提交时间 committer_name String 提交者 id String 提交id message String 提交信息 short_id String 提交短id title String 提交标题 表9 DivergingCommitCounts 参数 参数类型 描述 ahead Double 领先提交数 behind Double 滞后提交数
  • 响应示例 状态码: 200 OK { "result" : { "total" : 1, "branches" : [ { "name" : "master", "commit" : { "id" : "2912b8f2328e798f7d544272ffaebfccccb598ab", "title" : "Initial commit", "message" : "Initial commit", "committed_date" : "2021-12-06T09:24:50.000+08:00", "short_id" : "2912b8f2", "committer_name" : "repo" }, "diverging_commit_counts" : { "behind" : 0, "ahead" : 0 } } ] }, "status" : "success"}
  • 响应示例 状态码: 200 OK { "result" : { "id" : "dadb20863d7d4ef8bc0b4740db7358be", "repoId" : "472210", "name" : "testword", "sshUrl" : "git@codehub.alpha.devcloud.inhuawei.com:Demo00228/testword.git", "httpUrl" : "https://codehub.alpha.devcloud.inhuawei.com/Demo00228/testword.git", "groupName" : "Demo00228", "webUrl" : "https://alpha.devcloud.inhuawei.com/codehub/472210/home", "visibilityLevel" : 0, "createAt" : "2019-10-21 17:49:33", "projectId" : "4838955a48e2492bbe44b31bc4c272f6", "projectIsDelete" : "false" }, "status" : "success"}
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result RepoInfo object 响应结果 status String 响应状态 表4 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表5 RepoInfo 参数 参数类型 描述 createAt String 创建时间 groupName String 仓库组名(克隆地址中域名后面项目名前的一段 示例:git@codehub.alpha.devcloud.inhuawei.com:Demo00228/testword.git 组名:Demo00228) httpUrl String https url id String 仓库uuid(由CreateRepository接口返回) 最小长度:32 最大长度:32 name String 仓库名 最小长度:2 最大长度:128 projectId String 项目的uuid 最小长度:32 最大长度:32 projectIsDelete String 项目是否被删除 repoId String 仓库主键id 最小长度:1 最大长度:40 sshUrl String ssh url visibilityLevel Integer 是否可见:0私有仓库,20公有仓库 webUrl String web url 访问路径
  • 响应示例 状态码: 200 OK { "result" : [ { "file_name" : "README.md", "file_path" : "README.md", "size" : 666, "encoding" : "base64", "ref" : "master", "blob_id" : "75c19b5b1904a72c8a9959c98ae6884d0ace0279", "file_type" : "text/plain; charset=utf-8", "content" : "RUVFRUVFRUU=" } ], "status" : "success"}
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result FilesResponseInfo object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 FilesResponseInfo 参数 参数类型 描述 file_name String 文件名称 file_path String 文件路径 size String 文件大小 encoding String 编码类型 ref String 分支名称 blob_id String 文件块id file_type String 文件类型 content String 文件内容
  • 响应示例 状态码: 200 OK { "result" : { "total" : 1, "repositorys" : [ { "id" : "d0457f74cc5b43d989ded7248f71b4e5", "repoId" : "468480", "name" : "CreatRepository_2qD5i", "sshUrl" : "git@codehub.alpha.devcloud.inhuawei.com:Demo00228/CreatRepository_2qD5i.git", "httpUrl" : "https://codehub.alpha.devcloud.inhuawei.com/Demo00228/CreatRepository_2qD5i.git", "groupName" : "Demo00228", "webUrl" : "https://alpha.devcloud.inhuawei.com/codehub/468480/home", "visibilityLevel" : 0, "createAt" : "2019-10-15 09:40:26", "projectId" : "4838955a48e2492bbe44b31bc4c272f6", "projectIsDelete" : "false" } ], "status" : "success" }}
  • URI GET /v1/projects/{project_uuid}/repositories 表1 路径参数 参数 是否必选 参数类型 描述 project_uuid 是 String 项目的uuid 表2 Query参数 参数 是否必选 参数类型 描述 page_index 否 Integer 分页索引,从1开始计数 page_size 否 Integer 每页条目数 search 否 String 搜索关键字
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result RepoListInfo object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 RepoListInfo 参数 参数类型 描述 repositorys Array of RepoInfo objects 仓库列表 total Integer 仓库总数 表7 RepoInfo 参数 参数类型 描述 createAt String 创建时间 groupName String 仓库组名 httpUrl String https url id String 仓库uuid 最小长度:32 最大长度:32 name String 仓库名 最小长度:2 最大长度:128 projectId String 项目的uuid 最小长度:32 最大长度:32 projectIsDelete String 项目是否被删除 repoId String 仓库主键id 最小长度:1 最大长度:40 sshUrl String ssh url visibilityLevel Integer 是否可见:0私有仓库,20公有仓库 webUrl String web url 访问路径
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result Array of CommitInfo objects 提交列表 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 CommitInfo 参数 参数类型 描述 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 作者提交时间
  • 响应示例 状态码: 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 }, { "id" : "5c114bb316dff4d4a046e09a5c44c816f2433140", "title" : "更新README.md", "message" : "更新README.md", "short_id" : "5c114bb3", "author_name" : "repo", "author_email" : null, "committer_name" : "repo", "committer_email" : null, "created_at" : "2021-08-26T12:02:58.000Z", "parent_ids" : [ "646fc72bd87eb02e1e84bf3b82179c7f6d22c2c2" ], "committed_date" : "2021-08-26T12:02:58.000Z", "authored_date" : null } ], "status" : "success"}
  • URI GET /v2/projects/{repo_id}/repository/commits 表1 路径参数 参数 是否必选 参数类型 描述 repo_id 是 Integer 仓库短id 表2 Query参数 参数 是否必选 参数类型 描述 ref_name 否 String 仓库的branch名或tag名,如果为空则查询默认分支 since 否 String 在此日期之后或当天提交,格式 YYYY-MM-DDTHH:MM:SSZ until 否 String 在此日期之前或当天提交,格式 YYYY-MM-DDTHH:MM:SSZ path 否 String 文件路径 all 否 Boolean 是否检索仓库中每个提交 with_stats 否 Boolean 有关每个提交的统计信息是否添加到响应中 page 否 Integer 页码 最小值:1 最大值:2147483647 per_page 否 Integer 每页条目数 最小值:1 最大值:100
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result TemplateRepositoryList object 响应结果 status String 响应状态 表4 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表5 TemplateRepositoryList 参数 参数类型 描述 projects Array of TemplateRepository objects 模板列表 total Integer 模板总数 表6 TemplateRepository 参数 参数类型 描述 id Integer 模板唯一标识 name String 模板名称 template_name String 模板关联仓库名称 tags Array of strings 模板标签 description String 模板描述 brief_introduction String 模板简介 auto_pending_pipelines Integer 是否自动创建流水线 language String 模板语言分类 created_at String 模板创建时间 used_times Integer 模板引用次数 liked_times Integer 模板被点赞次数 creator_name String 模板创建人 https_url String 模板https链接
  • 响应示例 状态码: 200 OK { "result" : { "projects" : [ { "id" : 453613, "name" : "javaMavenDemo", "template_name" : "javaMavenDemo", "tags" : [ "UnsupportedPipeline", "OTHERS", "鲲鹏 ARM64" ], "description" : "javaMavenDemo", "brief_introduction" : "javaMavenDemo", "auto_pending_pipelines" : 0, "language" : "OTHERS", "created_at" : "Sep 25, 2019 4:03:31 PM", "used_times" : 58, "liked_times" : 1, "creator_name" : "Codehub", "https_url" : "https://codehub.alpha.devcloud.inhuawei.com/chentest00001/javaMavenDemo.git" } ], "total" : 100 }, "status" : "success"}
  • URI GET /v1/repositories/repository_templates 表1 Query参数 参数 是否必选 参数类型 描述 platform 否 String 模板平台类型 language 否 String 语言类型 pipeline 否 String 是否支持流水线 entertype 否 String 模板分类 search 否 String 模板名称 dateorder 否 String 模板日期排序 usedtimeorder 否 String 模板引用次数排序 type 否 String 模板公开类型 region 否 String 大区名称 page_no 是 Integer 分页页数 page_size 是 Integer 每页数据数
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result RepoCommitStatistics object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 RepoCommitStatistics 参数 参数类型 描述 all_branch_commits_count Integer 仓库总提交次数 codelines Array of RepoDailyCodeline objects 近15日每日代码提交行数 count Integer 对应分支仓库总提交次数 event RepoStatisticsEvent object 仓库统计状态 statistics Array of RepoStatistics objects 仓库统计列表 total Integer 仓库统计次数 表7 RepoDailyCodeline 参数 参数类型 描述 additions Integer 每日增加代码行 date String 日期 deletions Integer 每日删除代码行 表8 RepoStatisticsEvent 参数 参数类型 描述 branch String 分支名 最小长度:1 最大长度:260 created_at String 仓库统计创建的时间 date String 仓库统计的日期 id Integer 仓库统计事件的id project_id Integer 仓库id status String 仓库统计的状态: 等待统计waiting 正在统计active 完成统计finish updated_at String 仓库统计更新的时间 user_id Integer 用户id 表9 RepoStatistics 参数 参数类型 描述 add_lines Integer 添加代码行 branch String 分支名 最小长度:1 最大长度:260 commit_count Integer 提交次数 created_at String 仓库统计创建的时间 delete_lines Integer 删除代码行 id Integer 仓库统计记录id project_id Integer 仓库id updated_at String 仓库统计更新的时间 user_name String 用户名
  • 响应示例 状态码: 200 OK { "result" : { "event" : null, "total" : 0, "statistics" : [ ], "all_branch_commits_count" : 1, "count" : 1, "codelines" : { "additions" : 0, "deletions" : 0, "date" : "20191015" } }, "status" : "success"}
  • 响应示例 状态码: 200 OK { "result" : { "hooks" : [ { "id" : 2111600786, "project_id" : 2111615967, "created_at" : "2021-11-09 16:35:15", "enable_ssl_verification" : false, "push_events" : true, "tag_push_events" : false, "repository_update_events" : false, "merge_requests_events" : false, "issues_events" : false, "note_events" : false, "pipeline_events" : false, "wiki_page_events" : false } ] }, "status" : "success"}
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result RepoListHook object 响应结果 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 RepoListHook 参数 参数类型 描述 hooks Array of RepoHook objects hook列表 表7 RepoHook 参数 参数类型 描述 build_events Boolean 是否触发build_events事件 created_at String 仓库统计创建的时间 enable_ssl_verification Boolean 是否使用ssl验证 id Integer hook id issues_events Boolean 是否触发issues_events事件 merge_requests_events Boolean 是否触发merge_requests_events事件 note_events Boolean 是否触发note_events事件 pipeline_events Boolean 是否触发pipeline_events事件 project_id Integer 仓库id push_events Boolean 是否触发push_events事件 repository_update_events Boolean 是否触发repository_update_events事件 tag_push_events Boolean 是否触发tag_push_events事件 wiki_page_events Boolean 是否触发wiki_page_events事件
  • URI GET /v1/repositories/{group_name}/{repository_name}/hooks 表1 路径参数 参数 是否必选 参数类型 描述 group_name 是 String 组名(克隆地址中域名后面项目名前的一段 示例:git@repo.alpha.devcloud.inhuawei.com:Demo00228/testword.git 组名:Demo00228 ) repository_name 是 String 仓库名 表2 Query参数 参数 是否必选 参数类型 描述 hook_id 否 String hook id
  • 响应示例 状态码: 200 OK { "result" : { "size" : 9, "encoding" : "base64", "ref" : "master", "content" : "NDU0NTQ1NDQ1", "file_name" : "README.md", "file_path" : "README.md", "content_sha256" : "e16f4f6c41a79d120484774a625bea8a3c3dcb655aa7c7e793ac48639dc63944", "blob_id" : "3325fa3142fd66fedc8c3a5218b417f561e0ea2f", "commit_id" : "a772945ec2765e322cc83e0f467f394effa22cf3", "last_commit_id" : "a772945ec2765e322cc83e0f467f394effa22cf3" }, "status" : "success"}
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 error Error object 响应错误 result FileContentInfo object 文件详情 status String 响应状态 表5 Error 参数 参数类型 描述 code String 错误码 message String 错误信息 表6 FileContentInfo 参数 参数类型 描述 file_name String 文件名 file_path String 文件路径 size Integer 文件大小 encoding String 文件编码 content_sha256 String sha256编码的文件内容 ref String 分支名 blob_id String blob sha commit_id String 提交对应的SHA id last_commit_id String 最后一个提交对应的SHA id content String base64编码的文件内容
  • 响应示例 状态码: 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"}
共100000条