From 206bba1c4939d728ddce3e6d8d9083ba880f79bb Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 23 Sep 2021 18:17:52 +0800 Subject: [PATCH] add: contributors by filepath --- .../slate/source/includes/_repositories.md | 65 +++++++ public/docs/api.html | 163 +++++++++++++++--- 2 files changed, 207 insertions(+), 21 deletions(-) diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md index c27243da6..eaae10746 100644 --- a/app/docs/slate/source/includes/_repositories.md +++ b/app/docs/slate/source/includes/_repositories.md @@ -924,6 +924,71 @@ await octokit.request('GET /api/yystopf/csfjkkj/readme.json') Success Data. +## 获取仓库贡献者 +获取仓库贡献者 + +> 示例: + +```shell +curl -X GET \ +-d "ref=master" \ +-d "filepath=lib" \ +http://localhost:3000/api/yystopf/csfjkkj/contributors.json +``` + +```javascript +await octokit.request('GET /api/yystopf/csfjkkj/contributors.json') +``` + +### HTTP 请求 +`GET /api/:owner/:repo/contributors.json` + +### 请求参数: +参数 | 必选 | 默认 | 类型 | 字段说明 +--------- | ------- | ------- | -------- | ---------- +|owner |是| |string |用户登录名 | +|repo |是| |string |项目标识identifier | +|ref |否| | string |分支名称、tag名称或是提交记录id,默认为整个仓库 | +|filepath |否| | string |子目录名称,默认为空 | + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|total_count |integer|贡献者数量| +|contributions |integer|贡献数量| +|login |string |用户登录名 | +|type |string|用户类型 | +|name |string|用户昵称| +|image_url |string|用户头像| + + +> 返回的JSON示例: + +```json +{ + "contributors": [ + { + "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" + } + ], + "total_count": 2 +} +``` + + ## 获取仓库webhooks列表 获取仓库webhooks列表 diff --git a/public/docs/api.html b/public/docs/api.html index 5e3baed1c..4ec491b4f 100644 --- a/public/docs/api.html +++ b/public/docs/api.html @@ -502,6 +502,9 @@
  • 获取仓库README文件
  • +
  • + 获取仓库贡献者 +
  • 获取仓库webhooks列表
  • @@ -7363,6 +7366,124 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json +

    获取仓库贡献者

    +

    获取仓库贡献者

    + +
    +

    示例:

    +
    +
    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')
    +

    HTTP 请求

    +

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

    +

    请求参数:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数必选默认类型字段说明
    ownerstring用户登录名
    repostring项目标识identifier
    refstring分支名称、tag名称或是提交记录id,默认为整个仓库
    filepathstring子目录名称,默认为空
    +

    返回字段说明:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    total_countinteger贡献者数量
    contributionsinteger贡献数量
    loginstring用户登录名
    typestring用户类型
    namestring用户昵称
    image_urlstring用户头像
    + +
    +

    返回的JSON示例:

    +
    +
    {
    +    "contributors": [
    +        {
    +            "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"
    +        }
    +    ],
    +    "total_count": 2
    +}
    +
    +

    获取仓库webhooks列表

    获取仓库webhooks列表

    @@ -7372,9 +7493,9 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json
    curl -X GET \
     http://localhost:3000/api/yystopf/ceshi/webhooks.json
     
    await octokit.request('GET /api/yystopf/ceshi/webhooks.json')
    -

    HTTP 请求

    +

    HTTP 请求

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

    -

    请求参数:

    +

    请求参数:

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

    返回字段说明:

    +

    返回字段说明:

    @@ -7501,9 +7622,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
    curl -X GET \
     http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
     
    await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
    -

    HTTP 请求

    +

    HTTP 请求

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

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -7535,7 +7656,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
    参数webhook ID
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -7736,9 +7857,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
    curl -X POST \
     http://localhost:3000/api/yystopf/ceshi/webhooks.json
     
    await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
    -

    HTTP 请求

    +

    HTTP 请求

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

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -7922,7 +8043,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json "branch_filter": "*", "events": ["push"] } -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -7994,9 +8115,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
    curl -X PATCH \
     http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
     
    await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PATCH /api/:owner/:repo/webhooks/:id.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8187,7 +8308,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json "branch_filter": "*", "events": ["push"] } -

    返回字段说明:

    +

    返回字段说明:

    返回的JSON示例:

    @@ -8208,9 +8329,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
    curl -X DELETE \
     http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
     
    await octokit.request('DELETE /api/yystopf/ceshi/webhooks/7.json')
    -

    HTTP 请求

    +

    HTTP 请求

    DELETE /api/:owner/:repo/webhooks/:id.json

    -

    请求参数:

    +

    请求参数:

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

    返回字段说明:

    +

    返回字段说明:

    返回的JSON示例:

    @@ -8263,9 +8384,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
    curl -X GET \
     http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
     
    await octokit.request('GET /api/yystopf/ceshi/webhooks/3/tasks.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/:owner/:repo/webhooks/:id/tasks.json

    -

    请求参数:

    +

    请求参数:

    @@ -8297,7 +8418,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
    参数webhook ID
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8534,9 +8655,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
    curl -X POST \
     http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
     
    await octokit.request('POST /api/yystopf/ceshi/webhooks/3/test.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST /api/:owner/:repo/webhooks/:id/test.json

    -

    请求参数:

    +

    请求参数:

    参数
    @@ -8568,7 +8689,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
    参数webhook ID
    -

    返回字段说明:

    +

    返回字段说明:

    返回的JSON示例: