Skip to content

Commit 9528b39

Browse files
committed
Fix swagger
1 parent cbf878d commit 9528b39

File tree

4 files changed

+673
-23
lines changed

4 files changed

+673
-23
lines changed

api/docs/docs.go

Lines changed: 255 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// Package docs GENERATED BY SWAG; DO NOT EDIT
2-
// This file was generated by swaggo/swag
1+
// Package docs Code generated by swaggo/swag. DO NOT EDIT
32
package docs
43

54
import "github.com/swaggo/swag"
@@ -1429,6 +1428,72 @@ const docTemplate = `{
14291428
}
14301429
},
14311430
"/messages/{messageID}": {
1431+
"get": {
1432+
"security": [
1433+
{
1434+
"ApiKeyAuth": []
1435+
}
1436+
],
1437+
"description": "Get a message from the database by the message ID.",
1438+
"consumes": [
1439+
"application/json"
1440+
],
1441+
"produces": [
1442+
"application/json"
1443+
],
1444+
"tags": [
1445+
"Messages"
1446+
],
1447+
"summary": "Get a message from the database.",
1448+
"parameters": [
1449+
{
1450+
"type": "string",
1451+
"default": "32343a19-da5e-4b1b-a767-3298a73703ca",
1452+
"description": "ID of the message",
1453+
"name": "messageID",
1454+
"in": "path",
1455+
"required": true
1456+
}
1457+
],
1458+
"responses": {
1459+
"204": {
1460+
"description": "No Content",
1461+
"schema": {
1462+
"$ref": "#/definitions/responses.MessageResponse"
1463+
}
1464+
},
1465+
"400": {
1466+
"description": "Bad Request",
1467+
"schema": {
1468+
"$ref": "#/definitions/responses.BadRequest"
1469+
}
1470+
},
1471+
"401": {
1472+
"description": "Unauthorized",
1473+
"schema": {
1474+
"$ref": "#/definitions/responses.Unauthorized"
1475+
}
1476+
},
1477+
"404": {
1478+
"description": "Not Found",
1479+
"schema": {
1480+
"$ref": "#/definitions/responses.NotFound"
1481+
}
1482+
},
1483+
"422": {
1484+
"description": "Unprocessable Entity",
1485+
"schema": {
1486+
"$ref": "#/definitions/responses.UnprocessableEntity"
1487+
}
1488+
},
1489+
"500": {
1490+
"description": "Internal Server Error",
1491+
"schema": {
1492+
"$ref": "#/definitions/responses.InternalServerError"
1493+
}
1494+
}
1495+
}
1496+
},
14321497
"delete": {
14331498
"security": [
14341499
{
@@ -2390,6 +2455,13 @@ const docTemplate = `{
23902455
"schema": {
23912456
"$ref": "#/definitions/requests.UserPaymentInvoice"
23922457
}
2458+
},
2459+
{
2460+
"type": "string",
2461+
"description": "ID of the subscription invoice to generate the PDF for",
2462+
"name": "subscriptionInvoiceID",
2463+
"in": "path",
2464+
"required": true
23932465
}
23942466
],
23952467
"responses": {
@@ -2611,6 +2683,68 @@ const docTemplate = `{
26112683
}
26122684
}
26132685
},
2686+
"/v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}": {
2687+
"get": {
2688+
"description": "Download an MMS attachment by its path components",
2689+
"produces": [
2690+
"application/octet-stream"
2691+
],
2692+
"tags": [
2693+
"Attachments"
2694+
],
2695+
"summary": "Download a message attachment",
2696+
"parameters": [
2697+
{
2698+
"type": "string",
2699+
"description": "User ID",
2700+
"name": "userID",
2701+
"in": "path",
2702+
"required": true
2703+
},
2704+
{
2705+
"type": "string",
2706+
"description": "Message ID",
2707+
"name": "messageID",
2708+
"in": "path",
2709+
"required": true
2710+
},
2711+
{
2712+
"type": "string",
2713+
"description": "Attachment index",
2714+
"name": "attachmentIndex",
2715+
"in": "path",
2716+
"required": true
2717+
},
2718+
{
2719+
"type": "string",
2720+
"description": "Filename with extension",
2721+
"name": "filename",
2722+
"in": "path",
2723+
"required": true
2724+
}
2725+
],
2726+
"responses": {
2727+
"200": {
2728+
"description": "OK",
2729+
"schema": {
2730+
"type": "file"
2731+
}
2732+
},
2733+
"404": {
2734+
"description": "Not Found",
2735+
"schema": {
2736+
"$ref": "#/definitions/responses.NotFound"
2737+
}
2738+
},
2739+
"500": {
2740+
"description": "Internal Server Error",
2741+
"schema": {
2742+
"$ref": "#/definitions/responses.InternalServerError"
2743+
}
2744+
}
2745+
}
2746+
}
2747+
},
26142748
"/webhooks": {
26152749
"get": {
26162750
"security": [
@@ -3014,6 +3148,7 @@ const docTemplate = `{
30143148
"entities.Message": {
30153149
"type": "object",
30163150
"required": [
3151+
"attachments",
30173152
"contact",
30183153
"content",
30193154
"created_at",
@@ -3031,6 +3166,16 @@ const docTemplate = `{
30313166
"user_id"
30323167
],
30333168
"properties": {
3169+
"attachments": {
3170+
"type": "array",
3171+
"items": {
3172+
"type": "string"
3173+
},
3174+
"example": [
3175+
"https://example.com/image.jpg",
3176+
"https://example.com/video.mp4"
3177+
]
3178+
},
30343179
"contact": {
30353180
"type": "string",
30363181
"example": "+18005550100"
@@ -3118,7 +3263,11 @@ const docTemplate = `{
31183263
},
31193264
"sim": {
31203265
"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",
3121-
"type": "string",
3266+
"allOf": [
3267+
{
3268+
"$ref": "#/definitions/entities.SIM"
3269+
}
3270+
],
31223271
"example": "DEFAULT"
31233272
},
31243273
"status": {
@@ -3254,8 +3403,7 @@ const docTemplate = `{
32543403
"example": "+18005550199"
32553404
},
32563405
"sim": {
3257-
"description": "SIM card that received the message",
3258-
"type": "string"
3406+
"$ref": "#/definitions/entities.SIM"
32593407
},
32603408
"updated_at": {
32613409
"type": "string",
@@ -3331,6 +3479,46 @@ const docTemplate = `{
33313479
}
33323480
}
33333481
},
3482+
"entities.SIM": {
3483+
"type": "string",
3484+
"enum": [
3485+
"SIM1",
3486+
"SIM2"
3487+
],
3488+
"x-enum-varnames": [
3489+
"SIM1",
3490+
"SIM2"
3491+
]
3492+
},
3493+
"entities.SubscriptionName": {
3494+
"type": "string",
3495+
"enum": [
3496+
"free",
3497+
"pro-monthly",
3498+
"pro-yearly",
3499+
"ultra-monthly",
3500+
"ultra-yearly",
3501+
"pro-lifetime",
3502+
"20k-monthly",
3503+
"100k-monthly",
3504+
"50k-monthly",
3505+
"200k-monthly",
3506+
"20k-yearly"
3507+
],
3508+
"x-enum-varnames": [
3509+
"SubscriptionNameFree",
3510+
"SubscriptionNameProMonthly",
3511+
"SubscriptionNameProYearly",
3512+
"SubscriptionNameUltraMonthly",
3513+
"SubscriptionNameUltraYearly",
3514+
"SubscriptionNameProLifetime",
3515+
"SubscriptionName20KMonthly",
3516+
"SubscriptionName100KMonthly",
3517+
"SubscriptionName50KMonthly",
3518+
"SubscriptionName200KMonthly",
3519+
"SubscriptionName20KYearly"
3520+
]
3521+
},
33343522
"entities.User": {
33353523
"type": "object",
33363524
"required": [
@@ -3393,7 +3581,11 @@ const docTemplate = `{
33933581
"example": "8f9c71b8-b84e-4417-8408-a62274f65a08"
33943582
},
33953583
"subscription_name": {
3396-
"type": "string",
3584+
"allOf": [
3585+
{
3586+
"$ref": "#/definitions/entities.SubscriptionName"
3587+
}
3588+
],
33973589
"example": "free"
33983590
},
33993591
"subscription_renews_at": {
@@ -3528,15 +3720,46 @@ const docTemplate = `{
35283720
}
35293721
}
35303722
},
3723+
"requests.MessageAttachment": {
3724+
"type": "object",
3725+
"required": [
3726+
"content",
3727+
"content_type",
3728+
"name"
3729+
],
3730+
"properties": {
3731+
"content": {
3732+
"description": "Content is the base64-encoded attachment data",
3733+
"type": "string",
3734+
"example": "base64data..."
3735+
},
3736+
"content_type": {
3737+
"description": "ContentType is the MIME type of the attachment",
3738+
"type": "string",
3739+
"example": "image/jpeg"
3740+
},
3741+
"name": {
3742+
"description": "Name is the original filename of the attachment",
3743+
"type": "string",
3744+
"example": "photo.jpg"
3745+
}
3746+
}
3747+
},
35313748
"requests.MessageBulkSend": {
35323749
"type": "object",
35333750
"required": [
35343751
"content",
3535-
"encrypted",
35363752
"from",
35373753
"to"
35383754
],
35393755
"properties": {
3756+
"attachments": {
3757+
"description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
3758+
"type": "array",
3759+
"items": {
3760+
"type": "string"
3761+
}
3762+
},
35403763
"content": {
35413764
"type": "string",
35423765
"example": "This is a sample text message"
@@ -3629,6 +3852,13 @@ const docTemplate = `{
36293852
"to"
36303853
],
36313854
"properties": {
3855+
"attachments": {
3856+
"description": "Attachments is the list of MMS attachments received with the message",
3857+
"type": "array",
3858+
"items": {
3859+
"$ref": "#/definitions/requests.MessageAttachment"
3860+
}
3861+
},
36323862
"content": {
36333863
"type": "string",
36343864
"example": "This is a sample text message received on a phone"
@@ -3644,7 +3874,11 @@ const docTemplate = `{
36443874
},
36453875
"sim": {
36463876
"description": "SIM card that received the message",
3647-
"type": "string",
3877+
"allOf": [
3878+
{
3879+
"$ref": "#/definitions/entities.SIM"
3880+
}
3881+
],
36483882
"example": "SIM1"
36493883
},
36503884
"timestamp": {
@@ -3666,6 +3900,17 @@ const docTemplate = `{
36663900
"to"
36673901
],
36683902
"properties": {
3903+
"attachments": {
3904+
"description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
3905+
"type": "array",
3906+
"items": {
3907+
"type": "string"
3908+
},
3909+
"example": [
3910+
"https://example.com/image.jpg",
3911+
"https://example.com/video.mp4"
3912+
]
3913+
},
36693914
"content": {
36703915
"type": "string",
36713916
"example": "This is a sample text message"
@@ -4612,6 +4857,8 @@ var SwaggerInfo = &swag.Spec{
46124857
Description: "Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.",
46134858
InfoInstanceName: "swagger",
46144859
SwaggerTemplate: docTemplate,
4860+
LeftDelim: "{{",
4861+
RightDelim: "}}",
46154862
}
46164863

46174864
func init() {

0 commit comments

Comments
 (0)