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