diff --git a/README.md b/README.md index 9c50ad421..5ed0d3abf 100644 --- a/README.md +++ b/README.md @@ -809,6 +809,132 @@ curl -X GET http://localhost:3000/api/projects/mirror_demo/branches | jq ``` --- +### 获取版本列表 +``` +GET /api/:login/:repo_identifier/tags +``` +*示例* +``` +curl -X GET http://localhost:3000/api/18816895620/mirror_demo/tags | jq +``` +*请求参数说明:* + +|参数名|必选|类型|说明| +-|-|-|- +|identifier |是|string |项目标识 | + + +*返回参数说明:* + +|参数名|类型|说明| +-|-|- +|name |string|分支名称| +|user_can_push |boolean|用户是否可push| +|user_can_merge |boolean|用户是否客merge| +|protected |boolean|是否为保护分支| +|http_url |boolean|http链接| +|zip_url |boolean|zip包下载链接| +|tar_url |boolean|tar.gz下载链接| +|last_commit |object|最后提交记录| +|-- id |string|提交记录id| +|-- message |string|提交的说明信息| +|-- timestamp |int|提交时间,为UNIX时间戳| +|-- time_from_now|string|转换后的时间| +|author |object|提交用户| +|-- login |string|用户名称| +|-- image_url |string|用户头像| + + +返回值 +``` +[ + { + "name": "develop", + "user_can_push": true, + "user_can_merge": true, + "protected": false, + "http_url": "http://localhost:3003/18816895620/mirror_demo.git", + "zip_url": "http://localhost:3003/18816895620/mirror_demo/develop.zip", + "tar_url": "http://localhost:3003/18816895620/mirror_demo/develop.tar.gz", + "last_commit": { + "id": "735674d6696bddbafa993db9c67b40c41246c77f", + "message": "FIX test branch content\n", + "timestamp": 1577694074, + "time_from_now": "1天前" + }, + "author": { + "login": "18816895620", + "image_url": "avatars/User/b" + } + }, + { + "name": "master", + "user_can_push": true, + "user_can_merge": true, + "protected": false, + "http_url": "http://localhost:3003/18816895620/mirror_demo.git", + "zip_url": "http://localhost:3003/18816895620/mirror_demo/master.zip", + "tar_url": "http://localhost:3003/18816895620/mirror_demo/master.tar.gz", + "last_commit": { + "id": "19ac3bc45f62cc87a94b8ecce61101d8fd2dafd2", + "message": "合并pull request测试\n\n该功能很不错,感谢你的建议\n", + "timestamp": 1577244567, + "time_from_now": "6天前" + }, + "author": { + "login": "18816895620", + "image_url": "avatars/User/b" + } + } +] +``` +--- + +## 仓库详情 +``` +GET /api/:login/:repo_identifier/ +``` +*示例* +``` +curl -X GET \ +http://localhost:3000/api/18816895620/mirror_demo | jq +``` +*请求参数说明:* + +|参数名|必选|类型|说明| +-|-|-|- +|login |是|string |用户标识 | +|repo_identifier |是|string |仓库标识 | + + +*返回参数说明:* + +|参数名|类型|说明| +-|-|- +|identifier |string|仓库标识| +|praises_count |int|点赞数量| +|forked_count |int|fork数量| +|watchers_count |int|关注数量| +|author |object|提交用户| +|-- login |string|用户名称| +|-- image_url |string|用户头像| + + +返回值 +``` +{ + "identifier": "mirror_demo", + "praises_count": 0, + "forked_count": 0, + "watchers_count": 0, + "author": { + "name": "18816895620", + "image_url": "avatars/User/b" + } +} +``` +--- + ## 获取提交记录列表 ``` GET /api/:login/:repo_identifier/commits @@ -951,10 +1077,11 @@ DELETE /api/:login/:repo_identifier/contents ``` *示例* ``` -curl -X DELETE \ --d 'filepath=1' \ --d 'object_type=project' \ -http://localhost:3000/api/118816895620/mirror_demo/contents | jq +curl -X POST \ +-d 'filepath=test_create_file.rb' \ +-d 'branch=master' \ +-d 'content=ZnNmc2FkZg==' \ +http://localhost:3000/api/18816895620/mirror_demo/contents | jq ``` *请求参数说明:*