Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
Fix documentation
Acho Arnold23a3688b9488
diff --git a/api/pkg/handlers/handler.go b/api/pkg/handlers/handler.goindex a4c23c8c..53d7af08 100644--- a/api/pkg/handlers/handler.go+++ b/api/pkg/handlers/handler.go@@ -9,11 +9,11 @@ import (// handler is the base struct for handling requeststype handler struct{}-func (h *handler) responseBadRequest(c *fiber.Ctx, payload any) error {+func (h *handler) responseBadRequest(c *fiber.Ctx, err error) error {return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"status": "error","message": "The request isn't properly formed",- "data": payload,+ "data": err,})}diff --git a/api/pkg/handlers/message_handler.go b/api/pkg/handlers/message_handler.goindex 24277468..91f0eea1 100644--- a/api/pkg/handlers/message_handler.go+++ b/api/pkg/handlers/message_handler.go@@ -43,6 +43,9 @@ func NewMessageHandler(// @Accept json// @Produce json// @Success 200 {object} responses.MessageResponse+// @Success 400 {object} responses.BadRequest+// @Success 422 {object} responses.UnprocessableEntity+// @Success 500 {object} responses.InternalServerError// @Router /messages/send [post]func (h *MessageHandler) Send(c *fiber.Ctx) error {ctx, span := h.tracer.StartFromFiberCtx(c)diff --git a/api/pkg/responses/response.go b/api/pkg/responses/response.goindex 2a9d7156..f478f93f 100644--- a/api/pkg/responses/response.go+++ b/api/pkg/responses/response.go@@ -4,3 +4,23 @@ type response struct {Status string `json:"status" example:"success"`Message string `json:"message" example:"item created successfully"`}++// InternalServerError is the response with status code is 500+type InternalServerError struct {+ Status string `json:"status" example:"error"`+ Message string `json:"message" example:"We ran into an internal error while handling the request."`+}++// BadRequest is the response with status code is 400+type BadRequest struct {+ Status string `json:"status" example:"error"`+ Message string `json:"message" example:"The request isn't properly formed"`+ Data string `json:"data" example:"The request body is not a valid JSON string"`+}++// UnprocessableEntity is the response with status code is 422+type UnprocessableEntity struct {+ Status string `json:"status" example:"error"`+ Message string `json:"message" example:"validation errors while sending message"`+ Data map[string][]string `json:"data"`+}