Commit 4e94b8be authored by vicotor's avatar vicotor

update main

parent e72fa1c2
...@@ -54,6 +54,17 @@ type ProjectReq struct { ...@@ -54,6 +54,17 @@ type ProjectReq struct {
Project string `json:"project"` Project string `json:"project"`
} }
// GetConfigOwner godoc
// @Summary GetConfigOwner
// @Description get config owner info.
// @Tags config
// @Accept json
// @Produce json
// @Param config body Config true "config"
// @Success 200 {object} ProjectRes
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /apikey/owner [get]
func GetConfigOwner(c *fiber.Ctx) error { func GetConfigOwner(c *fiber.Ctx) error {
slog.Info(c.Route().Path, "body", string(c.Request().Body())) slog.Info(c.Route().Path, "body", string(c.Request().Body()))
...@@ -84,6 +95,31 @@ func GetConfigOwner(c *fiber.Ctx) error { ...@@ -84,6 +95,31 @@ func GetConfigOwner(c *fiber.Ctx) error {
} }
// add comment to generate swagger docs, example as below.
// GetUser godoc
// @Summary Get a user
// @Description get user by ID
// @Tags users
// @Accept json
// @Produce json
// @Param id path int true "User ID"
// @Success 200 {object} models.User
// @Failure 400 {object} models.HTTPError
// @Failure 404 {object} models.HTTPError
// @Failure 500 {object} models.HTTPError
// @Router /users/{id} [get]
// Project godoc
// @Summary Project
// @Description add project info.
// @Tags project
// @Accept json
// @Produce json
// @Param project body ProjectReq true "project"
// @Success 200 {object} ProjectRes
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /project [post]
func Project(c *fiber.Ctx) error { func Project(c *fiber.Ctx) error {
slog.Info(c.Route().Path, "body", string(c.Request().Body())) slog.Info(c.Route().Path, "body", string(c.Request().Body()))
...@@ -148,6 +184,17 @@ type AddTaskReq struct { ...@@ -148,6 +184,17 @@ type AddTaskReq struct {
ApiConfig Config `json:"config"` ApiConfig Config `json:"config"`
} }
// TaskAdd godoc
// @Summary TaskAdd
// @Description add task info.
// @Tags task
// @Accept json
// @Produce json
// @Param task body AddTaskReq true "task"
// @Success 200 {object} Res
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /task/add [post]
func TaskAdd(c *fiber.Ctx) error { func TaskAdd(c *fiber.Ctx) error {
slog.Info(c.Route().Path, "body", string(c.Request().Body())) slog.Info(c.Route().Path, "body", string(c.Request().Body()))
...@@ -264,6 +311,17 @@ type StopTaskReq struct { ...@@ -264,6 +311,17 @@ type StopTaskReq struct {
TaskId string `json:"task_id"` TaskId string `json:"task_id"`
} }
// TaskStop godoc
// @Summary TaskStop
// @Description stop task info.
// @Tags task
// @Accept json
// @Produce json
// @Param task body StopTaskReq true "task"
// @Success 200 {object} Res
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /task/stop [post]
func TaskStop(c *fiber.Ctx) error { func TaskStop(c *fiber.Ctx) error {
slog.Info(c.Route().Path, "body", string(c.Request().Body())) slog.Info(c.Route().Path, "body", string(c.Request().Body()))
...@@ -315,6 +373,18 @@ func TaskStop(c *fiber.Ctx) error { ...@@ -315,6 +373,18 @@ func TaskStop(c *fiber.Ctx) error {
} }
// VerifyRetweeter godoc
// @Summary VerifyRetweeter
// @Description verify retweeter info.
// @Tags verify
// @Accept json
// @Produce json
// @Param tweet_id query string true "tweet_id"
// @Param retweeter_id query string true "retweeter_id"
// @Success 200 {object} VerifyRes
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /verify/retweeter [get]
func VerifyRetweeter(c *fiber.Ctx) error { func VerifyRetweeter(c *fiber.Ctx) error {
tweetId := c.Query("tweet_id") tweetId := c.Query("tweet_id")
...@@ -355,6 +425,19 @@ func VerifyRetweeter(c *fiber.Ctx) error { ...@@ -355,6 +425,19 @@ func VerifyRetweeter(c *fiber.Ctx) error {
} }
// VerifyFollower godoc
// @Summary VerifyFollower
// @Description verify follower info.
// @Tags verify
// @Accept json
// @Produce json
// @Param task_id query string true "task_id"
// @Param follower_id query string true "follower_id"
// @Param follower_username query string true "follower_username"
// @Success 200 {object} VerifyRes
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /verify/follower [get]
func VerifyFollower(c *fiber.Ctx) error { func VerifyFollower(c *fiber.Ctx) error {
userId := c.Query("task_id") userId := c.Query("task_id")
...@@ -393,6 +476,18 @@ func VerifyFollower(c *fiber.Ctx) error { ...@@ -393,6 +476,18 @@ func VerifyFollower(c *fiber.Ctx) error {
} }
// VerifyLike godoc
// @Summary VerifyLike
// @Description verify like info.
// @Tags verify
// @Accept json
// @Produce json
// @Param tweet_id query string true "tweet_id"
// @Param user_id query string true "user_id"
// @Success 200 {object} VerifyRes
// @Failure 400 {object} Res
// @Failure 500 {object} Res
// @Router /verify/like [get]
func VerifyLike(c *fiber.Ctx) error { func VerifyLike(c *fiber.Ctx) error {
tweetId := c.Query("tweet_id") tweetId := c.Query("tweet_id")
......
...@@ -9,22 +9,509 @@ const docTemplate = `{ ...@@ -9,22 +9,509 @@ const docTemplate = `{
"info": { "info": {
"description": "{{escape .Description}}", "description": "{{escape .Description}}",
"title": "{{.Title}}", "title": "{{.Title}}",
"contact": {}, "contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}" "version": "{{.Version}}"
}, },
"host": "{{.Host}}", "host": "{{.Host}}",
"basePath": "{{.BasePath}}", "basePath": "{{.BasePath}}",
"paths": {} "paths": {
"/apikey/owner": {
"get": {
"description": "get config owner info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"config"
],
"summary": "GetConfigOwner",
"parameters": [
{
"description": "config",
"name": "config",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.Config"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ProjectRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/project": {
"post": {
"description": "add project info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"project"
],
"summary": "Project",
"parameters": [
{
"description": "project",
"name": "project",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.ProjectReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ProjectRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/task/add": {
"post": {
"description": "add task info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "TaskAdd",
"parameters": [
{
"description": "task",
"name": "task",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.AddTaskReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/task/stop": {
"post": {
"description": "stop task info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "TaskStop",
"parameters": [
{
"description": "task",
"name": "task",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.StopTaskReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/verify/follower": {
"get": {
"description": "verify follower info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"verify"
],
"summary": "VerifyFollower",
"parameters": [
{
"type": "string",
"description": "task_id",
"name": "task_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "follower_id",
"name": "follower_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "follower_username",
"name": "follower_username",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.VerifyRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/verify/like": {
"get": {
"description": "verify like info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"verify"
],
"summary": "VerifyLike",
"parameters": [
{
"type": "string",
"description": "tweet_id",
"name": "tweet_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "user_id",
"name": "user_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.VerifyRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/verify/retweeter": {
"get": {
"description": "verify retweeter info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"verify"
],
"summary": "VerifyRetweeter",
"parameters": [
{
"type": "string",
"description": "tweet_id",
"name": "tweet_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "retweeter_id",
"name": "retweeter_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.VerifyRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
}
},
"definitions": {
"main.AddTaskReq": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/main.Config"
},
"task_id": {
"type": "string"
},
"task_type": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"main.Config": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"access_token_secret": {
"type": "string"
},
"api_key": {
"type": "string"
},
"api_key_secret": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"main.ProjectReq": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"access_token_secret": {
"type": "string"
},
"api_key": {
"type": "string"
},
"api_key_secret": {
"type": "string"
},
"project": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"main.ProjectRes": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"$ref": "#/definitions/main.UserInfo"
},
"msg": {
"type": "string"
}
}
},
"main.Res": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"msg": {
"type": "string"
}
}
},
"main.StopTaskReq": {
"type": "object",
"properties": {
"task_id": {
"type": "string"
},
"task_type": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"main.UserInfo": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"user_id": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"main.VerifyRes": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"msg": {
"type": "string"
}
}
}
}
}` }`
// SwaggerInfo holds exported Swagger Info so clients can modify it // SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{ var SwaggerInfo = &swag.Spec{
Version: "", Version: "1.0",
Host: "", Host: "localhost:8001",
BasePath: "", BasePath: "/",
Schemes: []string{}, Schemes: []string{},
Title: "", Title: "Twitter Syncer API",
Description: "", Description: "This is api for twitter syncer.",
InfoInstanceName: "swagger", InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate, SwaggerTemplate: docTemplate,
LeftDelim: "{{", LeftDelim: "{{",
......
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"contact": {} "description": "This is api for twitter syncer.",
"title": "Twitter Syncer API",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
}, },
"paths": {} "host": "3.114.44.103:8001",
"basePath": "/",
"paths": {
"/apikey/owner": {
"get": {
"description": "get config owner info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"config"
],
"summary": "GetConfigOwner",
"parameters": [
{
"description": "config",
"name": "config",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.Config"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ProjectRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/project": {
"post": {
"description": "add project info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"project"
],
"summary": "Project",
"parameters": [
{
"description": "project",
"name": "project",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.ProjectReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ProjectRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/task/add": {
"post": {
"description": "add task info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "TaskAdd",
"parameters": [
{
"description": "task",
"name": "task",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.AddTaskReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/task/stop": {
"post": {
"description": "stop task info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "TaskStop",
"parameters": [
{
"description": "task",
"name": "task",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.StopTaskReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/verify/follower": {
"get": {
"description": "verify follower info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"verify"
],
"summary": "VerifyFollower",
"parameters": [
{
"type": "string",
"description": "task_id",
"name": "task_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "follower_id",
"name": "follower_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "follower_username",
"name": "follower_username",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.VerifyRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/verify/like": {
"get": {
"description": "verify like info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"verify"
],
"summary": "VerifyLike",
"parameters": [
{
"type": "string",
"description": "tweet_id",
"name": "tweet_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "user_id",
"name": "user_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.VerifyRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
},
"/verify/retweeter": {
"get": {
"description": "verify retweeter info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"verify"
],
"summary": "VerifyRetweeter",
"parameters": [
{
"type": "string",
"description": "tweet_id",
"name": "tweet_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "retweeter_id",
"name": "retweeter_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.VerifyRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/main.Res"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.Res"
}
}
}
}
}
},
"definitions": {
"main.AddTaskReq": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/main.Config"
},
"task_id": {
"type": "string"
},
"task_type": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"main.Config": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"access_token_secret": {
"type": "string"
},
"api_key": {
"type": "string"
},
"api_key_secret": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"main.ProjectReq": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"access_token_secret": {
"type": "string"
},
"api_key": {
"type": "string"
},
"api_key_secret": {
"type": "string"
},
"project": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"main.ProjectRes": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"$ref": "#/definitions/main.UserInfo"
},
"msg": {
"type": "string"
}
}
},
"main.Res": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"msg": {
"type": "string"
}
}
},
"main.StopTaskReq": {
"type": "object",
"properties": {
"task_id": {
"type": "string"
},
"task_type": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"main.UserInfo": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"user_id": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"main.VerifyRes": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"msg": {
"type": "string"
}
}
}
}
} }
\ No newline at end of file
openapi: "3.0.3" basePath: /
servers: definitions:
- url: http://3.114.44.103:38001 main.AddTaskReq:
description: Default server properties:
config:
$ref: '#/definitions/main.Config'
task_id:
type: string
task_type:
type: string
user_id:
type: string
type: object
main.Config:
properties:
access_token:
type: string
access_token_secret:
type: string
api_key:
type: string
api_key_secret:
type: string
token:
type: string
type: object
main.ProjectReq:
properties:
access_token:
type: string
access_token_secret:
type: string
api_key:
type: string
api_key_secret:
type: string
project:
type: string
token:
type: string
type: object
main.ProjectRes:
properties:
code:
type: integer
data:
$ref: '#/definitions/main.UserInfo'
msg:
type: string
type: object
main.Res:
properties:
code:
type: integer
msg:
type: string
type: object
main.StopTaskReq:
properties:
task_id:
type: string
task_type:
type: string
user_id:
type: string
type: object
main.UserInfo:
properties:
name:
type: string
user_id:
type: string
username:
type: string
type: object
main.VerifyRes:
properties:
code:
type: integer
data:
properties:
ok:
type: boolean
type: object
msg:
type: string
type: object
host: 3.114.44.103:8001
info: info:
description: |
This is a sample sniper wallet server.
## Introduction
This API is documented in **OpenAPI format** and is based on
version: 0.0.1
title: Swagger Uniswap Wallet YAML
termsOfService: "http://swagger.io/terms/"
contact: contact:
email: support@swagger.io
name: API Support name: API Support
email: apiteam@swagger.io url: http://www.swagger.io/support
url: https://github.com/Redocly/redoc description: This is api for twitter syncer.
x-logo:
url: "https://redocly.github.io/redoc/petstore-logo.png"
altText: Petstore logo
license: license:
name: Apache 2.0 name: Apache 2.0
url: "http://www.apache.org/licenses/LICENSE-2.0.html" url: http://www.apache.org/licenses/LICENSE-2.0.html
externalDocs: title: Twitter Syncer API
description: Find out how to create Github repo for your OpenAPI spec. version: "1.0"
url: "https://github.com/Rebilly/generator-openapi-repo"
tags:
- name: Task
description: add or stop task
- name: Verify
description: Verify the user's job
# - name: User
# description: Everything about user
# - name: store
# description: Access to Petstore orders
# x-displayName: Petstore Orders
# - name: user
# description: Operations about user
# x-displayName: Users
# - name: pet_model
# x-displayName: The Pet Model
# description: |
# <SchemaDefinition schemaRef="#/components/schemas/Pet" />
# - name: store_model
# x-displayName: The Order Model
# description: |
# <SchemaDefinition schemaRef="#/components/schemas/Order" exampleRef="#/components/examples/Order" showReadOnly={true} showWriteOnly={true} />
x-tagGroups:
- name: Task Controler
tags:
- task
- name: daily task
tags:
- user
- name: Models
tags:
- pet_model
- store_model
paths: paths:
/apikey/owner:
get:
consumes:
- application/json
description: get config owner info.
parameters:
- description: config
in: body
name: config
required: true
schema:
$ref: '#/definitions/main.Config'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/main.ProjectRes'
"400":
description: Bad Request
schema:
$ref: '#/definitions/main.Res'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/main.Res'
summary: GetConfigOwner
tags:
- config
/project: /project:
post: post:
tags: consumes:
- Task - application/json
requestBody: description: add project info.
content: parameters:
application/json: - description: project
schema: in: body
type: object name: project
$ref: "#/components/schemas/Project" required: true
schema:
$ref: '#/definitions/main.ProjectReq'
produces:
- application/json
responses: responses:
"200": "200":
description: successful operation description: OK
content: schema:
application/json: $ref: '#/definitions/main.ProjectRes'
schema: "400":
type: object description: Bad Request
properties: schema:
code: $ref: '#/definitions/main.Res'
type: integer "500":
format: int64 description: Internal Server Error
enum: [200, 500] schema:
msg: $ref: '#/definitions/main.Res'
type: string summary: Project
data: tags:
type: object - project
$ref: "#/components/schemas/Me"
/task/add: /task/add:
summary: Create or update a new task in the twitter syncer
post: post:
tags: consumes:
- Task - application/json
requestBody: description: add task info.
content: parameters:
application/json: - description: task
schema: in: body
type: object name: task
$ref: "#/components/schemas/AddTaskReq" required: true
schema:
$ref: '#/definitions/main.AddTaskReq'
produces:
- application/json
responses: responses:
"200": "200":
description: successful operation description: OK
content: schema:
application/json: $ref: '#/definitions/main.Res'
schema: "400":
type: object description: Bad Request
properties: schema:
code: $ref: '#/definitions/main.Res'
type: integer "500":
format: int64 description: Internal Server Error
enum: [200, 500] schema:
msg: $ref: '#/definitions/main.Res'
type: string summary: TaskAdd
tags:
- task
/task/stop: /task/stop:
summary: Stop a task in the twitter syncer
post: post:
tags: consumes:
- Task - application/json
requestBody: description: stop task info.
content: parameters:
application/json: - description: task
schema: in: body
type: object name: task
$ref: "#/components/schemas/StopTaskReq" required: true
schema:
$ref: '#/definitions/main.StopTaskReq'
produces:
- application/json
responses: responses:
"200": "200":
description: successful operation description: OK
content: schema:
application/json: $ref: '#/definitions/main.Res'
schema: "400":
type: object description: Bad Request
properties: schema:
code: $ref: '#/definitions/main.Res'
type: integer "500":
format: int64 description: Internal Server Error
enum: [200, 500] schema:
msg: $ref: '#/definitions/main.Res'
type: string summary: TaskStop
tags:
- task
/verify/follower: /verify/follower:
get: get:
tags: consumes:
- Verify - application/json
summary: Verify the provide user description: verify follower info.
parameters: parameters:
- name: task_id - description: task_id
in: query in: query
required: true name: task_id
explode: true required: true
type: string type: string
example: "aon_aonet" - description: follower_id
- name: follower_id in: query
in: query name: follower_id
required: true required: true
explode: true type: string
type: string - description: follower_username
example: "1825777453769650176" in: query
name: follower_username
required: true
type: string
produces:
- application/json
responses: responses:
"200": "200":
description: successful operation description: OK
content: schema:
application/json: $ref: '#/definitions/main.VerifyRes'
schema: "400":
type: object description: Bad Request
properties: schema:
code: $ref: '#/definitions/main.Res'
type: integer "500":
format: int64 description: Internal Server Error
enum: [200, 500] schema:
msg: $ref: '#/definitions/main.Res'
type: string summary: VerifyFollower
data: tags:
$ref: '#/components/schemas/verify_res' - verify
/verify/like: /verify/like:
get: get:
tags: consumes:
- Verify - application/json
summary: Verify the provide user description: verify like info.
parameters: parameters:
- name: tweet_id - description: tweet_id
in: query in: query
required: true name: tweet_id
explode: true required: true
type: string type: string
# default: available - description: user_id
example: "1800805503066661056" in: query
- name: user_id name: user_id
in: query required: true
required: true type: string
explode: true produces:
type: string - application/json
# default: available
example: "1823984946710765569"
- name: begin_time
in: query
type: string
format: date-time
example: "2024-01-01T00:00:00Z"
# default: "2024-10-01T00:00:00Z"
- name: end_time
in: query
type: string
format: date-time
example: "2024-12-01T00:00:00Z"
# default: "2024-10-01T00:00:00Z"
responses: responses:
"200": "200":
description: successful operation description: OK
content: schema:
application/json: $ref: '#/definitions/main.VerifyRes'
schema: "400":
type: object description: Bad Request
properties: schema:
code: $ref: '#/definitions/main.Res'
type: integer "500":
format: int64 description: Internal Server Error
enum: [200, 500] schema:
msg: $ref: '#/definitions/main.Res'
type: string summary: VerifyLike
data: tags:
$ref: '#/components/schemas/verify_res' - verify
/verify/retweeter: /verify/retweeter:
get: get:
tags: consumes:
- Verify - application/json
summary: Verify the provide user description: verify retweeter info.
parameters: parameters:
- name: tweet_id - description: tweet_id
in: query in: query
required: true name: tweet_id
explode: true required: true
type: string type: string
# default: available - description: retweeter_id
example: "1800805503066661056" in: query
- name: retweeter_id name: retweeter_id
in: query required: true
required: true type: string
explode: true produces:
type: string - application/json
# default: available
example: "1823984946710765569"
- name: begin_time
in: query
type: string
format: date-time
example: "2024-01-01T00:00:00Z"
# default: "2024-10-01T00:00:00Z"
- name: end_time
in: query
type: string
format: date-time
example: "2024-12-01T00:00:00Z"
# default: "2024-10-01T00:00:00Z"
responses: responses:
"200": "200":
description: successful operation description: OK
content: schema:
application/json: $ref: '#/definitions/main.VerifyRes'
schema: "400":
type: object description: Bad Request
properties: schema:
code: $ref: '#/definitions/main.Res'
type: integer "500":
format: int64 description: Internal Server Error
enum: [200, 500] schema:
msg: $ref: '#/definitions/main.Res'
type: string summary: VerifyRetweeter
data: tags:
$ref: '#/components/schemas/verify_res' - verify
swagger: "2.0"
components:
securitySchemes:
api_key:
description: |
For this sample, you can use the api key `special-key` to test the authorization filters.
in: header
name: api_key
type: apiKey
petstore_auth:
description: |
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
scopes:
read:pets: read your pets
write:pets: modify pets in your account
type: oauth2
schemas:
Project:
required:
- api_key
- api_key_secret
- access_token
- access_token_secret
- token
- project
type: object
properties:
api_key:
type: string
api_key_secret:
type: string
access_token:
type: string
access_token_secret:
type: string
token:
type: string
project:
type: string
Me:
type: object
properties:
user_id:
type: string
username:
type: string
name:
type: string
AddTaskReq:
required:
- task_id
- task_type
- user_id
type: object
properties:
user_id:
description: 方便识别用户身份信息
type: string
example: "1783145144700874752"
task_type:
type: string
enum:
- retweeters
- tweet_liking_users
- followers
example: followers
task_id:
description: tweet id;
type: string
example: "aon_aonet"
StopTaskReq:
required:
- user_id
- task_type
type: object
properties:
task_type:
type: string
enum:
- retweeters
- tweet_liking_users
- followers
example: retweeters
task_id:
description: user id or full name for follow, tweet id for retweet.
type: string
example: "1800805503066661056"
user_id:
type: string
example: "1783145144700874752"
# start:
# type: boolean
# example: true
verify_res:
required:
- ok
type: object
properties:
ok:
type: boolean
...@@ -16,7 +16,7 @@ require ( ...@@ -16,7 +16,7 @@ require (
require ( require (
github.com/AlexEidt/Vidio v1.5.1 // indirect github.com/AlexEidt/Vidio v1.5.1 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect github.com/KyleBanks/depth v1.2.1 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect github.com/andybalholm/brotli v1.1.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect
...@@ -33,10 +33,11 @@ require ( ...@@ -33,10 +33,11 @@ require (
github.com/go-openapi/swag v0.23.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-openapi/validate v0.22.3 // indirect github.com/go-openapi/validate v0.22.3 // indirect
github.com/gofiber/contrib/swagger v1.2.0 // indirect github.com/gofiber/contrib/swagger v1.2.0 // indirect
github.com/gofiber/swagger v1.1.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/compress v1.17.11 // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
...@@ -51,15 +52,16 @@ require ( ...@@ -51,15 +52,16 @@ require (
github.com/swaggo/files/v2 v2.0.1 // indirect github.com/swaggo/files/v2 v2.0.1 // indirect
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect github.com/valyala/fasthttp v1.56.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.13.1 // indirect go.mongodb.org/mongo-driver v1.13.1 // indirect
golang.org/x/net v0.29.0 // indirect golang.org/x/net v0.30.0 // indirect
golang.org/x/sys v0.25.0 // indirect golang.org/x/sys v0.26.0 // indirect
golang.org/x/tools v0.23.0 // indirect golang.org/x/tools v0.26.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
replace github.com/imperatrona/twitter-scraper => ../twitter-scraper replace github.com/imperatrona/twitter-scraper => ../twitter-scraper
//replace github.com/imperatrona/twitter-scraper => github.com/xueqianLu/twitter-scraper v0.0.2
\ No newline at end of file //replace github.com/imperatrona/twitter-scraper => github.com/xueqianLu/twitter-scraper v0.0.2
...@@ -4,6 +4,8 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc ...@@ -4,6 +4,8 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
...@@ -78,6 +80,8 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF ...@@ -78,6 +80,8 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
...@@ -144,6 +148,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw ...@@ -144,6 +148,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8= github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM= github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
github.com/valyala/fasthttp v1.56.0 h1:bEZdJev/6LCBlpdORfrLu/WOZXXxvrUQSiyniuaoW8U=
github.com/valyala/fasthttp v1.56.0/go.mod h1:sReBt3XZVnudxuLOx4J/fMrJVorWRiWY2koQKgABiVI=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
...@@ -153,6 +159,7 @@ github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgk ...@@ -153,6 +159,7 @@ github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgk
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xueqianLu/twitter-scraper v0.0.1/go.mod h1:38MY3g/h4V7Xl4HbW9lnkL8S3YiFZenBFv86hN57RG8= github.com/xueqianLu/twitter-scraper v0.0.1/go.mod h1:38MY3g/h4V7Xl4HbW9lnkL8S3YiFZenBFv86hN57RG8=
github.com/xueqianLu/twitter-scraper v0.0.2/go.mod h1:wtKfvNag8hxo4I0gEAn90OrKp1F0+StuFD3zbtIZlZE= github.com/xueqianLu/twitter-scraper v0.0.2/go.mod h1:wtKfvNag8hxo4I0gEAn90OrKp1F0+StuFD3zbtIZlZE=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
...@@ -173,6 +180,7 @@ golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= ...@@ -173,6 +180,7 @@ golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
...@@ -187,6 +195,8 @@ golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= ...@@ -187,6 +195,8 @@ golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
...@@ -214,6 +224,8 @@ golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= ...@@ -214,6 +224,8 @@ golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
...@@ -245,6 +257,8 @@ golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58 ...@@ -245,6 +257,8 @@ golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
......
// @title Twitter Syncer API
// @version 1.0
// @description This is api for twitter syncer.
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8001
// @BasePath /
package main package main
import ( import (
"fmt" "fmt"
"github.com/gofiber/swagger"
"log/slog" "log/slog"
// "github.com/gofiber/fiber/v2" //"github.com/gofiber/contrib/swagger"
// "github.com/gofiber/fiber/v2/middleware/cors"
// "github.com/gofiber/swagger"
"github.com/gofiber/contrib/swagger"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/cors"
//"github.com/gofiber/swagger"
_ "code.wuban.net.cn/odysseus/twitter_syncer/docs" _ "code.wuban.net.cn/odysseus/twitter_syncer/docs"
// docs are generated by Swag CLI, you have to import them.
// replace with your own docs folder, usually "github.com/username/reponame/docs"
//_ "github.com/gofiber/swagger/example/docs"
) )
func main() { func main() {
...@@ -51,14 +57,15 @@ func main() { ...@@ -51,14 +57,15 @@ func main() {
//app.Static("/swagger/docs", "./docs") //app.Static("/swagger/docs", "./docs")
cfg := swagger.Config{ //cfg := swagger.Config{
BasePath: "/", // BasePath: "/",
FilePath: "./docs/swagger.yaml", // FilePath: "./docs/swagger.yaml",
Path: "swagger", // Path: "swagger",
Title: "Swagger API Docs", // Title: "Swagger API Docs",
} //}
//
app.Use(swagger.New(cfg)) //app.Use(swagger.New(cfg))
app.Get("/swagger/*", swagger.HandlerDefault)
app.Post("/project", Project) app.Post("/project", Project)
app.Get("/apikey/owner", GetConfigOwner) app.Get("/apikey/owner", GetConfigOwner)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment