新增: webhooks文档使用新api地址
This commit is contained in:
parent
7cad953413
commit
211581cef0
|
@ -1115,15 +1115,15 @@ await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
|
|||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks.json
|
||||
http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/webhooks.json')
|
||||
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/webhooks.json`
|
||||
`GET /api/v1/:owner/:repo/webhooks.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
|
@ -1200,15 +1200,15 @@ await octokit.request('GET /api/yystopf/ceshi/webhooks.json')
|
|||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
|
||||
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
|
||||
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/webhooks/:id/edit.json`
|
||||
`GET /api/v1/:owner/:repo/webhooks/:id.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
|
@ -1226,12 +1226,10 @@ await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
|
|||
|content_type |string|POST Content Type|
|
||||
|http_method |string|请求方式|
|
||||
|secret| |string|密钥|
|
||||
|is_active |bool |是否激活|
|
||||
|type |string|类型|
|
||||
|last_status |string|最后一次推送的状态, waiting 等待,fail 失败,succeed 成功|
|
||||
|active |bool |是否激活|
|
||||
|branch_filter |string|分支过滤|
|
||||
|events |string|触发条件|
|
||||
|create_time |string|创建时间|
|
||||
|create_at |string|创建时间|
|
||||
|
||||
|
||||
参数| 含义|
|
||||
|
@ -1266,11 +1264,8 @@ await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
|
|||
"http_method": "GET",
|
||||
"content_type": "form",
|
||||
"url": "http://localhost:3000",
|
||||
"secret": "123456",
|
||||
"last_status": "succeed",
|
||||
"is_active": true,
|
||||
"type": "gitea",
|
||||
"create_time": "2021-07-26 10:03:45",
|
||||
"active": true,
|
||||
"create_at": "2021-07-26 10:03",
|
||||
"branch_filter": "*",
|
||||
"events": [
|
||||
"create",
|
||||
|
@ -1305,15 +1300,15 @@ await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
|
|||
|
||||
```shell
|
||||
curl -X POST \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks.json
|
||||
http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
|
||||
await octokit.request('POST /api/v1/yystopf/ceshi/webhooks.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/:owner/:repo/webhooks.json`
|
||||
`POST /api/v1/:owner/:repo/webhooks.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
|
@ -1321,7 +1316,6 @@ await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
|
|||
|owner |是| | string |用户登录名 |
|
||||
|repo |是| | string |项目标识identifier |
|
||||
|webhook.url |是| | string |目标url |
|
||||
|webhook.type |否| | string |类型|
|
||||
|webhook.http_method |是| | string | http方法, POST和GET |
|
||||
|webhook.content_type |是| | string | POST Content Type |
|
||||
|webhook.secret |否| | string |密钥文本|
|
||||
|
@ -1335,24 +1329,24 @@ await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
|
|||
--------- | ------- | ------- |
|
||||
|create|创建分支或标签|
|
||||
|delete|分支或标签删除|
|
||||
|fork|仓库被fork|
|
||||
<!-- |fork|仓库被fork| -->
|
||||
|push|git仓库推送|
|
||||
|issue|疑修已打开、已关闭、已重新打开或编辑|
|
||||
<!-- |issue|疑修已打开、已关闭、已重新打开或编辑|
|
||||
|issue_assign|疑修被指派|
|
||||
|issue_label|疑修标签被更新或删除|
|
||||
|issue_milestone|疑修被收入里程碑|
|
||||
|issue_comment|疑修评论|
|
||||
|issue_comment|疑修评论| -->
|
||||
|pull_request|合并请求|
|
||||
|pull_request_assign|合并请求被指派|
|
||||
|pull_request_label|合并请求被贴上标签|
|
||||
<!-- |pull_request_label|合并请求被贴上标签|
|
||||
|pull_request_milestone|合并请求被记录于里程碑中|
|
||||
|pull_request_comment|合并请求被评论|
|
||||
|pull_request_comment|合并请求被评论| -->
|
||||
|pull_request_review_approved|合并请求被批准|
|
||||
|pull_request_review_rejected|合并请求被拒绝|
|
||||
|pull_request_review_comment|合并请求被提出审查意见|
|
||||
<!-- |pull_request_review_comment|合并请求被提出审查意见|
|
||||
|pull_request_sync|合并请求被同步|
|
||||
|repository|创建或删除仓库|
|
||||
|release|版本发布|
|
||||
|release|版本发布| -->
|
||||
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
@ -1385,15 +1379,22 @@ await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
|
|||
|
||||
```json
|
||||
{
|
||||
"id": 18,
|
||||
"type": "gitea",
|
||||
"id": 68,
|
||||
"content_type": "json",
|
||||
"url": "http://localhost:10000",
|
||||
"http_method": "GET",
|
||||
"url": "http://127.0.0.1:3000",
|
||||
"events": [
|
||||
"push"
|
||||
"create",
|
||||
"delete",
|
||||
"push",
|
||||
"pull_request",
|
||||
"pull_request_assign",
|
||||
"pull_request_review_approved",
|
||||
"pull_request_review_rejected"
|
||||
],
|
||||
"active": true,
|
||||
"create_time": "2021-07-26 18:53:43"
|
||||
"branch_filter": "*",
|
||||
"created_at": "2022-06-23 15:52"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
|
@ -1407,15 +1408,15 @@ await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
|
|||
|
||||
```shell
|
||||
curl -X PATCH \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
|
||||
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
|
||||
await octokit.request('PATCH /api/v1/yystopf/ceshi/webhooks/7.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`PATCH /api/:owner/:repo/webhooks/:id.json`
|
||||
`PATCH /api/v1/:owner/:repo/webhooks/68.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
|
@ -1424,7 +1425,6 @@ await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
|
|||
|repo |是| | string |项目标识identifier |
|
||||
|id |是| | string |webhook id |
|
||||
|webhook.url |是| | string |目标url |
|
||||
|webhook.type |否| | string |类型|
|
||||
|webhook.http_method |是| | string | http方法, POST和GET |
|
||||
|webhook.content_type |是| | string | POST Content Type |
|
||||
|webhook.secret |否| | string |密钥文本|
|
||||
|
@ -1438,24 +1438,24 @@ await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
|
|||
--------- | ------- | ------- |
|
||||
|create|创建分支或标签|
|
||||
|delete|分支或标签删除|
|
||||
|fork|仓库被fork|
|
||||
<!-- |fork|仓库被fork| -->
|
||||
|push|git仓库推送|
|
||||
|issue|疑修已打开、已关闭、已重新打开或编辑|
|
||||
<!-- |issue|疑修已打开、已关闭、已重新打开或编辑|
|
||||
|issue_assign|疑修被指派|
|
||||
|issue_label|疑修标签被更新或删除|
|
||||
|issue_milestone|疑修被收入里程碑|
|
||||
|issue_comment|疑修评论|
|
||||
|issue_comment|疑修评论| -->
|
||||
|pull_request|合并请求|
|
||||
|pull_request_assign|合并请求被指派|
|
||||
|pull_request_label|合并请求被贴上标签|
|
||||
<!-- |pull_request_label|合并请求被贴上标签|
|
||||
|pull_request_milestone|合并请求被记录于里程碑中|
|
||||
|pull_request_comment|合并请求被评论|
|
||||
|pull_request_comment|合并请求被评论| -->
|
||||
|pull_request_review_approved|合并请求被批准|
|
||||
|pull_request_review_rejected|合并请求被拒绝|
|
||||
|pull_request_review_comment|合并请求被提出审查意见|
|
||||
<!-- |pull_request_review_comment|合并请求被提出审查意见|
|
||||
|pull_request_sync|合并请求被同步|
|
||||
|repository|创建或删除仓库|
|
||||
|release|版本发布|
|
||||
|release|版本发布| -->
|
||||
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
@ -1478,8 +1478,22 @@ await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
|
|||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
"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"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
|
@ -1494,15 +1508,15 @@ await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
|
|||
|
||||
```shell
|
||||
curl -X DELETE \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
|
||||
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('DELETE /api/yystopf/ceshi/webhooks/7.json')
|
||||
await octokit.request('DELETE /api/v1/yystopf/ceshi/webhooks/7.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`DELETE /api/:owner/:repo/webhooks/:id.json`
|
||||
`DELETE /api/v1/:owner/:repo/webhooks/:id.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
|
|
|
@ -18,8 +18,8 @@ class Api::V1::Projects::Webhooks::DeleteService < ApplicationService
|
|||
$gitea_client.token = nil unless token.blank?
|
||||
|
||||
gitea_data
|
||||
# rescue
|
||||
# raise Error, "服务器错误,请联系系统管理员!"
|
||||
rescue
|
||||
raise Error, "服务器错误,请联系系统管理员!"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -23,13 +23,13 @@ class Api::V1::Users::Projects::ListService < ApplicationService
|
|||
|
||||
def call
|
||||
raise Error, errors.full_messages.join(", ") unless valid?
|
||||
# begin
|
||||
begin
|
||||
project_query_data
|
||||
|
||||
queried_projects
|
||||
# rescue
|
||||
# raise Error, "服务器错误,请联系系统管理员!"
|
||||
# end
|
||||
rescue
|
||||
raise Error, "服务器错误,请联系系统管理员!"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue