获取仓库贡献者
+根据commit ID获取blame信息
-示例:
curl -X GET \
--d "ref=master" \
--d "filepath=lib" \
-http://localhost:3000/api/yystopf/csfjkkj/contributors.json
-
await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
+curl -X GET http://localhost:3000/api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393b2ae693756a4781fab2/diff.json
+
await octokit.request('GET /api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393b2ae693756a4781fab2/diff.json')
HTTP 请求
-GET /api/:owner/:repo/contributors.json
+GET /api/v1/:owner/:repo/commits/:sha/diff.json
请求参数:
@@ -9720,18 +9720,11 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
项目标识identifier
-ref
-否
+sha
+是
string
-分支名称、tag名称或是提交记录id,默认为整个仓库
-
-
-filepath
-否
-
-string
-子目录名称,默认为空
+提交记录id
返回字段说明:
@@ -9743,34 +9736,149 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
-total_count
-integer
-贡献者数量
+file_nums
+int
+文件数量
-contributions
-integer
-贡献数量
+total_addition
+int
+新增行数
-login
+total_deletion
+int
+删除行数
+
+
+files.name
string
-用户登录名
+文件名称
-type
+files.oldname
string
-用户类型
+文件修改前名称
-name
-string
-用户昵称
+files.addition
+int
+文件新增行数
-image_url
+files.deletion
+int
+文件删除行数
+
+
+files.type
+int
+文件类型 1: 新增 2: 更改 3: 删除 4: 重命名 5: 复制
+
+
+files.is_created
+bool
+是否为新建文件
+
+
+files.is_deleted
+bool
+是否为删除文件
+
+
+files.is_bin
+bool
+是否为二进制文件
+
+
+files.is_lfs_file
+bool
+
+
+
+files.is_renamed
+bool
+是否重命名
+
+
+files.is_ambiguous
+bool
+
+
+
+files.is_submodule
+bool
+是否为子模块
+
+
+files.sections.file_name
string
-用户头像
+文件名称
+
+
+files.sections.name
+string
+
+
+
+files.sections.lines.left_index
+int
+
+
+
+files.sections.lines.right_index
+int
+
+
+
+files.sections.lines.match
+int
+
+
+
+files.sections.lines.type
+int
+
+
+
+files.sections.lines.content
+string
+
+
+
+files.sections.lines.section_path
+string
+
+
+
+files.sections.lines.section_last_left_index
+int
+
+
+
+files.sections.lines.section_last_right_index
+int
+
+
+
+files.sections.lines.section_left_index
+int
+
+
+
+files.sections.lines.section_right_index
+int
+
+
+
+files.sections.lines.section_left_hunk_size
+int
+
+
+
+files.sections.lines.section_right_hunk_size
+int
+
@@ -9778,39 +9886,75 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
返回的JSON示例:
{
- "contributors": [
+ "file_nums": 1,
+ "total_addition": 1,
+ "total_deletion": 0,
+ "files": [
{
- "contributions": 5,
- "login": "testforge2",
- "type": "User",
- "name": "testforge2",
- "image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png"
- },
- {
- "contributions": 79,
- "login": "yystopf",
- "type": "User",
- "name": "yystopf",
- "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
+ "name": "xinzeng3",
+ "oldname": "xinzeng3",
+ "addition": 1,
+ "deletion": 0,
+ "type": 1,
+ "is_created": true,
+ "is_deleted": false,
+ "is_bin": false,
+ "is_lfs_file": false,
+ "is_renamed": false,
+ "is_ambiguous": false,
+ "is_submodule": false,
+ "sections": [
+ {
+ "file_name": "xinzeng3",
+ "name": "",
+ "lines": [
+ {
+ "left_index": 0,
+ "right_index": 0,
+ "match": 0,
+ "type": 4,
+ "content": "@@ -0,0 +1 @@",
+ "section_path": "xinzeng3",
+ "section_last_left_index": 0,
+ "section_last_right_index": 0,
+ "section_left_index": 0,
+ "section_right_index": 1,
+ "section_left_hunk_size": 0,
+ "section_right_hunk_size": 0
+ },
+ {
+ "left_index": 0,
+ "right_index": 1,
+ "match": -1,
+ "type": 2,
+ "content": "+1111122222"
+ }
+ ]
+ }
+ ],
+ "is_incomplete": false,
+ "is_incomplete_line_too_long": false,
+ "is_protected": false
}
- ],
- "total_count": 2
+ ]
}
-获取仓库webhooks列表
-获取仓库webhooks列表
+获取比较提交blame
+根据分支名、标签、commit ID来获取代码对比blame
示例:
curl -X GET \
-http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
-
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json')
+-d "from=hh_ceshi" \
+-d "to=master" \
+http://localhost:3000/api/v1/yystopf/csfjkkj/compare.json
+
await octokit.request('GET /api/v1/yystopf/csfjkkj/compare.json')
HTTP 请求
-GET /api/v1/:owner/:repo/webhooks.json
+GET /api/v1/:owner/:repo/compare.json
请求参数:
@@ -9835,6 +9979,20 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
string
项目标识identifier
+
+from
+是
+
+string
+源分支、标签、commitID
+
+
+to
+是
+
+string
+目标分支、标签、commitID
+
返回字段说明:
@@ -9845,6 +10003,318 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
+commits_count
+int
+提交数量
+
+
+commits.branch
+string
+提交分支
+
+
+commits.author
+object
+提交作者
+
+
+commits.committer
+object
+提交者
+
+
+commits.commit_message
+string
+提交信息
+
+
+commits.sha
+string
+提交ID
+
+
+commits.parent_shas
+array
+提交父节点ID
+
+
+diff.file_nums
+int
+文件数量
+
+
+diff.total_addition
+int
+新增行数
+
+
+diff.total_deletion
+int
+删除行数
+
+
+diff.files.name
+string
+文件名称
+
+
+diff.files.oldname
+string
+文件修改前名称
+
+
+diff.files.addition
+int
+文件新增行数
+
+
+diff.files.deletion
+int
+文件删除行数
+
+
+diff.files.type
+int
+文件类型 1: 新增 2: 更改 3: 删除 4: 重命名 5: 复制
+
+
+diff.files.is_created
+bool
+是否为新建文件
+
+
+diff.files.is_deleted
+bool
+是否为删除文件
+
+
+diff.files.is_bin
+bool
+是否为二进制文件
+
+
+diff.files.is_lfs_file
+bool
+
+
+
+diff.files.is_renamed
+bool
+是否重命名
+
+
+diff.files.is_ambiguous
+bool
+
+
+
+diff.files.is_submodule
+bool
+是否为子模块
+
+
+diff.files.sections.file_name
+string
+文件名称
+
+
+diff.files.sections.name
+string
+
+
+
+diff.files.sections.lines.left_index
+int
+
+
+
+diff.files.sections.lines.right_index
+int
+
+
+
+diff.files.sections.lines.match
+int
+
+
+
+diff.files.sections.lines.type
+int
+
+
+
+diff.files.sections.lines.content
+string
+
+
+
+diff.files.sections.lines.section_path
+string
+
+
+
+diff.files.sections.lines.section_last_left_index
+int
+
+
+
+diff.files.sections.lines.section_last_right_index
+int
+
+
+
+diff.files.sections.lines.section_left_index
+int
+
+
+
+diff.files.sections.lines.section_right_index
+int
+
+
+
+diff.files.sections.lines.section_left_hunk_size
+int
+
+
+
+diff.files.sections.lines.section_right_hunk_size
+int
+
+
+
+
+
+返回的JSON示例:
+
+{
+ "commits_count": 1,
+ "last_commit_sha": "80dd40214a58622312393b2ae693756a4781fab2",
+ "commits": [
+ {
+ "author": {
+ "id": "2",
+ "login": "yystopf",
+ "name": "heh",
+ "type": "User",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ },
+ "committer": {
+ "id": "2",
+ "login": "yystopf",
+ "name": "heh",
+ "type": "User",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ },
+ "branch": "",
+ "commit_message": "x拟增\n\nSigned-off-by: yystopf <yystopf@163.com>",
+ "sha": "7e4d8bb3c28e24d4cd6b205f2eed32513e937524",
+ "parent_shas": null
+ }
+ ],
+ "diff": {
+ "file_nums": 1,
+ "total_addition": 1,
+ "total_deletion": 0,
+ "files": [
+ {
+ "name": "ceshi123",
+ "oldname": "ceshi123",
+ "addition": 1,
+ "deletion": 0,
+ "type": 1,
+ "is_created": true,
+ "is_deleted": false,
+ "is_bin": false,
+ "is_lfs_file": false,
+ "is_renamed": false,
+ "is_ambiguous": false,
+ "is_submodule": false,
+ "sections": [
+ {
+ "file_name": "ceshi123",
+ "name": "",
+ "lines": [
+ {
+ "left_index": 0,
+ "right_index": 0,
+ "match": 0,
+ "type": 4,
+ "content": "@@ -0,0 +1 @@",
+ "section_path": "ceshi123",
+ "section_last_left_index": 0,
+ "section_last_right_index": 0,
+ "section_left_index": 0,
+ "section_right_index": 1,
+ "section_left_hunk_size": 0,
+ "section_right_hunk_size": 0
+ },
+ {
+ "left_index": 0,
+ "right_index": 1,
+ "match": -1,
+ "type": 2,
+ "content": "+1111122222"
+ }
+ ]
+ }
+ ],
+ "is_incomplete": false,
+ "is_incomplete_line_too_long": false,
+ "is_protected": false
+ }
+ ]
+ }
+}
+
+
+获取仓库webhooks列表
+获取仓库webhooks列表
+
+
+示例:
+
+curl -X GET \
+http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
+
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json')
+
HTTP 请求
+GET /api/v1/:owner/:repo/webhooks.json
+请求参数:
+
+
+参数
+必选
+默认
+类型
+字段说明
+
+
+
+owner
+是
+
+string
+用户登录名
+
+
+repo
+是
+
+string
+项目标识identifier
+
+
+返回字段说明:
+
+
+参数
+类型
+字段说明
+
+
+
id
int
id
@@ -9929,9 +10399,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
curl -X GET \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/webhooks/:id.json
-请求参数:
+请求参数:
参数
@@ -9963,7 +10433,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
webhook ID
-返回字段说明:
+返回字段说明:
参数
@@ -10086,214 +10556,8 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
curl -X POST \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
await octokit.request('POST /api/v1/yystopf/ceshi/webhooks.json')
-
HTTP 请求
-POST /api/v1/:owner/:repo/webhooks.json
-请求参数:
-
-
-参数
-必选
-默认
-类型
-字段说明
-
-
-
-owner
-是
-
-string
-用户登录名
-
-
-repo
-是
-
-string
-项目标识identifier
-
-
-webhook.url
-是
-
-string
-目标url
-
-
-webhook.http_method
-是
-
-string
-http方法, POST和GET
-
-
-webhook.content_type
-是
-
-string
-POST Content Type
-
-
-webhook.secret
-否
-
-string
-密钥文本
-
-
-webhook.active
-是
-
-bool
-是否激活
-
-
-webhook.branch_filter
-否
-
-string
-分支过滤
-
-
-webhook.events
-否
-
-array
-触发事件
-
-
-
-触发事件字段说明
-
-
-
-参数
-含义
-
-
-
-create
-创建分支或标签
-
-
-delete
-分支或标签删除
-
-
-push
-git仓库推送
-
-
-pull_request
-合并请求
-
-
-pull_request_assign
-合并请求被指派
-
-
-pull_request_review_approved
-合并请求被批准
-
-
-pull_request_review_rejected
-合并请求被拒绝
-
-
-
-
-请求的JSON示例:
-
-{
- "active": true,
- "content_type": "json",
- "http_method": "GET",
- "secret": "123456",
- "url": "http://localhost:10000",
- "branch_filter": "*",
- "events": ["push"]
-}
-
返回字段说明:
-
-
-参数
-类型
-字段说明
-
-
-
-id
-int
-id
-
-
-url
-string
-地址
-
-
-content_type
-string
-POST Content Type
-
-
-is_active
-bool
-是否激活
-
-
-type
-string
-类型
-
-
-events
-array
-触发事件
-
-
-create_time
-string
-创建时间
-
-
-
-
-返回的JSON示例:
-
-{
- "id": 68,
- "content_type": "json",
- "http_method": "GET",
- "url": "http://127.0.0.1:3000",
- "events": [
- "create",
- "delete",
- "push",
- "pull_request",
- "pull_request_assign",
- "pull_request_review_approved",
- "pull_request_review_rejected"
- ],
- "active": true,
- "branch_filter": "*",
- "created_at": "2022-06-23 15:52"
-}
-
-
-更新仓库webhook
-更新仓库webhook
-
-
-示例:
-
-curl -X PATCH \
-http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
-
await octokit.request('PATCH /api/v1/yystopf/ceshi/webhooks/7.json')
HTTP 请求
-PATCH /api/v1/:owner/:repo/webhooks/68.json
+POST /api/v1/:owner/:repo/webhooks.json
请求参数:
@@ -10319,13 +10583,6 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
项目标识identifier
-id
-是
-
-string
-webhook id
-
-
webhook.url
是
@@ -10427,6 +10684,219 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
"events": ["push"]
}
返回字段说明:
+
+
+参数
+类型
+字段说明
+
+
+
+id
+int
+id
+
+
+url
+string
+地址
+
+
+content_type
+string
+POST Content Type
+
+
+is_active
+bool
+是否激活
+
+
+type
+string
+类型
+
+
+events
+array
+触发事件
+
+
+create_time
+string
+创建时间
+
+
+
+
+返回的JSON示例:
+
+{
+ "id": 68,
+ "content_type": "json",
+ "http_method": "GET",
+ "url": "http://127.0.0.1:3000",
+ "events": [
+ "create",
+ "delete",
+ "push",
+ "pull_request",
+ "pull_request_assign",
+ "pull_request_review_approved",
+ "pull_request_review_rejected"
+ ],
+ "active": true,
+ "branch_filter": "*",
+ "created_at": "2022-06-23 15:52"
+}
+
+
+更新仓库webhook
+更新仓库webhook
+
+
+示例:
+
+curl -X PATCH \
+http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
+
await octokit.request('PATCH /api/v1/yystopf/ceshi/webhooks/7.json')
+
HTTP 请求
+PATCH /api/v1/:owner/:repo/webhooks/68.json
+请求参数:
+
+
+参数
+必选
+默认
+类型
+字段说明
+
+
+
+owner
+是
+
+string
+用户登录名
+
+
+repo
+是
+
+string
+项目标识identifier
+
+
+id
+是
+
+string
+webhook id
+
+
+webhook.url
+是
+
+string
+目标url
+
+
+webhook.http_method
+是
+
+string
+http方法, POST和GET
+
+
+webhook.content_type
+是
+
+string
+POST Content Type
+
+
+webhook.secret
+否
+
+string
+密钥文本
+
+
+webhook.active
+是
+
+bool
+是否激活
+
+
+webhook.branch_filter
+否
+
+string
+分支过滤
+
+
+webhook.events
+否
+
+array
+触发事件
+
+
+
+触发事件字段说明
+
+
+
+参数
+含义
+
+
+
+create
+创建分支或标签
+
+
+delete
+分支或标签删除
+
+
+push
+git仓库推送
+
+
+pull_request
+合并请求
+
+
+pull_request_assign
+合并请求被指派
+
+
+pull_request_review_approved
+合并请求被批准
+
+
+pull_request_review_rejected
+合并请求被拒绝
+
+
+
+
+请求的JSON示例:
+
+{
+ "active": true,
+ "content_type": "json",
+ "http_method": "GET",
+ "secret": "123456",
+ "url": "http://localhost:10000",
+ "branch_filter": "*",
+ "events": ["push"]
+}
+
返回字段说明:
返回的JSON示例:
@@ -10461,9 +10931,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
curl -X DELETE \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
await octokit.request('DELETE /api/v1/yystopf/ceshi/webhooks/7.json')
-
HTTP 请求
+HTTP 请求
DELETE /api/v1/:owner/:repo/webhooks/:id.json
-请求参数:
+请求参数:
参数
@@ -10495,7 +10965,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
webhook id
-返回字段说明:
+返回字段说明:
返回的JSON示例:
@@ -10516,9 +10986,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
curl -X GET \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3/hooktasks.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/webhooks/:id/hooktasks.json
-请求参数:
+请求参数:
参数
@@ -10550,7 +11020,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
webhook ID
-返回字段说明:
+返回字段说明:
参数
@@ -10787,9 +11257,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
curl -X POST \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/tests.json
await octokit.request('POST /api/v1/yystopf/ceshi/webhooks/3/tests.json')
-
HTTP 请求
+HTTP 请求
POST /api/v1/:owner/:repo/webhooks/:id/tests.json
-请求参数:
+请求参数:
参数
@@ -10821,7 +11291,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/tests.json
webhook ID
-返回字段说明:
+返回字段说明:
返回的JSON示例: