Swagger docs

This commit is contained in:
2024-10-20 16:16:50 -06:00
parent 3cbd0d1806
commit e2e736e500
12 changed files with 667 additions and 1 deletions

222
docs/docs.go Normal file
View File

@ -0,0 +1,222 @@
// Package docs 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}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/ping": {
"get": {
"description": "Get a pong response",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ping"
],
"summary": "Ping the server",
"responses": {
"200": {
"description": "Pong!",
"schema": {
"type": "string"
}
}
}
}
},
"/post/copy": {
"get": {
"description": "Returns an SVG of a copy icon",
"consumes": [
"application/json"
],
"produces": [
"text/html"
],
"tags": [
"post"
],
"summary": "Get copy icon SVG",
"responses": {
"200": {
"description": "SVG content",
"schema": {
"type": "string"
}
}
}
}
},
"/sse": {
"get": {
"description": "Establishes a Server-Sent Events connection",
"consumes": [
"application/json"
],
"produces": [
"text/event-stream"
],
"tags": [
"sse"
],
"summary": "Server-Sent Events endpoint",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
}
],
"responses": {
"200": {
"description": "Event stream",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/resize": {
"post": {
"description": "Resizes an uploaded image to specified dimensions",
"consumes": [
"multipart/form-data"
],
"produces": [
"image/png"
],
"tags": [
"tools"
],
"summary": "Resize an image",
"parameters": [
{
"type": "file",
"description": "Image file to resize",
"name": "image",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target width",
"name": "width",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target height",
"name": "height",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "Resized image",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/sendsse": {
"post": {
"description": "Sends a message to a specified SSE channel",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sse",
"tools"
],
"summary": "Send SSE message",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
},
{
"type": "string",
"description": "Message to send",
"name": "message",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:3000",
BasePath: "/api",
Schemes: []string{},
Title: "Atri.dad API",
Description: "This is the API for atri.dad",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

198
docs/swagger.json Normal file
View File

@ -0,0 +1,198 @@
{
"swagger": "2.0",
"info": {
"description": "This is the API for atri.dad",
"title": "Atri.dad API",
"contact": {},
"version": "1.0"
},
"host": "localhost:3000",
"basePath": "/api",
"paths": {
"/ping": {
"get": {
"description": "Get a pong response",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ping"
],
"summary": "Ping the server",
"responses": {
"200": {
"description": "Pong!",
"schema": {
"type": "string"
}
}
}
}
},
"/post/copy": {
"get": {
"description": "Returns an SVG of a copy icon",
"consumes": [
"application/json"
],
"produces": [
"text/html"
],
"tags": [
"post"
],
"summary": "Get copy icon SVG",
"responses": {
"200": {
"description": "SVG content",
"schema": {
"type": "string"
}
}
}
}
},
"/sse": {
"get": {
"description": "Establishes a Server-Sent Events connection",
"consumes": [
"application/json"
],
"produces": [
"text/event-stream"
],
"tags": [
"sse"
],
"summary": "Server-Sent Events endpoint",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
}
],
"responses": {
"200": {
"description": "Event stream",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/resize": {
"post": {
"description": "Resizes an uploaded image to specified dimensions",
"consumes": [
"multipart/form-data"
],
"produces": [
"image/png"
],
"tags": [
"tools"
],
"summary": "Resize an image",
"parameters": [
{
"type": "file",
"description": "Image file to resize",
"name": "image",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target width",
"name": "width",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target height",
"name": "height",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "Resized image",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/sendsse": {
"post": {
"description": "Sends a message to a specified SSE channel",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sse",
"tools"
],
"summary": "Send SSE message",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
},
{
"type": "string",
"description": "Message to send",
"name": "message",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
}

131
docs/swagger.yaml Normal file
View File

@ -0,0 +1,131 @@
basePath: /api
host: localhost:3000
info:
contact: {}
description: This is the API for atri.dad
title: Atri.dad API
version: "1.0"
paths:
/ping:
get:
consumes:
- application/json
description: Get a pong response
produces:
- application/json
responses:
"200":
description: Pong!
schema:
type: string
summary: Ping the server
tags:
- ping
/post/copy:
get:
consumes:
- application/json
description: Returns an SVG of a copy icon
produces:
- text/html
responses:
"200":
description: SVG content
schema:
type: string
summary: Get copy icon SVG
tags:
- post
/sse:
get:
consumes:
- application/json
description: Establishes a Server-Sent Events connection
parameters:
- description: Channel name
in: query
name: channel
type: string
produces:
- text/event-stream
responses:
"200":
description: Event stream
schema:
type: string
summary: Server-Sent Events endpoint
tags:
- sse
/tools/resize:
post:
consumes:
- multipart/form-data
description: Resizes an uploaded image to specified dimensions
parameters:
- description: Image file to resize
in: formData
name: image
required: true
type: file
- description: Target width
in: formData
name: width
required: true
type: integer
- description: Target height
in: formData
name: height
required: true
type: integer
produces:
- image/png
responses:
"200":
description: Resized image
schema:
type: file
"400":
description: Bad request
schema:
type: string
"500":
description: Internal server error
schema:
type: string
summary: Resize an image
tags:
- tools
/tools/sendsse:
post:
consumes:
- application/json
description: Sends a message to a specified SSE channel
parameters:
- description: Channel name
in: query
name: channel
type: string
- description: Message to send
in: query
name: message
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
summary: Send SSE message
tags:
- sse
- tools
swagger: "2.0"