add swagger docs for 'tasks'

This commit is contained in:
hantmac
2020-05-03 19:50:35 +08:00
parent fee7eff911
commit a14e166320
4 changed files with 1533 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2020-05-01 23:10:59.173446 +0800 CST m=+0.074737526
// 2020-05-03 19:45:55.093832 +0800 CST m=+0.085718059
package docs
@@ -2172,6 +2172,505 @@ var doc = `{
}
}
},
"/task/{id}": {
"delete": {
"description": "Delete task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Delete task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks": {
"get": {
"description": "Get task list",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task list",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "req data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/routes.TaskListRequestData"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"put": {
"description": "Put task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Put task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"delete": {
"description": "Delete tasks",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Delete tasks",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}": {
"get": {
"description": "Get task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/cancel": {
"post": {
"description": "Cancel task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Cancel task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/error-log": {
"delete": {
"description": "Get task error log",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task error log",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/log": {
"delete": {
"description": "Get task log",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task log",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/restart": {
"post": {
"description": "Restart task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Restart task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/results": {
"get": {
"description": "Get task list",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task list",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "req data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/routes.TaskResultsRequestData"
}
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/results/download": {
"get": {
"description": "Get task results",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task results",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks_by_status": {
"delete": {
"description": "Delete task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Delete task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task status",
"name": "status",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/version": {
"get": {
"description": "Get version",
@@ -2764,6 +3263,40 @@ var doc = `{
"type": "string"
}
}
},
"routes.TaskListRequestData": {
"type": "object",
"properties": {
"nodeId": {
"type": "string"
},
"pageNum": {
"type": "integer"
},
"pageSize": {
"type": "integer"
},
"scheduleId": {
"type": "string"
},
"spiderId": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"routes.TaskResultsRequestData": {
"type": "object",
"properties": {
"pageNum": {
"type": "integer"
},
"pageSize": {
"type": "integer"
}
}
}
}
}`

View File

@@ -2151,6 +2151,505 @@
}
}
},
"/task/{id}": {
"delete": {
"description": "Delete task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Delete task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks": {
"get": {
"description": "Get task list",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task list",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "req data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/routes.TaskListRequestData"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"put": {
"description": "Put task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Put task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"delete": {
"description": "Delete tasks",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Delete tasks",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}": {
"get": {
"description": "Get task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/cancel": {
"post": {
"description": "Cancel task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Cancel task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/error-log": {
"delete": {
"description": "Get task error log",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task error log",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/log": {
"delete": {
"description": "Get task log",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task log",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/restart": {
"post": {
"description": "Restart task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Restart task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/results": {
"get": {
"description": "Get task list",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task list",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "req data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/routes.TaskResultsRequestData"
}
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks/{id}/results/download": {
"get": {
"description": "Get task results",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get task results",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/tasks_by_status": {
"delete": {
"description": "Delete task",
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Delete task",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "task status",
"name": "status",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/version": {
"get": {
"description": "Get version",
@@ -2743,6 +3242,40 @@
"type": "string"
}
}
},
"routes.TaskListRequestData": {
"type": "object",
"properties": {
"nodeId": {
"type": "string"
},
"pageNum": {
"type": "integer"
},
"pageSize": {
"type": "integer"
},
"scheduleId": {
"type": "string"
},
"spiderId": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"routes.TaskResultsRequestData": {
"type": "object",
"properties": {
"pageNum": {
"type": "integer"
},
"pageSize": {
"type": "integer"
}
}
}
}
}

View File

@@ -381,6 +381,28 @@ definitions:
path:
type: string
type: object
routes.TaskListRequestData:
properties:
nodeId:
type: string
pageNum:
type: integer
pageSize:
type: integer
scheduleId:
type: string
spiderId:
type: string
status:
type: string
type: object
routes.TaskResultsRequestData:
properties:
pageNum:
type: integer
pageSize:
type: integer
type: object
info:
contact: {}
license: {}
@@ -1822,6 +1844,339 @@ paths:
summary: Upload spider by id
tags:
- spider
/task/{id}:
delete:
description: Delete task
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Delete task
tags:
- task
/tasks:
delete:
description: Delete tasks
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Delete tasks
tags:
- task
get:
description: Get task list
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: req data
in: body
name: data
required: true
schema:
$ref: '#/definitions/routes.TaskListRequestData'
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Get task list
tags:
- task
put:
description: Put task
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Put task
tags:
- task
/tasks/{id}:
get:
description: Get task
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Get task
tags:
- task
/tasks/{id}/cancel:
post:
description: Cancel task
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Cancel task
tags:
- task
/tasks/{id}/error-log:
delete:
description: Get task error log
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Get task error log
tags:
- task
/tasks/{id}/log:
delete:
description: Get task log
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Get task log
tags:
- task
/tasks/{id}/restart:
post:
description: Restart task
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Restart task
tags:
- task
/tasks/{id}/results:
get:
description: Get task list
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: req data
in: body
name: data
required: true
schema:
$ref: '#/definitions/routes.TaskResultsRequestData'
type: object
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Get task list
tags:
- task
/tasks/{id}/results/download:
get:
description: Get task results
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Get task results
tags:
- task
/tasks_by_status:
delete:
description: Delete task
parameters:
- description: Authorization token
in: header
name: Authorization
required: true
type: string
- description: task status
in: query
name: status
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: json
"400":
description: Bad Request
schema:
type: json
summary: Delete task
tags:
- task
/version:
get:
description: Get version