// 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 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": {}, "license": {}, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/nodes": { "get": { "description": "Get nodes", "produces": [ "application/json" ], "tags": [ "node" ], "summary": "Get nodes", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/nodes/{id}": { "get": { "description": "Get node", "produces": [ "application/json" ], "tags": [ "node" ], "summary": "Get node", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "post": { "description": "Post node", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "node" ], "summary": "Post node", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "post node", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } }, "delete": { "description": "Delete node", "produces": [ "application/json" ], "tags": [ "node" ], "summary": "Delete node", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "node id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/nodes/{id}/system": { "get": { "description": "Get system info", "produces": [ "application/json" ], "tags": [ "node" ], "summary": "Get system info", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "node id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/nodes/{id}/tasks": { "get": { "description": "Get tasks on node", "produces": [ "application/json" ], "tags": [ "node" ], "summary": "Get tasks on node", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "node id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/projects": { "get": { "description": "Get projects", "produces": [ "application/json" ], "tags": [ "project" ], "summary": "Get projects", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "projects", "name": "tag", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "put": { "description": "Put project", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "summary": "Put project", "parameters": [ { "type": "string", "description": "With the bearer started", "name": "Authorization", "in": "header", "required": true }, { "description": "post project", "name": "p", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/model.Project" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/projects/tags": { "get": { "description": "Get projects tags", "produces": [ "application/json" ], "tags": [ "project" ], "summary": "Get project tags", "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" } } } } }, "/projects/{id}": { "post": { "description": "Post project", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "summary": "Post project", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "project id", "name": "id", "in": "path", "required": true }, { "description": "project item", "name": "item", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/model.Project" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } }, "delete": { "description": "Delete project", "produces": [ "application/json" ], "tags": [ "project" ], "summary": "Delete project", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "project id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/schedules": { "get": { "description": "Get schedule list", "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "Get schedule list", "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" } } } }, "put": { "description": "Put schedule", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "Put schedule", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "description": "schedule item", "name": "item", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/model.Schedule" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/schedules/{id}": { "get": { "description": "Get schedule by id", "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "Get schedule by id", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "post": { "description": "Post schedule", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "Post schedule", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true }, { "description": "schedule item", "name": "newItem", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/model.Schedule" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } }, "delete": { "description": "Delete schedule", "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "Delete schedule", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/schedules/{id}/disable": { "post": { "description": "disable schedule", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "disable schedule", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/schedules/{id}/enable": { "post": { "description": "enable schedule", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "schedule" ], "summary": "enable schedule", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/setting": { "get": { "description": "Get setting", "produces": [ "application/json" ], "tags": [ "setting" ], "summary": "Get setting", "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" } } } } }, "/spiders": { "put": { "description": "Put spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Put spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "description": "spider item", "name": "spider", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/model.Spider" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } }, "post": { "description": "delete spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "delete spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/spiders-cancel": { "post": { "description": "cancel spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "cancel spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/spiders-run": { "post": { "description": "run spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "run spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/spiders/{id}": { "get": { "description": "Get spider by id", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get spider by id", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "post": { "description": "Post spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Post spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true }, { "description": "spider item", "name": "item", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/model.Spider" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } }, "delete": { "description": "Delete spider by id", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Delete spider by id", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/copy": { "post": { "description": "Copy spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Copy spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/spiders/{id}/dir": { "get": { "description": "Get spider dir", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get spider dir", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "path", "name": "path", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/file": { "get": { "description": "Get spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "path", "name": "path", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "put": { "description": "Post spider dir", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Post spider dir", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "description": "path", "name": "reqBody", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/routes.SpiderFileReqBody" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "post": { "description": "Put spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Put spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "description": "path", "name": "reqBody", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/routes.SpiderFileReqBody" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "delete": { "description": "Delete spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Delete spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "description": "path", "name": "reqBody", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/routes.SpiderFileReqBody" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/file/rename": { "post": { "description": "Rename spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Rename spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "description": "path", "name": "reqBody", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/routes.SpiderFileReqBody" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/file/tree": { "get": { "description": "Get spider dir", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get spider dir", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/git/reset": { "post": { "description": "Post spider reset git", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Post spider reset git", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/git/sync": { "post": { "description": "Post spider sync git", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Post spider sync git", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/publish": { "post": { "description": "Publish spider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Publish spider", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "schedule id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/spiders/{id}/schedules": { "get": { "description": "Get schedules", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get schedules", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/scrapy/items": { "get": { "description": "Get scrapy spider items", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get scrapy spider items", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "post": { "description": "Post scrapy spider items", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Post scrapy spider items", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "description": "req data", "name": "reqData", "in": "body", "required": true, "schema": { "type": "entity.ScrapyItem", "items": { "$ref": "#/definitions/entity.ScrapyItem" } } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/scrapy/pipelines": { "get": { "description": "Get scrapy spider pipelines", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get scrapy spider pipelines", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/scrapy/settings": { "get": { "description": "Get scrapy spider settings", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get scrapy spider settings", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "post": { "description": "Get scrapy spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get scrapy spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true }, { "description": "req data", "name": "reqData", "in": "body", "required": true, "schema": { "type": "entity.ScrapySettingParam", "items": { "$ref": "#/definitions/entity.ScrapySettingParam" } } } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/scrapy/spider/filepath": { "get": { "description": "Get scrapy spider file path", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get scrapy spider file path", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/scrapy/spiders": { "get": { "description": "Get scrapy spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get scrapy spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } }, "put": { "description": "Put scrapy spider file", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Put scrapy spider file", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/stats": { "get": { "description": "Get spider stats", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get spider stats", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/tasks": { "get": { "description": "Get task list", "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Get task list", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "400": { "description": "Bad Request", "schema": { "type": "json" } } } } }, "/spiders/{id}/upload": { "post": { "description": "Upload spider by id", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "spider" ], "summary": "Upload spider by id", "parameters": [ { "type": "string", "description": "Authorization token", "name": "Authorization", "in": "header", "required": true }, { "type": "file", "description": "spider file to upload", "name": "file", "in": "formData", "required": true }, { "type": "string", "description": "spider id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "json" } }, "500": { "description": "Internal Server Error", "schema": { "type": "json" } } } } }, "/version": { "get": { "description": "Get version", "produces": [ "application/json" ], "tags": [ "setting" ], "summary": "Get version", "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" } } } } } }, "definitions": { "entity.ConfigSpiderData": { "type": "object", "properties": { "cmd": { "description": "自定义爬虫", "type": "string" }, "col": { "type": "string" }, "display_name": { "type": "string" }, "engine": { "description": "可配置爬虫", "type": "string" }, "name": { "description": "通用", "type": "string" }, "remark": { "type": "string" }, "settings": { "type": "object" }, "stages": { "type": "array", "items": { "$ref": "#/definitions/entity.Stage" } }, "start_stage": { "type": "string" }, "start_url": { "type": "string" }, "type": { "type": "string" } } }, "entity.Field": { "type": "object", "properties": { "attr": { "type": "string" }, "css": { "type": "string" }, "name": { "type": "string" }, "next_stage": { "type": "string" }, "remark": { "type": "string" }, "xpath": { "type": "string" } } }, "entity.ScrapyItem": { "type": "object", "properties": { "fields": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" } } }, "entity.ScrapySettingParam": { "type": "object", "properties": { "key": { "type": "string" }, "type": { "type": "string" }, "value": { "type": "object" } } }, "entity.Stage": { "type": "object", "properties": { "fields": { "type": "array", "items": { "$ref": "#/definitions/entity.Field" } }, "is_list": { "type": "boolean" }, "list_css": { "type": "string" }, "list_xpath": { "type": "string" }, "name": { "type": "string" }, "page_attr": { "type": "string" }, "page_css": { "type": "string" }, "page_xpath": { "type": "string" } } }, "model.Env": { "type": "object", "properties": { "name": { "type": "string" }, "value": { "type": "string" } } }, "model.Node": { "type": "object", "properties": { "_id": { "type": "string" }, "create_ts": { "type": "string" }, "description": { "type": "string" }, "hostname": { "type": "string" }, "ip": { "type": "string" }, "is_master": { "description": "前端展示", "type": "boolean" }, "key": { "description": "用于唯一标识节点,可能是mac地址,可能是ip地址", "type": "string" }, "mac": { "type": "string" }, "name": { "type": "string" }, "port": { "type": "string" }, "status": { "type": "string" }, "update_ts": { "type": "string" }, "update_ts_unix": { "type": "integer" } } }, "model.Project": { "type": "object", "properties": { "_id": { "type": "string" }, "create_ts": { "type": "string" }, "description": { "type": "string" }, "name": { "type": "string" }, "spiders": { "description": "前端展示", "type": "array", "items": { "$ref": "#/definitions/model.Spider" } }, "tags": { "type": "array", "items": { "type": "string" } }, "update_ts": { "type": "string" }, "user_id": { "type": "string" }, "username": { "type": "string" } } }, "model.Schedule": { "type": "object", "properties": { "_id": { "type": "string" }, "create_ts": { "type": "string" }, "cron": { "type": "string" }, "description": { "type": "string" }, "enabled": { "type": "boolean" }, "entry_id": { "type": "integer" }, "message": { "type": "string" }, "name": { "type": "string" }, "node_ids": { "type": "array", "items": { "type": "string" } }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/model.Node" } }, "param": { "type": "string" }, "run_type": { "type": "string" }, "scrapy_log_level": { "type": "string" }, "scrapy_spider": { "type": "string" }, "spider_id": { "type": "string" }, "spider_name": { "description": "前端展示", "type": "string" }, "status": { "type": "string" }, "update_ts": { "type": "string" }, "user_id": { "type": "string" }, "user_name": { "type": "string" } } }, "model.Spider": { "type": "object", "properties": { "_id": { "description": "爬虫ID", "type": "string" }, "cmd": { "description": "自定义爬虫", "type": "string" }, "col": { "description": "结果储存位置", "type": "string" }, "config": { "description": "可配置爬虫配置", "type": "object", "$ref": "#/definitions/entity.ConfigSpiderData" }, "create_ts": { "type": "string" }, "dedup_field": { "description": "去重字段", "type": "string" }, "dedup_method": { "description": "去重方式", "type": "string" }, "display_name": { "description": "爬虫显示名称", "type": "string" }, "envs": { "description": "环境变量", "type": "array", "items": { "$ref": "#/definitions/model.Env" } }, "file_id": { "description": "GridFS文件ID", "type": "string" }, "git_auto_sync": { "description": "Git 是否自动同步", "type": "boolean" }, "git_branch": { "description": "Git 分支", "type": "string" }, "git_has_credential": { "description": "Git 是否加密", "type": "boolean" }, "git_password": { "description": "Git 密码", "type": "string" }, "git_sync_error": { "description": "Git 同步错误", "type": "string" }, "git_sync_frequency": { "description": "Git 同步频率", "type": "string" }, "git_url": { "description": "Git URL", "type": "string" }, "git_username": { "description": "Git 用户名", "type": "string" }, "is_dedup": { "description": "去重", "type": "boolean" }, "is_git": { "description": "Git 设置", "type": "boolean" }, "is_long_task": { "description": "长任务", "type": "boolean" }, "is_public": { "description": "是否公开", "type": "boolean" }, "is_scrapy": { "description": "Scrapy 爬虫(属于自定义爬虫)", "type": "boolean" }, "is_web_hook": { "description": "Web Hook", "type": "boolean" }, "last_run_ts": { "description": "前端展示", "type": "string" }, "last_status": { "description": "最后执行状态", "type": "string" }, "latest_tasks": { "description": "最近任务列表", "type": "array", "items": { "$ref": "#/definitions/model.Task" } }, "name": { "description": "爬虫名称(唯一)", "type": "string" }, "project_id": { "description": "项目ID", "type": "string" }, "remark": { "description": "备注", "type": "string" }, "site": { "description": "爬虫网站", "type": "string" }, "spider_names": { "description": "爬虫名称列表", "type": "array", "items": { "type": "string" } }, "src": { "description": "源码位置", "type": "string" }, "template": { "description": "可配置爬虫", "type": "string" }, "type": { "description": "爬虫类别", "type": "string" }, "update_ts": { "type": "string" }, "user_id": { "description": "时间", "type": "string" }, "username": { "description": "用户名称", "type": "string" }, "web_hook_url": { "description": "Web Hook URL", "type": "string" } } }, "model.Task": { "type": "object", "properties": { "_id": { "type": "string" }, "cmd": { "type": "string" }, "create_ts": { "type": "string" }, "error": { "type": "string" }, "error_log_count": { "type": "integer" }, "finish_ts": { "type": "string" }, "log_path": { "type": "string" }, "node_id": { "type": "string" }, "node_name": { "type": "string" }, "param": { "type": "string" }, "pid": { "type": "integer" }, "result_count": { "type": "integer" }, "run_type": { "type": "string" }, "runtime_duration": { "type": "number" }, "schedule_id": { "type": "string" }, "spider_id": { "type": "string" }, "spider_name": { "description": "前端数据", "type": "string" }, "start_ts": { "type": "string" }, "status": { "type": "string" }, "total_duration": { "type": "number" }, "update_ts": { "type": "string" }, "user_id": { "type": "string" }, "username": { "type": "string" }, "wait_duration": { "type": "number" } } }, "routes.SpiderFileReqBody": { "type": "object", "properties": { "content": { "type": "string" }, "new_path": { "type": "string" }, "path": { "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) }, }).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{}) }