Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix swagger parsing

Acho Arnold476a2afb0e3a
diff --git a/api/Dockerfile b/api/Dockerfile
index 6d493a82..34d82403 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -15,7 +15,7 @@ COPY . .
RUN go get github.com/swaggo/swag/gen@latest
RUN go get github.com/swaggo/swag/cmd/swag@latest
RUN go install github.com/swaggo/swag/cmd/swag
-RUN swag init
+RUN swag init --requiredByDefault --parseDependency --parseInternal
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$GIT_COMMIT" -o /bin/http-sms .
diff --git a/api/docs/docs.go b/api/docs/docs.go
index 274f7e6d..908d34c3 100644
--- a/api/docs/docs.go
+++ b/api/docs/docs.go
@@ -23,14 +23,14 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
- "/api-keys": {
+ "/billing/usage": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get list phone API keys which a user has registered on the httpSMS application",
+ "description": "Get the summary of sent and received messages for a user in the current month",
"consumes": [
"application/json"
],
@@ -38,37 +38,14 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "PhoneAPIKeys"
- ],
- "summary": "Get the phone API keys of a user",
- "parameters": [
- {
- "minimum": 0,
- "type": "integer",
- "description": "number of api keys to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter api keys with name containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 100,
- "minimum": 1,
- "type": "integer",
- "description": "number of api keys to return",
- "name": "limit",
- "in": "query"
- }
+ "Billing"
],
+ "summary": "Get Billing Usage.",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.PhoneAPIKeysResponse"
+ "$ref": "#/definitions/responses.BillingUsageResponse"
}
},
"400": {
@@ -96,14 +73,16 @@ const docTemplate = `{
}
}
}
- },
- "post": {
+ }
+ },
+ "/billing/usage-history": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Creates a new phone API key which can be used to log in to the httpSMS app on your Android phone",
+ "description": "Get billing usage records of sent and received messages for a user in the past. It will be sorted by timestamp in descending order.",
"consumes": [
"application/json"
],
@@ -111,25 +90,31 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "PhoneAPIKeys"
+ "Billing"
],
- "summary": "store phone API key",
+ "summary": "Get billing usage history.",
"parameters": [
{
- "description": "Payload of new phone API key.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.PhoneAPIKeyStoreRequest"
- }
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of heartbeats to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "maximum": 100,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of heartbeats to return",
+ "name": "limit",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.PhoneAPIKeyResponse"
+ "$ref": "#/definitions/responses.BillingUsagesResponse"
}
},
"400": {
@@ -159,14 +144,14 @@ const docTemplate = `{
}
}
},
- "/api-keys/{phoneAPIKeyID}": {
- "delete": {
+ "/bulk-messages": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Delete a phone API Key from the database and cannot be used for authentication anymore.",
+ "description": "Sends bulk SMS messages to multiple users from a CSV file.",
"consumes": [
"application/json"
],
@@ -174,22 +159,12 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "PhoneAPIKeys"
- ],
- "summary": "Delete a phone API key from the database.",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the phone API key",
- "name": "phoneAPIKeyID",
- "in": "path",
- "required": true
- }
+ "BulkSMS"
],
+ "summary": "Store bulk SMS file",
"responses": {
- "204": {
- "description": "No Content",
+ "202": {
+ "description": "Accepted",
"schema": {
"$ref": "#/definitions/responses.NoContent"
}
@@ -206,12 +181,6 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
- "404": {
- "description": "Not Found",
- "schema": {
- "$ref": "#/definitions/responses.NotFound"
- }
- },
"422": {
"description": "Unprocessable Entity",
"schema": {
@@ -227,14 +196,14 @@ const docTemplate = `{
}
}
},
- "/api-keys/{phoneAPIKeyID}/phones/{phoneID}": {
- "delete": {
+ "/discord-integrations": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "You will need to login again to the httpSMS app on your Android phone with a new phone API key.",
+ "description": "Get the discord integrations of a user",
"consumes": [
"application/json"
],
@@ -242,32 +211,37 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "PhoneAPIKeys"
+ "DiscordIntegration"
],
- "summary": "Remove the association of a phone from the phone API key.",
+ "summary": "Get discord integrations of a user",
"parameters": [
{
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the phone API key",
- "name": "phoneAPIKeyID",
- "in": "path",
- "required": true
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of discord integrations to skip",
+ "name": "skip",
+ "in": "query"
},
{
"type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the phone",
- "name": "phoneID",
- "in": "path",
- "required": true
+ "description": "filter discord integrations containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 20,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of discord integrations to return",
+ "name": "limit",
+ "in": "query"
}
],
"responses": {
- "204": {
- "description": "No Content",
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/responses.NoContent"
+ "$ref": "#/definitions/responses.DiscordsResponse"
}
},
"400": {
@@ -282,12 +256,6 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
- "404": {
- "description": "Not Found",
- "schema": {
- "$ref": "#/definitions/responses.NotFound"
- }
- },
"422": {
"description": "Unprocessable Entity",
"schema": {
@@ -301,16 +269,14 @@ const docTemplate = `{
}
}
}
- }
- },
- "/billing/usage": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get the summary of sent and received messages for a user in the current month",
+ "description": "Store a discord integration for the authenticated user",
"consumes": [
"application/json"
],
@@ -318,14 +284,25 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Billing"
+ "DiscordIntegration"
+ ],
+ "summary": "Store discord integration",
+ "parameters": [
+ {
+ "description": "Payload of the discord integration request",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.DiscordStore"
+ }
+ }
],
- "summary": "Get Billing Usage.",
"responses": {
- "200": {
- "description": "OK",
+ "201": {
+ "description": "Created",
"schema": {
- "$ref": "#/definitions/responses.BillingUsageResponse"
+ "$ref": "#/definitions/responses.DiscordResponse"
}
},
"400": {
@@ -355,14 +332,14 @@ const docTemplate = `{
}
}
},
- "/billing/usage-history": {
- "get": {
+ "/discord-integrations/{discordID}": {
+ "put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get billing usage records of sent and received messages for a user in the past. It will be sorted by timestamp in descending order.",
+ "description": "Update a discord integration for the currently authenticated user",
"consumes": [
"application/json"
],
@@ -370,31 +347,33 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Billing"
+ "DiscordIntegration"
],
- "summary": "Get billing usage history.",
+ "summary": "Update a discord integration",
"parameters": [
{
- "minimum": 0,
- "type": "integer",
- "description": "number of heartbeats to skip",
- "name": "skip",
- "in": "query"
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the discord integration",
+ "name": "discordID",
+ "in": "path",
+ "required": true
},
{
- "maximum": 100,
- "minimum": 1,
- "type": "integer",
- "description": "number of heartbeats to return",
- "name": "limit",
- "in": "query"
+ "description": "Payload of discord integration to update",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.DiscordUpdate"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.BillingUsagesResponse"
+ "$ref": "#/definitions/responses.DiscordResponse"
}
},
"400": {
@@ -422,16 +401,14 @@ const docTemplate = `{
}
}
}
- }
- },
- "/bulk-messages": {
- "post": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Sends bulk SMS messages to multiple users from a CSV file.",
+ "description": "Delete a discord integration for a user",
"consumes": [
"application/json"
],
@@ -439,12 +416,22 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "BulkSMS"
+ "Webhooks"
+ ],
+ "summary": "Delete discord integration",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the discord integration",
+ "name": "discordID",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "Store bulk SMS file",
"responses": {
- "202": {
- "description": "Accepted",
+ "204": {
+ "description": "No Content",
"schema": {
"$ref": "#/definitions/responses.NoContent"
}
@@ -476,14 +463,9 @@ const docTemplate = `{
}
}
},
- "/discord-integrations": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get the discord integrations of a user",
+ "/discord/event": {
+ "post": {
+ "description": "Publish a discord event to the registered listeners",
"consumes": [
"application/json"
],
@@ -491,37 +473,14 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "DiscordIntegration"
- ],
- "summary": "Get discord integrations of a user",
- "parameters": [
- {
- "minimum": 0,
- "type": "integer",
- "description": "number of discord integrations to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter discord integrations containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 20,
- "minimum": 1,
- "type": "integer",
- "description": "number of discord integrations to return",
- "name": "limit",
- "in": "query"
- }
+ "Discord"
],
+ "summary": "Consume a discord event",
"responses": {
- "200": {
- "description": "OK",
+ "204": {
+ "description": "No Content",
"schema": {
- "$ref": "#/definitions/responses.DiscordsResponse"
+ "$ref": "#/definitions/responses.NoContent"
}
},
"400": {
@@ -549,14 +508,16 @@ const docTemplate = `{
}
}
}
- },
- "post": {
+ }
+ },
+ "/heartbeats": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Store a discord integration for the authenticated user",
+ "description": "Get the last time a phone number requested for outstanding messages. It will be sorted by timestamp in descending order.",
"consumes": [
"application/json"
],
@@ -564,25 +525,45 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "DiscordIntegration"
+ "Heartbeats"
],
- "summary": "Store discord integration",
+ "summary": "Get heartbeats of an owner phone number",
"parameters": [
{
- "description": "Payload of the discord integration request",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.DiscordStore"
- }
+ "type": "string",
+ "default": "+18005550199",
+ "description": "the owner's phone number",
+ "name": "owner",
+ "in": "query",
+ "required": true
+ },
+ {
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of heartbeats to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 20,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of heartbeats to return",
+ "name": "limit",
+ "in": "query"
}
],
"responses": {
- "201": {
- "description": "Created",
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/responses.DiscordResponse"
+ "$ref": "#/definitions/responses.HeartbeatsResponse"
}
},
"400": {
@@ -610,16 +591,14 @@ const docTemplate = `{
}
}
}
- }
- },
- "/discord-integrations/{discordID}": {
- "put": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Update a discord integration for the currently authenticated user",
+ "description": "Store the heartbeat to make notify that a phone number is still active",
"consumes": [
"application/json"
],
@@ -627,25 +606,17 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "DiscordIntegration"
+ "Heartbeats"
],
- "summary": "Update a discord integration",
+ "summary": "Register heartbeat of an owner phone number",
"parameters": [
{
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the discord integration",
- "name": "discordID",
- "in": "path",
- "required": true
- },
- {
- "description": "Payload of discord integration to update",
+ "description": "Payload of the heartbeat request",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.DiscordUpdate"
+ "$ref": "#/definitions/requests.HeartbeatStore"
}
}
],
@@ -653,7 +624,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.DiscordResponse"
+ "$ref": "#/definitions/responses.HeartbeatResponse"
}
},
"400": {
@@ -681,14 +652,11 @@ const docTemplate = `{
}
}
}
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a discord integration for a user",
+ }
+ },
+ "/integration/3cx/messages": {
+ "post": {
+ "description": "Sends an SMS message from the 3CX platform",
"consumes": [
"application/json"
],
@@ -696,19 +664,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Webhooks"
- ],
- "summary": "Delete discord integration",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the discord integration",
- "name": "discordID",
- "in": "path",
- "required": true
- }
+ "3CXIntegration"
],
+ "summary": "Sends a 3CX SMS message",
"responses": {
"204": {
"description": "No Content",
@@ -743,9 +701,9 @@ const docTemplate = `{
}
}
},
- "/discord/event": {
+ "/lemonsqueezy/event": {
"post": {
- "description": "Publish a discord event to the registered listeners",
+ "description": "Publish a lemonsqueezy event to the registered listeners",
"consumes": [
"application/json"
],
@@ -753,9 +711,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Discord"
+ "Lemonsqueezy"
],
- "summary": "Consume a discord event",
+ "summary": "Consume a lemonsqueezy event",
"responses": {
"204": {
"description": "No Content",
@@ -790,14 +748,14 @@ const docTemplate = `{
}
}
},
- "/heartbeats": {
+ "/message-threads": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get the last time a phone number requested for outstanding messages. It will be sorted by timestamp in descending order.",
+ "description": "Get list of contacts which a phone number has communicated with (threads). It will be sorted by timestamp in descending order.",
"consumes": [
"application/json"
],
@@ -805,14 +763,14 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Heartbeats"
+ "MessageThreads"
],
- "summary": "Get heartbeats of an owner phone number",
+ "summary": "Get message threads for a phone number",
"parameters": [
{
"type": "string",
"default": "+18005550199",
- "description": "the owner's phone number",
+ "description": "owner phone number",
"name": "owner",
"in": "query",
"required": true
@@ -820,13 +778,13 @@ const docTemplate = `{
{
"minimum": 0,
"type": "integer",
- "description": "number of heartbeats to skip",
+ "description": "number of messages to skip",
"name": "skip",
"in": "query"
},
{
"type": "string",
- "description": "filter containing query",
+ "description": "filter message threads containing query",
"name": "query",
"in": "query"
},
@@ -834,7 +792,7 @@ const docTemplate = `{
"maximum": 20,
"minimum": 1,
"type": "integer",
- "description": "number of heartbeats to return",
+ "description": "number of messages to return",
"name": "limit",
"in": "query"
}
@@ -843,7 +801,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.HeartbeatsResponse"
+ "$ref": "#/definitions/responses.MessageThreadsResponse"
}
},
"400": {
@@ -871,14 +829,16 @@ const docTemplate = `{
}
}
}
- },
- "post": {
+ }
+ },
+ "/message-threads/{messageThreadID}": {
+ "put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Store the heartbeat to make notify that a phone number is still active",
+ "description": "Updates the details of a message thread",
"consumes": [
"application/json"
],
@@ -886,17 +846,25 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Heartbeats"
+ "MessageThreads"
],
- "summary": "Register heartbeat of an owner phone number",
+ "summary": "Update a message thread",
"parameters": [
{
- "description": "Payload of the heartbeat request",
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message thread",
+ "name": "messageThreadID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Payload of message thread details to update",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.HeartbeatStore"
+ "$ref": "#/definitions/requests.MessageThreadUpdate"
}
}
],
@@ -904,7 +872,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.HeartbeatResponse"
+ "$ref": "#/definitions/responses.PhoneResponse"
}
},
"400": {
@@ -932,11 +900,14 @@ const docTemplate = `{
}
}
}
- }
- },
- "/integration/3cx/messages": {
- "post": {
- "description": "Sends an SMS message from the 3CX platform",
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete a message thread from the database and also deletes all the messages in the thread.",
"consumes": [
"application/json"
],
@@ -944,9 +915,19 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "3CXIntegration"
+ "MessageThreads"
+ ],
+ "summary": "Delete a message thread from the database.",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message thread",
+ "name": "messageThreadID",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "Sends a 3CX SMS message",
"responses": {
"204": {
"description": "No Content",
@@ -966,6 +947,12 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
"422": {
"description": "Unprocessable Entity",
"schema": {
@@ -981,9 +968,14 @@ const docTemplate = `{
}
}
},
- "/lemonsqueezy/event": {
- "post": {
- "description": "Publish a lemonsqueezy event to the registered listeners",
+ "/messages": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get list of messages which are sent between 2 phone numbers. It will be sorted by timestamp in descending order.",
"consumes": [
"application/json"
],
@@ -991,14 +983,53 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Lemonsqueezy"
+ "Messages"
+ ],
+ "summary": "Get messages which are sent between 2 phone numbers",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "+18005550199",
+ "description": "the owner's phone number",
+ "name": "owner",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "default": "+18005550100",
+ "description": "the contact's phone number",
+ "name": "contact",
+ "in": "query",
+ "required": true
+ },
+ {
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of messages to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter messages containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 20,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of messages to return",
+ "name": "limit",
+ "in": "query"
+ }
],
- "summary": "Consume a lemonsqueezy event",
"responses": {
- "204": {
- "description": "No Content",
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/responses.NoContent"
+ "$ref": "#/definitions/responses.MessagesResponse"
}
},
"400": {
@@ -1028,14 +1059,14 @@ const docTemplate = `{
}
}
},
- "/message-threads": {
- "get": {
+ "/messages/bulk-send": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get list of contacts which a phone number has communicated with (threads). It will be sorted by timestamp in descending order.",
+ "description": "Add bulk SMS messages to be sent by the android phone",
"consumes": [
"application/json"
],
@@ -1043,45 +1074,28 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "MessageThreads"
+ "Messages"
],
- "summary": "Get message threads for a phone number",
+ "summary": "Send bulk SMS messages",
"parameters": [
{
- "type": "string",
- "default": "+18005550199",
- "description": "owner phone number",
- "name": "owner",
- "in": "query",
- "required": true
- },
- {
- "minimum": 0,
- "type": "integer",
- "description": "number of messages to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter message threads containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 20,
- "minimum": 1,
- "type": "integer",
- "description": "number of messages to return",
- "name": "limit",
- "in": "query"
+ "description": "Bulk send message request payload",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageBulkSend"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.MessageThreadsResponse"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/responses.MessagesResponse"
+ }
}
},
"400": {
@@ -1111,14 +1125,14 @@ const docTemplate = `{
}
}
},
- "/message-threads/{messageThreadID}": {
- "put": {
+ "/messages/calls/missed": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Updates the details of a message thread",
+ "description": "This endpoint is called by the httpSMS android app to register a missed call event on the mobile phone.",
"consumes": [
"application/json"
],
@@ -1126,25 +1140,17 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "MessageThreads"
+ "Messages"
],
- "summary": "Update a message thread",
+ "summary": "Register a missed call event on the mobile phone",
"parameters": [
{
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message thread",
- "name": "messageThreadID",
- "in": "path",
- "required": true
- },
- {
- "description": "Payload of message thread details to update",
+ "description": "Payload of the missed call event.",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.MessageThreadUpdate"
+ "$ref": "#/definitions/requests.MessageCallMissed"
}
}
],
@@ -1152,7 +1158,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.PhoneResponse"
+ "$ref": "#/definitions/responses.MessageResponse"
}
},
"400": {
@@ -1167,6 +1173,12 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
"422": {
"description": "Unprocessable Entity",
"schema": {
@@ -1180,14 +1192,16 @@ const docTemplate = `{
}
}
}
- },
- "delete": {
+ }
+ },
+ "/messages/outstanding": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Delete a message thread from the database and also deletes all the messages in the thread.",
+ "description": "Get an outstanding message to be sent by an android phone",
"consumes": [
"application/json"
],
@@ -1195,24 +1209,24 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "MessageThreads"
+ "Messages"
],
- "summary": "Delete a message thread from the database.",
+ "summary": "Get an outstanding message",
"parameters": [
{
"type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message thread",
- "name": "messageThreadID",
- "in": "path",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703cb",
+ "description": "The ID of the message",
+ "name": "message_id",
+ "in": "query",
"required": true
}
],
"responses": {
- "204": {
- "description": "No Content",
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/responses.NoContent"
+ "$ref": "#/definitions/responses.MessageResponse"
}
},
"400": {
@@ -1227,10 +1241,61 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
- "404": {
- "description": "Not Found",
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages/receive": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Add a new message received from a mobile phone",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Messages"
+ ],
+ "summary": "Receive a new SMS message from a mobile phone",
+ "parameters": [
+ {
+ "description": "Received message request payload",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageReceive"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
"schema": {
- "$ref": "#/definitions/responses.NotFound"
+ "$ref": "#/definitions/responses.BadRequest"
}
},
"422": {
@@ -1248,14 +1313,14 @@ const docTemplate = `{
}
}
},
- "/messages": {
+ "/messages/search": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get list of messages which are sent between 2 phone numbers. It will be sorted by timestamp in descending order.",
+ "description": "This returns the list of all messages based on the filter criteria including missed calls",
"consumes": [
"application/json"
],
@@ -1265,21 +1330,20 @@ const docTemplate = `{
"tags": [
"Messages"
],
- "summary": "Get messages which are sent between 2 phone numbers",
+ "summary": "Search all messages of a user",
"parameters": [
{
"type": "string",
- "default": "+18005550199",
- "description": "the owner's phone number",
- "name": "owner",
- "in": "query",
+ "description": "Cloudflare turnstile token https://www.cloudflare.com/en-gb/application-services/products/turnstile/",
+ "name": "token",
+ "in": "header",
"required": true
},
{
"type": "string",
- "default": "+18005550100",
- "description": "the contact's phone number",
- "name": "contact",
+ "default": "+18005550199,+18005550100",
+ "description": "the owner's phone numbers",
+ "name": "owners",
"in": "query",
"required": true
},
@@ -1297,7 +1361,7 @@ const docTemplate = `{
"in": "query"
},
{
- "maximum": 20,
+ "maximum": 200,
"minimum": 1,
"type": "integer",
"description": "number of messages to return",
@@ -1339,14 +1403,14 @@ const docTemplate = `{
}
}
},
- "/messages/bulk-send": {
+ "/messages/send": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Add bulk SMS messages to be sent by the android phone",
+ "description": "Add a new SMS message to be sent by the android phone",
"consumes": [
"application/json"
],
@@ -1356,15 +1420,15 @@ const docTemplate = `{
"tags": [
"Messages"
],
- "summary": "Send bulk SMS messages",
+ "summary": "Send a new SMS message",
"parameters": [
{
- "description": "Bulk send message request payload",
+ "description": "PostSend message request payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.MessageBulkSend"
+ "$ref": "#/definitions/requests.MessageSend"
}
}
],
@@ -1372,10 +1436,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/responses.MessagesResponse"
- }
+ "$ref": "#/definitions/responses.MessageResponse"
}
},
"400": {
@@ -1405,14 +1466,14 @@ const docTemplate = `{
}
}
},
- "/messages/calls/missed": {
- "post": {
+ "/messages/{messageID}": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "This endpoint is called by the httpSMS android app to register a missed call event on the mobile phone.",
+ "description": "Delete a message from the database and removes the message content from the list of threads.",
"consumes": [
"application/json"
],
@@ -1422,23 +1483,22 @@ const docTemplate = `{
"tags": [
"Messages"
],
- "summary": "Register a missed call event on the mobile phone",
+ "summary": "Delete a message from the database.",
"parameters": [
{
- "description": "Payload of the missed call event.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageCallMissed"
- }
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
+ "required": true
}
],
"responses": {
- "200": {
- "description": "OK",
+ "204": {
+ "description": "No Content",
"schema": {
- "$ref": "#/definitions/responses.MessageResponse"
+ "$ref": "#/definitions/responses.NoContent"
}
},
"400": {
@@ -1474,14 +1534,14 @@ const docTemplate = `{
}
}
},
- "/messages/outstanding": {
- "get": {
+ "/messages/{messageID}/events": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get an outstanding message to be sent by an android phone",
+ "description": "Use this endpoint to send events for a message when it is failed, sent or delivered by the mobile phone.",
"consumes": [
"application/json"
],
@@ -1491,15 +1551,24 @@ const docTemplate = `{
"tags": [
"Messages"
],
- "summary": "Get an outstanding message",
+ "summary": "Upsert an event for a message on the mobile phone",
"parameters": [
{
"type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703cb",
- "description": "The ID of the message",
- "name": "message_id",
- "in": "query",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
"required": true
+ },
+ {
+ "description": "Payload of the event emitted.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageEvent"
+ }
}
],
"responses": {
@@ -1521,61 +1590,10 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
- },
- "/messages/receive": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Add a new message received from a mobile phone",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Messages"
- ],
- "summary": "Receive a new SMS message from a mobile phone",
- "parameters": [
- {
- "description": "Received message request payload",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageReceive"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.MessageResponse"
- }
- },
- "400": {
- "description": "Bad Request",
+ "404": {
+ "description": "Not Found",
"schema": {
- "$ref": "#/definitions/responses.BadRequest"
+ "$ref": "#/definitions/responses.NotFound"
}
},
"422": {
@@ -1593,14 +1611,14 @@ const docTemplate = `{
}
}
},
- "/messages/search": {
+ "/phone-api-keys": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "This returns the list of all messages based on the filter criteria including missed calls",
+ "description": "Get list phone API keys which a user has registered on the httpSMS application",
"consumes": [
"application/json"
],
@@ -1608,43 +1626,28 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Messages"
+ "PhoneAPIKeys"
],
- "summary": "Search all messages of a user",
+ "summary": "Get the phone API keys of a user",
"parameters": [
- {
- "type": "string",
- "description": "Cloudflare turnstile token https://www.cloudflare.com/en-gb/application-services/products/turnstile/",
- "name": "token",
- "in": "header",
- "required": true
- },
- {
- "type": "string",
- "default": "+18005550199,+18005550100",
- "description": "the owner's phone numbers",
- "name": "owners",
- "in": "query",
- "required": true
- },
{
"minimum": 0,
"type": "integer",
- "description": "number of messages to skip",
+ "description": "number of phone api keys to skip",
"name": "skip",
"in": "query"
},
{
"type": "string",
- "description": "filter messages containing query",
+ "description": "filter phone api keys with name containing query",
"name": "query",
"in": "query"
},
{
- "maximum": 200,
+ "maximum": 100,
"minimum": 1,
"type": "integer",
- "description": "number of messages to return",
+ "description": "number of phone api keys to return",
"name": "limit",
"in": "query"
}
@@ -1653,7 +1656,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.MessagesResponse"
+ "$ref": "#/definitions/responses.PhoneAPIKeysResponse"
}
},
"400": {
@@ -1681,16 +1684,14 @@ const docTemplate = `{
}
}
}
- }
- },
- "/messages/send": {
+ },
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Add a new SMS message to be sent by the android phone",
+ "description": "Creates a new phone API key which can be used to log in to the httpSMS app on your Android phone",
"consumes": [
"application/json"
],
@@ -1698,17 +1699,17 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Messages"
+ "PhoneAPIKeys"
],
- "summary": "Send a new SMS message",
+ "summary": "Store phone API key",
"parameters": [
{
- "description": "PostSend message request payload",
+ "description": "Payload of new phone API key.",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.MessageSend"
+ "$ref": "#/definitions/requests.PhoneAPIKeyStoreRequest"
}
}
],
@@ -1716,7 +1717,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.MessageResponse"
+ "$ref": "#/definitions/responses.PhoneAPIKeyResponse"
}
},
"400": {
@@ -1746,14 +1747,14 @@ const docTemplate = `{
}
}
},
- "/messages/{messageID}": {
+ "/phone-api-keys/{phoneAPIKeyID}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Delete a message from the database and removes the message content from the list of threads.",
+ "description": "Delete a phone API Key from the database and cannot be used for authentication anymore.",
"consumes": [
"application/json"
],
@@ -1761,15 +1762,15 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Messages"
+ "PhoneAPIKeys"
],
- "summary": "Delete a message from the database.",
+ "summary": "Delete a phone API key from the database.",
"parameters": [
{
"type": "string",
"default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message",
- "name": "messageID",
+ "description": "ID of the phone API key",
+ "name": "phoneAPIKeyID",
"in": "path",
"required": true
}
@@ -1814,14 +1815,14 @@ const docTemplate = `{
}
}
},
- "/messages/{messageID}/events": {
- "post": {
+ "/phone-api-keys/{phoneAPIKeyID}/phones/{phoneID}": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Use this endpoint to send events for a message when it is failed, sent or delivered by the mobile phone.",
+ "description": "You will need to login again to the httpSMS app on your Android phone with a new phone API key.",
"consumes": [
"application/json"
],
@@ -1829,33 +1830,32 @@ const docTemplate = `{
"application/json"
],
"tags": [
- "Messages"
+ "PhoneAPIKeys"
],
- "summary": "Upsert an event for a message on the mobile phone",
+ "summary": "Remove the association of a phone from the phone API key.",
"parameters": [
{
"type": "string",
"default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message",
- "name": "messageID",
+ "description": "ID of the phone API key",
+ "name": "phoneAPIKeyID",
"in": "path",
"required": true
},
{
- "description": "Payload of the event emitted.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageEvent"
- }
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the phone",
+ "name": "phoneID",
+ "in": "path",
+ "required": true
}
],
"responses": {
- "200": {
- "description": "OK",
+ "204": {
+ "description": "No Content",
"schema": {
- "$ref": "#/definitions/responses.MessageResponse"
+ "$ref": "#/definitions/responses.NoContent"
}
},
"400": {
@@ -3244,8 +3244,8 @@ const docTemplate = `{
"type": "string"
},
"example": [
- "[32343a19-da5e-4b1b-a767-3298a73703cb",
- "32343a19-da5e-4b1b-a767-3298a73703cc]"
+ "32343a19-da5e-4b1b-a767-3298a73703cb",
+ "32343a19-da5e-4b1b-a767-3298a73703cc"
]
},
"phone_numbers": {
@@ -3254,8 +3254,8 @@ const docTemplate = `{
"type": "string"
},
"example": [
- "[+18005550199",
- "+18005550100]"
+ "+18005550199",
+ "+18005550100"
]
},
"updated_at": {
@@ -3382,7 +3382,7 @@ const docTemplate = `{
"type": "string"
},
"example": [
- "[message.phone.received]"
+ "message.phone.received"
]
},
"id": {
@@ -3395,8 +3395,8 @@ const docTemplate = `{
"type": "string"
},
"example": [
- "[+18005550199",
- "+18005550100]"
+ "+18005550199",
+ "+18005550100"
]
},
"signing_key": {
@@ -3607,7 +3607,6 @@ const docTemplate = `{
"type": "object",
"required": [
"content",
- "encrypted",
"from",
"to"
],
@@ -3617,7 +3616,7 @@ const docTemplate = `{
"example": "This is a sample text message"
},
"encrypted": {
- "description": "Encrypted is used to determine if the content is end-to-end encrypted. Make sure to set the encryption key on the httpSMS mobile app",
+ "description": "Encrypted is an optional parameter used to determine if the content is end-to-end encrypted. Make sure to set the encryption key on the httpSMS mobile app",
"type": "boolean",
"example": false
},
@@ -3878,7 +3877,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3902,7 +3901,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3923,7 +3922,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3947,7 +3946,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3968,7 +3967,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3992,7 +3991,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4030,7 +4029,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4054,7 +4053,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4078,7 +4077,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4154,7 +4153,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4178,7 +4177,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4199,7 +4198,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4223,7 +4222,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4272,7 +4271,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "validation errors while sending message"
+ "example": "validation errors while handling request"
},
"status": {
"type": "string",
@@ -4293,7 +4292,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4314,7 +4313,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -4338,7 +4337,7 @@ const docTemplate = `{
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
diff --git a/api/docs/swagger.json b/api/docs/swagger.json
index 5130748a..fb49b100 100644
--- a/api/docs/swagger.json
+++ b/api/docs/swagger.json
@@ -17,262 +17,6 @@
"host": "api.httpsms.com",
"basePath": "/v1",
"paths": {
- "/api-keys": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get list phone API keys which a user has registered on the httpSMS application",
- "consumes": ["application/json"],
- "produces": ["application/json"],
- "tags": ["PhoneAPIKeys"],
- "summary": "Get the phone API keys of a user",
- "parameters": [
- {
- "minimum": 0,
- "type": "integer",
- "description": "number of api keys to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter api keys with name containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 100,
- "minimum": 1,
- "type": "integer",
- "description": "number of api keys to return",
- "name": "limit",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhoneAPIKeysResponse"
- }
- },
- "400": {
- "description": "Bad Request",
- "schema": {
- "$ref": "#/definitions/responses.BadRequest"
- }
- },
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Creates a new phone API key which can be used to log in to the httpSMS app on your Android phone",
- "consumes": ["application/json"],
- "produces": ["application/json"],
- "tags": ["PhoneAPIKeys"],
- "summary": "store phone API key",
- "parameters": [
- {
- "description": "Payload of new phone API key.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.PhoneAPIKeyStoreRequest"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhoneAPIKeyResponse"
- }
- },
- "400": {
- "description": "Bad Request",
- "schema": {
- "$ref": "#/definitions/responses.BadRequest"
- }
- },
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
- },
- "/api-keys/{phoneAPIKeyID}": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a phone API Key from the database and cannot be used for authentication anymore.",
- "consumes": ["application/json"],
- "produces": ["application/json"],
- "tags": ["PhoneAPIKeys"],
- "summary": "Delete a phone API key from the database.",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the phone API key",
- "name": "phoneAPIKeyID",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "schema": {
- "$ref": "#/definitions/responses.NoContent"
- }
- },
- "400": {
- "description": "Bad Request",
- "schema": {
- "$ref": "#/definitions/responses.BadRequest"
- }
- },
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "404": {
- "description": "Not Found",
- "schema": {
- "$ref": "#/definitions/responses.NotFound"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
- },
- "/api-keys/{phoneAPIKeyID}/phones/{phoneID}": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "You will need to login again to the httpSMS app on your Android phone with a new phone API key.",
- "consumes": ["application/json"],
- "produces": ["application/json"],
- "tags": ["PhoneAPIKeys"],
- "summary": "Remove the association of a phone from the phone API key.",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the phone API key",
- "name": "phoneAPIKeyID",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the phone",
- "name": "phoneID",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "schema": {
- "$ref": "#/definitions/responses.NoContent"
- }
- },
- "400": {
- "description": "Bad Request",
- "schema": {
- "$ref": "#/definitions/responses.BadRequest"
- }
- },
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "404": {
- "description": "Not Found",
- "schema": {
- "$ref": "#/definitions/responses.NotFound"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
- },
"/billing/usage": {
"get": {
"security": [
@@ -1101,18 +845,333 @@
"$ref": "#/definitions/responses.BadRequest"
}
},
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "404": {
- "description": "Not Found",
- "schema": {
- "$ref": "#/definitions/responses.NotFound"
- }
- },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get list of messages which are sent between 2 phone numbers. It will be sorted by timestamp in descending order.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Get messages which are sent between 2 phone numbers",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "+18005550199",
+ "description": "the owner's phone number",
+ "name": "owner",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "default": "+18005550100",
+ "description": "the contact's phone number",
+ "name": "contact",
+ "in": "query",
+ "required": true
+ },
+ {
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of messages to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter messages containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 20,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of messages to return",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessagesResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages/bulk-send": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Add bulk SMS messages to be sent by the android phone",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Send bulk SMS messages",
+ "parameters": [
+ {
+ "description": "Bulk send message request payload",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageBulkSend"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/responses.MessagesResponse"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages/calls/missed": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "This endpoint is called by the httpSMS android app to register a missed call event on the mobile phone.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Register a missed call event on the mobile phone",
+ "parameters": [
+ {
+ "description": "Payload of the missed call event.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageCallMissed"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages/outstanding": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get an outstanding message to be sent by an android phone",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Get an outstanding message",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703cb",
+ "description": "The ID of the message",
+ "name": "message_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages/receive": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Add a new message received from a mobile phone",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Receive a new SMS message from a mobile phone",
+ "parameters": [
+ {
+ "description": "Received message request payload",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageReceive"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
"422": {
"description": "Unprocessable Entity",
"schema": {
@@ -1128,32 +1187,31 @@
}
}
},
- "/messages": {
+ "/messages/search": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get list of messages which are sent between 2 phone numbers. It will be sorted by timestamp in descending order.",
+ "description": "This returns the list of all messages based on the filter criteria including missed calls",
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["Messages"],
- "summary": "Get messages which are sent between 2 phone numbers",
+ "summary": "Search all messages of a user",
"parameters": [
{
"type": "string",
- "default": "+18005550199",
- "description": "the owner's phone number",
- "name": "owner",
- "in": "query",
+ "description": "Cloudflare turnstile token https://www.cloudflare.com/en-gb/application-services/products/turnstile/",
+ "name": "token",
+ "in": "header",
"required": true
},
{
"type": "string",
- "default": "+18005550100",
- "description": "the contact's phone number",
- "name": "contact",
+ "default": "+18005550199,+18005550100",
+ "description": "the owner's phone numbers",
+ "name": "owners",
"in": "query",
"required": true
},
@@ -1171,7 +1229,7 @@
"in": "query"
},
{
- "maximum": 20,
+ "maximum": 200,
"minimum": 1,
"type": "integer",
"description": "number of messages to return",
@@ -1213,26 +1271,26 @@
}
}
},
- "/messages/bulk-send": {
+ "/messages/send": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Add bulk SMS messages to be sent by the android phone",
+ "description": "Add a new SMS message to be sent by the android phone",
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["Messages"],
- "summary": "Send bulk SMS messages",
+ "summary": "Send a new SMS message",
"parameters": [
{
- "description": "Bulk send message request payload",
+ "description": "PostSend message request payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.MessageBulkSend"
+ "$ref": "#/definitions/requests.MessageSend"
}
}
],
@@ -1240,10 +1298,7 @@
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/responses.MessagesResponse"
- }
+ "$ref": "#/definitions/responses.MessageResponse"
}
},
"400": {
@@ -1273,34 +1328,33 @@
}
}
},
- "/messages/calls/missed": {
- "post": {
+ "/messages/{messageID}": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "This endpoint is called by the httpSMS android app to register a missed call event on the mobile phone.",
+ "description": "Delete a message from the database and removes the message content from the list of threads.",
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["Messages"],
- "summary": "Register a missed call event on the mobile phone",
+ "summary": "Delete a message from the database.",
"parameters": [
{
- "description": "Payload of the missed call event.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageCallMissed"
- }
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
+ "required": true
}
],
"responses": {
- "200": {
- "description": "OK",
+ "204": {
+ "description": "No Content",
"schema": {
- "$ref": "#/definitions/responses.MessageResponse"
+ "$ref": "#/definitions/responses.NoContent"
}
},
"400": {
@@ -1336,26 +1390,35 @@
}
}
},
- "/messages/outstanding": {
- "get": {
+ "/messages/{messageID}/events": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get an outstanding message to be sent by an android phone",
+ "description": "Use this endpoint to send events for a message when it is failed, sent or delivered by the mobile phone.",
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["Messages"],
- "summary": "Get an outstanding message",
+ "summary": "Upsert an event for a message on the mobile phone",
"parameters": [
{
"type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703cb",
- "description": "The ID of the message",
- "name": "message_id",
- "in": "query",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
"required": true
+ },
+ {
+ "description": "Payload of the event emitted.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageEvent"
+ }
}
],
"responses": {
@@ -1377,55 +1440,10 @@
"$ref": "#/definitions/responses.Unauthorized"
}
},
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
- },
- "/messages/receive": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Add a new message received from a mobile phone",
- "consumes": ["application/json"],
- "produces": ["application/json"],
- "tags": ["Messages"],
- "summary": "Receive a new SMS message from a mobile phone",
- "parameters": [
- {
- "description": "Received message request payload",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageReceive"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.MessageResponse"
- }
- },
- "400": {
- "description": "Bad Request",
+ "404": {
+ "description": "Not Found",
"schema": {
- "$ref": "#/definitions/responses.BadRequest"
+ "$ref": "#/definitions/responses.NotFound"
}
},
"422": {
@@ -1443,52 +1461,37 @@
}
}
},
- "/messages/search": {
+ "/phone-api-keys": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "This returns the list of all messages based on the filter criteria including missed calls",
+ "description": "Get list phone API keys which a user has registered on the httpSMS application",
"consumes": ["application/json"],
"produces": ["application/json"],
- "tags": ["Messages"],
- "summary": "Search all messages of a user",
+ "tags": ["PhoneAPIKeys"],
+ "summary": "Get the phone API keys of a user",
"parameters": [
- {
- "type": "string",
- "description": "Cloudflare turnstile token https://www.cloudflare.com/en-gb/application-services/products/turnstile/",
- "name": "token",
- "in": "header",
- "required": true
- },
- {
- "type": "string",
- "default": "+18005550199,+18005550100",
- "description": "the owner's phone numbers",
- "name": "owners",
- "in": "query",
- "required": true
- },
{
"minimum": 0,
"type": "integer",
- "description": "number of messages to skip",
+ "description": "number of phone api keys to skip",
"name": "skip",
"in": "query"
},
{
"type": "string",
- "description": "filter messages containing query",
+ "description": "filter phone api keys with name containing query",
"name": "query",
"in": "query"
},
{
- "maximum": 200,
+ "maximum": 100,
"minimum": 1,
"type": "integer",
- "description": "number of messages to return",
+ "description": "number of phone api keys to return",
"name": "limit",
"in": "query"
}
@@ -1497,7 +1500,7 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.MessagesResponse"
+ "$ref": "#/definitions/responses.PhoneAPIKeysResponse"
}
},
"400": {
@@ -1525,28 +1528,26 @@
}
}
}
- }
- },
- "/messages/send": {
+ },
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Add a new SMS message to be sent by the android phone",
+ "description": "Creates a new phone API key which can be used to log in to the httpSMS app on your Android phone",
"consumes": ["application/json"],
"produces": ["application/json"],
- "tags": ["Messages"],
- "summary": "Send a new SMS message",
+ "tags": ["PhoneAPIKeys"],
+ "summary": "Store phone API key",
"parameters": [
{
- "description": "PostSend message request payload",
+ "description": "Payload of new phone API key.",
"name": "payload",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.MessageSend"
+ "$ref": "#/definitions/requests.PhoneAPIKeyStoreRequest"
}
}
],
@@ -1554,7 +1555,7 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.MessageResponse"
+ "$ref": "#/definitions/responses.PhoneAPIKeyResponse"
}
},
"400": {
@@ -1584,24 +1585,24 @@
}
}
},
- "/messages/{messageID}": {
+ "/phone-api-keys/{phoneAPIKeyID}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Delete a message from the database and removes the message content from the list of threads.",
+ "description": "Delete a phone API Key from the database and cannot be used for authentication anymore.",
"consumes": ["application/json"],
"produces": ["application/json"],
- "tags": ["Messages"],
- "summary": "Delete a message from the database.",
+ "tags": ["PhoneAPIKeys"],
+ "summary": "Delete a phone API key from the database.",
"parameters": [
{
"type": "string",
"default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message",
- "name": "messageID",
+ "description": "ID of the phone API key",
+ "name": "phoneAPIKeyID",
"in": "path",
"required": true
}
@@ -1646,42 +1647,41 @@
}
}
},
- "/messages/{messageID}/events": {
- "post": {
+ "/phone-api-keys/{phoneAPIKeyID}/phones/{phoneID}": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Use this endpoint to send events for a message when it is failed, sent or delivered by the mobile phone.",
+ "description": "You will need to login again to the httpSMS app on your Android phone with a new phone API key.",
"consumes": ["application/json"],
"produces": ["application/json"],
- "tags": ["Messages"],
- "summary": "Upsert an event for a message on the mobile phone",
+ "tags": ["PhoneAPIKeys"],
+ "summary": "Remove the association of a phone from the phone API key.",
"parameters": [
{
"type": "string",
"default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message",
- "name": "messageID",
+ "description": "ID of the phone API key",
+ "name": "phoneAPIKeyID",
"in": "path",
"required": true
},
{
- "description": "Payload of the event emitted.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageEvent"
- }
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the phone",
+ "name": "phoneID",
+ "in": "path",
+ "required": true
}
],
"responses": {
- "200": {
- "description": "OK",
+ "204": {
+ "description": "No Content",
"schema": {
- "$ref": "#/definitions/responses.MessageResponse"
+ "$ref": "#/definitions/responses.NoContent"
}
},
"400": {
@@ -2984,8 +2984,8 @@
"type": "string"
},
"example": [
- "[32343a19-da5e-4b1b-a767-3298a73703cb",
- "32343a19-da5e-4b1b-a767-3298a73703cc]"
+ "32343a19-da5e-4b1b-a767-3298a73703cb",
+ "32343a19-da5e-4b1b-a767-3298a73703cc"
]
},
"phone_numbers": {
@@ -2993,7 +2993,7 @@
"items": {
"type": "string"
},
- "example": ["[+18005550199", "+18005550100]"]
+ "example": ["+18005550199", "+18005550100"]
},
"updated_at": {
"type": "string",
@@ -3118,7 +3118,7 @@
"items": {
"type": "string"
},
- "example": ["[message.phone.received]"]
+ "example": ["message.phone.received"]
},
"id": {
"type": "string",
@@ -3129,7 +3129,7 @@
"items": {
"type": "string"
},
- "example": ["[+18005550199", "+18005550100]"]
+ "example": ["+18005550199", "+18005550100"]
},
"signing_key": {
"type": "string",
@@ -3302,14 +3302,14 @@
},
"requests.MessageSend": {
"type": "object",
- "required": ["content", "encrypted", "from", "to"],
+ "required": ["content", "from", "to"],
"properties": {
"content": {
"type": "string",
"example": "This is a sample text message"
},
"encrypted": {
- "description": "Encrypted is used to determine if the content is end-to-end encrypted. Make sure to set the encryption key on the httpSMS mobile app",
+ "description": "Encrypted is an optional parameter used to determine if the content is end-to-end encrypted. Make sure to set the encryption key on the httpSMS mobile app",
"type": "boolean",
"example": false
},
@@ -3535,7 +3535,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3555,7 +3555,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3572,7 +3572,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3592,7 +3592,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3609,7 +3609,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3629,7 +3629,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3660,7 +3660,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3680,7 +3680,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3700,7 +3700,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3762,7 +3762,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3782,7 +3782,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3799,7 +3799,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3819,7 +3819,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3860,7 +3860,7 @@
},
"message": {
"type": "string",
- "example": "validation errors while sending message"
+ "example": "validation errors while handling request"
},
"status": {
"type": "string",
@@ -3877,7 +3877,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3894,7 +3894,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
@@ -3914,7 +3914,7 @@
},
"message": {
"type": "string",
- "example": "item created successfully"
+ "example": "Request handled successfully"
},
"status": {
"type": "string",
diff --git a/api/docs/swagger.yaml b/api/docs/swagger.yaml
index 5cc0f418..a4124b82 100644
--- a/api/docs/swagger.yaml
+++ b/api/docs/swagger.yaml
@@ -341,15 +341,15 @@ definitions:
type: string
phone_ids:
example:
- - "[32343a19-da5e-4b1b-a767-3298a73703cb"
- - 32343a19-da5e-4b1b-a767-3298a73703cc]
+ - 32343a19-da5e-4b1b-a767-3298a73703cb
+ - 32343a19-da5e-4b1b-a767-3298a73703cc
items:
type: string
type: array
phone_numbers:
example:
- - "[+18005550199"
- - +18005550100]
+ - "+18005550199"
+ - "+18005550100"
items:
type: string
type: array
@@ -448,7 +448,7 @@ definitions:
type: string
events:
example:
- - "[message.phone.received]"
+ - message.phone.received
items:
type: string
type: array
@@ -457,8 +457,8 @@ definitions:
type: string
phone_numbers:
example:
- - "[+18005550199"
- - +18005550100]
+ - "+18005550199"
+ - "+18005550100"
items:
type: string
type: array
@@ -641,8 +641,9 @@ definitions:
type: string
encrypted:
description:
- Encrypted is used to determine if the content is end-to-end encrypted.
- Make sure to set the encryption key on the httpSMS mobile app
+ Encrypted is an optional parameter used to determine if the content
+ is end-to-end encrypted. Make sure to set the encryption key on the httpSMS
+ mobile app
example: false
type: boolean
from:
@@ -665,7 +666,6 @@ definitions:
type: string
required:
- content
- - encrypted
- from
- to
type: object
@@ -844,7 +844,7 @@ definitions:
data:
$ref: "#/definitions/entities.BillingUsage"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -861,7 +861,7 @@ definitions:
$ref: "#/definitions/entities.BillingUsage"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -876,7 +876,7 @@ definitions:
data:
$ref: "#/definitions/entities.Discord"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -893,7 +893,7 @@ definitions:
$ref: "#/definitions/entities.Discord"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -908,7 +908,7 @@ definitions:
data:
$ref: "#/definitions/entities.Heartbeat"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -925,7 +925,7 @@ definitions:
$ref: "#/definitions/entities.Heartbeat"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -952,7 +952,7 @@ definitions:
data:
$ref: "#/definitions/entities.Message"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -969,7 +969,7 @@ definitions:
$ref: "#/definitions/entities.MessageThread"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -986,7 +986,7 @@ definitions:
$ref: "#/definitions/entities.Message"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1040,7 +1040,7 @@ definitions:
data:
$ref: "#/definitions/entities.PhoneAPIKey"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1057,7 +1057,7 @@ definitions:
$ref: "#/definitions/entities.PhoneAPIKey"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1072,7 +1072,7 @@ definitions:
data:
$ref: "#/definitions/entities.Phone"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1089,7 +1089,7 @@ definitions:
$ref: "#/definitions/entities.Phone"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1124,7 +1124,7 @@ definitions:
type: array
type: object
message:
- example: validation errors while sending message
+ example: validation errors while handling request
type: string
status:
example: error
@@ -1139,7 +1139,7 @@ definitions:
data:
$ref: "#/definitions/entities.User"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1154,7 +1154,7 @@ definitions:
data:
$ref: "#/definitions/entities.Webhook"
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1171,7 +1171,7 @@ definitions:
$ref: "#/definitions/entities.Webhook"
type: array
message:
- example: item created successfully
+ example: Request handled successfully
type: string
status:
example: success
@@ -1195,196 +1195,6 @@ info:
title: httpSMS API Reference
version: "1.0"
paths:
- /api-keys:
- get:
- consumes:
- - application/json
- description:
- Get list phone API keys which a user has registered on the httpSMS
- application
- parameters:
- - description: number of api keys to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter api keys with name containing query
- in: query
- name: query
- type: string
- - description: number of api keys to return
- in: query
- maximum: 100
- minimum: 1
- name: limit
- type: integer
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: "#/definitions/responses.PhoneAPIKeysResponse"
- "400":
- description: Bad Request
- schema:
- $ref: "#/definitions/responses.BadRequest"
- "401":
- description: Unauthorized
- schema:
- $ref: "#/definitions/responses.Unauthorized"
- "422":
- description: Unprocessable Entity
- schema:
- $ref: "#/definitions/responses.UnprocessableEntity"
- "500":
- description: Internal Server Error
- schema:
- $ref: "#/definitions/responses.InternalServerError"
- security:
- - ApiKeyAuth: []
- summary: Get the phone API keys of a user
- tags:
- - PhoneAPIKeys
- post:
- consumes:
- - application/json
- description:
- Creates a new phone API key which can be used to log in to the
- httpSMS app on your Android phone
- parameters:
- - description: Payload of new phone API key.
- in: body
- name: payload
- required: true
- schema:
- $ref: "#/definitions/requests.PhoneAPIKeyStoreRequest"
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: "#/definitions/responses.PhoneAPIKeyResponse"
- "400":
- description: Bad Request
- schema:
- $ref: "#/definitions/responses.BadRequest"
- "401":
- description: Unauthorized
- schema:
- $ref: "#/definitions/responses.Unauthorized"
- "422":
- description: Unprocessable Entity
- schema:
- $ref: "#/definitions/responses.UnprocessableEntity"
- "500":
- description: Internal Server Error
- schema:
- $ref: "#/definitions/responses.InternalServerError"
- security:
- - ApiKeyAuth: []
- summary: store phone API key
- tags:
- - PhoneAPIKeys
- /api-keys/{phoneAPIKeyID}:
- delete:
- consumes:
- - application/json
- description:
- Delete a phone API Key from the database and cannot be used for
- authentication anymore.
- parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the phone API key
- in: path
- name: phoneAPIKeyID
- required: true
- type: string
- produces:
- - application/json
- responses:
- "204":
- description: No Content
- schema:
- $ref: "#/definitions/responses.NoContent"
- "400":
- description: Bad Request
- schema:
- $ref: "#/definitions/responses.BadRequest"
- "401":
- description: Unauthorized
- schema:
- $ref: "#/definitions/responses.Unauthorized"
- "404":
- description: Not Found
- schema:
- $ref: "#/definitions/responses.NotFound"
- "422":
- description: Unprocessable Entity
- schema:
- $ref: "#/definitions/responses.UnprocessableEntity"
- "500":
- description: Internal Server Error
- schema:
- $ref: "#/definitions/responses.InternalServerError"
- security:
- - ApiKeyAuth: []
- summary: Delete a phone API key from the database.
- tags:
- - PhoneAPIKeys
- /api-keys/{phoneAPIKeyID}/phones/{phoneID}:
- delete:
- consumes:
- - application/json
- description:
- You will need to login again to the httpSMS app on your Android
- phone with a new phone API key.
- parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the phone API key
- in: path
- name: phoneAPIKeyID
- required: true
- type: string
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the phone
- in: path
- name: phoneID
- required: true
- type: string
- produces:
- - application/json
- responses:
- "204":
- description: No Content
- schema:
- $ref: "#/definitions/responses.NoContent"
- "400":
- description: Bad Request
- schema:
- $ref: "#/definitions/responses.BadRequest"
- "401":
- description: Unauthorized
- schema:
- $ref: "#/definitions/responses.Unauthorized"
- "404":
- description: Not Found
- schema:
- $ref: "#/definitions/responses.NotFound"
- "422":
- description: Unprocessable Entity
- schema:
- $ref: "#/definitions/responses.UnprocessableEntity"
- "500":
- description: Internal Server Error
- schema:
- $ref: "#/definitions/responses.InternalServerError"
- security:
- - ApiKeyAuth: []
- summary: Remove the association of a phone from the phone API key.
- tags:
- - PhoneAPIKeys
/billing/usage:
get:
consumes:
@@ -2439,6 +2249,196 @@ paths:
summary: Send a new SMS message
tags:
- Messages
+ /phone-api-keys:
+ get:
+ consumes:
+ - application/json
+ description:
+ Get list phone API keys which a user has registered on the httpSMS
+ application
+ parameters:
+ - description: number of phone api keys to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter phone api keys with name containing query
+ in: query
+ name: query
+ type: string
+ - description: number of phone api keys to return
+ in: query
+ maximum: 100
+ minimum: 1
+ name: limit
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: "#/definitions/responses.PhoneAPIKeysResponse"
+ "400":
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/responses.BadRequest"
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: "#/definitions/responses.Unauthorized"
+ "422":
+ description: Unprocessable Entity
+ schema:
+ $ref: "#/definitions/responses.UnprocessableEntity"
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: "#/definitions/responses.InternalServerError"
+ security:
+ - ApiKeyAuth: []
+ summary: Get the phone API keys of a user
+ tags:
+ - PhoneAPIKeys
+ post:
+ consumes:
+ - application/json
+ description:
+ Creates a new phone API key which can be used to log in to the
+ httpSMS app on your Android phone
+ parameters:
+ - description: Payload of new phone API key.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.PhoneAPIKeyStoreRequest"
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: "#/definitions/responses.PhoneAPIKeyResponse"
+ "400":
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/responses.BadRequest"
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: "#/definitions/responses.Unauthorized"
+ "422":
+ description: Unprocessable Entity
+ schema:
+ $ref: "#/definitions/responses.UnprocessableEntity"
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: "#/definitions/responses.InternalServerError"
+ security:
+ - ApiKeyAuth: []
+ summary: Store phone API key
+ tags:
+ - PhoneAPIKeys
+ /phone-api-keys/{phoneAPIKeyID}:
+ delete:
+ consumes:
+ - application/json
+ description:
+ Delete a phone API Key from the database and cannot be used for
+ authentication anymore.
+ parameters:
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the phone API key
+ in: path
+ name: phoneAPIKeyID
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "204":
+ description: No Content
+ schema:
+ $ref: "#/definitions/responses.NoContent"
+ "400":
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/responses.BadRequest"
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: "#/definitions/responses.Unauthorized"
+ "404":
+ description: Not Found
+ schema:
+ $ref: "#/definitions/responses.NotFound"
+ "422":
+ description: Unprocessable Entity
+ schema:
+ $ref: "#/definitions/responses.UnprocessableEntity"
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: "#/definitions/responses.InternalServerError"
+ security:
+ - ApiKeyAuth: []
+ summary: Delete a phone API key from the database.
+ tags:
+ - PhoneAPIKeys
+ /phone-api-keys/{phoneAPIKeyID}/phones/{phoneID}:
+ delete:
+ consumes:
+ - application/json
+ description:
+ You will need to login again to the httpSMS app on your Android
+ phone with a new phone API key.
+ parameters:
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the phone API key
+ in: path
+ name: phoneAPIKeyID
+ required: true
+ type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the phone
+ in: path
+ name: phoneID
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "204":
+ description: No Content
+ schema:
+ $ref: "#/definitions/responses.NoContent"
+ "400":
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/responses.BadRequest"
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: "#/definitions/responses.Unauthorized"
+ "404":
+ description: Not Found
+ schema:
+ $ref: "#/definitions/responses.NotFound"
+ "422":
+ description: Unprocessable Entity
+ schema:
+ $ref: "#/definitions/responses.UnprocessableEntity"
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: "#/definitions/responses.InternalServerError"
+ security:
+ - ApiKeyAuth: []
+ summary: Remove the association of a phone from the phone API key.
+ tags:
+ - PhoneAPIKeys
/phones:
get:
consumes:
diff --git a/api/pkg/requests/message_send_request.go b/api/pkg/requests/message_send_request.go
index df844868..9a57cc9c 100644
--- a/api/pkg/requests/message_send_request.go
+++ b/api/pkg/requests/message_send_request.go
@@ -18,8 +18,8 @@ type MessageSend struct {
To string `json:"to" example:"+18005550100"`
Content string `json:"content" example:"This is a sample text message"`
- // Encrypted is used to determine if the content is end-to-end encrypted. Make sure to set the encryption key on the httpSMS mobile app
- Encrypted bool `json:"encrypted" example:"false"`
+ // Encrypted is an optional parameter used to determine if the content is end-to-end encrypted. Make sure to set the encryption key on the httpSMS mobile app
+ Encrypted bool `json:"encrypted" example:"false" validate:"optional"`
// RequestID is an optional parameter used to track a request from the client's perspective
RequestID string `json:"request_id" example:"153554b5-ae44-44a0-8f4f-7bbac5657ad4" validate:"optional"`
// SendAt is an optional parameter used to schedule a message to be sent at a later time