Skip to content

Commit 278678a

Browse files
committed
[docs] fix GET /api/3rdparty/v1/message/{id} path param
1 parent ca50e26 commit 278678a

File tree

5 files changed

+97
-94
lines changed

5 files changed

+97
-94
lines changed

api/swagger.json

+53-49
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"title": "SMS Gateway for Android™ API",
99
"contact": {
1010
"name": "Aleksandr Soloshenko",
11-
"email": "i@capcom.me"
11+
"email": "sms@capcom.me"
1212
},
1313
"version": "{APP_VERSION}"
1414
},
@@ -151,35 +151,52 @@
151151
}
152152
},
153153
"/3rdparty/v1/message": {
154-
"get": {
154+
"post": {
155155
"security": [
156156
{
157157
"ApiAuth": []
158158
}
159159
],
160-
"description": "Returns message state by ID",
160+
"description": "Enqueues message for sending. If ID is not specified, it will be generated",
161+
"consumes": [
162+
"application/json"
163+
],
161164
"produces": [
162165
"application/json"
163166
],
164167
"tags": [
165168
"User",
166169
"Messages"
167170
],
168-
"summary": "Get message state",
171+
"summary": "Enqueue message",
169172
"parameters": [
170173
{
171-
"type": "string",
172-
"description": "Message ID",
173-
"name": "id",
174-
"in": "path",
175-
"required": true
174+
"type": "boolean",
175+
"description": "Skip phone validation",
176+
"name": "skipPhoneValidation",
177+
"in": "query"
178+
},
179+
{
180+
"description": "Send message request",
181+
"name": "request",
182+
"in": "body",
183+
"required": true,
184+
"schema": {
185+
"$ref": "#/definitions/smsgateway.Message"
186+
}
176187
}
177188
],
178189
"responses": {
179-
"200": {
180-
"description": "Message state",
190+
"202": {
191+
"description": "Message enqueued",
181192
"schema": {
182193
"$ref": "#/definitions/smsgateway.MessageState"
194+
},
195+
"headers": {
196+
"Location": {
197+
"type": "string",
198+
"description": "Get message state URL"
199+
}
183200
}
184201
},
185202
"400": {
@@ -194,60 +211,51 @@
194211
"$ref": "#/definitions/smsgateway.ErrorResponse"
195212
}
196213
},
214+
"409": {
215+
"description": "Message with such ID already exists",
216+
"schema": {
217+
"$ref": "#/definitions/smsgateway.ErrorResponse"
218+
}
219+
},
197220
"500": {
198221
"description": "Internal server error",
199222
"schema": {
200223
"$ref": "#/definitions/smsgateway.ErrorResponse"
201224
}
202225
}
203226
}
204-
},
205-
"post": {
227+
}
228+
},
229+
"/3rdparty/v1/message/{id}": {
230+
"get": {
206231
"security": [
207232
{
208233
"ApiAuth": []
209234
}
210235
],
211-
"description": "Enqueues message for sending. If ID is not specified, it will be generated",
212-
"consumes": [
213-
"application/json"
214-
],
236+
"description": "Returns message state by ID",
215237
"produces": [
216238
"application/json"
217239
],
218240
"tags": [
219241
"User",
220242
"Messages"
221243
],
222-
"summary": "Enqueue message",
244+
"summary": "Get message state",
223245
"parameters": [
224246
{
225-
"type": "boolean",
226-
"description": "Skip phone validation",
227-
"name": "skipPhoneValidation",
228-
"in": "query"
229-
},
230-
{
231-
"description": "Send message request",
232-
"name": "request",
233-
"in": "body",
234-
"required": true,
235-
"schema": {
236-
"$ref": "#/definitions/smsgateway.Message"
237-
}
247+
"type": "string",
248+
"description": "Message ID",
249+
"name": "id",
250+
"in": "path",
251+
"required": true
238252
}
239253
],
240254
"responses": {
241-
"202": {
242-
"description": "Message enqueued",
255+
"200": {
256+
"description": "Message state",
243257
"schema": {
244258
"$ref": "#/definitions/smsgateway.MessageState"
245-
},
246-
"headers": {
247-
"Location": {
248-
"type": "string",
249-
"description": "Get message state URL"
250-
}
251259
}
252260
},
253261
"400": {
@@ -262,12 +270,6 @@
262270
"$ref": "#/definitions/smsgateway.ErrorResponse"
263271
}
264272
},
265-
"409": {
266-
"description": "Message with such ID already exists",
267-
"schema": {
268-
"$ref": "#/definitions/smsgateway.ErrorResponse"
269-
}
270-
},
271273
"500": {
272274
"description": "Internal server error",
273275
"schema": {
@@ -1164,7 +1166,7 @@
11641166
"description": "The type of event the webhook is triggered for.",
11651167
"allOf": [
11661168
{
1167-
"$ref": "#/definitions/smsgateway.WebhookEvent"
1169+
"$ref": "#/definitions/webhooks.EventType"
11681170
}
11691171
],
11701172
"example": "sms:received"
@@ -1182,15 +1184,17 @@
11821184
}
11831185
}
11841186
},
1185-
"smsgateway.WebhookEvent": {
1187+
"webhooks.EventType": {
11861188
"type": "string",
11871189
"enum": [
11881190
"sms:received",
1191+
"sms:sent",
11891192
"system:ping"
11901193
],
11911194
"x-enum-varnames": [
1192-
"WebhookEventSmsReceived",
1193-
"WebhookEventSystemPing"
1195+
"EventTypeSmsReceived",
1196+
"EventTypeSmsSent",
1197+
"EventTypeSystemPing"
11941198
]
11951199
}
11961200
},

api/swagger.yaml

+41-38
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ definitions:
332332
properties:
333333
event:
334334
allOf:
335-
- $ref: '#/definitions/smsgateway.WebhookEvent'
335+
- $ref: '#/definitions/webhooks.EventType'
336336
description: The type of event the webhook is triggered for.
337337
example: sms:received
338338
id:
@@ -348,18 +348,20 @@ definitions:
348348
- event
349349
- url
350350
type: object
351-
smsgateway.WebhookEvent:
351+
webhooks.EventType:
352352
enum:
353353
- sms:received
354+
- sms:sent
354355
- system:ping
355356
type: string
356357
x-enum-varnames:
357-
- WebhookEventSmsReceived
358-
- WebhookEventSystemPing
358+
- EventTypeSmsReceived
359+
- EventTypeSmsSent
360+
- EventTypeSystemPing
359361
host: sms.capcom.me
360362
info:
361363
contact:
362-
email: i@capcom.me
364+
email: sms@capcom.me
363365
name: Aleksandr Soloshenko
364366
description: This API provides programmatic access to sending SMS messages on Android
365367
devices. Features include sending SMS, checking message status, device management,
@@ -457,39 +459,6 @@ paths:
457459
- System
458460
- Logs
459461
/3rdparty/v1/message:
460-
get:
461-
description: Returns message state by ID
462-
parameters:
463-
- description: Message ID
464-
in: path
465-
name: id
466-
required: true
467-
type: string
468-
produces:
469-
- application/json
470-
responses:
471-
"200":
472-
description: Message state
473-
schema:
474-
$ref: '#/definitions/smsgateway.MessageState'
475-
"400":
476-
description: Invalid request
477-
schema:
478-
$ref: '#/definitions/smsgateway.ErrorResponse'
479-
"401":
480-
description: Unauthorized
481-
schema:
482-
$ref: '#/definitions/smsgateway.ErrorResponse'
483-
"500":
484-
description: Internal server error
485-
schema:
486-
$ref: '#/definitions/smsgateway.ErrorResponse'
487-
security:
488-
- ApiAuth: []
489-
summary: Get message state
490-
tags:
491-
- User
492-
- Messages
493462
post:
494463
consumes:
495464
- application/json
@@ -539,6 +508,40 @@ paths:
539508
tags:
540509
- User
541510
- Messages
511+
/3rdparty/v1/message/{id}:
512+
get:
513+
description: Returns message state by ID
514+
parameters:
515+
- description: Message ID
516+
in: path
517+
name: id
518+
required: true
519+
type: string
520+
produces:
521+
- application/json
522+
responses:
523+
"200":
524+
description: Message state
525+
schema:
526+
$ref: '#/definitions/smsgateway.MessageState'
527+
"400":
528+
description: Invalid request
529+
schema:
530+
$ref: '#/definitions/smsgateway.ErrorResponse'
531+
"401":
532+
description: Unauthorized
533+
schema:
534+
$ref: '#/definitions/smsgateway.ErrorResponse'
535+
"500":
536+
description: Internal server error
537+
schema:
538+
$ref: '#/definitions/smsgateway.ErrorResponse'
539+
security:
540+
- ApiAuth: []
541+
summary: Get message state
542+
tags:
543+
- User
544+
- Messages
542545
/3rdparty/v1/webhooks:
543546
get:
544547
description: Returns list of registered webhooks

cmd/sms-gateway/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ import (
1616
// @description This API provides programmatic access to sending SMS messages on Android devices. Features include sending SMS, checking message status, device management, webhook configuration, and system health checks.
1717

1818
// @contact.name Aleksandr Soloshenko
19-
// @contact.email i@capcom.me
19+
// @contact.email sms@capcom.me
2020

2121
// @host localhost:3000
2222
// @host sms.capcom.me
2323
// @schemes https
2424
// @BasePath /api
2525
//
26-
// SMS Gateway
26+
// SMS Gateway for Android
2727
func main() {
2828
smsgateway.Run()
2929
}

go.sum

-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
2626
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
2727
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
2828
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
29-
github.com/android-sms-gateway/client-go v1.0.2 h1:kXWzVeSgBu2bM1yN4ac8tTEm0fX2Tqsn+yr9mMNjNfI=
30-
github.com/android-sms-gateway/client-go v1.0.2/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
31-
github.com/android-sms-gateway/client-go v1.0.3 h1:Q2pMI/1Lhsw7wu+I+nAaMD4yYvzhQPsP2py71HG7rVo=
32-
github.com/android-sms-gateway/client-go v1.0.3/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
3329
github.com/android-sms-gateway/client-go v1.0.4 h1:QZ72TRBJKm11WL/jim+ba7m2J5RLBaICMcy7f/RVfuQ=
3430
github.com/android-sms-gateway/client-go v1.0.4/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
3531
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=

internal/sms-gateway/handlers/3rdparty.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (h *thirdPartyHandler) postMessage(user models.User, c *fiber.Ctx) error {
125125
// @Failure 400 {object} smsgateway.ErrorResponse "Invalid request"
126126
// @Failure 401 {object} smsgateway.ErrorResponse "Unauthorized"
127127
// @Failure 500 {object} smsgateway.ErrorResponse "Internal server error"
128-
// @Router /3rdparty/v1/message [get]
128+
// @Router /3rdparty/v1/message/{id} [get]
129129
//
130130
// Get message state
131131
func (h *thirdPartyHandler) getMessage(user models.User, c *fiber.Ctx) error {

0 commit comments

Comments
 (0)