|
|
|
@ -399,15 +399,15 @@ http://localhost:3000/api/18816895620/mirror_demo/entries | jq
|
|
|
|
|
```
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
#### 获取子目录代码列表
|
|
|
|
|
#### 获取子目录代码列表/编辑某个具体的文件
|
|
|
|
|
```
|
|
|
|
|
POST api/:login/:repo_identifier/sub_entries
|
|
|
|
|
GET api/:login/:repo_identifier/sub_entries
|
|
|
|
|
```
|
|
|
|
|
*示例*
|
|
|
|
|
```
|
|
|
|
|
curl -X GET \
|
|
|
|
|
-d "ref=develop" \
|
|
|
|
|
-d "filepath=lib/slew.rc" \
|
|
|
|
|
-d "ref=master" \
|
|
|
|
|
-d "filepath=test1_create_file6.rb" \
|
|
|
|
|
http://localhost:3000/api/18816895620/mirror_demo/sub_entries | jq
|
|
|
|
|
```
|
|
|
|
|
*请求参数说明:*
|
|
|
|
@ -416,7 +416,7 @@ http://localhost:3000/api/18816895620/mirror_demo/sub_entries | jq
|
|
|
|
|
-|-|-|-
|
|
|
|
|
|login |是|string |用户标识(login) |
|
|
|
|
|
|repo_identifier |是|string |仓库标识(identifier) |
|
|
|
|
|
|filepath |是|string |文件夹、文件路径 |
|
|
|
|
|
|filepath |是|string |文件夹、文件的相对路径 |
|
|
|
|
|
|ref |否|string |分支名称、tag名称或是提交记录id,默认为master分支 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1083,8 +1083,8 @@ DELETE /api/:login/:repo_identifier/contents
|
|
|
|
|
```
|
|
|
|
|
curl -X POST \
|
|
|
|
|
-d 'filepath=test1_create_file1.rb' \
|
|
|
|
|
-d 'branch=develop' \
|
|
|
|
|
-d 'content=ZnNmc2FkZg==' \
|
|
|
|
|
-d 'branch=master' \
|
|
|
|
|
-d 'content=提交的内容' \
|
|
|
|
|
-d 'message=test commit ' \
|
|
|
|
|
http://localhost:3000/api/18816895620/mirror_demo/contents.json | jq
|
|
|
|
|
```
|
|
|
|
@ -1146,14 +1146,18 @@ http://localhost:3000/api/18816895620/mirror_demo/contents.json | jq
|
|
|
|
|
|
|
|
|
|
### 更新仓库中的文件
|
|
|
|
|
```
|
|
|
|
|
DELETE /api/:login/:repo_identifier/contents/files/update
|
|
|
|
|
PUT /api/:login/:repo_identifier/contents/files/update
|
|
|
|
|
```
|
|
|
|
|
*示例*
|
|
|
|
|
```
|
|
|
|
|
curl -X DELETE \
|
|
|
|
|
-d 'filepath=1' \
|
|
|
|
|
-d 'object_type=project' \
|
|
|
|
|
http://localhost:3000/api/118816895620/mirror_demo/contents | jq
|
|
|
|
|
curl -X PUT \
|
|
|
|
|
-d 'filepath=text1.rb' \
|
|
|
|
|
-d 'branch=master' \
|
|
|
|
|
-d 'content=ruby code' \
|
|
|
|
|
-d 'message=更改提交信息' \
|
|
|
|
|
-d 'from_path=text.rb' \
|
|
|
|
|
-d "sha=57426eb21e4ceabdf4b206f022077e0040" \
|
|
|
|
|
http://localhost:3000/api/18816895620/mirror_demo/contents/files/update.json | jq
|
|
|
|
|
```
|
|
|
|
|
*请求参数说明:*
|
|
|
|
|
|
|
|
|
@ -1161,10 +1165,12 @@ http://localhost:3000/api/118816895620/mirror_demo/contents | jq
|
|
|
|
|
-|-|-|-
|
|
|
|
|
|login |是|string |用户标识 |
|
|
|
|
|
|repo_identifier|是|string |仓库标识 |
|
|
|
|
|
|filepath |是|string |文件相对于仓库的路径 |
|
|
|
|
|
|content |否|string |内容 |
|
|
|
|
|
|filepath |是|string |文件相对于仓库的路径(或修改后的文件路径) |
|
|
|
|
|
|from_path |是|string |原文件相对于仓库的路径, 只有当需要修改原文件名称时,才需要该参数 |
|
|
|
|
|
|sha |是|string |文件的sha标识值 |
|
|
|
|
|
|content |是|string |内容 |
|
|
|
|
|
|message |否|string |提交说明 |
|
|
|
|
|
|branch |否|string |分支名称, branch和new_branch必须存在一个 |
|
|
|
|
|
|branch |否|string |分支名称, branch和new_branch必须存在一个,且只能存在一个 |
|
|
|
|
|
|new_branch |否|string |新的分支名称 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1172,14 +1178,40 @@ http://localhost:3000/api/118816895620/mirror_demo/contents | jq
|
|
|
|
|
|
|
|
|
|
|参数名|类型|说明|
|
|
|
|
|
-|-|-
|
|
|
|
|
|status |int|0:点赞成功,-1:操作失败,2:表示还未点赞|
|
|
|
|
|
|name |string|文件名|
|
|
|
|
|
|sha |string|提交文件的sha值|
|
|
|
|
|
|size |int|文件大小, 单位:B|
|
|
|
|
|
|content |string|base64编码后的文件内容|
|
|
|
|
|
|encoding |string|编码方式|
|
|
|
|
|
|commit |object||
|
|
|
|
|
|-- message |string|提交备注说明信息|
|
|
|
|
|
|-- committer|object||
|
|
|
|
|
|---- name |string|用户名|
|
|
|
|
|
|---- email |string|用户邮箱|
|
|
|
|
|
|---- date |string|文件创建时间|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
返回值
|
|
|
|
|
```
|
|
|
|
|
{
|
|
|
|
|
"status": 0,
|
|
|
|
|
"message": "响应成功"
|
|
|
|
|
"name": "test1_create_file6.rb",
|
|
|
|
|
"sha": "57426eb21e4ceabdf4b206f022257e08077e0040",
|
|
|
|
|
"size": 16,
|
|
|
|
|
"content": "5o+Q5Lqk55qE5YaF5a65MQ==",
|
|
|
|
|
"encoding": "base64",
|
|
|
|
|
"commit": {
|
|
|
|
|
"message": "更改提交信息\n",
|
|
|
|
|
"author": {
|
|
|
|
|
"name": "18816895620",
|
|
|
|
|
"email": "2456233122@qq.com",
|
|
|
|
|
"date": "2020-01-08T07:05:15Z"
|
|
|
|
|
},
|
|
|
|
|
"committer": {
|
|
|
|
|
"name": "18816895620",
|
|
|
|
|
"email": "2456233122@qq.com",
|
|
|
|
|
"date": "2020-01-08T07:05:15Z"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
---
|
|
|
|
@ -1191,9 +1223,10 @@ DELETE /api/:login/:repo_identifier/contents/files/delete
|
|
|
|
|
*示例*
|
|
|
|
|
```
|
|
|
|
|
curl -X DELETE \
|
|
|
|
|
-d 'filepath=1' \
|
|
|
|
|
-d 'object_type=project' \
|
|
|
|
|
http://localhost:3000/api/118816895620/mirror_demo/contents | jq
|
|
|
|
|
-d 'filepath=test1_create_file12.rb' \
|
|
|
|
|
-d 'test delete file' \
|
|
|
|
|
-d 'sha=7b70509105b587e71f5692b9e8ab70851e321f64' \
|
|
|
|
|
http://localhost:3000/api/18816895620/mirror_demo/contents/files/delete | jq
|
|
|
|
|
```
|
|
|
|
|
*请求参数说明:*
|
|
|
|
|
|
|
|
|
@ -1202,9 +1235,8 @@ http://localhost:3000/api/118816895620/mirror_demo/contents | jq
|
|
|
|
|
|login |是|string |用户标识 |
|
|
|
|
|
|repo_identifier|是|string |仓库标识 |
|
|
|
|
|
|filepath |是|string |文件相对于仓库的路径 |
|
|
|
|
|
|content |否|string |内容 |
|
|
|
|
|
|message |否|string |提交说明 |
|
|
|
|
|
|branch |否|string |分支名称, branch和new_branch必须存在一个 |
|
|
|
|
|
|branch |否|string |分支名称, 默认为master分支|
|
|
|
|
|
|new_branch |否|string |新的分支名称 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1212,14 +1244,32 @@ http://localhost:3000/api/118816895620/mirror_demo/contents | jq
|
|
|
|
|
|
|
|
|
|
|参数名|类型|说明|
|
|
|
|
|
-|-|-
|
|
|
|
|
|status |int|0:点赞成功,-1:操作失败,2:表示还未点赞|
|
|
|
|
|
|sha |string|提交文件的sha值|
|
|
|
|
|
|commit |object||
|
|
|
|
|
|-- message |string|提交备注说明信息|
|
|
|
|
|
|-- committer|object||
|
|
|
|
|
|---- name |string|用户名|
|
|
|
|
|
|---- email |string|用户邮箱|
|
|
|
|
|
|---- date |string|文件创建时间|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
返回值
|
|
|
|
|
```
|
|
|
|
|
{
|
|
|
|
|
"status": 0,
|
|
|
|
|
"message": "响应成功"
|
|
|
|
|
"commit": {
|
|
|
|
|
"sha": "7b70509105b587e71f5692b9e8ab70851e321f64",
|
|
|
|
|
"message": "Delete 'test1_create_file11.rb'\n",
|
|
|
|
|
"author": {
|
|
|
|
|
"name": "18816895620",
|
|
|
|
|
"email": "2456233122@qq.com",
|
|
|
|
|
"date": "2020-01-08T07:57:34Z"
|
|
|
|
|
},
|
|
|
|
|
"committer": {
|
|
|
|
|
"name": "18816895620",
|
|
|
|
|
"email": "2456233122@qq.com",
|
|
|
|
|
"date": "2020-01-08T07:57:34Z"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
---
|
|
|
|
|