467 lines
15 KiB
Go
Raw Normal View History

// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {
"name": "MIT",
"url": "https://github.com/h44z/wg-portal/blob/master/LICENSE.txt"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/user/{email}": {
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"summary": "Retrieves user based on given Email",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"put": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"summary": "Updates a user based on the given user model",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"delete": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"summary": "Deletes the specified user",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"patch": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"summary": "Updates a user based on the given partial user model",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
"/users": {
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"summary": "Retrieves all users",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/users.User"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"post": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"summary": "Creates a new user based on the given user model",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
}
},
"definitions": {
"gorm.DeletedAt": {
"type": "object",
"properties": {
"time": {
"type": "string"
},
"valid": {
"description": "Valid is true if Time is not NULL",
"type": "boolean"
}
}
},
"server.ApiError": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"users.User": {
"type": "object",
"required": [
"email",
"firstname",
"lastname"
],
"properties": {
"createdAt": {
"description": "database internal fields",
"type": "string"
},
"deletedAt": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"email": {
"description": "required fields",
"type": "string"
},
"firstname": {
"description": "optional fields",
"type": "string"
},
"isAdmin": {
"type": "boolean"
},
"lastname": {
"type": "string"
},
"password": {
"description": "optional, integrated password authentication",
"type": "string"
},
"phone": {
"type": "string"
},
"source": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"ApiBasicAuth": {
"type": "basic"
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "",
BasePath: "/api/v1",
Schemes: []string{},
Title: "WireGuard Portal API",
Description: "WireGuard Portal API for managing users and peers.",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}