Add swagger docs

This commit is contained in:
hantmac
2020-05-01 23:11:51 +08:00
parent 09ea0bb56a
commit f59ca2b605
11 changed files with 7977 additions and 0 deletions

View File

@@ -8,6 +8,14 @@ import (
"net/http"
)
// @Summary Get nodes
// @Description Get nodes
// @Tags node
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /nodes [get]
func GetNodeList(c *gin.Context) {
nodes, err := model.GetNodeList(nil)
if err != nil {
@@ -26,6 +34,15 @@ func GetNodeList(c *gin.Context) {
})
}
// @Summary Get node
// @Description Get node
// @Tags node
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param id path string true "id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /nodes/{id} [get]
func GetNode(c *gin.Context) {
id := c.Param("id")
@@ -54,6 +71,17 @@ func Ping(c *gin.Context) {
})
}
// @Summary Post node
// @Description Post node
// @Tags node
// @Accept json
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param id path string true "post node"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /nodes/{id} [post]
func PostNode(c *gin.Context) {
id := c.Param("id")
@@ -81,6 +109,15 @@ func PostNode(c *gin.Context) {
})
}
// @Summary Get tasks on node
// @Description Get tasks on node
// @Tags node
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param id path string true "node id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /nodes/{id}/tasks [get]
func GetNodeTaskList(c *gin.Context) {
id := c.Param("id")
@@ -97,6 +134,15 @@ func GetNodeTaskList(c *gin.Context) {
})
}
// @Summary Get system info
// @Description Get system info
// @Tags node
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param id path string true "node id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /nodes/{id}/system [get]
func GetSystemInfo(c *gin.Context) {
id := c.Param("id")
@@ -109,6 +155,15 @@ func GetSystemInfo(c *gin.Context) {
})
}
// @Summary Delete node
// @Description Delete node
// @Tags node
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param id path string true "node id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /nodes/{id} [delete]
func DeleteNode(c *gin.Context) {
id := c.Param("id")
node, err := model.GetNode(bson.ObjectIdHex(id))

View File

@@ -10,6 +10,15 @@ import (
"net/http"
)
// @Summary Get projects
// @Description Get projects
// @Tags project
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param tag query string true "projects"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /projects [get]
func GetProjectList(c *gin.Context) {
tag := c.Query("tag")
@@ -70,6 +79,16 @@ func GetProjectList(c *gin.Context) {
})
}
// @Summary Put project
// @Description Put project
// @Tags project
// @Accept json
// @Produce json
// @Param Authorization header string true "With the bearer started"
// @Param p body model.Project true "post project"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /projects [put]
func PutProject(c *gin.Context) {
// 绑定请求数据
var p model.Project
@@ -92,6 +111,17 @@ func PutProject(c *gin.Context) {
})
}
// @Summary Post project
// @Description Post project
// @Tags project
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "project id"
// @Param item body model.Project true "project item"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /projects/{id} [post]
func PostProject(c *gin.Context) {
id := c.Param("id")
@@ -116,6 +146,15 @@ func PostProject(c *gin.Context) {
})
}
// @Summary Delete project
// @Description Delete project
// @Tags project
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "project id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /projects/{id} [delete]
func DeleteProject(c *gin.Context) {
id := c.Param("id")
@@ -154,6 +193,14 @@ func DeleteProject(c *gin.Context) {
})
}
// @Summary Get project tags
// @Description Get projects tags
// @Tags project
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /projects/tags [get]
func GetProjectTags(c *gin.Context) {
type Result struct {
Tag string `json:"tag" bson:"tag"`

View File

@@ -8,6 +8,14 @@ import (
"net/http"
)
// @Summary Get schedule list
// @Description Get schedule list
// @Tags schedule
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /schedules [get]
func GetScheduleList(c *gin.Context) {
query := bson.M{}
@@ -22,6 +30,15 @@ func GetScheduleList(c *gin.Context) {
HandleSuccessData(c, results)
}
// @Summary Get schedule by id
// @Description Get schedule by id
// @Tags schedule
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /schedules/{id} [get]
func GetSchedule(c *gin.Context) {
id := c.Param("id")
@@ -34,6 +51,17 @@ func GetSchedule(c *gin.Context) {
HandleSuccessData(c, result)
}
// @Summary Post schedule
// @Description Post schedule
// @Tags schedule
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Param newItem body model.Schedule true "schedule item"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /schedules/{id} [post]
func PostSchedule(c *gin.Context) {
id := c.Param("id")
@@ -66,6 +94,16 @@ func PostSchedule(c *gin.Context) {
HandleSuccess(c)
}
// @Summary Put schedule
// @Description Put schedule
// @Tags schedule
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param item body model.Schedule true "schedule item"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /schedules [put]
func PutSchedule(c *gin.Context) {
var item model.Schedule
@@ -99,6 +137,15 @@ func PutSchedule(c *gin.Context) {
HandleSuccess(c)
}
// @Summary Delete schedule
// @Description Delete schedule
// @Tags schedule
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /schedules/{id} [delete]
func DeleteSchedule(c *gin.Context) {
id := c.Param("id")
@@ -118,6 +165,16 @@ func DeleteSchedule(c *gin.Context) {
}
// 停止定时任务
// @Summary disable schedule
// @Description disable schedule
// @Tags schedule
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /schedules/{id}/disable [post]
func DisableSchedule(c *gin.Context) {
id := c.Param("id")
if err := services.Sched.Disable(bson.ObjectIdHex(id)); err != nil {
@@ -128,6 +185,16 @@ func DisableSchedule(c *gin.Context) {
}
// 运行定时任务
// @Summary enable schedule
// @Description enable schedule
// @Tags schedule
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /schedules/{id}/enable [post]
func EnableSchedule(c *gin.Context) {
id := c.Param("id")
if err := services.Sched.Enable(bson.ObjectIdHex(id)); err != nil {

View File

@@ -13,6 +13,14 @@ type SettingBody struct {
EnableDemoSpiders string `json:"enable_demo_spiders"`
}
// @Summary Get version
// @Description Get version
// @Tags setting
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /version [get]
func GetVersion(c *gin.Context) {
version := viper.GetString("version")
@@ -23,6 +31,14 @@ func GetVersion(c *gin.Context) {
})
}
// @Summary Get setting
// @Description Get setting
// @Tags setting
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /setting [get]
func GetSetting(c *gin.Context) {
body := SettingBody{
AllowRegister: viper.GetString("setting.allowRegister"),

View File

@@ -28,6 +28,22 @@ import (
// ======== 爬虫管理 ========
// @Summary Get spider list
// @Description Get spider list
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param page_num query string false "page num"
// @Param page_size query string false "page size"
// @Param keyword query string false "keyword"
// @Param project_id query string false "project_id"
// @Param type query string false "type"
// @Param sort_key query string false "sort_key"
// @Param sort_direction query string false "sort_direction"
// @Param owner_type query string false "owner_type"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /schedules [get]
func GetSpiderList(c *gin.Context) {
pageNum := c.Query("page_num")
pageSize := c.Query("page_size")
@@ -109,6 +125,15 @@ func GetSpiderList(c *gin.Context) {
})
}
// @Summary Get spider by id
// @Description Get spider by id
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id} [get]
func GetSpider(c *gin.Context) {
id := c.Param("id")
@@ -129,6 +154,17 @@ func GetSpider(c *gin.Context) {
})
}
// @Summary Post spider
// @Description Post spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Param item body model.Spider true "spider item"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders/{id} [post]
func PostSpider(c *gin.Context) {
id := c.Param("id")
@@ -177,6 +213,16 @@ func PostSpider(c *gin.Context) {
})
}
// @Summary Publish spider
// @Description Publish spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders/{id}/publish [post]
func PublishSpider(c *gin.Context) {
id := c.Param("id")
@@ -198,6 +244,16 @@ func PublishSpider(c *gin.Context) {
})
}
// @Summary Put spider
// @Description Put spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param spider body model.Spider true "spider item"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders [put]
func PutSpider(c *gin.Context) {
var spider model.Spider
if err := c.ShouldBindJSON(&spider); err != nil {
@@ -279,6 +335,16 @@ func PutSpider(c *gin.Context) {
})
}
// @Summary Copy spider
// @Description Copy spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "schedule id"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders/{id}/copy [post]
func CopySpider(c *gin.Context) {
type ReqBody struct {
Name string `json:"name"`
@@ -326,6 +392,20 @@ func CopySpider(c *gin.Context) {
})
}
// @Summary Upload spider
// @Description Upload spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param file formData file true "spider file to upload"
// @Param name formData string true "spider name"
// @Param display_name formData string true "display name"
// @Param col formData string true "col"
// @Param cmd formData string true "cmd"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders [post]
func UploadSpider(c *gin.Context) {
// 从body中获取文件
uploadFile, err := c.FormFile("file")
@@ -467,6 +547,17 @@ func UploadSpider(c *gin.Context) {
})
}
// @Summary Upload spider by id
// @Description Upload spider by id
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param file formData file true "spider file to upload"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders/{id}/upload [post]
func UploadSpiderFromId(c *gin.Context) {
// TODO: 与 UploadSpider 部分逻辑重复,需要优化代码
// 爬虫ID
@@ -560,6 +651,15 @@ func UploadSpiderFromId(c *gin.Context) {
})
}
// @Summary Delete spider by id
// @Description Delete spider by id
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id} [delete]
func DeleteSpider(c *gin.Context) {
id := c.Param("id")
@@ -585,6 +685,15 @@ func DeleteSpider(c *gin.Context) {
})
}
// @Summary delete spider
// @Description delete spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders [post]
func DeleteSelectedSpider(c *gin.Context) {
type ReqBody struct {
SpiderIds []string `json:"spider_ids"`
@@ -615,6 +724,15 @@ func DeleteSelectedSpider(c *gin.Context) {
})
}
// @Summary cancel spider
// @Description cancel spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders-cancel [post]
func CancelSelectedSpider(c *gin.Context) {
type ReqBody struct {
SpiderIds []string `json:"spider_ids"`
@@ -639,6 +757,15 @@ func CancelSelectedSpider(c *gin.Context) {
})
}
// @Summary run spider
// @Description run spider
// @Tags spider
// @Accept json
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Success 200 json string Response
// @Failure 500 json string Response
// @Router /spiders-run [post]
func RunSelectedSpider(c *gin.Context) {
type TaskParam struct {
SpiderId bson.ObjectId `json:"spider_id"`
@@ -734,6 +861,15 @@ func RunSelectedSpider(c *gin.Context) {
})
}
// @Summary Get task list
// @Description Get task list
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/tasks [get]
func GetSpiderTasks(c *gin.Context) {
id := c.Param("id")
@@ -756,6 +892,15 @@ func GetSpiderTasks(c *gin.Context) {
})
}
// @Summary Get spider stats
// @Description Get spider stats
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/stats [get]
func GetSpiderStats(c *gin.Context) {
type Overview struct {
TaskCount int `json:"task_count" bson:"task_count"`
@@ -876,6 +1021,15 @@ func GetSpiderStats(c *gin.Context) {
})
}
// @Summary Get schedules
// @Description Get schedules
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/schedules [get]
func GetSpiderSchedules(c *gin.Context) {
id := c.Param("id")
@@ -902,6 +1056,16 @@ func GetSpiderSchedules(c *gin.Context) {
// ======== 爬虫文件管理 ========
// @Summary Get spider dir
// @Description Get spider dir
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param path query string true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/dir [get]
func GetSpiderDir(c *gin.Context) {
// 爬虫ID
id := c.Param("id")
@@ -949,6 +1113,16 @@ type SpiderFileReqBody struct {
NewPath string `json:"new_path"`
}
// @Summary Get spider file
// @Description Get spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param path query string true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file [get]
func GetSpiderFile(c *gin.Context) {
// 爬虫ID
id := c.Param("id")
@@ -977,6 +1151,15 @@ func GetSpiderFile(c *gin.Context) {
})
}
// @Summary Get spider dir
// @Description Get spider dir
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file/tree [get]
func GetSpiderFileTree(c *gin.Context) {
// 爬虫ID
id := c.Param("id")
@@ -1007,6 +1190,16 @@ func GetSpiderFileTree(c *gin.Context) {
})
}
// @Summary Post spider file
// @Description Post spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqBody body routes.SpiderFileReqBody true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file [post]
func PostSpiderFile(c *gin.Context) {
// 爬虫ID
id := c.Param("id")
@@ -1044,6 +1237,16 @@ func PostSpiderFile(c *gin.Context) {
})
}
// @Summary Put spider file
// @Description Put spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqBody body routes.SpiderFileReqBody true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file [post]
func PutSpiderFile(c *gin.Context) {
spiderId := c.Param("id")
var reqBody SpiderFileReqBody
@@ -1084,6 +1287,16 @@ func PutSpiderFile(c *gin.Context) {
})
}
// @Summary Post spider dir
// @Description Post spider dir
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqBody body routes.SpiderFileReqBody true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file [put]
func PutSpiderDir(c *gin.Context) {
spiderId := c.Param("id")
var reqBody SpiderFileReqBody
@@ -1124,6 +1337,16 @@ func PutSpiderDir(c *gin.Context) {
})
}
// @Summary Delete spider file
// @Description Delete spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqBody body routes.SpiderFileReqBody true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file [delete]
func DeleteSpiderFile(c *gin.Context) {
spiderId := c.Param("id")
var reqBody SpiderFileReqBody
@@ -1154,6 +1377,16 @@ func DeleteSpiderFile(c *gin.Context) {
})
}
// @Summary Rename spider file
// @Description Rename spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqBody body routes.SpiderFileReqBody true "path"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/file/rename [post]
func RenameSpiderFile(c *gin.Context) {
spiderId := c.Param("id")
var reqBody SpiderFileReqBody
@@ -1203,6 +1436,15 @@ func RenameSpiderFile(c *gin.Context) {
// ======== Scrapy 部分 ========
// @Summary Get scrapy spider file
// @Description Get scrapy spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/spiders [get]
func GetSpiderScrapySpiders(c *gin.Context) {
id := c.Param("id")
@@ -1230,6 +1472,15 @@ func GetSpiderScrapySpiders(c *gin.Context) {
})
}
// @Summary Put scrapy spider file
// @Description Put scrapy spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/spiders [put]
func PutSpiderScrapySpiders(c *gin.Context) {
type ReqBody struct {
Name string `json:"name"`
@@ -1267,6 +1518,15 @@ func PutSpiderScrapySpiders(c *gin.Context) {
})
}
// @Summary Get scrapy spider settings
// @Description Get scrapy spider settings
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/settings [get]
func GetSpiderScrapySettings(c *gin.Context) {
id := c.Param("id")
@@ -1294,6 +1554,16 @@ func GetSpiderScrapySettings(c *gin.Context) {
})
}
// @Summary Get scrapy spider file
// @Description Get scrapy spider file
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqData body []entity.ScrapySettingParam true "req data"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/settings [post]
func PostSpiderScrapySettings(c *gin.Context) {
id := c.Param("id")
@@ -1325,6 +1595,15 @@ func PostSpiderScrapySettings(c *gin.Context) {
})
}
// @Summary Get scrapy spider items
// @Description Get scrapy spider items
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/items [get]
func GetSpiderScrapyItems(c *gin.Context) {
id := c.Param("id")
@@ -1352,6 +1631,16 @@ func GetSpiderScrapyItems(c *gin.Context) {
})
}
// @Summary Post scrapy spider items
// @Description Post scrapy spider items
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Param reqData body []entity.ScrapyItem true "req data"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/items [post]
func PostSpiderScrapyItems(c *gin.Context) {
id := c.Param("id")
@@ -1383,6 +1672,16 @@ func PostSpiderScrapyItems(c *gin.Context) {
})
}
// @Summary Get scrapy spider pipelines
// @Description Get scrapy spider pipelines
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/pipelines [get]
func GetSpiderScrapyPipelines(c *gin.Context) {
id := c.Param("id")
@@ -1410,6 +1709,15 @@ func GetSpiderScrapyPipelines(c *gin.Context) {
})
}
// @Summary Get scrapy spider file path
// @Description Get scrapy spider file path
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/scrapy/spider/filepath [get]
func GetSpiderScrapySpiderFilepath(c *gin.Context) {
id := c.Param("id")
@@ -1447,6 +1755,15 @@ func GetSpiderScrapySpiderFilepath(c *gin.Context) {
// ======== Git 部分 ========
// @Summary Post spider sync git
// @Description Post spider sync git
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/git/sync [post]
func PostSpiderSyncGit(c *gin.Context) {
id := c.Param("id")
@@ -1472,6 +1789,15 @@ func PostSpiderSyncGit(c *gin.Context) {
})
}
// @Summary Post spider reset git
// @Description Post spider reset git
// @Tags spider
// @Produce json
// @Param Authorization header string true "Authorization token"
// @Param id path string true "spider id"
// @Success 200 json string Response
// @Failure 400 json string Response
// @Router /spiders/{id}/git/reset [post]
func PostSpiderResetGit(c *gin.Context) {
id := c.Param("id")