From b8d4b15b40b98688715ab287c798017e6967c6fb Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 15 Jul 2022 14:40:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v1/projects/branches_controller.rb | 3 +- .../slate/source/includes/_repositories.md | 99 ++++++++++++++++++- .../v1/projects/branches/all_list_service.rb | 3 +- .../_simple_gitea_detail.json.jbuilder | 7 +- 4 files changed, 101 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/v1/projects/branches_controller.rb b/app/controllers/api/v1/projects/branches_controller.rb index d7f66d749..bc4919616 100644 --- a/app/controllers/api/v1/projects/branches_controller.rb +++ b/app/controllers/api/v1/projects/branches_controller.rb @@ -1,5 +1,5 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController - before_action :require_public_and_member_above, only: [:index] + before_action :require_public_and_member_above, only: [:all] def all @result_object = Api::V1::Projects::Branches::AllListService.call(@project, current_user&.gitea_token) @@ -9,7 +9,6 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController def create @result_object = Api::V1::Projects::Branches::CreateService.call(@project, branch_params, current_user&.gitea_token) - puts @result_object end private diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md index f0a64a60d..624afd5b1 100644 --- a/app/docs/slate/source/includes/_repositories.md +++ b/app/docs/slate/source/includes/_repositories.md @@ -409,21 +409,21 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json') ``` -## 仓库分支列表 -仓库分支列表 +## 仓库所有分支列表 +仓库所有分支列表 > 示例: ```shell -curl -X GET http://localhost:3000/api/yystopf/csfjkkj/branches.json +curl -X GET http://localhost:3000/api/v1/yystopf/csfjkkj/branches/all.json ``` ```javascript -await octokit.request('GET /api/yystopf/csfjkkj/branches.json') +await octokit.request('GET /api/v1/yystopf/csfjkkj/branches/all.json') ``` ### HTTP 请求 -`GET /api/:owner/:repo/branches.json` +`GET /api/v1/:owner/:repo/branches/all.json` ### 请求参数: 参数 | 必选 | 默认 | 类型 | 字段说明 @@ -466,6 +466,95 @@ await octokit.request('GET /api/yystopf/csfjkkj/branches.json') ] ``` +## 仓库创建分支 +为仓库创建一个新的分支 + +> 示例: + +```shell +curl -X POST http://localhost:3000/api/v1/yystopf/csfjkkj/branches.json +``` + +```javascript +await octokit.request('POST /api/v1/yystopf/csfjkkj/branches.json') +``` + +### HTTP 请求 +`POST /api/v1/:owner/:repo/branches.json` + +### 请求参数: +参数 | 必选 | 默认 | 类型 | 字段说明 +--------- | ------- | ------- | -------- | ---------- +|owner |是| |string |用户登录名 | +|repo |是| |string |项目标识identifier | +|new_branch_name|是||string| 新分支名称| +|old_branch_name|否||string| 来源分支名称| + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|name |string|分支名称| +|commit.id |string|提交ID| +|commit.message |string|提交信息| +|commit.author.id |string|提交作者ID| +|commit.author.login |string|提交作者标识| +|commit.author.name |string|提交作者名称| +|commit.author.type |string|提交作者类型| +|commit.committer.id |string|提交者ID| +|commit.committer.login |string|提交者标识| +|commit.committer.name |string|提交者名称| +|commit.committer.type |string|提交者类型| +|commit.committer.image_url|string|提交者头像| +|commit.time_ago |string|分支最新提交时间距现在时间差| +|commit.timestamp |string|分支最新提交时间| +|protected |bool |是否为保护分支| +|user_can_push |bool |当前用户是否能提交| +|user_can_merge |bool |当前用户是否能合并| +|commit_id |string|提交ID| +|commit_time_from_now |string|分支最新提交时间距现在时间差| +|commit_time |string|分支最新提交时间| +|http_url |string|分支http地址| +|zip_url |string|分支zip包下载地址| +|tar_url |string|分支tar包下载地址| + +> 返回的JSON示例: + +```json +{ + "name": "new_branch_8", + "commit": { + "id": "80dd40214a58622312393b2ae693756a4781fab2", + "message": "x拟增\n\nSigned-off-by: yystopf ", + "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" + }, + "time_ago": "1天前", + "timestamp": "2022-07-13T09:54:15Z" + }, + "protected": false, + "user_can_push": true, + "user_can_merge": true, + "commit_id": "80dd40214a58622312393b2ae693756a4781fab2", + "commit_time_from_now": "1天前", + "commit_time": "2022-07-13T09:54:15Z", + "default_branch": "master", + "http_url": "http://127.0.0.1:10081/yystopf/ceshi_hook.git", + "zip_url": "http://localhost:3000/api/yystopf/ceshi_hook/archive/new_branch_8.zip", + "tar_url": "http://localhost:3000/api/yystopf/ceshi_hook/archive/new_branch_8.tar.gz" +} +``` + ## 仓库贡献者列表 仓库贡献者列表 diff --git a/app/services/api/v1/projects/branches/all_list_service.rb b/app/services/api/v1/projects/branches/all_list_service.rb index fd942288f..9e97b6dd2 100644 --- a/app/services/api/v1/projects/branches/all_list_service.rb +++ b/app/services/api/v1/projects/branches/all_list_service.rb @@ -16,12 +16,11 @@ class Api::V1::Projects::Branches::AllListService < ApplicationService $gitea_client.token = nil unless token.blank? gitea_data - rescue - raise Error, "服务器错误,请联系系统管理员!" end private def load_gitea_data @gitea_data = $gitea_client.get_repos_branch_name_set_by_owner_repo(owner, repo) + raise Error, '获取所有分支失败!' unless @gitea_data.is_a?(Hash) end end \ No newline at end of file diff --git a/app/views/api/v1/projects/branches/_simple_gitea_detail.json.jbuilder b/app/views/api/v1/projects/branches/_simple_gitea_detail.json.jbuilder index 9fee552d4..70fac8238 100644 --- a/app/views/api/v1/projects/branches/_simple_gitea_detail.json.jbuilder +++ b/app/views/api/v1/projects/branches/_simple_gitea_detail.json.jbuilder @@ -18,6 +18,9 @@ json.protected branch['protected'] json.user_can_push branch['user_can_push'] json.user_can_merge branch['user_can_merge'] json.commit_id branch['commit_id'] -json.commit_time_from_now branch['commit_time'] +json.commit_time_from_now time_from_now(branch['commit_time'].to_time) json.commit_time branch['commit_time'] -json.default_branch branch['default_branch'] \ No newline at end of file +json.default_branch branch['default_branch'] +json.http_url render_http_url(@project) +json.zip_url render_zip_url(@owner, @project.repository, branch['name']) +json.tar_url render_tar_url(@owner, @project.repository, branch['name']) \ No newline at end of file From bd3cbf33fd76713ff46d78de1243273368e9233a Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 15 Jul 2022 14:41:00 +0800 Subject: [PATCH 2/2] fix --- public/docs/api.html | 911 ++++++++++++++++++++++++++----------------- 1 file changed, 562 insertions(+), 349 deletions(-) diff --git a/public/docs/api.html b/public/docs/api.html index 86560740d..e9091591e 100644 --- a/public/docs/api.html +++ b/public/docs/api.html @@ -503,7 +503,10 @@ 仓库标签列表
  • - 仓库分支列表 + 仓库所有分支列表 +
  • +
  • + 仓库创建分支
  • 仓库贡献者列表 @@ -7798,16 +7801,16 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat } } ] -

    仓库分支列表

    -

    仓库分支列表

    +

    仓库所有分支列表

    +

    仓库所有分支列表

    示例:

    -
    curl -X GET http://localhost:3000/api/yystopf/csfjkkj/branches.json
    -
    await octokit.request('GET /api/yystopf/csfjkkj/branches.json')
    +
    curl -X GET http://localhost:3000/api/v1/yystopf/csfjkkj/branches/all.json
    +
    await octokit.request('GET /api/v1/yystopf/csfjkkj/branches/all.json')
     

    HTTP 请求

    -

    GET /api/:owner/:repo/branches.json

    +

    GET /api/v1/:owner/:repo/branches/all.json

    请求参数:

    @@ -7886,16 +7889,16 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat "tar_url": "http://localhost:3000/api/yystopf/hahahah/archive/touch-100.tar.gz" } ] -

    仓库贡献者列表

    -

    仓库贡献者列表

    +

    仓库创建分支

    +

    为仓库创建一个新的分支

    示例:

    -
    curl -X GET http://localhost:3000/api/yystopf/csfjkkj/contributors.json
    -
    await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
    +
    curl -X POST http://localhost:3000/api/v1/yystopf/csfjkkj/branches.json
    +
    await octokit.request('POST /api/v1/yystopf/csfjkkj/branches.json')
     

    HTTP 请求

    -

    GET /api/:owner/:repo/contributors.json

    +

    POST /api/v1/:owner/:repo/branches.json

    请求参数:

    @@ -7920,6 +7923,20 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat + + + + + + + + + + + + + +
    string 项目标识identifier
    new_branch_name是||string新分支名称
    old_branch_name否|string来源分支名称

    返回字段说明:

    @@ -7930,6 +7947,202 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    namestring分支名称
    commit.idstring提交ID
    commit.messagestring提交信息
    commit.author.idstring提交作者ID
    commit.author.loginstring提交作者标识
    commit.author.namestring提交作者名称
    commit.author.typestring提交作者类型
    commit.committer.idstring提交者ID
    commit.committer.loginstring提交者标识
    commit.committer.namestring提交者名称
    commit.committer.typestring提交者类型
    commit.committer.image_urlstring提交者头像
    commit.time_agostring分支最新提交时间距现在时间差
    commit.timestampstring分支最新提交时间
    protectedbool是否为保护分支
    user_can_pushbool当前用户是否能提交
    user_can_mergebool当前用户是否能合并
    commit_idstring提交ID
    commit_time_from_nowstring分支最新提交时间距现在时间差
    commit_timestring分支最新提交时间
    http_urlstring分支http地址
    zip_urlstring分支zip包下载地址
    tar_urlstring分支tar包下载地址
    + +
    +

    返回的JSON示例:

    +
    +
    {
    +    "name": "new_branch_8",
    +    "commit": {
    +        "id": "80dd40214a58622312393b2ae693756a4781fab2",
    +        "message": "x拟增\n\nSigned-off-by: yystopf <yystopf@163.com>",
    +        "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"
    +        },
    +        "time_ago": "1天前",
    +        "timestamp": "2022-07-13T09:54:15Z"
    +    },
    +    "protected": false,
    +    "user_can_push": true,
    +    "user_can_merge": true,
    +    "commit_id": "80dd40214a58622312393b2ae693756a4781fab2",
    +    "commit_time_from_now": "1天前",
    +    "commit_time": "2022-07-13T09:54:15Z",
    +    "default_branch": "master",
    +    "http_url": "http://127.0.0.1:10081/yystopf/ceshi_hook.git",
    +    "zip_url": "http://localhost:3000/api/yystopf/ceshi_hook/archive/new_branch_8.zip",
    +    "tar_url": "http://localhost:3000/api/yystopf/ceshi_hook/archive/new_branch_8.tar.gz"
    +}
    +

    仓库贡献者列表

    +

    仓库贡献者列表

    + +
    +

    示例:

    +
    +
    curl -X GET http://localhost:3000/api/yystopf/csfjkkj/contributors.json
    +
    await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
    +

    HTTP 请求

    +

    GET /api/:owner/:repo/contributors.json

    +

    请求参数:

    + + + + + + + + + + + + + + + + + + + + + + + +
    参数必选默认类型字段说明
    ownerstring用户登录名
    repostring项目标识identifier
    +

    返回字段说明:

    + + + + + + + + @@ -7986,9 +8199,9 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
    curl -X GET http://localhost:3000/api/yystopf/csfjkkj/languages.json
     
    await octokit.request('GET /api/yystopf/csfjkkj/languages.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/languages.json

    -

    请求参数:

    +

    请求参数:

    参数类型字段说明
    list.contributions int 贡献者commit数量
    @@ -8013,7 +8226,7 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
    参数项目标识identifier
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8050,9 +8263,9 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
    curl -X GET http://localhost:3000/api/jasder/jasder_test/edit.json
     
    await octokit.request('GET /api/jasder/jasder_test/edit.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/edit.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8077,7 +8290,7 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
    参数项目标识identifier
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8154,9 +8367,9 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat -d"private=true"\ http://localhost:3000/api/jasder/jasder_test.json
    await octokit.request('PATCH /api/jasder/jasder_test.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PATCH /api/:owner/:repo

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8216,7 +8429,7 @@ http://localhost:3000/api/jasder/jasder_test.json
    参数项目是否私有, true:为私有,false: 公开,默认为公开
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8281,9 +8494,9 @@ http://localhost:3000/api/jasder/jasder_test.json
    curl -X DELETE http://localhost:3000/api/jasder/jasder_test.json
     
    await octokit.request('DELETE /api/jasder/jasder_test.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PATCH /api/:owner/:repo

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8308,7 +8521,7 @@ http://localhost:3000/api/jasder/jasder_test.json
    参数项目标识identifier
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8349,83 +8562,8 @@ http://localhost:3000/api/jasder/jasder_test.json -d"user_id=12"\ http://localhost:3000/api/jasder/jasder_test/collaborators.json
    await octokit.request('POST /api/jasder/jasder_test/collaborators.json')
    -

    HTTP 请求

    -

    POST /api/:owner/:repo/collaborators.json

    -

    请求参数:

    -
    参数
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    参数必选默认类型字段说明
    ownerstring用户登录名
    repostring项目标识identifier
    user_idint用户id
    -

    返回字段说明:

    - - - - - - - - - - - - - - - - - -
    参数类型字段说明
    statusint返回状态, 0: 表示操作成功
    messagestring返回信息说明
    - -
    -

    返回的JSON示例:

    -
    -
    {
    -  "status": 0,
    -  "message": "success"
    -}
    -
    - -

    删除仓库成员

    -

    仓库中删除成员操作

    - -
    -

    示例:

    -
    -
    curl -X DELETE \
    --d "user_id=12" \
    -http://localhost:3000/api/jasder/jasder_test/collaborators.json
    -
    await octokit.request('DELETE /api/jasder/jasder_test/collaborators.json')
     

    HTTP 请求

    -

    DELETE /api/:owner/:repo/collaborators.json

    +

    POST /api/:owner/:repo/collaborators.json

    请求参数:

    @@ -8478,6 +8616,81 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
    +
    +

    返回的JSON示例:

    +
    +
    {
    +  "status": 0,
    +  "message": "success"
    +}
    +
    + +

    删除仓库成员

    +

    仓库中删除成员操作

    + +
    +

    示例:

    +
    +
    curl -X DELETE \
    +-d "user_id=12" \
    +http://localhost:3000/api/jasder/jasder_test/collaborators.json
    +
    await octokit.request('DELETE /api/jasder/jasder_test/collaborators.json')
    +

    HTTP 请求

    +

    DELETE /api/:owner/:repo/collaborators.json

    +

    请求参数:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数必选默认类型字段说明
    ownerstring用户登录名
    repostring项目标识identifier
    user_idint用户id
    +

    返回字段说明:

    + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    statusint返回状态, 0: 表示操作成功
    messagestring返回信息说明
    +

    返回的JSON示例:

    @@ -8500,9 +8713,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json -d "role=Developer" \ http://localhost:3000/api/jasder/jasder_test/change_role.json
    await octokit.request('PUT /api/jasder/jasder_test/change_role.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PUT /api/:owner/:repo/change_role.json

    -

    请求参数:

    +

    请求参数:

    @@ -8541,7 +8754,7 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
    参数取值范围:"Manager", "Developer", "Reporter";分别为项目管理人员(拥有所有操作权限)、项目开发人员(只拥有读写权限)、项目报告人员(只拥有读权限)
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8583,9 +8796,9 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json -d"limit=5"\ http://localhost:3000/api/jasder/jasder_test/collaborators.json
    await octokit.request('GET /api/jasder/jasder_test/collaborators.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/collaborators.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8624,7 +8837,7 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
    参数每页多少条数据,默认15条
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8712,9 +8925,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json -d"ref=develop"\ http://localhost:3000/api/yystopf/ceshi/files.json
    await octokit.request('GET /api/yystopf/ceshi/files.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/files

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8753,7 +8966,7 @@ http://localhost:3000/api/yystopf/ceshi/files.json
    参数分支名,默认为仓库默认分支
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8835,9 +9048,9 @@ http://localhost:3000/api/yystopf/ceshi/files.json -d"ref=develop"\ http://localhost:3000//api/jasder/jasder_test/entries.json
    await octokit.request('GET /api/jasder/jasder_test/entries.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/entries.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8869,7 +9082,7 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
    参数分支名称、tag名称或是提交记录id,默认为master分支
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8983,9 +9196,9 @@ http://localhost:3000//api/jasder/jasder_test/entries.json -d"filepath=file"\ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
    await octokit.request('GET /api/jasder/jasder_test/sub_entries.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/sub_entries.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -9024,7 +9237,7 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
    参数分支名称、tag名称或是提交记录id,默认为master分支
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -9121,9 +9334,9 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json -d"filepath=lib"\ http://localhost:3000/api/yystopf/csfjkkj/readme.json
    await octokit.request('GET /api/yystopf/csfjkkj/readme.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/readme.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -9162,7 +9375,7 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json
    参数子目录名称,默认为空
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -9234,9 +9447,9 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json -d"filepath=lib"\ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
    await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/contributors.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -9275,7 +9488,7 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
    参数子目录名称,默认为空
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -9350,9 +9563,9 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
    curl -X GET \
     http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
     
    await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/v1/:owner/:repo/webhooks.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -9377,7 +9590,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
    参数项目标识identifier
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -9470,9 +9683,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

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -9504,7 +9717,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
    参数webhook ID
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -9627,214 +9840,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

    -

    请求参数:

    -
    参数
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    参数必选默认类型字段说明
    ownerstring用户登录名
    repostring项目标识identifier
    webhook.urlstring目标url
    webhook.http_methodstringhttp方法, POST和GET
    webhook.content_typestringPOST Content Type
    webhook.secretstring密钥文本
    webhook.activebool是否激活
    webhook.branch_filterstring分支过滤
    webhook.eventsarray触发事件
    - -

    触发事件字段说明

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    参数含义
    create创建分支或标签
    delete分支或标签删除
    pushgit仓库推送
    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"]
    -}
    -

    返回字段说明:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    参数类型字段说明
    idintid
    urlstring地址
    content_typestringPOST Content Type
    is_activebool是否激活
    typestring类型
    eventsarray触发事件
    create_timestring创建时间
    - -
    -

    返回的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

    请求参数:

    @@ -9860,13 +9867,6 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json - - - - - - - @@ -9968,6 +9968,219 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json "events": ["push"] }

    返回字段说明:

    +
    项目标识identifier
    idstringwebhook id
    webhook.url
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    idintid
    urlstring地址
    content_typestringPOST Content Type
    is_activebool是否激活
    typestring类型
    eventsarray触发事件
    create_timestring创建时间
    + +
    +

    返回的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

    +

    请求参数:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数必选默认类型字段说明
    ownerstring用户登录名
    repostring项目标识identifier
    idstringwebhook id
    webhook.urlstring目标url
    webhook.http_methodstringhttp方法, POST和GET
    webhook.content_typestringPOST Content Type
    webhook.secretstring密钥文本
    webhook.activebool是否激活
    webhook.branch_filterstring分支过滤
    webhook.eventsarray触发事件
    + +

    触发事件字段说明

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数含义
    create创建分支或标签
    delete分支或标签删除
    pushgit仓库推送
    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示例:

    @@ -10002,9 +10215,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

    -

    请求参数:

    +

    请求参数:

    @@ -10036,7 +10249,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
    参数webhook id
    -

    返回字段说明:

    +

    返回字段说明:

    返回的JSON示例:

    @@ -10057,9 +10270,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

    -

    请求参数:

    +

    请求参数:

    @@ -10091,7 +10304,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
    参数webhook ID
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -10328,9 +10541,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

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -10362,7 +10575,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/tests.json
    参数webhook ID
    -

    返回字段说明:

    +

    返回字段说明:

    返回的JSON示例: