Adding swagger annotations to core

This commit is contained in:
🐙PiperYxzzy
2022-05-05 23:11:24 +02:00
parent d2dcd8c94b
commit 99402ebdf0
7 changed files with 907 additions and 5 deletions

304
docs/docs.go Normal file
View File

@@ -0,0 +1,304 @@
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
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": {
"/adm/doot": {
"get": {
"description": "admin ping and login check",
"summary": "ping example",
"parameters": [
{
"type": "string",
"description": "JWT Cookie set by /admin",
"name": "jwt",
"in": "header",
"required": true
}
],
"responses": {}
}
},
"/admin": {
"post": {
"description": "Secured login for any user accounts",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "User login",
"parameters": [
{
"description": "user email",
"name": "userkey",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "user password",
"name": "password",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "the 2fa token",
"name": "twofactorcode",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"headers": {
"jwt": {
"type": "string",
"description": "The authentication token for this session, valid for 24h"
}
}
},
"400": {
"description": "userkey, 2fa token or password missing"
},
"401": {
"description": "not found or credentials invalid"
}
}
}
},
"/doot": {
"get": {
"description": "unauthenticated ping",
"summary": "ping example",
"responses": {}
}
},
"/forgot": {
"post": {
"description": "Request a password reset for the provided userkey",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Forgot password",
"parameters": [
{
"description": "user email to reset",
"name": "userkey",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "userkey not provided"
}
}
}
},
"/login": {
"post": {
"description": "Secured login for any user accounts",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "User login",
"parameters": [
{
"description": "user email",
"name": "userkey",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "user password",
"name": "password",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "the 2fa token for the user, if activated",
"name": "twofactorcode",
"in": "body",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"headers": {
"jwt": {
"type": "string",
"description": "The authentication token for this session, valid for 24h"
}
}
},
"400": {
"description": "userkey or password missing"
},
"401": {
"description": "not found or credentials invalid"
}
}
}
},
"/reset": {
"post": {
"description": "Use a JWT token to validate and reset a password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Password reset",
"parameters": [
{
"description": "the token emailed to the user",
"name": "token",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "the new password value",
"name": "password",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "token and password not provided"
},
"401": {
"description": "bad token or user not found"
}
}
}
},
"/sec/doot": {
"get": {
"description": "user ping and login check",
"summary": "ping example",
"parameters": [
{
"type": "string",
"description": "JWT Cookie set by /login",
"name": "jwt",
"in": "header",
"required": true
}
],
"responses": {}
}
},
"/signup": {
"post": {
"description": "Sign a user up for a new account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "User signup",
"parameters": [
{
"description": "user email",
"name": "userkey",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "user password",
"name": "password",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "userkey missing, or password missing or not strong enough"
}
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1",
Host: "",
BasePath: "/v1",
Schemes: []string{},
Title: "Go-Gin Prepack",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}