From 4eefd7c55e47c3b4e43e58c797666901854f16ea Mon Sep 17 00:00:00 2001 From: Fabio1988 Date: Fri, 27 Sep 2024 08:34:55 +0200 Subject: [PATCH] initial swagger --- docs/.swaggo | 4 + docs/docs.go | 467 ++++++++++++++++++++++++++++++++++++++++++++++ docs/swagger.json | 438 +++++++++++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 315 +++++++++++++++++++++++++++++++ go.mod | 15 ++ go.sum | 53 ++++++ main.go | 3 + routes.go | 46 ++++- 8 files changed, 1335 insertions(+), 6 deletions(-) create mode 100644 docs/.swaggo create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml diff --git a/docs/.swaggo b/docs/.swaggo new file mode 100644 index 00000000..bdb8d425 --- /dev/null +++ b/docs/.swaggo @@ -0,0 +1,4 @@ +replace null.String string +replace null.Bool bool +replace null.Float float64 +replace null.Int int \ No newline at end of file diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 00000000..d90a2721 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,467 @@ +// Package docs Code generated by swaggo/swag. DO NOT EDIT +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": {}, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/api/clear-quests": { + "post": { + "description": "Clear Quests in given Fence", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "quest" + ], + "summary": "Clear Quests", + "parameters": [ + { + "description": "Fence", + "name": "fence", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/geojson.Feature" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/main.Response" + } + } + } + } + }, + "/api/pokemon/v2/scan": { + "post": { + "description": "Scan Pokemon for given request", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pokemon" + ], + "summary": "Pokemon Scan V2", + "parameters": [ + { + "description": "Pokemon Scan2", + "name": "scan", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/decoder.ApiPokemonScan2" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/decoder.ApiPokemonResult" + } + } + } + } + } + }, + "/api/quest-status": { + "post": { + "description": "Get Status of Quests in given Fence", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "quest" + ], + "summary": "Quests Status", + "parameters": [ + { + "description": "Fence", + "name": "fence", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/geojson.Feature" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/db.QuestStatus" + } + } + } + } + } + } + }, + "definitions": { + "db.QuestStatus": { + "type": "object", + "properties": { + "ar_quests": { + "type": "integer" + }, + "no_ar_quests": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonDnfFilter": { + "type": "object", + "properties": { + "atk_iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "cp": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "def_iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "gender": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "level": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "pokemon": { + "type": "array", + "items": { + "$ref": "#/definitions/decoder.ApiPokemonDnfId" + } + }, + "pvp_great": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "pvp_little": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "pvp_ultra": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "size": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "sta_iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + } + } + }, + "decoder.ApiPokemonDnfId": { + "type": "object", + "properties": { + "form": { + "type": "integer" + }, + "id": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonDnfMinMax": { + "type": "object", + "properties": { + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonDnfMinMax8": { + "type": "object", + "properties": { + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonResult": { + "type": "object", + "properties": { + "atk_iv": { + "type": "integer" + }, + "capture_1": { + "type": "number" + }, + "capture_2": { + "type": "number" + }, + "capture_3": { + "type": "number" + }, + "cell_id": { + "type": "integer" + }, + "changed": { + "type": "integer" + }, + "costume": { + "type": "integer" + }, + "cp": { + "type": "integer" + }, + "def_iv": { + "type": "integer" + }, + "display_pokemon_id": { + "type": "integer" + }, + "distance": { + "type": "number" + }, + "encounter_weather": { + "type": "integer" + }, + "expire_timestamp": { + "type": "integer" + }, + "expire_timestamp_verified": { + "type": "boolean" + }, + "first_seen_timestamp": { + "type": "integer" + }, + "form": { + "type": "integer" + }, + "gender": { + "type": "integer" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "is_ditto": { + "type": "boolean" + }, + "is_event": { + "type": "integer" + }, + "iv": { + "type": "number" + }, + "lat": { + "type": "number" + }, + "level": { + "type": "integer" + }, + "lon": { + "type": "number" + }, + "move_1": { + "type": "integer" + }, + "move_2": { + "type": "integer" + }, + "pokemon_id": { + "type": "integer" + }, + "pokestop_id": { + "type": "string" + }, + "pvp": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/gohbem.PokemonEntry" + } + } + }, + "seen_type": { + "type": "string" + }, + "shiny": { + "type": "boolean" + }, + "size": { + "type": "integer" + }, + "spawn_id": { + "type": "integer" + }, + "sta_iv": { + "type": "integer" + }, + "updated": { + "type": "integer" + }, + "username": { + "type": "string" + }, + "weather": { + "type": "integer" + }, + "weight": { + "type": "number" + } + } + }, + "decoder.ApiPokemonScan2": { + "type": "object", + "properties": { + "filters": { + "type": "array", + "items": { + "$ref": "#/definitions/decoder.ApiPokemonDnfFilter" + } + }, + "limit": { + "type": "integer" + }, + "max": { + "$ref": "#/definitions/geo.Location" + }, + "min": { + "$ref": "#/definitions/geo.Location" + } + } + }, + "geo.Location": { + "type": "object", + "properties": { + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + } + } + }, + "geojson.Feature": { + "type": "object", + "properties": { + "bbox": { + "type": "array", + "items": { + "type": "number" + } + }, + "geometry": {}, + "id": {}, + "properties": { + "$ref": "#/definitions/geojson.Properties" + }, + "type": { + "type": "string" + } + } + }, + "geojson.Properties": { + "type": "object", + "additionalProperties": true + }, + "gohbem.PokemonEntry": { + "type": "object", + "properties": { + "cap": { + "type": "number" + }, + "capped": { + "type": "boolean" + }, + "cp": { + "type": "integer" + }, + "evolution": { + "type": "integer" + }, + "form": { + "type": "integer" + }, + "level": { + "type": "number" + }, + "percentage": { + "type": "number" + }, + "pokemon": { + "type": "integer" + }, + "rank": { + "type": "integer" + }, + "value": { + "type": "number" + } + } + }, + "main.Response": { + "type": "object", + "properties": { + "data": { + "type": "string" + }, + "status": { + "type": "string", + "example": "ok" + } + } + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "", + Description: "", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 00000000..4b94f85a --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,438 @@ +{ + "swagger": "2.0", + "info": { + "contact": {} + }, + "paths": { + "/api/clear-quests": { + "post": { + "description": "Clear Quests in given Fence", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "quest" + ], + "summary": "Clear Quests", + "parameters": [ + { + "description": "Fence", + "name": "fence", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/geojson.Feature" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/main.Response" + } + } + } + } + }, + "/api/pokemon/v2/scan": { + "post": { + "description": "Scan Pokemon for given request", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pokemon" + ], + "summary": "Pokemon Scan V2", + "parameters": [ + { + "description": "Pokemon Scan2", + "name": "scan", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/decoder.ApiPokemonScan2" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/decoder.ApiPokemonResult" + } + } + } + } + } + }, + "/api/quest-status": { + "post": { + "description": "Get Status of Quests in given Fence", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "quest" + ], + "summary": "Quests Status", + "parameters": [ + { + "description": "Fence", + "name": "fence", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/geojson.Feature" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/db.QuestStatus" + } + } + } + } + } + } + }, + "definitions": { + "db.QuestStatus": { + "type": "object", + "properties": { + "ar_quests": { + "type": "integer" + }, + "no_ar_quests": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonDnfFilter": { + "type": "object", + "properties": { + "atk_iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "cp": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "def_iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "gender": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "level": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "pokemon": { + "type": "array", + "items": { + "$ref": "#/definitions/decoder.ApiPokemonDnfId" + } + }, + "pvp_great": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "pvp_little": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "pvp_ultra": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax" + }, + "size": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + }, + "sta_iv": { + "$ref": "#/definitions/decoder.ApiPokemonDnfMinMax8" + } + } + }, + "decoder.ApiPokemonDnfId": { + "type": "object", + "properties": { + "form": { + "type": "integer" + }, + "id": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonDnfMinMax": { + "type": "object", + "properties": { + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonDnfMinMax8": { + "type": "object", + "properties": { + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + } + } + }, + "decoder.ApiPokemonResult": { + "type": "object", + "properties": { + "atk_iv": { + "type": "integer" + }, + "capture_1": { + "type": "number" + }, + "capture_2": { + "type": "number" + }, + "capture_3": { + "type": "number" + }, + "cell_id": { + "type": "integer" + }, + "changed": { + "type": "integer" + }, + "costume": { + "type": "integer" + }, + "cp": { + "type": "integer" + }, + "def_iv": { + "type": "integer" + }, + "display_pokemon_id": { + "type": "integer" + }, + "distance": { + "type": "number" + }, + "encounter_weather": { + "type": "integer" + }, + "expire_timestamp": { + "type": "integer" + }, + "expire_timestamp_verified": { + "type": "boolean" + }, + "first_seen_timestamp": { + "type": "integer" + }, + "form": { + "type": "integer" + }, + "gender": { + "type": "integer" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "is_ditto": { + "type": "boolean" + }, + "is_event": { + "type": "integer" + }, + "iv": { + "type": "number" + }, + "lat": { + "type": "number" + }, + "level": { + "type": "integer" + }, + "lon": { + "type": "number" + }, + "move_1": { + "type": "integer" + }, + "move_2": { + "type": "integer" + }, + "pokemon_id": { + "type": "integer" + }, + "pokestop_id": { + "type": "string" + }, + "pvp": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/gohbem.PokemonEntry" + } + } + }, + "seen_type": { + "type": "string" + }, + "shiny": { + "type": "boolean" + }, + "size": { + "type": "integer" + }, + "spawn_id": { + "type": "integer" + }, + "sta_iv": { + "type": "integer" + }, + "updated": { + "type": "integer" + }, + "username": { + "type": "string" + }, + "weather": { + "type": "integer" + }, + "weight": { + "type": "number" + } + } + }, + "decoder.ApiPokemonScan2": { + "type": "object", + "properties": { + "filters": { + "type": "array", + "items": { + "$ref": "#/definitions/decoder.ApiPokemonDnfFilter" + } + }, + "limit": { + "type": "integer" + }, + "max": { + "$ref": "#/definitions/geo.Location" + }, + "min": { + "$ref": "#/definitions/geo.Location" + } + } + }, + "geo.Location": { + "type": "object", + "properties": { + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + } + } + }, + "geojson.Feature": { + "type": "object", + "properties": { + "bbox": { + "type": "array", + "items": { + "type": "number" + } + }, + "geometry": {}, + "id": {}, + "properties": { + "$ref": "#/definitions/geojson.Properties" + }, + "type": { + "type": "string" + } + } + }, + "geojson.Properties": { + "type": "object", + "additionalProperties": true + }, + "gohbem.PokemonEntry": { + "type": "object", + "properties": { + "cap": { + "type": "number" + }, + "capped": { + "type": "boolean" + }, + "cp": { + "type": "integer" + }, + "evolution": { + "type": "integer" + }, + "form": { + "type": "integer" + }, + "level": { + "type": "number" + }, + "percentage": { + "type": "number" + }, + "pokemon": { + "type": "integer" + }, + "rank": { + "type": "integer" + }, + "value": { + "type": "number" + } + } + }, + "main.Response": { + "type": "object", + "properties": { + "data": { + "type": "string" + }, + "status": { + "type": "string", + "example": "ok" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 00000000..841d0435 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,315 @@ +definitions: + db.QuestStatus: + properties: + ar_quests: + type: integer + no_ar_quests: + type: integer + total: + type: integer + type: object + decoder.ApiPokemonDnfFilter: + properties: + atk_iv: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + cp: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax' + def_iv: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + gender: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + iv: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + level: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + pokemon: + items: + $ref: '#/definitions/decoder.ApiPokemonDnfId' + type: array + pvp_great: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax' + pvp_little: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax' + pvp_ultra: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax' + size: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + sta_iv: + $ref: '#/definitions/decoder.ApiPokemonDnfMinMax8' + type: object + decoder.ApiPokemonDnfId: + properties: + form: + type: integer + id: + type: integer + type: object + decoder.ApiPokemonDnfMinMax: + properties: + max: + type: integer + min: + type: integer + type: object + decoder.ApiPokemonDnfMinMax8: + properties: + max: + type: integer + min: + type: integer + type: object + decoder.ApiPokemonResult: + properties: + atk_iv: + $ref: '#/definitions/null.Int' + capture_1: + $ref: '#/definitions/null.Float' + capture_2: + $ref: '#/definitions/null.Float' + capture_3: + $ref: '#/definitions/null.Float' + cell_id: + $ref: '#/definitions/null.Int' + changed: + type: integer + costume: + $ref: '#/definitions/null.Int' + cp: + $ref: '#/definitions/null.Int' + def_iv: + $ref: '#/definitions/null.Int' + display_pokemon_id: + $ref: '#/definitions/null.Int' + distance: + type: number + encounter_weather: + type: integer + expire_timestamp: + $ref: '#/definitions/null.Int' + expire_timestamp_verified: + type: boolean + first_seen_timestamp: + type: integer + form: + $ref: '#/definitions/null.Int' + gender: + $ref: '#/definitions/null.Int' + height: + $ref: '#/definitions/null.Float' + id: + type: string + is_ditto: + type: boolean + is_event: + type: integer + iv: + $ref: '#/definitions/null.Float' + lat: + type: number + level: + $ref: '#/definitions/null.Int' + lon: + type: number + move_1: + $ref: '#/definitions/null.Int' + move_2: + $ref: '#/definitions/null.Int' + pokemon_id: + type: integer + pokestop_id: + $ref: '#/definitions/null.String' + pvp: + additionalProperties: + items: + $ref: '#/definitions/gohbem.PokemonEntry' + type: array + type: object + seen_type: + $ref: '#/definitions/null.String' + shiny: + $ref: '#/definitions/null.Bool' + size: + $ref: '#/definitions/null.Int' + spawn_id: + $ref: '#/definitions/null.Int' + sta_iv: + $ref: '#/definitions/null.Int' + updated: + $ref: '#/definitions/null.Int' + username: + $ref: '#/definitions/null.String' + weather: + $ref: '#/definitions/null.Int' + weight: + $ref: '#/definitions/null.Float' + type: object + decoder.ApiPokemonScan2: + properties: + filters: + items: + $ref: '#/definitions/decoder.ApiPokemonDnfFilter' + type: array + limit: + type: integer + max: + $ref: '#/definitions/geo.Location' + min: + $ref: '#/definitions/geo.Location' + type: object + geo.Location: + properties: + latitude: + type: number + longitude: + type: number + type: object + gohbem.PokemonEntry: + properties: + cap: + type: number + capped: + type: boolean + cp: + type: integer + evolution: + type: integer + form: + type: integer + level: + type: number + percentage: + type: number + pokemon: + type: integer + rank: + type: integer + value: + type: number + type: object + main.ApiLocation: + properties: + lat: + type: number + lon: + type: number + type: object + main.GolbatFence: + properties: + fence: + items: + $ref: '#/definitions/main.ApiLocation' + type: array + type: object + main.Response: + properties: + data: + type: string + status: + type: string + type: object + null.Bool: + properties: + bool: + type: boolean + valid: + description: Valid is true if Bool is not NULL + type: boolean + type: object + null.Float: + properties: + float64: + type: number + valid: + description: Valid is true if Float64 is not NULL + type: boolean + type: object + null.Int: + properties: + int64: + type: integer + valid: + description: Valid is true if Int64 is not NULL + type: boolean + type: object + null.String: + properties: + string: + type: string + valid: + description: Valid is true if String is not NULL + type: boolean + type: object +info: + contact: {} +paths: + /api/clear-quests: + post: + consumes: + - application/json + description: Clear Quests in given Fence + parameters: + - description: Fence + in: body + name: GolbatFence + required: true + schema: + $ref: '#/definitions/main.GolbatFence' + produces: + - application/json + responses: + "200": + description: Success + schema: + $ref: '#/definitions/main.Response' + summary: Clear Quests + tags: + - quest + /api/pokemon/v2/scan: + post: + consumes: + - application/json + description: Scan Pokemon for given request + parameters: + - description: PokemonScan2 + in: body + name: decoder.ApiPokemonScan2 + required: true + schema: + $ref: '#/definitions/decoder.ApiPokemonScan2' + produces: + - application/json + responses: + "200": + description: ok + schema: + items: + $ref: '#/definitions/decoder.ApiPokemonResult' + type: array + summary: Pokemon Scan V2 + tags: + - pokemon + /api/quest-status: + post: + consumes: + - application/json + description: Get Status of Quests in given Fence + parameters: + - description: Fence + in: body + name: GolbatFence + required: true + schema: + $ref: '#/definitions/main.GolbatFence' + produces: + - application/json + responses: + "200": + description: ok + schema: + items: + $ref: '#/definitions/db.QuestStatus' + type: array + summary: Quests Status + tags: + - quest +swagger: "2.0" diff --git a/go.mod b/go.mod index c442afed..5fbc3986 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module golbat go 1.22 + toolchain go1.22.6 require ( @@ -27,6 +28,9 @@ require ( github.com/ringsaturn/tzf v0.15.0 github.com/ringsaturn/tzf-rel v0.0.2024-a github.com/sirupsen/logrus v1.9.3 + github.com/swaggo/files v1.0.1 + github.com/swaggo/gin-swagger v1.6.0 + github.com/swaggo/swag v1.16.3 github.com/tidwall/rtree v1.10.0 github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f google.golang.org/grpc v1.65.0 @@ -37,6 +41,9 @@ require ( require ( filippo.io/edwards25519 v1.1.0 // indirect + github.com/KyleBanks/depth v1.2.1 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bytedance/sonic v1.12.1 // indirect github.com/bytedance/sonic/loader v0.2.0 // indirect @@ -47,6 +54,10 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.5 // indirect github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/spec v0.20.4 // indirect + github.com/go-openapi/swag v0.19.15 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.22.0 // indirect @@ -54,10 +65,12 @@ require ( github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -85,6 +98,8 @@ require ( golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect + golang.org/x/tools v0.24.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240820151423-278611b39280 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 53f9645b..c29d27d8 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,14 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25 github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Depado/ginprom v1.8.1 h1:lrQTddbRqlHq1j6SpJDySDumJlR7FEybzdX0PS3HXPc= github.com/Depado/ginprom v1.8.1/go.mod h1:9Z+ahPJLSeMndDfnDTfiuBn2SKVAuL2yvihApWzof9A= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/UnownHash/gohbem v0.11.3 h1:ffl+EMsp74GoSReJ+O2LSFwTeBVL/vHRnz0Yf6h77GY= github.com/UnownHash/gohbem v0.11.3/go.mod h1:I7SrAlxOo56fGlUD7pLtitcGcmRd7rr9/HWpgmseqSc= github.com/appleboy/gofight/v2 v2.1.2 h1:VOy3jow4vIK8BRQJoC/I9muxyYlJ2yb9ht2hZoS3rf4= @@ -23,6 +29,7 @@ github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/ github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -45,12 +52,24 @@ github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8 github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4= github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg= +github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= +github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -91,6 +110,8 @@ github.com/jellydator/ttlcache/v3 v3.2.0 h1:6lqVJ8X3ZaUwvzENqPAobDsXNExfUJd61u++ github.com/jellydator/ttlcache/v3 v3.2.0/go.mod h1:hi7MGFdMAwZna5n2tuvh63DvFLzVKySzCVW6+0gA2n4= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -127,6 +148,11 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/loov/hrtime v1.0.3 h1:LiWKU3B9skJwRPUf0Urs9+0+OE3TxdMuiRPOTwR0gcU= github.com/loov/hrtime v1.0.3/go.mod h1:yDY3Pwv2izeY4sq7YcPX/dtLwzg5NU1AxWuWxKwd0p0= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= @@ -149,6 +175,7 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nmvalera/striped-mutex v0.1.0 h1:+fwhVWGAsgkiOqmZGZ0HzDD3p/CEt3S85wf0YnMUpL0= github.com/nmvalera/striped-mutex v0.1.0/go.mod h1:D22iujuGIgMJ/2xSnQDK0I3kh0t3ZOiao5VPYBbq1O0= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -204,6 +231,12 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= +github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= +github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= +github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= +github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= +github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/tidwall/cities v0.1.0 h1:CVNkmMf7NEC9Bvokf5GoSsArHCKRMTgLuubRTHnH0mE= github.com/tidwall/cities v0.1.0/go.mod h1:lV/HDp2gCcRcHJWqgt6Di54GiDrTZwh1aG2ZUPNbqa4= github.com/tidwall/geoindex v1.4.4/go.mod h1:rvVVNEFfkJVWGUdEfU8QaoOg/9zFX0h9ofWzA60mz1I= @@ -236,6 +269,7 @@ github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgk github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= go.mongodb.org/mongo-driver v1.16.1 h1:rIVLL3q0IHM39dvE+z2ulZLp9ENZKThVfuvN/IiN4l8= go.mongodb.org/mongo-driver v1.16.1/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw= @@ -248,6 +282,7 @@ golang.org/x/arch v0.9.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= @@ -255,43 +290,56 @@ golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDT golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/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.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -308,13 +356,18 @@ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6h google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg= gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index d3115985..4d95fc6e 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,8 @@ import ( _ "github.com/golang-migrate/migrate/v4/source/file" "github.com/jmoiron/sqlx" log "github.com/sirupsen/logrus" + swaggerfiles "github.com/swaggo/files" + ginSwagger "github.com/swaggo/gin-swagger" ginlogrus "github.com/toorop/gin-logrus" "google.golang.org/grpc" "google.golang.org/protobuf/proto" @@ -256,6 +258,7 @@ func main() { r.POST("/raw", Raw) r.GET("/health", GetHealth) + r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler)) apiGroup := r.Group("/api", AuthRequired()) apiGroup.GET("/health", GetHealth) diff --git a/routes.go b/routes.go index 94df24c1..a3740bc2 100644 --- a/routes.go +++ b/routes.go @@ -317,6 +317,17 @@ func AuthRequired() gin.HandlerFunc { } } +// @BasePath /api + +// @Summary Clear Quests +// @Schemes +// @Description Clear Quests in given Fence +// @Tags quest +// @Accept json +// @Produce json +// @Param fence body geojson.Feature true "Fence" +// @Success 200 {object} Response "Success" +// @Router /api/clear-quests [post] func ClearQuests(c *gin.Context) { fence, err := geo.NormaliseFenceRequest(c) @@ -334,17 +345,13 @@ func ClearQuests(c *gin.Context) { decoder.ClearQuestsWithinGeofence(ctx, dbDetails, fence) log.Infof("Clear quest took %s", time.Since(startTime)) - c.JSON(http.StatusAccepted, map[string]interface{}{ - "status": "ok", - }) + c.JSON(http.StatusAccepted, &Response{Status: "ok"}) } func ReloadGeojson(c *gin.Context) { decoder.ReloadGeofenceAndClearStats() - c.JSON(http.StatusAccepted, map[string]interface{}{ - "status": "ok", - }) + c.JSON(http.StatusAccepted, &Response{Status: "ok"}) } func PokemonScan(c *gin.Context) { @@ -364,6 +371,17 @@ func PokemonScan(c *gin.Context) { c.JSON(http.StatusAccepted, res) } +// @BasePath /api + +// @Summary Pokemon Scan V2 +// @Schemes +// @Description Scan Pokemon for given request +// @Tags pokemon +// @Accept json +// @Produce json +// @Param scan body decoder.ApiPokemonScan2 true "Pokemon Scan2" +// @Success 200 {array} decoder.ApiPokemonResult "ok" +// @Router /api/pokemon/v2/scan [post] func PokemonScan2(c *gin.Context) { var requestBody decoder.ApiPokemonScan2 @@ -423,6 +441,17 @@ func PokemonSearch(c *gin.Context) { c.JSON(http.StatusAccepted, res) } +// @BasePath /api + +// @Summary Quests Status +// @Schemes +// @Description Get Status of Quests in given Fence +// @Tags quest +// @Accept json +// @Produce json +// @Param fence body geojson.Feature true "Fence" +// @Success 200 {array} db.QuestStatus "ok" +// @Router /api/quest-status [post] func GetQuestStatus(c *gin.Context) { fence, err := geo.NormaliseFenceRequest(c) @@ -478,3 +507,8 @@ func GetPokestop(c *gin.Context) { func GetDevices(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"devices": GetAllDevices()}) } + +type Response struct { + Status string `json:"status" example:"ok"` + Data *string `json:"data"` +}