From 332a6e0a8541505ede961cceb117cf96b6afcf71 Mon Sep 17 00:00:00 2001 From: Aleksandr Soloshenko Date: Sun, 14 Sep 2025 08:47:13 +0300 Subject: [PATCH] [handlers] fix inbox export path --- .../sms-gateway/handlers/messages/3rdparty.go | 2 +- internal/sms-gateway/openapi/docs.go | 126 +++++++++--------- 2 files changed, 65 insertions(+), 63 deletions(-) diff --git a/internal/sms-gateway/handlers/messages/3rdparty.go b/internal/sms-gateway/handlers/messages/3rdparty.go index 631b726..0ba73be 100644 --- a/internal/sms-gateway/handlers/messages/3rdparty.go +++ b/internal/sms-gateway/handlers/messages/3rdparty.go @@ -246,7 +246,7 @@ func (h *ThirdPartyController) get(user models.User, c *fiber.Ctx) error { // @Failure 400 {object} smsgateway.ErrorResponse "Invalid request" // @Failure 401 {object} smsgateway.ErrorResponse "Unauthorized" // @Failure 500 {object} smsgateway.ErrorResponse "Internal server error" -// @Router /3rdparty/v1/inbox/export [post] +// @Router /3rdparty/v1/messages/inbox/export [post] // // Export inbox func (h *ThirdPartyController) postInboxExport(user models.User, c *fiber.Ctx) error { diff --git a/internal/sms-gateway/openapi/docs.go b/internal/sms-gateway/openapi/docs.go index 7eb180f..d86627b 100644 --- a/internal/sms-gateway/openapi/docs.go +++ b/internal/sms-gateway/openapi/docs.go @@ -147,64 +147,6 @@ const docTemplate = `{ } } }, - "/3rdparty/v1/inbox/export": { - "post": { - "security": [ - { - "ApiAuth": [] - } - ], - "description": "Initiates process of inbox messages export via webhooks. For each message the ` + "`" + `sms:received` + "`" + ` webhook will be triggered. The webhooks will be triggered without specific order.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "User", - "Messages" - ], - "summary": "Request inbox messages export", - "parameters": [ - { - "description": "Export inbox request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/smsgateway.MessagesExportRequest" - } - } - ], - "responses": { - "202": { - "description": "Inbox export request accepted", - "schema": { - "type": "object" - } - }, - "400": { - "description": "Invalid request", - "schema": { - "$ref": "#/definitions/smsgateway.ErrorResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/smsgateway.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/smsgateway.ErrorResponse" - } - } - } - } - }, "/3rdparty/v1/logs": { "get": { "security": [ @@ -439,6 +381,64 @@ const docTemplate = `{ } } }, + "/3rdparty/v1/messages/inbox/export": { + "post": { + "security": [ + { + "ApiAuth": [] + } + ], + "description": "Initiates process of inbox messages export via webhooks. For each message the ` + "`" + `sms:received` + "`" + ` webhook will be triggered. The webhooks will be triggered without specific order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User", + "Messages" + ], + "summary": "Request inbox messages export", + "parameters": [ + { + "description": "Export inbox request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/smsgateway.MessagesExportRequest" + } + } + ], + "responses": { + "202": { + "description": "Inbox export request accepted", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Invalid request", + "schema": { + "$ref": "#/definitions/smsgateway.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/smsgateway.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/smsgateway.ErrorResponse" + } + } + } + } + }, "/3rdparty/v1/messages/{id}": { "get": { "security": [ @@ -1368,7 +1368,7 @@ const docTemplate = `{ "type": "object", "properties": { "passphrase": { - "description": "Passphrase is the encryption passphrase. If nil or empty, encryption is disabled.", + "description": "Passphrase is the encryption passphrase. If nil or empty, encryption is disabled. Must not be used with Cloud Server.", "type": "string" } } @@ -1470,7 +1470,7 @@ const docTemplate = `{ "minimum": 1 }, "signing_key": { - "description": "SigningKey is the secret key used for signing webhook payloads.", + "description": "SigningKey is the secret key used for signing webhook payloads. Must not be used with Cloud Server.", "type": "string" } } @@ -1546,7 +1546,8 @@ const docTemplate = `{ "sms:sent", "sms:delivered", "sms:failed", - "system:ping" + "system:ping", + "mms:received" ], "x-enum-varnames": [ "WebhookEventSmsReceived", @@ -1554,7 +1555,8 @@ const docTemplate = `{ "WebhookEventSmsSent", "WebhookEventSmsDelivered", "WebhookEventSmsFailed", - "WebhookEventSystemPing" + "WebhookEventSystemPing", + "WebhookEventMmsReceived" ] } },