NAV
Shell JavaScript

# Introduction

Welcome to the GitLink API! You can use our API to access GitLink API endpoints, which can get information on projects, repository, and users in our platform.

We have language bindings in Shell,avaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

This example API documentation page was created with GitLink. Feel free to edit it and use it as a base for your own API's documentation.

# Licenses

## Get All Licenses

The Licenses API returns metadata about popular open source licenses and information about a particular project's license file.

> 示例:

    curl -X GET \
    -d "name=AFL" \
    http://localhost:3000/api/licenses

    await octokit.request('GET /api/licenses')

### HTTP Request

`GET https://www.gitlink.org.cn/api/licenses.json`

### 请求参数

Name | Required | Type | Description
--- | --- | --- | ---
name | false | string | name of the license

> 返回字段说明:

    {
      "licenses": [
        {
          "id": 57,
          "name": "AFL-1.2"
        },
        {
          "id": 76,
          "name": "AFL-3.0"
        },
        {
          "id": 214,
          "name": "AFL-1.1"
        },
        {
          "id": 326,
          "name": "AFL-2.1"
        },
        {
          "id": 350,
          "name": "AFL-2.0"
        }
      ]
    }

# Gitignores

## gitignore模板列表

获取gitignore模板列表, 支持名称搜索过滤

> 示例:

    curl -X GET \
    -d "name=Ada" \
    http://localhost:3000/api/ignores.json

    await octokit.request('GET /api/ignores.json')

### HTTP 请求

`GET api/ignores.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
name | 否 | 否 |  | string

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
name | string | gitignore名称

> 返回的JSON示例:

    {
      "ignores": [
        {
          "id": 1,
          "name": "Ada"
        }
      ]
    }

Success — a happy kitten is an authenticated kitten!

# PublicKeys

## public_keys列表

获取public_keys列表，支持分页

> 示例:

    curl -X GET \
    http://localhost:3000/api/public_keys.json

    await octokit.request('GET /api/public_keys.json')

### HTTP 请求

`GET api/public_keys.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
page | 否 | 1 | int | 页码
limit | 否 | 15 | int | 每页数量

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 总数
public_keys.id | int | ID
public_keys.name | string | 密钥标题
public_keys.content | string | 密钥内容
public_keys.fingerprint | string | 密钥标识
public_keys.created_time | string | 密钥创建时间

> 返回的JSON示例:

    {
        "total_count": 1,
        "public_keys": [
            {
                "id": 16,
                "name": "xxx",
                "content": "ssh-rsa   yystopf@163.com",
                "fingerprint": "SHA256:cU8AK/+roqUUyiaYXIdS2Nj4+Rb2p6rqWSeRDc+aqKM",
                "created_unix": 1626246596,
                "created_time": "2021/07/14 15:09"
            }
        ]
    }

Success — a happy kitten is an authenticated kitten!

## 创建public_key

创建public_key

> 示例:

    curl -X POST \
    http://localhost:3000/api/public_keys.json

    await octokit.request('POST /api/public_keys.json')

### HTTP 请求

`POST api/public_keys.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
key | 是 | 否 | string | 密钥
title | 是 | 否 | string | 密钥标题

> 请求的JSON示例： `json { "public_key": { "key": "ssh-rsa yystopf@163.com", "title": "xxx" } }`

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 总数
id | int | ID
name | string | 密钥标题
content | string | 密钥内容
fingerprint | string | 密钥标识
created_time | string | 密钥创建时间

> 返回的JSON示例:

    {
        "id": 17,
        "name": "xxx",
        "content": "ssh-rsa   yystopf@163.com",
        "fingerprint": "SHA256:cU8AK/+roqUUyiaYXIdS2Nj4+Rb2p6rqWSeRDc+aqKM",
        "created_time": "2021/07/14 15:26"
    }

Success — a happy kitten is an authenticated kitten!

## 删除public_key

删除public_key

> 示例:

    curl -X DELETE \
    http://localhost:3000/api/public_keys/:id.json

    await octokit.request('DELETE /api/public_keys/:id.json')

### HTTP 请求

`DELETE api/public_keys/:id.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
id | 是 | 否 | int | 密钥ID

> 返回的JSON示例:

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

Success — a happy kitten is an authenticated kitten!

# Users

## 获取当前登陆用户信息

获取当前登陆用户信息

> 示例:

    curl -X GET http://localhost:3000/api/users/me.json

    await octokit.request('GET /api/users/me.json')

### HTTP 请求

`GET api/users/me.json`

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
user_id | int | 用户id
username | string | 用户名称
admin | boolean | 是否为管理用户
login | string | 登录名
image_url | string | 用户头像

> 返回的JSON示例:

    {
      "username": "username",
      "login": "login",
      "user_id": 100000,
      "image_url": "avatars/User/b",
      "admin": false
    }

Success Data.

## 用户项目列表

获取用户项目列表

> 示例:

    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`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
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示例:

    "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
        }
    ]

Success Data.

## 用户消息列表

获取用户消息列表

> 示例:

    curl -X GET http://localhost:3000/api/users/:login/messages.json

    await octokit.request('GET /api/users/:login/messages.json')

### HTTP 请求

`GET api/users/yystopf/messages.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 消息类型，不传为所有消息，notification为系统消息，atme为@我消息
status | integer | 是否已读，不传为所有消息，1为未读，2为已读
limit | integer | 每页个数
page | integer | 页码

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | integer | 消息总数
type | string | 消息类型
unread_notification | integer | 未读系统通知数量
unread_atme | integer | 未读@我数量
messages.id | integer | 消息id
messages.status | integer | 消息是否已读，1为未读，2为已读
messages.content | string | 消息内容
messages.notification_url | string | 消息跳转地址
messages.source | string | 消息来源
messages.timeago | string | 消息时间
messages.type | string | 消息类型，notification为系统消息，atme为@我消息
sender | object | 消息发送者

#### 消息来源source字段说明

类型 | 说明
--- | ---
IssueAssigned | 有新指派给我的疑修
IssueExpire | 我创建或负责的疑修截止日期到达最后一天
IssueAtme | 在疑修中@我
IssueChanged | 我创建或负责的疑修状态变更
IssueDeleted | 我创建或负责的疑修删除
IssueJournal | 我创建或负责的疑修有新的评论
LoginIpTip | 登录异常提示
OrganizationJoined | 账号被拉入组织
OrganizationLeft | 账号被移出组织
OrganizationRole | 账号组织权限变更
ProjectDeleted | 我关注的仓库被删除
ProjectFollowed | 我管理的仓库被关注
ProjectForked | 我管理的仓库被复刻
ProjectIssue | 我管理/关注的仓库有新的疑修
ProjectJoined | 账号被拉入项目
ProjectLeft | 账号被移出项目
ProjectMemberJoined | 我管理的仓库有成员加入
ProjectMemberLeft | 我管理的仓库有成员移出
ProjectMilestoneCompleted | 我管理的仓库有里程碑完成度100%
ProjectMilestone | 我管理的仓库有新的里程碑
ProjectPraised | 我管理的仓库被点赞
ProjectPullRequest | 我管理/关注的仓库有新的合并请求
ProjectRole | 账号仓库权限变更
ProjectSettingChanged | 我管理的仓库项目设置被更改
ProjectTransfer | 我关注的仓库被转移
ProjectVersion | 我关注的仓库有新的发行版
PullRequestAssigned | 有新指派给我的合并请求
PullReuqestAtme | 在合并请求中@我
PullRequestChanged | 我创建或负责的合并请求状态变更
PullRequestClosed | 我创建或负责的合并请求被关闭
PullRequestJournal | 我创建或负责的合并请求有新的评论
PullRequestMerged | 我创建或负责的合并请求被合并

> 返回的JSON示例:

    {
        "total_count": 5,
        "type": "",
        "unread_notification": 3,
        "unread_atme": 2,
        "messages": [
            {
                "id": 1,
                "status": 1,
                "content": "Atme Message Content 1",
                "notification_url": "http://www.baidu.com",
                "source": "PullRequestAtme",
                "time_ago": "1天前",
                "type": "atme",
                "sender": {
                    "id": 5,
                    "type": "User",
                    "name": "testforge2",
                    "login": "testforge2",
                    "image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png"
                }
            },
            {
                "id": 2,
                "status": 0,
                "content": "Atme Message Content 2",
                "notification_url": "http://www.baidu.com",
                "source": "IssueAtme",
                "time_ago": "1天前",
                "type": "atme",
                "sender": {
                    "id": 4,
                    "type": "User",
                    "name": "testforge1",
                    "login": "testforge1",
                    "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
                }
            },
            {
                "id": 3,
                "status": 1,
                "content": "Notification Message Content 1",
                "notification_url": "http://www.baidu.com",
                "source": "IssueDelete",
                "time_ago": "1天前",
                "type": "notification"
            },
            {
                "id": 4,
                "status": 0,
                "content": "Notification Message Content 2",
                "notification_url": "http://www.baidu.com",
                "source": "IssueChanged",
                "time_ago": "1天前",
                "type": "notification"
            },
            {
                "id": 5,
                "status": 0,
                "content": "Notification Message Content 3",
                "notification_url": "http://www.baidu.com",
                "source": "ProjectJoined",
                "time_ago": "1天前",
                "type": "notification"
            }
        ]
    }

Success Data.

## 用户阅读系统通知

用户阅读系统通知

> 示例:

    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 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
system_notification_id | integer | 阅读的系统通知id

> 返回的JSON示例:

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

## 发送消息

发送消息, 目前只支持atme

> 示例:

    curl -X POST http://localhost:3000/api/users/:login/messages.json

    await octokit.request('POST /api/users/:login/messages.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 消息类型
receivers_login | array | 需要发送消息的用户名数组
atmeable_type | string | atme消息对象，是从哪里@我的，比如评论：Journal、疑修：Issue、合并请求：PullRequest
atmeable_id | integer | atme消息对象id

> 请求的JSON示例:

    {
        "type": "atme",
        "receivers_login": ["yystopf", "testforge1"],
        "atmeable_type": "Journal",
        "atmeable_id": 67
    }

> 返回的JSON示例:

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

Success Data.

## 阅读消息

阅读消息

> 示例:

    curl -X POST http://localhost:3000/api/users/:login/messages/read.json

    await octokit.request('POST /api/users/:login/messages/read.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 消息类型，不传为所有消息，notification为系统消息，atme为@我消息
ids | array | 消息id数组，包含-1则把所有未读消息标记为已读

> 返回的JSON示例:

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

Success Data.

## 删除消息

删除消息

> 示例:

    curl -X DELETE http://localhost:3000/api/users/:login/messages.json

    await octokit.request('DELETE /api/users/:login/messages.json')

### HTTP 请求

`DELETE api/users/yystopf/messages.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 消息类型，atme为@我消息
ids | array | 消息id数组，包含-1则把所有消息删除

> 返回的JSON示例:

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

Success Data.

## 更改用户信息

更改用户信息

> 示例:

    curl -X PATCH/PUT http://localhost:3000/api/users/yystopf.json

    await octokit.request('PATCH/PUT /api/users/:login.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
user.nickname | string | 用户昵称
user.image | base64/file | 用户头像
user.user_extension_attributes.gender | int | 性别， 0男 1女
user.user_extension_attributes.province | string | 省份
user.user_extension_attributes.city | string | 城市
user.user_extension_attributes.description | string | 简介
user.user_extension_attributes.custom_department | string | 单位名称
user.user_extension_attributes.technical_title | string | 职业
user.user_extension_attributes.show_email | bool | 是否展示邮箱
user.user_extension_attributes.show_location | bool | 是否展示位置
user.user_extension_attributes.show_department | bool | 是否展示公司

> 请求的JSON示例：

    {
        "user": {
            "nickname": "xxx",
            "user_extension_attributes": {
                "gender": 0,
                "province": "湖南",
                "city": "长沙",
                "description": "个性签名",
                "custom_department": "湖南智擎科技有限公司",
            }
        }
    }

> 返回的JSON示例:

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

## 获取平台消息设置配置信息

获取平台消息设置配置信息

> 示例:

    curl -X GET http://localhost:3000/api/template_message_settings.json

    await octokit.request('GET /api/template_message_settings.json')

### HTTP 请求

`GET /api/template_message_settings.json`

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 消息配置类型
type_name | string | 消息配置类型含义
total_settings_count | int | 配置条数
settings.name | string | 配置名称
settings.key | string | 配置标识
settings.notification_disabled | boolean | 站内信设置是否禁用
settings.email_disabled | boolean | 邮件设置是否禁用

> 返回的JSON示例:

    {
        "status": 0,
        "message": "响应成功",
        "setting_types": [
            {
                "type": "TemplateMessageSetting::Normal",
                "type_name": "",
                "total_settings_count": 3,
                "settings": [
                    {
                        "name": "被拉入或移出组织",
                        "key": "Organization",
                        "notification_disabled": true,
                        "email_disabled": false
                    },
                    {
                        "name": "被拉入或移出项目",
                        "key": "Project",
                        "notification_disabled": true,
                        "email_disabled": false
                    },
                    {
                        "name": "有权限变更",
                        "key": "Permission",
                        "notification_disabled": true,
                        "email_disabled": false
                    }
                ]
            },
            {
                "type": "TemplateMessageSetting::CreateOrAssign",
                "type_name": "我创建的或负责的",
                "total_settings_count": 4,
                "settings": [
                    {
                        "name": "疑修被指派",
                        "key": "IssueAssigned",
                        "notification_disabled": true,
                        "email_disabled": false
                    },
                    {
                        "name": "合并请求被指派",
                        "key": "PullRequestAssigned",
                        "notification_disabled": true,
                        "email_disabled": false
                    }
                ]
            },
            {
                "type": "TemplateMessageSetting::ManageProject",
                "type_name": "我管理的仓库",
                "total_settings_count": 4,
                "settings": [
                    {
                        "name": "有新的疑修",
                        "key": "Issue",
                        "notification_disabled": true,
                        "email_disabled": false
                    },
                    {
                        "name": "有新的合并请求",
                        "key": "PullRequest",
                        "notification_disabled": true,
                        "email_disabled": false
                    },
                    {
                        "name": "有成员变动",
                        "key": "Member",
                        "notification_disabled": true,
                        "email_disabled": false
                    },
                    {
                        "name": "设置更改",
                        "key": "SettingChanged",
                        "notification_disabled": true,
                        "email_disabled": false
                    }
                ]
            }
        ]
    }

Success Data.

## 获取用户消息设置配置信息

获取用户消息设置配置信息

> 示例:

    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 请求

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

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
notification_body | string | 站内信配置
email_body | string | 邮件配置

> 返回的JSON示例:

    {
        "status": 0,
        "message": "响应成功",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "notification_body": {
            "CreateOrAssign::IssueAssigned": true,
            "CreateOrAssign::PullRequestAssigned": true,
            "ManageProject::Issue": true,
            "ManageProject::PullRequest": true,
            "ManageProject::Member": true,
            "ManageProject::SettingChanged": true,
            "Normal::Organization": true,
            "Normal::Project": true,
            "Normal::Permission": true
        },
        "email_body": {
            "CreateOrAssign::IssueAssigned": false,
            "CreateOrAssign::PullRequestAssigned": false,
            "ManageProject::Issue": false,
            "ManageProject::PullRequest": false,
            "ManageProject::Member": false,
            "ManageProject::SettingChanged": true,
            "Normal::Organization": false,
            "Normal::Project": true,
            "Normal::Permission": false
        }
    }

Success Data.

## 重新设置用户消息设置配置信息

重新设置用户消息设置配置信息

> 示例:

    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 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
notification_body | string | 站内信配置
email_body | string | 邮件配置

> 请求的JSON示例:

    {
        "setting": {
            "notification_body": {
                "CreateOrAssign::IssueAssigned": true,
                "CreateOrAssign::PullRequestAssigned": true,
                "ManageProject::Issue": true,
                "ManageProject::PullRequest": true,
                "ManageProject::Member": true,
                "ManageProject::SettingChanged": true,
                "Normal::Organization": true,
                "Normal::Project": true,
                "Normal::Permission": true
            },
            "email_body": {
                "CreateOrAssign::IssueAssigned": false,
                "CreateOrAssign::PullRequestAssigned": false,
                "ManageProject::Issue": false,
                "ManageProject::PullRequest": false,
                "ManageProject::Member": false,
                "ManageProject::SettingChanged": true,
                "Normal::Organization": false,
                "Normal::Project": "t",
                "Normal::Permission": false
            }
       }
    }

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
notification_body | string | 站内信配置
email_body | string | 邮件配置

> 返回的JSON示例:

    {
        "status": 0,
        "message": "响应成功",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "notification_body": {
            "CreateOrAssign::IssueAssigned": true,
            "CreateOrAssign::PullRequestAssigned": true,
            "ManageProject::Issue": true,
            "ManageProject::PullRequest": true,
            "ManageProject::Member": true,
            "ManageProject::SettingChanged": true,
            "Normal::Organization": true,
            "Normal::Project": true,
            "Normal::Permission": true
        },
        "email_body": {
            "CreateOrAssign::IssueAssigned": false,
            "CreateOrAssign::PullRequestAssigned": false,
            "ManageProject::Issue": false,
            "ManageProject::PullRequest": false,
            "ManageProject::Member": false,
            "ManageProject::SettingChanged": true,
            "Normal::Organization": false,
            "Normal::Project": true,
            "Normal::Permission": false
        }
    }

Success Data.

## 获取用户星标项目

获取用户星标项目

> 示例:

    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 请求

`GET api/users/:login/is_pinned_projects.json`

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 星标项目数量
identifier | string | 项目标识
name | string | 项目名称
description | string | 项目描述
visits | int | 项目访问数量
praises_count | int | 项目点赞数量
watchers_count | int | 项目关注数量
issues_count | int | 项目issue数量
pull_requests_count | int | 项目合并请求数量
forked_count | int | 项目复刻数量
is_public | bool | 项目是否公开
mirror_url | string | 镜像地址
type | int | 项目类型 0 普通项目 1 普通镜像项目 2 同步镜像项目
time_ago | string | 上次更新时间
open_devops | int | 是否开启devops
forked_from_project_id | int | fork项目id
platform | string | 项目平台
author.name | string | 项目拥有者名称
author.type | string | 项目拥有者类型
author.login | string | 项目拥有者用户名
author.image_url | string | 项目拥有者头像
category.name | string | 项目分类名称
language.name | string | 项目语言名称
position | int | 项目排序

> 返回的JSON示例:

    {
        "total_count": 1,
        "projects": [
            {
                "id": 89,
                "repo_id": 89,
                "identifier": "monkey",
                "name": "boke",
                "description": "dkkd",
                "visits": 4,
                "praises_count": 0,
                "watchers_count": 0,
                "issues_count": 0,
                "pull_requests_count": 0,
                "forked_count": 0,
                "is_public": true,
                "mirror_url": "https://github.com/viletyy/monkey.git",
                "type": 1,
                "last_update_time": 1619685144,
                "time_ago": "27天前",
                "forked_from_project_id": null,
                "open_devops": false,
                "platform": "forge",
                "author": {
                    "name": "测试组织",
                    "type": "Organization",
                    "login": "ceshi_org",
                    "image_url": "images/avatars/Organization/9?t=1612706073"
                },
                "category": {
                    "id": 3,
                    "name": "深度学习"
                },
                "language": {
                    "id": 2,
                    "name": "C"
                }
            }
        ]
    }

Success Data.

## 用户添加星标项目

用户添加星标项目

> 示例:

    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 请求

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

### 请求字段说明:

#### 同时设定多个星标项目

参数 | 类型 | 字段说明
--- | --- | ---
is_pinned_project_ids | array | 设定为星标项目的id

#### 只设定一个星标项目

参数 | 类型 | 字段说明
--- | --- | ---
is_pinned_project_id | integer | 设定为星标项目的id

> 返回的JSON示例:

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

## 星标项目展示排序

星标项目展示排序

> 示例:

    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 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
pinned_projects.position | int | 排序,数字越大排名越前

> 请求的JSON示例：

    {
        "pinned_project": {
            "position": 1
        }
    }

> 返回的JSON示例:

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

## 用户近期活动统计

用户近期活动统计, 默认显示近一周的数据

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/statistics/activity.json

    await octokit.request('GET /api/users/:login/statistics/activity.json')

### HTTP 请求

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

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
dates | array | 时间
issues_count | array | 疑修数量
pull_requests_count | array | 合并请求数量
commtis_count | array | 贡献数量

> 返回的JSON示例:

    {
        "dates": [
            "2021.05.21",
            "2021.05.22",
            "2021.05.23",
            "2021.05.24",
            "2021.05.25",
            "2021.05.26",
            "2021.05.27",
            "2021.05.28"
        ],
        "issues_count": [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
        ],
        "pull_requests_count": [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
        ],
        "commits_count": [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
        ]
    }

Success Data.

## 获取用户贡献度

获取用户贡献度

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/headmaps.json

    await octokit.request('GET /api/users/:login/headmaps.json')

### HTTP 请求

`GET api/users/:login/headmaps.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
year | string | 年份

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_contributions | int | 所选时间内的总贡献度
headmaps.date | string | 时间
headmaps.contributions | int | 贡献度

> 返回的JSON示例:

    {
        "total_contributions": 139,
        "headmaps": [
            {
                "date": "2021-02-07",
                "contributions": 1
            },
            {
                "date": "2021-02-21",
                "contributions": 13
            },
            {
                "date": "2021-02-25",
                "contributions": 5
            },
            {
                "date": "2021-03-01",
                "contributions": 2
            },
            {
                "date": "2021-03-04",
                "contributions": 1
            },
            {
                "date": "2021-03-15",
                "contributions": 9
            },
            {
                "date": "2021-03-22",
                "contributions": 14
            },
            {
                "date": "2021-03-24",
                "contributions": 1
            },
            {
                "date": "2021-03-30",
                "contributions": 11
            },
            {
                "date": "2021-04-06",
                "contributions": 1
            },
            {
                "date": "2021-04-12",
                "contributions": 1
            },
            {
                "date": "2021-04-13",
                "contributions": 2
            },
            {
                "date": "2021-04-19",
                "contributions": 3
            },
            {
                "date": "2021-04-23",
                "contributions": 37
            },
            {
                "date": "2021-04-25",
                "contributions": 2
            },
            {
                "date": "2021-04-26",
                "contributions": 6
            },
            {
                "date": "2021-04-28",
                "contributions": 1
            },
            {
                "date": "2021-04-29",
                "contributions": 18
            },
            {
                "date": "2021-04-30",
                "contributions": 9
            },
            {
                "date": "2021-05-04",
                "contributions": 1
            },
            {
                "date": "2021-05-06",
                "contributions": 1
            }
        ]
    }

Success Data.

## 获取用户动态

获取用户动态

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/project_trends.json

    await octokit.request('GET /api/users/:login/project_trends.json')

### HTTP 请求

`GET api/users/:login/project_trends.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
date | string | 日期，格式: 2021-05-28

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 所选时间内的总动态数
project_trends.trend_type | string | 动态类型，Issue：疑修，VersionRelease：版本发布，PullRequest：合并请求
project_trends.action_type | string | 操作类型
project_trends.trend_id | integer | 动态id
project_trends.user_name | string | 用户名称
project_trends.user_login | string | 用户用户名
project_trends.user_avatar | string | 用户头像
project_trends.action_time | string | 操作时间
project_trends.name | string | 动态标题

> 返回的JSON示例:

    {
        "total_count": 16,
        "project_trends": [
            {
                "id": 27,
                "trend_type": "Issue",
                "action_type": "创建了工单",
                "trend_id": 18,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "21天前",
                "name": "31213123123",
                "issue_type": "1",
                "status_id": 2,
                "priority_id": 4,
                "created_at": "2021-05-07 15:39",
                "updated_at": "2021-05-27 15:42",
                "assign_user_name": "yystopf",
                "assign_user_login": "yystopf",
                "issue_journal_size": 1,
                "issue_journals": []
            },
            {
                "id": 8,
                "trend_type": "VersionRelease",
                "action_type": "创建了版本发布",
                "trend_id": 8,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "24天前",
                "name": "heihei1",
                "tag_name": "v1.0",
                "target_commitish": "master",
                "tarball_url": "http://localhost:10080/forgeceshiorg1/ceshi1/archive/v1.0.tar.gz",
                "zipball_url": "http://localhost:10080/forgeceshiorg1/ceshi1/archive/v1.0.zip",
                "url": "http://localhost:10080/api/v1/repos/forgeceshiorg1/ceshi1/releases/84",
                "version_gid": "84",
                "created_at": "2021-05-04 12:04"
            },
            {
                "id": 25,
                "trend_type": "PullRequest",
                "action_type": "关闭了合并请求",
                "trend_id": 14,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "13",
                "created_at": "2021-04-30 15:39"
            },
            {
                "id": 24,
                "trend_type": "PullRequest",
                "action_type": "创建了合并请求",
                "trend_id": 13,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "211212",
                "created_at": "2021-04-30 15:37"
            },
            {
                "id": 23,
                "trend_type": "PullRequest",
                "action_type": "创建了合并请求",
                "trend_id": 12,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "奇偶哦iu",
                "created_at": "2021-04-30 10:19"
            },
            {
                "id": 22,
                "trend_type": "PullRequest",
                "action_type": "创建了合并请求",
                "trend_id": 11,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "2112123",
                "created_at": "2021-04-29 18:46"
            },
            {
                "id": 21,
                "trend_type": "PullRequest",
                "action_type": "关闭了合并请求",
                "trend_id": 10,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "23123",
                "created_at": "2021-04-29 18:45"
            },
            {
                "id": 20,
                "trend_type": "PullRequest",
                "action_type": "创建了合并请求",
                "trend_id": 9,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "33",
                "created_at": "2021-04-29 18:37"
            },
            {
                "id": 19,
                "trend_type": "PullRequest",
                "action_type": "关闭了合并请求",
                "trend_id": 8,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "28天前",
                "name": "gggg",
                "created_at": "2021-04-29 17:51"
            },
            {
                "id": 16,
                "trend_type": "Issue",
                "action_type": "创建了工单",
                "trend_id": 8,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "1个月前",
                "name": "hjhkj",
                "issue_type": "1",
                "status_id": 1,
                "priority_id": 2,
                "created_at": "2021-04-19 10:52",
                "updated_at": "2021-04-19 10:52",
                "assign_user_name": null,
                "assign_user_login": null,
                "issue_journal_size": 0,
                "issue_journals": []
            },
            {
                "id": 7,
                "trend_type": "VersionRelease",
                "action_type": "创建了版本发布",
                "trend_id": 7,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "1个月前",
                "name": "v3.0.1",
                "tag_name": "v3.0.1",
                "target_commitish": "master",
                "tarball_url": "http://localhost:10080/yystopf/ceshirepo1/archive/v3.0.1.tar.gz",
                "zipball_url": "http://localhost:10080/yystopf/ceshirepo1/archive/v3.0.1.zip",
                "url": "http://localhost:10080/api/v1/repos/yystopf/ceshirepo1/releases/78",
                "version_gid": "78",
                "created_at": "2021-03-30 15:51"
            },
            {
                "id": 6,
                "trend_type": "VersionRelease",
                "action_type": "创建了版本发布",
                "trend_id": 6,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "1个月前",
                "name": "v3.0.0",
                "tag_name": "v3.0.0",
                "target_commitish": "master",
                "tarball_url": "http://localhost:10080/yystopf/ceshirepo1/archive/v3.0.0.tar.gz",
                "zipball_url": "http://localhost:10080/yystopf/ceshirepo1/archive/v3.0.0.zip",
                "url": "http://localhost:10080/api/v1/repos/yystopf/ceshirepo1/releases/77",
                "version_gid": "77",
                "created_at": "2021-03-30 15:33"
            },
            {
                "id": 5,
                "trend_type": "VersionRelease",
                "action_type": "创建了版本发布",
                "trend_id": 5,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "1个月前",
                "name": "v1.0.0",
                "tag_name": "v1.0.0",
                "target_commitish": "master",
                "tarball_url": "http://localhost:10080/yystopf/ceshirepo1/archive/v1.0.0.tar.gz",
                "zipball_url": "http://localhost:10080/yystopf/ceshirepo1/archive/v1.0.0.zip",
                "url": "http://localhost:10080/api/v1/repos/yystopf/ceshirepo1/releases/76",
                "version_gid": "76",
                "created_at": "2021-03-30 15:27"
            },
            {
                "id": 2,
                "trend_type": "VersionRelease",
                "action_type": "创建了版本发布",
                "trend_id": 2,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "2个月前",
                "name": "vvvv",
                "tag_name": "v1.1",
                "target_commitish": "dev",
                "tarball_url": "http://localhost:10080/yystopf/virus_blog/archive/v1.1.tar.gz",
                "zipball_url": "http://localhost:10080/yystopf/virus_blog/archive/v1.1.zip",
                "url": "http://localhost:10080/api/v1/repos/yystopf/virus_blog/releases/6",
                "version_gid": "6",
                "created_at": "2021-03-15 14:18"
            },
            {
                "id": 2,
                "trend_type": "PullRequest",
                "action_type": "创建了合并请求",
                "trend_id": 2,
                "user_name": "yystopf",
                "user_login": "yystopf",
                "user_avatar": "system/lets/letter_avatars/2/Y/241_125_89/120.png",
                "action_time": "3个月前",
                "name": "444",
                "created_at": "2021-02-25 17:31"
            }
        ]
    }

Success Data.

## 用户开发能力

用户开发能力， 默认为所有时间下的开发能力

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/statistics/develop.json

    await octokit.request('GET /api/users/:login/statistics/develop.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
start_time | integer | 时间戳，开始时间，格式：1621526400
end_time | integer | 时间戳，结束时间，格式：1622131200

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
influence | int | 影响力
contribution | int | 贡献度
activity | int | 活跃度
experience | int | 项目经验
language | int | 语言能力
languages_percent | float | 语言百分比
each_language_score | int | 各门语言分数

> 返回的JSON示例:

    {
        "platform": {
            "influence": 61,
            "contribution": 75,
            "activity": 66,
            "experience": 95,
            "language": 87,
            "languages_percent": {
                "CSS": 0.03,
                "C#": 0.13,
                "Ruby": 0.04,
                "Go": 0.05,
                "C": 0.19,
                "Java": 0.34,
                "Python": 0.09,
                "C+": 0.01,
                "C++": 0.11,
                "Scala": 0.01,
                "HTML": 0.01
            },
            "each_language_score": {
                "CSS": 71,
                "C#": 86,
                "Ruby": 75,
                "Go": 77,
                "C": 90,
                "Java": 93,
                "Python": 83,
                "C+": 66,
                "C++": 85,
                "Scala": 66,
                "HTML": 66
            }
        },
        "user": {
            "influence": 60,
            "contribution": 72,
            "activity": 65,
            "experience": 88,
            "language": 84,
            "languages_percent": {
                "C": 0.25,
                "C#": 0.33,
                "C++": 0.13,
                "CSS": 0.08,
                "Go": 0.04,
                "HTML": 0.04,
                "Java": 0.04,
                "Ruby": 0.08
            },
            "each_language_score": {
                "C": 81,
                "C#": 84,
                "C++": 75,
                "CSS": 71,
                "Go": 66,
                "HTML": 66,
                "Java": 66,
                "Ruby": 71
            }
        }
    }

Success Data.

## 用户角色定位

用户角色定位，默认显示所有时间下的角色定位数据

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/statistics/role.json

    await octokit.request('GET /api/users/:login/statistics/role.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
start_time | integer | 时间戳，开始时间，格式：1621526400
end_time | integer | 时间戳，结束时间，格式：1622131200

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_projects_count | int | 用户所有的项目数量
role.object.count | int | 用户该语言下的项目数量
role.object.percent | float | 用户该语言下的项目占比

> 返回的JSON示例:

    {
        "total_projects_count": 27,
        "role": {
            "owner": {
                "count": 24,
                "percent": 0.89
            },
            "manager": {
                "count": 1,
                "percent": 0.04
            },
            "developer": {
                "count": 2,
                "percent": 0.07
            },
            "reporter": {
                "count": 0,
                "percent": 0.0
            }
        }
    }

Success Data.

## 用户专业定位

用户专业定位，默认显示所有时间下的专业定位数据

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/statistics/major.json

    await octokit.request('GET /api/users/:login/statistics/major.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
start_time | integer | 时间戳，开始时间，格式：1621526400
end_time | integer | 时间戳，结束时间，格式：1622131200

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
categories | int | 用户项目分类

> 返回的JSON示例:

    {
        "categories": [
            "大数据",
            "机器学习",
            "深度学习",
            "人工智能",
            "智慧医疗",
            "云计算"
        ]
    }

Success Data.

## 待办事项-用户通知信息

待办事项-用户通知信息

> 示例:

    curl -X GET http://localhost:3000/api/users/yystopf/applied_messages.json

    await octokit.request('GET /api/users/:login/applied_messages.json')

### HTTP 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
applied | object | 通知主体
applied.id | int | 通知主体的迁移id
applied.status | string | 通知主体的迁移状态，canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
applied.time_ago | string | 通知主体的迁移创建的时间
applied.project.id | int | 通知主体的迁移项目的id
applied.project.identifier | string | 通知主体的迁移项目的标识
applied.project.name | string | 通知主体的迁移项目的名称
applied.project.description | string | 通知主体的迁移项目的描述
applied.project.is_public | bool | 通知主体的迁移项目是否公开
applied.project.owner.id | bool | 通知主体的迁移项目拥有者id
applied.project.owner.type | string | 通知主体的迁移项目拥有者类型
applied.project.owner.name | string | 通知主体的迁移项目拥有者昵称
applied.project.owner.login | string | 通知主体的迁移项目拥有者标识
applied.project.owner.image_url | string | 通知主体的迁移项目拥有者头像
applied.user.id | int | 通知主体的迁移创建者的id
applied.user.type | string | 通知主体的迁移创建者的类型
applied.user.name | string | 通知主体的迁移创建者的名称
applied.user.login | string | 通知主体的迁移创建者的标识
applied.user.image_url | string | 通知主体的迁移创建者头像
applied_user.id | int | 通知发起者的id
applied_user.type | string | 通知发起者的类型
applied_user.name | string | 通知发起者的名称
applied_user.login | string | 通知发起者的标识
applied_user.image_url | string | 通知发起者头像
applied_type | string | 通知类型
name | string | 通知内容
viewed | string | 是否已读，waiting:未读,viewed:已读
status | string | 通知状态, canceled:已取消,common: 正常,successed:成功,failure:失败
time_ago | string | 通知时间

> 返回的JSON示例:

    {
        "total_count": 5,
        "applied_messages": [
            {
                "applied": {
                    "project": {
                        "id": 74,
                        "identifier": "hehuisssjssjjsjs",
                        "name": "hehuisssjssjjsjs",
                        "description": "wwww",
                        "is_public": false,
                        "owner": {
                            "id": 10,
                            "type": "User",
                            "name": "testforge1",
                            "login": "testforge1",
                            "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
                        }
                    },
                    "user": {
                        "id": 6,
                        "type": "User",
                        "name": "何慧",
                        "login": "yystopf",
                        "image_url": "images/avatars/User/6?t=1622513134"
                    },
                    "id": 6,
                    "status": "accepted",
                    "created_at": "2021-06-09 16:34",
                    "time_ago": "1分钟前"
                },
                "applied_user": {
                    "id": 6,
                    "type": "User",
                    "name": "何慧",
                    "login": "yystopf",
                    "image_url": "images/avatars/User/6?t=1622513134"
                },
                "applied_type": "AppliedProject",
                "name": "已通过你加入【hehuisssjssjjsjs】仓库的申请。",
                "viewed": "waiting",
                "status": "successed",
                "created_at": "2021-06-09 16:34",
                "time_ago": "1分钟前"
            },
            {
                "applied": {
                    "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": 9,
                        "type": "Organization",
                        "name": "测试组织",
                        "login": "ceshi_org",
                        "image_url": "images/avatars/Organization/9?t=1612706073"
                    },
                    "id": 4,
                    "status": "common",
                    "created_at": "2021-04-26 09:54",
                    "time_ago": "35分钟前"
                },
                "applied_user": {
                    "id": 6,
                    "type": "User",
                    "name": "yystopf",
                    "login": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
                },
                "applied_type": "AppliedTransferProject",
                "name": "正在将【测试项目啊1】仓库转移给【测试组织】",
                "viewed": "viewed",
                "status": "common",
                "created_at": "2021-04-26 09:54",
                "time_ago": "35分钟前"
            },
            ...
        ]
    }

## 待办事项-接受仓库

待办事项-接受仓库

> 示例:

    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 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 迁移id
status | string | 迁移状态，canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
time_ago | string | 迁移创建的时间
project.id | int | 迁移项目的id
project.identifier | string | 迁移项目的标识
project.name | string | 迁移项目的名称
project.description | string | 迁移项目的描述
project.is_public | bool | 迁移项目是否公开
project.owner.id | bool | 迁移项目拥有者id
project.owner.type | string | 迁移项目拥有者类型
project.owner.name | string | 迁移项目拥有者昵称
project.owner.login | string | 迁移项目拥有者标识
project.owner.image_url | string | 迁移项目拥有者头像
user.id | int | 迁移创建者的id
user.type | string | 迁移创建者的类型
user.name | string | 迁移创建者的名称
user.login | string | 迁移创建者的标识
user.image_url | string | 迁移创建者头像
owner.id | int | 迁移接受者的id
owner.type | string | 迁移接受者的类型
owner.name | string | 迁移接受者的名称
owner.login | string | 迁移接受者的标识
owner.image_url | string | 迁移接受者头像

> 返回的JSON示例:

    {
        "total_count": 4,
        "applied_transfer_projects": [
            {
                "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/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`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
id | int | 迁移id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 迁移id
status | string | 迁移状态，canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
time_ago | string | 迁移创建的时间
project.id | int | 迁移项目的id
project.identifier | string | 迁移项目的标识
project.name | string | 迁移项目的名称
project.description | string | 迁移项目的描述
project.is_public | bool | 迁移项目是否公开
project.owner.id | bool | 迁移项目拥有者id
project.owner.type | string | 迁移项目拥有者类型
project.owner.name | string | 迁移项目拥有者昵称
project.owner.login | string | 迁移项目拥有者标识
project.owner.image_url | string | 迁移项目拥有者头像
user.id | int | 迁移创建者的id
user.type | string | 迁移创建者的类型
user.name | string | 迁移创建者的名称
user.login | string | 迁移创建者的标识
user.image_url | string | 迁移创建者头像
owner.id | int | 迁移接受者的id
owner.type | string | 迁移接受者的类型
owner.name | string | 迁移接受者的名称
owner.login | string | 迁移接受者的标识
owner.image_url | string | 迁移接受者头像

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
id | int | 迁移id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 迁移id
status | string | 迁移状态，canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
time_ago | string | 迁移创建的时间
project.id | int | 迁移项目的id
project.identifier | string | 迁移项目的标识
project.name | string | 迁移项目的名称
project.description | string | 迁移项目的描述
project.is_public | bool | 迁移项目是否公开
project.owner.id | bool | 迁移项目拥有者id
project.owner.type | string | 迁移项目拥有者类型
project.owner.name | string | 迁移项目拥有者昵称
project.owner.login | string | 迁移项目拥有者标识
project.owner.image_url | string | 迁移项目拥有者头像
user.id | int | 迁移创建者的id
user.type | string | 迁移创建者的类型
user.name | string | 迁移创建者的名称
user.login | string | 迁移创建者的标识
user.image_url | string | 迁移创建者头像
owner.id | int | 迁移接受者的id
owner.type | string | 迁移接受者的类型
owner.name | string | 迁移接受者的名称
owner.login | string | 迁移接受者的标识
owner.image_url | string | 迁移接受者头像

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 申请id
status | string | 申请状态，canceled:取消,common:正在申请, accept:已接受,refuse:已拒绝
time_ago | string | 申请创建的时间
project.id | int | 申请项目的id
project.identifier | string | 申请项目的标识
project.name | string | 申请项目的名称
project.description | string | 申请项目的描述
project.is_public | bool | 申请项目是否公开
project.owner.id | bool | 申请项目拥有者id
project.owner.type | string | 申请项目拥有者类型
project.owner.name | string | 申请项目拥有者昵称
project.owner.login | string | 申请项目拥有者标识
project.owner.image_url | string | 申请项目拥有者头像
user.id | int | 申请创建者的id
user.type | string | 申请创建者的类型
user.name | string | 申请创建者的名称
user.login | string | 申请创建者的标识
user.image_url | string | 申请创建者头像

> 返回的JSON示例:

    {
        "total_count": 4,
        "applied_transfer_projects": [
            {
                "project": {
                    "id": 74,
                    "identifier": "hehuisssjssjjsjs",
                    "name": "hehuisssjssjjsjs",
                    "description": "wwww",
                    "is_public": false,
                    "owner": {
                        "id": 10,
                        "type": "User",
                        "name": "testforge1",
                        "login": "testforge1",
                        "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
                    }
                },
                "user": {
                    "id": 6,
                    "type": "User",
                    "name": "何慧",
                    "login": "yystopf",
                    "image_url": "images/avatars/User/6?t=1622513134"
                },
                "id": 7,
                "status": "common",
                "created_at": "2021-06-09 16:41",
                "time_ago": "7分钟前"
            },
            ...
        ]
    }

## 用户接受申请

用户接受申请

> 示例:

    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 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
id | int | 申请id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 申请id
status | string | 申请状态，canceled:取消,common:正在申请, accept:已接受,refuse:已拒绝
time_ago | string | 申请创建的时间
project.id | int | 申请项目的id
project.identifier | string | 申请项目的标识
project.name | string | 申请项目的名称
project.description | string | 申请项目的描述
project.is_public | bool | 申请项目是否公开
project.owner.id | bool | 申请项目拥有者id
project.owner.type | string | 申请项目拥有者类型
project.owner.name | string | 申请项目拥有者昵称
project.owner.login | string | 申请项目拥有者标识
project.owner.image_url | string | 申请项目拥有者头像
user.id | int | 申请创建者的id
user.type | string | 申请创建者的类型
user.name | string | 申请创建者的名称
user.login | string | 申请创建者的标识
user.image_url | string | 申请创建者头像

> 返回的JSON示例:

    {
        "project": {
            "id": 74,
            "identifier": "hehuisssjssjjsjs",
            "name": "hehuisssjssjjsjs",
            "description": "wwww",
            "is_public": false,
            "owner": {
                "id": 10,
                "type": "User",
                "name": "testforge1",
                "login": "testforge1",
                "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
            }
        },
        "user": {
            "id": 6,
            "type": "User",
            "name": "何慧",
            "login": "yystopf",
            "image_url": "images/avatars/User/6?t=1622513134"
        },
        "id": 7,
        "status": "accept",
        "created_at": "2021-06-09 16:41",
        "time_ago": "7分钟前"
    }

## 用户拒绝申请

用户拒绝申请

> 示例:

    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 请求

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

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
id | int | 申请id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 申请id
status | string | 申请状态，canceled:取消,common:正在申请, accept:已接受,refuse:已拒绝
time_ago | string | 申请创建的时间
project.id | int | 申请项目的id
project.identifier | string | 申请项目的标识
project.name | string | 申请项目的名称
project.description | string | 申请项目的描述
project.is_public | bool | 申请项目是否公开
project.owner.id | bool | 申请项目拥有者id
project.owner.type | string | 申请项目拥有者类型
project.owner.name | string | 申请项目拥有者昵称
project.owner.login | string | 申请项目拥有者标识
project.owner.image_url | string | 申请项目拥有者头像
user.id | int | 申请创建者的id
user.type | string | 申请创建者的类型
user.name | string | 申请创建者的名称
user.login | string | 申请创建者的标识
user.image_url | string | 申请创建者头像

> 返回的JSON示例:

    {
        "project": {
            "id": 74,
            "identifier": "hehuisssjssjjsjs",
            "name": "hehuisssjssjjsjs",
            "description": "wwww",
            "is_public": false,
            "owner": {
                "id": 10,
                "type": "User",
                "name": "testforge1",
                "login": "testforge1",
                "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
            }
        },
        "user": {
            "id": 6,
            "type": "User",
            "name": "何慧",
            "login": "yystopf",
            "image_url": "images/avatars/User/6?t=1622513134"
        },
        "id": 7,
        "status": "accept",
        "created_at": "2021-06-09 16:41",
        "time_ago": "7分钟前"
    }

## 用户发送邮件验证码

用户发送邮件验证码

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/send_email_vefify_code.json

    await octokit.request('GET /api/v1/:login/send_email_vefify_code.json')

### HTTP 请求

`GET /api/v1/:login/send_email_vefify_code.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
code_type | int | 10: 更新邮箱
email | string | 邮箱
smscode | string | 邮箱md5加密值

### 返回字段说明:

> 返回的JSON示例:

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

## 用户验证邮件验证码

用户验证邮件验证码

> 示例:

    curl -X POST http://localhost:3000/api/v1/yystopf/check_email_verify_code.json

    await octokit.request('POST /api/v1/:login/check_email_verify_code.json')

### HTTP 请求

`POST /api/v1/:login/check_email_verify_code.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
code_type | int | 10: 更新邮箱
email | string | 邮箱
code | string | 邮箱验证码

### 返回字段说明:

> 返回的JSON示例:

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

## 用户验证密码

用户验证密码，检查是否和用户密码一致

> 示例:

    curl -X POST http://localhost:3000/api/v1/yystopf/check_password.json

    await octokit.request('POST /api/v1/:login/check_password.json')

### HTTP 请求

`POST /api/v1/:login/check_password.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
password | string | 用户密码

### 返回字段说明:

> 返回的JSON示例:

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

## 用户验证邮箱

用户验证邮箱是否符合规范以及是否已被使用

> 示例:

    curl -X POST http://localhost:3000/api/v1/yystopf/check_email.json

    await octokit.request('POST /api/v1/:login/check_email.json')

### HTTP 请求

`POST /api/v1/:login/check_email.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
email | string | 邮箱地址

### 返回字段说明:

> 返回的JSON示例:

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

## 用户更改邮箱

用户更改一个新的邮箱

> 示例:

    curl -X PATCH http://localhost:3000/api/v1/yystopf/update_email.json

    await octokit.request('PATCH /api/v1/:login/update_email.json')

### HTTP 请求

`PATCH /api/v1/:login/update_email.json`

### 请求字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
login | string | 用户标识
password | string | 用户密码
email | string | 邮箱地址
code | string | 邮箱验证码

> 请求的JSON示例:

    {
        "password": "Aa19960425.",
        "code": "657134",
        "email": "yystopf@163.com"
    }

> 返回的JSON示例:

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

# Projects

## 获取项目邀请链接（项目管理员）

当前登录（管理员）用户获取项目邀请链接的接口（第一次请求会默认生成role类型为developer和is_apply为true的链接）

> 示例:

    curl -X GET http://localhost:3000/api/yystopf/kellect/project_invite_links/current_link.json

    await octokit.request('GET /api/yystopf/kellect/project_invite_links/current_link.json')

### HTTP 请求

`GET /api/:owner/:repo/project_invite_links/current_link.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
role | 是 |  | string | 项目权限，reporter: 报告者, developer: 开发者，manager：管理员
is_apply | 是 |  | boolean | 是否需要审核

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 链接id
role | string | 邀请角色
is_apply | boolean | 是否需要审核
sign | string | 邀请标识(放在链接后面即可)
expired_at | string | 链接过期时间
user.id | int | 链接创建者的id
user.type | string | 链接创建者的类型
user.name | string | 链接创建者的名称
user.login | string | 链接创建者的标识
user.image_url | string | 链接创建者头像
project.id | int | 链接关联项目的id
project.identifier | string | 链接关联项目的标识
project.name | string | 链接关联项目的名称
project.description | string | 链接关联项目的描述
project.is_public | bool | 链接关联项目是否公开
project.owner.id | bool | 链接关联项目拥有者id
project.owner.type | string | 链接关联项目拥有者类型
project.owner.name | string | 链接关联项目拥有者昵称
project.owner.login | string | 链接关联项目拥有者标识
project.owner.image_url | string | 链接关联项目拥有者头像

> 返回的JSON示例:

    {
        "id": 7,
        "role": "developer",
        "is_apply": false,
        "sign": "6b6b454843c291d4e52e60853cb8ad9f",
        "expired_at": "2022-06-23 10:08",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "project": {
            "id": 474,
            "identifier": "kellect",
            "name": "kellect",
            "description": null,
            "is_public": true,
            "owner": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            }
        }
    }

## 生成项目邀请链接（项目管理员）

当前登录（管理员）用户生成的项目邀请链接，可选role和is_apply参数

> 示例:

    curl -X POST http://localhost:3000/api/yystopf/kellect/project_invite_links/generate_link.json

    await octokit.request('POST /api/yystopf/kellect/project_invite_links/generate_link.json')

### HTTP 请求

`POST /api/:owner/:repo/project_invite_links/generate_link.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
role | 是 |  | string | 项目权限，reporter: 报告者, developer: 开发者，manager：管理员
is_apply | 是 |  | boolean | 是否需要审核

> 请求的JSON示例

    {
        "role": "developer",
        "is_apply": false
    }

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 链接id
role | string | 邀请角色
is_apply | boolean | 是否需要审核
sign | string | 邀请标识(放在链接后面即可)
expired_at | string | 链接过期时间
user.id | int | 链接创建者的id
user.type | string | 链接创建者的类型
user.name | string | 链接创建者的名称
user.login | string | 链接创建者的标识
user.image_url | string | 链接创建者头像
project.id | int | 链接关联项目的id
project.identifier | string | 链接关联项目的标识
project.name | string | 链接关联项目的名称
project.description | string | 链接关联项目的描述
project.is_public | bool | 链接关联项目是否公开
project.owner.id | bool | 链接关联项目拥有者id
project.owner.type | string | 链接关联项目拥有者类型
project.owner.name | string | 链接关联项目拥有者昵称
project.owner.login | string | 链接关联项目拥有者标识
project.owner.image_url | string | 链接关联项目拥有者头像

> 返回的JSON示例:

    {
        "id": 7,
        "role": "developer",
        "is_apply": false,
        "sign": "6b6b454843c291d4e52e60853cb8ad9f",
        "expired_at": "2022-06-23 10:08",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "project": {
            "id": 474,
            "identifier": "kellect",
            "name": "kellect",
            "description": null,
            "is_public": true,
            "owner": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            }
        }
    }

## 获取邀请链接信息（被邀请用户）

用户请求邀请链接时，通过该接口来获取链接的信息

> 示例:

    curl -X GET http://localhost:3000/api/yystopf/kellect/project_invite_links/show_link.json?invite_sign=d612df03aad63760445c187bcf83f2e6

    await octokit.request('POST /api/yystopf/kellect/project_invite_links/show_link.json?invite_sign=d612df03aad63760445c187bcf83f2e6')

### HTTP 请求

`POST /api/:owner/:repo/project_invite_links/show_link.json?invite_sign=xxx`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
invite_sign | 是 |  | string | 项目邀请链接的标识

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 链接id
role | string | 邀请角色
is_apply | boolean | 是否需要审核
sign | string | 邀请标识(放在链接后面即可)
expired_at | string | 链接过期时间
user.id | int | 链接创建者的id
user.type | string | 链接创建者的类型
user.name | string | 链接创建者的名称
user.login | string | 链接创建者的标识
user.image_url | string | 链接创建者头像
project.id | int | 链接关联项目的id
project.identifier | string | 链接关联项目的标识
project.name | string | 链接关联项目的名称
project.description | string | 链接关联项目的描述
project.is_public | bool | 链接关联项目是否公开
project.owner.id | bool | 链接关联项目拥有者id
project.owner.type | string | 链接关联项目拥有者类型
project.owner.name | string | 链接关联项目拥有者昵称
project.owner.login | string | 链接关联项目拥有者标识
project.owner.image_url | string | 链接关联项目拥有者头像

> 返回的JSON示例:

    {
        "id": 7,
        "role": "developer",
        "is_apply": false,
        "sign": "6b6b454843c291d4e52e60853cb8ad9f",
        "expired_at": "2022-06-23 10:08",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "project": {
            "id": 474,
            "identifier": "kellect",
            "name": "kellect",
            "description": null,
            "is_public": true,
            "owner": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            }
        }
    }

## 接受项目邀请链接（被邀请用户）

当前登录（非项目）用户加入项目的接口，如果项目链接不需要审核，请求成功后即加入项目，如果需要审核，那么会提交一个申请，需要项目管理员审核

> 示例:

    curl -X POST http://localhost:3000/api/yystopf/kellect/project_invite_links/redirect_link.json?invite_sign=d612df03aad63760445c187bcf83f2e6

    await octokit.request('POST /api/yystopf/kellect/project_invite_links/redirect_link.json?invite_sign=d612df03aad63760445c187bcf83f2e6')

### HTTP 请求

`POST /api/:owner/:repo/project_invite_links/redirect_link.json?invite_sign=xxx`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
invite_sign | 是 |  | string | 项目邀请链接的标识

> 返回的JSON示例:

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

## 申请加入项目

申请加入项目

> 示例:

    curl -X POST http://localhost:3000/api/applied_projects.json

    await octokit.request('POST /api/appliedr_projects.json')

### HTTP 请求

`POST /api/applied_projects.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
applied_project.code | 是 |  | string | 邀请码
applied_project.role | 否 |  | string | 项目权限，reporter: 报告者, developer: 开发者，manager：管理员

> 请求的JSON示例

    {
      "applied_project": {
        "code": "1una34",
        "role": "developer"
      }
    }

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 申请id
status | string | 申请状态，canceled:取消,common:正在申请, accept:已接受,refuse:已拒绝
time_ago | string | 项目申请创建的时间
project.id | int | 申请项目的id
project.identifier | string | 申请项目的标识
project.name | string | 申请项目的名称
project.description | string | 申请项目的描述
project.is_public | bool | 申请项目是否公开
project.owner.id | bool | 申请项目拥有者id
project.owner.type | string | 申请项目拥有者类型
project.owner.name | string | 申请项目拥有者昵称
project.owner.login | string | 申请项目拥有者标识
project.owner.image_url | string | 申请项目拥有者头像
user.id | int | 申请创建者的id
user.type | string | 申请创建者的类型
user.name | string | 申请创建者的名称
user.login | string | 申请创建者的标识
user.image_url | string | 申请创建者头像

> 返回的JSON示例:

    {
        "project": {
            "id": 74,
            "identifier": "hehuisssjssjjsjs",
            "name": "hehuisssjssjjsjs",
            "description": "wwww",
            "is_public": false,
            "owner": {
                "id": 10,
                "type": "User",
                "name": "testforge1",
                "login": "testforge1",
                "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
            }
        },
        "user": {
            "id": 6,
            "type": "User",
            "name": "何慧",
            "login": "yystopf",
            "image_url": "images/avatars/User/6?t=1622513134"
        },
        "id": 7,
        "status": "common",
        "created_at": "2021-06-09 16:41",
        "time_ago": "1分钟前"
    }

## 获取项目列表

获取项目列表，也可以更加相关条件过滤搜素

> 示例:

    curl -X GET \
    -d "page=1" \
    -d "limit=5" \
    http://localhost:3000/api/projects  | jq

    await octokit.request('GET /api/projects')

### HTTP 请求

`GET api/projects`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
page | false | 1 | string | 页数，第几页
limit | false | 15 | string | 每页多少条数据，默认15条
sort_by | false |  | string | 排序类型, 取值：updated_on、created_on、forked_count、praises_count; updated_on: 更新时间排序，created_on: 创建时间排序，forked_count: fork数据排序，praises_count: 点赞数量排序，默认为updated_on更新时间排序
sort_direction | false |  | string | 排序方式,取值为: desc、asc; desc: 降序排序， asc: 升序排序， 默认为：desc
search | false |  | string | 按照项目名称搜索
category_id | false |  | int | 项目类别id
language_id | false |  | int | 项目语言id
project_type | false |  | string | 项目类型， 取值为：common、mirror; common:开源托管项目, mirror:开源镜像项目

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 项目总条数
id | string | 项目id
name | string | 项目名称
description | string | 项目简介
visits | int | 流量数
forked_count | int | 被fork的数量
praises_count | int | star数量
is_public | boolean | 是否公开， true:公开，false:未公开
mirror_url | string | 镜像url
last_update_time | int | 最后更新时间，为UNIX格式的时间戳
author | object | 项目创建者
-- name | string | 用户名，也是用户标识
category | object | 项目类别
-- id | int | 项目类型id
-- name | string | 项目类型名称
language | object | 项目语言
-- id | int | 项目语言id
-- name | string | 项目语言名称

> 返回的JSON示例:

    {
      "total_count": 3096,
      "projects": [
        {
          "id": 1400794,
          "repo_id": 1402452,
          "identifier": "cscw_2021_sponsor",
          "name": "Sponsor机制下的开源贡献",
          "description": "CSCW 2021 sponsor机制研究",
          "visits": 5,
          "praises_count": 0,
          "forked_count": 0,
          "is_public": true,
          "mirror_url": null,
          "type": 0,
          "last_update_time": 1611971671,
          "time_ago": "2天前",
          "forked_from_project_id": null,
          "open_devops": false,
          "platform": "forge",
          "author": {
            "name": "张迅晖",
            "login": "Nigel",
            "image_url": "images/avatars/User/3675?t=1611832880"
          },
          "category": {
            "id": 13,
            "name": "云计算和大数据"
          },
          "language": {
            "id": 34,
            "name": "Python3.6"
          }
        }
      ]
    }

Remember — a happy kitten is an authenticated kitten!

## 推荐项目

获取推荐项目列表

> 示例:

    curl -X GET \
    http://localhost:3000/api/projects/recommend  | jq

    await octokit.request('GET /api/projects/recommend.json')

### HTTP 请求

`GET api/projects/recommend`

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 项目总条数
id | string | 项目id
name | string | 项目名称
description | string | 项目简介
visits | int | 流量数
forked_count | int | 被fork的数量
praises_count | int | star数量
is_public | boolean | 是否公开， true:公开，false:未公开
mirror_url | string | 镜像url
last_update_time | int | 最后更新时间，为UNIX格式的时间戳
author | object | 项目创建者
-- name | string | 用户名，也是用户标识
category | object | 项目类别
-- id | int | 项目类型id
-- name | string | 项目类型名称
language | object | 项目语言
-- id | int | 项目语言id
-- name | string | 项目语言名称

> 返回的JSON示例:

    [
      {
        "id": 20,
        "repo_id": 2,
        "identifier": "PNAekinmH",
        "name": "FNILL",
        "visits": 13567,
        "author": {
          "name": "王一达",
          "login": "wangyida",
          "image_url": "avatars/User/b"
        },
        "category": {
          "id": 8,
          "name": "其他"
        }
      }
    ]

Remember — a happy kitten is an authenticated kitten!

## 项目导航

获取项目导航信息

> 示例:

    curl -X GET \
    http://localhost:3000/api/yystopf/ceshi/menu_list  | jq

    await octokit.request('GET /api/yystopf/ceshi/menu_list')

### HTTP 请求

`GET api/:owner/:repo/menu_list`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
menu_name | string | 导航名称， home:主页,code:代码库,issues:疑修,pulls:合并请求,devops:工作流,versions:里程碑,wiki:维基,services:服务,activity:动态,setting:仓库设置

> 返回的JSON示例:

    [
        {
            "menu_name": "home"
        },
        {
            "menu_name": "code"
        },
        {
            "menu_name": "pulls"
        },
        {
            "menu_name": "activity"
        }
    ]

## 项目主页

获取项目主页信息

> 示例:

    curl -X GET \
    http://localhost:3000/api/jasder/forgeplus/about  | jq

    await octokit.request('GET /api/jasder/forgeplus/about')

### HTTP 请求

`GET api/:owner/:repo/about`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
identifier | string | project's identifier
content | string | 主页内容
attachments | array | 附件

> 返回的JSON示例:

    {
      "content": "",
      "identifier": "forgeplus",
      attachments: []
    }

Remember — a happy kitten is an authenticated kitten!

## 项目模块信息

项目模块信息

> 示例:

    curl -X GET \
    http://localhost:3000/api/yystopf/ceshi/project_units.json

    await octokit.request('GET /api/yystopf/ceshi/project_units')

### HTTP 请求

`GET /api/yystopf/ceshi/project_units`

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 模块名称

> 返回的JSON示例:

    [
        {
            "type": "code"
        },
        {
            "type": "pulls"
        },
        {
            "type": "issues"
        }
    ]

## 更改项目模块展示

更改项目模块展示

> 示例:

    curl -X POST \
    -H  "accept: application/json" \
    -H  "Content-Type: application/json" \
    -d "{ \"unit_typs\": [\"code\", \"pulls\"]}" \
    http://localhost:3000/api/yystopf/ceshi/project_units.json

    await octokit.request('POST /api/yystopf/ceshi/project_units')

### HTTP 请求

`POST /api/yystopf/ceshi/project_units`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
unit_types | 是 |  | array | 项目模块内容， 支持以下参数:code:代码库,issues:疑修,pulls:合并请求,devops:工作流,versions:里程碑,wiki:维基,resources:资源库,services:服务

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
status | int | 返回状态， 0: 表示操作成功
message | string | 返回信息说明

> 返回的JSON示例:

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

## 创建项目

创建项目

> 示例:

    curl -X POST \
    -d "user_id=36401" \
    -d "name=hnfl_demo" \
    -d "description=my first project" \
    -d "repository_name=hnfl_demo" \
    -d "project_category_id=1" \
    -d "project_language_id=2" \
    -d "ignore_id=2" \
    -d "license_id=1" \
    http://localhost:3000/api/projects.json

    await octokit.request('GET /api/projects.json')

### HTTP 请求

`POST api/projects`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
user_id | 是 |  | int | 用户id或者组织id
name | 是 |  | string | 项目名称
description | 是 |  | string | 项目描述
repository_name | 是 |  | string | 仓库名称, 只含有数字、字母、下划线不能以下划线开头和结尾，且唯一
project_category_id | 是 |  | int | 项目类别id
project_language_id | 是 |  | int | 项目语言id
ignore_id | 否 |  | int | gitignore相关id
license_id | 否 |  | int | 开源许可证id
private | 否 |  | boolean | 项目是否私有, true：为私有，false: 公开，默认为公开

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
name | string | 项目名称

> 返回的JSON示例:

    {
      "id": 3240,
      "name": "好项目"
    }

## 创建镜像项目

创建镜像项目

> 示例:

    curl -X POST \
    -d "user_id=36408" \
    -d "clone_addr=https://gitea.com/mx8090alex/golden.git" \
    -d "name=golden_mirror1" \
    -d "description=golden_mirror" \
    -d "project_category_id=1" \
    -d "project_language_id=2" \
    http://localhost:3000/api/projects/migrate.json

    await octokit.request('GET /api/projects/migrate.json')

### HTTP 请求

`POST api/projects/migrate.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
user_id | 是 |  | int | 用户id或者组织id
name | 是 |  | string | 项目名称
clone_addr | 是 |  | string | 镜像项目clone地址
description | 否 |  | string | 项目描述
repository_name | 是 |  | string | 仓库名称, 只含有数字、字母、下划线不能以下划线开头和结尾，且唯一
project_category_id | 是 |  | int | 项目类别id
project_language_id | 是 |  | int | 项目语言id
is_mirror | 否 |  | boolean | 是否设置为镜像， true：是， false：否，默认为否
auth_username | 否 |  | string | 镜像源仓库的登录用户名
auth_password | 否 |  | string | 镜像源仓库的登录秘密
private | 否 |  | boolean | 项目是否私有, true：为私有，false: 非私有，默认为公开

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
name | string | 项目名称

> 返回的JSON示例:

    {
      "id": 3241,
      "name": "这是一个镜像项目"
    }

## 同步镜像

手动同步镜像

> 示例:

    curl -X POST http://localhost:3000/api/repositories/1244/sync_mirror.json

    await octokit.request('POST /api/repositories/1244/sync_mirror.json')

### HTTP 请求

`POST api/repositories/:id/sync_mirror.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
id | 是 |  | int | 仓库id

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
status | int | 状态码， 0:标识请求成功
message | string | 服务端返回的信息说明

> 返回的JSON示例:

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

## Fork项目

fork项目

> 示例:

    curl -X POST http://localhost:3000/api/jasder/forgeplus/forks.json

    await octokit.request('POST /api/jaser/jasder_test/forks.json')

### HTTP 请求

`POST api/:owner/:repo/forks.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 项目id
identifier | string | 项目标识

> 返回的JSON示例:

    {
      "id": 3290,
      "identifier": "newadm"
    }

## 用户管理的组织列表

用户管理的组织列表

> 示例:

    curl -X GET \
    http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizations.json  | jq

    await octokit.request('GET /api/:owner/:repo/applied_transfer_projects/organizations')

### HTTP 请求

`GET api/:owner/:repo/applied_transfer_projects/organizations`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
name | string | 组织标识
nickname | string | 组织名称
description | string | 组织描述
avatar_url | string｜组织头像 |

> 返回的JSON示例:

    {
        "total_count": 3,
        "organizations": [
            {
                "id": 9,
                "name": "ceshi_org",
                "nickname": "测试组织",
                "description": "测试组织",
                "avatar_url": "images/avatars/Organization/9?t=1612706073"
            },
            {
                "id": 51,
                "name": "ceshi",
                "nickname": "测试组织哈哈哈",
                "description": "23212312",
                "avatar_url": "images/avatars/Organization/51?t=1618800723"
            },
            {
                "id": 52,
                "name": "ceshi1",
                "nickname": "身份卡手动阀",
                "description": "1231手动阀是的",
                "avatar_url": "images/avatars/Organization/52?t=1618805056"
            }
        ]
    }

## 迁移项目

迁移项目，edit接口is_transfering为true表示正在迁移

> 示例:

    curl -X POST http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects.json

    await octokit.request('POST /api/:owner/:repo/applied_transfer_projects.json')

### HTTP 请求

`POST /api/:owner/:repo/applied_transfer_projects.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
owner_name | 是 |  | string | 迁移对象标识

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 项目id
status | string | 项目迁移状态，canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
time_ago | string | 项目迁移创建的时间
project.id | int | 迁移项目的id
project.identifier | string | 迁移项目的标识
project.name | string | 迁移项目的名称
project.description | string | 迁移项目的描述
project.is_public | bool | 迁移项目是否公开
project.owner.id | bool | 迁移项目拥有者id
project.owner.type | string | 迁移项目拥有者类型
project.owner.name | string | 迁移项目拥有者昵称
project.owner.login | string | 迁移项目拥有者标识
project.owner.image_url | string | 迁移项目拥有者头像
user.id | int | 迁移创建者的id
user.type | string | 迁移创建者的类型
user.name | string | 迁移创建者的名称
user.login | string | 迁移创建者的标识
user.image_url | string | 迁移创建者头像
owner.id | int | 迁移接受者的id
owner.type | string | 迁移接受者的类型
owner.name | string | 迁移接受者的名称
owner.login | string | 迁移接受者的标识
owner.image_url | string | 迁移接受者头像

> 返回的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": 9,
            "type": "Organization",
            "name": "测试组织",
            "login": "ceshi_org",
            "image_url": "images/avatars/Organization/9?t=1612706073"
        },
        "id": 4,
        "status": "common",
        "created_at": "2021-04-26 09:54",
        "time_ago": "1分钟前"
    }

## 取消迁移项目

迁移项目，edit接口is_transfering为true表示正在迁移

> 示例:

    curl -X POST http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/cancel.json

    await octokit.request('POST /api/:owner/:repo/applied_transfer_projects/cancel.json')

### HTTP 请求

`POST /api/:owner/:repo/applied_transfer_projects/cancel.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 迁移id
status | string | 迁移状态，canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝
time_ago | string | 迁移创建的时间
project.id | int | 迁移项目的id
project.identifier | string | 迁移项目的标识
project.name | string | 迁移项目的名称
project.description | string | 迁移项目的描述
project.is_public | bool | 迁移项目是否公开
project.owner.id | bool | 迁移项目拥有者id
project.owner.type | string | 迁移项目拥有者类型
project.owner.name | string | 迁移项目拥有者昵称
project.owner.login | string | 迁移项目拥有者标识
project.owner.image_url | string | 迁移项目拥有者头像
user.id | int | 迁移创建者的id
user.type | string | 迁移创建者的类型
user.name | string | 迁移创建者的名称
user.login | string | 迁移创建者的标识
user.image_url | string | 迁移创建者头像
owner.id | int | 迁移接受者的id
owner.type | string | 迁移接受者的类型
owner.name | string | 迁移接受者的名称
owner.login | string | 迁移接受者的标识
owner.image_url | string | 迁移接受者头像

> 返回的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": 9,
            "type": "Organization",
            "name": "测试组织",
            "login": "ceshi_org",
            "image_url": "images/avatars/Organization/9?t=1612706073"
        },
        "id": 4,
        "status": "common",
        "created_at": "2021-04-26 09:54",
        "time_ago": "1分钟前"
    }

## 退出项目

供项目成员(开发者、报告者)退出项目用

> 示例:

    curl -X POST http://localhost:3000/api/ceshi1/ceshi_repo1/quit.json

    await octokit.request('POST /api/:owner/:repo/quit.json')

### HTTP 请求

`POST /api/:owner/:repo/quit.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

> 返回的JSON示例:

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

# Repositories

## 仓库详情

仓库详情

> 示例:

    curl -X GET http://localhost:3000/api/jasder/jasder_test.json

    await octokit.request('GET /api/jasder/jasder_test.json')

### HTTP 请求

`GET /api/:owner/:repo`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
identifier | string | 项目标识
name | string | 项目名称
project_id | int | 项目ID
repo_id | int | 仓库ID
issues_count | int | 疑修数量
pull_requests_count | int | 合并请求数量
project_identifier | string | 项目标识
praises_count | int | 项目点赞数
forked_count | int | 项目复刻数
watchers_count | int | 项目关注数
versions_count | int | 项目里程碑数量
version_releases_count | int | 项目版本数
version_releasesed_count | int | 项目已发行项目版本数
contributor_users_count | int | 项目贡献者数
permission | string | 用户权限 Admin: 平台管理员, Manager: 项目管理员, Developer: 项目开发者, Reporter: 项目报告者
mirror_url | string | 项目镜像地址
mirror | bool | 是否为镜像项目
type | int | 项目类型 0: 托管项目，1: 镜像项目，2: 同步镜像项目
forked_from_project_id | int | 项目复刻来源项目ID
fork_info.fork_form_name | string | 项目复刻来源项目的名称
fork_info.fork_project_user_login | string | 项目复刻来源项目拥有者标识
fork_info.fork_project_identifier | string | 项目复刻来源项目标识
fork_info.fork_project_user_name | string | 项目复刻来源项目拥有者名称
size | string | 项目大小
ssh_url | string | 项目ssh clone地址
clone_url | string | 项目http clone地址
default_branch | string | 项目默认分支
empty | bool | 项目是否为空
full_name | string | 项目路径
private | bool | 项目是否为私有项目
author.id | int | 项目拥有者ID
author.login | string | 项目拥有者标识
author.type | string | 项目拥有者类型
author.name | string | 项目拥有者名称
author.image_url | string | 项目拥有者头像地址

> 返回的JSON示例:

    {
        "identifier": "hahahah",
        "name": "hahahah",
        "project_id": 469,
        "repo_id": 469,
        "issues_count": 2,
        "pull_requests_count": 3,
        "project_identifier": "hahahah",
        "praises_count": 0,
        "forked_count": 1,
        "watchers_count": 0,
        "versions_count": 0,
        "version_releases_count": 0,
        "version_releasesed_count": 0,
        "contributor_users_count": 1,
        "permission": "Admin",
        "mirror_url": null,
        "mirror": false,
        "type": 0,
        "open_devops": false,
        "watched": false,
        "praised": false,
        "status": 1,
        "forked_from_project_id": null,
        "size": "2.1 MB",
        "ssh_url": "virus@127.0.0.1:10081:yystopf/hahahah.git",
        "clone_url": "http://127.0.0.1:10081/yystopf/hahahah.git",
        "default_branch": "master",
        "empty": false,
        "full_name": "yystopf/hahahah",
        "private": false,
        "author": {
            "id": 2,
            "login": "yystopf",
            "type": "User",
            "name": "heh",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        }
    }

## 仓库详情(简版)

仓库详情

> 示例:

    curl -X GET http://localhost:3000/api/jasder/jasder_test/simple.json

    await octokit.request('GET /api/jasder/jasder_test/simple.json')

### HTTP 请求

`GET /api/:owner/:repo/simple`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
name | string | 项目名称
platform | string | 项目平台
identifier | string | 项目标识
repo_id | int | 仓库id
open_devops | bool | 是否开启工作流
type | int | 项目类型 0: 托管项目，1: 镜像项目，2: 同步镜像项目
author.login | string | 项目拥有者标识
author.type | string | 项目拥有者类型
author.name | string | 项目拥有者名称
author.image_url | string | 项目拥有者头像地址

> 返回的JSON示例:

    {
        "identifier": "hahahah",
        "name": "hahahah",
        "platform": "forge",
        "id": 469,
        "repo_id": 469,
        "open_devops": false,
        "type": 0,
        "author": {
            "login": "yystopf",
            "name": "heh",
            "type": "User",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        }
    }

## 仓库详情(新版)

仓库详情

> 示例:

    curl -X GET http://localhost:3000/api/yystopf/ceshi/detail.json

    await octokit.request('GET /api/yystopf/ceshi/detail.json')

### HTTP 请求

`GET /api/:owner/:repo/detail`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
content | string | 仓库简介
website | string | 仓库网址
lesson_url | string | 课程地址
identifier | string | 项目标识
invite_code | string | 项目邀请码
name | string | 项目名称
description | string | 项目描述
project_id | int | 项目ID
repo_id | int | 仓库ID
issues_count | int | 项目issue数量
pull_requests_count | int | 项目合并请求数量
project_identifier | int | 项目标识
praises_count | int | 项目点赞数量
forked_count | int | 项目复刻数量
watchers_count | int | 项目关注数量
versions_count | int | 项目里程碑数量
version_releases_count | int | 项目发行版数量
version_releasesed_count | int | 项目发行版已发行数量
permission | string | 项目权限, Admin: 平台管理员，Manager: 项目管理员, Developer: 项目开发者, Reporter: 项目报告者
mirror_url | string | 镜像地址
mirror | bool | 是否为镜像项目
type | int | 项目类型 0 普通项目 1 普通镜像项目 2 同步镜像项目
open_devops | int | 是否开启devops
watched | bool | 是否关注
praised | bool | 是否点赞
status | int | 项目状态
forked_from_project_id | int | 项目复刻来源项目id
fork_info.fork_form_name | string | 项目复刻来源项目的名称
fork_info.fork_project_user_login | string | 项目复刻来源项目拥有者标识
fork_info.fork_project_identifier | string | 项目复刻来源项目标识
fork_info.fork_project_user_name | string | 项目复刻来源项目拥有者名称
size | string | 仓库大小
ssh_url | string | 项目ssh克隆地址
clone_url | string | 项目http克隆地址
default_branch | string | 仓库默认分支
empty | bool | 仓库是否为空
full_name | string | 仓库全称
private | bool | 仓库是否为私有项目
license_name | string | 许可证名称
author.id | int | 项目拥有者ID
author.login | string | 项目拥有者标识
author.type | string | 项目拥有者类型
author.name | string | 项目拥有者名称
author.image_url | string | 项目拥有者头像地址

> 返回的JSON示例:

    {
        "content": null,
        "website": null,
        "lesson_url": null,
        "identifier": "hahahah",
        "invite_code": "8zfKtM",
        "name": "hahahah",
        "description": null,
        "project_id": 469,
        "repo_id": 469,
        "issues_count": 2,
        "pull_requests_count": 2,
        "project_identifier": "hahahah",
        "praises_count": 0,
        "forked_count": 1,
        "watchers_count": 0,
        "versions_count": 0,
        "version_releases_count": 0,
        "version_releasesed_count": 0,
        "permission": "Admin",
        "mirror_url": null,
        "mirror": false,
        "type": 0,
        "open_devops": false,
        "watched": false,
        "praised": false,
        "status": 1,
        "forked_from_project_id": null,
        "size": "2.1 MB",
        "ssh_url": "virus@127.0.0.1:10081:yystopf/hahahah.git",
        "clone_url": "http://127.0.0.1:10081/yystopf/hahahah.git",
        "default_branch": "master",
        "empty": false,
        "full_name": "yystopf/hahahah",
        "private": false,
        "license_name": null,
        "branches_count": 1201,
        "tags_count": 0,
        "author": {
            "id": 2,
            "login": "yystopf",
            "type": "User",
            "name": "heh",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        }
    }

## 仓库标签列表

仓库标签列表

> 示例:

    curl -X GET http://localhost:3000/api/yystopf/csfjkkj/tags.json

    await octokit.request('GET /api/yystopf/csfjkkj/tags.json')

### HTTP 请求

`GET /api/:owner/:repo/tags.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
page | 否 | 1 | integer | 页码
limit | 否 | 20 | integer | 每页个数

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | 标签id
name | string | 标签名称
zipball_url | string | 标签zip包下载地址
tarball_url | string | 标签tar包下载地址
tagger | object | 打标签的人
time_ago | string | 打标签的时间
created_at_unix | string | 打标签的时间戳
message | string | 标签信息
commit | object | 标签最后一个commit
commit.sha | string | commit的id
commit.message | string | commit的提交信息
commit.time_ago | string | commit的提交时间
commit.created_at_unix | string | commit的提交时间戳
commit.committer | object | commit的提交者
commit.author | object | commit的作者

> 返回的JSON示例:

    [
        {
            "name": "v2.0.0",
            "id": "c7d0873ee41796d1a0e193063095ccf539a9bf31",
            "zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip",
            "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz",
            "tagger": {
                "id": 4,
                "login": "testforge1",
                "name": "testforge1",
                "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
            },
            "time_ago": "1天前",
            "created_at_unix": 1632376903,
            "message": "jdfkls",
            "commit": {
                "sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7",
                "message": "add\n",
                "time_ago": "1天前",
                "created_at_unix": 1632376186,
                "committer": {
                    "id": 4,
                    "login": "testforge1",
                    "name": "testforge1",
                    "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
                },
                "author": {
                    "id": 4,
                    "login": "testforge1",
                    "name": "testforge1",
                    "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
                }
            }
        },
        {
            "name": "v1.0.0",
            "id": "12168ad39c3ef201a445a2db181a3e43d50e40dd",
            "zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip",
            "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz",
            "tagger": {
                "id": null,
                "login": "viletyy",
                "name": "viletyy",
                "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
            },
            "time_ago": "10天前",
            "created_at_unix": 1631588042,
            "message": "dfks",
            "commit": {
                "sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf",
                "message": "ADD file via upload\n",
                "time_ago": "21天前",
                "created_at_unix": 1630648417,
                "committer": {
                    "id": null,
                    "login": "yystopf",
                    "name": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
                },
                "author": {
                    "id": null,
                    "login": "yystopf",
                    "name": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
                }
            }
        }
    ]

## 仓库所有分支列表

仓库所有分支列表

> 示例:

    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/v1/:owner/:repo/branches/all.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
name | string | 分支名称
http_url | string | 分支http地址
zip_url | string | 分支zip包下载地址
tar_url | string | 分支tar包下载地址

> 返回的JSON示例:

    [
        {
            "name": "master",
            "http_url": "http://127.0.0.1:10081/yystopf/hahahah.git",
            "zip_url": "http://localhost:3000/api/yystopf/hahahah/archive/master.zip",
            "tar_url": "http://localhost:3000/api/yystopf/hahahah/archive/master.tar.gz"
        },
        {
            "name": "touch-10",
            "http_url": "http://127.0.0.1:10081/yystopf/hahahah.git",
            "zip_url": "http://localhost:3000/api/yystopf/hahahah/archive/touch-10.zip",
            "tar_url": "http://localhost:3000/api/yystopf/hahahah/archive/touch-10.tar.gz"
        },
        {
            "name": "touch-100",
            "http_url": "http://127.0.0.1:10081/yystopf/hahahah.git",
            "zip_url": "http://localhost:3000/api/yystopf/hahahah/archive/touch-100.zip",
            "tar_url": "http://localhost:3000/api/yystopf/hahahah/archive/touch-100.tar.gz"
        }
    ]

## 仓库创建分支

为仓库创建一个新的分支

> 示例:

    curl -X POST \
    -d "new_branch_name=ceshi_branch_1" \
    -d "old_branch_name=master" \
    http://localhost:3000/api/v1/yystopf/csfjkkj/branches.json

    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示例:

    {
        "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`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
list.contributions | int | 贡献者commit数量
list.login | string | 贡献者标识
list.type | string | 贡献者类型
list.name | string | 贡献者昵称
list.image_url | string | 贡献者头像地址

> 返回的JSON示例:

    {
        "list": [
            {
                "contributions": 2411,
                "login": "yystopf",
                "type": "User",
                "name": "heh",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            },
            {
                "contributions": 6,
                "login": "testforge3",
                "type": null,
                "name": "testforge3",
                "image_url": "system/lets/letter_avatars/2/T/132_143_60/120.png"
            }
        ],
        "total_count": 2
    }

## 仓库开发语言

仓库开发语言组成

> 示例:

    curl -X GET http://localhost:3000/api/yystopf/csfjkkj/languages.json

    await octokit.request('GET /api/yystopf/csfjkkj/languages.json')

### HTTP 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
key | string | 语言类型
value | string | 语言占比

> 返回的JSON示例:

    {
        "Go": "99.0%",
        "Shell": "0.4%",
        "Smarty": "0.4%",
        "Makefile": "0.2%"
    }

## 编辑仓库信息

编辑仓库信息

> 示例:

    curl -X GET http://localhost:3000/api/jasder/jasder_test/edit.json

    await octokit.request('GET /api/jasder/jasder_test/edit.json')

### HTTP 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
identifier | string | 仓库标识
project_id | int | 项目id
project_name | string | 项目名称
project_identifier | string | 项目标识
project_description | string | 项目简介
project_category_id | int | 项目类别id
project_language_id | int | 项目语言id
private | boolean | 项目是否私有, true：为私有，false: 公开

> 返回的JSON示例:

    {
      "identifier": "project",
      "project_id": 3263,
      "project_name": "项目",
      "project_identifier": "project identifier",
      "project_description": "project description",
      "project_category_id": 1,
      "project_language_id": 2,
      "private": false
    }

## 修改仓库信息

修改仓库信息

> 示例:

    curl -X PATCH \
    -d "name=hnfl_demo" \
    -d "description=my first project" \
    -d "project_category_id=1" \
    -d "project_language_id=2" \
    -d "private=true" \
    http://localhost:3000/api/jasder/jasder_test.json

    await octokit.request('PATCH /api/jasder/jasder_test.json')

### HTTP 请求

`PATCH /api/:owner/:repo`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
id | 是 |  | int | 项目id
name | 否 |  | string | 项目名称
description | 否 |  | string | 项目描述
project_category_id | 否 |  | int | 项目类别id
project_language_id | 否 |  | int | 项目语言id
default_branch | 否 |  | string | 默认分支名称
private | 否 |  | boolean | 项目是否私有, true：为私有，false: 公开，默认为公开

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
identifier | string | 项目标识
name | string | 项目名称
description | string | 项目简介
project_category_id | int | 项目类别id
project_language_id | int | 项目语言id
private | 否 | boolean

> 返回的JSON示例:

    {
      "id": 3263,
      "identifier": "project identifier",
      "name": "project name",
      "description": "project description",
      "project_category_id": 1,
      "project_language_id": 2,
      "is_public": true
    }

## 删除仓库

删除仓库

> 示例:

    curl -X DELETE http://localhost:3000/api/jasder/jasder_test.json

    await octokit.request('DELETE /api/jasder/jasder_test.json')

### HTTP 请求

`PATCH /api/:owner/:repo`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
status | int | 返回状态， 0: 表示操作成功
message | string | 返回信息说明

> 返回的JSON示例:

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

只有平台管理员和项目管理员才能删除仓库.

## 添加仓库成员

仓库中添加成员操作

> 示例:

    curl -X POST \
    -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`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
user_id | 是 | int |  | 用户id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
status | int | 返回状态， 0: 表示操作成功
message | string | 返回信息说明

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
user_id | 是 | int |  | 用户id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
status | int | 返回状态， 0: 表示操作成功
message | string | 返回信息说明

> 返回的JSON示例:

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

只有平台管理员和项目管理员才能删除仓库成员.

## 更改仓库成员角色(权限)

更改仓库成员角色

> 示例:

    curl -X PUT \
    -d "user_id=12" \
    -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 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
user_id | 是 | int |  | 用户id
role | 是 | string |  | 取值范围："Manager", "Developer", "Reporter"；分别为项目管理人员(拥有所有操作权限)、项目开发人员(只拥有读写权限)、项目报告人员(只拥有读权限)

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
status | int | 返回状态， 0: 表示操作成功
message | string | 返回信息说明

> 返回的JSON示例:

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

只有平台管理员和项目管理员才能更改仓库成员角色.

## 获取仓库成员列表

获取仓库成员列表

> 示例:

    curl -X GET \
    -d "page=1" \
    -d "limit=5" \
    http://localhost:3000/api/jasder/jasder_test/collaborators.json

    await octokit.request('GET /api/jasder/jasder_test/collaborators.json')

### HTTP 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
page | 否 |  | string | 页数，第几页
limit | 否 |  | string | 每页多少条数据，默认15条

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 返回记录总条数
members | array | 项目成员信息
-- id | int | 用户id
-- name | string | 用户名称
-- login | string | 用户登录名/标识
-- image_url | string | 用户头像
-- is_owner | boolean | 是否是项目的拥有者，true:是， false:不是
-- role | string | 该用户在项目中的角色， Manager: 管理员(拥有操作权限); Developer:开发人员(只拥有读写权限)； Reporter:报告人员(只拥有读权限)

> 返回的JSON示例:

    {
      "total_count": 2,
      "members": [
        {
          "id": 36401,
          "name": "name",
          "login": "login",
          "image_url": "avatars/User/b",
          "is_owner": true,
          "role": "Manager"
        },
        {
          "id": 36399,
          "name": "name",
          "login": "login",
          "image_url": "avatars/User/b",
          "is_owner": false,
          "role": "Developer"
        }
      ]
    }

Success Data.

## 获取仓库所有文件

获取仓库所有文件

> 示例:

    curl -X GET \
    -d "ref=develop" \
    http://localhost:3000/api/yystopf/ceshi/files.json

    await octokit.request('GET /api/yystopf/ceshi/files.json')

### HTTP 请求

`GET /api/:owner/:repo/files`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
search | 否 |  | string | 文件搜索关键词
ref | 是 |  | string | 分支名，默认为仓库默认分支

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
name | string | 文件名称
path | string | 文件路径
sha | string | 文件标识
type | string | 文件类型
size | int | 文件大小
url | string | 文件地址

> 返回的JSON示例:

    [
        {
            "name": ".gitignore",
            "path": ".gitignore",
            "sha": "f83922d01ae60f6e637a1a2b9f08871b4f87dfc8",
            "type": "file",
            "size": 63,
            "url": "http://localhost:10080/api/v1/repos/yystopf/ceshi/contents/.gitignore?ref=master",
            "html_url": "http://localhost:10080/yystopf/ceshi/src/branch/master/.gitignore"
        },
        {
            "name": "LICENSE",
            "path": "LICENSE",
            "sha": "8f3b9ab0d08afd3a624d822e3971a2f42b3bc2b9",
            "type": "file",
            "size": 341,
            "url": "http://localhost:10080/api/v1/repos/yystopf/ceshi/contents/LICENSE?ref=master",
            "html_url": "http://localhost:10080/yystopf/ceshi/src/branch/master/LICENSE"
        },
        {
            "name": "README.md",
            "path": "README.md",
            "sha": "1bc8a60ac6ddc876ebc4b60fc68991435bfad93e",
            "type": "file",
            "size": 9,
            "url": "http://localhost:10080/api/v1/repos/yystopf/ceshi/contents/README.md?ref=master",
            "html_url": "http://localhost:10080/yystopf/ceshi/src/branch/master/README.md"
        }
    ]

## 提交文件到仓库

提交文件到仓库，支持批量

> 示例:

    curl -X POST \
    -d "files[][action_type]=create" \
    -d "files[][content]=jfksj" \
    -d "files[][encoding]=text" \
    -d "files[][file_path]=heihei8" \
    -d "author_email=yystopf@163.com" \
    -d "author_name=yystopf" \
    -d "author_timeunix=1658214400" \
    -d "committer_email=yystopf@163.com" \
    -d "committer_name=yystopf" \
    -d "committer_timeunix=1658214400" \
    -d "branch=develop" \
    -d "new_branch=develop_ceshi" \
    -d "message=测试提交" \
    http://localhost:3000/api/v1/yystopf/ceshi/contents/batch.json

    await octokit.request('POST /api/v1/yystopf/ceshi/contents/batch.json')

### HTTP 请求

`POST /api/v1/:owner/:repo/contents/batch`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
files.action_type | 是 |  | string | 操作类型 create: 创建 update: 更新 delete: 删除
files.content | 是 |  | string | 文件内容
files.encoding | 是 |  | string | 文件编码方式 text 文本 base64 加密
files.file_path | 是 |  | string | 文件路径
author_email | 否 | 当前用户邮箱 | string | 作者邮箱，不填时需要与作者名称同时为空
author_name | 否 | 当前用户标识 | string | 作者名称，不填时需要与作者邮箱同时为空
author_timeunix | 否 | 当前时间戳 | int | 编码时间，精确到秒
committer_email | 否 | 当前用户邮箱 | string | 提交者邮箱，不填时需要与提交者名称同时为空
committer_name | 否 | 当前用户标识 | string | 提交者名称，不填时需要与提交者邮箱同时为空
committer_timeunix | 否 | 当前时间戳 | int | 提交时间戳，精确到秒
branch | 是 |  | string | 提交分支
new_branch | 否 |  | string | 如果需要创建新分支，这个需要填
message | 是 |  | string | 提交信息

> 请求的JSON示例:

    {
        "files": [
            {
                "action_type": "create",
                "content": "jfksj",
                "encoding": "text",
                "file_path": "heihei7"
            }
        ],
        "author_email": "yystopf@163.com",
        "author_name": "yystopf",
        "author_timeunix": 1658214400,
        "committer_email": "yystopf@163.com",
        "committer_name": "yystopf",
        "committer_timeunix": 1658214400,
        "branch": "hh_ceshi",
        "message": "测试提交"
    }

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
commit.sha | string | 提交ID
commit.author | object | 作者
commit.committer | object | 提交者
commit.commit_message | string | 提交信息
commit.parent_shas | array | 父节点commit ID
commit.authored_time | int | 编码时间
commit.commited_time | int | 提交时间
contents.name | string | 文件名称
contents.path | string | 文件路径
contents.sha | string | 文件标识
contents.type | string | 文件类型
contents.size | int | 文件大小
contents.url | string | 文件地址
contents.encoding | string | 编码类型 text 文本 base64 加密
contents.content | string | 文件内容

> 返回的JSON示例:

    {
        "commit": {
            "sha": "7c1e25f9b974e4b7a3816bd7f5e49b441078e999",
            "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"
            },
            "commit_message": "测试提交\n",
            "parent_shas": [
                "9aec816d0f3600082ca77893290a14bd29d805fe"
            ],
            "authored_time": 1658214400,
            "commited_time": 1658214400
        },
        "contents": [
            {
                "name": "heihei7",
                "path": "heihei7",
                "sha": "f0acac8efb3021b0f6a7b13b42d033d86e076a4b",
                "type": "file",
                "size": 5,
                "encoding": "base64",
                "content": "amZrc2o="
            }
        ]
    }

## 获取仓库代码目录

获取仓库代码目录

> 示例:

    curl -X GET \
    -d "ref=develop" \
    http://localhost:3000//api/jasder/jasder_test/entries.json

    await octokit.request('GET /api/jasder/jasder_test/entries.json')

### HTTP 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
ref | 否 |  | string | 分支名称、tag名称或是提交记录id，默认为master分支

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
last_commit | object |
-- commit | object |
id | int | id
name | string | 文件夹或文件名称
path | string | 文件夹或文件相对路径
type | string | 文件类型， file:文件，dir：文件目录
size | int | 文件夹或文件大小 单位B
content | string | 文件内容
target | string | 标签

> 返回的JSON示例:

    {
      "last_commit": {
        "commit": {
          "sha": "3f2de4f78d2d7050486535082cd11cdfc9f3679e",
          "url": "http://localhost:3003//api/repositories/api-cloud-platform/commits/3f2de4f78d2d7050486535082cd11cdfc9f3679e",
          "message": "update README.md.",
          "author": {
            "name": "Gitee",
            "email": "noreply@gitee.com",
            "date": "2020-03-02T20:23:18+08:00"
          },
          "committer": {
            "name": "Gitee",
            "email": "noreply@gitee.com",
            "date": "2020-03-02T20:23:18+08:00"
          },
          "timestamp": 1583151798,
          "time_from_now": "3个月前"
        },
        "author": null,
        "committer": null
      },
      "entries": [
        {
          "name": "ace-gate",
          "path": "ace-gate",
          "sha": "c83f85fc63b14edcd6fc502eee9996f5a9993eca",
          "type": "dir",
          "size": 0,
          "content": null,
          "target": null,
          "commit": {
            "message": "v2.9 升级alibaba组件release版本\n",
            "sha": "6117eaab86f71115f42f2a46ff1683015cda798d",
            "created_at": "1970-01-01 08:00",
            "time_from_now": "1年前",
            "created_at_unix": null
          }
        }
      ]
    }

Success Data.

## 获取仓库代码子目录或者文件

获取仓库代码子目录或者文件

> 示例:

    curl -X GET \
    -d "ref=master" \
    -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 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
filepath | 是 | string | 文件夹、文件的相对路径 |
ref | 否 |  | string | 分支名称、tag名称或是提交记录id，默认为master分支

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
name | string | 文件夹或文件名称
path | string | 文件夹或文件相对路径
type | string | 文件类型， file:文件，dir：文件目录
size | int | 文件夹或文件大小 单位KB
content | string | 文件内容，
target | string | 标签
url | string | 文件访问链接,带分支
html_url | string | 文件访问链接，未标识分支
git_url | string | 文件夹或文件的git仓库访问链接
download_url | string | 文件下载、文件内容访问链接

> 返回的JSON示例:

    [
      {
        "name": "build.rc",
        "path": "lib/build.rc",
        "type": "",
        "size": 1268,
        "content": null,
        "target": null,
        "url": "http://localhost:3003/api/v1/repos/18816895620/mirror_demo/contents/lib/build.rc?ref=master",
        "html_url": "http://localhost:3003/18816895620/mirror_demo/src/branch/master/lib/build.rc",
        "git_url": "http://localhost:3003/api/v1/repos/18816895620/mirror_demo/git/blobs/191fcf1a63b3777e2977fcede7dd5309efdd70fe",
        "download_url": null
      }
    ]

Success Data.

## 获取仓库README文件

获取仓库README文件

> 示例:

    curl -X GET \
    -d "ref=master" \
    -d "filepath=lib" \
    http://localhost:3000/api/yystopf/csfjkkj/readme.json

    await octokit.request('GET /api/yystopf/csfjkkj/readme.json')

### HTTP 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
ref | 否 |  | string | 分支名称、tag名称或是提交记录id，默认为默认分支
filepath | 否 |  | string | 子目录名称，默认为空

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
type | string | 文件类型， file:文件，dir：文件目录
encoding | string | 编码
size | int | 文件夹或文件大小 单位B
name | string | 文件夹或文件名称
path | string | 文件夹或文件相对路径
content | string | 文件内容
sha | string | 文件commitid

> 返回的JSON示例:

    {
        "type": "file",
        "encoding": "base64",
        "size": 24,
        "name": "README.md",
        "path": "lib/README.md",
        "content": "ZGZhc2RhZGpmIGRrZnNsCgpzZGZkZnMK",
        "sha": "860962cd21c60b1a9e07d723080c87c32c18d44a"
    }

Success Data.

## 获取文件树列表

根据分支、标签、commit ID获取仓库文件树列表

> 示例:

    curl -X GET \
    -d "recursive=true" \
    -d "page=1" \
    -d "limit=1" \
    http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae693756a4781fab2.json

    await octokit.request('GET /api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae693756a4781fab2.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/git/trees/:sha.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
sha | 是 |  | string | 分支名称、tag名称或是提交记录id
recursive | 否 |  | bool | 是否显示目录
page | 否 | 1 | int | 页码
limit | 否 | 15 | int | 分页个数

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 文件树数量
sha | string | 查询分支、标签、commit_id最后一次提交的ID
entries.name | string | 文件树名称
entries.mode | string | 文件树权限
entries.type | string | 文件树类型， file：文件，dir: 文件夹
entries.size | int | 文件树大小
entries.sha | string | 文件树commit_ID

> 返回的JSON示例:

    {
        "total_count": 13,
        "sha": "80dd40214a58622312393b2ae693756a4781fab2",
        "entries": [
            {
                "name": "README.md",
                "mode": "100644",
                "type": "file",
                "size": 14,
                "sha": "b2f7b457fd8ca55f2274032cbb2abcb7dd8cd57e"
            }
        ]
    }

Success Data.

## 获取仓库blobs内容

根据commit ID获取仓库blobs内容

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/csfjkkj/git/blobs/80dd40214a58622312393b2ae693756a4781fab2.json

    await octokit.request('GET /api/v1/yystopf/csfjkkj/git/blobs/80dd40214a58622312393b2ae693756a4781fab2.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/git/blobs/:sha.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
sha | 是 |  | string | 提交记录id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
sha | string | 提交ID
size | int | blobs大小
encoding | string | 内容编码模式
content | string | blobs内容

> 返回的JSON示例:

    {
        "sha": "80dd40214a58622312393b2ae693756a4781fab2",
        "size": 247,
        "encoding": "base64",
        "content": "dHJlZSAyN2JjYjI2ZDQ5YmU1M2RmOGZmYTk5NDc3MjRkYmI3YzIzZWI4MjY4CnBhcmVudCA3ZTRkOGJiM2MyOGUyNGQ0Y2Q2YjIwNWYyZWVkMzI1MTNlOTM3NTI0CmF1dGhvciB5eXN0b3BmIDx5eXN0b3BmQDE2My5jb20+IDE2NTc3MDYwNTUgKzAwMDAKY29tbWl0dGVyIHl5c3RvcGYgPHl5c3RvcGZAMTYzLmNvbT4gMTY1NzcwNjA1NSArMDAwMAoKeOaLn+WingoKU2lnbmVkLW9mZi1ieTogeXlzdG9wZiA8eXlzdG9wZkAxNjMuY29tPg=="
    }

Success Data.

## 获取仓库提交列表

根据分支名、标签、commit ID来获取提交列表

> 示例:

    curl -X GET \
    -d "sha=master" \
    -d "page=1" \
    -d "limit=1" \
    http://localhost:3000/api/v1/yystopf/csfjkkj/commits.json

    await octokit.request('GET /api/v1/yystopf/csfjkkj/commits.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/commits.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
sha | 否 |  | string | 分支名、标签名或Commit ID
page | 否 |  | int | 页码
limit | 否 |  | int | 每页数量

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 提交总数
commits.sha | string | 提交ID
commits.author | object | 提交作者
commits.committer | object | 提交者
commits.commit_message | string | 提交信息
commits.parent_shas | array | 提交父节点ID
commits.files | array | 提交文件
commits.commit_date | string | 提交日期
commits.commit_time | string | 提交时间
commits.branch | string | 提交分支

> 返回的JSON示例:

    {
        "total_count": 12,
        "commits": [
            {
                "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
                "author": {
                    "id": null,
                    "login": "viletyy",
                    "name": "viletyy",
                    "type": null,
                    "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                },
                "committer": {
                    "id": null,
                    "login": "viletyy",
                    "name": "viletyy",
                    "type": null,
                    "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                },
                "commit_message": "fix\n",
                "parent_shas": [
                    "411e4d259785241f1bd14faf99ca24fd1b802f2a"
                ],
                "files": [
                    "hd.txt"
                ],
                "commit_date": "2022-07-05",
                "commit_time": "2022-07-05 11:00:45",
                "branch": "hh_ceshi"
            }
        ]
    }

Success Data.

## 获取单个提交的blame信息

根据commit ID获取blame信息

> 示例:

    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/v1/:owner/:repo/commits/:sha/diff.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
sha | 是 |  | string | 提交记录id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
file_nums | int | 文件数量
total_addition | int | 新增行数
total_deletion | int | 删除行数
files.name | string | 文件名称
files.oldname | string | 文件修改前名称
files.addition | int | 文件新增行数
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 |

> 返回的JSON示例:

    {
        "file_nums": 1,
        "total_addition": 1,
        "total_deletion": 0,
        "files": [
            {
                "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
            }
        ]
    }

Success Data.

## 获取单个文件的blame信息

根据分支、标签、commitID获取某个文件的blame信息

> 示例:

    curl -X GET \
    -d "sha=master" \
    -d "filepath=hd.txt" \
    http://localhost:3000/api/v1/yystopf/csfjkkj/blame.json

    await octokit.request('GET /api/v1/yystopf/csfjkkj/blame.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/blame.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
sha | 是 |  | string | 分支、标签或提交记录id
filepath | 是 |  | string | 文件路径

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
file_size | int | 文件大小
file_name | string | 文件名称
num_lines | int | 文件总行数
blame_parts.commit | object | 提交
blame_parts.current_number | int | 当前行数
blame_parts.effect_line | int | 影响的行数
blame_parts.lines | array | 行内容

> 返回的JSON示例:

    {
        "file_size": 32,
        "file_name": "hd.txt",
        "num_lines": 12,
        "blame_parts": [
            {
                "commit": {
                    "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
                    "author": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "committer": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "commit_message": "fix\n",
                    "authored_time": "2022-07-04 18:41:25",
                    "committed_time": "2022-07-04 18:41:25",
                    "created_time": "2022-07-04 18:41:25"
                },
                "current_number": 1,
                "effect_line": 5,
                "lines": [
                    "dkfj",
                    "s",
                    "324",
                    "234",
                    "2"
                ]
            },
            {
                "commit": {
                    "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
                    "author": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "committer": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "commit_message": "fix\n",
                    "authored_time": "2022-07-05 11:00:45",
                    "committed_time": "2022-07-05 11:00:45",
                    "created_time": "2022-07-05 11:00:45"
                },
                "current_number": 6,
                "effect_line": 1,
                "lines": [
                    "dd"
                ]
            },
            {
                "commit": {
                    "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
                    "author": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "committer": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "commit_message": "fix\n",
                    "authored_time": "2022-07-04 18:41:25",
                    "committed_time": "2022-07-04 18:41:25",
                    "created_time": "2022-07-04 18:41:25"
                },
                "current_number": 7,
                "effect_line": 3,
                "lines": [
                    "23",
                    "4",
                    "23"
                ]
            },
            {
                "commit": {
                    "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
                    "author": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "committer": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "commit_message": "fix\n",
                    "authored_time": "2022-07-05 11:00:45",
                    "committed_time": "2022-07-05 11:00:45",
                    "created_time": "2022-07-05 11:00:45"
                },
                "current_number": 10,
                "effect_line": 1,
                "lines": [
                    "s1"
                ]
            },
            {
                "commit": {
                    "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
                    "author": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "committer": {
                        "id": null,
                        "login": "viletyy",
                        "name": "viletyy",
                        "type": null,
                        "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
                    },
                    "commit_message": "fix\n",
                    "authored_time": "2022-07-04 18:41:25",
                    "committed_time": "2022-07-04 18:41:25",
                    "created_time": "2022-07-04 18:41:25"
                },
                "current_number": 11,
                "effect_line": 1,
                "lines": [
                    ""
                ]
            }
        ]
    }

Success Data.

## 获取比较提交blame

根据分支名、标签、commit ID来获取代码对比blame

> 示例:

    curl -X GET \
    -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/compare.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
from | 是 |  | string | 源分支、标签、commitID
to | 是 |  | string | 目标分支、标签、commitID

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
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 | 是否为LFS文件
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 | 文件变更之后的行数(及当前页面编辑器显示的总行数)
diff.files.is_incomplete | bool | 是否不完整
diff.files.is_incomplete_line_too_long | bool | 文件是否不完整是因为太长了
diff.files.is_protected | bool | 文件是否被保护

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

Success Data.

## 获取仓库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
url | string | 地址
http_method | string | 请求方式
is_active | bool | 是否激活
last_status | string | 最后一次推送的状态
create_time | string | 创建时间

> 返回的JSON示例:

    {
        "total_count": 4,
        "webhooks": [
            {
                "id": 2,
                "url": "https://oapi.dingtalk.com/robot/send?access_token=7e1e19d0eddb6a5e33c5c2c4e66f4c88f9437184b9ed2c2653194c6374c7d513",
                "http_method": "",
                "is_active": true,
                "last_status": "succeed",
                "create_time": "2021-07-12 10:50:07"
            },
            {
                "id": 3,
                "url": "http://localhost:3000",
                "http_method": "GET",
                "is_active": true,
                "last_status": "succeed",
                "create_time": "2021-07-26 10:03:45"
            },
            {
                "id": 4,
                "url": "http://localhost:10081",
                "http_method": "POST",
                "is_active": true,
                "last_status": "waiting",
                "create_time": "2021-07-26 16:56:53"
            },
            {
                "id": 5,
                "url": "http://localhost:3001",
                "http_method": "POST",
                "is_active": true,
                "last_status": "fail",
                "create_time": "2021-07-26 16:58:23"
            }
        ]
    }

Success Data.

## 获取仓库单个webhook

获取仓库单个webhook

> 示例:

    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 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
id | 是 |  | integer | webhook ID

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
url | string | 地址
content_type | string | POST Content Type
http_method | string | 请求方式
secret |  | string
active | bool | 是否激活
branch_filter | string | 分支过滤
events | string | 触发条件
create_at | string | 创建时间

参数 | 含义
--- | ---
create | 创建分支或标签
delete | 分支或标签删除
push | git仓库推送
pull_request | 合并请求
pull_request_assign | 合并请求被指派
pull_request_review_approved | 合并请求被批准
pull_request_review_rejected | 合并请求被拒绝

> 返回的JSON示例:

    {
        "id": 3,
        "http_method": "GET",
        "content_type": "form",
        "url": "http://localhost:3000",
        "active": true,
        "create_at": "2021-07-26 10:03",
        "branch_filter": "*",
        "events": [
            "create",
            "delete",
            "push",
            "pull_request",
            "pull_request_assign",
        ]
    }

Success Data.

## 添加仓库webhook

添加仓库webhook

> 示例:

    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 | 触发事件
webhook.type | 否 | gitea | string | hook类型，gitea slack discord dingtalk telegram msteams feishu matrix jianmu

触发事件字段说明

参数 | 含义
--- | ---
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"
    }

Success Data.

## 更新仓库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示例:

    {
        "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"
    }

Success Data.

## 删除仓库webhook

删除仓库webhook

> 示例:

    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 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
id | 是 |  | string | webhook id

### 返回字段说明:

> 返回的JSON示例:

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

Success Data.

## 获取仓库webhook的历史推送列表

获取仓库webhook的历史推送列表

> 示例:

    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 请求

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

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
id | 是 |  | integer | webhook ID

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
id | int | id
uuid | string | 推送uuid
type | string | 类型
is_succeed | bool | 是否推送成功
is_delivered | bool | 是否完成推送
payload_content | json | 请求主体内容
request_content | json | 请求内容，头部等等
reponse_content | json | 响应内容，状态，头部，主体等等
delivered_time | string | 推送时间

> 返回的JSON示例:

    {
      "total_count": 6,
      "hooktasks": [
        {
          "id": 20,
          "type": "gitea",
          "uuid": "99aa2c23-6884-4c44-9020-5469320aa408",
          "is_succeed": true,
          "is_delivered": true,
          "payload_content": {
              "secret": "123456",
              "ref": "refs/heads/master",
              "before": "feb48e31362787a7620b53d4df3c4effddbb6f0b",
              "after": "feb48e31362787a7620b53d4df3c4effddbb6f0b",
              "compare_url": "",
              "commits": [
                  {
                      "id": "feb48e31362787a7620b53d4df3c4effddbb6f0b",
                      "message": "fix\n",
                      "url": "http://localhost:10081/yystopf/ceshi/commit/feb48e31362787a7620b53d4df3c4effddbb6f0b",
                      "author": {
                          "name": "viletyy",
                          "email": "yystopf@163.com",
                          "username": "root"
                      },
                      "committer": {
                          "name": "viletyy",
                          "email": "yystopf@163.com",
                          "username": "root"
                      },
                      "verification": {
                          "verified": false,
                          "reason": "gpg.error.not_signed_commit",
                          "signature": "",
                          "signer": null,
                          "payload": ""
                      },
                      "timestamp": "2021-07-26T13:52:13+08:00",
                      "added": null,
                      "removed": null,
                      "modified": null
                  }
              ],
              "head_commit": null,
              "repository": {
                  "id": 2,
                  "owner": {
                      "id": 3,
                      "login": "yystopf",
                      "full_name": "",
                      "email": "yystopf@forge.com",
                      "avatar_url": "http://localhost:10081/user/avatar/yystopf/-1",
                      "language": "zh-CN",
                      "is_admin": true,
                      "last_login": "2021-07-21T18:38:21+08:00",
                      "created": "2021-06-03T14:50:25+08:00",
                      "username": "yystopf"
                  },
                  "name": "ceshi",
                  "full_name": "yystopf/ceshi",
                  "description": "",
                  "empty": false,
                  "private": false,
                  "fork": false,
                  "template": false,
                  "parent": null,
                  "mirror": false,
                  "size": 3846,
                  "html_url": "http://localhost:10081/yystopf/ceshi",
                  "ssh_url": "virus@localhost:10081:yystopf/ceshi.git",
                  "clone_url": "http://localhost:10081/yystopf/ceshi.git",
                  "original_url": "",
                  "website": "",
                  "stars_count": 0,
                  "forks_count": 1,
                  "watchers_count": 1,
                  "open_issues_count": 0,
                  "open_pr_counter": 0,
                  "release_counter": 0,
                  "default_branch": "master",
                  "archived": false,
                  "created_at": "2021-06-03T15:15:30+08:00",
                  "updated_at": "2021-07-26T13:52:16+08:00",
                  "permissions": {
                      "admin": false,
                      "push": false,
                      "pull": false
                  },
                  "has_issues": true,
                  "internal_tracker": {
                      "enable_time_tracker": true,
                      "allow_only_contributors_to_track_time": true,
                      "enable_issue_dependencies": true
                  },
                  "has_wiki": true,
                  "has_pull_requests": true,
                  "ignore_whitespace_conflicts": false,
                  "allow_merge_commits": true,
                  "allow_rebase": true,
                  "allow_rebase_explicit": true,
                  "allow_squash_merge": true,
                  "avatar_url": "",
                  "internal": false
              },
              "pusher": {
                  "id": 0,
                  "login": "yystopf",
                  "full_name": "",
                  "email": "yystopf@forge.com",
                  "avatar_url": "http://localhost:10081/user/avatar/yystopf/-1",
                  "language": "",
                  "is_admin": false,
                  "last_login": "0001-01-01T00:00:00Z",
                  "created": "2021-06-03T14:50:25+08:00",
                  "username": "yystopf"
              },
              "sender": {
                  "id": 0,
                  "login": "yystopf",
                  "full_name": "",
                  "email": "yystopf@forge.com",
                  "avatar_url": "http://localhost:10081/user/avatar/yystopf/-1",
                  "language": "",
                  "is_admin": false,
                  "last_login": "0001-01-01T00:00:00Z",
                  "created": "2021-06-03T14:50:25+08:00",
                  "username": "yystopf"
              }
          },
          "request_content": {
              "headers": {
                  "X-GitHub-Delivery": "99aa2c23-6884-4c44-9020-5469320aa408",
                  "X-GitHub-Event": "push",
                  "X-Gitea-Delivery": "99aa2c23-6884-4c44-9020-5469320aa408",
                  "X-Gitea-Event": "push",
                  "X-Gitea-Signature": "34a01edcd952ff6410ff6ebc946471161bde74aff86171f21621d2c2c4130f66",
                  "X-Gogs-Delivery": "99aa2c23-6884-4c44-9020-5469320aa408",
                  "X-Gogs-Event": "push",
                  "X-Gogs-Signature": "34a01edcd952ff6410ff6ebc946471161bde74aff86171f21621d2c2c4130f66"
              }
          },
          "response_content": {
              "status": 200,
              "headers": {
                  "Cache-Control": "no-store, must-revalidate, private, max-age=0",
                  "Content-Length": "2556",
                  "Content-Type": "text/html; charset=utf-8",
                  "Referrer-Policy": "strict-origin-when-cross-origin",
                  "Set-Cookie": "__profilin=p%3Dt; path=/; HttpOnly",
                  "Vary": "Origin",
                  "X-Content-Type-Options": "nosniff",
                  "X-Download-Options": "noopen",
                  "X-Frame-Options": "SAMEORIGIN",
                  "X-Miniprofiler-Ids": "9ynvpncz5xm0rpgorb5y,hgggd9mv6lr4a9drcrlr,j7zqlx2vy5aji2vtgoba,f1ktsmh3jxvq0z2hf612,mih3dvgvlqhi3zy8lf2x,5k1qbkvbnru8mye9cest,tj6ern8w6awqf2zsimbr,9isaehvubivd52wo5p9v,1rzfhtq1nhuwbgy9p76g,z0xzidzyywna0y7a69m0,hzoklky92ycjqt42gi0s,y0ai7y0t28mcn8x0py2x,322il7nadinp51mw2r5m,m6dukftfsh6tjcxzp1gq,667wlqbytfwbrirnmma1,jcehj3dl8lkw8gk510cr",
                  "X-Miniprofiler-Original-Cache-Control": "max-age=0, private, must-revalidate",
                  "X-Permitted-Cross-Domain-Policies": "none",
                  "X-Request-Id": "08bff080-bbb5-4183-b845-81de3d47120a",
                  "X-Runtime": "0.394766",
                  "X-Xss-Protection": "1; mode=block"
              },
              "body": "<!doctype html><html lang=\"zh-CN\" class=\"notranslate translated-ltr\" translate=\"no\"><head><meta charset=\"utf-8\"><meta name=\"”Keywords”\" content=\"”trustie,trustieforge,forge,确实让创建更美好,协同开发平台″\"><meta name=\"”Keywords”\" content=\"”TrustieOpenSourceProject″\"><meta name=\"”Keywords”\" content=\"”issue,bug,tracker,软件工程,课程实践″\"><meta name=\"”Description”\" content=\"”持续构建协同、共享、可信的软件创建生态开源创作与软件生产相结合，支持大规模群体开展软件协同创新活动”\"><meta name=\"theme-color\" content=\"#000000\"><link rel=\"manifest\" href=\"/react/build//manifest.json\"><link rel=\"stylesheet\" href=\"/react/build/css/iconfont.css\"><link rel=\"stylesheet\" href=\"/react/build/css/edu-purge.css\"><link rel=\"stylesheet\" href=\"/react/build/css/editormd.min.css\"><link rel=\"stylesheet\" href=\"/react/build/css/merge.css\"><link href=\"/react/build/static/css/main.07f7e90c.chunk.css\" rel=\"stylesheet\"></head><body><div id=\"md_div\" style=\"display:none\"></div><div id=\"root\" class=\"page -layout-v -fit widthunit\"></div><div id=\"picture_display\" style=\"display:none\"></div><script src=\"/react/build/js/jquery-1.8.3.min.js\"></script><script src=\"/react/build/js/js_min_all.js\"></script><script src=\"/react/build/js/codemirror/codemirror.js\"></script><script src=\"/react/build/js/editormd/editormd.min.js\"></script><script src=\"/react/build/js/codemirror/merge/merge.js\"></script><script src=\"/react/build/./static/js/runtime~main.3d644966.js\"></script><script src=\"/react/build/./static/js/main.e46872e3.chunk.js\"></script><script async type=\"text/javascript\" id=\"mini-profiler\" src=\"/mini-profiler-resources/includes.js?v=67dd1c2571ced7fc74ae7f1813e47bdf\" data-version=\"67dd1c2571ced7fc74ae7f1813e47bdf\" data-path=\"/mini-profiler-resources/\" data-current-id=\"9ynvpncz5xm0rpgorb5y\" data-ids=\"9ynvpncz5xm0rpgorb5y,hgggd9mv6lr4a9drcrlr,j7zqlx2vy5aji2vtgoba,f1ktsmh3jxvq0z2hf612,mih3dvgvlqhi3zy8lf2x,5k1qbkvbnru8mye9cest,tj6ern8w6awqf2zsimbr,9isaehvubivd52wo5p9v,1rzfhtq1nhuwbgy9p76g,z0xzidzyywna0y7a69m0,hzoklky92ycjqt42gi0s,y0ai7y0t28mcn8x0py2x,322il7nadinp51mw2r5m,m6dukftfsh6tjcxzp1gq,667wlqbytfwbrirnmma1,jcehj3dl8lkw8gk510cr\" data-horizontal-position=\"left\" data-vertical-position=\"top\" data-trivial=\"false\" data-children=\"false\" data-max-traces=\"20\" data-controls=\"false\" data-total-sql-count=\"false\" data-authorized=\"true\" data-toggle-shortcut=\"alt+p\" data-start-hidden=\"false\" data-collapse-results=\"true\" data-html-container=\"body\"></script>\n</body></html>"
          },
          "delivered_time": "2021-07-28 11:47:29"
        }
      ]
    }

Success Data.

## 仓库webhook测试推送

仓库webhook测试推送

> 示例:

    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 请求

`POST /api/v1/:owner/:repo/webhooks/:id/tests.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
id | 是 |  | integer | webhook ID

### 返回字段说明:

> 返回的JSON示例:

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

Success Data.

# Traces

## 代码溯源初始化

用户同意协议后请求的接口，创建代码溯源的账号

> 示例:

    curl -X POST \
    http://localhost:3000/api/traces/trace_users.json

    await octokit.request('POST /api/traces/trace_users.json')

### HTTP 请求

`POST api/traces/trace_users.json`

> 返回的JSON示例:

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

Success — a happy kitten is an authenticated kitten!

## 代码分析结果列表

查询项目下代码分析的结果

> 示例:

    curl -X GET \
    http://localhost:3000/api/traces/yystopf/many_branch/task_results.json

    await octokit.request('GET /api/traces/:owner/:repo/task_results.json')

### HTTP 请求

`GET api/traces/:owner/:repo/task_results.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 | 否 | string | 项目所有者标识
repo | 是 | 否 | string | 项目标识
page | 否 | 1 | int | 页码
limit | 否 | 15 | int | 每页数量

### 返回字段说明（暂缺）

> 返回的JSON示例:

    {
        "data": [
            {
                "accuracy": "20",
                "code_type": "C",
                "depth": "2",
                "detect_flag": "快速-组件级",
                "detect_rule": "快速-组件级,2,20,,开源软件,50,10",
                "detect_startdate": "2022-05-10 15:59:46 ",
                "detect_status": "fail",
                "detectflag": "快速-组件级",
                "fail_reason": "Invalid package type",
                "file_name": "many_branch.zip",
                "license_process": "100",
                "licenseparam": "开源软件",
                "package_type": "",
                "product_name": "84727546110",
                "project_id": "6dbc3e42-5857-4ca4-a54d-58fd9dbf6dc5",
                "sim_process": "100",
                "similarity_process": "2",
                "task_id": "15139171-091b-4316-98b1-6068970efa44",
                "totalsize": 5,
                "uid": "78",
                "vuln_process": "",
                "vulnlevel": ""
            }
        ]
    }

Success — a happy kitten is an authenticated kitten!

## 新建分析

用户选择仓库分支进行代码分析的接口

> 示例:

    curl -X POST \
    http://localhost:3000/api/traces/yystopf/many_branch/tasks.json

    await octokit.request('POST /api/traces/:owner/:repo/tasks.json')

### HTTP 请求

`POST api/traces/:owner/:repo/tasks.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 | 否 | string | 项目所有者标识
repo | 是 | 否 | string | 项目标识
branch_name | 是 | 否 | string | 分支名称

> 返回的JSON示例:

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

Success — a happy kitten is an authenticated kitten!

## 重新扫描

对代码分析结果进行再次分析

> 示例:

    curl -X GET \
    http://localhost:3000/api/traces/yystopf/many_branch/reload_task.json

    await octokit.request('GET /api/traces/:owner/:repo/reload_task.json')

### HTTP 请求

`GET api/traces/:owner/:repo/reload_task.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 | 否 | string | 项目所有者标识
repo | 是 | 否 | string | 项目标识
project_id | 是 | 否 | string | 代码分析结果里的project_id

> 返回的JSON示例:

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

Success — a happy kitten is an authenticated kitten!

## 下载报告

把代码分析的结果下载到本地

> 示例:

    curl -X GET \
    http://localhost:3000/api/traces/yystopf/many_branch/task_pdf.json

    await octokit.request('GET /api/traces/:owner/:repo/task_pdf.json')

### HTTP 请求

`GET api/traces/:owner/:repo/task_pdf.json`

### 请求参数

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 | 否 | string | 项目所有者标识
repo | 是 | 否 | string | 项目标识
task_id | 是 | 否 | string | 代码分析结果里的task_id

> 返回的JSON示例:

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

Success — a happy kitten is an authenticated kitten!

# Pulls

## 获取一个合并请求

获取合并请求详情接口

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/ceshi_commit/pulls/1.json

    await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls/1.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/pulls/:index.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | integer | pull 序号

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
- | - | -
id | int | 合并请求ID
title | string | 合并请求标题
body |  | string
head | int | 合并请求源分支
base | int | 合并请求目标分支
index | int | 合并请求序号
status | string | 合并请求状态，open: 开启的, merged: 合并的, closed: 关闭的
issue.id | int | 疑修ID
issue.author | object | 疑修作者
issue.priority | string | 疑修优先级
issue.version | string | 疑修里程碑
issue.journals_count | int | 普通评论数量
issue.issue_tags | array | 标记
journals_count | int | 审查评论数量
merge_base | string | 目标的commit ID
base_commit_sha | string | 合并之后的第一个commit ID
head_commit_sha | string | 源commit ID
commit_num | int | commit数量
changed_files | int | 更改文件数量
is_locked | bool |
mergeable | bool | 是否能合并
merged | bool | 是否合并
merged_at | string | 合并时间
merge_commit_sha | string | 合并之后的第一个commit ID
merge_by | object | 被谁合并了
last_review.id | int | 最后一个审查的id
last_review.commit_id | string | 最后一个审查对应的commit ID
last_review.content | string | 最后一个审查的内容
last_review.status | string | 最后一个审查的状态，common: 一般审查, approved: 通过, rejected: 拒绝通过
last_review.created_at | string | 审查创建的时间
last_review.reviewer | object | 审查创建人
reviewers | array | 指定审查用户标识数组
conflict_files | array | 有冲突的文件

> 返回的JSON示例:

    {
        "id": 168,
        "head": "new_branch",
        "base": "master",
        "is_original": false,
        "index": 5,
        "status": "merged",
        "issue": {
            "id": 265,
            "author": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            },
            "priority": null,
            "version": null,
            "journals_count": 1,
            "issue_tags": null
        },
        "journals_count": 0,
        "merge_base": "4a277037093c1248e46d2946ee30b61cccdb9df9",
        "base_commit_sha": "dbb510cd852a6bfd4d71a1f84921aa3170654590",
        "head_commit_sha": "0f0e27918eb5deb8d514012d84d13db10eebe19a",
        "commit_num": 1,
        "changed_files": 1,
        "is_locked": false,
        "mergeable": true,
        "merged": true,
        "merged_at": 1658743004,
        "merge_commit_sha": "dbb510cd852a6bfd4d71a1f84921aa3170654590",
        "merge_by": {
            "id": null,
            "login": "yystopf",
            "name": "yystopf",
            "type": null,
            "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
        },
        "last_review": {
            "id": 5,
            "commit_id": null,
            "content": "新建一个审查",
            "status": "common",
            "created_at": "2022-07-25 17:08",
            "reviewer": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            }
        },
        "reviewers": [
            "yystopf"
        ],
        "conflict_files": []
    }

## 获取合并请求文件列表

获取合并请求文件列表

> 示例:

    curl -X GET \
    http://localhost:3000/api/Jason/gitlink/pulls/1/files.json

    await octokit.request('GET /api/jasder/gitlink/pulls/1/files.json')

### HTTP 请求

`GET /api/:owner/:repo/pulls/:id/files.json`

### 请求参数:

参数名 | 必选 | 类型 | 说明
--- | --- | --- | ---
owner | 是 | string | 用户登录名
repo | 是 | string | project's identifier
id | 是 | int | pull request's id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
- | - | -
files_count | int | 文件更改的总数量
total_addition | int | 添加代码总行数
total_deletion | int | 删除代码总行数
files | array |
-- sha | string | commit's sha value
-- name | string | 当前文件名
-- old_name | string | 修改之前的文件名称,与name相同的话，说明文件名未更改
-- addition | int | 文件添加的行数
-- deletion | int | 文件删除的行数
-- type | int | 文件类型， 1: 表示该文件只添加了内容，2: 表示该文件内容有修改， 3: 表示文件被删除或者改文件只删除了内容
-- isCreated | boolean | 当前文件是否为新增文件, true: 是， false: 否
-- isDeleted | boolean | 当前文件是否被删除， true: 是，false: 否
-- isBin | boolean | 当前文件是否为二进制文件，true: 是，false: 否
-- isLFSFile | boolean | 当前文件是否为LFS文件，true: 是，false: 否
-- isRenamed | boolean | 当前文件是否被重命名，true: 是，false: 否
-- sections | array |
---- fileName | string | 文件名称
---- lines | array |
------ leftIdx | string | 文件变动之前所在行数
------ rightIdx | string | 文件更改后所在行数
------ type | string | 文件变更类型，1: 新增，2: 修改， 3: 删除， 4: diff统计信息
------ content | string | 文件变更的内容
------ sectionInfo | object |
-------- path | string | 文件相对仓库的路径
-------- lastLeftIdx | int |
-------- lastRightIdx | int |
-------- leftHunkSize | int | 文件变更之前的行数
-------- rightHunkSize | int | 文件变更之后的行数(及当前页面编辑器显示的总行数)
-------- leftIdx | int | 文件变更之前所在行数
-------- rightIdx | int | 文件变更之后所在行数(即：页面编辑器开始显示的行数)

> 返回的JSON示例:

    {
      "files_count": 6,
      "total_addition": 447,
      "total_deletion": 0,
      "files": [
        {
          "sha": "xefenisnii",
          "name": "文件.txt",
          "old_name": "文件.txt",
          "index": 6,
          "addition": 2,
          "deletion": 0,
          "type": 1,
          "isCreated": true,
          "isDeleted": false,
          "isBin": false,
          "isLFSFile": false,
          "isRenamed": false,
          "isSubmodule": false,
          "sections": [
            {
              "fileName": "文件.txt",
              "name": "",
              "lines": [
                {
                  "leftIdx": 0,
                  "rightIdx": 0,
                  "type": 4,
                  "content": "@@ -0,0 +1,2 @@",
                  "sectionInfo": {
                    "path": null,
                    "lastLeftIdx": null,
                    "lastRightIdx": null,
                    "leftIdx": 0,
                    "rightIdx": 0,
                    "leftHunkSize": null,
                    "rightHunkSize": null
                  }
                },
                {
                  "leftIdx": 0,
                  "rightIdx": 1,
                  "type": 2,
                  "content": "+用例图一致性更新",
                  "sectionInfo": null
                },
                {
                  "leftIdx": 0,
                  "rightIdx": 2,
                  "type": 2,
                  "content": "+工程文件直接上传会有文件缺失，现在压缩后上传",
                  "sectionInfo": null
                }
              ]
            }
          ]
        }
      ]
    }

## 获取合并请求的commits列表

获取合并请求的commits列表

> 示例:

    curl -X GET http://localhost:3000/api/jasder/jasder_test/pulls/1/commits.json

    await octokit.request('GET /api/jasder/jasder_test/pulls/1/commits.json')

### HTTP 请求

`GET /api/:owner/:repo/pulls/:id/commits.json`

### 请求参数:

参数名 | 必选 | 类型 | 说明
--- | --- | --- | ---
owner | 是 | string | 用户登录名
repo | 是 | string | project's identifier
id | 是 | int | pull request's id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
commits_count | int | commits总数量
commits | array |
-- author | object | 项目作者
---- login | string | 用户login
---- name | string | 用户姓名
---- image_url | string | 用户头像
-- committer | object | commit提交用户
---- login | string | 用户login
---- name | string | 用户姓名
---- image_url | string | 用户头像
-- timestamp | int | commit的unix时间戳
-- time_from_now | string | commit’s 提交时间距当前时间的时间值
-- message | string | commit说明信息
-- sha | string | commit’s sha值

> 返回的JSON示例:

    {
      "commits_count": 1,
      "commits": [
        {
          "author": {
            "id": 36480,
            "login": "jasder",
            "name": "段甲生",
            "image_url": "avatars/User/b"
          },
          "committer": {
            "id": 36480,
            "login": "jasder",
            "name": "段甲生",
            "image_url": "avatars/User/b"
          },
          "timestamp": 1604382982,
          "time_from_now": "3小时前",
          "message": "add some file\n* Add the tag list page to the release page\n* Apply suggestions from code review\n* Add the tags list view\n* Add the delete tag way on ui\n* Not delete tag and clear message when delete a release\n",
          "sha": "8f5faee0d3b3be1b8063e84da0c79dd75327b968"
        }
      ]
    }

## Compare two commits

Compare two commits

> 示例:

    curl -X GET \
    http://localhost:3000/api/Jason/test-txt/compare/master...develop

    curl -X GET \
    http://localhost:3000/api/Jason/test-txt/compare/master...Jason/test-txt:develop

    await octokit.request('GET /api/Jason/test-txt/compare/master...Jason/test-txt:develop')

### HTTP 请求

`GET /api/:owner/:repo/compare/{base}...{head}.json`

### 请求参数:

参数名 | 必选 | 类型 | 说明
--- | --- | --- | ---
owner | 是 | string | 用户登录名
repo | 是 | string | project's identifier
base | 是 | string | pull request's id
head | 是 | string | pull request's id

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
- | - | -
commits_count | int | commits总数量
commits | array |
-- author | object | 项目作者
---- login | string | 用户login
---- name | string | 用户姓名
---- image_url | string | 用户头像
-- committer | object | commit提交用户
---- login | string | 用户login
---- name | string | 用户姓名
---- image_url | string | 用户头像
-- timestamp | int | commit的unix时间戳
-- time_from_now | string | commit’s 提交时间距当前时间的时间值
-- message | string | commit说明信息
-- sha | string | commit’s sha值
diff | object |
-- files_count | int | 文件更改的总数量
-- total_addition | int | 添加代码总行数
-- total_deletion | int | 删除代码总行数
-- files | Array |
-- sha | string | commit's sha
-- name | string | 当前文件名
-- old_name | string | 修改之前的文件名称,与name相同的话，说明文件名未更改
-- addition | int | 文件添加的行数
-- deletion | int | 文件删除的行数
-- type | int | 文件类型， 1: 表示该文件只添加了内容，2: 表示该文件内容有修改， 3: 表示文件被删除或者改文件只删除了内容
-- isCreated | boolean | 当前文件是否为新增文件, true: 是， false: 否
-- isDeleted | boolean | 当前文件是否被删除， true: 是，false: 否
-- isBin | boolean | 当前文件是否为二进制文件，true: 是，false: 否
-- isLFSFile | boolean | 当前文件是否为LFS文件，true: 是，false: 否
-- isRenamed | boolean | 当前文件是否被重命名，true: 是，false: 否
-- sections | array |
---- fileName | string | 文件名称
---- lines | array |
------ leftIdx | string | 文件变动之前所在行数
------ rightIdx | string | 文件更改后所在行数
------ type | string | 文件变更类型，1: 内容未改动，2: 添加， 3: 删除， 4: diff统计信息
------ content | string | 文件变更的内容
------ sectionInfo | object |
-------- path | string | 文件相对仓库的路径
-------- lastLeftIdx | int |
-------- lastRightIdx | int |
-------- leftHunkSize | int | 文件变更之前的行数
-------- rightHunkSize | int | 文件变更之后的行数(及当前页面编辑器显示的总行数)
-------- leftIdx | int | 文件变更之前所在行数
-------- rightIdx | int | 文件变更之后所在行数

> 返回的JSON示例:

    {
      "commits_count": 1,
      "commits": [
        {
          "author": {
            "id": 36480,
            "login": "jasder",
            "name": "段甲生",
            "image_url": "avatars/User/b"
          },
          "committer": {
            "id": 36480,
            "login": "jasder",
            "name": "段甲生",
            "image_url": "avatars/User/b"
          },
          "timestamp": 1604382982,
          "time_from_now": "4小时前",
          "message": "add some file\n* Add the tag list page to the release page\n* Apply suggestions from code review\n* Add the tags list view\n* Add the delete tag way on ui\n* Not delete tag and clear message when delete a release\n",
          "sha": "8f5faee0d3b3be1b8063e84da0c79dd75327b968"
        }
      ],
      "diff": {
        "files_count": 6,
        "total_addition": 447,
        "total_deletion": 0,
        "files": [
          {
            "name": "build.go",
            "old_name": "build.go",
            "index": 1,
            "addition": 33,
            "deletion": 0,
            "type": 1,
            "isCreated": true,
            "isDeleted": false,
            "isBin": false,
            "isLFSFile": false,
            "isRenamed": false,
            "isSubmodule": false,
            "sections": [
              {
                "fileName": "build.go",
                "name": "",
                "lines": [
                  {
                    "leftIdx": 0,
                    "rightIdx": 0,
                    "type": 4,
                    "content": "@@ -0,0 +1,33 @@",
                    "sectionInfo": {
                      "path": "build.go",
                      "lastLeftIdx": 0,
                      "lastRightIdx": 0,
                      "leftIdx": 0,
                      "rightIdx": 1,
                      "leftHunkSize": 0,
                      "rightHunkSize": 33
                    }
                  },
                  {
                    "leftIdx": 0,
                    "rightIdx": 1,
                    "type": 2,
                    "content": "+// Copyright 2020 The Gitea Authors. All rights reserved.",
                    "sectionInfo": null
                  }
                ]
              }
            ]
          }
        ]
      }

## 获取合并请求列表

获取合并请求列表

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/ceshi_commit/pulls.json

    await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/pulls.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
keyword | 否 |  | string | 搜索关键词
status | 否 |  | int | 合并请求类型 0: 开启的, 1: 合并的 2: 关闭的，不传则为全部的
priority_id | 否 |  | int | 优先级ID
issue_tag_id | 否 |  | int | 标记ID
version_id | 否 |  | int | 里程碑ID
reviewer_id | 否 |  | int | 审查人员ID
assign_user_id | 否 |  | int | 指派人员ID
sort_by | 否 | created_at | string | 排序字段，created_at: 创建时间, updated_at: 更新时间
sort_direction | 否 | desc | string | 排序类型 desc: 倒序 asc: 正序

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
- | - | -
total_count | int | 合并请求总数
id | int | 合并请求ID
title | string | 合并请求标题
body | string | 合并请求内容
head | int | 合并请求源分支
base | int | 合并请求目标分支
index | int | 合并请求序号
is_original | bool | 是否为fork仓库发来的合并请求
status | string | 合并请求状态，open: 开启的, merged: 合并的, closed: 关闭的
fork_project.id | int | fork仓库的id
fork_project.identifier | string | fork仓库的标识
fork_project.login | string | fork仓库拥有者的标识
issue.id | int | 疑修ID
issue.author | object | 疑修作者
issue.priority | string | 疑修优先级
issue.version | string | 疑修里程碑
issue.journals_count | int | 普通评论数量
issue.issue_tags | array | 标记
journals_count | int | 审查评论数量

> 返回的JSON示例:

    {
        "total_count": 2,
        "pulls": [
            {
                "id": 167,
                "head": "master",
                "base": "master",
                "is_original": true,
                "index": 4,
                "status": "open",
                "fork_project": {
                    "id": 491,
                    "identifier": "ceshi_commit",
                    "login": "testforge1"
                },
                "issue": {
                    "id": 264,
                    "author": {
                        "id": 4,
                        "type": "User",
                        "name": "tes tforge1",
                        "login": "testforge1",
                        "image_url": "system/lets/letter_avatars/2/T/238_117_19/120.png"
                    },
                    "priority": null,
                    "version": null,
                    "journals_count": 0,
                    "issue_tags": null
                },
                "journals_count": 0
            },
            {
                "id": 165,
                "head": "master_1",
                "base": "master",
                "is_original": false,
                "index": 3,
                "status": "open",
                "issue": {
                    "id": 262,
                    "author": {
                        "id": 2,
                        "type": "User",
                        "name": "heh",
                        "login": "yystopf",
                        "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                    },
                    "priority": null,
                    "version": null,
                    "journals_count": 0,
                    "issue_tags": null
                },
                "journals_count": 0
            }
        ]
    }

## 创建一个合并请求

为仓库创建一个合并请求

> 示例:

    curl -X POST \
    http://localhost:3000/api/yystopf/ceshi/pulls.json

    await octokit.request('POST /api/yystopf/ceshi/pulls.json')

### HTTP 请求

`POST /api/:owner/:repo/pulls.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
title | 是 |  | string | 合并请求标题
body | 否 |  | string | 合并请求内容
base | 是 |  | string | 目标分支
head | 是 |  | string | 源分支
is_original | 是 |  | bool | 是否为fork仓库发来的合并请求
fork_project_id | 否 |  | integer | fork仓库ID
reviewer_ids | 否 |  | array | 审查人员id数组
assigned_to_id | 否 |  | integer | 指派人员ID
fixed_version_id | 否 |  | integer | 里程碑ID
issue_tag_ids | 否 |  | array | 标记ID数组
priority_id | 否 |  | integer | 优先级ID
receivers_login | 否 |  | array | @人员的login

> 请求的JSON示例:

    {
        "title": "324",
        "assigned_to_id": "2",
        "fixed_version_id": "",
        "issue_tag_ids": [],
        "priority_id": "2",
        "body": "312",
        "head": "new_branch_1",
        "base": "master",
        "is_original": false,
        "fork_project_id": "",
        "files_count": 1,
        "commits_count": 1,
        "reviewer_ids": [],
        "receivers_login": []
    }

> 返回的JSON示例:

    {
        "status": 0,
        "message": "响应成功",
        "pull_request_id": 169,
        "pull_request_number": 6,
        "pull_request_status": 0,
        "pull_request_head": "new_branch_1",
        "pull_request_base": "master",
        "pull_request_staus": "open",
        "is_original": false,
        "fork_project_id": null,
        "fork_project_identifier": null,
        "fork_project_user": null,
        "reviewers": [
            "yystopf"
        ],
        "id": 266,
        "name": "324",
        "pr_time": "1分钟前",
        "assign_user_name": "heh",
        "assign_user_login": "yystopf",
        "author_name": "heh",
        "author_login": "yystopf",
        "avatar_url": "system/lets/letter_avatars/2/H/188_239_142/120.png",
        "priority": "正常",
        "version": null,
        "journals_count": 0,
        "issue_tags": null
    }

Success Data.

## 获取合并请求版本列表

获取合并请求版本列表

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/ceshi_commit/pulls/3/versions.json

    await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls/3/versions.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/pulls/:index/versions.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | int | 合并请求序号

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 合并请求版本总数
versions.id | int | 版本ID
versions.add_line_num | int | 该版本新增行数
versions.del_line_num | int | 该版本删除行数
versions.commits_count | int | 该版本提交总数
versions.files_count | int | 该版本提交文件总数
versions.base_commit_sha | string | 目标commit ID
versions.head_commit_sha | string | 源commit ID
versions.start_commit_sha | string | 该版本起始commit ID
versions.created_time | int | 版本创建时间
versions.updated_time | int | 版本更新时间

> 返回的JSON示例:

    {
        "total_count": 1,
        "versions": [
            {
                "id": 33,
                "add_line_num": 5,
                "del_line_num": 2,
                "commits_count": 31,
                "files_count": 29,
                "base_commit_sha": "4a277037093c1248e46d2946ee30b61cccdb9df9",
                "head_commit_sha": "fa3b1cdc8e0727d0fb9c96d28c545867c39815b8",
                "start_commit_sha": "e49b1fd335e093a440fcf35a21e050afd48ef932",
                "created_time": 1658469499,
                "updated_time": 1658469499
            }
        ]
    }

## 获取合并请求版本Diff

获取合并请求版本Diff（支持获取单文件Diff）

> 示例:

    curl -X GET \
    -d "filepath=ceshi_dir_1/new_file_1" \
    http://localhost:3000/api/v1/yystopf/ceshi_commit/pulls/3/versions/33/diff.json

    await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls/3/versions/33/diff.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/pulls/:index/versions/:version_id/diff.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | int | 合并请求序号
version_id | 是 |  | int | 版本ID
filepath | 否 |  | string | 文件路径

### 列表返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
file_nums | int | 文件数量
total_addition | int | 新增行数
total_deletion | int | 删除行数
files.name | string | 文件名称
files.oldname | string | 文件修改前名称
files.addition | int | 文件新增行数
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 | 是否为LFS文件
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 | 文件变更之后的行数(及当前页面编辑器显示的总行数)
files.is_incomplete | bool | 是否不完整
files.is_incomplete_line_too_long | bool | 文件是否不完整是因为太长了
files.is_protected | bool | 文件是否被保护

> 列表返回的JSON示例:

    {
        "file_nums": 29,
        "total_addition": 5,
        "total_deletion": 2,
        "files": [
            {
                "name": "README.md",
                "oldname": "README.md",
                "addition": 1,
                "deletion": 2,
                "type": 2,
                "is_created": false,
                "is_deleted": false,
                "is_bin": false,
                "is_lfs_file": false,
                "is_renamed": false,
                "is_ambiguous": false,
                "is_submodule": false,
                "sections": [
                    {
                        "file_name": "README.md",
                        "name": "",
                        "lines": [
                            {
                                "left_index": 0,
                                "right_index": 0,
                                "match": 0,
                                "type": 4,
                                "content": "@@ -1,2 +1 @@",
                                "section_path": "README.md",
                                "section_last_left_index": 0,
                                "section_last_right_index": 0,
                                "section_left_index": 1,
                                "section_right_index": 1,
                                "section_left_hunk_size": 2,
                                "section_right_hunk_size": 0
                            },
                            {
                                "left_index": 1,
                                "right_index": 0,
                                "match": 3,
                                "type": 3,
                                "content": "-# ceshi_commit"
                            },
                            {
                                "left_index": 2,
                                "right_index": 0,
                                "match": -1,
                                "type": 3,
                                "content": "-"
                            },
                            {
                                "left_index": 0,
                                "right_index": 1,
                                "match": 1,
                                "type": 2,
                                "content": "+adsa"
                            }
                        ]
                    },
                    {}
                ],
                "is_incomplete": false,
                "is_incomplete_line_too_long": false,
                "is_protected": false
            }
        ]
    }

### 单个文件返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
name | string | 文件名称
oldname | string | 文件修改前名称
addition | int | 文件新增行数
deletion | int | 文件删除行数
type | int | 文件类型 1: 新增 2: 更改 3: 删除 4: 重命名 5: 复制
is_created | bool | 是否为新建文件
is_deleted | bool | 是否为删除文件
is_bin | bool | 是否为二进制文件
is_lfs_file | bool | 是否为LFS文件
is_renamed | bool | 是否重命名
is_ambiguous | bool |
is_submodule | bool | 是否为子模块
diff | string | git diff内容
sections.file_name | string | 文件名称
sections.name | string |
sections.lines.left_index | int | 文件变动之前所在行数
sections.lines.right_index | int | 文件变动之后所在行数
sections.lines.match | int |
sections.lines.type | int | 文件变更类型
sections.lines.content | string | 文件变更内容
sections.lines.section_path | string | 文件路径
sections.lines.section_last_left_index | int |
sections.lines.section_last_right_index | int |
sections.lines.section_left_index | int | 文件变更之前所在行数
sections.lines.section_right_index | int | 文件变更之后所在行数(即：页面编辑器开始显示的行数)
sections.lines.section_left_hunk_size | int | 文件变更之前的行数
sections.lines.section_right_hunk_size | int | 文件变更之后的行数(及当前页面编辑器显示的总行数)
is_incomplete | bool | 是否不完整
is_incomplete_line_too_long | bool | 文件是否不完整是因为太长了
is_protected | bool | 文件是否被保护

> 单个文件返回的JSON示例:

    {
        "name": "README.md",
        "oldname": "README.md",
        "addition": 1,
        "deletion": 2,
        "type": 2,
        "is_created": false,
        "is_deleted": false,
        "is_bin": false,
        "is_lfs_file": false,
        "is_renamed": false,
        "is_ambiguous": false,
        "is_submodule": false,
        "sections": [
            {
                "file_name": "README.md",
                "name": "",
                "lines": [
                    {
                        "left_index": 0,
                        "right_index": 0,
                        "match": 0,
                        "type": 4,
                        "content": "@@ -1,2 +1 @@",
                        "section_path": "README.md",
                        "section_last_left_index": 0,
                        "section_last_right_index": 0,
                        "section_left_index": 1,
                        "section_right_index": 1,
                        "section_left_hunk_size": 2,
                        "section_right_hunk_size": 0
                    },
                    {
                        "left_index": 1,
                        "right_index": 0,
                        "match": 3,
                        "type": 3,
                        "content": "-# ceshi_commit"
                    },
                    {
                        "left_index": 2,
                        "right_index": 0,
                        "match": -1,
                        "type": 3,
                        "content": "-"
                    },
                    {
                        "left_index": 0,
                        "right_index": 1,
                        "match": 1,
                        "type": 2,
                        "content": "+adsa"
                    }
                ]
            },
            {
                "file_name": "README.md",
                "name": "",
                "lines": [
                    {
                        "left_index": 0,
                        "right_index": 0,
                        "match": 0,
                        "type": 4,
                        "content": " ",
                        "section_path": "README.md",
                        "section_last_left_index": 0,
                        "section_last_right_index": 1,
                        "section_left_index": 3,
                        "section_right_index": 2,
                        "section_left_hunk_size": 0,
                        "section_right_hunk_size": 0
                    }
                ]
            }
        ],
        "is_incomplete": false,
        "is_incomplete_line_too_long": false,
        "is_protected": false
    }

## 获取合并请求审查列表

获取合并请求版本审查列表

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/ceshi_commit/pulls/3/reviews.json

    await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls/3/reviews.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/pulls/:index/reviews.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | int | 合并请求序号
status | 否 |  | string | 审查类型， common: 评论类型, approved: 已通过, rejected: 已拒绝

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 审查总数
reviews.reviewer | object | 审查者
reviews.pull_request.id | integer | 合并请求ID
reviews.pull_request.title | string | 合并请求标题
reviews.pull_request.body | string | 合并请求内容
reviews.pull_request.head | string | 合并请求源分支
reviews.pull_request.base | string | 合并请求目标分支
reviews.pull_request.is_original | string | 合并请求是否从fork仓库所来
reviews.pull_request.fork_project.id | int | fork仓库的id
reviews.pull_request.fork_project.identifier | string | fork仓库的标识
reviews.pull_request.fork_project.login | string | fork仓库拥有者的标识
reviews.pull_request.index | string | 合并请求的序号
reviews.pull_request.status | string | 合并请求的状态，open: 打开的, merged: 合并的, closed: 关闭的
reviews.pull_request.issue.id | integer | 合并请求下疑修的ID
reviews.pull_request.issue.author | object | 合并请求以及疑修的创建着
reviews.pull_request.issue.priority | string | 疑修的优先级
reviews.pull_request.issue.version | string | 疑修的里程碑
reviews.pull_request.issue.journals_count | integer | 普通评论数量
reviews.pull_request.issue.issue_tags | array | 所属标记
reviews.pull_request.journals_count | integer | 审查评论数量
reviews.id | integer | 审查ID
reviews.commit_id | string | 审查的commit ID
reviews.content | string | 审查的内容
reviews.status | string | 审查类型，common: 普通, approved: 通过，rejected: 拒绝通过
reviews.created_at | string | 审查创建时间

> 返回的JSON示例:

    {
        "total_count": 1,
        "reviews": [
            {
                "reviewer": {
                    "id": 2,
                    "type": "User",
                    "name": "heh",
                    "login": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                },
                "pull_request": {
                    "id": 163,
                    "title": "新合并请求1",
                    "body": null,
                    "head": "master_1",
                    "base": "master",
                    "is_original": false,
                    "index": 1,
                    "status": "closed",
                    "issue": {
                        "id": 260,
                        "author": {
                            "id": 2,
                            "type": "User",
                            "name": "heh",
                            "login": "yystopf",
                            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                        },
                        "priority": null,
                        "version": null,
                        "journals_count": 0,
                        "issue_tags": null
                    },
                    "reviewers": [],
                    "journals_count": 8
                },
                "id": 5,
                "commit_id": null,
                "content": "新建一个审查",
                "status": "common",
                "created_at": "2022-07-25 17:08"
            }
        ]
    }

## 为合并请求创建一个审查

合并请求创建一个审查

> 示例:

    curl -X POST \
    http://localhost:3000/api/v1/yystopf/ceshi/pulls/1/reviews.json

    await octokit.request('POST /api/v1/yystopf/ceshi/pulls/1/reviews.json')

### HTTP 请求

`POST /api/v1/:owner/:repo/pulls/:index/reviews.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | integer | 合并请求序号
content | 否 |  | string | 审查内容
commit_id | 否 |  | string | 当前合并请求的commit_id
status | 是 |  | string | 审查类型, common: 普通, approved: 通过, rejected: 拒绝

> 请求的JSON示例:

    {
        "content": "新建一个审查",
        "commit_id": "e506844b2467ce25a35dd46dad8236a1595a02da",
        "status": "common"
    }

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
reviewer | object | 审查者
pull_request.id | integer | 合并请求ID
pull_request.title | string | 合并请求标题
pull_request.body | string | 合并请求内容
pull_request.head | string | 合并请求源分支
pull_request.base | string | 合并请求目标分支
pull_request.is_original | string | 合并请求是否从fork仓库所来
pull_request.fork_project.id | int | fork仓库的id
pull_request.fork_project.identifier | string | fork仓库的标识
pull_request.fork_project.login | string | fork仓库拥有者的标识
pull_request.index | string | 合并请求的序号
pull_request.status | string | 合并请求的状态，open: 打开的, merged: 合并的, closed: 关闭的
pull_request.issue.id | integer | 合并请求下疑修的ID
pull_request.issue.author | object | 合并请求以及疑修的创建着
pull_request.issue.priority | string | 疑修的优先级
pull_request.issue.version | string | 疑修的里程碑
pull_request.issue.journals_count | integer | 普通评论数量
pull_request.issue.issue_tags | array | 所属标记
pull_request.journals_count | integer | 审查评论数量
id | integer | 审查ID
commit_id | string | 审查的commit ID
content | string | 审查的内容
status | string | 审查类型，common: 普通, approved: 通过，rejected: 拒绝通过
created_at | string | 审查创建时间

> 返回的JSON示例:

    {
        "reviewer": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "pull_request": {
            "id": 163,
            "head": "master_1",
            "base": "master",
            "is_original": false,
            "index": 1,
            "status": "closed",
            "issue": {
                "id": 260,
                "author": {
                    "id": 2,
                    "type": "User",
                    "name": "heh",
                    "login": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                },
                "priority": null,
                "version": null,
                "journals_count": 0,
                "issue_tags": null
            },
            "journals_count": 6
        },
        "id": 10,
        "commit_id": "e506844b2467ce25a35dd46dad8236a1595a02da",
        "content": "新建一个审查",
        "status": "common",
        "created_at": "2022-07-26 11:45"
    }

Success Data.

## 获取合并请求评论列表

获取合并请求版本评论列表

> 示例:

    curl -X GET http://localhost:3000/api/v1/yystopf/ceshi_commit/pulls/3/journals.json

    await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls/3/journals.json')

### HTTP 请求

`GET /api/v1/:owner/:repo/pulls/:index/journals.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | int | 合并请求序号
keyword | 否 |  | string | 搜索关键词
review_id | 否 |  | integer | 审查ID
need_respond | 否 |  | bool | 是否需要回应
state | 否 |  | string | 状态, opened: 开启的, resolved: 已解决的, disabled: 无效的
parent_id | 否 |  | integer | 父评论ID
path | 否 |  | string | 评论文件路径
is_full | 否 |  | bool | 是否展示全部评论（包括回复）
sort_by | 否 | created_on | string | 排序字段 created_on: 创建时间, updated_on: 更新时间
sort_direction | 否 | asc | string | 排序类型 desc: 倒序, asc: 正序

### 返回字段说明:

参数 | 类型 | 字段说明
--- | --- | ---
total_count | int | 评论总数
journals.id | int | 评论ID
journals.notes | string | 评论内容
journals.commit_id | string | CommitID
journals.line_code | string | 评论行数
journals.path | string | 评论文件路径
journals.diff | object | 评论文件diff内容
journals.need_respond | bool | 评论是否要回应
journals.state | string | 评论状态，opened: 开启的, resolved: 已解决的, disabled: 无效的
journals.parent_id | int | 父评论ID
journals.user | object | 评论创建者
journals.review | object | 评论所属评审
journals.resolveer | object | 评论解决者
journals.resolve_at | int | 评论解决时间
journals.created_at | int | 评论创建时间
journals.updated_at | int | 评论更新时间

> 返回的JSON示例:

    {
        "total_count": 1,
        "journals": [
            {
                "id": 200,
                "note": "测试评论修改",
                "commit_id": null,
                "line_code": "70eede447ccc01c1902260fd377af5d90be28e0d_0_29",
                "path": "Gemfile.lock",
                "diff": {},
                "need_respond": true,
                "state": "resolved",
                "parent_id": nil,
                "user": {
                    "id": 2,
                    "type": "User",
                    "name": "heh",
                    "login": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                },
                "review": {
                    "reviewer": {
                        "id": 2,
                        "type": "User",
                        "name": "heh",
                        "login": "yystopf",
                        "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                    },
                    "pull_request": {
                        "id": 163,
                        "title": "新合并请求1",
                        "body": null,
                        "head": "master_1",
                        "base": "master",
                        "is_original": false,
                        "index": 1,
                        "status": "closed",
                        "issue": {
                            "id": 260,
                            "author": {
                                "id": 2,
                                "type": "User",
                                "name": "heh",
                                "login": "yystopf",
                                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                            },
                            "priority": null,
                            "version": null,
                            "journals_count": 0,
                            "issue_tags": null
                        },
                        "reviewers": [],
                        "journals_count": 9
                    },
                    "id": 10,
                    "commit_id": "1",
                    "content": "新建一个审查",
                    "status": "common",
                    "created_at": "2022-07-26 11:45"
                },
                "resolveer": {
                    "id": 2,
                    "type": "User",
                    "name": "heh",
                    "login": "yystopf",
                    "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                },
                "resolve_at": "2022-07-27 14:50",
                "created_at": "2022-07-27 14:31",
                "updated_at": "2022-07-27 14:50"
            }
        ]
    }

## 创建一个合并请求评论

为仓库创建一个合并请求的评论

> 示例:

    curl -X POST \
    http://localhost:3000/api/v1/yystopf/ceshi/pulls/1/journals.json

    await octokit.request('POST /api/v1/yystopf/ceshi/pulls/1/journals.json')

### HTTP 请求

`POST /api/v1/:owner/:repo/pulls/:index/journals.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | integer | 合并请求序号
type | 否 | comment | string | 评论类型 comment: 普通, problem: 需要回应的评论
note | 否 |  | string | 评论内容
review_id | 否 |  | string | 审查ID
line_code | 否 |  | string | 行号
commit_id | 否 |  | bool | commitID
path | 否 |  | integer | 文件路径
parent_id | 否 |  | integer | 父评论ID
diff | 否 |  | array | 文件diff内容

> 请求的JSON示例:

    {
        "type": "problem",
        "note": "测试评论",
        "review_id": "10",
        "line_code": "70eede447ccc01c1902260fd377af5d90be28e0d_0_29",
        "commit_id": "70eede447ccc01c1902260fd377af5d90be28e0d",
        "path": "Gemfile.lock",
        "diff": {
            "name": "README.md",
            "oldname": "README.md",
            "addition": 1,
            "deletion": 2,
            "type": 2,
            "is_created": false,
            "is_deleted": false,
            "is_bin": false,
            "is_lfs_file": false,
            "is_renamed": false,
            "is_ambiguous": false,
            "is_submodule": false,
            "sections": [
                {
                    "file_name": "README.md",
                    "name": "",
                    "lines": [
                        {
                            "left_index": 0,
                            "right_index": 0,
                            "match": 0,
                            "type": 4,
                            "content": "@@ -1,2 +1 @@",
                            "section_path": "README.md",
                            "section_last_left_index": 0,
                            "section_last_right_index": 0,
                            "section_left_index": 1,
                            "section_right_index": 1,
                            "section_left_hunk_size": 2,
                            "section_right_hunk_size": 0
                        },
                        {
                            "left_index": 1,
                            "right_index": 0,
                            "match": 3,
                            "type": 3,
                            "content": "-# ceshi_commit"
                        },
                        {
                            "left_index": 2,
                            "right_index": 0,
                            "match": -1,
                            "type": 3,
                            "content": "-"
                        },
                        {
                            "left_index": 0,
                            "right_index": 1,
                            "match": 1,
                            "type": 2,
                            "content": "+adsa"
                        }
                    ]
                },
                {
                    "file_name": "README.md",
                    "name": "",
                    "lines": [
                        {
                            "left_index": 0,
                            "right_index": 0,
                            "match": 0,
                            "type": 4,
                            "content": " ",
                            "section_path": "README.md",
                            "section_last_left_index": 0,
                            "section_last_right_index": 1,
                            "section_left_index": 3,
                            "section_right_index": 2,
                            "section_left_hunk_size": 0,
                            "section_right_hunk_size": 0
                        }
                    ]
                }
            ],
            "is_incomplete": false,
            "is_incomplete_line_too_long": false,
            "is_protected": false
        }
    }

> 返回的JSON示例:

    {
        "id": 200,
        "note": "测试评论修改",
        "commit_id": null,
        "line_code": "70eede447ccc01c1902260fd377af5d90be28e0d_0_29",
        "path": "Gemfile.lock",
        "diff": {},
        "need_respond": true,
        "state": "resolved",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "review": {
            "reviewer": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            },
            "pull_request": {
                "id": 163,
                "title": "新合并请求1",
                "body": null,
                "head": "master_1",
                "base": "master",
                "is_original": false,
                "index": 1,
                "status": "closed",
                "issue": {
                    "id": 260,
                    "author": {
                        "id": 2,
                        "type": "User",
                        "name": "heh",
                        "login": "yystopf",
                        "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                    },
                    "priority": null,
                    "version": null,
                    "journals_count": 0,
                    "issue_tags": null
                },
                "reviewers": [],
                "journals_count": 9
            },
            "id": 10,
            "commit_id": "1",
            "content": "新建一个审查",
            "status": "common",
            "created_at": "2022-07-26 11:45"
        },
        "resolveer": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "resolve_at": "2022-07-27 14:50",
        "created_at": "2022-07-27 14:31",
        "updated_at": "2022-07-27 14:50"
    }

Success Data.

## 修改一个合并请求评论

修改一个仓库合并请求的评论

> 示例:

    curl -X PATCH \
    http://localhost:3000/api/v1/yystopf/ceshi/pulls/1/journals/200.json

    await octokit.request('PATCH /api/v1/yystopf/ceshi/pulls/1/journals/200.json')

### HTTP 请求

`PATCH /api/v1/:owner/:repo/pulls/:index/journals/:id.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | integer | 合并请求序号
id | 是 |  | integer | 评论ID
note | 是 |  | string | 评论内容
commit_id | 是 |  | string | commitID
state | 是 |  | string | 评论状态, opened: 开启的, resolved: 已解决的, disabled: 无效的

> 请求的JSON示例:

    {
        "note": "测试评论",
        "commit_id": "70eede447ccc01c1902260fd377af5d90be28e0d",
        "state": "resolved"
    }

> 返回的JSON示例:

    {
        "id": 200,
        "note": "测试评论修改",
        "commit_id": null,
        "line_code": "70eede447ccc01c1902260fd377af5d90be28e0d_0_29",
        "path": "Gemfile.lock",
        "diff": {},
        "need_respond": true,
        "state": "resolved",
        "user": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "review": {
            "reviewer": {
                "id": 2,
                "type": "User",
                "name": "heh",
                "login": "yystopf",
                "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
            },
            "pull_request": {
                "id": 163,
                "title": "新合并请求1",
                "body": null,
                "head": "master_1",
                "base": "master",
                "is_original": false,
                "index": 1,
                "status": "closed",
                "issue": {
                    "id": 260,
                    "author": {
                        "id": 2,
                        "type": "User",
                        "name": "heh",
                        "login": "yystopf",
                        "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
                    },
                    "priority": null,
                    "version": null,
                    "journals_count": 0,
                    "issue_tags": null
                },
                "reviewers": [],
                "journals_count": 9
            },
            "id": 10,
            "commit_id": "1",
            "content": "新建一个审查",
            "status": "common",
            "created_at": "2022-07-26 11:45"
        },
        "resolveer": {
            "id": 2,
            "type": "User",
            "name": "heh",
            "login": "yystopf",
            "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
        },
        "resolve_at": "2022-07-27 14:50",
        "created_at": "2022-07-27 14:31",
        "updated_at": "2022-07-27 14:50"
    }

Success Data.

## 删除合并请求的一个评论

删除合并请求的一个评论

> 示例:

    curl -X DELETE \
    http://localhost:3000/api/v1/yystopf/ceshi/pulls/1/journals/200.json

    await octokit.request('DELETE /api/v1/yystopf/ceshi/pulls/1/journals/200.json')

### HTTP 请求

`DELETE /api/v1/:owner/:repo/pulls/:index/journals/:id.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
owner | 是 |  | string | 用户登录名
repo | 是 |  | string | 项目标识identifier
index | 是 |  | integer | 合并请求序号
id | 是 |  | integer | 评论ID

### 返回字段说明:

> 返回的JSON示例:

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

Success Data.

# Issues

# Organizations

# Teams

## 团队下新增所有的项目

团队下新增所有的项目

> 示例:

    curl -X POST \
    http://localhost:3000/api/organizations/ceshi_org/teams/28/team_projects/create_all

    await octokit.request('POST /api/organizations/ceshi_org/teams/28/team_projects/create_all.json')

### HTTP 请求

`POST /api/organizations/:organization/teams/:id/team_projects/create_all.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
organization | 是 |  | string | 组织标识
id | 是 |  | integer | 团队 ID

### 返回字段说明:

> 返回的JSON示例:

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

Success Data.

## 团队下删除所有的项目

团队下删除所有的项目

> 示例:

    curl -X DELETE \
    http://localhost:3000/api/organizations/ceshi_org/teams/28/team_projects/destroy_all

    await octokit.request('DELETE /api/organizations/ceshi_org/teams/28/team_projects/destroy_all.json')

### HTTP 请求

`DELETE /api/organizations/:organization/teams/:id/team_projects/destroy_all.json`

### 请求参数:

参数 | 必选 | 默认 | 类型 | 字段说明
--- | --- | --- | --- | ---
organization | 是 |  | string | 组织标识
id | 是 |  | integer | 团队 ID

### 返回字段说明:

> 返回的JSON示例:

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

Success Data.

# Errors

This error section is stored in a separate file in `includes/_errors.md`. Slate allows you to optionally separate out your docs into many files...just save them to the `includes` folder and add them to the top of your `index.md`'s frontmatter. Files are included in the order listed.

The Kittn API uses the following error codes:

Error Code | Meaning
--- | ---
400 | Bad Request -- Your request is invalid.
401 | Unauthorized -- Your API key is wrong.
403 | Forbidden -- The kitten requested is hidden for administrators only.
404 | Not Found -- The specified kitten could not be found.
405 | Method Not Allowed -- You tried to access a kitten with an invalid method.
406 | Not Acceptable -- You requested a format that isn't json.
410 | Gone -- The kitten requested has been removed from our servers.
418 | I'm a teapot.
429 | Too Many Requests -- You're requesting too many kittens! Slow down!
500 | Internal Server Error -- We had a problem with our server. Try again later.
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Shell JavaScript