Skip to content

Commit 6e84044

Browse files
committed
Fix the multiplart form data
1 parent bc2f348 commit 6e84044

File tree

4 files changed

+45
-19
lines changed

4 files changed

+45
-19
lines changed

api/docs/docs.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const docTemplate = `{
1111
"description": "{{escape .Description}}",
1212
"title": "{{.Title}}",
1313
"contact": {
14-
"name": "HTTP SMS",
14+
"name": "[email protected]",
1515
"email": "[email protected]"
1616
},
1717
"license": {
@@ -151,9 +151,9 @@ const docTemplate = `{
151151
"ApiKeyAuth": []
152152
}
153153
],
154-
"description": "Sends bulk SMS messages to multiple users from a CSV file.",
154+
"description": "Sends bulk SMS messages to multiple users from a CSV or Excel file.",
155155
"consumes": [
156-
"application/json"
156+
"multipart/form-data"
157157
],
158158
"produces": [
159159
"application/json"
@@ -162,6 +162,15 @@ const docTemplate = `{
162162
"BulkSMS"
163163
],
164164
"summary": "Store bulk SMS file",
165+
"parameters": [
166+
{
167+
"type": "file",
168+
"description": "The Excel or CSV file formatted according to the templates",
169+
"name": "document",
170+
"in": "formData",
171+
"required": true
172+
}
173+
],
165174
"responses": {
166175
"202": {
167176
"description": "Accepted",
@@ -3630,7 +3639,7 @@ const docTemplate = `{
36303639
"example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
36313640
},
36323641
"send_at": {
3633-
"description": "SendAt is an optional parameter used to schedule a message to be sent at a later time",
3642+
"description": "SendAt is an optional parameter used to schedule a message to be sent in the future. The time is considered to be in your profile's local timezone.",
36343643
"type": "string",
36353644
"example": "2022-06-05T14:26:09.527976+03:00"
36363645
},
@@ -4362,7 +4371,7 @@ var SwaggerInfo = &swag.Spec{
43624371
BasePath: "/v1",
43634372
Schemes: []string{"https"},
43644373
Title: "httpSMS API Reference",
4365-
Description: "API to send SMS messages using android [SmsManager](https://developer.android.com/reference/android/telephony/SmsManager) via HTTP",
4374+
Description: "Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.",
43664375
InfoInstanceName: "swagger",
43674376
SwaggerTemplate: docTemplate,
43684377
}

api/docs/swagger.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"schemes": ["https"],
33
"swagger": "2.0",
44
"info": {
5-
"description": "API to send SMS messages using android [SmsManager](https://developer.android.com/reference/android/telephony/SmsManager) via HTTP",
5+
"description": "Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.",
66
"title": "httpSMS API Reference",
77
"contact": {
8-
"name": "HTTP SMS",
8+
"name": "[email protected]",
99
"email": "[email protected]"
1010
},
1111
"license": {
@@ -133,11 +133,20 @@
133133
"ApiKeyAuth": []
134134
}
135135
],
136-
"description": "Sends bulk SMS messages to multiple users from a CSV file.",
137-
"consumes": ["application/json"],
136+
"description": "Sends bulk SMS messages to multiple users from a CSV or Excel file.",
137+
"consumes": ["multipart/form-data"],
138138
"produces": ["application/json"],
139139
"tags": ["BulkSMS"],
140140
"summary": "Store bulk SMS file",
141+
"parameters": [
142+
{
143+
"type": "file",
144+
"description": "The Excel or CSV file formatted according to the templates",
145+
"name": "document",
146+
"in": "formData",
147+
"required": true
148+
}
149+
],
141150
"responses": {
142151
"202": {
143152
"description": "Accepted",
@@ -3323,7 +3332,7 @@
33233332
"example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
33243333
},
33253334
"send_at": {
3326-
"description": "SendAt is an optional parameter used to schedule a message to be sent at a later time",
3335+
"description": "SendAt is an optional parameter used to schedule a message to be sent in the future. The time is considered to be in your profile's local timezone.",
33273336
"type": "string",
33283337
"example": "2022-06-05T14:26:09.527976+03:00"
33293338
},

api/docs/swagger.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ definitions:
658658
send_at:
659659
description:
660660
SendAt is an optional parameter used to schedule a message to
661-
be sent at a later time
661+
be sent in the future. The time is considered to be in your profile's local
662+
timezone.
662663
example: "2022-06-05T14:26:09.527976+03:00"
663664
type: string
664665
to:
@@ -1185,10 +1186,10 @@ host: api.httpsms.com
11851186
info:
11861187
contact:
11871188
1188-
name: HTTP SMS
1189+
11891190
description:
1190-
API to send SMS messages using android [SmsManager](https://developer.android.com/reference/android/telephony/SmsManager)
1191-
via HTTP
1191+
Use your Android phone to send and receive SMS messages via a simple
1192+
programmable API with end-to-end encryption.
11921193
license:
11931194
name: AGPL-3.0
11941195
url: https://raw.githubusercontent.com/NdoleStudio/http-sms-manager/main/LICENSE
@@ -1280,8 +1281,14 @@ paths:
12801281
/bulk-messages:
12811282
post:
12821283
consumes:
1283-
- application/json
1284-
description: Sends bulk SMS messages to multiple users from a CSV file.
1284+
- multipart/form-data
1285+
description: Sends bulk SMS messages to multiple users from a CSV or Excel file.
1286+
parameters:
1287+
- description: The Excel or CSV file formatted according to the templates
1288+
in: formData
1289+
name: document
1290+
required: true
1291+
type: file
12851292
produces:
12861293
- application/json
12871294
responses:

api/pkg/handlers/bulk_message_handler.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ func (h *BulkMessageHandler) RegisterRoutes(router fiber.Router, middlewares ...
4848
router.Post("/v1/bulk-messages", h.computeRoute(middlewares, h.Store)...)
4949
}
5050

51-
// Store sends bulk SMS messages from a CSV file.
51+
// Store sends bulk SMS messages from a CSV or Excel file.
5252
// @Summary Store bulk SMS file
53-
// @Description Sends bulk SMS messages to multiple users from a CSV file.
53+
// @Description Sends bulk SMS messages to multiple users from a CSV or Excel file.
5454
// @Security ApiKeyAuth
5555
// @Tags BulkSMS
56-
// @Accept json
56+
// @Accept multipart/form-data
5757
// @Produce json
58+
// @Param document formData file true "The Excel or CSV file formatted according to the templates"
5859
// @Success 202 {object} responses.NoContent
5960
// @Failure 400 {object} responses.BadRequest
6061
// @Failure 401 {object} responses.Unauthorized

0 commit comments

Comments
 (0)