Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
ab1a9b42
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
11 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ab1a9b42
编写于
12月 06, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update api docs
上级
184e7813
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
311 addition
and
0 deletion
+311
-0
internal/server/modules/v1/controller/job.go
internal/server/modules/v1/controller/job.go
+6
-0
xdoc/docs/docs.go
xdoc/docs/docs.go
+183
-0
xdoc/docs/swagger.json
xdoc/docs/swagger.json
+118
-0
xdoc/notes.txt
xdoc/notes.txt
+4
-0
未找到文件。
internal/server/modules/v1/controller/job.go
浏览文件 @
ab1a9b42
...
...
@@ -16,6 +16,12 @@ func NewJobCtrl() *JobCtrl {
return
&
JobCtrl
{}
}
// @summary 列出执行任务
// @Accept json
// @Produce json
// @Param status query string true "Status List to Filter like 'created,inprogress'"
// @Success 200 {object} domain.Response "code = success | fail"
// @Router /api/v1/jobs/add [post]
func
(
c
*
JobCtrl
)
List
(
ctx
iris
.
Context
)
{
status
:=
ctx
.
URLParam
(
"status"
)
...
...
xdoc/docs/docs.go
0 → 100644
浏览文件 @
ab1a9b42
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package
docs
import
(
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var
doc
=
`{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {
"name": "API Support",
"url": "https://github.com/easysoft/zentaoatf/issues",
"email": "462626@qq.com"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/jobs/add": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "添加脚本执行任务",
"parameters": [
{
"description": "Zentao Job Add Request Object",
"name": "ZentaoExecReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/serverDomain.ZentaoExecReq"
}
}
],
"responses": {
"200": {
"description": "code = success | fail",
"schema": {
"$ref": "#/definitions/domain.Response"
}
}
}
}
},
"/api/v1/jobs/cancel": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "取消脚本执行任务",
"parameters": [
{
"description": "Zentao Job Cancel Request Object",
"name": "ZentaoExecReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/serverDomain.ZentaoCancelReq"
}
}
],
"responses": {
"200": {
"description": "code = success | fail",
"schema": {
"$ref": "#/definitions/domain.Response"
}
}
}
}
}
},
"definitions": {
"domain.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "object"
},
"msg": {
"type": "string"
}
}
},
"serverDomain.ZentaoCancelReq": {
"type": "object",
"properties": {
"task": {
"type": "integer"
}
}
},
"serverDomain.ZentaoExecReq": {
"type": "object",
"properties": {
"cmd": {
"type": "string"
},
"ids": {
"type": "string"
},
"path": {
"type": "string"
},
"task": {
"type": "integer"
},
"workspace": {
"type": "string"
}
}
}
}
}`
type
swaggerInfo
struct
{
Version
string
Host
string
BasePath
string
Schemes
[]
string
Title
string
Description
string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var
SwaggerInfo
=
swaggerInfo
{
Version
:
"1.0"
,
Host
:
""
,
BasePath
:
""
,
Schemes
:
[]
string
{},
Title
:
"ZTF服务端API文档"
,
Description
:
""
,
}
type
s
struct
{}
func
(
s
*
s
)
ReadDoc
()
string
{
sInfo
:=
SwaggerInfo
sInfo
.
Description
=
strings
.
Replace
(
sInfo
.
Description
,
"
\n
"
,
"
\\
n"
,
-
1
)
t
,
err
:=
template
.
New
(
"swagger_info"
)
.
Funcs
(
template
.
FuncMap
{
"marshal"
:
func
(
v
interface
{})
string
{
a
,
_
:=
json
.
Marshal
(
v
)
return
string
(
a
)
},
})
.
Parse
(
doc
)
if
err
!=
nil
{
return
doc
}
var
tpl
bytes
.
Buffer
if
err
:=
t
.
Execute
(
&
tpl
,
sInfo
);
err
!=
nil
{
return
doc
}
return
tpl
.
String
()
}
func
init
()
{
swag
.
Register
(
swag
.
Name
,
&
s
{})
}
xdoc/docs/swagger.json
0 → 100644
浏览文件 @
ab1a9b42
{
"swagger"
:
"2.0"
,
"info"
:
{
"title"
:
"ZTF服务端API文档"
,
"contact"
:
{
"name"
:
"API Support"
,
"url"
:
"https://github.com/easysoft/zentaoatf/issues"
,
"email"
:
"462626@qq.com"
},
"version"
:
"1.0"
},
"paths"
:
{
"/api/v1/jobs/add"
:
{
"post"
:
{
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"summary"
:
"添加脚本执行任务"
,
"parameters"
:
[
{
"description"
:
"Zentao Job Add Request Object"
,
"name"
:
"ZentaoExecReq"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"$ref"
:
"#/definitions/serverDomain.ZentaoExecReq"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"code = success | fail"
,
"schema"
:
{
"$ref"
:
"#/definitions/domain.Response"
}
}
}
}
},
"/api/v1/jobs/cancel"
:
{
"post"
:
{
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"summary"
:
"取消脚本执行任务"
,
"parameters"
:
[
{
"description"
:
"Zentao Job Cancel Request Object"
,
"name"
:
"ZentaoExecReq"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"$ref"
:
"#/definitions/serverDomain.ZentaoCancelReq"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"code = success | fail"
,
"schema"
:
{
"$ref"
:
"#/definitions/domain.Response"
}
}
}
}
}
},
"definitions"
:
{
"domain.Response"
:
{
"type"
:
"object"
,
"properties"
:
{
"code"
:
{
"type"
:
"integer"
},
"data"
:
{
"type"
:
"object"
},
"msg"
:
{
"type"
:
"string"
}
}
},
"serverDomain.ZentaoCancelReq"
:
{
"type"
:
"object"
,
"properties"
:
{
"task"
:
{
"type"
:
"integer"
}
}
},
"serverDomain.ZentaoExecReq"
:
{
"type"
:
"object"
,
"properties"
:
{
"cmd"
:
{
"type"
:
"string"
},
"ids"
:
{
"type"
:
"string"
},
"path"
:
{
"type"
:
"string"
},
"task"
:
{
"type"
:
"integer"
},
"workspace"
:
{
"type"
:
"string"
}
}
}
}
}
\ No newline at end of file
xdoc/notes.txt
浏览文件 @
ab1a9b42
...
...
@@ -67,3 +67,7 @@ sonar-scanner
# 本地安装swaggo,生成并上传。 https://github.com/swaggo/swag
rm -rf xdoc/docs && swag init --parseDependency --parseInternal --parseDepth 5 -d cmd/server -o xdoc/docs
# 服务器上启动go-swagger服务。 https://github.com/go-swagger/go-swagger
ps -ef | grep swagger | grep -v grep | awk '{print $2}' | xargs kill -9
nohup swagger serve --no-open -p 50004 https://gitee.com/aaronchen2k/zagent/raw/main/xdoc/docs/swagger.json > ztf.log 2>&1 &
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录