Swagger docs
This commit is contained in:
@ -6,6 +6,14 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// Ping godoc
|
||||
// @Summary Ping the server
|
||||
// @Description Get a pong response
|
||||
// @Tags ping
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {string} string "Pong!"
|
||||
// @Router /ping [get]
|
||||
func Ping(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Pong!")
|
||||
}
|
||||
|
@ -6,6 +6,14 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// PostCopy godoc
|
||||
// @Summary Get copy icon SVG
|
||||
// @Description Returns an SVG of a copy icon
|
||||
// @Tags post
|
||||
// @Accept json
|
||||
// @Produce html
|
||||
// @Success 200 {string} string "SVG content"
|
||||
// @Router /post/copy [get]
|
||||
func PostCopy(c echo.Context) error {
|
||||
return c.String(http.StatusOK, `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`)
|
||||
}
|
||||
|
@ -1,5 +1,14 @@
|
||||
package api
|
||||
|
||||
// RSSFeedHandler godoc
|
||||
// @Summary Get RSS feed
|
||||
// @Description Returns an RSS feed of blog posts
|
||||
// @Tags rss
|
||||
// @Accept json
|
||||
// @Produce xml
|
||||
// @Success 200 {string} string "RSS feed content"
|
||||
// @Failure 500 {string} string "Internal Server Error"
|
||||
// @Router /rss [get]
|
||||
import (
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
@ -8,6 +8,15 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// SSE godoc
|
||||
// @Summary Server-Sent Events endpoint
|
||||
// @Description Establishes a Server-Sent Events connection
|
||||
// @Tags sse
|
||||
// @Accept json
|
||||
// @Produce text/event-stream
|
||||
// @Param channel query string false "Channel name"
|
||||
// @Success 200 {string} string "Event stream"
|
||||
// @Router /sse [get]
|
||||
func SSE(c echo.Context) error {
|
||||
channel := c.QueryParam("channel")
|
||||
if channel == "" {
|
||||
|
@ -9,6 +9,19 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// ResizeHandler godoc
|
||||
// @Summary Resize an image
|
||||
// @Description Resizes an uploaded image to specified dimensions
|
||||
// @Tags tools
|
||||
// @Accept mpfd
|
||||
// @Produce png
|
||||
// @Param image formData file true "Image file to resize"
|
||||
// @Param width formData int true "Target width"
|
||||
// @Param height formData int true "Target height"
|
||||
// @Success 200 {file} binary "Resized image"
|
||||
// @Failure 400 {string} string "Bad request"
|
||||
// @Failure 500 {string} string "Internal server error"
|
||||
// @Router /tools/resize [post]
|
||||
func ResizeHandler(c echo.Context) error {
|
||||
|
||||
// Extract file from request
|
||||
|
@ -7,6 +7,17 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// SSEDemoSend godoc
|
||||
// @Summary Send SSE message
|
||||
// @Description Sends a message to a specified SSE channel
|
||||
// @Tags sse,tools
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param channel query string false "Channel name"
|
||||
// @Param message query string false "Message to send"
|
||||
// @Success 200 {object} map[string]string
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Router /tools/sendsse [post]
|
||||
func SSEDemoSend(c echo.Context) error {
|
||||
channel := c.QueryParam("channel")
|
||||
if channel == "" {
|
||||
|
Reference in New Issue
Block a user