|
|
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
|
|
// This file was generated by swaggo/swag
|
|
|
package docs
|
|
|
|
|
|
import (
|
|
|
"bytes"
|
|
|
"encoding/json"
|
|
|
"strings"
|
|
|
"text/template"
|
|
|
|
|
|
"github.com/swaggo/swag"
|
|
|
)
|
|
|
|
|
|
var doc = `{
|
|
|
"schemes": {{ marshal .Schemes }},
|
|
|
"swagger": "2.0",
|
|
|
"info": {
|
|
|
"description": "{{escape .Description}}",
|
|
|
"title": "{{.Title}}",
|
|
|
"contact": {},
|
|
|
"version": "{{.Version}}"
|
|
|
},
|
|
|
"host": "{{.Host}}",
|
|
|
"basePath": "{{.BasePath}}",
|
|
|
"paths": {
|
|
|
"/api/monkey/v1/create_task": {
|
|
|
"post": {
|
|
|
"description": "新建Monkey任务,创建成功后将会发送指令到monkey服务,初始status为WAITTING-等待中",
|
|
|
"consumes": [
|
|
|
"application/x-www-form-urlencoded"
|
|
|
],
|
|
|
"tags": [
|
|
|
"Monkey相关 /api/monkey/v1/"
|
|
|
],
|
|
|
"summary": "新建Monkey任务",
|
|
|
"parameters": [
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "项目名",
|
|
|
"name": "project",
|
|
|
"in": "formData"
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "测试包下载链接",
|
|
|
"name": "package_url",
|
|
|
"in": "formData"
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "应用包名",
|
|
|
"name": "package_name",
|
|
|
"in": "formData",
|
|
|
"required": true
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "启动activity页",
|
|
|
"name": "launch_activity",
|
|
|
"in": "formData"
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "运行设备数,默认1台",
|
|
|
"name": "device_amount",
|
|
|
"in": "formData"
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "平台adr/ios",
|
|
|
"name": "platform",
|
|
|
"in": "formData",
|
|
|
"required": true
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "运行时间(s),默认两小时(7200s)",
|
|
|
"name": "run_time",
|
|
|
"in": "formData"
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "任务创建者",
|
|
|
"name": "creator",
|
|
|
"in": "formData"
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "调用服务的方式,0-cli模式/1-api模式,默认cli",
|
|
|
"name": "mode",
|
|
|
"in": "formData"
|
|
|
}
|
|
|
],
|
|
|
"responses": {
|
|
|
"200": {
|
|
|
"description": "返回创建的任务id",
|
|
|
"schema": {
|
|
|
"$ref": "#/definitions/models.Response"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
"/api/monkey/v1/task/status": {
|
|
|
"post": {
|
|
|
"description": "更新Monkey任务状态,进行中为RUNNING,已完成为FINIASHED,如有错误为ERROR",
|
|
|
"consumes": [
|
|
|
"application/x-www-form-urlencoded"
|
|
|
],
|
|
|
"tags": [
|
|
|
"Monkey相关 /api/monkey/v1/"
|
|
|
],
|
|
|
"summary": "更新Monkey任务状态",
|
|
|
"parameters": [
|
|
|
{
|
|
|
"type": "integer",
|
|
|
"description": "项目名",
|
|
|
"name": "task_id",
|
|
|
"in": "formData",
|
|
|
"required": true
|
|
|
},
|
|
|
{
|
|
|
"type": "string",
|
|
|
"description": "要更新的任务状态",
|
|
|
"name": "status",
|
|
|
"in": "formData"
|
|
|
}
|
|
|
],
|
|
|
"responses": {
|
|
|
"200": {
|
|
|
"description": "返回更新后的任务信息",
|
|
|
"schema": {
|
|
|
"$ref": "#/definitions/models.Response"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
"/api/monkey/v1/tasks": {
|
|
|
"get": {
|
|
|
"description": "获取任务列表",
|
|
|
"consumes": [
|
|
|
"application/x-www-form-urlencoded"
|
|
|
],
|
|
|
"tags": [
|
|
|
"Monkey相关 /api/monkey/v1/"
|
|
|
],
|
|
|
"summary": "获取任务列表",
|
|
|
"parameters": [
|
|
|
{
|
|
|
"type": "integer",
|
|
|
"description": "每页大小,默认为10",
|
|
|
"name": "page_size",
|
|
|
"in": "query"
|
|
|
},
|
|
|
{
|
|
|
"type": "integer",
|
|
|
"description": "第几页,默认为第一页",
|
|
|
"name": "page_index",
|
|
|
"in": "query"
|
|
|
}
|
|
|
],
|
|
|
"responses": {
|
|
|
"200": {
|
|
|
"description": "返回更新后的任务信息",
|
|
|
"schema": {
|
|
|
"$ref": "#/definitions/models.Response"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
"definitions": {
|
|
|
"models.Response": {
|
|
|
"type": "object",
|
|
|
"properties": {
|
|
|
"code": {
|
|
|
"type": "integer"
|
|
|
},
|
|
|
"data": {},
|
|
|
"msg": {
|
|
|
"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: "",
|
|
|
Host: "",
|
|
|
BasePath: "",
|
|
|
Schemes: []string{},
|
|
|
Title: "",
|
|
|
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)
|
|
|
},
|
|
|
"escape": func(v interface{}) string {
|
|
|
// escape tabs
|
|
|
str := strings.Replace(v.(string), "\t", "\\t", -1)
|
|
|
// replace " with \", and if that results in \\", replace that with \\\"
|
|
|
str = strings.Replace(str, "\"", "\\\"", -1)
|
|
|
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
|
|
|
},
|
|
|
}).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("swagger", &s{})
|
|
|
}
|