diff --git a/.gitignore b/.gitignore index 04eacc9..091bd58 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ __debug_bin .env .idea output -docs \ No newline at end of file diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 0000000..0917acc --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,185 @@ +// 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}}", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "http://www.swagger.io/support", + "email": "support@swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/health/getHealth": { + "get": { + "description": "Get the health of the API", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "health" + ], + "summary": "Generate Health status", + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/openai/general": { + "get": { + "description": "Ask ChatGPT a general question", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "openai" + ], + "summary": "Gerneral ChatGPT", + "parameters": [ + { + "type": "string", + "description": "Ask ChatGPT a general question", + "name": "message", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/openai/travelagent": { + "get": { + "description": "Ask ChatGPT for suggestions as if it was a travel agent", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "openai" + ], + "summary": "Travel Agent ChatGPT", + "parameters": [ + { + "type": "string", + "description": "Ask ChatGPT for suggestions as a travel agent", + "name": "message", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/token/GenerateToken": { + "get": { + "description": "Get the health of the API", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "token" + ], + "summary": "Generate Health status", + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/unraid/powerusage": { + "get": { + "description": "Gets the PSU Data from unraid", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "unraid" + ], + "summary": "Unraid PSU Stats", + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "durpapi.durp.info", + BasePath: "/api/v1", + Schemes: []string{}, + Title: "DurpAPI", + Description: "API for Durp's needs", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..7bd8a61 --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,162 @@ +{ + "swagger": "2.0", + "info": { + "description": "API for Durp's needs", + "title": "DurpAPI", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "http://www.swagger.io/support", + "email": "support@swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0" + }, + "host": "durpapi.durp.info", + "basePath": "/api/v1", + "paths": { + "/health/getHealth": { + "get": { + "description": "Get the health of the API", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "health" + ], + "summary": "Generate Health status", + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/openai/general": { + "get": { + "description": "Ask ChatGPT a general question", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "openai" + ], + "summary": "Gerneral ChatGPT", + "parameters": [ + { + "type": "string", + "description": "Ask ChatGPT a general question", + "name": "message", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/openai/travelagent": { + "get": { + "description": "Ask ChatGPT for suggestions as if it was a travel agent", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "openai" + ], + "summary": "Travel Agent ChatGPT", + "parameters": [ + { + "type": "string", + "description": "Ask ChatGPT for suggestions as a travel agent", + "name": "message", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/token/GenerateToken": { + "get": { + "description": "Get the health of the API", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "token" + ], + "summary": "Generate Health status", + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + }, + "/unraid/powerusage": { + "get": { + "description": "Gets the PSU Data from unraid", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "unraid" + ], + "summary": "Unraid PSU Stats", + "responses": { + "200": { + "description": "response", + "schema": { + "type": "string" + } + } + } + } + } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..f036e0d --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,108 @@ +basePath: /api/v1 +host: durpapi.durp.info +info: + contact: + email: support@swagger.io + name: API Support + url: http://www.swagger.io/support + description: API for Durp's needs + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + termsOfService: http://swagger.io/terms/ + title: DurpAPI + version: "1.0" +paths: + /health/getHealth: + get: + consumes: + - application/json + description: Get the health of the API + produces: + - application/json + responses: + "200": + description: response + schema: + type: string + summary: Generate Health status + tags: + - health + /openai/general: + get: + consumes: + - application/json + description: Ask ChatGPT a general question + parameters: + - description: Ask ChatGPT a general question + in: query + name: message + required: true + type: string + produces: + - text/plain + responses: + "200": + description: response + schema: + type: string + summary: Gerneral ChatGPT + tags: + - openai + /openai/travelagent: + get: + consumes: + - application/json + description: Ask ChatGPT for suggestions as if it was a travel agent + parameters: + - description: Ask ChatGPT for suggestions as a travel agent + in: query + name: message + required: true + type: string + produces: + - text/plain + responses: + "200": + description: response + schema: + type: string + summary: Travel Agent ChatGPT + tags: + - openai + /token/GenerateToken: + get: + consumes: + - application/json + description: Get the health of the API + produces: + - application/json + responses: + "200": + description: response + schema: + type: string + summary: Generate Health status + tags: + - token + /unraid/powerusage: + get: + consumes: + - application/json + description: Gets the PSU Data from unraid + produces: + - application/json + responses: + "200": + description: response + schema: + type: string + summary: Unraid PSU Stats + tags: + - unraid +securityDefinitions: + ApiKeyAuth: + in: header + name: Authorization + type: apiKey +swagger: "2.0"