diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md index b57df90f6..862e96cea 100644 --- a/app/docs/slate/source/includes/_repositories.md +++ b/app/docs/slate/source/includes/_repositories.md @@ -97,6 +97,182 @@ await octokit.request('GET /api/jasder/jasder_test/simple.json') } ``` +## 仓库详情(新版) +仓库详情 + +> 示例: + +```shell +curl -X GET http://localhost:3000/api/yystopf/ceshi/detail.json +``` + +```javascript +await octokit.request('GET /api/yystopf/ceshi/detail.json') +``` + +### HTTP 请求 +`GET /api/:owner/:repo/detail` + +### 请求参数: +参数 | 必选 | 默认 | 类型 | 字段说明 +--------- | ------- | ------- | -------- | ---------- +|owner |是| |string |用户登录名 | +|repo |是| |string |项目标识identifier | + + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|content |string |仓库简介 | +|website |string |仓库网址 | +|readme |string |readme文件| +|identifier |string |项目标识 | +|name |string |项目名称 | +|issues_count |int |项目issue数量| +|pull_requests_count |int |项目issue数量| +|project_identifier |int |项目issue数量| +|praises_count |int |项目issue数量| +|forked_count |int |项目issue数量| +|watchers_count |int |项目issue数量| +|versions_count |int |项目里程碑数量| +|version_releases_count |int |项目发行版数量| +|version_releasesed_count |int |项目发行版已发行数量| +|permission |string |项目权限| +|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 |fork项目id| +|fork_info |object |fork项目信息| +|size |string |仓库大小| +|ssh_url |string |项目ssh地址| +|clone_url |string |项目克隆地址| +|default_branch |string |仓库默认分支| +|empty |bool |仓库是否为空| +|full_name |string |仓库全称| +|private |bool |仓库是否为私有项目| +|license_name |string |许可证名称| +|release_versions.list.name |string |项目issue数量| +|release_versions.list.tag_name |string |发行版标签名称| +|release_versions.list.created_at |string |发行版创建时间| +|release_versions.total_count |int |发行版数量| +|branches.list.name |string |分支名称| +|branches.total_count |int |分支数量| +|tags.list.name |string |标签名称| +|tags.total_count |int |标签数量| +|contributors.list.contributions|int |贡献数量| +|contributors.list.login |string |贡献者登录名| +|contributors.list.name |string |贡献者用户名称| +|contributors.list.image_url |string |贡献者头像| +|languages |object |项目语言占比| + +> 返回的JSON示例: + +```json +{ + "content": "仓库简介", + "website": "仓库网址", + "readme": { + "type": "file", + "encoding": "base64", + "size": 9, + "name": "README.md", + "path": "README.md", + "content": "# ceshi\n\n", + "sha": "" + }, + "identifier": "ceshi", + "name": "测试项目", + "project_id": 2, + "repo_id": 2, + "issues_count": 0, + "pull_requests_count": 0, + "project_identifier": "ceshi", + "praises_count": 0, + "forked_count": 0, + "watchers_count": 0, + "versions_count": 0, + "version_releases_count": 0, + "version_releasesed_count": 0, + "permission": "Reporter", + "mirror_url": null, + "mirror": false, + "type": 0, + "open_devops": false, + "watched": false, + "praised": false, + "status": 1, + "forked_from_project_id": 1, + "fork_info": { + "fork_form_name": "测试项目", + "fork_project_user_login": "ceshi_org", + "fork_project_identifier": "ceshi", + "fork_project_user_name": "ceshi_org" + }, + "size": "25.0 KB", + "ssh_url": "virus@localhost:yystopf/ceshi.git", + "clone_url": "http://localhost:10080/yystopf/ceshi.git", + "default_branch": "master", + "empty": false, + "full_name": "yystopf/ceshi", + "private": false, + "license_name": "gnu-javamail-exception", + "release_versions": { + "list": [ + { + "id": 2, + "name": "vvvv", + "tag_name": "v1.1", + "created_at": "2019-07-18 10:16" + } + ], + "total_count": 1 + }, + "branches": { + "list": [ + { + "name": "master" + } + ], + "total_count": 1 + }, + "tags": { + "list": [ + { + "name": "v1.1" + }, + { + "name": "v1.0" + } + ], + "total_count": 2 + }, + "contributors": { + "list": [ + { + "contributions": 1, + "gid": 2, + "login": "yystopf", + "type": "User", + "name": "yystopf", + "image_url": "avatars/User/b" + } + ], + "total_count": 1 + }, + "languages": { + "HTML": "50.9%", + "Ruby": "25.6%", + "JavaScript": "21.4%", + "CSS": "1.3%", + "CoffeeScript": "0.7%", + "Shell": "0.1%" + } +} +``` ## 编辑仓库信息 编辑仓库信息 @@ -463,6 +639,74 @@ await octokit.request('GET /api/jasder/jasder_test/collaborators.json') Success Data. +## 获取仓库所有文件 +获取仓库所有文件 + +> 示例: + +```shell +curl -X GET http://localhost:3000/api/yystopf/ceshi/files.json +``` + +```javascript +await octokit.request('GET /api/yystopf/ceshi/files.json') +``` + +### HTTP 请求 +`GET /api/:owner/:repo/files` + +### 请求参数: +参数 | 必选 | 默认 | 类型 | 字段说明 +--------- | ------- | ------- | -------- | ---------- +|owner |是| |string |用户登录名 | +|repo |是| |string |项目标识identifier | + + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|name |string |文件名称| +|path |string |文件路径| +|sha |string |文件标识| +|type |string |文件类型| +|size |int |文件大小| +|url |string |文件地址| + + +> 返回的JSON示例: + +```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" + } +] +``` + ## 获取仓库代码目录 获取仓库代码目录 diff --git a/public/docs/api.html b/public/docs/api.html index c33cad0d4..64f96b9f3 100644 --- a/public/docs/api.html +++ b/public/docs/api.html @@ -368,6 +368,9 @@
编辑仓库信息
+仓库详情
-示例:
curl -X GET http://localhost:3000/api/jasder/jasder_test/edit.json
-
await octokit.request('GET /api/jasder/jasder_test/edit.json')
+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/edit.json
+GET /api/:owner/:repo/detail
请求参数:
@@ -1634,6 +1640,379 @@ http://localhost:3000/api/projects/migrate.json
+content
+string
+仓库简介
+
+
+website
+string
+仓库网址
+
+
+readme
+string
+readme文件|
+
+
+identifier
+string
+项目标识
+
+
+name
+string
+项目名称
+
+
+issues_count
+int
+项目issue数量
+
+
+pull_requests_count
+int
+项目issue数量
+
+
+project_identifier
+int
+项目issue数量
+
+
+praises_count
+int
+项目issue数量
+
+
+forked_count
+int
+项目issue数量
+
+
+watchers_count
+int
+项目issue数量
+
+
+versions_count
+int
+项目里程碑数量
+
+
+version_releases_count
+int
+项目发行版数量
+
+
+version_releasesed_count
+int
+项目发行版已发行数量
+
+
+permission
+string
+项目权限
+
+
+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
+fork项目id
+
+
+fork_info
+object
+fork项目信息
+
+
+size
+string
+仓库大小
+
+
+ssh_url
+string
+项目ssh地址
+
+
+clone_url
+string
+项目克隆地址
+
+
+default_branch
+string
+仓库默认分支
+
+
+empty
+bool
+仓库是否为空
+
+
+full_name
+string
+仓库全称
+
+
+private
+bool
+仓库是否为私有项目
+
+
+license_name
+string
+许可证名称
+
+
+release_versions.list.name
+string
+项目issue数量
+
+
+release_versions.list.tag_name
+string
+发行版标签名称
+
+
+release_versions.list.created_at
+string
+发行版创建时间
+
+
+release_versions.total_count
+int
+发行版数量
+
+
+branches.list.name
+string
+分支名称
+
+
+branches.total_count
+int
+分支数量
+
+
+tags.list.name
+string
+标签名称
+
+
+tags.total_count
+int
+标签数量
+
+
+contributors.list.contributions
+int
+贡献数量
+
+
+contributors.list.login
+string
+贡献者登录名
+
+
+contributors.list.name
+string
+贡献者用户名称
+
+
+contributors.list.image_url
+string
+贡献者头像
+
+
+languages
+object
+项目语言占比
+
+
+
+
+返回的JSON示例:
+
+{
+ "content": "仓库简介",
+ "website": "仓库网址",
+ "readme": {
+ "type": "file",
+ "encoding": "base64",
+ "size": 9,
+ "name": "README.md",
+ "path": "README.md",
+ "content": "# ceshi\n\n",
+ "sha": ""
+ },
+ "identifier": "ceshi",
+ "name": "测试项目",
+ "project_id": 2,
+ "repo_id": 2,
+ "issues_count": 0,
+ "pull_requests_count": 0,
+ "project_identifier": "ceshi",
+ "praises_count": 0,
+ "forked_count": 0,
+ "watchers_count": 0,
+ "versions_count": 0,
+ "version_releases_count": 0,
+ "version_releasesed_count": 0,
+ "permission": "Reporter",
+ "mirror_url": null,
+ "mirror": false,
+ "type": 0,
+ "open_devops": false,
+ "watched": false,
+ "praised": false,
+ "status": 1,
+ "forked_from_project_id": 1,
+ "fork_info": {
+ "fork_form_name": "测试项目",
+ "fork_project_user_login": "ceshi_org",
+ "fork_project_identifier": "ceshi",
+ "fork_project_user_name": "ceshi_org"
+ },
+ "size": "25.0 KB",
+ "ssh_url": "virus@localhost:yystopf/ceshi.git",
+ "clone_url": "http://localhost:10080/yystopf/ceshi.git",
+ "default_branch": "master",
+ "empty": false,
+ "full_name": "yystopf/ceshi",
+ "private": false,
+ "license_name": "gnu-javamail-exception",
+ "release_versions": {
+ "list": [
+ {
+ "id": 2,
+ "name": "vvvv",
+ "tag_name": "v1.1",
+ "created_at": "2019-07-18 10:16"
+ }
+ ],
+ "total_count": 1
+ },
+ "branches": {
+ "list": [
+ {
+ "name": "master"
+ }
+ ],
+ "total_count": 1
+ },
+ "tags": {
+ "list": [
+ {
+ "name": "v1.1"
+ },
+ {
+ "name": "v1.0"
+ }
+ ],
+ "total_count": 2
+ },
+ "contributors": {
+ "list": [
+ {
+ "contributions": 1,
+ "gid": 2,
+ "login": "yystopf",
+ "type": "User",
+ "name": "yystopf",
+ "image_url": "avatars/User/b"
+ }
+ ],
+ "total_count": 1
+ },
+ "languages": {
+ "HTML": "50.9%",
+ "Ruby": "25.6%",
+ "JavaScript": "21.4%",
+ "CSS": "1.3%",
+ "CoffeeScript": "0.7%",
+ "Shell": "0.1%"
+ }
+}
+
编辑仓库信息
+编辑仓库信息
+
+
+示例:
+
+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
仓库标识
@@ -1702,9 +2081,9 @@ http://localhost:3000/api/projects/migrate.json
-d "private=true" \
http://localhost:3000/api/jasder/jasder_test.json
await octokit.request('PATCH /api/jasder/jasder_test.json')
-
HTTP 请求
+HTTP 请求
PATCH /api/:owner/:repo
-请求参数:
+请求参数:
参数
@@ -1764,7 +2143,7 @@ http://localhost:3000/api/jasder/jasder_test.json
项目是否私有, true:为私有,false: 公开,默认为公开
-返回字段说明:
+返回字段说明:
参数
@@ -1829,9 +2208,9 @@ http://localhost:3000/api/jasder/jasder_test.json
curl -X DELETE http://localhost:3000/api/jasder/jasder_test.json
await octokit.request('DELETE /api/jasder/jasder_test.json')
-
HTTP 请求
+HTTP 请求
PATCH /api/:owner/:repo
-请求参数:
+请求参数:
参数
@@ -1856,7 +2235,7 @@ http://localhost:3000/api/jasder/jasder_test.json
项目标识identifier
-返回字段说明:
+返回字段说明:
参数
@@ -1897,83 +2276,8 @@ http://localhost:3000/api/jasder/jasder_test.json
-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
+POST /api/:owner/:repo/collaborators.json
请求参数:
@@ -2026,6 +2330,81 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
+
+返回的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示例:
@@ -2048,9 +2427,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
-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 请求
+HTTP 请求
PUT /api/:owner/:repo/change_role.json
-请求参数:
+请求参数:
参数
@@ -2089,7 +2468,7 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
取值范围:"Manager", "Developer", "Reporter";分别为项目管理人员(拥有所有操作权限)、项目开发人员(只拥有读写权限)、项目报告人员(只拥有读权限)
-返回字段说明:
+返回字段说明:
参数
@@ -2131,9 +2510,9 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
-d "limit=5" \
http://localhost:3000/api/jasder/jasder_test/collaborators.json
await octokit.request('GET /api/jasder/jasder_test/collaborators.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/collaborators.json
-请求参数:
+请求参数:
参数
@@ -2172,7 +2551,7 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
每页多少条数据,默认15条
-返回字段说明:
+返回字段说明:
参数
@@ -2250,7 +2629,114 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
-获取仓库代码目录
+获取仓库所有文件
+获取仓库所有文件
+
+
+示例:
+
+curl -X GET 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
+
+
+返回字段说明:
+
+
+参数
+类型
+字段说明
+
+
+
+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"
+ }
+]
+
获取仓库代码目录
获取仓库代码目录
@@ -2260,9 +2746,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
-d "ref=develop" \
http://localhost:3000//api/jasder/jasder_test/entries.json
await octokit.request('GET /api/jasder/jasder_test/entries.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/entries.json
-请求参数:
+请求参数:
参数
@@ -2294,7 +2780,7 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
分支名称、tag名称或是提交记录id,默认为master分支
-返回字段说明:
+返回字段说明:
参数
@@ -2408,9 +2894,9 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
-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 请求
+HTTP 请求
GET /api/:owner/:repo/sub_entries.json
-请求参数:
+请求参数:
参数
@@ -2449,7 +2935,7 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
分支名称、tag名称或是提交记录id,默认为master分支
-返回字段说明:
+返回字段说明:
参数