- Add swagger api docs for user, token, and variable

This commit is contained in:
hantmac
2020-05-04 17:54:41 +08:00
parent eee81c57c6
commit 46ea790cab
6 changed files with 1745 additions and 138 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-04 07:44:51.372978 +0800 CST m=+0.135701027
// 2020-05-04 17:53:13.810815 +0800 CST m=+0.105728870
package docs
@@ -763,14 +763,14 @@ var doc = `{
},
"/schedules": {
"get": {
"description": "Get spider list",
"description": "Get schedule list",
"produces": [
"application/json"
],
"tags": [
"spider"
"schedule"
],
"summary": "Get spider list",
"summary": "Get schedule list",
"parameters": [
{
"type": "string",
@@ -778,54 +778,6 @@ var doc = `{
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "page num",
"name": "page_num",
"in": "query"
},
{
"type": "string",
"description": "page size",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "keyword",
"name": "keyword",
"in": "query"
},
{
"type": "string",
"description": "project_id",
"name": "project_id",
"in": "query"
},
{
"type": "string",
"description": "type",
"name": "type",
"in": "query"
},
{
"type": "string",
"description": "sort_key",
"name": "sort_key",
"in": "query"
},
{
"type": "string",
"description": "sort_direction",
"name": "sort_direction",
"in": "query"
},
{
"type": "string",
"description": "owner_type",
"name": "owner_type",
"in": "query"
}
],
"responses": {
@@ -3090,6 +3042,508 @@ var doc = `{
}
}
},
"/tokens": {
"get": {
"description": "token",
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Get token",
"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": "token",
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Put token",
"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"
}
}
}
}
},
"/tokens/{id}": {
"delete": {
"description": "Delete token",
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Delete token",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "token id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/users": {
"get": {
"description": "Get user list",
"produces": [
"application/json"
],
"tags": [
"token"
],
"summary": "Get user list",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "data body",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/routes.UserListRequestData"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"put": {
"description": "Put user",
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Put user",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "reqData body",
"name": "reqData",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/routes.UserRequestData"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/users/{id}": {
"get": {
"description": "user",
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get user",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "user id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"post": {
"description": "Post user",
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Post user",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "user body",
"name": "item",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/model.User"
}
},
{
"type": "string",
"description": "user id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"delete": {
"description": "Delete user",
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Delete user",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "user id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/variable": {
"put": {
"description": "Put variable",
"produces": [
"application/json"
],
"tags": [
"variable"
],
"summary": "Put variable",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "reqData body",
"name": "variable",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/model.Variable"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/variable/{id}": {
"post": {
"description": "Post variable",
"produces": [
"application/json"
],
"tags": [
"variable"
],
"summary": "Post variable",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "reqData body",
"name": "variable",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/model.Variable"
}
},
{
"type": "string",
"description": "variable id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
},
"delete": {
"description": "Delete variable",
"produces": [
"application/json"
],
"tags": [
"variable"
],
"summary": "Delete variable",
"parameters": [
{
"type": "string",
"description": "Authorization token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "variable id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "json"
}
}
}
}
},
"/variables": {
"get": {
"description": "Get variable list",
"produces": [
"application/json"
],
"tags": [
"variable"
],
"summary": "Get variable 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"
}
}
}
}
},
"/version": {
"get": {
"description": "Get version",
@@ -3669,6 +4123,85 @@ var doc = `{
}
}
},
"model.User": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"create_ts": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"role": {
"type": "string"
},
"setting": {
"type": "object",
"$ref": "#/definitions/model.UserSetting"
},
"update_ts": {
"type": "string"
},
"user_id": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.UserSetting": {
"type": "object",
"properties": {
"ding_talk_robot_webhook": {
"type": "string"
},
"enabled_notifications": {
"type": "array",
"items": {
"type": "string"
}
},
"error_regex_pattern": {
"type": "string"
},
"log_expire_duration": {
"type": "integer"
},
"max_error_log": {
"type": "integer"
},
"notification_trigger": {
"type": "string"
},
"wechat_robot_webhook": {
"type": "string"
}
}
},
"model.Variable": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"key": {
"type": "string"
},
"remark": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"routes.SpiderFileReqBody": {
"type": "object",
"properties": {
@@ -3716,6 +4249,34 @@ var doc = `{
"type": "integer"
}
}
},
"routes.UserListRequestData": {
"type": "object",
"properties": {
"pageNum": {
"type": "integer"
},
"pageSize": {
"type": "integer"
}
}
},
"routes.UserRequestData": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"role": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
}
}`