Skip to content

Commit 03a39eb

Browse files
committed
[docs] improve API docs
1 parent 6e115f4 commit 03a39eb

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

cmd/sms-gateway/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ const (
4040

4141
// @contact.name SMSGate Support
4242
// @contact.email support@sms-gate.app
43+
// @contact.url https://docs.sms-gate.app/
44+
45+
// @license.name Apache 2.0
46+
// @license.url http://www.apache.org/licenses/LICENSE-2.0
4347

4448
// @host localhost:3000/api
4549
// @host api.sms-gate.app

internal/sms-gateway/handlers/thirdparty/auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func (h *AuthHandler) postToken(user users.User, c *fiber.Ctx) error {
8686
// @Security ApiAuth
8787
// @Security JWTAuth
8888
// @Tags User, Auth
89+
// @Produce json
8990
// @Param jti path string true "JWT ID"
9091
// @Success 204 "No Content"
9192
// @Failure 401 {object} smsgateway.ErrorResponse "Unauthorized"

internal/sms-gateway/openapi/docs.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ const docTemplate = `{
1111
"title": "{{.Title}}",
1212
"contact": {
1313
"name": "SMSGate Support",
14+
"url": "https://docs.sms-gate.app/",
1415
"email": "support@sms-gate.app"
1516
},
17+
"license": {
18+
"name": "Apache 2.0",
19+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
20+
},
1621
"version": "{{.Version}}"
1722
},
1823
"host": "{{.Host}}",
@@ -96,6 +101,9 @@ const docTemplate = `{
96101
}
97102
],
98103
"description": "Revoke access token with specified jti",
104+
"produces": [
105+
"application/json"
106+
],
99107
"tags": [
100108
"User",
101109
"Auth"
@@ -1512,6 +1520,7 @@ const docTemplate = `{
15121520
},
15131521
"smsgateway.MessagePriority": {
15141522
"type": "integer",
1523+
"format": "int32",
15151524
"enum": [
15161525
-128,
15171526
0,
@@ -1521,6 +1530,12 @@ const docTemplate = `{
15211530
"x-enum-comments": {
15221531
"PriorityBypassThreshold": "Threshold at which messages bypass limits and delays"
15231532
},
1533+
"x-enum-descriptions": [
1534+
"",
1535+
"",
1536+
"Threshold at which messages bypass limits and delays",
1537+
""
1538+
],
15241539
"x-enum-varnames": [
15251540
"PriorityMinimum",
15261541
"PriorityDefault",
@@ -1638,6 +1653,13 @@ const docTemplate = `{
16381653
"ProcessingStateProcessed": "Processed (received by device)",
16391654
"ProcessingStateSent": "Sent"
16401655
},
1656+
"x-enum-descriptions": [
1657+
"Pending",
1658+
"Processed (received by device)",
1659+
"Sent",
1660+
"Delivered",
1661+
"Failed"
1662+
],
16411663
"x-enum-varnames": [
16421664
"ProcessingStatePending",
16431665
"ProcessingStateProcessed",
@@ -1911,6 +1933,15 @@ const docTemplate = `{
19111933
"WebhookEventSmsSent": "Triggered when an SMS is sent.",
19121934
"WebhookEventSystemPing": "Triggered when the device pings the server."
19131935
},
1936+
"x-enum-descriptions": [
1937+
"Triggered when an MMS is received.",
1938+
"Triggered when a data SMS is received.",
1939+
"Triggered when an SMS is delivered.",
1940+
"Triggered when an SMS processing fails.",
1941+
"Triggered when an SMS is received.",
1942+
"Triggered when an SMS is sent.",
1943+
"Triggered when the device pings the server."
1944+
],
19141945
"x-enum-varnames": [
19151946
"WebhookEventMmsReceived",
19161947
"WebhookEventSmsDataReceived",

0 commit comments

Comments
 (0)