diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md index 9238615e4..c1c8b3670 100644 --- a/app/docs/slate/source/includes/_repositories.md +++ b/app/docs/slate/source/includes/_repositories.md @@ -1139,7 +1139,6 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json') |url |string|地址| |http_method |string|请求方式| |is_active |bool |是否激活| -|type |string|类型| |last_status |string|最后一次推送的状态| |create_time |string|创建时间| @@ -1155,7 +1154,6 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json') "url": "https://oapi.dingtalk.com/robot/send?access_token=7e1e19d0eddb6a5e33c5c2c4e66f4c88f9437184b9ed2c2653194c6374c7d513", "http_method": "", "is_active": true, - "type": "dingtalk", "last_status": "succeed", "create_time": "2021-07-12 10:50:07" }, @@ -1164,7 +1162,6 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json') "url": "http://localhost:3000", "http_method": "GET", "is_active": true, - "type": "gitea", "last_status": "succeed", "create_time": "2021-07-26 10:03:45" }, @@ -1173,7 +1170,6 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json') "url": "http://localhost:10081", "http_method": "POST", "is_active": true, - "type": "gitea", "last_status": "waiting", "create_time": "2021-07-26 16:56:53" }, @@ -1182,7 +1178,6 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json') "url": "http://localhost:3001", "http_method": "POST", "is_active": true, - "type": "gitea", "last_status": "fail", "create_time": "2021-07-26 16:58:23" } @@ -1236,24 +1231,11 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3.json') --------- | ------- | ------- | |create|创建分支或标签| |delete|分支或标签删除| -|fork|仓库被fork| |push|git仓库推送| -|issue|疑修已打开、已关闭、已重新打开或编辑| -|issue_assign|疑修被指派| -|issue_label|疑修标签被更新或删除| -|issue_milestone|疑修被收入里程碑| -|issue_comment|疑修评论| |pull_request|合并请求| |pull_request_assign|合并请求被指派| -|pull_request_label|合并请求被贴上标签| -|pull_request_milestone|合并请求被记录于里程碑中| -|pull_request_comment|合并请求被评论| |pull_request_review_approved|合并请求被批准| |pull_request_review_rejected|合并请求被拒绝| -|pull_request_review_comment|合并请求被提出审查意见| -|pull_request_sync|合并请求被同步| -|repository|创建或删除仓库| -|release|版本发布| > 返回的JSON示例: @@ -1270,22 +1252,9 @@ await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3.json') "events": [ "create", "delete", - "fork", - "issues", - "issue_assign", - "issue_label", - "issue_milestone", - "issue_comment", "push", "pull_request", "pull_request_assign", - "pull_request_label", - "pull_request_milestone", - "pull_request_comment", - "pull_request_review", - "pull_request_sync", - "repository", - "release" ] } ``` @@ -1329,24 +1298,11 @@ await octokit.request('POST /api/v1/yystopf/ceshi/webhooks.json') --------- | ------- | ------- | |create|创建分支或标签| |delete|分支或标签删除| - |push|git仓库推送| - |pull_request|合并请求| |pull_request_assign|合并请求被指派| - |pull_request_review_approved|合并请求被批准| |pull_request_review_rejected|合并请求被拒绝| - > 请求的JSON示例: @@ -1438,24 +1394,11 @@ await octokit.request('PATCH /api/v1/yystopf/ceshi/webhooks/7.json') --------- | ------- | ------- | |create|创建分支或标签| |delete|分支或标签删除| - |push|git仓库推送| - |pull_request|合并请求| |pull_request_assign|合并请求被指派| - |pull_request_review_approved|合并请求被批准| |pull_request_review_rejected|合并请求被拒绝| - > 请求的JSON示例: @@ -1546,15 +1489,15 @@ await octokit.request('DELETE /api/v1/yystopf/ceshi/webhooks/7.json') ```shell curl -X GET \ -http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json +http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json ``` ```javascript -await octokit.request('GET /api/yystopf/ceshi/webhooks/3/tasks.json') +await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3/hooktasks.json') ``` ### HTTP 请求 -`GET /api/:owner/:repo/webhooks/:id/tasks.json` +`GET /api/v1/:owner/:repo/webhooks/:id/hooktasks.json` ### 请求参数: 参数 | 必选 | 默认 | 类型 | 字段说明 @@ -1582,7 +1525,7 @@ await octokit.request('GET /api/yystopf/ceshi/webhooks/3/tasks.json') ```json { "total_count": 6, - "tasks": [ + "hooktasks": [ { "id": 20, "type": "gitea", @@ -1758,15 +1701,15 @@ await octokit.request('GET /api/yystopf/ceshi/webhooks/3/tasks.json') ```shell curl -X POST \ -http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json +http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/tests.json ``` ```javascript -await octokit.request('POST /api/yystopf/ceshi/webhooks/3/test.json') +await octokit.request('POST /api/v1/yystopf/ceshi/webhooks/3/tests.json') ``` ### HTTP 请求 -`POST /api/:owner/:repo/webhooks/:id/test.json` +`POST /api/v1/:owner/:repo/webhooks/:id/tests.json` ### 请求参数: 参数 | 必选 | 默认 | 类型 | 字段说明 diff --git a/app/docs/slate/source/includes/_users.md b/app/docs/slate/source/includes/_users.md index dc3faea8e..318c7930a 100644 --- a/app/docs/slate/source/includes/_users.md +++ b/app/docs/slate/source/includes/_users.md @@ -47,6 +47,105 @@ await octokit.request('GET /api/users/me.json') Success Data. +## 用户项目列表 +获取用户项目列表 + +> 示例: + +```shell +curl -X GET http://localhost:3000/api/v1/:login/projects.json +``` + +```javascript +await octokit.request('GET /api/v1/:login/projects.json') +``` + +### HTTP 请求 +`GET api/v1/yystopf/projects.json` + +### 请求字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|login | string | 用户的用户名| +|category | string | 归属项目,默认为全部项目, join: 参与项目, created: 创建项目, manage: 管理项目, watched: 关注项目, forked: 复刻项目 | +|is_public | boolean | 公/私有项目,true为公开项目,false为私有项目| +|project_type | string | 项目类型,common为托管项目, mirror为镜像项目, sync_mirror为同步镜像项目| +|sort_by | string | 项目的排序字段,比如 created_on, updated_on等| +|sort_direction | string | 排序的类型,desc 倒序,asc 正序| +|limit | integer | 每页个数 | +|page | integer | 页码 | + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|total_count | integer | 项目总数 | +|projects.owner.id | integer | 项目拥有者id | +|projects.owner.type | string | 项目拥有者类型,User 用户,Organization 组织 | +|projects.owner.name | string | 项目拥有者名称| +|projects.owner.login | string | 项目拥有者用户名 | +|projects.owner.image_url | string | 项目拥有者头像地址 | +|type | string | 项目类型,common 托管项目,mirror 镜像项目, sync 同步镜像项目 | +|description | string | 项目描述 | +|forked_count | integer | 项目复刻数量 | +|forked_from_project_id | integer | 项目复刻来源项目 | +|identifier | string | 项目标识 | +|issues_count | integer | 项目issues数量| +|pull_requests_count | integer | 项目合并请求数量 | +|invite_code | string | 项目邀请码| +|website | string | 项目网址| +|platform | string | 项目平台 | +|name | string | 项目名称| +|open_devops | boolean | 项目是否开启工作流 | +|praises_count | integer | 项目点赞数量| +|is_public | boolean | 项目是否公开| +|status | integer | 项目状态| +|watchers_count | integer | 项目关注数量| +|ignore_id | integer | 项目ignoreID| +|license_id | integer | 项目许可证ID| +|project_category_id | integer | 项目分类ID| +|project_language_id | integer | 项目语言ID| + + +> 返回的JSON示例: + +```json +"total_count": 1, +"projects": [ + { + "owner": { + "id": 2, + "type": "User", + "name": "heh", + "login": "yystopf", + "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png" + }, + "type": "common", + "description": null, + "forked_count": 1, + "forked_from_project_id": null, + "identifier": "hahahah", + "issues_count": 5, + "pull_requests_count": 3, + "invite_code": "8zfKtM", + "website": null, + "platform": "forge", + "name": "hahahah", + "open_devops": false, + "praises_count": 0, + "is_public": true, + "status": 1, + "watchers_count": 0, + "ignore_id": null, + "license_id": null, + "project_category_id": null, + "project_language_id": null + } +] +``` + + ## 用户消息列表 获取用户消息列表 diff --git a/app/services/api/v1/users/projects/list_service.rb b/app/services/api/v1/users/projects/list_service.rb index 00f852396..9a095c60b 100644 --- a/app/services/api/v1/users/projects/list_service.rb +++ b/app/services/api/v1/users/projects/list_service.rb @@ -4,8 +4,8 @@ class Api::V1::Users::Projects::ListService < ApplicationService attr_reader :observe_user, :category, :is_public, :project_type, :sort_by, :sort_direction, :search, :current_user attr_accessor :queried_projects - validates :category, inclusion: {in: %w(all join created watched forked), message: "请输入正确的Category"} - validates :is_public, inclusion: {in: [true, false], message: '请输入正确的IsPublic'} + validates :category, inclusion: {in: %w(all join created manage watched forked), message: "请输入正确的Category"} + validates :is_public, inclusion: {in: [true, false], message: '请输入正确的IsPublic'}, allow_nil: true validates :project_type, inclusion: {in: %w(common mirror sync_mirror), message: '请输入正确的ProjectType'}, allow_nil: true validates :sort_by, inclusion: {in: Project.column_names, message: '请输入正确的SortBy'} validates :sort_direction, inclusion: {in: %w(asc desc), message: '请输入正确的SortDirection'} @@ -13,7 +13,7 @@ class Api::V1::Users::Projects::ListService < ApplicationService def initialize(observe_user, params, current_user=nil) @observe_user = observe_user @category = params[:category] || 'all' - @is_public = params[:is_public] || true + @is_public = params[:is_public] @project_type = params[:project_type] @sort_by = params[:sort_by] || 'updated_on' @sort_direction = params[:sort_direction] || 'desc' @@ -47,6 +47,10 @@ class Api::V1::Users::Projects::ListService < ApplicationService projects = Project.from("( #{normal_projects} UNION #{org_projects} ) AS projects").distinct when 'created' projects = projects.where(user_id: observe_user.id) + when 'manage' + normal_projects = projects.joins(members: :roles).where(members: {user_id: observe_user.id}, roles: {name: 'Manager'}).to_sql + org_projects = projects.joins(team_projects: [team: :team_users]).where(team_users: {user_id: observe_user.id}, teams: {authorize: %w(owner admin)}).to_sql + projects = Project.from("( #{normal_projects} UNION #{org_projects} ) AS projects").distinct when 'watched' projects = projects.where.not(user_id: observe_user.id).joins(:watchers).where(watchers: {watchable_type: "Project", user_id: observe_user.id}) when 'forked' @@ -58,11 +62,14 @@ class Api::V1::Users::Projects::ListService < ApplicationService projects = Project.from("( #{ normal_projects} UNION #{ org_projects } ) AS projects").distinct end - if is_public - projects = projects.visible - else - projects = projects.is_private + unless is_public.nil? + if is_public + projects = projects.visible + else + projects = projects.is_private + end end + projects = projects.with_project_type(project_type) diff --git a/public/docs/api.html b/public/docs/api.html index 82b751e9f..cdb828179 100644 --- a/public/docs/api.html +++ b/public/docs/api.html @@ -345,6 +345,9 @@
  • 获取当前登陆用户信息
  • +
  • + 用户项目列表 +
  • 用户消息列表
  • @@ -1036,6 +1039,244 @@ Success — a happy kitten is an authenticated kitten! +

    用户项目列表

    +

    获取用户项目列表

    + +
    +

    示例:

    +
    +
    curl -X GET http://localhost:3000/api/v1/:login/projects.json
    +
    await octokit.request('GET /api/v1/:login/projects.json')
    +

    HTTP 请求

    +

    GET api/v1/yystopf/projects.json

    +

    请求字段说明:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    loginstring用户的用户名
    categorystring归属项目,默认为全部项目, join: 参与项目, created: 创建项目, manage: 管理项目, watched: 关注项目, forked: 复刻项目
    is_publicboolean公/私有项目,true为公开项目,false为私有项目
    project_typestring项目类型,common为托管项目, mirror为镜像项目, sync_mirror为同步镜像项目
    sort_bystring项目的排序字段,比如 created_on, updated_on等
    sort_directionstring排序的类型,desc 倒序,asc 正序
    limitinteger每页个数
    pageinteger页码
    +

    返回字段说明:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    total_countinteger项目总数
    projects.owner.idinteger项目拥有者id
    projects.owner.typestring项目拥有者类型,User 用户,Organization 组织
    projects.owner.namestring项目拥有者名称
    projects.owner.loginstring项目拥有者用户名
    projects.owner.image_urlstring项目拥有者头像地址
    typestring项目类型,common 托管项目,mirror 镜像项目, sync 同步镜像项目
    descriptionstring项目描述
    forked_countinteger项目复刻数量
    forked_from_project_idinteger项目复刻来源项目
    identifierstring项目标识
    issues_countinteger项目issues数量
    pull_requests_countinteger项目合并请求数量
    invite_codestring项目邀请码
    websitestring项目网址
    platformstring项目平台
    namestring项目名称
    open_devopsboolean项目是否开启工作流
    praises_countinteger项目点赞数量
    is_publicboolean项目是否公开
    statusinteger项目状态
    watchers_countinteger项目关注数量
    ignore_idinteger项目ignoreID
    license_idinteger项目许可证ID
    project_category_idinteger项目分类ID
    project_language_idinteger项目语言ID
    + +
    +

    返回的JSON示例:

    +
    +
    "total_count": 1,
    +"projects": [
    +    {
    +        "owner": {
    +            "id": 2,
    +            "type": "User",
    +            "name": "heh",
    +            "login": "yystopf",
    +            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
    +        },
    +        "type": "common",
    +        "description": null,
    +        "forked_count": 1,
    +        "forked_from_project_id": null,
    +        "identifier": "hahahah",
    +        "issues_count": 5,
    +        "pull_requests_count": 3,
    +        "invite_code": "8zfKtM",
    +        "website": null,
    +        "platform": "forge",
    +        "name": "hahahah",
    +        "open_devops": false,
    +        "praises_count": 0,
    +        "is_public": true,
    +        "status": 1,
    +        "watchers_count": 0,
    +        "ignore_id": null,
    +        "license_id": null,
    +        "project_category_id": null,
    +        "project_language_id": null
    +    }
    +]
    +
    +

    用户消息列表

    获取用户消息列表

    @@ -1044,9 +1285,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/:login/messages.json
     
    await octokit.request('GET /api/users/:login/messages.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/yystopf/messages.json

    -

    请求字段说明:

    +

    请求字段说明:

    @@ -1075,7 +1316,7 @@ Success — a happy kitten is an authenticated kitten!
    参数页码
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -1363,9 +1604,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/system_notification_histories.json
     
    await octokit.request('GET /api/users/:login/system_notification_histories.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST /api/users/:login/system_notification_histories.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -1395,9 +1636,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/:login/messages.json
     
    await octokit.request('POST /api/users/:login/messages.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST api/users/yystopf/messages.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -1456,9 +1697,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/:login/messages/read.json
     
    await octokit.request('POST /api/users/:login/messages/read.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST api/users/yystopf/messages/read.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -1497,9 +1738,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X DELETE http://localhost:3000/api/users/:login/messages.json
     
    await octokit.request('DELETE /api/users/:login/messages.json')
    -

    HTTP 请求

    +

    HTTP 请求

    DELETE api/users/yystopf/messages.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -1538,9 +1779,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X PATCH/PUT http://localhost:3000/api/users/yystopf.json
     
    await octokit.request('PATCH/PUT /api/users/:login.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PATCH/PUT /api/users/:login.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -1636,9 +1877,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/template_message_settings.json
     
    await octokit.request('GET /api/template_message_settings.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/template_message_settings.json

    -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -1779,9 +2020,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/template_message_settings.json
     
    await octokit.request('GET /api/uses/yystopf/template_message_settings.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:user_id/template_message_settings.json

    -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -1849,9 +2090,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/template_message_settings/update_setting.json
     
    await octokit.request('POST /api/uses/yystopf/template_message_settings/update_setting.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST /api/users/:user_id/template_message_settings/update_setting.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -1900,7 +2141,7 @@ Success — a happy kitten is an authenticated kitten! } } } -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -1968,9 +2209,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/is_pinned_projects.json
     
    await octokit.request('GET /api/users/:login/is_pinned_projects.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/:login/is_pinned_projects.json

    -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -2155,9 +2396,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/is_pinned_projects/pin.json
     
    await octokit.request('GET /api/users/:login/is_pinned_projects/pin.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST /api/users/:login/is_pinned_projects/pin.json

    -

    请求字段说明:

    同时设定多个星标项目

    +

    请求字段说明:

    同时设定多个星标项目

    参数
    @@ -2201,9 +2442,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X PATCH http://localhost:3000/api/users/yystopf/is_pinned_projects/11.json
     
    await octokit.request('PATCH/PUT /api/users/:login/is_pinned_projects/:id.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PATCH/PUT /api/users/:login/is_pinned_projects/:id.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2242,9 +2483,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/activity.json
     
    await octokit.request('GET /api/users/:login/statistics/activity.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/activity.json

    -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -2331,9 +2572,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/headmaps.json
     
    await octokit.request('GET /api/users/:login/headmaps.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/:login/headmaps.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2347,7 +2588,7 @@ Success — a happy kitten is an authenticated kitten!
    参数年份
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2476,9 +2717,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/project_trends.json
     
    await octokit.request('GET /api/users/:login/project_trends.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/:login/project_trends.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2492,7 +2733,7 @@ Success — a happy kitten is an authenticated kitten!
    参数日期,格式: 2021-05-28
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2793,9 +3034,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/develop.json
     
    await octokit.request('GET /api/users/:login/statistics/develop.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/develop.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2814,7 +3055,7 @@ Success — a happy kitten is an authenticated kitten!
    参数时间戳,结束时间,格式:1622131200
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2936,9 +3177,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/role.json
     
    await octokit.request('GET /api/users/:login/statistics/role.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/role.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2957,7 +3198,7 @@ Success — a happy kitten is an authenticated kitten!
    参数时间戳,结束时间,格式:1622131200
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3018,9 +3259,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/major.json
     
    await octokit.request('GET /api/users/:login/statistics/major.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/major.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3039,7 +3280,7 @@ Success — a happy kitten is an authenticated kitten!
    参数时间戳,结束时间,格式:1622131200
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3079,9 +3320,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/applied_messages.json
     
    await octokit.request('GET /api/users/:login/applied_messages.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_messages.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3095,7 +3336,7 @@ Success — a happy kitten is an authenticated kitten!
    参数用户标识
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3358,9 +3599,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/applied_transfer_projects.json
     
    await octokit.request('GET /api/users/:login/applied_transfer_projects.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_transfer_projects.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3374,7 +3615,7 @@ Success — a happy kitten is an authenticated kitten!
    参数用户标识
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3550,199 +3791,8 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/accept.json
     
    await octokit.request('GET /api/users/:login/applied_transfer_projects/:id/accept.json')
    -

    HTTP 请求

    -

    GET /api/users/:login/applied_transfer_projects/:id/accept.json

    -

    请求字段说明:

    -
    参数
    - - - - - - - - - - - - - - - - -
    参数类型字段说明
    loginstring用户标识
    idint迁移id
    -

    返回字段说明:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    参数类型字段说明
    idint迁移id
    statusstring迁移状态,canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
    time_agostring迁移创建的时间
    project.idint迁移项目的id
    project.identifierstring迁移项目的标识
    project.namestring迁移项目的名称
    project.descriptionstring迁移项目的描述
    project.is_publicbool迁移项目是否公开
    project.owner.idbool迁移项目拥有者id
    project.owner.typestring迁移项目拥有者类型
    project.owner.namestring迁移项目拥有者昵称
    project.owner.loginstring迁移项目拥有者标识
    project.owner.image_urlstring迁移项目拥有者头像
    user.idint迁移创建者的id
    user.typestring迁移创建者的类型
    user.namestring迁移创建者的名称
    user.loginstring迁移创建者的标识
    user.image_urlstring迁移创建者头像
    owner.idint迁移接受者的id
    owner.typestring迁移接受者的类型
    owner.namestring迁移接受者的名称
    owner.loginstring迁移接受者的标识
    owner.image_urlstring迁移接受者头像
    - -
    -

    返回的JSON示例:

    -
    -
    {
    -    "project": {
    -        "id": 86,
    -        "identifier": "ceshi_repo1",
    -        "name": "测试项目啊1",
    -        "description": "二十多",
    -        "is_public": true,
    -        "owner": {
    -            "id": 52,
    -            "type": "Organization",
    -            "name": "身份卡手动阀",
    -            "login": "ceshi1",
    -            "image_url": "images/avatars/Organization/52?t=1618805056"
    -        }
    -    },
    -    "user": {
    -        "id": 6,
    -        "type": "User",
    -        "name": "yystopf",
    -        "login": "yystopf",
    -        "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
    -    },
    -    "owner": {
    -        "id": 52,
    -        "type": "Organization",
    -        "name": "身份卡手动阀",
    -        "login": "ceshi1",
    -        "image_url": "images/avatars/Organization/52?t=1618805056"
    -    },
    -    "id": 1,
    -    "status": "canceled",
    -    "created_at": "2021-04-25 18:06",
    -    "time_ago": "16小时前"
    -}
    -

    用户拒绝迁移

    -

    用户拒绝迁移

    - -
    -

    示例:

    -
    -
    curl -X POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/refuse.json
    -
    await octokit.request('GET /api/users/:login/applied_transfer_projects/:id/refuse.json')
     

    HTTP 请求

    -

    GET /api/users/:login/applied_transfer_projects/:id/refuse.json

    +

    GET /api/users/:login/applied_transfer_projects/:id/accept.json

    请求字段说明:

    @@ -3924,16 +3974,16 @@ Success — a happy kitten is an authenticated kitten! "created_at": "2021-04-25 18:06", "time_ago": "16小时前" } -

    待办事项-项目申请

    -

    待办事项-项目申请

    +

    用户拒绝迁移

    +

    用户拒绝迁移

    示例:

    -
    curl -X GET http://localhost:3000/api/users/yystopf/applied_projects.json
    -
    await octokit.request('GET /api/users/:login/applied_projects.json')
    +
    curl -X POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/refuse.json
    +
    await octokit.request('GET /api/users/:login/applied_transfer_projects/:id/refuse.json')
     

    HTTP 请求

    -

    GET /api/users/:login/applied_projects.json

    +

    GET /api/users/:login/applied_transfer_projects/:id/refuse.json

    请求字段说明:

    @@ -3947,6 +3997,11 @@ Success — a happy kitten is an authenticated kitten! + + + + +
    string 用户标识
    idint迁移id

    返回字段说明:

    @@ -3959,6 +4014,192 @@ Success — a happy kitten is an authenticated kitten! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    id int迁移id
    statusstring迁移状态,canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
    time_agostring迁移创建的时间
    project.idint迁移项目的id
    project.identifierstring迁移项目的标识
    project.namestring迁移项目的名称
    project.descriptionstring迁移项目的描述
    project.is_publicbool迁移项目是否公开
    project.owner.idbool迁移项目拥有者id
    project.owner.typestring迁移项目拥有者类型
    project.owner.namestring迁移项目拥有者昵称
    project.owner.loginstring迁移项目拥有者标识
    project.owner.image_urlstring迁移项目拥有者头像
    user.idint迁移创建者的id
    user.typestring迁移创建者的类型
    user.namestring迁移创建者的名称
    user.loginstring迁移创建者的标识
    user.image_urlstring迁移创建者头像
    owner.idint迁移接受者的id
    owner.typestring迁移接受者的类型
    owner.namestring迁移接受者的名称
    owner.loginstring迁移接受者的标识
    owner.image_urlstring迁移接受者头像
    + +
    +

    返回的JSON示例:

    +
    +
    {
    +    "project": {
    +        "id": 86,
    +        "identifier": "ceshi_repo1",
    +        "name": "测试项目啊1",
    +        "description": "二十多",
    +        "is_public": true,
    +        "owner": {
    +            "id": 52,
    +            "type": "Organization",
    +            "name": "身份卡手动阀",
    +            "login": "ceshi1",
    +            "image_url": "images/avatars/Organization/52?t=1618805056"
    +        }
    +    },
    +    "user": {
    +        "id": 6,
    +        "type": "User",
    +        "name": "yystopf",
    +        "login": "yystopf",
    +        "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
    +    },
    +    "owner": {
    +        "id": 52,
    +        "type": "Organization",
    +        "name": "身份卡手动阀",
    +        "login": "ceshi1",
    +        "image_url": "images/avatars/Organization/52?t=1618805056"
    +    },
    +    "id": 1,
    +    "status": "canceled",
    +    "created_at": "2021-04-25 18:06",
    +    "time_ago": "16小时前"
    +}
    +

    待办事项-项目申请

    +

    待办事项-项目申请

    + +
    +

    示例:

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

    HTTP 请求

    +

    GET /api/users/:login/applied_projects.json

    +

    请求字段说明:

    + + + + + + + + + + + + +
    参数类型字段说明
    loginstring用户标识
    +

    返回字段说明:

    + + + + + + + + + + @@ -4092,9 +4333,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_projects/2/accept.json
     
    await octokit.request('GET /api/users/:login/applied_projects/:id/accept.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_projects/:id/accept.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数类型字段说明
    idint 申请id
    @@ -4113,7 +4354,7 @@ Success — a happy kitten is an authenticated kitten!
    参数申请id
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -4251,9 +4492,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_projects/2/refuse.json
     
    await octokit.request('GET /api/users/:login/applied_projects/:id/refuse.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_projects/:id/refuse.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -4272,7 +4513,7 @@ Success — a happy kitten is an authenticated kitten!
    参数申请id
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -8715,10 +8956,10 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json

    示例:

    curl -X GET \
    -http://localhost:3000/api/yystopf/ceshi/webhooks.json
    -
    await octokit.request('GET /api/yystopf/ceshi/webhooks.json')
    +http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
    +
    await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json')
     

    HTTP 请求

    -

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

    +

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

    请求参数:

    参数
    @@ -8773,11 +9014,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json - - - - - @@ -8800,7 +9036,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json "url": "https://oapi.dingtalk.com/robot/send?access_token=7e1e19d0eddb6a5e33c5c2c4e66f4c88f9437184b9ed2c2653194c6374c7d513", "http_method": "", "is_active": true, - "type": "dingtalk", "last_status": "succeed", "create_time": "2021-07-12 10:50:07" }, @@ -8809,7 +9044,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json "url": "http://localhost:3000", "http_method": "GET", "is_active": true, - "type": "gitea", "last_status": "succeed", "create_time": "2021-07-26 10:03:45" }, @@ -8818,7 +9052,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json "url": "http://localhost:10081", "http_method": "POST", "is_active": true, - "type": "gitea", "last_status": "waiting", "create_time": "2021-07-26 16:56:53" }, @@ -8827,7 +9060,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json "url": "http://localhost:3001", "http_method": "POST", "is_active": true, - "type": "gitea", "last_status": "fail", "create_time": "2021-07-26 16:58:23" } @@ -8844,10 +9076,10 @@ 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://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
    +
    await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3.json')
     

    HTTP 请求

    -

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

    +

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

    请求参数:

    是否激活
    typestring类型
    last_status string 最后一次推送的状态
    @@ -8914,21 +9146,11 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json - + - - - - - - - - - - @@ -8939,7 +9161,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json - + @@ -8960,34 +9182,10 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json - - - - - - - - - - - - - - - - - - - - - - - - @@ -8996,18 +9194,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json - - - - - - - - - - - - @@ -9015,22 +9201,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json - - - - - - - - - - - - - - - -
    string
    is_activeactive bool 是否激活
    typestring类型
    last_statusstring最后一次推送的状态, waiting 等待,fail 失败,succeed 成功
    branch_filter string 分支过滤触发条件
    create_timecreate_at string 创建时间
    分支或标签删除
    fork仓库被fork
    push git仓库推送
    issue疑修已打开、已关闭、已重新打开或编辑
    issue_assign疑修被指派
    issue_label疑修标签被更新或删除
    issue_milestone疑修被收入里程碑
    issue_comment疑修评论
    pull_request 合并请求
    合并请求被指派
    pull_request_label合并请求被贴上标签
    pull_request_milestone合并请求被记录于里程碑中
    pull_request_comment合并请求被评论
    pull_request_review_approved 合并请求被批准
    pull_request_review_rejected 合并请求被拒绝
    pull_request_review_comment合并请求被提出审查意见
    pull_request_sync合并请求被同步
    repository创建或删除仓库
    release版本发布
    @@ -9041,31 +9211,15 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json "http_method": "GET", "content_type": "form", "url": "http://localhost:3000", - "secret": "123456", - "last_status": "succeed", - "is_active": true, - "type": "gitea", - "create_time": "2021-07-26 10:03:45", + "active": true, + "create_at": "2021-07-26 10:03", "branch_filter": "*", "events": [ "create", "delete", - "fork", - "issues", - "issue_assign", - "issue_label", - "issue_milestone", - "issue_comment", "push", "pull_request", "pull_request_assign", - "pull_request_label", - "pull_request_milestone", - "pull_request_comment", - "pull_request_review", - "pull_request_sync", - "repository", - "release" ] } @@ -9079,10 +9233,10 @@ 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://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
    +
    await octokit.request('POST /api/v1/yystopf/ceshi/webhooks.json')
     

    HTTP 请求

    -

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

    +

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

    请求参数:

    @@ -9115,13 +9269,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json - - - - - - - @@ -9182,34 +9329,10 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json - - - - - - - - - - - - - - - - - - - - - - - - @@ -9218,18 +9341,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json - - - - - - - - - - - - @@ -9237,22 +9348,6 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json - - - - - - - - - - - - - - - -
    目标url
    webhook.typestring类型
    webhook.http_method 分支或标签删除
    fork仓库被fork
    push git仓库推送
    issue疑修已打开、已关闭、已重新打开或编辑
    issue_assign疑修被指派
    issue_label疑修标签被更新或删除
    issue_milestone疑修被收入里程碑
    issue_comment疑修评论
    pull_request 合并请求
    合并请求被指派
    pull_request_label合并请求被贴上标签
    pull_request_milestone合并请求被记录于里程碑中
    pull_request_comment合并请求被评论
    pull_request_review_approved 合并请求被批准
    pull_request_review_rejected 合并请求被拒绝
    pull_request_review_comment合并请求被提出审查意见
    pull_request_sync合并请求被同步
    repository创建或删除仓库
    release版本发布
    @@ -9316,15 +9411,22 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json

    返回的JSON示例:

    {
    -    "id": 18,
    -    "type": "gitea",
    +    "id": 68,
         "content_type": "json",
    -    "url": "http://localhost:10000",
    +    "http_method": "GET",
    +    "url": "http://127.0.0.1:3000",
         "events": [
    -        "push"
    +        "create",
    +        "delete",
    +        "push",
    +        "pull_request",
    +        "pull_request_assign",
    +        "pull_request_review_approved",
    +        "pull_request_review_rejected"
         ],
         "active": true,
    -    "create_time": "2021-07-26 18:53:43"
    +    "branch_filter": "*",
    +    "created_at": "2022-06-23 15:52"
     }