提交 2590a9dc 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

update api docs

上级 0b910c8a
......@@ -5,10 +5,10 @@ import (
)
type ZentaoExecReq struct {
Workspace string `json:"workspace"`
Path string `json:"path"`
Ids string `json:"ids"`
Cmd string `json:"cmd"`
Workspace string `json:"workspace"` // workspace absolute path
Path string `json:"path"` // relative path in workspace to find scripts
Ids string `json:"ids"` // zentao case ids
Cmd string `json:"cmd"` // commands to exec before run test cases
Task int `json:"task"`
}
......
// 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{})
}
{
"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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册