Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix swagger

Acho Arnold9528b392595b
diff --git a/api/docs/docs.go b/api/docs/docs.go
index 26545bdb..ab5a4ea6 100644
--- a/api/docs/docs.go
+++ b/api/docs/docs.go
@@ -1,5 +1,4 @@
-// Package docs GENERATED BY SWAG; DO NOT EDIT
-// This file was generated by swaggo/swag
+// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
@@ -1429,6 +1428,72 @@ const docTemplate = `{
}
},
"/messages/{messageID}": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get a message from the database by the message ID.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Messages"
+ ],
+ "summary": "Get a message from the database.",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ },
"delete": {
"security": [
{
@@ -2390,6 +2455,13 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/requests.UserPaymentInvoice"
}
+ },
+ {
+ "type": "string",
+ "description": "ID of the subscription invoice to generate the PDF for",
+ "name": "subscriptionInvoiceID",
+ "in": "path",
+ "required": true
}
],
"responses": {
@@ -2611,6 +2683,68 @@ const docTemplate = `{
}
}
},
+ "/v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}": {
+ "get": {
+ "description": "Download an MMS attachment by its path components",
+ "produces": [
+ "application/octet-stream"
+ ],
+ "tags": [
+ "Attachments"
+ ],
+ "summary": "Download a message attachment",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "User ID",
+ "name": "userID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Message ID",
+ "name": "messageID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Attachment index",
+ "name": "attachmentIndex",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Filename with extension",
+ "name": "filename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "file"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
"/webhooks": {
"get": {
"security": [
@@ -3014,6 +3148,7 @@ const docTemplate = `{
"entities.Message": {
"type": "object",
"required": [
+ "attachments",
"contact",
"content",
"created_at",
@@ -3031,6 +3166,16 @@ const docTemplate = `{
"user_id"
],
"properties": {
+ "attachments": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "https://example.com/image.jpg",
+ "https://example.com/video.mp4"
+ ]
+ },
"contact": {
"type": "string",
"example": "+18005550100"
@@ -3118,7 +3263,11 @@ const docTemplate = `{
},
"sim": {
"description": "SIM is the SIM card to use to send the message\n* SMS1: use the SIM card in slot 1\n* SMS2: use the SIM card in slot 2\n* DEFAULT: used the default communication SIM card",
- "type": "string",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SIM"
+ }
+ ],
"example": "DEFAULT"
},
"status": {
@@ -3254,8 +3403,7 @@ const docTemplate = `{
"example": "+18005550199"
},
"sim": {
- "description": "SIM card that received the message",
- "type": "string"
+ "$ref": "#/definitions/entities.SIM"
},
"updated_at": {
"type": "string",
@@ -3331,6 +3479,46 @@ const docTemplate = `{
}
}
},
+ "entities.SIM": {
+ "type": "string",
+ "enum": [
+ "SIM1",
+ "SIM2"
+ ],
+ "x-enum-varnames": [
+ "SIM1",
+ "SIM2"
+ ]
+ },
+ "entities.SubscriptionName": {
+ "type": "string",
+ "enum": [
+ "free",
+ "pro-monthly",
+ "pro-yearly",
+ "ultra-monthly",
+ "ultra-yearly",
+ "pro-lifetime",
+ "20k-monthly",
+ "100k-monthly",
+ "50k-monthly",
+ "200k-monthly",
+ "20k-yearly"
+ ],
+ "x-enum-varnames": [
+ "SubscriptionNameFree",
+ "SubscriptionNameProMonthly",
+ "SubscriptionNameProYearly",
+ "SubscriptionNameUltraMonthly",
+ "SubscriptionNameUltraYearly",
+ "SubscriptionNameProLifetime",
+ "SubscriptionName20KMonthly",
+ "SubscriptionName100KMonthly",
+ "SubscriptionName50KMonthly",
+ "SubscriptionName200KMonthly",
+ "SubscriptionName20KYearly"
+ ]
+ },
"entities.User": {
"type": "object",
"required": [
@@ -3393,7 +3581,11 @@ const docTemplate = `{
"example": "8f9c71b8-b84e-4417-8408-a62274f65a08"
},
"subscription_name": {
- "type": "string",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SubscriptionName"
+ }
+ ],
"example": "free"
},
"subscription_renews_at": {
@@ -3528,15 +3720,46 @@ const docTemplate = `{
}
}
},
+ "requests.MessageAttachment": {
+ "type": "object",
+ "required": [
+ "content",
+ "content_type",
+ "name"
+ ],
+ "properties": {
+ "content": {
+ "description": "Content is the base64-encoded attachment data",
+ "type": "string",
+ "example": "base64data..."
+ },
+ "content_type": {
+ "description": "ContentType is the MIME type of the attachment",
+ "type": "string",
+ "example": "image/jpeg"
+ },
+ "name": {
+ "description": "Name is the original filename of the attachment",
+ "type": "string",
+ "example": "photo.jpg"
+ }
+ }
+ },
"requests.MessageBulkSend": {
"type": "object",
"required": [
"content",
- "encrypted",
"from",
"to"
],
"properties": {
+ "attachments": {
+ "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"content": {
"type": "string",
"example": "This is a sample text message"
@@ -3629,6 +3852,13 @@ const docTemplate = `{
"to"
],
"properties": {
+ "attachments": {
+ "description": "Attachments is the list of MMS attachments received with the message",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/requests.MessageAttachment"
+ }
+ },
"content": {
"type": "string",
"example": "This is a sample text message received on a phone"
@@ -3644,7 +3874,11 @@ const docTemplate = `{
},
"sim": {
"description": "SIM card that received the message",
- "type": "string",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SIM"
+ }
+ ],
"example": "SIM1"
},
"timestamp": {
@@ -3666,6 +3900,17 @@ const docTemplate = `{
"to"
],
"properties": {
+ "attachments": {
+ "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "https://example.com/image.jpg",
+ "https://example.com/video.mp4"
+ ]
+ },
"content": {
"type": "string",
"example": "This is a sample text message"
@@ -4612,6 +4857,8 @@ var SwaggerInfo = &swag.Spec{
Description: "Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
+ LeftDelim: "{{",
+ RightDelim: "}}",
}
func init() {
diff --git a/api/docs/swagger.json b/api/docs/swagger.json
index db16ea4b..b8bc5739 100644
--- a/api/docs/swagger.json
+++ b/api/docs/swagger.json
@@ -1297,6 +1297,66 @@
}
},
"/messages/{messageID}": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get a message from the database by the message ID.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Get a message from the database.",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ },
"delete": {
"security": [
{
@@ -2166,6 +2226,13 @@
"schema": {
"$ref": "#/definitions/requests.UserPaymentInvoice"
}
+ },
+ {
+ "type": "string",
+ "description": "ID of the subscription invoice to generate the PDF for",
+ "name": "subscriptionInvoiceID",
+ "in": "path",
+ "required": true
}
],
"responses": {
@@ -2369,6 +2436,64 @@
}
}
},
+ "/v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}": {
+ "get": {
+ "description": "Download an MMS attachment by its path components",
+ "produces": ["application/octet-stream"],
+ "tags": ["Attachments"],
+ "summary": "Download a message attachment",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "User ID",
+ "name": "userID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Message ID",
+ "name": "messageID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Attachment index",
+ "name": "attachmentIndex",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Filename with extension",
+ "name": "filename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "file"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
"/webhooks": {
"get": {
"security": [
@@ -2748,6 +2873,7 @@
"entities.Message": {
"type": "object",
"required": [
+ "attachments",
"contact",
"content",
"created_at",
@@ -2765,6 +2891,16 @@
"user_id"
],
"properties": {
+ "attachments": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "https://example.com/image.jpg",
+ "https://example.com/video.mp4"
+ ]
+ },
"contact": {
"type": "string",
"example": "+18005550100"
@@ -2852,7 +2988,11 @@
},
"sim": {
"description": "SIM is the SIM card to use to send the message\n* SMS1: use the SIM card in slot 1\n* SMS2: use the SIM card in slot 2\n* DEFAULT: used the default communication SIM card",
- "type": "string",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SIM"
+ }
+ ],
"example": "DEFAULT"
},
"status": {
@@ -2988,8 +3128,7 @@
"example": "+18005550199"
},
"sim": {
- "description": "SIM card that received the message",
- "type": "string"
+ "$ref": "#/definitions/entities.SIM"
},
"updated_at": {
"type": "string",
@@ -3062,6 +3201,40 @@
}
}
},
+ "entities.SIM": {
+ "type": "string",
+ "enum": ["SIM1", "SIM2"],
+ "x-enum-varnames": ["SIM1", "SIM2"]
+ },
+ "entities.SubscriptionName": {
+ "type": "string",
+ "enum": [
+ "free",
+ "pro-monthly",
+ "pro-yearly",
+ "ultra-monthly",
+ "ultra-yearly",
+ "pro-lifetime",
+ "20k-monthly",
+ "100k-monthly",
+ "50k-monthly",
+ "200k-monthly",
+ "20k-yearly"
+ ],
+ "x-enum-varnames": [
+ "SubscriptionNameFree",
+ "SubscriptionNameProMonthly",
+ "SubscriptionNameProYearly",
+ "SubscriptionNameUltraMonthly",
+ "SubscriptionNameUltraYearly",
+ "SubscriptionNameProLifetime",
+ "SubscriptionName20KMonthly",
+ "SubscriptionName100KMonthly",
+ "SubscriptionName50KMonthly",
+ "SubscriptionName200KMonthly",
+ "SubscriptionName20KYearly"
+ ]
+ },
"entities.User": {
"type": "object",
"required": [
@@ -3124,7 +3297,11 @@
"example": "8f9c71b8-b84e-4417-8408-a62274f65a08"
},
"subscription_name": {
- "type": "string",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SubscriptionName"
+ }
+ ],
"example": "free"
},
"subscription_renews_at": {
@@ -3243,10 +3420,38 @@
}
}
},
+ "requests.MessageAttachment": {
+ "type": "object",
+ "required": ["content", "content_type", "name"],
+ "properties": {
+ "content": {
+ "description": "Content is the base64-encoded attachment data",
+ "type": "string",
+ "example": "base64data..."
+ },
+ "content_type": {
+ "description": "ContentType is the MIME type of the attachment",
+ "type": "string",
+ "example": "image/jpeg"
+ },
+ "name": {
+ "description": "Name is the original filename of the attachment",
+ "type": "string",
+ "example": "photo.jpg"
+ }
+ }
+ },
"requests.MessageBulkSend": {
"type": "object",
- "required": ["content", "encrypted", "from", "to"],
+ "required": ["content", "from", "to"],
"properties": {
+ "attachments": {
+ "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"content": {
"type": "string",
"example": "This is a sample text message"
@@ -3320,6 +3525,13 @@
"type": "object",
"required": ["content", "encrypted", "from", "sim", "timestamp", "to"],
"properties": {
+ "attachments": {
+ "description": "Attachments is the list of MMS attachments received with the message",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/requests.MessageAttachment"
+ }
+ },
"content": {
"type": "string",
"example": "This is a sample text message received on a phone"
@@ -3335,7 +3547,11 @@
},
"sim": {
"description": "SIM card that received the message",
- "type": "string",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SIM"
+ }
+ ],
"example": "SIM1"
},
"timestamp": {
@@ -3353,6 +3569,17 @@
"type": "object",
"required": ["content", "from", "to"],
"properties": {
+ "attachments": {
+ "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "https://example.com/image.jpg",
+ "https://example.com/video.mp4"
+ ]
+ },
"content": {
"type": "string",
"example": "This is a sample text message"
diff --git a/api/docs/swagger.yaml b/api/docs/swagger.yaml
index e8b171eb..f5563f2a 100644
--- a/api/docs/swagger.yaml
+++ b/api/docs/swagger.yaml
@@ -102,6 +102,13 @@ definitions:
type: object
entities.Message:
properties:
+ attachments:
+ example:
+ - https://example.com/image.jpg
+ - https://example.com/video.mp4
+ items:
+ type: string
+ type: array
contact:
example: "+18005550100"
type: string
@@ -169,13 +176,14 @@ definitions:
example: "2022-06-05T14:26:09.527976+03:00"
type: string
sim:
+ allOf:
+ - $ref: "#/definitions/entities.SIM"
description: |-
SIM is the SIM card to use to send the message
* SMS1: use the SIM card in slot 1
* SMS2: use the SIM card in slot 2
* DEFAULT: used the default communication SIM card
example: DEFAULT
- type: string
status:
example: pending
type: string
@@ -189,6 +197,7 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
+ - attachments
- contact
- content
- created_at
@@ -289,8 +298,7 @@ definitions:
example: "+18005550199"
type: string
sim:
- description: SIM card that received the message
- type: string
+ $ref: "#/definitions/entities.SIM"
updated_at:
example: "2022-06-05T14:26:10.303278+03:00"
type: string
@@ -356,6 +364,40 @@ definitions:
- user_email
- user_id
type: object
+ entities.SIM:
+ enum:
+ - SIM1
+ - SIM2
+ type: string
+ x-enum-varnames:
+ - SIM1
+ - SIM2
+ entities.SubscriptionName:
+ enum:
+ - free
+ - pro-monthly
+ - pro-yearly
+ - ultra-monthly
+ - ultra-yearly
+ - pro-lifetime
+ - 20k-monthly
+ - 100k-monthly
+ - 50k-monthly
+ - 200k-monthly
+ - 20k-yearly
+ type: string
+ x-enum-varnames:
+ - SubscriptionNameFree
+ - SubscriptionNameProMonthly
+ - SubscriptionNameProYearly
+ - SubscriptionNameUltraMonthly
+ - SubscriptionNameUltraYearly
+ - SubscriptionNameProLifetime
+ - SubscriptionName20KMonthly
+ - SubscriptionName100KMonthly
+ - SubscriptionName50KMonthly
+ - SubscriptionName200KMonthly
+ - SubscriptionName20KYearly
entities.User:
properties:
active_phone_id:
@@ -392,8 +434,9 @@ definitions:
example: 8f9c71b8-b84e-4417-8408-a62274f65a08
type: string
subscription_name:
+ allOf:
+ - $ref: "#/definitions/entities.SubscriptionName"
example: free
- type: string
subscription_renews_at:
example: "2022-06-05T14:26:02.302718+03:00"
type: string
@@ -501,8 +544,34 @@ definitions:
- charging
- phone_numbers
type: object
+ requests.MessageAttachment:
+ properties:
+ content:
+ description: Content is the base64-encoded attachment data
+ example: base64data...
+ type: string
+ content_type:
+ description: ContentType is the MIME type of the attachment
+ example: image/jpeg
+ type: string
+ name:
+ description: Name is the original filename of the attachment
+ example: photo.jpg
+ type: string
+ required:
+ - content
+ - content_type
+ - name
+ type: object
requests.MessageBulkSend:
properties:
+ attachments:
+ description:
+ Attachments are optional. When you provide a list of attachments,
+ the message will be sent out as an MMS
+ items:
+ type: string
+ type: array
content:
example: This is a sample text message
type: string
@@ -530,7 +599,6 @@ definitions:
type: array
required:
- content
- - encrypted
- from
- to
type: object
@@ -580,6 +648,13 @@ definitions:
type: object
requests.MessageReceive:
properties:
+ attachments:
+ description:
+ Attachments is the list of MMS attachments received with the
+ message
+ items:
+ $ref: "#/definitions/requests.MessageAttachment"
+ type: array
content:
example: This is a sample text message received on a phone
type: string
@@ -593,9 +668,10 @@ definitions:
example: "+18005550199"
type: string
sim:
+ allOf:
+ - $ref: "#/definitions/entities.SIM"
description: SIM card that received the message
example: SIM1
- type: string
timestamp:
description:
Timestamp is the time when the event was emitted, Please send
@@ -615,6 +691,16 @@ definitions:
type: object
requests.MessageSend:
properties:
+ attachments:
+ description:
+ Attachments are optional. When you provide a list of attachments,
+ the message will be sent out as an MMS
+ example:
+ - https://example.com/image.jpg
+ - https://example.com/video.mp4
+ items:
+ type: string
+ type: array
content:
example: This is a sample text message
type: string
@@ -2031,6 +2117,49 @@ paths:
summary: Delete a message from the database.
tags:
- Messages
+ get:
+ consumes:
+ - application/json
+ description: Get a message from the database by the message ID.
+ parameters:
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the message
+ in: path
+ name: messageID
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "204":
+ description: No Content
+ schema:
+ $ref: "#/definitions/responses.MessageResponse"
+ "400":
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/responses.BadRequest"
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: "#/definitions/responses.Unauthorized"
+ "404":
+ description: Not Found
+ schema:
+ $ref: "#/definitions/responses.NotFound"
+ "422":
+ description: Unprocessable Entity
+ schema:
+ $ref: "#/definitions/responses.UnprocessableEntity"
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: "#/definitions/responses.InternalServerError"
+ security:
+ - ApiKeyAuth: []
+ summary: Get a message from the database.
+ tags:
+ - Messages
/messages/{messageID}/events:
post:
consumes:
@@ -2973,6 +3102,11 @@ paths:
required: true
schema:
$ref: "#/definitions/requests.UserPaymentInvoice"
+ - description: ID of the subscription invoice to generate the PDF for
+ in: path
+ name: subscriptionInvoiceID
+ required: true
+ type: string
produces:
- application/pdf
responses:
@@ -3037,6 +3171,48 @@ paths:
summary: Get the last 10 subscription payments.
tags:
- Users
+ /v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}:
+ get:
+ description: Download an MMS attachment by its path components
+ parameters:
+ - description: User ID
+ in: path
+ name: userID
+ required: true
+ type: string
+ - description: Message ID
+ in: path
+ name: messageID
+ required: true
+ type: string
+ - description: Attachment index
+ in: path
+ name: attachmentIndex
+ required: true
+ type: string
+ - description: Filename with extension
+ in: path
+ name: filename
+ required: true
+ type: string
+ produces:
+ - application/octet-stream
+ responses:
+ "200":
+ description: OK
+ schema:
+ type: file
+ "404":
+ description: Not Found
+ schema:
+ $ref: "#/definitions/responses.NotFound"
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: "#/definitions/responses.InternalServerError"
+ summary: Download a message attachment
+ tags:
+ - Attachments
/webhooks:
get:
consumes:
diff --git a/api/pkg/handlers/attachment_handler.go b/api/pkg/handlers/attachment_handler.go
index e6ea4f85..46a4397b 100644
--- a/api/pkg/handlers/attachment_handler.go
+++ b/api/pkg/handlers/attachment_handler.go
@@ -36,17 +36,17 @@ func (h *AttachmentHandler) RegisterRoutes(router fiber.Router) {
router.Get("/v1/attachments/:userID/:messageID/:attachmentIndex/:filename", h.GetAttachment)
}
-// GetAttachment downloads an attachment
+// GetAttachment Downloads an attachment
// @Summary Download a message attachment
// @Description Download an MMS attachment by its path components
// @Tags Attachments
-// @Produce octet-stream
+// @Produce application/octet-stream
// @Param userID path string true "User ID"
// @Param messageID path string true "Message ID"
// @Param attachmentIndex path string true "Attachment index"
// @Param filename path string true "Filename with extension"
// @Success 200 {file} binary
-// @Failure 404 {object} responses.NotFoundResponse
+// @Failure 404 {object} responses.NotFound
// @Failure 500 {object} responses.InternalServerError
// @Router /v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename} [get]
func (h *AttachmentHandler) GetAttachment(c *fiber.Ctx) error {