Freshly generated swagger docs

This commit is contained in:
Imbus 2024-03-29 18:43:26 +01:00
parent 87a19bfd4e
commit f1e15137d6

View file

@ -21,21 +21,21 @@ const docTemplate = `{
"paths": {
"/login": {
"post": {
"description": "logs the user in and returns a jwt token",
"description": "Logs in a user and returns a JWT token",
"consumes": [
"application/json"
],
"produces": [
"text/plain"
"application/json"
],
"tags": [
"User"
"Auth"
],
"summary": "login",
"summary": "Login",
"parameters": [
{
"description": "login info",
"name": "NewUser",
"description": "User credentials",
"name": "body",
"in": "body",
"required": true,
"schema": {
@ -45,9 +45,9 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "Successfully signed token for user",
"description": "JWT token",
"schema": {
"type": "Token"
"$ref": "#/definitions/types.Token"
}
},
"400": {
@ -71,29 +71,26 @@ const docTemplate = `{
}
}
},
"/loginerenew": {
"/loginrenew": {
"post": {
"security": [
{
"bererToken": []
"JWT": []
}
],
"description": "renews the users token",
"consumes": [
"description": "Renews the users token.",
"produces": [
"application/json"
],
"produces": [
"text/plain"
],
"tags": [
"User"
"Auth"
],
"summary": "LoginRenews",
"responses": {
"200": {
"description": "Successfully signed token for user",
"schema": {
"type": "Token"
"$ref": "#/definitions/types.Token"
}
},
"401": {
@ -113,7 +110,12 @@ const docTemplate = `{
},
"/promoteToAdmin": {
"post": {
"description": "promote chosen user to admin",
"security": [
{
"JWT": []
}
],
"description": "Promote chosen user to site admin",
"consumes": [
"application/json"
],
@ -139,7 +141,7 @@ const docTemplate = `{
"200": {
"description": "Successfully promoted user",
"schema": {
"type": "json"
"$ref": "#/definitions/types.Token"
}
},
"400": {
@ -173,7 +175,7 @@ const docTemplate = `{
"text/plain"
],
"tags": [
"User"
"Auth"
],
"summary": "Register",
"parameters": [
@ -211,6 +213,11 @@ const docTemplate = `{
},
"/userdelete/{username}": {
"delete": {
"security": [
{
"JWT": []
}
],
"description": "UserDelete deletes a user from the database",
"consumes": [
"application/json"
@ -252,12 +259,14 @@ const docTemplate = `{
},
"/users/all": {
"get": {
"description": "lists all users",
"consumes": [
"application/json"
"security": [
{
"JWT": []
}
],
"description": "lists all users",
"produces": [
"text/plain"
"application/json"
],
"tags": [
"User"
@ -265,9 +274,12 @@ const docTemplate = `{
"summary": "ListsAllUsers",
"responses": {
"200": {
"description": "Successfully signed token for user",
"description": "Successfully returned all users",
"schema": {
"type": "json"
"type": "array",
"items": {
"type": "string"
}
}
},
"401": {
@ -291,16 +303,27 @@ const docTemplate = `{
"type": "object",
"properties": {
"password": {
"type": "string"
"type": "string",
"example": "password123"
},
"username": {
"type": "string",
"example": "username123"
}
}
},
"types.Token": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"bererToken": {
"JWT": {
"description": "Use the JWT token provided by the login endpoint to authenticate requests. **Prefix the token with \"Bearer \".**",
"type": "apiKey",
"name": "Authorization",
"in": "header"