mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
Merge branch 'develop' into standalone_develop
This commit is contained in:
@@ -1093,6 +1093,138 @@ await octokit.request('GET /api/yystopf/ceshi/files.json')
|
||||
]
|
||||
```
|
||||
|
||||
## 提交文件到仓库
|
||||
提交文件到仓库,支持批量
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
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
|
||||
```
|
||||
|
||||
```javascript
|
||||
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示例:
|
||||
|
||||
```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示例:
|
||||
|
||||
```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="
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 获取仓库代码目录
|
||||
获取仓库代码目录
|
||||
@@ -1413,6 +1545,89 @@ await octokit.request('GET /api/v1/yystopf/csfjkkj/git/blobs/80dd40214a586223123
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取仓库提交列表
|
||||
根据分支名、标签、commit ID来获取提交列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "sha=master" \
|
||||
-d "page=1" \
|
||||
-d "limit=1" \
|
||||
http://localhost:3000/api/v1/yystopf/csfjkkj/commits.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
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示例:
|
||||
|
||||
```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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取单个提交的blame信息
|
||||
根据commit ID获取blame信息
|
||||
|
||||
@@ -1531,6 +1746,203 @@ await octokit.request('GET /api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取单个文件的blame信息
|
||||
根据分支、标签、commitID获取某个文件的blame信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "sha=master" \
|
||||
-d "filepath=hd.txt" \
|
||||
http://localhost:3000/api/v1/yystopf/csfjkkj/blame.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
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示例:
|
||||
|
||||
```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": [
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
## 获取比较提交blame
|
||||
根据分支名、标签、commit ID来获取代码对比blame
|
||||
|
||||
|
||||
Reference in New Issue
Block a user