Skip to content

Commit

Permalink
[docs] fix GET /api/3rdparty/v1/message/{id} path param
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Aug 15, 2024
1 parent ca50e26 commit 278678a
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 94 deletions.
102 changes: 53 additions & 49 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"title": "SMS Gateway for Android™ API",
"contact": {
"name": "Aleksandr Soloshenko",
"email": "i@capcom.me"
"email": "sms@capcom.me"
},
"version": "{APP_VERSION}"
},
Expand Down Expand Up @@ -151,35 +151,52 @@
}
},
"/3rdparty/v1/message": {
"get": {
"post": {
"security": [
{
"ApiAuth": []
}
],
"description": "Returns message state by ID",
"description": "Enqueues message for sending. If ID is not specified, it will be generated",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User",
"Messages"
],
"summary": "Get message state",
"summary": "Enqueue message",
"parameters": [
{
"type": "string",
"description": "Message ID",
"name": "id",
"in": "path",
"required": true
"type": "boolean",
"description": "Skip phone validation",
"name": "skipPhoneValidation",
"in": "query"
},
{
"description": "Send message request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smsgateway.Message"
}
}
],
"responses": {
"200": {
"description": "Message state",
"202": {
"description": "Message enqueued",
"schema": {
"$ref": "#/definitions/smsgateway.MessageState"
},
"headers": {
"Location": {
"type": "string",
"description": "Get message state URL"
}
}
},
"400": {
Expand All @@ -194,60 +211,51 @@
"$ref": "#/definitions/smsgateway.ErrorResponse"
}
},
"409": {
"description": "Message with such ID already exists",
"schema": {
"$ref": "#/definitions/smsgateway.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/smsgateway.ErrorResponse"
}
}
}
},
"post": {
}
},
"/3rdparty/v1/message/{id}": {
"get": {
"security": [
{
"ApiAuth": []
}
],
"description": "Enqueues message for sending. If ID is not specified, it will be generated",
"consumes": [
"application/json"
],
"description": "Returns message state by ID",
"produces": [
"application/json"
],
"tags": [
"User",
"Messages"
],
"summary": "Enqueue message",
"summary": "Get message state",
"parameters": [
{
"type": "boolean",
"description": "Skip phone validation",
"name": "skipPhoneValidation",
"in": "query"
},
{
"description": "Send message request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smsgateway.Message"
}
"type": "string",
"description": "Message ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"202": {
"description": "Message enqueued",
"200": {
"description": "Message state",
"schema": {
"$ref": "#/definitions/smsgateway.MessageState"
},
"headers": {
"Location": {
"type": "string",
"description": "Get message state URL"
}
}
},
"400": {
Expand All @@ -262,12 +270,6 @@
"$ref": "#/definitions/smsgateway.ErrorResponse"
}
},
"409": {
"description": "Message with such ID already exists",
"schema": {
"$ref": "#/definitions/smsgateway.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
Expand Down Expand Up @@ -1164,7 +1166,7 @@
"description": "The type of event the webhook is triggered for.",
"allOf": [
{
"$ref": "#/definitions/smsgateway.WebhookEvent"
"$ref": "#/definitions/webhooks.EventType"
}
],
"example": "sms:received"
Expand All @@ -1182,15 +1184,17 @@
}
}
},
"smsgateway.WebhookEvent": {
"webhooks.EventType": {
"type": "string",
"enum": [
"sms:received",
"sms:sent",
"system:ping"
],
"x-enum-varnames": [
"WebhookEventSmsReceived",
"WebhookEventSystemPing"
"EventTypeSmsReceived",
"EventTypeSmsSent",
"EventTypeSystemPing"
]
}
},
Expand Down
79 changes: 41 additions & 38 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ definitions:
properties:
event:
allOf:
- $ref: '#/definitions/smsgateway.WebhookEvent'
- $ref: '#/definitions/webhooks.EventType'
description: The type of event the webhook is triggered for.
example: sms:received
id:
Expand All @@ -348,18 +348,20 @@ definitions:
- event
- url
type: object
smsgateway.WebhookEvent:
webhooks.EventType:
enum:
- sms:received
- sms:sent
- system:ping
type: string
x-enum-varnames:
- WebhookEventSmsReceived
- WebhookEventSystemPing
- EventTypeSmsReceived
- EventTypeSmsSent
- EventTypeSystemPing
host: sms.capcom.me
info:
contact:
email: i@capcom.me
email: sms@capcom.me
name: Aleksandr Soloshenko
description: This API provides programmatic access to sending SMS messages on Android
devices. Features include sending SMS, checking message status, device management,
Expand Down Expand Up @@ -457,39 +459,6 @@ paths:
- System
- Logs
/3rdparty/v1/message:
get:
description: Returns message state by ID
parameters:
- description: Message ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Message state
schema:
$ref: '#/definitions/smsgateway.MessageState'
"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'
security:
- ApiAuth: []
summary: Get message state
tags:
- User
- Messages
post:
consumes:
- application/json
Expand Down Expand Up @@ -539,6 +508,40 @@ paths:
tags:
- User
- Messages
/3rdparty/v1/message/{id}:
get:
description: Returns message state by ID
parameters:
- description: Message ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Message state
schema:
$ref: '#/definitions/smsgateway.MessageState'
"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'
security:
- ApiAuth: []
summary: Get message state
tags:
- User
- Messages
/3rdparty/v1/webhooks:
get:
description: Returns list of registered webhooks
Expand Down
4 changes: 2 additions & 2 deletions cmd/sms-gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import (
// @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.

// @contact.name Aleksandr Soloshenko
// @contact.email i@capcom.me
// @contact.email sms@capcom.me

// @host localhost:3000
// @host sms.capcom.me
// @schemes https
// @BasePath /api
//
// SMS Gateway
// SMS Gateway for Android
func main() {
smsgateway.Run()
}
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
github.com/android-sms-gateway/client-go v1.0.2 h1:kXWzVeSgBu2bM1yN4ac8tTEm0fX2Tqsn+yr9mMNjNfI=
github.com/android-sms-gateway/client-go v1.0.2/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/android-sms-gateway/client-go v1.0.3 h1:Q2pMI/1Lhsw7wu+I+nAaMD4yYvzhQPsP2py71HG7rVo=
github.com/android-sms-gateway/client-go v1.0.3/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/android-sms-gateway/client-go v1.0.4 h1:QZ72TRBJKm11WL/jim+ba7m2J5RLBaICMcy7f/RVfuQ=
github.com/android-sms-gateway/client-go v1.0.4/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
Expand Down
2 changes: 1 addition & 1 deletion internal/sms-gateway/handlers/3rdparty.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (h *thirdPartyHandler) postMessage(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/message [get]
// @Router /3rdparty/v1/message/{id} [get]
//
// Get message state
func (h *thirdPartyHandler) getMessage(user models.User, c *fiber.Ctx) error {
Expand Down

0 comments on commit 278678a

Please sign in to comment.