Skip to content

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

refactor: rename send_schedule to message_send_schedule for consistency

Acho Arnold1840217002c2
diff --git a/api/docs/docs.go b/api/docs/docs.go
index 934cd282..018614fa 100644
--- a/api/docs/docs.go
+++ b/api/docs/docs.go
@@ -2242,7 +2242,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.SendScheduleStore"
+ "$ref": "#/definitions/requests.MessageSendScheduleStore"
}
}
],
@@ -2250,7 +2250,7 @@ const docTemplate = `{
"201": {
"description": "Created",
"schema": {
- "$ref": "#/definitions/responses.SendScheduleResponse"
+ "$ref": "#/definitions/responses.MessageSendScheduleResponse"
}
},
"400": {
@@ -2265,6 +2265,12 @@ const docTemplate = `{
"$ref": "#/definitions/responses.Unauthorized"
}
},
+ "402": {
+ "description": "Payment Required",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
"422": {
"description": "Unprocessable Entity",
"schema": {
@@ -2312,7 +2318,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/requests.SendScheduleStore"
+ "$ref": "#/definitions/requests.MessageSendScheduleStore"
}
}
],
@@ -2320,7 +2326,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/responses.SendScheduleResponse"
+ "$ref": "#/definitions/responses.MessageSendScheduleResponse"
}
},
"400": {
@@ -4246,6 +4252,51 @@ const docTemplate = `{
}
}
},
+ "requests.MessageSendScheduleStore": {
+ "type": "object",
+ "required": [
+ "is_active",
+ "name",
+ "timezone",
+ "windows"
+ ],
+ "properties": {
+ "is_active": {
+ "type": "boolean"
+ },
+ "name": {
+ "type": "string"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "windows": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/requests.MessageSendScheduleWindow"
+ }
+ }
+ }
+ },
+ "requests.MessageSendScheduleWindow": {
+ "type": "object",
+ "required": [
+ "day_of_week",
+ "end_minute",
+ "start_minute"
+ ],
+ "properties": {
+ "day_of_week": {
+ "type": "integer"
+ },
+ "end_minute": {
+ "type": "integer"
+ },
+ "start_minute": {
+ "type": "integer"
+ }
+ }
+ },
"requests.MessageThreadUpdate": {
"type": "object",
"required": [
@@ -4343,51 +4394,6 @@ const docTemplate = `{
}
}
},
- "requests.SendScheduleStore": {
- "type": "object",
- "required": [
- "is_active",
- "name",
- "timezone",
- "windows"
- ],
- "properties": {
- "is_active": {
- "type": "boolean"
- },
- "name": {
- "type": "string"
- },
- "timezone": {
- "type": "string"
- },
- "windows": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/requests.SendScheduleWindow"
- }
- }
- }
- },
- "requests.SendScheduleWindow": {
- "type": "object",
- "required": [
- "day_of_week",
- "end_minute",
- "start_minute"
- ],
- "properties": {
- "day_of_week": {
- "type": "integer"
- },
- "end_minute": {
- "type": "integer"
- },
- "start_minute": {
- "type": "integer"
- }
- }
- },
"requests.UserNotificationUpdate": {
"type": "object",
"required": [
@@ -4735,6 +4741,27 @@ const docTemplate = `{
}
}
},
+ "responses.MessageSendScheduleResponse": {
+ "type": "object",
+ "required": [
+ "data",
+ "message",
+ "status"
+ ],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.MessageSendSchedule"
+ },
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
+ },
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
"responses.MessageThreadsResponse": {
"type": "object",
"required": [
@@ -4928,27 +4955,6 @@ const docTemplate = `{
}
}
},
- "responses.SendScheduleResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.MessageSendSchedule"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
- },
"responses.Unauthorized": {
"type": "object",
"required": [
diff --git a/api/docs/swagger.json b/api/docs/swagger.json
index e48dab66..3045ce7f 100644
--- a/api/docs/swagger.json
+++ b/api/docs/swagger.json
@@ -1,5222 +1,4739 @@
{
- "schemes": [
- "https"
- ],
- "swagger": "2.0",
- "info": {
- "description": "Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.",
- "title": "httpSMS API Reference",
+ "schemes": ["https"],
+ "swagger": "2.0",
+ "info": {
+ "description": "Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.",
+ "title": "httpSMS API Reference",
+ "contact": {
+ "name": "[email protected]",
+ "email": "[email protected]"
+ },
+ "license": {
+ "name": "AGPL-3.0",
+ "url": "https://raw.githubusercontent.com/NdoleStudio/http-sms-manager/main/LICENSE"
+ },
+ "version": "1.0"
+ },
+ "host": "api.httpsms.com",
+ "basePath": "/v1",
+ "paths": {
+ "/billing/usage": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get the summary of sent and received messages for a user in the current month",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Billing"],
+ "summary": "Get Billing Usage.",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.BillingUsageResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/billing/usage-history": {
+ "get": {
+ "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.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Billing"],
+ "summary": "Get billing usage history.",
+ "parameters": [
+ {
+ "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.BillingUsagesResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/bulk-messages": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Sends bulk SMS messages to multiple users based on our [CSV template](https://httpsms.com/templates/httpsms-bulk.csv) or our [Excel template](https://httpsms.com/templates/httpsms-bulk.xlsx).",
+ "consumes": ["multipart/form-data"],
+ "produces": ["application/json"],
+ "tags": ["BulkSMS"],
+ "summary": "Store bulk SMS file",
+ "parameters": [
+ {
+ "type": "file",
+ "description": "The Excel or CSV file containing the messages to be sent.",
+ "name": "document",
+ "in": "formData",
+ "required": true
+ }
+ ],
+ "responses": {
+ "202": {
+ "description": "Accepted",
+ "schema": {
+ "$ref": "#/definitions/responses.NoContent"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/discord-integrations": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get the discord integrations of a user",
+ "consumes": ["application/json"],
+ "produces": ["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"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.DiscordsResponse"
+ }
+ },
+ "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": "Store a discord integration for the authenticated user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["DiscordIntegration"],
+ "summary": "Store discord integration",
+ "parameters": [
+ {
+ "description": "Payload of the discord integration request",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.DiscordStore"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "Created",
+ "schema": {
+ "$ref": "#/definitions/responses.DiscordResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/discord-integrations/{discordID}": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Update a discord integration for the currently authenticated user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["DiscordIntegration"],
+ "summary": "Update a discord integration",
+ "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",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.DiscordUpdate"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.DiscordResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete a discord integration for a user",
+ "consumes": ["application/json"],
+ "produces": ["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
+ }
+ ],
+ "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"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/discord/event": {
+ "post": {
+ "description": "Publish a discord event to the registered listeners",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Discord"],
+ "summary": "Consume a discord event",
+ "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"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/heartbeats": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get the last time a phone number requested for outstanding messages. It will be sorted by timestamp in descending order.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Heartbeats"],
+ "summary": "Get heartbeats of an owner phone number",
+ "parameters": [
+ {
+ "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": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.HeartbeatsResponse"
+ }
+ },
+ "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": "Store the heartbeat to make notify that a phone number is still active",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Heartbeats"],
+ "summary": "Register heartbeat of an owner phone number",
+ "parameters": [
+ {
+ "description": "Payload of the heartbeat request",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.HeartbeatStore"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.HeartbeatResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/integration/3cx/messages": {
+ "post": {
+ "description": "Sends an SMS message from the 3CX platform",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["3CXIntegration"],
+ "summary": "Sends a 3CX SMS message",
+ "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"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/message-threads": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "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"],
+ "produces": ["application/json"],
+ "tags": ["MessageThreads"],
+ "summary": "Get message threads for a phone number",
+ "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"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageThreadsResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/message-threads/{messageThreadID}": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Updates the details of a message thread",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["MessageThreads"],
+ "summary": "Update a message thread",
+ "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",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageThreadUpdate"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.PhoneResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete a message thread from the database and also deletes all the messages in the thread.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["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
+ }
+ ],
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/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": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/messages/search": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "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": "Search all messages 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",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter messages containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 200,
+ "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/send": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Add a new SMS message to be sent by your Android phone",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Send an SMS message",
+ "parameters": [
+ {
+ "description": "Send message request payload",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageSend"
+ }
+ }
+ ],
+ "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/{messageID}": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get a message from the database by the message ID.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Messages"],
+ "summary": "Get a message from the database.",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "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"
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "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": "Delete a message from the database.",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the message",
+ "name": "messageID",
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/messages/{messageID}/events": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "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": "Upsert an event for a message on the mobile phone",
+ "parameters": [
+ {
+ "type": "string",
+ "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": {
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/phone-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 phone api keys to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter phone api keys with name containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 100,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of phone 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"
+ }
+ }
+ }
+ }
+ },
+ "/phone-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"
+ }
+ }
+ }
+ }
+ },
+ "/phone-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"
+ }
+ }
+ }
+ }
+ },
+ "/phones": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get list of phones which a user has registered on the http sms application",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Phones"],
+ "summary": "Get phones of a user",
+ "parameters": [
+ {
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of heartbeats to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter phones containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 20,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of phones to return",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.PhonesResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Updates properties of a user's phone. If the phone with this number does not exist, a new one will be created. Think of this method like an 'upsert'",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Phones"],
+ "summary": "Upsert Phone",
+ "parameters": [
+ {
+ "description": "Payload of new phone number.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.PhoneUpsert"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.PhoneResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/phones/fcm-token": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Updates the FCM token of a phone. If the phone with this number does not exist, a new one will be created. Think of this method like an 'upsert'",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Phones"],
+ "summary": "Upserts the FCM token of a phone",
+ "parameters": [
+ {
+ "description": "Payload of new FCM token.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.PhoneFCMToken"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.PhoneResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/phones/{phoneID}": {
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete a phone that has been sored in the database",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Phones"],
+ "summary": "Delete Phone",
+ "parameters": [
+ {
+ "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"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/send-schedules": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "List all send schedules owned by the authenticated user.",
+ "produces": ["application/json"],
+ "tags": ["Send Schedules"],
+ "summary": "List send schedules",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.MessageSendSchedule"
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Create a new send schedule for the authenticated user.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Send Schedules"],
+ "summary": "Create send schedule",
+ "parameters": [
+ {
+ "description": "Payload of new send schedule.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageSendScheduleStore"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "Created",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageSendScheduleResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "402": {
+ "description": "Payment Required",
+ "schema": {
+ "$ref": "#/definitions/responses.BadRequest"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/send-schedules/{scheduleID}": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Update a send schedule owned by the authenticated user.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Send Schedules"],
+ "summary": "Update send schedule",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Schedule ID",
+ "name": "scheduleID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Payload of updated send schedule.",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.MessageSendScheduleStore"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.MessageSendScheduleResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete a send schedule owned by the authenticated user.",
+ "produces": ["application/json"],
+ "tags": ["Send Schedules"],
+ "summary": "Delete send schedule",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Schedule ID",
+ "name": "scheduleID",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content"
+ },
+ "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"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/users/me": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get details of the currently authenticated user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Get current user",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.UserResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Updates the details of the currently authenticated user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Update a user",
+ "parameters": [
+ {
+ "description": "Payload of user details to update",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.UserUpdate"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.PhoneResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Deletes the currently authenticated user together with all their data.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Delete a user",
+ "responses": {
+ "201": {
+ "description": "Created",
+ "schema": {
+ "$ref": "#/definitions/responses.NoContent"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/responses.Unauthorized"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/users/subscription": {
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Cancel the subscription of the authenticated user.",
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Cancel the user's subscription",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.NoContent"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/users/subscription-update-url": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Fetches the subscription URL of the authenticated user.",
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Currently authenticated user subscription update URL",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.OkString"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/users/subscription/invoices/{subscriptionInvoiceID}": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Generates a new invoice PDF file for the given subscription payment with given parameters.",
+ "consumes": ["application/json"],
+ "produces": ["application/pdf"],
+ "tags": ["Users"],
+ "summary": "Generate a subscription payment invoice",
+ "parameters": [
+ {
+ "description": "Generate subscription payment invoice parameters",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.UserPaymentInvoice"
+ }
+ },
+ {
+ "type": "string",
+ "description": "ID of the subscription invoice to generate the PDF for",
+ "name": "subscriptionInvoiceID",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "file"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/users/subscription/payments": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Subscription payments are generated throughout the lifecycle of a subscription, typically there is one at the time of purchase and then one for each renewal.",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Get the last 10 subscription payments.",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.UserSubscriptionPaymentsResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/users/{userID}/api-keys": {
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Rotate the user's API key in case the current API Key is compromised",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Rotate the user's API Key",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the user to update",
+ "name": "userID",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.UserResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/users/{userID}/notifications": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Update the email notification settings for a user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Users"],
+ "summary": "Update notification settings",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the user to update",
+ "name": "userID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "User notification details to update",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.UserNotificationUpdate"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.UserResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}": {
+ "get": {
+ "description": "Download an MMS attachment by its path components",
+ "produces": ["application/octet-stream"],
+ "tags": ["Attachments"],
+ "summary": "Download a message attachment",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "User ID",
+ "name": "userID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Message ID",
+ "name": "messageID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Attachment index",
+ "name": "attachmentIndex",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Filename with extension",
+ "name": "filename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "file"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/responses.NotFound"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ },
+ "/webhooks": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Get the webhooks of a user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Webhooks"],
+ "summary": "Get webhooks of a user",
+ "parameters": [
+ {
+ "minimum": 0,
+ "type": "integer",
+ "description": "number of webhooks to skip",
+ "name": "skip",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter webhooks containing query",
+ "name": "query",
+ "in": "query"
+ },
+ {
+ "maximum": 20,
+ "minimum": 1,
+ "type": "integer",
+ "description": "number of webhooks to return",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.WebhooksResponse"
+ }
+ },
+ "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": "Store a webhook for the authenticated user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Webhooks"],
+ "summary": "Store a webhook",
+ "parameters": [
+ {
+ "description": "Payload of the webhook request",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.WebhookStore"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.WebhookResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+ },
+ "/webhooks/{webhookID}": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Update a webhook for the currently authenticated user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Webhooks"],
+ "summary": "Update a webhook",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the webhook",
+ "name": "webhookID",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Payload of webhook details to update",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/requests.WebhookUpdate"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/responses.WebhookResponse"
+ }
+ },
+ "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"
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete a webhook for a user",
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["Webhooks"],
+ "summary": "Delete webhook",
+ "parameters": [
+ {
+ "type": "string",
+ "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
+ "description": "ID of the webhook",
+ "name": "webhookID",
+ "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"
+ }
+ },
+ "422": {
+ "description": "Unprocessable Entity",
+ "schema": {
+ "$ref": "#/definitions/responses.UnprocessableEntity"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/responses.InternalServerError"
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "entities.BillingUsage": {
+ "type": "object",
+ "required": [
+ "created_at",
+ "end_timestamp",
+ "id",
+ "received_messages",
+ "sent_messages",
+ "start_timestamp",
+ "total_cost",
+ "updated_at",
+ "user_id"
+ ],
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "end_timestamp": {
+ "type": "string",
+ "example": "2022-01-31T23:59:59+00:00"
+ },
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "received_messages": {
+ "type": "integer",
+ "example": 465
+ },
+ "sent_messages": {
+ "type": "integer",
+ "example": 321
+ },
+ "start_timestamp": {
+ "type": "string",
+ "example": "2022-01-01T00:00:00+00:00"
+ },
+ "total_cost": {
+ "type": "integer",
+ "example": 0
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
+ },
+ "entities.Discord": {
+ "type": "object",
+ "required": [
+ "created_at",
+ "id",
+ "incoming_channel_id",
+ "name",
+ "server_id",
+ "updated_at",
+ "user_id"
+ ],
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "incoming_channel_id": {
+ "type": "string",
+ "example": "1095780203256627291"
+ },
+ "name": {
+ "type": "string",
+ "example": "Game Server"
+ },
+ "server_id": {
+ "type": "string",
+ "example": "1095778291488653372"
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
+ },
+ "entities.Heartbeat": {
+ "type": "object",
+ "required": [
+ "charging",
+ "id",
+ "owner",
+ "timestamp",
+ "user_id",
+ "version"
+ ],
+ "properties": {
+ "charging": {
+ "type": "boolean",
+ "example": true
+ },
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "owner": {
+ "type": "string",
+ "example": "+18005550199"
+ },
+ "timestamp": {
+ "type": "string",
+ "example": "2022-06-05T14:26:01.520828+03:00"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ },
+ "version": {
+ "type": "string",
+ "example": "344c10f"
+ }
+ }
+ },
+ "entities.Message": {
+ "type": "object",
+ "required": [
+ "attachments",
+ "contact",
+ "content",
+ "created_at",
+ "encrypted",
+ "id",
+ "max_send_attempts",
+ "order_timestamp",
+ "owner",
+ "request_received_at",
+ "send_attempt_count",
+ "sim",
+ "status",
+ "type",
+ "updated_at",
+ "user_id"
+ ],
+ "properties": {
+ "attachments": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "https://example.com/image.jpg",
+ "https://example.com/video.mp4"
+ ]
+ },
+ "contact": {
+ "type": "string",
+ "example": "+18005550100"
+ },
+ "content": {
+ "type": "string",
+ "example": "This is a sample text message"
+ },
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "delivered_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "encrypted": {
+ "type": "boolean",
+ "example": false
+ },
+ "expired_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "failed_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "failure_reason": {
+ "type": "string",
+ "example": "UNKNOWN"
+ },
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "last_attempted_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "max_send_attempts": {
+ "type": "integer",
+ "example": 1
+ },
+ "order_timestamp": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "owner": {
+ "type": "string",
+ "example": "+18005550199"
+ },
+ "received_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "request_id": {
+ "type": "string",
+ "example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
+ },
+ "request_received_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:01.520828+03:00"
+ },
+ "scheduled_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "scheduled_send_time": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "send_attempt_count": {
+ "type": "integer",
+ "example": 0
+ },
+ "send_time": {
+ "description": "SendDuration is the number of nanoseconds from when the request was received until when the mobile phone send the message",
+ "type": "integer",
+ "example": 133414
+ },
+ "sent_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "sim": {
+ "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",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SIM"
+ }
+ ],
+ "example": "DEFAULT"
+ },
+ "status": {
+ "type": "string",
+ "example": "pending"
+ },
+ "type": {
+ "type": "string",
+ "example": "mobile-terminated"
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
+ },
+ "entities.MessageSendSchedule": {
+ "type": "object",
+ "required": [
+ "created_at",
+ "id",
+ "is_active",
+ "name",
+ "timezone",
+ "updated_at",
+ "user_id",
+ "windows"
+ ],
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "is_active": {
+ "type": "boolean",
+ "example": true
+ },
+ "name": {
+ "type": "string",
+ "example": "Business Hours"
+ },
+ "timezone": {
+ "type": "string",
+ "example": "Europe/Tallinn"
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ },
+ "windows": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.MessageSendScheduleWindow"
+ }
+ }
+ }
+ },
+ "entities.MessageSendScheduleWindow": {
+ "type": "object",
+ "required": ["day_of_week", "end_minute", "start_minute"],
+ "properties": {
+ "day_of_week": {
+ "type": "integer",
+ "example": 1
+ },
+ "end_minute": {
+ "type": "integer",
+ "example": 1020
+ },
+ "start_minute": {
+ "type": "integer",
+ "example": 540
+ }
+ }
+ },
+ "entities.MessageThread": {
+ "type": "object",
+ "required": [
+ "color",
+ "contact",
+ "created_at",
+ "id",
+ "is_archived",
+ "last_message_content",
+ "last_message_id",
+ "order_timestamp",
+ "owner",
+ "status",
+ "updated_at",
+ "user_id"
+ ],
+ "properties": {
+ "color": {
+ "type": "string",
+ "example": "indigo"
+ },
"contact": {
- "name": "[email protected]",
- "email": "[email protected]"
+ "type": "string",
+ "example": "+18005550100"
+ },
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
},
- "license": {
- "name": "AGPL-3.0",
- "url": "https://raw.githubusercontent.com/NdoleStudio/http-sms-manager/main/LICENSE"
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703ca"
},
- "version": "1.0"
+ "is_archived": {
+ "type": "boolean",
+ "example": false
+ },
+ "last_message_content": {
+ "type": "string",
+ "example": "This is a sample message content"
+ },
+ "last_message_id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703ca"
+ },
+ "order_timestamp": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "owner": {
+ "type": "string",
+ "example": "+18005550199"
+ },
+ "status": {
+ "type": "string",
+ "example": "PENDING"
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
},
- "host": "api.httpsms.com",
- "basePath": "/v1",
- "paths": {
- "/billing/usage": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get the summary of sent and received messages for a user in the current month",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Billing"
- ],
- "summary": "Get Billing Usage.",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.BillingUsageResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "entities.Phone": {
+ "type": "object",
+ "required": [
+ "created_at",
+ "id",
+ "max_send_attempts",
+ "message_expiration_seconds",
+ "messages_per_minute",
+ "phone_number",
+ "schedule_id",
+ "sim",
+ "updated_at",
+ "user_id"
+ ],
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
},
- "/billing/usage-history": {
- "get": {
- "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.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Billing"
- ],
- "summary": "Get billing usage history.",
- "parameters": [
- {
- "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.BillingUsagesResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "fcm_token": {
+ "type": "string",
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."
},
- "/bulk-messages": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Sends bulk SMS messages to multiple users based on our [CSV template](https://httpsms.com/templates/httpsms-bulk.csv) or our [Excel template](https://httpsms.com/templates/httpsms-bulk.xlsx).",
- "consumes": [
- "multipart/form-data"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "BulkSMS"
- ],
- "summary": "Store bulk SMS file",
- "parameters": [
- {
- "type": "file",
- "description": "The Excel or CSV file containing the messages to be sent.",
- "name": "document",
- "in": "formData",
- "required": true
- }
- ],
- "responses": {
- "202": {
- "description": "Accepted",
- "schema": {
- "$ref": "#/definitions/responses.NoContent"
- }
- },
- "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"
- }
- }
- }
- }
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
},
- "/discord-integrations": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get the discord integrations of a user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "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"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.DiscordsResponse"
- }
- },
- "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": "Store a discord integration for the authenticated user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "DiscordIntegration"
- ],
- "summary": "Store discord integration",
- "parameters": [
- {
- "description": "Payload of the discord integration request",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.DiscordStore"
- }
- }
- ],
- "responses": {
- "201": {
- "description": "Created",
- "schema": {
- "$ref": "#/definitions/responses.DiscordResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "max_send_attempts": {
+ "description": "MaxSendAttempts determines how many times to retry sending an SMS message",
+ "type": "integer",
+ "example": 2
},
- "/discord-integrations/{discordID}": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Update a discord integration for the currently authenticated user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "DiscordIntegration"
- ],
- "summary": "Update a discord integration",
- "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",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.DiscordUpdate"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.DiscordResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a discord integration for a user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "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
- }
- ],
- "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"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "message_expiration_seconds": {
+ "description": "MessageExpirationSeconds is the duration in seconds after sending a message when it is considered to be expired.",
+ "type": "integer"
},
- "/discord/event": {
- "post": {
- "description": "Publish a discord event to the registered listeners",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Discord"
- ],
- "summary": "Consume a discord event",
- "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"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "messages_per_minute": {
+ "type": "integer",
+ "example": 1
},
- "/heartbeats": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get the last time a phone number requested for outstanding messages. It will be sorted by timestamp in descending order.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Heartbeats"
- ],
- "summary": "Get heartbeats of an owner phone number",
- "parameters": [
- {
- "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": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.HeartbeatsResponse"
- }
- },
- "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": "Store the heartbeat to make notify that a phone number is still active",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Heartbeats"
- ],
- "summary": "Register heartbeat of an owner phone number",
- "parameters": [
- {
- "description": "Payload of the heartbeat request",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.HeartbeatStore"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.HeartbeatResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "missed_call_auto_reply": {
+ "type": "string",
+ "example": "This phone cannot receive calls. Please send an SMS instead."
},
- "/integration/3cx/messages": {
- "post": {
- "description": "Sends an SMS message from the 3CX platform",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "3CXIntegration"
- ],
- "summary": "Sends a 3CX SMS message",
- "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"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "phone_number": {
+ "type": "string",
+ "example": "+18005550199"
},
- "/message-threads": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "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"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "MessageThreads"
- ],
- "summary": "Get message threads for a phone number",
- "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"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.MessageThreadsResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "schedule_id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
},
- "/message-threads/{messageThreadID}": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Updates the details of a message thread",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "MessageThreads"
- ],
- "summary": "Update a message thread",
- "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",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageThreadUpdate"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhoneResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a message thread from the database and also deletes all the messages in the thread.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "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
- }
- ],
- "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"
- }
- }
- }
- }
+ "sim": {
+ "$ref": "#/definitions/entities.SIM"
},
- "/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"
- }
- }
- }
- }
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
},
- "/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"
- }
- }
- }
- }
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
+ },
+ "entities.PhoneAPIKey": {
+ "type": "object",
+ "required": [
+ "api_key",
+ "created_at",
+ "id",
+ "name",
+ "phone_ids",
+ "phone_numbers",
+ "updated_at",
+ "user_email",
+ "user_id"
+ ],
+ "properties": {
+ "api_key": {
+ "type": "string",
+ "example": "pk_DGW8NwQp7mxKaSZ72Xq9v6xxxxx"
},
- "/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"
- }
- }
- }
- }
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
},
- "/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"
- }
- }
- }
- }
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
},
- "/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": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "name": {
+ "type": "string",
+ "example": "Business Phone Key"
},
- "/messages/search": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "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": "Search all messages 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",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter messages containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 200,
- "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"
- }
- }
- }
- }
+ "phone_ids": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "32343a19-da5e-4b1b-a767-3298a73703cb",
+ "32343a19-da5e-4b1b-a767-3298a73703cc"
+ ]
},
- "/messages/send": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Add a new SMS message to be sent by your Android phone",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Messages"
- ],
- "summary": "Send an SMS message",
- "parameters": [
- {
- "description": "Send message request payload",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.MessageSend"
- }
- }
- ],
- "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"
- }
- }
- }
- }
+ "phone_numbers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": ["+18005550199", "+18005550100"]
},
- "/messages/{messageID}": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get a message from the database by the message ID.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Messages"
- ],
- "summary": "Get a message from the database.",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message",
- "name": "messageID",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "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"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "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": "Delete a message from the database.",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the message",
- "name": "messageID",
- "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"
- }
- }
- }
- }
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
},
- "/messages/{messageID}/events": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "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": "Upsert an event for a message on the mobile phone",
- "parameters": [
- {
- "type": "string",
- "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": {
- "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"
- }
- }
- }
+ "user_email": {
+ "type": "string",
+ "example": "[email protected]"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
+ },
+ "entities.SIM": {
+ "type": "string",
+ "enum": ["SIM1", "SIM2"],
+ "x-enum-varnames": ["SIM1", "SIM2"]
+ },
+ "entities.SubscriptionName": {
+ "type": "string",
+ "enum": [
+ "free",
+ "pro-monthly",
+ "pro-yearly",
+ "ultra-monthly",
+ "ultra-yearly",
+ "pro-lifetime",
+ "20k-monthly",
+ "100k-monthly",
+ "50k-monthly",
+ "200k-monthly",
+ "20k-yearly"
+ ],
+ "x-enum-varnames": [
+ "SubscriptionNameFree",
+ "SubscriptionNameProMonthly",
+ "SubscriptionNameProYearly",
+ "SubscriptionNameUltraMonthly",
+ "SubscriptionNameUltraYearly",
+ "SubscriptionNameProLifetime",
+ "SubscriptionName20KMonthly",
+ "SubscriptionName100KMonthly",
+ "SubscriptionName50KMonthly",
+ "SubscriptionName200KMonthly",
+ "SubscriptionName20KYearly"
+ ]
+ },
+ "entities.User": {
+ "type": "object",
+ "required": [
+ "api_key",
+ "created_at",
+ "email",
+ "id",
+ "notification_heartbeat_enabled",
+ "notification_message_status_enabled",
+ "notification_newsletter_enabled",
+ "notification_webhook_enabled",
+ "subscription_id",
+ "subscription_name",
+ "timezone",
+ "updated_at"
+ ],
+ "properties": {
+ "active_phone_id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "api_key": {
+ "type": "string",
+ "example": "x-api-key"
+ },
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "email": {
+ "type": "string",
+ "example": "[email protected]"
+ },
+ "id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ },
+ "notification_heartbeat_enabled": {
+ "type": "boolean",
+ "example": true
+ },
+ "notification_message_status_enabled": {
+ "type": "boolean",
+ "example": true
+ },
+ "notification_newsletter_enabled": {
+ "type": "boolean",
+ "example": true
+ },
+ "notification_webhook_enabled": {
+ "type": "boolean",
+ "example": true
+ },
+ "subscription_ends_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "subscription_id": {
+ "type": "string",
+ "example": "8f9c71b8-b84e-4417-8408-a62274f65a08"
+ },
+ "subscription_name": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SubscriptionName"
}
+ ],
+ "example": "free"
+ },
+ "subscription_renews_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "subscription_status": {
+ "type": "string",
+ "example": "on_trial"
+ },
+ "timezone": {
+ "type": "string",
+ "example": "Europe/Helsinki"
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
+ }
+ }
+ },
+ "entities.Webhook": {
+ "type": "object",
+ "required": [
+ "created_at",
+ "events",
+ "id",
+ "phone_numbers",
+ "signing_key",
+ "updated_at",
+ "url",
+ "user_id"
+ ],
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:02.302718+03:00"
+ },
+ "events": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": ["message.phone.received"]
+ },
+ "id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "phone_numbers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": ["+18005550199", "+18005550100"]
+ },
+ "signing_key": {
+ "type": "string",
+ "example": "DGW8NwQp7mxKaSZ72Xq9v67SLqSbWQvckzzmK8D6rvd7NywSEkdMJtuxKyEkYnCY"
+ },
+ "updated_at": {
+ "type": "string",
+ "example": "2022-06-05T14:26:10.303278+03:00"
+ },
+ "url": {
+ "type": "string",
+ "example": "https://example.com"
+ },
+ "user_id": {
+ "type": "string",
+ "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
+ }
+ }
+ },
+ "requests.DiscordStore": {
+ "type": "object",
+ "required": ["incoming_channel_id", "name", "server_id"],
+ "properties": {
+ "incoming_channel_id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "server_id": {
+ "type": "string"
+ }
+ }
+ },
+ "requests.DiscordUpdate": {
+ "type": "object",
+ "required": ["incoming_channel_id", "name", "server_id"],
+ "properties": {
+ "incoming_channel_id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "server_id": {
+ "type": "string"
+ }
+ }
+ },
+ "requests.HeartbeatStore": {
+ "type": "object",
+ "required": ["charging", "phone_numbers"],
+ "properties": {
+ "charging": {
+ "type": "boolean"
+ },
+ "phone_numbers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requests.MessageAttachment": {
+ "type": "object",
+ "required": ["content", "content_type", "name"],
+ "properties": {
+ "content": {
+ "description": "Content is the base64-encoded attachment data",
+ "type": "string",
+ "example": "base64data..."
+ },
+ "content_type": {
+ "description": "ContentType is the MIME type of the attachment",
+ "type": "string",
+ "example": "image/jpeg"
+ },
+ "name": {
+ "description": "Name is the original filename of the attachment",
+ "type": "string",
+ "example": "photo.jpg"
+ }
+ }
+ },
+ "requests.MessageBulkSend": {
+ "type": "object",
+ "required": ["content", "from", "to"],
+ "properties": {
+ "attachments": {
+ "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "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",
+ "type": "boolean",
+ "example": false
+ },
+ "from": {
+ "type": "string",
+ "example": "+18005550199"
+ },
+ "request_id": {
+ "description": "RequestID is an optional parameter used to track a request from the client's perspective",
+ "type": "string",
+ "example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
+ },
+ "to": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": ["+18005550100", "+18005550100"]
+ }
+ }
+ },
+ "requests.MessageCallMissed": {
+ "type": "object",
+ "required": ["from", "sim", "timestamp", "to"],
+ "properties": {
+ "from": {
+ "type": "string",
+ "example": "+18005550199"
+ },
+ "sim": {
+ "type": "string",
+ "example": "SIM1"
+ },
+ "timestamp": {
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ },
+ "to": {
+ "type": "string",
+ "example": "+18005550100"
+ }
+ }
+ },
+ "requests.MessageEvent": {
+ "type": "object",
+ "required": ["event_name", "reason", "timestamp"],
+ "properties": {
+ "event_name": {
+ "description": "EventName is the type of event\n* SENT: is emitted when a message is sent by the mobile phone\n* FAILED: is event is emitted when the message could not be sent by the mobile phone\n* DELIVERED: is event is emitted when a delivery report has been received by the mobile phone",
+ "type": "string",
+ "example": "SENT"
+ },
+ "reason": {
+ "description": "Reason is the exact error message in case the event is an error",
+ "type": "string"
+ },
+ "timestamp": {
+ "description": "Timestamp is the time when the event was emitted, Please send the timestamp in UTC with as much precision as possible",
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
+ }
+ }
+ },
+ "requests.MessageReceive": {
+ "type": "object",
+ "required": ["content", "encrypted", "from", "sim", "timestamp", "to"],
+ "properties": {
+ "attachments": {
+ "description": "Attachments is the list of MMS attachments received with the message",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/requests.MessageAttachment"
+ }
+ },
+ "content": {
+ "type": "string",
+ "example": "This is a sample text message received on a phone"
+ },
+ "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",
+ "type": "boolean",
+ "example": false
+ },
+ "from": {
+ "type": "string",
+ "example": "+18005550199"
},
- "/phone-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 phone api keys to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter phone api keys with name containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 100,
- "minimum": 1,
- "type": "integer",
- "description": "number of phone 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"
- }
- }
- }
+ "sim": {
+ "description": "SIM card that received the message",
+ "allOf": [
+ {
+ "$ref": "#/definitions/entities.SIM"
}
+ ],
+ "example": "SIM1"
},
- "/phone-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"
- }
- }
- }
- }
+ "timestamp": {
+ "description": "Timestamp is the time when the event was emitted, Please send the timestamp in UTC with as much precision as possible",
+ "type": "string",
+ "example": "2022-06-05T14:26:09.527976+03:00"
},
- "/phone-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"
- }
- }
- }
- }
+ "to": {
+ "type": "string",
+ "example": "+18005550100"
+ }
+ }
+ },
+ "requests.MessageSend": {
+ "type": "object",
+ "required": ["content", "from", "to"],
+ "properties": {
+ "attachments": {
+ "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "https://example.com/image.jpg",
+ "https://example.com/video.mp4"
+ ]
},
- "/phones": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get list of phones which a user has registered on the http sms application",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Phones"
- ],
- "summary": "Get phones of a user",
- "parameters": [
- {
- "minimum": 0,
- "type": "integer",
- "description": "number of heartbeats to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter phones containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 20,
- "minimum": 1,
- "type": "integer",
- "description": "number of phones to return",
- "name": "limit",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhonesResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Updates properties of a user's phone. If the phone with this number does not exist, a new one will be created. Think of this method like an 'upsert'",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Phones"
- ],
- "summary": "Upsert Phone",
- "parameters": [
- {
- "description": "Payload of new phone number.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.PhoneUpsert"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhoneResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "content": {
+ "type": "string",
+ "example": "This is a sample text message"
},
- "/phones/fcm-token": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Updates the FCM token of a phone. If the phone with this number does not exist, a new one will be created. Think of this method like an 'upsert'",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Phones"
- ],
- "summary": "Upserts the FCM token of a phone",
- "parameters": [
- {
- "description": "Payload of new FCM token.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.PhoneFCMToken"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhoneResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "encrypted": {
+ "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
},
- "/phones/{phoneID}": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a phone that has been sored in the database",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Phones"
- ],
- "summary": "Delete Phone",
- "parameters": [
- {
- "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"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "from": {
+ "type": "string",
+ "example": "+18005550199"
},
- "/send-schedules": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "List all send schedules owned by the authenticated user.",
- "produces": [
- "application/json"
- ],
- "tags": [
- "Send Schedules"
- ],
- "summary": "List send schedules",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.MessageSendSchedule"
- }
- }
- },
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Create a new send schedule for the authenticated user.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Send Schedules"
- ],
- "summary": "Create send schedule",
- "parameters": [
- {
- "description": "Payload of new send schedule.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.SendScheduleStore"
- }
- }
- ],
- "responses": {
- "201": {
- "description": "Created",
- "schema": {
- "$ref": "#/definitions/responses.SendScheduleResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "request_id": {
+ "description": "RequestID is an optional parameter used to track a request from the client's perspective",
+ "type": "string",
+ "example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
},
- "/send-schedules/{scheduleID}": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Update a send schedule owned by the authenticated user.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Send Schedules"
- ],
- "summary": "Update send schedule",
- "parameters": [
- {
- "type": "string",
- "description": "Schedule ID",
- "name": "scheduleID",
- "in": "path",
- "required": true
- },
- {
- "description": "Payload of updated send schedule.",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.SendScheduleStore"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.SendScheduleResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a send schedule owned by the authenticated user.",
- "produces": [
- "application/json"
- ],
- "tags": [
- "Send Schedules"
- ],
- "summary": "Delete send schedule",
- "parameters": [
- {
- "type": "string",
- "description": "Schedule ID",
- "name": "scheduleID",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "204": {
- "description": "No Content"
- },
- "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"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "send_at": {
+ "description": "SendAt is an optional parameter used to schedule a message to be sent in the future. The time is considered to be in your profile's local timezone and you can queue messages for up to 20 days (480 hours) in the future.",
+ "type": "string",
+ "example": "2025-12-19T16:39:57-08:00"
},
- "/users/me": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get details of the currently authenticated user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Get current user",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.UserResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Updates the details of the currently authenticated user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Update a user",
- "parameters": [
- {
- "description": "Payload of user details to update",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.UserUpdate"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.PhoneResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Deletes the currently authenticated user together with all their data.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Delete a user",
- "responses": {
- "201": {
- "description": "Created",
- "schema": {
- "$ref": "#/definitions/responses.NoContent"
- }
- },
- "401": {
- "description": "Unauthorized",
- "schema": {
- "$ref": "#/definitions/responses.Unauthorized"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "to": {
+ "type": "string",
+ "example": "+18005550100"
+ }
+ }
+ },
+ "requests.MessageSendScheduleStore": {
+ "type": "object",
+ "required": ["is_active", "name", "timezone", "windows"],
+ "properties": {
+ "is_active": {
+ "type": "boolean"
},
- "/users/subscription": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Cancel the subscription of the authenticated user.",
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Cancel the user's subscription",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.NoContent"
- }
- },
- "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"
- }
- }
- }
- }
+ "name": {
+ "type": "string"
},
- "/users/subscription-update-url": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Fetches the subscription URL of the authenticated user.",
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Currently authenticated user subscription update URL",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.OkString"
- }
- },
- "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"
- }
- }
- }
- }
+ "timezone": {
+ "type": "string"
},
- "/users/subscription/invoices/{subscriptionInvoiceID}": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Generates a new invoice PDF file for the given subscription payment with given parameters.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/pdf"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Generate a subscription payment invoice",
- "parameters": [
- {
- "description": "Generate subscription payment invoice parameters",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.UserPaymentInvoice"
- }
- },
- {
- "type": "string",
- "description": "ID of the subscription invoice to generate the PDF for",
- "name": "subscriptionInvoiceID",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "type": "file"
- }
- },
- "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"
- }
- }
- }
- }
+ "windows": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/requests.MessageSendScheduleWindow"
+ }
+ }
+ }
+ },
+ "requests.MessageSendScheduleWindow": {
+ "type": "object",
+ "required": ["day_of_week", "end_minute", "start_minute"],
+ "properties": {
+ "day_of_week": {
+ "type": "integer"
},
- "/users/subscription/payments": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Subscription payments are generated throughout the lifecycle of a subscription, typically there is one at the time of purchase and then one for each renewal.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Get the last 10 subscription payments.",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.UserSubscriptionPaymentsResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "end_minute": {
+ "type": "integer"
},
- "/users/{userID}/api-keys": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Rotate the user's API key in case the current API Key is compromised",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Rotate the user's API Key",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the user to update",
- "name": "userID",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.UserResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "start_minute": {
+ "type": "integer"
+ }
+ }
+ },
+ "requests.MessageThreadUpdate": {
+ "type": "object",
+ "required": ["is_archived"],
+ "properties": {
+ "is_archived": {
+ "type": "boolean",
+ "example": true
+ }
+ }
+ },
+ "requests.PhoneAPIKeyStoreRequest": {
+ "type": "object",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "example": "My Phone API Key"
+ }
+ }
+ },
+ "requests.PhoneFCMToken": {
+ "type": "object",
+ "required": ["fcm_token", "phone_number", "sim"],
+ "properties": {
+ "fcm_token": {
+ "type": "string",
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."
},
- "/users/{userID}/notifications": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Update the email notification settings for a user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Users"
- ],
- "summary": "Update notification settings",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the user to update",
- "name": "userID",
- "in": "path",
- "required": true
- },
- {
- "description": "User notification details to update",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.UserNotificationUpdate"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.UserResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "phone_number": {
+ "type": "string",
+ "example": "[+18005550199]"
},
- "/v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}": {
- "get": {
- "description": "Download an MMS attachment by its path components",
- "produces": [
- "application/octet-stream"
- ],
- "tags": [
- "Attachments"
- ],
- "summary": "Download a message attachment",
- "parameters": [
- {
- "type": "string",
- "description": "User ID",
- "name": "userID",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Message ID",
- "name": "messageID",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Attachment index",
- "name": "attachmentIndex",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "Filename with extension",
- "name": "filename",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "type": "file"
- }
- },
- "404": {
- "description": "Not Found",
- "schema": {
- "$ref": "#/definitions/responses.NotFound"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "sim": {
+ "description": "SIM is the SIM slot of the phone in case the phone has more than 1 SIM slot",
+ "type": "string",
+ "example": "SIM1"
+ }
+ }
+ },
+ "requests.PhoneUpsert": {
+ "type": "object",
+ "required": [
+ "fcm_token",
+ "max_send_attempts",
+ "message_expiration_seconds",
+ "messages_per_minute",
+ "missed_call_auto_reply",
+ "phone_number",
+ "schedule_id",
+ "sim"
+ ],
+ "properties": {
+ "fcm_token": {
+ "type": "string",
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."
},
- "/webhooks": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get the webhooks of a user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Webhooks"
- ],
- "summary": "Get webhooks of a user",
- "parameters": [
- {
- "minimum": 0,
- "type": "integer",
- "description": "number of webhooks to skip",
- "name": "skip",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter webhooks containing query",
- "name": "query",
- "in": "query"
- },
- {
- "maximum": 20,
- "minimum": 1,
- "type": "integer",
- "description": "number of webhooks to return",
- "name": "limit",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.WebhooksResponse"
- }
- },
- "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": "Store a webhook for the authenticated user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Webhooks"
- ],
- "summary": "Store a webhook",
- "parameters": [
- {
- "description": "Payload of the webhook request",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.WebhookStore"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.WebhookResponse"
- }
- },
- "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"
- }
- }
- }
- }
+ "max_send_attempts": {
+ "description": "MaxSendAttempts is the number of attempts when sending an SMS message to handle the case where the phone is offline.",
+ "type": "integer",
+ "example": 2
},
- "/webhooks/{webhookID}": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Update a webhook for the currently authenticated user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Webhooks"
- ],
- "summary": "Update a webhook",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the webhook",
- "name": "webhookID",
- "in": "path",
- "required": true
- },
- {
- "description": "Payload of webhook details to update",
- "name": "payload",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/requests.WebhookUpdate"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/responses.WebhookResponse"
- }
- },
- "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"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Delete a webhook for a user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "Webhooks"
- ],
- "summary": "Delete webhook",
- "parameters": [
- {
- "type": "string",
- "default": "32343a19-da5e-4b1b-a767-3298a73703ca",
- "description": "ID of the webhook",
- "name": "webhookID",
- "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"
- }
- },
- "422": {
- "description": "Unprocessable Entity",
- "schema": {
- "$ref": "#/definitions/responses.UnprocessableEntity"
- }
- },
- "500": {
- "description": "Internal Server Error",
- "schema": {
- "$ref": "#/definitions/responses.InternalServerError"
- }
- }
- }
- }
+ "message_expiration_seconds": {
+ "description": "MessageExpirationSeconds is the duration in seconds after sending a message when it is considered to be expired.",
+ "type": "integer",
+ "example": 12345
+ },
+ "messages_per_minute": {
+ "type": "integer",
+ "example": 1
+ },
+ "missed_call_auto_reply": {
+ "type": "string",
+ "example": "e.g. This phone cannot receive calls. Please send an SMS instead."
+ },
+ "phone_number": {
+ "type": "string",
+ "example": "+18005550199"
+ },
+ "schedule_id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
+ },
+ "sim": {
+ "description": "SIM is the SIM slot of the phone in case the phone has more than 1 SIM slot",
+ "type": "string",
+ "example": "SIM1"
}
+ }
},
- "definitions": {
- "entities.BillingUsage": {
- "type": "object",
- "required": [
- "created_at",
- "end_timestamp",
- "id",
- "received_messages",
- "sent_messages",
- "start_timestamp",
- "total_cost",
- "updated_at",
- "user_id"
- ],
- "properties": {
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "end_timestamp": {
- "type": "string",
- "example": "2022-01-31T23:59:59+00:00"
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "received_messages": {
- "type": "integer",
- "example": 465
- },
- "sent_messages": {
- "type": "integer",
- "example": 321
- },
- "start_timestamp": {
- "type": "string",
- "example": "2022-01-01T00:00:00+00:00"
- },
- "total_cost": {
- "type": "integer",
- "example": 0
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "requests.UserNotificationUpdate": {
+ "type": "object",
+ "required": [
+ "heartbeat_enabled",
+ "message_status_enabled",
+ "newsletter_enabled",
+ "webhook_enabled"
+ ],
+ "properties": {
+ "heartbeat_enabled": {
+ "type": "boolean",
+ "example": true
},
- "entities.Discord": {
- "type": "object",
- "required": [
- "created_at",
- "id",
- "incoming_channel_id",
- "name",
- "server_id",
- "updated_at",
- "user_id"
- ],
- "properties": {
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "incoming_channel_id": {
- "type": "string",
- "example": "1095780203256627291"
- },
- "name": {
- "type": "string",
- "example": "Game Server"
- },
- "server_id": {
- "type": "string",
- "example": "1095778291488653372"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "message_status_enabled": {
+ "type": "boolean",
+ "example": true
},
- "entities.Heartbeat": {
- "type": "object",
- "required": [
- "charging",
- "id",
- "owner",
- "timestamp",
- "user_id",
- "version"
- ],
- "properties": {
- "charging": {
- "type": "boolean",
- "example": true
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "owner": {
- "type": "string",
- "example": "+18005550199"
- },
- "timestamp": {
- "type": "string",
- "example": "2022-06-05T14:26:01.520828+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- },
- "version": {
- "type": "string",
- "example": "344c10f"
- }
- }
+ "newsletter_enabled": {
+ "type": "boolean",
+ "example": true
},
- "entities.Message": {
- "type": "object",
- "required": [
- "attachments",
- "contact",
- "content",
- "created_at",
- "encrypted",
- "id",
- "max_send_attempts",
- "order_timestamp",
- "owner",
- "request_received_at",
- "send_attempt_count",
- "sim",
- "status",
- "type",
- "updated_at",
- "user_id"
- ],
- "properties": {
- "attachments": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "https://example.com/image.jpg",
- "https://example.com/video.mp4"
- ]
- },
- "contact": {
- "type": "string",
- "example": "+18005550100"
- },
- "content": {
- "type": "string",
- "example": "This is a sample text message"
- },
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "delivered_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "encrypted": {
- "type": "boolean",
- "example": false
- },
- "expired_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "failed_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "failure_reason": {
- "type": "string",
- "example": "UNKNOWN"
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "last_attempted_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "max_send_attempts": {
- "type": "integer",
- "example": 1
- },
- "order_timestamp": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "owner": {
- "type": "string",
- "example": "+18005550199"
- },
- "received_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "request_id": {
- "type": "string",
- "example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
- },
- "request_received_at": {
- "type": "string",
- "example": "2022-06-05T14:26:01.520828+03:00"
- },
- "scheduled_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "scheduled_send_time": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "send_attempt_count": {
- "type": "integer",
- "example": 0
- },
- "send_time": {
- "description": "SendDuration is the number of nanoseconds from when the request was received until when the mobile phone send the message",
- "type": "integer",
- "example": 133414
- },
- "sent_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "sim": {
- "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",
- "allOf": [
- {
- "$ref": "#/definitions/entities.SIM"
- }
- ],
- "example": "DEFAULT"
- },
- "status": {
- "type": "string",
- "example": "pending"
- },
- "type": {
- "type": "string",
- "example": "mobile-terminated"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "webhook_enabled": {
+ "type": "boolean",
+ "example": true
+ }
+ }
+ },
+ "requests.UserPaymentInvoice": {
+ "type": "object",
+ "required": [
+ "address",
+ "city",
+ "country",
+ "name",
+ "notes",
+ "state",
+ "zip_code"
+ ],
+ "properties": {
+ "address": {
+ "type": "string",
+ "example": "221B Baker Street, London"
},
- "entities.MessageSendSchedule": {
- "type": "object",
- "required": [
- "created_at",
- "id",
- "is_active",
- "name",
- "timezone",
- "updated_at",
- "user_id",
- "windows"
- ],
- "properties": {
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "is_active": {
- "type": "boolean",
- "example": true
- },
- "name": {
- "type": "string",
- "example": "Business Hours"
- },
- "timezone": {
- "type": "string",
- "example": "Europe/Tallinn"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- },
- "windows": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.MessageSendScheduleWindow"
- }
- }
- }
+ "city": {
+ "type": "string",
+ "example": "Los Angeles"
},
- "entities.MessageSendScheduleWindow": {
- "type": "object",
- "required": [
- "day_of_week",
- "end_minute",
- "start_minute"
- ],
- "properties": {
- "day_of_week": {
- "type": "integer",
- "example": 1
- },
- "end_minute": {
- "type": "integer",
- "example": 1020
- },
- "start_minute": {
- "type": "integer",
- "example": 540
- }
- }
+ "country": {
+ "type": "string",
+ "example": "US"
},
- "entities.MessageThread": {
- "type": "object",
- "required": [
- "color",
- "contact",
- "created_at",
- "id",
- "is_archived",
- "last_message_content",
- "last_message_id",
- "order_timestamp",
- "owner",
- "status",
- "updated_at",
- "user_id"
- ],
- "properties": {
- "color": {
- "type": "string",
- "example": "indigo"
- },
- "contact": {
- "type": "string",
- "example": "+18005550100"
- },
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703ca"
- },
- "is_archived": {
- "type": "boolean",
- "example": false
- },
- "last_message_content": {
- "type": "string",
- "example": "This is a sample message content"
- },
- "last_message_id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703ca"
- },
- "order_timestamp": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "owner": {
- "type": "string",
- "example": "+18005550199"
- },
- "status": {
- "type": "string",
- "example": "PENDING"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "name": {
+ "type": "string",
+ "example": "Acme Corp"
},
- "entities.Phone": {
- "type": "object",
- "required": [
- "created_at",
- "id",
- "max_send_attempts",
- "message_expiration_seconds",
- "messages_per_minute",
- "phone_number",
- "schedule_id",
- "sim",
- "updated_at",
- "user_id"
- ],
- "properties": {
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "fcm_token": {
- "type": "string",
- "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "max_send_attempts": {
- "description": "MaxSendAttempts determines how many times to retry sending an SMS message",
- "type": "integer",
- "example": 2
- },
- "message_expiration_seconds": {
- "description": "MessageExpirationSeconds is the duration in seconds after sending a message when it is considered to be expired.",
- "type": "integer"
- },
- "messages_per_minute": {
- "type": "integer",
- "example": 1
- },
- "missed_call_auto_reply": {
- "type": "string",
- "example": "This phone cannot receive calls. Please send an SMS instead."
- },
- "phone_number": {
- "type": "string",
- "example": "+18005550199"
- },
- "schedule_id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "sim": {
- "$ref": "#/definitions/entities.SIM"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "notes": {
+ "type": "string",
+ "example": "Thank you for your business!"
},
- "entities.PhoneAPIKey": {
- "type": "object",
- "required": [
- "api_key",
- "created_at",
- "id",
- "name",
- "phone_ids",
- "phone_numbers",
- "updated_at",
- "user_email",
- "user_id"
- ],
- "properties": {
- "api_key": {
- "type": "string",
- "example": "pk_DGW8NwQp7mxKaSZ72Xq9v6xxxxx"
- },
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "name": {
- "type": "string",
- "example": "Business Phone Key"
- },
- "phone_ids": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "32343a19-da5e-4b1b-a767-3298a73703cb",
- "32343a19-da5e-4b1b-a767-3298a73703cc"
- ]
- },
- "phone_numbers": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "+18005550199",
- "+18005550100"
- ]
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "user_email": {
- "type": "string",
- "example": "[email protected]"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "state": {
+ "type": "string",
+ "example": "CA"
},
- "entities.SIM": {
- "type": "string",
- "enum": [
- "SIM1",
- "SIM2"
- ],
- "x-enum-varnames": [
- "SIM1",
- "SIM2"
- ]
- },
- "entities.SubscriptionName": {
- "type": "string",
- "enum": [
- "free",
- "pro-monthly",
- "pro-yearly",
- "ultra-monthly",
- "ultra-yearly",
- "pro-lifetime",
- "20k-monthly",
- "100k-monthly",
- "50k-monthly",
- "200k-monthly",
- "20k-yearly"
- ],
- "x-enum-varnames": [
- "SubscriptionNameFree",
- "SubscriptionNameProMonthly",
- "SubscriptionNameProYearly",
- "SubscriptionNameUltraMonthly",
- "SubscriptionNameUltraYearly",
- "SubscriptionNameProLifetime",
- "SubscriptionName20KMonthly",
- "SubscriptionName100KMonthly",
- "SubscriptionName50KMonthly",
- "SubscriptionName200KMonthly",
- "SubscriptionName20KYearly"
- ]
- },
- "entities.User": {
- "type": "object",
- "required": [
- "api_key",
- "created_at",
- "email",
- "id",
- "notification_heartbeat_enabled",
- "notification_message_status_enabled",
- "notification_newsletter_enabled",
- "notification_webhook_enabled",
- "subscription_id",
- "subscription_name",
- "timezone",
- "updated_at"
- ],
- "properties": {
- "active_phone_id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "api_key": {
- "type": "string",
- "example": "x-api-key"
- },
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "email": {
- "type": "string",
- "example": "[email protected]"
- },
- "id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- },
- "notification_heartbeat_enabled": {
- "type": "boolean",
- "example": true
- },
- "notification_message_status_enabled": {
- "type": "boolean",
- "example": true
- },
- "notification_newsletter_enabled": {
- "type": "boolean",
- "example": true
- },
- "notification_webhook_enabled": {
- "type": "boolean",
- "example": true
- },
- "subscription_ends_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "subscription_id": {
- "type": "string",
- "example": "8f9c71b8-b84e-4417-8408-a62274f65a08"
- },
- "subscription_name": {
- "allOf": [
- {
- "$ref": "#/definitions/entities.SubscriptionName"
- }
- ],
- "example": "free"
- },
- "subscription_renews_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "subscription_status": {
- "type": "string",
- "example": "on_trial"
- },
- "timezone": {
- "type": "string",
- "example": "Europe/Helsinki"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- }
- }
+ "zip_code": {
+ "type": "string",
+ "example": "9800"
+ }
+ }
+ },
+ "requests.UserUpdate": {
+ "type": "object",
+ "required": ["active_phone_id", "timezone"],
+ "properties": {
+ "active_phone_id": {
+ "type": "string",
+ "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
},
- "entities.Webhook": {
- "type": "object",
- "required": [
- "created_at",
- "events",
- "id",
- "phone_numbers",
- "signing_key",
- "updated_at",
- "url",
- "user_id"
- ],
- "properties": {
- "created_at": {
- "type": "string",
- "example": "2022-06-05T14:26:02.302718+03:00"
- },
- "events": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "message.phone.received"
- ]
- },
- "id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "phone_numbers": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "+18005550199",
- "+18005550100"
- ]
- },
- "signing_key": {
- "type": "string",
- "example": "DGW8NwQp7mxKaSZ72Xq9v67SLqSbWQvckzzmK8D6rvd7NywSEkdMJtuxKyEkYnCY"
- },
- "updated_at": {
- "type": "string",
- "example": "2022-06-05T14:26:10.303278+03:00"
- },
- "url": {
- "type": "string",
- "example": "https://example.com"
- },
- "user_id": {
- "type": "string",
- "example": "WB7DRDWrJZRGbYrv2CKGkqbzvqdC"
- }
- }
+ "timezone": {
+ "type": "string",
+ "example": "Europe/Helsinki"
+ }
+ }
+ },
+ "requests.WebhookStore": {
+ "type": "object",
+ "required": ["events", "phone_numbers", "signing_key", "url"],
+ "properties": {
+ "events": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
},
- "requests.DiscordStore": {
- "type": "object",
- "required": [
- "incoming_channel_id",
- "name",
- "server_id"
- ],
- "properties": {
- "incoming_channel_id": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "server_id": {
- "type": "string"
- }
- }
+ "phone_numbers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": ["+18005550100", "+18005550100"]
},
- "requests.DiscordUpdate": {
- "type": "object",
- "required": [
- "incoming_channel_id",
- "name",
- "server_id"
- ],
- "properties": {
- "incoming_channel_id": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "server_id": {
- "type": "string"
- }
- }
+ "signing_key": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+ },
+ "requests.WebhookUpdate": {
+ "type": "object",
+ "required": ["events", "phone_numbers", "signing_key", "url"],
+ "properties": {
+ "events": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "phone_numbers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": ["+18005550100", "+18005550100"]
+ },
+ "signing_key": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+ },
+ "responses.BadRequest": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "string",
+ "example": "The request body is not a valid JSON string"
+ },
+ "message": {
+ "type": "string",
+ "example": "The request isn't properly formed"
},
- "requests.HeartbeatStore": {
- "type": "object",
- "required": [
- "charging",
- "phone_numbers"
- ],
- "properties": {
- "charging": {
- "type": "boolean"
- },
- "phone_numbers": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
+ "status": {
+ "type": "string",
+ "example": "error"
+ }
+ }
+ },
+ "responses.BillingUsageResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.BillingUsage"
},
- "requests.MessageAttachment": {
- "type": "object",
- "required": [
- "content",
- "content_type",
- "name"
- ],
- "properties": {
- "content": {
- "description": "Content is the base64-encoded attachment data",
- "type": "string",
- "example": "base64data..."
- },
- "content_type": {
- "description": "ContentType is the MIME type of the attachment",
- "type": "string",
- "example": "image/jpeg"
- },
- "name": {
- "description": "Name is the original filename of the attachment",
- "type": "string",
- "example": "photo.jpg"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.MessageBulkSend": {
- "type": "object",
- "required": [
- "content",
- "from",
- "to"
- ],
- "properties": {
- "attachments": {
- "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "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",
- "type": "boolean",
- "example": false
- },
- "from": {
- "type": "string",
- "example": "+18005550199"
- },
- "request_id": {
- "description": "RequestID is an optional parameter used to track a request from the client's perspective",
- "type": "string",
- "example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
- },
- "to": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "+18005550100",
- "+18005550100"
- ]
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.BillingUsagesResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.BillingUsage"
+ }
},
- "requests.MessageCallMissed": {
- "type": "object",
- "required": [
- "from",
- "sim",
- "timestamp",
- "to"
- ],
- "properties": {
- "from": {
- "type": "string",
- "example": "+18005550199"
- },
- "sim": {
- "type": "string",
- "example": "SIM1"
- },
- "timestamp": {
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "to": {
- "type": "string",
- "example": "+18005550100"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.MessageEvent": {
- "type": "object",
- "required": [
- "event_name",
- "reason",
- "timestamp"
- ],
- "properties": {
- "event_name": {
- "description": "EventName is the type of event\n* SENT: is emitted when a message is sent by the mobile phone\n* FAILED: is event is emitted when the message could not be sent by the mobile phone\n* DELIVERED: is event is emitted when a delivery report has been received by the mobile phone",
- "type": "string",
- "example": "SENT"
- },
- "reason": {
- "description": "Reason is the exact error message in case the event is an error",
- "type": "string"
- },
- "timestamp": {
- "description": "Timestamp is the time when the event was emitted, Please send the timestamp in UTC with as much precision as possible",
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.DiscordResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.Discord"
},
- "requests.MessageReceive": {
- "type": "object",
- "required": [
- "content",
- "encrypted",
- "from",
- "sim",
- "timestamp",
- "to"
- ],
- "properties": {
- "attachments": {
- "description": "Attachments is the list of MMS attachments received with the message",
- "type": "array",
- "items": {
- "$ref": "#/definitions/requests.MessageAttachment"
- }
- },
- "content": {
- "type": "string",
- "example": "This is a sample text message received on a phone"
- },
- "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",
- "type": "boolean",
- "example": false
- },
- "from": {
- "type": "string",
- "example": "+18005550199"
- },
- "sim": {
- "description": "SIM card that received the message",
- "allOf": [
- {
- "$ref": "#/definitions/entities.SIM"
- }
- ],
- "example": "SIM1"
- },
- "timestamp": {
- "description": "Timestamp is the time when the event was emitted, Please send the timestamp in UTC with as much precision as possible",
- "type": "string",
- "example": "2022-06-05T14:26:09.527976+03:00"
- },
- "to": {
- "type": "string",
- "example": "+18005550100"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.MessageSend": {
- "type": "object",
- "required": [
- "content",
- "from",
- "to"
- ],
- "properties": {
- "attachments": {
- "description": "Attachments are optional. When you provide a list of attachments, the message will be sent out as an MMS",
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "https://example.com/image.jpg",
- "https://example.com/video.mp4"
- ]
- },
- "content": {
- "type": "string",
- "example": "This is a sample text message"
- },
- "encrypted": {
- "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
- },
- "from": {
- "type": "string",
- "example": "+18005550199"
- },
- "request_id": {
- "description": "RequestID is an optional parameter used to track a request from the client's perspective",
- "type": "string",
- "example": "153554b5-ae44-44a0-8f4f-7bbac5657ad4"
- },
- "send_at": {
- "description": "SendAt is an optional parameter used to schedule a message to be sent in the future. The time is considered to be in your profile's local timezone and you can queue messages for up to 20 days (480 hours) in the future.",
- "type": "string",
- "example": "2025-12-19T16:39:57-08:00"
- },
- "to": {
- "type": "string",
- "example": "+18005550100"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.DiscordsResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.Discord"
+ }
},
- "requests.MessageThreadUpdate": {
- "type": "object",
- "required": [
- "is_archived"
- ],
- "properties": {
- "is_archived": {
- "type": "boolean",
- "example": true
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.PhoneAPIKeyStoreRequest": {
- "type": "object",
- "required": [
- "name"
- ],
- "properties": {
- "name": {
- "type": "string",
- "example": "My Phone API Key"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.HeartbeatResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.Heartbeat"
},
- "requests.PhoneFCMToken": {
- "type": "object",
- "required": [
- "fcm_token",
- "phone_number",
- "sim"
- ],
- "properties": {
- "fcm_token": {
- "type": "string",
- "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."
- },
- "phone_number": {
- "type": "string",
- "example": "[+18005550199]"
- },
- "sim": {
- "description": "SIM is the SIM slot of the phone in case the phone has more than 1 SIM slot",
- "type": "string",
- "example": "SIM1"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.PhoneUpsert": {
- "type": "object",
- "required": [
- "fcm_token",
- "max_send_attempts",
- "message_expiration_seconds",
- "messages_per_minute",
- "missed_call_auto_reply",
- "phone_number",
- "schedule_id",
- "sim"
- ],
- "properties": {
- "fcm_token": {
- "type": "string",
- "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."
- },
- "max_send_attempts": {
- "description": "MaxSendAttempts is the number of attempts when sending an SMS message to handle the case where the phone is offline.",
- "type": "integer",
- "example": 2
- },
- "message_expiration_seconds": {
- "description": "MessageExpirationSeconds is the duration in seconds after sending a message when it is considered to be expired.",
- "type": "integer",
- "example": 12345
- },
- "messages_per_minute": {
- "type": "integer",
- "example": 1
- },
- "missed_call_auto_reply": {
- "type": "string",
- "example": "e.g. This phone cannot receive calls. Please send an SMS instead."
- },
- "phone_number": {
- "type": "string",
- "example": "+18005550199"
- },
- "schedule_id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "sim": {
- "description": "SIM is the SIM slot of the phone in case the phone has more than 1 SIM slot",
- "type": "string",
- "example": "SIM1"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.HeartbeatsResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.Heartbeat"
+ }
},
- "requests.SendScheduleStore": {
- "type": "object",
- "required": [
- "is_active",
- "name",
- "timezone",
- "windows"
- ],
- "properties": {
- "is_active": {
- "type": "boolean"
- },
- "name": {
- "type": "string"
- },
- "timezone": {
- "type": "string"
- },
- "windows": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/requests.SendScheduleWindow"
- }
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.SendScheduleWindow": {
- "type": "object",
- "required": [
- "day_of_week",
- "end_minute",
- "start_minute"
- ],
- "properties": {
- "day_of_week": {
- "type": "integer"
- },
- "end_minute": {
- "type": "integer"
- },
- "start_minute": {
- "type": "integer"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.InternalServerError": {
+ "type": "object",
+ "required": ["message", "status"],
+ "properties": {
+ "message": {
+ "type": "string",
+ "example": "We ran into an internal error while handling the request."
},
- "requests.UserNotificationUpdate": {
- "type": "object",
- "required": [
- "heartbeat_enabled",
- "message_status_enabled",
- "newsletter_enabled",
- "webhook_enabled"
- ],
- "properties": {
- "heartbeat_enabled": {
- "type": "boolean",
- "example": true
- },
- "message_status_enabled": {
- "type": "boolean",
- "example": true
- },
- "newsletter_enabled": {
- "type": "boolean",
- "example": true
- },
- "webhook_enabled": {
- "type": "boolean",
- "example": true
- }
- }
+ "status": {
+ "type": "string",
+ "example": "error"
+ }
+ }
+ },
+ "responses.MessageResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.Message"
},
- "requests.UserPaymentInvoice": {
- "type": "object",
- "required": [
- "address",
- "city",
- "country",
- "name",
- "notes",
- "state",
- "zip_code"
- ],
- "properties": {
- "address": {
- "type": "string",
- "example": "221B Baker Street, London"
- },
- "city": {
- "type": "string",
- "example": "Los Angeles"
- },
- "country": {
- "type": "string",
- "example": "US"
- },
- "name": {
- "type": "string",
- "example": "Acme Corp"
- },
- "notes": {
- "type": "string",
- "example": "Thank you for your business!"
- },
- "state": {
- "type": "string",
- "example": "CA"
- },
- "zip_code": {
- "type": "string",
- "example": "9800"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.UserUpdate": {
- "type": "object",
- "required": [
- "active_phone_id",
- "timezone"
- ],
- "properties": {
- "active_phone_id": {
- "type": "string",
- "example": "32343a19-da5e-4b1b-a767-3298a73703cb"
- },
- "timezone": {
- "type": "string",
- "example": "Europe/Helsinki"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.MessageSendScheduleResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.MessageSendSchedule"
},
- "requests.WebhookStore": {
- "type": "object",
- "required": [
- "events",
- "phone_numbers",
- "signing_key",
- "url"
- ],
- "properties": {
- "events": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "phone_numbers": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "+18005550100",
- "+18005550100"
- ]
- },
- "signing_key": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "requests.WebhookUpdate": {
- "type": "object",
- "required": [
- "events",
- "phone_numbers",
- "signing_key",
- "url"
- ],
- "properties": {
- "events": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "phone_numbers": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "+18005550100",
- "+18005550100"
- ]
- },
- "signing_key": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.MessageThreadsResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.MessageThread"
+ }
},
- "responses.BadRequest": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "string",
- "example": "The request body is not a valid JSON string"
- },
- "message": {
- "type": "string",
- "example": "The request isn't properly formed"
- },
- "status": {
- "type": "string",
- "example": "error"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.BillingUsageResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.BillingUsage"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.MessagesResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.Message"
+ }
},
- "responses.BillingUsagesResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.BillingUsage"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.DiscordResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.Discord"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.NoContent": {
+ "type": "object",
+ "required": ["message", "status"],
+ "properties": {
+ "message": {
+ "type": "string",
+ "example": "action performed successfully"
},
- "responses.DiscordsResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.Discord"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.NotFound": {
+ "type": "object",
+ "required": ["message", "status"],
+ "properties": {
+ "message": {
+ "type": "string",
+ "example": "cannot find message with ID [32343a19-da5e-4b1b-a767-3298a73703ca]"
},
- "responses.HeartbeatResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.Heartbeat"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "error"
+ }
+ }
+ },
+ "responses.OkString": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "string"
},
- "responses.HeartbeatsResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.Heartbeat"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.InternalServerError": {
- "type": "object",
- "required": [
- "message",
- "status"
- ],
- "properties": {
- "message": {
- "type": "string",
- "example": "We ran into an internal error while handling the request."
- },
- "status": {
- "type": "string",
- "example": "error"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.PhoneAPIKeyResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.PhoneAPIKey"
},
- "responses.MessageResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.Message"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.MessageThreadsResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.MessageThread"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.PhoneAPIKeysResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.PhoneAPIKey"
+ }
},
- "responses.MessagesResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.Message"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.NoContent": {
- "type": "object",
- "required": [
- "message",
- "status"
- ],
- "properties": {
- "message": {
- "type": "string",
- "example": "action performed successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.PhoneResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.Phone"
},
- "responses.NotFound": {
- "type": "object",
- "required": [
- "message",
- "status"
- ],
- "properties": {
- "message": {
- "type": "string",
- "example": "cannot find message with ID [32343a19-da5e-4b1b-a767-3298a73703ca]"
- },
- "status": {
- "type": "string",
- "example": "error"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.OkString": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "string"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.PhonesResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.Phone"
+ }
},
- "responses.PhoneAPIKeyResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.PhoneAPIKey"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.PhoneAPIKeysResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.PhoneAPIKey"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.Unauthorized": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "string",
+ "example": "Make sure your API key is set in the [X-API-Key] header in the request"
},
- "responses.PhoneResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.Phone"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "You are not authorized to carry out this request."
},
- "responses.PhonesResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.Phone"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
+ "status": {
+ "type": "string",
+ "example": "error"
+ }
+ }
+ },
+ "responses.UnprocessableEntity": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
}
+ }
},
- "responses.SendScheduleResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.MessageSendSchedule"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "validation errors while handling request"
},
- "responses.Unauthorized": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "string",
- "example": "Make sure your API key is set in the [X-API-Key] header in the request"
- },
- "message": {
- "type": "string",
- "example": "You are not authorized to carry out this request."
- },
- "status": {
- "type": "string",
- "example": "error"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "error"
+ }
+ }
+ },
+ "responses.UserResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.User"
},
- "responses.UnprocessableEntity": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "object",
- "additionalProperties": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- },
- "message": {
- "type": "string",
- "example": "validation errors while handling request"
- },
- "status": {
- "type": "string",
- "example": "error"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.UserResponse": {
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.UserSubscriptionPaymentsResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
"type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
+ "required": ["attributes", "id", "type"],
"properties": {
- "data": {
- "$ref": "#/definitions/entities.User"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
+ "attributes": {
+ "type": "object",
+ "required": [
+ "billing_reason",
+ "card_brand",
+ "card_last_four",
+ "created_at",
+ "currency",
+ "currency_rate",
+ "discount_total",
+ "discount_total_formatted",
+ "discount_total_usd",
+ "refunded",
+ "refunded_amount",
+ "refunded_amount_formatted",
+ "refunded_amount_usd",
+ "refunded_at",
+ "status",
+ "status_formatted",
+ "subtotal",
+ "subtotal_formatted",
+ "subtotal_usd",
+ "tax",
+ "tax_formatted",
+ "tax_inclusive",
+ "tax_usd",
+ "total",
+ "total_formatted",
+ "total_usd",
+ "updated_at"
+ ],
+ "properties": {
+ "billing_reason": {
+ "type": "string"
+ },
+ "card_brand": {
+ "type": "string"
+ },
+ "card_last_four": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "string"
+ },
+ "currency": {
+ "type": "string"
+ },
+ "currency_rate": {
+ "type": "string"
+ },
+ "discount_total": {
+ "type": "integer"
+ },
+ "discount_total_formatted": {
+ "type": "string"
+ },
+ "discount_total_usd": {
+ "type": "integer"
+ },
+ "refunded": {
+ "type": "boolean"
+ },
+ "refunded_amount": {
+ "type": "integer"
+ },
+ "refunded_amount_formatted": {
+ "type": "string"
+ },
+ "refunded_amount_usd": {
+ "type": "integer"
+ },
+ "refunded_at": {},
+ "status": {
+ "type": "string"
+ },
+ "status_formatted": {
+ "type": "string"
+ },
+ "subtotal": {
+ "type": "integer"
+ },
+ "subtotal_formatted": {
+ "type": "string"
+ },
+ "subtotal_usd": {
+ "type": "integer"
+ },
+ "tax": {
+ "type": "integer"
+ },
+ "tax_formatted": {
+ "type": "string"
+ },
+ "tax_inclusive": {
+ "type": "boolean"
+ },
+ "tax_usd": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "total_formatted": {
+ "type": "string"
+ },
+ "total_usd": {
+ "type": "integer"
+ },
+ "updated_at": {
+ "type": "string"
+ }
}
+ },
+ "id": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ }
}
+ }
},
- "responses.UserSubscriptionPaymentsResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "type": "object",
- "required": [
- "attributes",
- "id",
- "type"
- ],
- "properties": {
- "attributes": {
- "type": "object",
- "required": [
- "billing_reason",
- "card_brand",
- "card_last_four",
- "created_at",
- "currency",
- "currency_rate",
- "discount_total",
- "discount_total_formatted",
- "discount_total_usd",
- "refunded",
- "refunded_amount",
- "refunded_amount_formatted",
- "refunded_amount_usd",
- "refunded_at",
- "status",
- "status_formatted",
- "subtotal",
- "subtotal_formatted",
- "subtotal_usd",
- "tax",
- "tax_formatted",
- "tax_inclusive",
- "tax_usd",
- "total",
- "total_formatted",
- "total_usd",
- "updated_at"
- ],
- "properties": {
- "billing_reason": {
- "type": "string"
- },
- "card_brand": {
- "type": "string"
- },
- "card_last_four": {
- "type": "string"
- },
- "created_at": {
- "type": "string"
- },
- "currency": {
- "type": "string"
- },
- "currency_rate": {
- "type": "string"
- },
- "discount_total": {
- "type": "integer"
- },
- "discount_total_formatted": {
- "type": "string"
- },
- "discount_total_usd": {
- "type": "integer"
- },
- "refunded": {
- "type": "boolean"
- },
- "refunded_amount": {
- "type": "integer"
- },
- "refunded_amount_formatted": {
- "type": "string"
- },
- "refunded_amount_usd": {
- "type": "integer"
- },
- "refunded_at": {},
- "status": {
- "type": "string"
- },
- "status_formatted": {
- "type": "string"
- },
- "subtotal": {
- "type": "integer"
- },
- "subtotal_formatted": {
- "type": "string"
- },
- "subtotal_usd": {
- "type": "integer"
- },
- "tax": {
- "type": "integer"
- },
- "tax_formatted": {
- "type": "string"
- },
- "tax_inclusive": {
- "type": "boolean"
- },
- "tax_usd": {
- "type": "integer"
- },
- "total": {
- "type": "integer"
- },
- "total_formatted": {
- "type": "string"
- },
- "total_usd": {
- "type": "integer"
- },
- "updated_at": {
- "type": "string"
- }
- }
- },
- "id": {
- "type": "string"
- },
- "type": {
- "type": "string"
- }
- }
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
},
- "responses.WebhookResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "$ref": "#/definitions/entities.Webhook"
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "status": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "responses.WebhookResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/entities.Webhook"
},
- "responses.WebhooksResponse": {
- "type": "object",
- "required": [
- "data",
- "message",
- "status"
- ],
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/entities.Webhook"
- }
- },
- "message": {
- "type": "string",
- "example": "Request handled successfully"
- },
- "status": {
- "type": "string",
- "example": "success"
- }
- }
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
+ },
+ "status": {
+ "type": "string",
+ "example": "success"
}
+ }
},
- "securityDefinitions": {
- "ApiKeyAuth": {
- "type": "apiKey",
- "name": "x-api-Key",
- "in": "header"
+ "responses.WebhooksResponse": {
+ "type": "object",
+ "required": ["data", "message", "status"],
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/entities.Webhook"
+ }
+ },
+ "message": {
+ "type": "string",
+ "example": "Request handled successfully"
+ },
+ "status": {
+ "type": "string",
+ "example": "success"
}
+ }
+ }
+ },
+ "securityDefinitions": {
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "name": "x-api-Key",
+ "in": "header"
}
-}
\ No newline at end of file
+ }
+}
diff --git a/api/docs/swagger.yaml b/api/docs/swagger.yaml
index 118671d8..58cee295 100644
--- a/api/docs/swagger.yaml
+++ b/api/docs/swagger.yaml
@@ -30,15 +30,15 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - created_at
- - end_timestamp
- - id
- - received_messages
- - sent_messages
- - start_timestamp
- - total_cost
- - updated_at
- - user_id
+ - created_at
+ - end_timestamp
+ - id
+ - received_messages
+ - sent_messages
+ - start_timestamp
+ - total_cost
+ - updated_at
+ - user_id
type: object
entities.Discord:
properties:
@@ -64,13 +64,13 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - created_at
- - id
- - incoming_channel_id
- - name
- - server_id
- - updated_at
- - user_id
+ - created_at
+ - id
+ - incoming_channel_id
+ - name
+ - server_id
+ - updated_at
+ - user_id
type: object
entities.Heartbeat:
properties:
@@ -93,19 +93,19 @@ definitions:
example: 344c10f
type: string
required:
- - charging
- - id
- - owner
- - timestamp
- - user_id
- - version
+ - charging
+ - id
+ - owner
+ - timestamp
+ - user_id
+ - version
type: object
entities.Message:
properties:
attachments:
example:
- - https://example.com/image.jpg
- - https://example.com/video.mp4
+ - https://example.com/image.jpg
+ - https://example.com/video.mp4
items:
type: string
type: array
@@ -167,7 +167,8 @@ definitions:
example: 0
type: integer
send_time:
- description: SendDuration is the number of nanoseconds from when the request
+ description:
+ SendDuration is the number of nanoseconds from when the request
was received until when the mobile phone send the message
example: 133414
type: integer
@@ -176,7 +177,7 @@ definitions:
type: string
sim:
allOf:
- - $ref: '#/definitions/entities.SIM'
+ - $ref: "#/definitions/entities.SIM"
description: |-
SIM is the SIM card to use to send the message
* SMS1: use the SIM card in slot 1
@@ -196,22 +197,22 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - attachments
- - contact
- - content
- - created_at
- - encrypted
- - id
- - max_send_attempts
- - order_timestamp
- - owner
- - request_received_at
- - send_attempt_count
- - sim
- - status
- - type
- - updated_at
- - user_id
+ - attachments
+ - contact
+ - content
+ - created_at
+ - encrypted
+ - id
+ - max_send_attempts
+ - order_timestamp
+ - owner
+ - request_received_at
+ - send_attempt_count
+ - sim
+ - status
+ - type
+ - updated_at
+ - user_id
type: object
entities.MessageSendSchedule:
properties:
@@ -238,17 +239,17 @@ definitions:
type: string
windows:
items:
- $ref: '#/definitions/entities.MessageSendScheduleWindow'
+ $ref: "#/definitions/entities.MessageSendScheduleWindow"
type: array
required:
- - created_at
- - id
- - is_active
- - name
- - timezone
- - updated_at
- - user_id
- - windows
+ - created_at
+ - id
+ - is_active
+ - name
+ - timezone
+ - updated_at
+ - user_id
+ - windows
type: object
entities.MessageSendScheduleWindow:
properties:
@@ -262,9 +263,9 @@ definitions:
example: 540
type: integer
required:
- - day_of_week
- - end_minute
- - start_minute
+ - day_of_week
+ - end_minute
+ - start_minute
type: object
entities.MessageThread:
properties:
@@ -305,18 +306,18 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - color
- - contact
- - created_at
- - id
- - is_archived
- - last_message_content
- - last_message_id
- - order_timestamp
- - owner
- - status
- - updated_at
- - user_id
+ - color
+ - contact
+ - created_at
+ - id
+ - is_archived
+ - last_message_content
+ - last_message_id
+ - order_timestamp
+ - owner
+ - status
+ - updated_at
+ - user_id
type: object
entities.Phone:
properties:
@@ -330,12 +331,14 @@ definitions:
example: 32343a19-da5e-4b1b-a767-3298a73703cb
type: string
max_send_attempts:
- description: MaxSendAttempts determines how many times to retry sending an
+ description:
+ MaxSendAttempts determines how many times to retry sending an
SMS message
example: 2
type: integer
message_expiration_seconds:
- description: MessageExpirationSeconds is the duration in seconds after sending
+ description:
+ MessageExpirationSeconds is the duration in seconds after sending
a message when it is considered to be expired.
type: integer
messages_per_minute:
@@ -351,7 +354,7 @@ definitions:
example: 32343a19-da5e-4b1b-a767-3298a73703cb
type: string
sim:
- $ref: '#/definitions/entities.SIM'
+ $ref: "#/definitions/entities.SIM"
updated_at:
example: "2022-06-05T14:26:10.303278+03:00"
type: string
@@ -359,16 +362,16 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - created_at
- - id
- - max_send_attempts
- - message_expiration_seconds
- - messages_per_minute
- - phone_number
- - schedule_id
- - sim
- - updated_at
- - user_id
+ - created_at
+ - id
+ - max_send_attempts
+ - message_expiration_seconds
+ - messages_per_minute
+ - phone_number
+ - schedule_id
+ - sim
+ - updated_at
+ - user_id
type: object
entities.PhoneAPIKey:
properties:
@@ -386,15 +389,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
@@ -408,50 +411,50 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - api_key
- - created_at
- - id
- - name
- - phone_ids
- - phone_numbers
- - updated_at
- - user_email
- - user_id
+ - api_key
+ - created_at
+ - id
+ - name
+ - phone_ids
+ - phone_numbers
+ - updated_at
+ - user_email
+ - user_id
type: object
entities.SIM:
enum:
- - SIM1
- - SIM2
+ - SIM1
+ - SIM2
type: string
x-enum-varnames:
- - SIM1
- - SIM2
+ - SIM1
+ - SIM2
entities.SubscriptionName:
enum:
- - free
- - pro-monthly
- - pro-yearly
- - ultra-monthly
- - ultra-yearly
- - pro-lifetime
- - 20k-monthly
- - 100k-monthly
- - 50k-monthly
- - 200k-monthly
- - 20k-yearly
+ - free
+ - pro-monthly
+ - pro-yearly
+ - ultra-monthly
+ - ultra-yearly
+ - pro-lifetime
+ - 20k-monthly
+ - 100k-monthly
+ - 50k-monthly
+ - 200k-monthly
+ - 20k-yearly
type: string
x-enum-varnames:
- - SubscriptionNameFree
- - SubscriptionNameProMonthly
- - SubscriptionNameProYearly
- - SubscriptionNameUltraMonthly
- - SubscriptionNameUltraYearly
- - SubscriptionNameProLifetime
- - SubscriptionName20KMonthly
- - SubscriptionName100KMonthly
- - SubscriptionName50KMonthly
- - SubscriptionName200KMonthly
- - SubscriptionName20KYearly
+ - SubscriptionNameFree
+ - SubscriptionNameProMonthly
+ - SubscriptionNameProYearly
+ - SubscriptionNameUltraMonthly
+ - SubscriptionNameUltraYearly
+ - SubscriptionNameProLifetime
+ - SubscriptionName20KMonthly
+ - SubscriptionName100KMonthly
+ - SubscriptionName50KMonthly
+ - SubscriptionName200KMonthly
+ - SubscriptionName20KYearly
entities.User:
properties:
active_phone_id:
@@ -489,7 +492,7 @@ definitions:
type: string
subscription_name:
allOf:
- - $ref: '#/definitions/entities.SubscriptionName'
+ - $ref: "#/definitions/entities.SubscriptionName"
example: free
subscription_renews_at:
example: "2022-06-05T14:26:02.302718+03:00"
@@ -504,18 +507,18 @@ definitions:
example: "2022-06-05T14:26:10.303278+03:00"
type: string
required:
- - api_key
- - created_at
- - email
- - id
- - notification_heartbeat_enabled
- - notification_message_status_enabled
- - notification_newsletter_enabled
- - notification_webhook_enabled
- - subscription_id
- - subscription_name
- - timezone
- - updated_at
+ - api_key
+ - created_at
+ - email
+ - id
+ - notification_heartbeat_enabled
+ - notification_message_status_enabled
+ - notification_newsletter_enabled
+ - notification_webhook_enabled
+ - subscription_id
+ - subscription_name
+ - timezone
+ - updated_at
type: object
entities.Webhook:
properties:
@@ -524,7 +527,7 @@ definitions:
type: string
events:
example:
- - message.phone.received
+ - message.phone.received
items:
type: string
type: array
@@ -533,8 +536,8 @@ definitions:
type: string
phone_numbers:
example:
- - "+18005550199"
- - "+18005550100"
+ - "+18005550199"
+ - "+18005550100"
items:
type: string
type: array
@@ -551,14 +554,14 @@ definitions:
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
type: string
required:
- - created_at
- - events
- - id
- - phone_numbers
- - signing_key
- - updated_at
- - url
- - user_id
+ - created_at
+ - events
+ - id
+ - phone_numbers
+ - signing_key
+ - updated_at
+ - url
+ - user_id
type: object
requests.DiscordStore:
properties:
@@ -569,9 +572,9 @@ definitions:
server_id:
type: string
required:
- - incoming_channel_id
- - name
- - server_id
+ - incoming_channel_id
+ - name
+ - server_id
type: object
requests.DiscordUpdate:
properties:
@@ -582,9 +585,9 @@ definitions:
server_id:
type: string
required:
- - incoming_channel_id
- - name
- - server_id
+ - incoming_channel_id
+ - name
+ - server_id
type: object
requests.HeartbeatStore:
properties:
@@ -595,8 +598,8 @@ definitions:
type: string
type: array
required:
- - charging
- - phone_numbers
+ - charging
+ - phone_numbers
type: object
requests.MessageAttachment:
properties:
@@ -613,14 +616,15 @@ definitions:
example: photo.jpg
type: string
required:
- - content
- - content_type
- - name
+ - content
+ - content_type
+ - name
type: object
requests.MessageBulkSend:
properties:
attachments:
- description: Attachments are optional. When you provide a list of attachments,
+ description:
+ Attachments are optional. When you provide a list of attachments,
the message will be sent out as an MMS
items:
type: string
@@ -629,7 +633,8 @@ definitions:
example: This is a sample text message
type: string
encrypted:
- description: Encrypted is used to determine if the content is end-to-end 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
example: false
type: boolean
@@ -637,21 +642,22 @@ definitions:
example: "+18005550199"
type: string
request_id:
- description: RequestID is an optional parameter used to track a request from
+ description:
+ RequestID is an optional parameter used to track a request from
the client's perspective
example: 153554b5-ae44-44a0-8f4f-7bbac5657ad4
type: string
to:
example:
- - "+18005550100"
- - "+18005550100"
+ - "+18005550100"
+ - "+18005550100"
items:
type: string
type: array
required:
- - content
- - from
- - to
+ - content
+ - from
+ - to
type: object
requests.MessageCallMissed:
properties:
@@ -668,10 +674,10 @@ definitions:
example: "+18005550100"
type: string
required:
- - from
- - sim
- - timestamp
- - to
+ - from
+ - sim
+ - timestamp
+ - to
type: object
requests.MessageEvent:
properties:
@@ -687,28 +693,31 @@ definitions:
description: Reason is the exact error message in case the event is an error
type: string
timestamp:
- description: Timestamp is the time when the event was emitted, Please send
+ description:
+ Timestamp is the time when the event was emitted, Please send
the timestamp in UTC with as much precision as possible
example: "2022-06-05T14:26:09.527976+03:00"
type: string
required:
- - event_name
- - reason
- - timestamp
+ - event_name
+ - reason
+ - timestamp
type: object
requests.MessageReceive:
properties:
attachments:
- description: Attachments is the list of MMS attachments received with the
+ description:
+ Attachments is the list of MMS attachments received with the
message
items:
- $ref: '#/definitions/requests.MessageAttachment'
+ $ref: "#/definitions/requests.MessageAttachment"
type: array
content:
example: This is a sample text message received on a phone
type: string
encrypted:
- description: Encrypted is used to determine if the content is end-to-end 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
example: false
type: boolean
@@ -717,11 +726,12 @@ definitions:
type: string
sim:
allOf:
- - $ref: '#/definitions/entities.SIM'
+ - $ref: "#/definitions/entities.SIM"
description: SIM card that received the message
example: SIM1
timestamp:
- description: Timestamp is the time when the event was emitted, Please send
+ description:
+ Timestamp is the time when the event was emitted, Please send
the timestamp in UTC with as much precision as possible
example: "2022-06-05T14:26:09.527976+03:00"
type: string
@@ -729,21 +739,22 @@ definitions:
example: "+18005550100"
type: string
required:
- - content
- - encrypted
- - from
- - sim
- - timestamp
- - to
+ - content
+ - encrypted
+ - from
+ - sim
+ - timestamp
+ - to
type: object
requests.MessageSend:
properties:
attachments:
- description: Attachments are optional. When you provide a list of attachments,
+ description:
+ Attachments are optional. When you provide a list of attachments,
the message will be sent out as an MMS
example:
- - https://example.com/image.jpg
- - https://example.com/video.mp4
+ - https://example.com/image.jpg
+ - https://example.com/video.mp4
items:
type: string
type: array
@@ -751,7 +762,8 @@ definitions:
example: This is a sample text message
type: string
encrypted:
- description: Encrypted is an optional parameter used to determine if the content
+ 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
example: false
@@ -760,12 +772,14 @@ definitions:
example: "+18005550199"
type: string
request_id:
- description: RequestID is an optional parameter used to track a request from
+ description:
+ RequestID is an optional parameter used to track a request from
the client's perspective
example: 153554b5-ae44-44a0-8f4f-7bbac5657ad4
type: string
send_at:
- description: SendAt is an optional parameter used to schedule a message to
+ description:
+ SendAt is an optional parameter used to schedule a message to
be sent in the future. The time is considered to be in your profile's local
timezone and you can queue messages for up to 20 days (480 hours) in the
future.
@@ -775,9 +789,40 @@ definitions:
example: "+18005550100"
type: string
required:
- - content
- - from
- - to
+ - content
+ - from
+ - to
+ type: object
+ requests.MessageSendScheduleStore:
+ properties:
+ is_active:
+ type: boolean
+ name:
+ type: string
+ timezone:
+ type: string
+ windows:
+ items:
+ $ref: "#/definitions/requests.MessageSendScheduleWindow"
+ type: array
+ required:
+ - is_active
+ - name
+ - timezone
+ - windows
+ type: object
+ requests.MessageSendScheduleWindow:
+ properties:
+ day_of_week:
+ type: integer
+ end_minute:
+ type: integer
+ start_minute:
+ type: integer
+ required:
+ - day_of_week
+ - end_minute
+ - start_minute
type: object
requests.MessageThreadUpdate:
properties:
@@ -785,7 +830,7 @@ definitions:
example: true
type: boolean
required:
- - is_archived
+ - is_archived
type: object
requests.PhoneAPIKeyStoreRequest:
properties:
@@ -793,7 +838,7 @@ definitions:
example: My Phone API Key
type: string
required:
- - name
+ - name
type: object
requests.PhoneFCMToken:
properties:
@@ -801,17 +846,18 @@ definitions:
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd.....
type: string
phone_number:
- example: '[+18005550199]'
+ example: "[+18005550199]"
type: string
sim:
- description: SIM is the SIM slot of the phone in case the phone has more than
+ description:
+ SIM is the SIM slot of the phone in case the phone has more than
1 SIM slot
example: SIM1
type: string
required:
- - fcm_token
- - phone_number
- - sim
+ - fcm_token
+ - phone_number
+ - sim
type: object
requests.PhoneUpsert:
properties:
@@ -819,12 +865,14 @@ definitions:
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd.....
type: string
max_send_attempts:
- description: MaxSendAttempts is the number of attempts when sending an SMS
+ description:
+ MaxSendAttempts is the number of attempts when sending an SMS
message to handle the case where the phone is offline.
example: 2
type: integer
message_expiration_seconds:
- description: MessageExpirationSeconds is the duration in seconds after sending
+ description:
+ MessageExpirationSeconds is the duration in seconds after sending
a message when it is considered to be expired.
example: 12345
type: integer
@@ -841,50 +889,20 @@ definitions:
example: 32343a19-da5e-4b1b-a767-3298a73703cb
type: string
sim:
- description: SIM is the SIM slot of the phone in case the phone has more than
+ description:
+ SIM is the SIM slot of the phone in case the phone has more than
1 SIM slot
example: SIM1
type: string
required:
- - fcm_token
- - max_send_attempts
- - message_expiration_seconds
- - messages_per_minute
- - missed_call_auto_reply
- - phone_number
- - schedule_id
- - sim
- type: object
- requests.SendScheduleStore:
- properties:
- is_active:
- type: boolean
- name:
- type: string
- timezone:
- type: string
- windows:
- items:
- $ref: '#/definitions/requests.SendScheduleWindow'
- type: array
- required:
- - is_active
- - name
- - timezone
- - windows
- type: object
- requests.SendScheduleWindow:
- properties:
- day_of_week:
- type: integer
- end_minute:
- type: integer
- start_minute:
- type: integer
- required:
- - day_of_week
- - end_minute
- - start_minute
+ - fcm_token
+ - max_send_attempts
+ - message_expiration_seconds
+ - messages_per_minute
+ - missed_call_auto_reply
+ - phone_number
+ - schedule_id
+ - sim
type: object
requests.UserNotificationUpdate:
properties:
@@ -901,10 +919,10 @@ definitions:
example: true
type: boolean
required:
- - heartbeat_enabled
- - message_status_enabled
- - newsletter_enabled
- - webhook_enabled
+ - heartbeat_enabled
+ - message_status_enabled
+ - newsletter_enabled
+ - webhook_enabled
type: object
requests.UserPaymentInvoice:
properties:
@@ -930,13 +948,13 @@ definitions:
example: "9800"
type: string
required:
- - address
- - city
- - country
- - name
- - notes
- - state
- - zip_code
+ - address
+ - city
+ - country
+ - name
+ - notes
+ - state
+ - zip_code
type: object
requests.UserUpdate:
properties:
@@ -947,8 +965,8 @@ definitions:
example: Europe/Helsinki
type: string
required:
- - active_phone_id
- - timezone
+ - active_phone_id
+ - timezone
type: object
requests.WebhookStore:
properties:
@@ -958,8 +976,8 @@ definitions:
type: array
phone_numbers:
example:
- - "+18005550100"
- - "+18005550100"
+ - "+18005550100"
+ - "+18005550100"
items:
type: string
type: array
@@ -968,10 +986,10 @@ definitions:
url:
type: string
required:
- - events
- - phone_numbers
- - signing_key
- - url
+ - events
+ - phone_numbers
+ - signing_key
+ - url
type: object
requests.WebhookUpdate:
properties:
@@ -981,8 +999,8 @@ definitions:
type: array
phone_numbers:
example:
- - "+18005550100"
- - "+18005550100"
+ - "+18005550100"
+ - "+18005550100"
items:
type: string
type: array
@@ -991,10 +1009,10 @@ definitions:
url:
type: string
required:
- - events
- - phone_numbers
- - signing_key
- - url
+ - events
+ - phone_numbers
+ - signing_key
+ - url
type: object
responses.BadRequest:
properties:
@@ -1008,14 +1026,14 @@ definitions:
example: error
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.BillingUsageResponse:
properties:
data:
- $ref: '#/definitions/entities.BillingUsage'
+ $ref: "#/definitions/entities.BillingUsage"
message:
example: Request handled successfully
type: string
@@ -1023,15 +1041,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.BillingUsagesResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.BillingUsage'
+ $ref: "#/definitions/entities.BillingUsage"
type: array
message:
example: Request handled successfully
@@ -1040,14 +1058,14 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.DiscordResponse:
properties:
data:
- $ref: '#/definitions/entities.Discord'
+ $ref: "#/definitions/entities.Discord"
message:
example: Request handled successfully
type: string
@@ -1055,15 +1073,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.DiscordsResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.Discord'
+ $ref: "#/definitions/entities.Discord"
type: array
message:
example: Request handled successfully
@@ -1072,14 +1090,14 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.HeartbeatResponse:
properties:
data:
- $ref: '#/definitions/entities.Heartbeat'
+ $ref: "#/definitions/entities.Heartbeat"
message:
example: Request handled successfully
type: string
@@ -1087,15 +1105,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.HeartbeatsResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.Heartbeat'
+ $ref: "#/definitions/entities.Heartbeat"
type: array
message:
example: Request handled successfully
@@ -1104,9 +1122,9 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.InternalServerError:
properties:
@@ -1117,13 +1135,13 @@ definitions:
example: error
type: string
required:
- - message
- - status
+ - message
+ - status
type: object
responses.MessageResponse:
properties:
data:
- $ref: '#/definitions/entities.Message'
+ $ref: "#/definitions/entities.Message"
message:
example: Request handled successfully
type: string
@@ -1131,15 +1149,30 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
+ type: object
+ responses.MessageSendScheduleResponse:
+ properties:
+ data:
+ $ref: "#/definitions/entities.MessageSendSchedule"
+ message:
+ example: Request handled successfully
+ type: string
+ status:
+ example: success
+ type: string
+ required:
+ - data
+ - message
+ - status
type: object
responses.MessageThreadsResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.MessageThread'
+ $ref: "#/definitions/entities.MessageThread"
type: array
message:
example: Request handled successfully
@@ -1148,15 +1181,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.MessagesResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.Message'
+ $ref: "#/definitions/entities.Message"
type: array
message:
example: Request handled successfully
@@ -1165,9 +1198,9 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.NoContent:
properties:
@@ -1178,8 +1211,8 @@ definitions:
example: success
type: string
required:
- - message
- - status
+ - message
+ - status
type: object
responses.NotFound:
properties:
@@ -1190,8 +1223,8 @@ definitions:
example: error
type: string
required:
- - message
- - status
+ - message
+ - status
type: object
responses.OkString:
properties:
@@ -1204,14 +1237,14 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.PhoneAPIKeyResponse:
properties:
data:
- $ref: '#/definitions/entities.PhoneAPIKey'
+ $ref: "#/definitions/entities.PhoneAPIKey"
message:
example: Request handled successfully
type: string
@@ -1219,15 +1252,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.PhoneAPIKeysResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.PhoneAPIKey'
+ $ref: "#/definitions/entities.PhoneAPIKey"
type: array
message:
example: Request handled successfully
@@ -1236,14 +1269,14 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.PhoneResponse:
properties:
data:
- $ref: '#/definitions/entities.Phone'
+ $ref: "#/definitions/entities.Phone"
message:
example: Request handled successfully
type: string
@@ -1251,15 +1284,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.PhonesResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.Phone'
+ $ref: "#/definitions/entities.Phone"
type: array
message:
example: Request handled successfully
@@ -1268,24 +1301,9 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
- type: object
- responses.SendScheduleResponse:
- properties:
- data:
- $ref: '#/definitions/entities.MessageSendSchedule'
- message:
- example: Request handled successfully
- type: string
- status:
- example: success
- type: string
- required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.Unauthorized:
properties:
@@ -1299,9 +1317,9 @@ definitions:
example: error
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.UnprocessableEntity:
properties:
@@ -1318,14 +1336,14 @@ definitions:
example: error
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.UserResponse:
properties:
data:
- $ref: '#/definitions/entities.User'
+ $ref: "#/definitions/entities.User"
message:
example: Request handled successfully
type: string
@@ -1333,9 +1351,9 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.UserSubscriptionPaymentsResponse:
properties:
@@ -1398,42 +1416,42 @@ definitions:
updated_at:
type: string
required:
- - billing_reason
- - card_brand
- - card_last_four
- - created_at
- - currency
- - currency_rate
- - discount_total
- - discount_total_formatted
- - discount_total_usd
- - refunded
- - refunded_amount
- - refunded_amount_formatted
- - refunded_amount_usd
- - refunded_at
- - status
- - status_formatted
- - subtotal
- - subtotal_formatted
- - subtotal_usd
- - tax
- - tax_formatted
- - tax_inclusive
- - tax_usd
- - total
- - total_formatted
- - total_usd
- - updated_at
+ - billing_reason
+ - card_brand
+ - card_last_four
+ - created_at
+ - currency
+ - currency_rate
+ - discount_total
+ - discount_total_formatted
+ - discount_total_usd
+ - refunded
+ - refunded_amount
+ - refunded_amount_formatted
+ - refunded_amount_usd
+ - refunded_at
+ - status
+ - status_formatted
+ - subtotal
+ - subtotal_formatted
+ - subtotal_usd
+ - tax
+ - tax_formatted
+ - tax_inclusive
+ - tax_usd
+ - total
+ - total_formatted
+ - total_usd
+ - updated_at
type: object
id:
type: string
type:
type: string
required:
- - attributes
- - id
- - type
+ - attributes
+ - id
+ - type
type: object
type: array
message:
@@ -1443,14 +1461,14 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.WebhookResponse:
properties:
data:
- $ref: '#/definitions/entities.Webhook'
+ $ref: "#/definitions/entities.Webhook"
message:
example: Request handled successfully
type: string
@@ -1458,15 +1476,15 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
responses.WebhooksResponse:
properties:
data:
items:
- $ref: '#/definitions/entities.Webhook'
+ $ref: "#/definitions/entities.Webhook"
type: array
message:
example: Request handled successfully
@@ -1475,16 +1493,17 @@ definitions:
example: success
type: string
required:
- - data
- - message
- - status
+ - data
+ - message
+ - status
type: object
host: api.httpsms.com
info:
contact:
- description: Use your Android phone to send and receive SMS messages via a simple
+ description:
+ Use your Android phone to send and receive SMS messages via a simple
programmable API with end-to-end encryption.
license:
name: AGPL-3.0
@@ -1495,1834 +1514,1859 @@ paths:
/billing/usage:
get:
consumes:
- - application/json
- description: Get the summary of sent and received messages for a user in the
+ - application/json
+ description:
+ Get the summary of sent and received messages for a user in the
current month
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.BillingUsageResponse'
+ $ref: "#/definitions/responses.BillingUsageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get Billing Usage.
tags:
- - Billing
+ - Billing
/billing/usage-history:
get:
consumes:
- - application/json
- description: Get billing usage records of sent and received messages for a user
+ - application/json
+ 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.
parameters:
- - description: number of heartbeats to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: number of heartbeats to return
- in: query
- maximum: 100
- minimum: 1
- name: limit
- type: integer
+ - description: number of heartbeats to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: number of heartbeats to return
+ in: query
+ maximum: 100
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.BillingUsagesResponse'
+ $ref: "#/definitions/responses.BillingUsagesResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get billing usage history.
tags:
- - Billing
+ - Billing
/bulk-messages:
post:
consumes:
- - multipart/form-data
- description: Sends bulk SMS messages to multiple users based on our [CSV template](https://httpsms.com/templates/httpsms-bulk.csv)
+ - multipart/form-data
+ description:
+ Sends bulk SMS messages to multiple users based on our [CSV template](https://httpsms.com/templates/httpsms-bulk.csv)
or our [Excel template](https://httpsms.com/templates/httpsms-bulk.xlsx).
parameters:
- - description: The Excel or CSV file containing the messages to be sent.
- in: formData
- name: document
- required: true
- type: file
+ - description: The Excel or CSV file containing the messages to be sent.
+ in: formData
+ name: document
+ required: true
+ type: file
produces:
- - application/json
+ - application/json
responses:
"202":
description: Accepted
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Store bulk SMS file
tags:
- - BulkSMS
+ - BulkSMS
/discord-integrations:
get:
consumes:
- - application/json
+ - application/json
description: Get the discord integrations of a user
parameters:
- - description: number of discord integrations to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter discord integrations containing query
- in: query
- name: query
- type: string
- - description: number of discord integrations to return
- in: query
- maximum: 20
- minimum: 1
- name: limit
- type: integer
+ - description: number of discord integrations to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter discord integrations containing query
+ in: query
+ name: query
+ type: string
+ - description: number of discord integrations to return
+ in: query
+ maximum: 20
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.DiscordsResponse'
+ $ref: "#/definitions/responses.DiscordsResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get discord integrations of a user
tags:
- - DiscordIntegration
+ - DiscordIntegration
post:
consumes:
- - application/json
+ - application/json
description: Store a discord integration for the authenticated user
parameters:
- - description: Payload of the discord integration request
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.DiscordStore'
+ - description: Payload of the discord integration request
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.DiscordStore"
produces:
- - application/json
+ - application/json
responses:
"201":
description: Created
schema:
- $ref: '#/definitions/responses.DiscordResponse'
+ $ref: "#/definitions/responses.DiscordResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Store discord integration
tags:
- - DiscordIntegration
+ - DiscordIntegration
/discord-integrations/{discordID}:
delete:
consumes:
- - application/json
+ - application/json
description: Delete a discord integration for a user
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the discord integration
- in: path
- name: discordID
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the discord integration
+ in: path
+ name: discordID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete discord integration
tags:
- - Webhooks
+ - Webhooks
put:
consumes:
- - application/json
+ - application/json
description: Update a discord integration for the currently authenticated user
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the discord integration
- in: path
- name: discordID
- required: true
- type: string
- - description: Payload of discord integration to update
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.DiscordUpdate'
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the discord integration
+ in: path
+ name: discordID
+ required: true
+ type: string
+ - description: Payload of discord integration to update
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.DiscordUpdate"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.DiscordResponse'
+ $ref: "#/definitions/responses.DiscordResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Update a discord integration
tags:
- - DiscordIntegration
+ - DiscordIntegration
/discord/event:
post:
consumes:
- - application/json
+ - application/json
description: Publish a discord event to the registered listeners
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
summary: Consume a discord event
tags:
- - Discord
+ - Discord
/heartbeats:
get:
consumes:
- - application/json
- description: Get the last time a phone number requested for outstanding messages.
+ - application/json
+ description:
+ Get the last time a phone number requested for outstanding messages.
It will be sorted by timestamp in descending order.
parameters:
- - default: "+18005550199"
- description: the owner's phone number
- in: query
- name: owner
- required: true
- type: string
- - description: number of heartbeats to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter containing query
- in: query
- name: query
- type: string
- - description: number of heartbeats to return
- in: query
- maximum: 20
- minimum: 1
- name: limit
- type: integer
+ - default: "+18005550199"
+ description: the owner's phone number
+ in: query
+ name: owner
+ required: true
+ type: string
+ - description: number of heartbeats to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter containing query
+ in: query
+ name: query
+ type: string
+ - description: number of heartbeats to return
+ in: query
+ maximum: 20
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.HeartbeatsResponse'
+ $ref: "#/definitions/responses.HeartbeatsResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get heartbeats of an owner phone number
tags:
- - Heartbeats
+ - Heartbeats
post:
consumes:
- - application/json
- description: Store the heartbeat to make notify that a phone number is still
+ - application/json
+ description:
+ Store the heartbeat to make notify that a phone number is still
active
parameters:
- - description: Payload of the heartbeat request
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.HeartbeatStore'
+ - description: Payload of the heartbeat request
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.HeartbeatStore"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.HeartbeatResponse'
+ $ref: "#/definitions/responses.HeartbeatResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Register heartbeat of an owner phone number
tags:
- - Heartbeats
+ - Heartbeats
/integration/3cx/messages:
post:
consumes:
- - application/json
+ - application/json
description: Sends an SMS message from the 3CX platform
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
summary: Sends a 3CX SMS message
tags:
- - 3CXIntegration
+ - 3CXIntegration
/message-threads:
get:
consumes:
- - application/json
- description: Get list of contacts which a phone number has communicated with
+ - application/json
+ description:
+ Get list of contacts which a phone number has communicated with
(threads). It will be sorted by timestamp in descending order.
parameters:
- - default: "+18005550199"
- description: owner phone number
- in: query
- name: owner
- required: true
- type: string
- - description: number of messages to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter message threads containing query
- in: query
- name: query
- type: string
- - description: number of messages to return
- in: query
- maximum: 20
- minimum: 1
- name: limit
- type: integer
+ - default: "+18005550199"
+ description: owner phone number
+ in: query
+ name: owner
+ required: true
+ type: string
+ - description: number of messages to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter message threads containing query
+ in: query
+ name: query
+ type: string
+ - description: number of messages to return
+ in: query
+ maximum: 20
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessageThreadsResponse'
+ $ref: "#/definitions/responses.MessageThreadsResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get message threads for a phone number
tags:
- - MessageThreads
+ - MessageThreads
/message-threads/{messageThreadID}:
delete:
consumes:
- - application/json
- description: Delete a message thread from the database and also deletes all
+ - application/json
+ description:
+ Delete a message thread from the database and also deletes all
the messages in the thread.
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the message thread
- in: path
- name: messageThreadID
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the message thread
+ in: path
+ name: messageThreadID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete a message thread from the database.
tags:
- - MessageThreads
+ - MessageThreads
put:
consumes:
- - application/json
+ - application/json
description: Updates the details of a message thread
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the message thread
- in: path
- name: messageThreadID
- required: true
- type: string
- - description: Payload of message thread details to update
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.MessageThreadUpdate'
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the message thread
+ in: path
+ name: messageThreadID
+ required: true
+ type: string
+ - description: Payload of message thread details to update
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageThreadUpdate"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhoneResponse'
+ $ref: "#/definitions/responses.PhoneResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Update a message thread
tags:
- - MessageThreads
+ - MessageThreads
/messages:
get:
consumes:
- - application/json
- description: Get list of messages which are sent between 2 phone numbers. It
+ - application/json
+ description:
+ Get list of messages which are sent between 2 phone numbers. It
will be sorted by timestamp in descending order.
parameters:
- - default: "+18005550199"
- description: the owner's phone number
- in: query
- name: owner
- required: true
- type: string
- - default: "+18005550100"
- description: the contact's phone number
- in: query
- name: contact
- required: true
- type: string
- - description: number of messages to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter messages containing query
- in: query
- name: query
- type: string
- - description: number of messages to return
- in: query
- maximum: 20
- minimum: 1
- name: limit
- type: integer
+ - default: "+18005550199"
+ description: the owner's phone number
+ in: query
+ name: owner
+ required: true
+ type: string
+ - default: "+18005550100"
+ description: the contact's phone number
+ in: query
+ name: contact
+ required: true
+ type: string
+ - description: number of messages to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter messages containing query
+ in: query
+ name: query
+ type: string
+ - description: number of messages to return
+ in: query
+ maximum: 20
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessagesResponse'
+ $ref: "#/definitions/responses.MessagesResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get messages which are sent between 2 phone numbers
tags:
- - Messages
+ - Messages
/messages/{messageID}:
delete:
consumes:
- - application/json
- description: Delete a message from the database and removes the message content
+ - application/json
+ description:
+ Delete a message from the database and removes the message content
from the list of threads.
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the message
- in: path
- name: messageID
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the message
+ in: path
+ name: messageID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete a message from the database.
tags:
- - Messages
+ - Messages
get:
consumes:
- - application/json
+ - application/json
description: Get a message from the database by the message ID.
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the message
- in: path
- name: messageID
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the message
+ in: path
+ name: messageID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.MessageResponse'
+ $ref: "#/definitions/responses.MessageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get a message from the database.
tags:
- - Messages
+ - Messages
/messages/{messageID}/events:
post:
consumes:
- - application/json
- description: Use this endpoint to send events for a message when it is failed,
+ - application/json
+ description:
+ Use this endpoint to send events for a message when it is failed,
sent or delivered by the mobile phone.
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the message
- in: path
- name: messageID
- required: true
- type: string
- - description: Payload of the event emitted.
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.MessageEvent'
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the message
+ in: path
+ name: messageID
+ required: true
+ type: string
+ - description: Payload of the event emitted.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageEvent"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessageResponse'
+ $ref: "#/definitions/responses.MessageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Upsert an event for a message on the mobile phone
tags:
- - Messages
+ - Messages
/messages/bulk-send:
post:
consumes:
- - application/json
+ - application/json
description: Add bulk SMS messages to be sent by the android phone
parameters:
- - description: Bulk send message request payload
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.MessageBulkSend'
+ - description: Bulk send message request payload
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageBulkSend"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
items:
- $ref: '#/definitions/responses.MessagesResponse'
+ $ref: "#/definitions/responses.MessagesResponse"
type: array
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Send bulk SMS messages
tags:
- - Messages
+ - Messages
/messages/calls/missed:
post:
consumes:
- - application/json
- description: This endpoint is called by the httpSMS android app to register
+ - application/json
+ description:
+ This endpoint is called by the httpSMS android app to register
a missed call event on the mobile phone.
parameters:
- - description: Payload of the missed call event.
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.MessageCallMissed'
+ - description: Payload of the missed call event.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageCallMissed"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessageResponse'
+ $ref: "#/definitions/responses.MessageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Register a missed call event on the mobile phone
tags:
- - Messages
+ - Messages
/messages/outstanding:
get:
consumes:
- - application/json
+ - application/json
description: Get an outstanding message to be sent by an android phone
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703cb
- description: The ID of the message
- in: query
- name: message_id
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703cb
+ description: The ID of the message
+ in: query
+ name: message_id
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessageResponse'
+ $ref: "#/definitions/responses.MessageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get an outstanding message
tags:
- - Messages
+ - Messages
/messages/receive:
post:
consumes:
- - application/json
+ - application/json
description: Add a new message received from a mobile phone
parameters:
- - description: Received message request payload
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.MessageReceive'
+ - description: Received message request payload
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageReceive"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessageResponse'
+ $ref: "#/definitions/responses.MessageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Receive a new SMS message from a mobile phone
tags:
- - Messages
+ - Messages
/messages/search:
get:
consumes:
- - application/json
- description: This returns the list of all messages based on the filter criteria
+ - application/json
+ description:
+ This returns the list of all messages based on the filter criteria
including missed calls
parameters:
- - description: Cloudflare turnstile token https://www.cloudflare.com/en-gb/application-services/products/turnstile/
- in: header
- name: token
- required: true
- type: string
- - default: +18005550199,+18005550100
- description: the owner's phone numbers
- in: query
- name: owners
- required: true
- type: string
- - description: number of messages to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter messages containing query
- in: query
- name: query
- type: string
- - description: number of messages to return
- in: query
- maximum: 200
- minimum: 1
- name: limit
- type: integer
+ - description: Cloudflare turnstile token https://www.cloudflare.com/en-gb/application-services/products/turnstile/
+ in: header
+ name: token
+ required: true
+ type: string
+ - default: +18005550199,+18005550100
+ description: the owner's phone numbers
+ in: query
+ name: owners
+ required: true
+ type: string
+ - description: number of messages to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter messages containing query
+ in: query
+ name: query
+ type: string
+ - description: number of messages to return
+ in: query
+ maximum: 200
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessagesResponse'
+ $ref: "#/definitions/responses.MessagesResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Search all messages of a user
tags:
- - Messages
+ - Messages
/messages/send:
post:
consumes:
- - application/json
+ - application/json
description: Add a new SMS message to be sent by your Android phone
parameters:
- - description: Send message request payload
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.MessageSend'
+ - description: Send message request payload
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageSend"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.MessageResponse'
+ $ref: "#/definitions/responses.MessageResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Send an SMS message
tags:
- - Messages
+ - Messages
/phone-api-keys:
get:
consumes:
- - application/json
- description: Get list phone API keys which a user has registered on the httpSMS
+ - 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
+ - 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
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhoneAPIKeysResponse'
+ $ref: "#/definitions/responses.PhoneAPIKeysResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get the phone API keys of a user
tags:
- - PhoneAPIKeys
+ - PhoneAPIKeys
post:
consumes:
- - application/json
- description: Creates a new phone API key which can be used to log in to the
+ - 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'
+ - description: Payload of new phone API key.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.PhoneAPIKeyStoreRequest"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhoneAPIKeyResponse'
+ $ref: "#/definitions/responses.PhoneAPIKeyResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Store phone API key
tags:
- - PhoneAPIKeys
+ - PhoneAPIKeys
/phone-api-keys/{phoneAPIKeyID}:
delete:
consumes:
- - application/json
- description: Delete a phone API Key from the database and cannot be used for
+ - 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
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the phone API key
+ in: path
+ name: phoneAPIKeyID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete a phone API key from the database.
tags:
- - PhoneAPIKeys
+ - 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
+ - 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
+ - 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
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Remove the association of a phone from the phone API key.
tags:
- - PhoneAPIKeys
+ - PhoneAPIKeys
/phones:
get:
consumes:
- - application/json
- description: Get list of phones which a user has registered on the http sms
+ - application/json
+ description:
+ Get list of phones which a user has registered on the http sms
application
parameters:
- - description: number of heartbeats to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter phones containing query
- in: query
- name: query
- type: string
- - description: number of phones to return
- in: query
- maximum: 20
- minimum: 1
- name: limit
- type: integer
+ - description: number of heartbeats to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter phones containing query
+ in: query
+ name: query
+ type: string
+ - description: number of phones to return
+ in: query
+ maximum: 20
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhonesResponse'
+ $ref: "#/definitions/responses.PhonesResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get phones of a user
tags:
- - Phones
+ - Phones
put:
consumes:
- - application/json
- description: Updates properties of a user's phone. If the phone with this number
+ - application/json
+ description:
+ Updates properties of a user's phone. If the phone with this number
does not exist, a new one will be created. Think of this method like an 'upsert'
parameters:
- - description: Payload of new phone number.
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.PhoneUpsert'
+ - description: Payload of new phone number.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.PhoneUpsert"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhoneResponse'
+ $ref: "#/definitions/responses.PhoneResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Upsert Phone
tags:
- - Phones
+ - Phones
/phones/{phoneID}:
delete:
consumes:
- - application/json
+ - application/json
description: Delete a phone that has been sored in the database
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the phone
- in: path
- name: phoneID
- 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
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete Phone
tags:
- - Phones
+ - Phones
/phones/fcm-token:
put:
consumes:
- - application/json
- description: Updates the FCM token of a phone. If the phone with this number
+ - application/json
+ description:
+ Updates the FCM token of a phone. If the phone with this number
does not exist, a new one will be created. Think of this method like an 'upsert'
parameters:
- - description: Payload of new FCM token.
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.PhoneFCMToken'
+ - description: Payload of new FCM token.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.PhoneFCMToken"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhoneResponse'
+ $ref: "#/definitions/responses.PhoneResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Upserts the FCM token of a phone
tags:
- - Phones
+ - Phones
/send-schedules:
get:
description: List all send schedules owned by the authenticated user.
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
items:
- $ref: '#/definitions/entities.MessageSendSchedule'
+ $ref: "#/definitions/entities.MessageSendSchedule"
type: array
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: List send schedules
tags:
- - Send Schedules
+ - Send Schedules
post:
consumes:
- - application/json
+ - application/json
description: Create a new send schedule for the authenticated user.
parameters:
- - description: Payload of new send schedule.
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.SendScheduleStore'
+ - description: Payload of new send schedule.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageSendScheduleStore"
produces:
- - application/json
+ - application/json
responses:
"201":
description: Created
schema:
- $ref: '#/definitions/responses.SendScheduleResponse'
+ $ref: "#/definitions/responses.MessageSendScheduleResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
+ "402":
+ description: Payment Required
+ schema:
+ $ref: "#/definitions/responses.BadRequest"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Create send schedule
tags:
- - Send Schedules
+ - Send Schedules
/send-schedules/{scheduleID}:
delete:
description: Delete a send schedule owned by the authenticated user.
parameters:
- - description: Schedule ID
- in: path
- name: scheduleID
- required: true
- type: string
+ - description: Schedule ID
+ in: path
+ name: scheduleID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete send schedule
tags:
- - Send Schedules
+ - Send Schedules
put:
consumes:
- - application/json
+ - application/json
description: Update a send schedule owned by the authenticated user.
parameters:
- - description: Schedule ID
- in: path
- name: scheduleID
- required: true
- type: string
- - description: Payload of updated send schedule.
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.SendScheduleStore'
+ - description: Schedule ID
+ in: path
+ name: scheduleID
+ required: true
+ type: string
+ - description: Payload of updated send schedule.
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.MessageSendScheduleStore"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.SendScheduleResponse'
+ $ref: "#/definitions/responses.MessageSendScheduleResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Update send schedule
tags:
- - Send Schedules
+ - Send Schedules
/users/{userID}/api-keys:
delete:
consumes:
- - application/json
+ - application/json
description: Rotate the user's API key in case the current API Key is compromised
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the user to update
- in: path
- name: userID
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the user to update
+ in: path
+ name: userID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.UserResponse'
+ $ref: "#/definitions/responses.UserResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Rotate the user's API Key
tags:
- - Users
+ - Users
/users/{userID}/notifications:
put:
consumes:
- - application/json
+ - application/json
description: Update the email notification settings for a user
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the user to update
- in: path
- name: userID
- required: true
- type: string
- - description: User notification details to update
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.UserNotificationUpdate'
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the user to update
+ in: path
+ name: userID
+ required: true
+ type: string
+ - description: User notification details to update
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.UserNotificationUpdate"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.UserResponse'
+ $ref: "#/definitions/responses.UserResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Update notification settings
tags:
- - Users
+ - Users
/users/me:
delete:
consumes:
- - application/json
- description: Deletes the currently authenticated user together with all their
+ - application/json
+ description:
+ Deletes the currently authenticated user together with all their
data.
produces:
- - application/json
+ - application/json
responses:
"201":
description: Created
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete a user
tags:
- - Users
+ - Users
get:
consumes:
- - application/json
+ - application/json
description: Get details of the currently authenticated user
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.UserResponse'
+ $ref: "#/definitions/responses.UserResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get current user
tags:
- - Users
+ - Users
put:
consumes:
- - application/json
+ - application/json
description: Updates the details of the currently authenticated user
parameters:
- - description: Payload of user details to update
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.UserUpdate'
+ - description: Payload of user details to update
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.UserUpdate"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.PhoneResponse'
+ $ref: "#/definitions/responses.PhoneResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Update a user
tags:
- - Users
+ - Users
/users/subscription:
delete:
description: Cancel the subscription of the authenticated user.
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Cancel the user's subscription
tags:
- - Users
+ - Users
/users/subscription-update-url:
get:
description: Fetches the subscription URL of the authenticated user.
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.OkString'
+ $ref: "#/definitions/responses.OkString"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Currently authenticated user subscription update URL
tags:
- - Users
+ - Users
/users/subscription/invoices/{subscriptionInvoiceID}:
post:
consumes:
- - application/json
- description: Generates a new invoice PDF file for the given subscription payment
+ - application/json
+ description:
+ Generates a new invoice PDF file for the given subscription payment
with given parameters.
parameters:
- - description: Generate subscription payment invoice parameters
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.UserPaymentInvoice'
- - description: ID of the subscription invoice to generate the PDF for
- in: path
- name: subscriptionInvoiceID
- required: true
- type: string
+ - description: Generate subscription payment invoice parameters
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.UserPaymentInvoice"
+ - description: ID of the subscription invoice to generate the PDF for
+ in: path
+ name: subscriptionInvoiceID
+ required: true
+ type: string
produces:
- - application/pdf
+ - application/pdf
responses:
"200":
description: OK
@@ -3331,85 +3375,86 @@ paths:
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Generate a subscription payment invoice
tags:
- - Users
+ - Users
/users/subscription/payments:
get:
consumes:
- - application/json
- description: Subscription payments are generated throughout the lifecycle of
+ - application/json
+ description:
+ Subscription payments are generated throughout the lifecycle of
a subscription, typically there is one at the time of purchase and then one
for each renewal.
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.UserSubscriptionPaymentsResponse'
+ $ref: "#/definitions/responses.UserSubscriptionPaymentsResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get the last 10 subscription payments.
tags:
- - Users
+ - Users
/v1/attachments/{userID}/{messageID}/{attachmentIndex}/{filename}:
get:
description: Download an MMS attachment by its path components
parameters:
- - description: User ID
- in: path
- name: userID
- required: true
- type: string
- - description: Message ID
- in: path
- name: messageID
- required: true
- type: string
- - description: Attachment index
- in: path
- name: attachmentIndex
- required: true
- type: string
- - description: Filename with extension
- in: path
- name: filename
- required: true
- type: string
+ - description: User ID
+ in: path
+ name: userID
+ required: true
+ type: string
+ - description: Message ID
+ in: path
+ name: messageID
+ required: true
+ type: string
+ - description: Attachment index
+ in: path
+ name: attachmentIndex
+ required: true
+ type: string
+ - description: Filename with extension
+ in: path
+ name: filename
+ required: true
+ type: string
produces:
- - application/octet-stream
+ - application/octet-stream
responses:
"200":
description: OK
@@ -3418,189 +3463,189 @@ paths:
"404":
description: Not Found
schema:
- $ref: '#/definitions/responses.NotFound'
+ $ref: "#/definitions/responses.NotFound"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
summary: Download a message attachment
tags:
- - Attachments
+ - Attachments
/webhooks:
get:
consumes:
- - application/json
+ - application/json
description: Get the webhooks of a user
parameters:
- - description: number of webhooks to skip
- in: query
- minimum: 0
- name: skip
- type: integer
- - description: filter webhooks containing query
- in: query
- name: query
- type: string
- - description: number of webhooks to return
- in: query
- maximum: 20
- minimum: 1
- name: limit
- type: integer
+ - description: number of webhooks to skip
+ in: query
+ minimum: 0
+ name: skip
+ type: integer
+ - description: filter webhooks containing query
+ in: query
+ name: query
+ type: string
+ - description: number of webhooks to return
+ in: query
+ maximum: 20
+ minimum: 1
+ name: limit
+ type: integer
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.WebhooksResponse'
+ $ref: "#/definitions/responses.WebhooksResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Get webhooks of a user
tags:
- - Webhooks
+ - Webhooks
post:
consumes:
- - application/json
+ - application/json
description: Store a webhook for the authenticated user
parameters:
- - description: Payload of the webhook request
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.WebhookStore'
+ - description: Payload of the webhook request
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.WebhookStore"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.WebhookResponse'
+ $ref: "#/definitions/responses.WebhookResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Store a webhook
tags:
- - Webhooks
+ - Webhooks
/webhooks/{webhookID}:
delete:
consumes:
- - application/json
+ - application/json
description: Delete a webhook for a user
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the webhook
- in: path
- name: webhookID
- required: true
- type: string
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the webhook
+ in: path
+ name: webhookID
+ required: true
+ type: string
produces:
- - application/json
+ - application/json
responses:
"204":
description: No Content
schema:
- $ref: '#/definitions/responses.NoContent'
+ $ref: "#/definitions/responses.NoContent"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Delete webhook
tags:
- - Webhooks
+ - Webhooks
put:
consumes:
- - application/json
+ - application/json
description: Update a webhook for the currently authenticated user
parameters:
- - default: 32343a19-da5e-4b1b-a767-3298a73703ca
- description: ID of the webhook
- in: path
- name: webhookID
- required: true
- type: string
- - description: Payload of webhook details to update
- in: body
- name: payload
- required: true
- schema:
- $ref: '#/definitions/requests.WebhookUpdate'
+ - default: 32343a19-da5e-4b1b-a767-3298a73703ca
+ description: ID of the webhook
+ in: path
+ name: webhookID
+ required: true
+ type: string
+ - description: Payload of webhook details to update
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: "#/definitions/requests.WebhookUpdate"
produces:
- - application/json
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/responses.WebhookResponse'
+ $ref: "#/definitions/responses.WebhookResponse"
"400":
description: Bad Request
schema:
- $ref: '#/definitions/responses.BadRequest'
+ $ref: "#/definitions/responses.BadRequest"
"401":
description: Unauthorized
schema:
- $ref: '#/definitions/responses.Unauthorized'
+ $ref: "#/definitions/responses.Unauthorized"
"422":
description: Unprocessable Entity
schema:
- $ref: '#/definitions/responses.UnprocessableEntity'
+ $ref: "#/definitions/responses.UnprocessableEntity"
"500":
description: Internal Server Error
schema:
- $ref: '#/definitions/responses.InternalServerError'
+ $ref: "#/definitions/responses.InternalServerError"
security:
- - ApiKeyAuth: []
+ - ApiKeyAuth: []
summary: Update a webhook
tags:
- - Webhooks
+ - Webhooks
schemes:
-- https
+ - https
securityDefinitions:
ApiKeyAuth:
in: header
diff --git a/api/pkg/di/container.go b/api/pkg/di/container.go
index 5727f6f7..66b57468 100644
--- a/api/pkg/di/container.go
+++ b/api/pkg/di/container.go
@@ -128,8 +128,8 @@ func NewContainer(projectID string, version string) (container *Container) {
container.RegisterHeartbeatListeners()
container.RegisterUserRoutes()
- container.RegisterSendScheduleRoutes()
- container.RegisterSendScheduleListeners()
+ container.RegisterMessageSendScheduleRoutes()
+ container.RegisterMessageSendScheduleListeners()
container.RegisterUserListeners()
container.RegisterPhoneRoutes()
@@ -751,43 +751,43 @@ func (container *Container) PhoneRepository() (repository repositories.PhoneRepo
)
}
-// SendScheduleRepository creates a new instance of repositories.SendScheduleRepository
-func (container *Container) SendScheduleRepository() repositories.SendScheduleRepository {
- container.logger.Debug("creating GORM repositories.SendScheduleRepository")
- return repositories.NewGormSendScheduleRepository(
+// MessageSendScheduleRepository creates a new instance of repositories.MessageSendScheduleRepository
+func (container *Container) MessageSendScheduleRepository() repositories.MessageSendScheduleRepository {
+ container.logger.Debug("creating GORM repositories.MessageSendScheduleRepository")
+ return repositories.NewGormMessageSendScheduleRepository(
container.Logger(),
container.Tracer(),
container.DB(),
)
}
-// SendScheduleService creates a new instance of services.SendScheduleService
-func (container *Container) SendScheduleService() *services.SendScheduleService {
- container.logger.Debug("creating services.SendScheduleService")
- return services.NewSendScheduleService(
+// MessageSendScheduleService creates a new instance of services.MessageSendScheduleService
+func (container *Container) MessageSendScheduleService() *services.MessageSendScheduleService {
+ container.logger.Debug("creating services.MessageSendScheduleService")
+ return services.NewMessageSendScheduleService(
container.Logger(),
container.Tracer(),
- container.SendScheduleRepository(),
+ container.MessageSendScheduleRepository(),
)
}
-// SendScheduleHandlerValidator creates a new instance of validators.SendScheduleHandlerValidator
-func (container *Container) SendScheduleHandlerValidator() *validators.SendScheduleHandlerValidator {
- container.logger.Debug("creating validators.SendScheduleHandlerValidator")
- return validators.NewSendScheduleHandlerValidator(
+// MessageSendScheduleHandlerValidator creates a new instance of validators.MessageSendScheduleHandlerValidator
+func (container *Container) MessageSendScheduleHandlerValidator() *validators.MessageSendScheduleHandlerValidator {
+ container.logger.Debug("creating validators.MessageSendScheduleHandlerValidator")
+ return validators.NewMessageSendScheduleHandlerValidator(
container.Logger(),
container.Tracer(),
)
}
-// SendScheduleHandler creates a new instance of handlers.SendScheduleHandler
-func (container *Container) SendScheduleHandler() *handlers.SendScheduleHandler {
- container.logger.Debug("creating handlers.SendScheduleHandler")
- return handlers.NewSendScheduleHandler(
+// MessageSendScheduleHandler creates a new instance of handlers.MessageSendScheduleHandler
+func (container *Container) MessageSendScheduleHandler() *handlers.MessageSendScheduleHandler {
+ container.logger.Debug("creating handlers.MessageSendScheduleHandler")
+ return handlers.NewMessageSendScheduleHandler(
container.Logger(),
container.Tracer(),
- container.SendScheduleHandlerValidator(),
- container.SendScheduleService(),
+ container.MessageSendScheduleHandlerValidator(),
+ container.MessageSendScheduleService(),
container.EntitlementService(),
)
}
@@ -1147,13 +1147,13 @@ func (container *Container) RegisterMessageListeners() {
}
}
-// RegisterSendScheduleListeners registers event listeners for listeners.SendScheduleListener
-func (container *Container) RegisterSendScheduleListeners() {
- container.logger.Debug(fmt.Sprintf("registering listeners for %T", listeners.SendScheduleListener{}))
- _, routes := listeners.NewSendScheduleListener(
+// RegisterMessageSendScheduleListeners registers event listeners for listeners.MessageSendScheduleListener
+func (container *Container) RegisterMessageSendScheduleListeners() {
+ container.logger.Debug(fmt.Sprintf("registering listeners for %T", listeners.MessageSendScheduleListener{}))
+ _, routes := listeners.NewMessageSendScheduleListener(
container.Logger(),
container.Tracer(),
- container.SendScheduleService(),
+ container.MessageSendScheduleService(),
)
for event, handler := range routes {
@@ -1574,7 +1574,7 @@ func (container *Container) NotificationService() (service *services.PhoneNotifi
container.FirebaseMessagingClient(),
container.PhoneRepository(),
container.PhoneNotificationRepository(),
- container.SendScheduleRepository(),
+ container.MessageSendScheduleRepository(),
container.EventDispatcher(),
)
}
@@ -1630,10 +1630,10 @@ func (container *Container) RegisterUserRoutes() {
container.UserHandler().RegisterRoutes(container.App(), container.AuthenticatedMiddleware())
}
-// RegisterSendScheduleRoutes registers routes for the /send-schedules prefix
-func (container *Container) RegisterSendScheduleRoutes() {
- container.logger.Debug(fmt.Sprintf("registering %T routes", &handlers.SendScheduleHandler{}))
- container.SendScheduleHandler().RegisterRoutes(container.App(), container.AuthenticatedMiddleware())
+// RegisterMessageSendScheduleRoutes registers routes for the /send-schedules prefix
+func (container *Container) RegisterMessageSendScheduleRoutes() {
+ container.logger.Debug(fmt.Sprintf("registering %T routes", &handlers.MessageSendScheduleHandler{}))
+ container.MessageSendScheduleHandler().RegisterRoutes(container.App(), container.AuthenticatedMiddleware())
}
// RegisterEventRoutes registers routes for the /events prefix
diff --git a/api/pkg/entities/send_schedule.go b/api/pkg/entities/message_send_schedule.go
similarity index 100%
rename from api/pkg/entities/send_schedule.go
rename to api/pkg/entities/message_send_schedule.go
diff --git a/api/pkg/entities/send_schedule_test.go b/api/pkg/entities/message_send_schedule_test.go
similarity index 100%
rename from api/pkg/entities/send_schedule_test.go
rename to api/pkg/entities/message_send_schedule_test.go
diff --git a/api/pkg/handlers/send_schedule_handler.go b/api/pkg/handlers/message_send_schedule_handler.go
similarity index 83%
rename from api/pkg/handlers/send_schedule_handler.go
rename to api/pkg/handlers/message_send_schedule_handler.go
index ebf475a3..d7df8cdb 100644
--- a/api/pkg/handlers/send_schedule_handler.go
+++ b/api/pkg/handlers/message_send_schedule_handler.go
@@ -14,26 +14,26 @@ import (
"github.com/palantir/stacktrace"
)
-// SendScheduleHandler handles HTTP requests for message send schedules.
-type SendScheduleHandler struct {
+// MessageSendScheduleHandler handles HTTP requests for message send schedules.
+type MessageSendScheduleHandler struct {
handler
logger telemetry.Logger
tracer telemetry.Tracer
- validator *validators.SendScheduleHandlerValidator
- service *services.SendScheduleService
+ validator *validators.MessageSendScheduleHandlerValidator
+ service *services.MessageSendScheduleService
entitlementService *services.EntitlementService
}
-// NewSendScheduleHandler creates a new SendScheduleHandler.
-func NewSendScheduleHandler(
+// NewMessageSendScheduleHandler creates a new MessageSendScheduleHandler.
+func NewMessageSendScheduleHandler(
logger telemetry.Logger,
tracer telemetry.Tracer,
- validator *validators.SendScheduleHandlerValidator,
- service *services.SendScheduleService,
+ validator *validators.MessageSendScheduleHandlerValidator,
+ service *services.MessageSendScheduleService,
entitlementService *services.EntitlementService,
-) *SendScheduleHandler {
- return &SendScheduleHandler{
- logger: logger.WithService(fmt.Sprintf("%T", &SendScheduleHandler{})),
+) *MessageSendScheduleHandler {
+ return &MessageSendScheduleHandler{
+ logger: logger.WithService(fmt.Sprintf("%T", &MessageSendScheduleHandler{})),
tracer: tracer,
validator: validator,
service: service,
@@ -42,7 +42,7 @@ func NewSendScheduleHandler(
}
// RegisterRoutes registers send schedule routes.
-func (h *SendScheduleHandler) RegisterRoutes(router fiber.Router, middlewares ...fiber.Handler) {
+func (h *MessageSendScheduleHandler) RegisterRoutes(router fiber.Router, middlewares ...fiber.Handler) {
router.Get("/v1/send-schedules", h.computeRoute(middlewares, h.Index)...)
router.Post("/v1/send-schedules", h.computeRoute(middlewares, h.Store)...)
router.Put("/v1/send-schedules/:scheduleID", h.computeRoute(middlewares, h.Update)...)
@@ -60,7 +60,7 @@ func (h *SendScheduleHandler) RegisterRoutes(router fiber.Router, middlewares ..
// @Failure 401 {object} responses.Unauthorized
// @Failure 500 {object} responses.InternalServerError
// @Router /send-schedules [get]
-func (h *SendScheduleHandler) Index(c *fiber.Ctx) error {
+func (h *MessageSendScheduleHandler) Index(c *fiber.Ctx) error {
ctx, span, ctxLogger := h.tracer.StartFromFiberCtxWithLogger(c, h.logger)
defer span.End()
@@ -81,15 +81,15 @@ func (h *SendScheduleHandler) Index(c *fiber.Ctx) error {
// @Tags Send Schedules
// @Accept json
// @Produce json
-// @Param payload body requests.SendScheduleStore true "Payload of new send schedule."
-// @Success 201 {object} responses.SendScheduleResponse
+// @Param payload body requests.MessageSendScheduleStore true "Payload of new send schedule."
+// @Success 201 {object} responses.MessageSendScheduleResponse
// @Failure 400 {object} responses.BadRequest
// @Failure 401 {object} responses.Unauthorized
// @Failure 402 {object} responses.BadRequest
// @Failure 422 {object} responses.UnprocessableEntity
// @Failure 500 {object} responses.InternalServerError
// @Router /send-schedules [post]
-func (h *SendScheduleHandler) Store(c *fiber.Ctx) error {
+func (h *MessageSendScheduleHandler) Store(c *fiber.Ctx) error {
ctx, span, ctxLogger := h.tracer.StartFromFiberCtxWithLogger(c, h.logger)
defer span.End()
@@ -110,7 +110,7 @@ func (h *SendScheduleHandler) Store(c *fiber.Ctx) error {
return h.responsePaymentRequired(c, result.Message)
}
- var request requests.SendScheduleStore
+ var request requests.MessageSendScheduleStore
if err := c.BodyParser(&request); err != nil {
return h.responseBadRequest(c, err)
}
@@ -143,15 +143,15 @@ func (h *SendScheduleHandler) Store(c *fiber.Ctx) error {
// @Accept json
// @Produce json
// @Param scheduleID path string true "Schedule ID"
-// @Param payload body requests.SendScheduleStore true "Payload of updated send schedule."
-// @Success 200 {object} responses.SendScheduleResponse
+// @Param payload body requests.MessageSendScheduleStore true "Payload of updated send schedule."
+// @Success 200 {object} responses.MessageSendScheduleResponse
// @Failure 400 {object} responses.BadRequest
// @Failure 401 {object} responses.Unauthorized
// @Failure 404 {object} responses.NotFound
// @Failure 422 {object} responses.UnprocessableEntity
// @Failure 500 {object} responses.InternalServerError
// @Router /send-schedules/{scheduleID} [put]
-func (h *SendScheduleHandler) Update(c *fiber.Ctx) error {
+func (h *MessageSendScheduleHandler) Update(c *fiber.Ctx) error {
ctx, span, ctxLogger := h.tracer.StartFromFiberCtxWithLogger(c, h.logger)
defer span.End()
@@ -160,7 +160,7 @@ func (h *SendScheduleHandler) Update(c *fiber.Ctx) error {
return h.responseBadRequest(c, err)
}
- var request requests.SendScheduleStore
+ var request requests.MessageSendScheduleStore
if err = c.BodyParser(&request); err != nil {
return h.responseBadRequest(c, err)
}
@@ -201,7 +201,7 @@ func (h *SendScheduleHandler) Update(c *fiber.Ctx) error {
// @Failure 404 {object} responses.NotFound
// @Failure 500 {object} responses.InternalServerError
// @Router /send-schedules/{scheduleID} [delete]
-func (h *SendScheduleHandler) Delete(c *fiber.Ctx) error {
+func (h *MessageSendScheduleHandler) Delete(c *fiber.Ctx) error {
ctx, span, ctxLogger := h.tracer.StartFromFiberCtxWithLogger(c, h.logger)
defer span.End()
diff --git a/api/pkg/listeners/send_schedule_listener.go b/api/pkg/listeners/message_send_schedule_listener.go
similarity index 68%
rename from api/pkg/listeners/send_schedule_listener.go
rename to api/pkg/listeners/message_send_schedule_listener.go
index ac65eddd..61e57b24 100644
--- a/api/pkg/listeners/send_schedule_listener.go
+++ b/api/pkg/listeners/message_send_schedule_listener.go
@@ -11,21 +11,21 @@ import (
"github.com/palantir/stacktrace"
)
-// SendScheduleListener handles cloud events related to message send schedules.
-type SendScheduleListener struct {
+// MessageSendScheduleListener handles cloud events related to message send schedules.
+type MessageSendScheduleListener struct {
logger telemetry.Logger
tracer telemetry.Tracer
- service *services.SendScheduleService
+ service *services.MessageSendScheduleService
}
-// NewSendScheduleListener creates a new instance of SendScheduleListener.
-func NewSendScheduleListener(
+// NewMessageSendScheduleListener creates a new instance of MessageSendScheduleListener.
+func NewMessageSendScheduleListener(
logger telemetry.Logger,
tracer telemetry.Tracer,
- service *services.SendScheduleService,
-) (l *SendScheduleListener, routes map[string]events.EventListener) {
- l = &SendScheduleListener{
- logger: logger.WithService(fmt.Sprintf("%T", &SendScheduleListener{})),
+ service *services.MessageSendScheduleService,
+) (l *MessageSendScheduleListener, routes map[string]events.EventListener) {
+ l = &MessageSendScheduleListener{
+ logger: logger.WithService(fmt.Sprintf("%T", &MessageSendScheduleListener{})),
tracer: tracer,
service: service,
}
@@ -36,7 +36,7 @@ func NewSendScheduleListener(
}
// onUserAccountDeleted removes all message send schedules for a deleted user account.
-func (listener *SendScheduleListener) onUserAccountDeleted(
+func (listener *MessageSendScheduleListener) onUserAccountDeleted(
ctx context.Context,
event cloudevents.Event,
) error {
diff --git a/api/pkg/repositories/gorm_send_schedule_repository.go b/api/pkg/repositories/gorm_message_send_schedule_repository.go
similarity index 82%
rename from api/pkg/repositories/gorm_send_schedule_repository.go
rename to api/pkg/repositories/gorm_message_send_schedule_repository.go
index 4ee3c408..919eb6a9 100644
--- a/api/pkg/repositories/gorm_send_schedule_repository.go
+++ b/api/pkg/repositories/gorm_message_send_schedule_repository.go
@@ -12,28 +12,28 @@ import (
"gorm.io/gorm"
)
-// gormSendScheduleRepository persists and loads entities.MessageSendSchedule using GORM.
-type gormSendScheduleRepository struct {
+// gormMessageSendScheduleRepository persists and loads entities.MessageSendSchedule using GORM.
+type gormMessageSendScheduleRepository struct {
logger telemetry.Logger
tracer telemetry.Tracer
db *gorm.DB
}
-// NewGormSendScheduleRepository creates a new GORM-backed SendScheduleRepository.
-func NewGormSendScheduleRepository(
+// NewGormMessageSendScheduleRepository creates a new GORM-backed MessageSendScheduleRepository.
+func NewGormMessageSendScheduleRepository(
logger telemetry.Logger,
tracer telemetry.Tracer,
db *gorm.DB,
-) SendScheduleRepository {
- return &gormSendScheduleRepository{
- logger: logger.WithService(fmt.Sprintf("%T", &gormSendScheduleRepository{})),
+) MessageSendScheduleRepository {
+ return &gormMessageSendScheduleRepository{
+ logger: logger.WithService(fmt.Sprintf("%T", &gormMessageSendScheduleRepository{})),
tracer: tracer,
db: db,
}
}
// Store saves a new message send schedule.
-func (r *gormSendScheduleRepository) Store(
+func (r *gormMessageSendScheduleRepository) Store(
ctx context.Context,
schedule *entities.MessageSendSchedule,
) error {
@@ -51,7 +51,7 @@ func (r *gormSendScheduleRepository) Store(
}
// Update persists changes to an existing message send schedule.
-func (r *gormSendScheduleRepository) Update(
+func (r *gormMessageSendScheduleRepository) Update(
ctx context.Context,
schedule *entities.MessageSendSchedule,
) error {
@@ -69,7 +69,7 @@ func (r *gormSendScheduleRepository) Update(
}
// Load fetches a message send schedule by user ID and schedule ID.
-func (r *gormSendScheduleRepository) Load(
+func (r *gormMessageSendScheduleRepository) Load(
ctx context.Context,
userID entities.UserID,
scheduleID uuid.UUID,
@@ -104,7 +104,7 @@ func (r *gormSendScheduleRepository) Load(
}
// Index lists all message send schedules owned by the given user.
-func (r *gormSendScheduleRepository) Index(
+func (r *gormMessageSendScheduleRepository) Index(
ctx context.Context,
userID entities.UserID,
) ([]entities.MessageSendSchedule, error) {
@@ -126,7 +126,7 @@ func (r *gormSendScheduleRepository) Index(
}
// Delete removes a message send schedule owned by the given user.
-func (r *gormSendScheduleRepository) Delete(
+func (r *gormMessageSendScheduleRepository) Delete(
ctx context.Context,
userID entities.UserID,
scheduleID uuid.UUID,
@@ -148,7 +148,7 @@ func (r *gormSendScheduleRepository) Delete(
}
// DeleteAllForUser removes all message send schedules owned by the given user.
-func (r *gormSendScheduleRepository) DeleteAllForUser(
+func (r *gormMessageSendScheduleRepository) DeleteAllForUser(
ctx context.Context,
userID entities.UserID,
) error {
@@ -168,7 +168,7 @@ func (r *gormSendScheduleRepository) DeleteAllForUser(
}
// CountByUser returns the number of schedules owned by a user.
-func (r *gormSendScheduleRepository) CountByUser(
+func (r *gormMessageSendScheduleRepository) CountByUser(
ctx context.Context,
userID entities.UserID,
) (int, error) {
diff --git a/api/pkg/repositories/send_schedule_repository.go b/api/pkg/repositories/message_send_schedule_repository.go
similarity index 89%
rename from api/pkg/repositories/send_schedule_repository.go
rename to api/pkg/repositories/message_send_schedule_repository.go
index d57b42d7..82ef4518 100644
--- a/api/pkg/repositories/send_schedule_repository.go
+++ b/api/pkg/repositories/message_send_schedule_repository.go
@@ -7,8 +7,8 @@ import (
"github.com/google/uuid"
)
-// SendScheduleRepository loads and persists entities.MessageSendSchedule.
-type SendScheduleRepository interface {
+// MessageSendScheduleRepository loads and persists entities.MessageSendSchedule.
+type MessageSendScheduleRepository interface {
// Store persists a new message send schedule.
Store(ctx context.Context, schedule *entities.MessageSendSchedule) error
diff --git a/api/pkg/requests/message_send_schedule_store_request.go b/api/pkg/requests/message_send_schedule_store_request.go
new file mode 100644
index 00000000..1796e4bd
--- /dev/null
+++ b/api/pkg/requests/message_send_schedule_store_request.go
@@ -0,0 +1,52 @@
+package requests
+
+import (
+ "sort"
+ "strings"
+
+ "github.com/NdoleStudio/httpsms/pkg/entities"
+ "github.com/NdoleStudio/httpsms/pkg/services"
+)
+
+// MessageSendScheduleWindow represents a single request window for a message send schedule.
+type MessageSendScheduleWindow struct {
+ DayOfWeek int `json:"day_of_week"`
+ StartMinute int `json:"start_minute"`
+ EndMinute int `json:"end_minute"`
+}
+
+// MessageSendScheduleStore contains the payload used to create or update a message send schedule.
+type MessageSendScheduleStore struct {
+ request
+ Name string `json:"name"`
+ Timezone string `json:"timezone"`
+ IsActive bool `json:"is_active"`
+ Windows []MessageSendScheduleWindow `json:"windows"`
+}
+
+// Sanitize trims and sorts the message send schedule payload before validation.
+func (input *MessageSendScheduleStore) Sanitize() MessageSendScheduleStore {
+ input.Name = strings.TrimSpace(input.Name)
+ input.Timezone = strings.TrimSpace(input.Timezone)
+ windows := make([]MessageSendScheduleWindow, 0, len(input.Windows))
+ for _, item := range input.Windows {
+ windows = append(windows, MessageSendScheduleWindow{DayOfWeek: item.DayOfWeek, StartMinute: item.StartMinute, EndMinute: item.EndMinute})
+ }
+ sort.SliceStable(windows, func(i, j int) bool {
+ if windows[i].DayOfWeek == windows[j].DayOfWeek {
+ return windows[i].StartMinute < windows[j].StartMinute
+ }
+ return windows[i].DayOfWeek < windows[j].DayOfWeek
+ })
+ input.Windows = windows
+ return *input
+}
+
+// ToParams converts the request payload into message send schedule service params.
+func (input *MessageSendScheduleStore) ToParams(user entities.AuthContext) *services.MessageSendScheduleUpsertParams {
+ windows := make([]entities.MessageSendScheduleWindow, 0, len(input.Windows))
+ for _, item := range input.Windows {
+ windows = append(windows, entities.MessageSendScheduleWindow{DayOfWeek: item.DayOfWeek, StartMinute: item.StartMinute, EndMinute: item.EndMinute})
+ }
+ return &services.MessageSendScheduleUpsertParams{UserID: user.ID, Name: input.Name, Timezone: input.Timezone, IsActive: input.IsActive, Windows: windows}
+}
diff --git a/api/pkg/requests/send_schedule_store_request.go b/api/pkg/requests/send_schedule_store_request.go
deleted file mode 100644
index 8a6a2c3d..00000000
--- a/api/pkg/requests/send_schedule_store_request.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package requests
-
-import (
- "sort"
- "strings"
-
- "github.com/NdoleStudio/httpsms/pkg/entities"
- "github.com/NdoleStudio/httpsms/pkg/services"
-)
-
-type SendScheduleWindow struct {
- DayOfWeek int `json:"day_of_week"`
- StartMinute int `json:"start_minute"`
- EndMinute int `json:"end_minute"`
-}
-
-type SendScheduleStore struct {
- request
- Name string `json:"name"`
- Timezone string `json:"timezone"`
- IsActive bool `json:"is_active"`
- Windows []SendScheduleWindow `json:"windows"`
-}
-
-func (input *SendScheduleStore) Sanitize() SendScheduleStore {
- input.Name = strings.TrimSpace(input.Name)
- input.Timezone = strings.TrimSpace(input.Timezone)
- windows := make([]SendScheduleWindow, 0, len(input.Windows))
- for _, item := range input.Windows {
- windows = append(windows, SendScheduleWindow{DayOfWeek: item.DayOfWeek, StartMinute: item.StartMinute, EndMinute: item.EndMinute})
- }
- sort.SliceStable(windows, func(i, j int) bool {
- if windows[i].DayOfWeek == windows[j].DayOfWeek {
- return windows[i].StartMinute < windows[j].StartMinute
- }
- return windows[i].DayOfWeek < windows[j].DayOfWeek
- })
- input.Windows = windows
- return *input
-}
-
-func (input *SendScheduleStore) ToParams(user entities.AuthContext) *services.SendScheduleUpsertParams {
- windows := make([]entities.MessageSendScheduleWindow, 0, len(input.Windows))
- for _, item := range input.Windows {
- windows = append(windows, entities.MessageSendScheduleWindow{DayOfWeek: item.DayOfWeek, StartMinute: item.StartMinute, EndMinute: item.EndMinute})
- }
- return &services.SendScheduleUpsertParams{UserID: user.ID, Name: input.Name, Timezone: input.Timezone, IsActive: input.IsActive, Windows: windows}
-}
diff --git a/api/pkg/responses/message_send_schedule_responses.go b/api/pkg/responses/message_send_schedule_responses.go
new file mode 100644
index 00000000..630dba13
--- /dev/null
+++ b/api/pkg/responses/message_send_schedule_responses.go
@@ -0,0 +1,15 @@
+package responses
+
+import "github.com/NdoleStudio/httpsms/pkg/entities"
+
+// MessageSendSchedulesResponse represents a collection of message send schedules.
+type MessageSendSchedulesResponse struct {
+ response
+ Data []entities.MessageSendSchedule `json:"data"`
+}
+
+// MessageSendScheduleResponse represents a single message send schedule.
+type MessageSendScheduleResponse struct {
+ response
+ Data entities.MessageSendSchedule `json:"data"`
+}
diff --git a/api/pkg/responses/send_schedule_responses.go b/api/pkg/responses/send_schedule_responses.go
deleted file mode 100644
index 9834de86..00000000
--- a/api/pkg/responses/send_schedule_responses.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package responses
-
-import "github.com/NdoleStudio/httpsms/pkg/entities"
-
-type SendSchedulesResponse struct {
- response
- Data []entities.MessageSendSchedule `json:"data"`
-}
-
-type SendScheduleResponse struct {
- response
- Data entities.MessageSendSchedule `json:"data"`
-}
diff --git a/api/pkg/services/send_schedule_service.go b/api/pkg/services/message_send_schedule_service.go
similarity index 78%
rename from api/pkg/services/send_schedule_service.go
rename to api/pkg/services/message_send_schedule_service.go
index b984b32d..e9140b5d 100644
--- a/api/pkg/services/send_schedule_service.go
+++ b/api/pkg/services/message_send_schedule_service.go
@@ -13,29 +13,29 @@ import (
"github.com/palantir/stacktrace"
)
-// SendScheduleService manages message send schedules for a user.
-type SendScheduleService struct {
+// MessageSendScheduleService manages message send schedules for a user.
+type MessageSendScheduleService struct {
service
logger telemetry.Logger
tracer telemetry.Tracer
- repository repositories.SendScheduleRepository
+ repository repositories.MessageSendScheduleRepository
}
-// NewSendScheduleService creates a new SendScheduleService.
-func NewSendScheduleService(
+// NewMessageSendScheduleService creates a new MessageSendScheduleService.
+func NewMessageSendScheduleService(
logger telemetry.Logger,
tracer telemetry.Tracer,
- repository repositories.SendScheduleRepository,
-) *SendScheduleService {
- return &SendScheduleService{
- logger: logger.WithService(fmt.Sprintf("%T", &SendScheduleService{})),
+ repository repositories.MessageSendScheduleRepository,
+) *MessageSendScheduleService {
+ return &MessageSendScheduleService{
+ logger: logger.WithService(fmt.Sprintf("%T", &MessageSendScheduleService{})),
tracer: tracer,
repository: repository,
}
}
-// SendScheduleUpsertParams contains the fields required to create or update a message send schedule.
-type SendScheduleUpsertParams struct {
+// MessageSendScheduleUpsertParams contains the fields required to create or update a message send schedule.
+type MessageSendScheduleUpsertParams struct {
UserID entities.UserID
Name string
Timezone string
@@ -44,7 +44,7 @@ type SendScheduleUpsertParams struct {
}
// Index returns all message send schedules for a user.
-func (service *SendScheduleService) Index(
+func (service *MessageSendScheduleService) Index(
ctx context.Context,
userID entities.UserID,
) ([]entities.MessageSendSchedule, error) {
@@ -52,7 +52,7 @@ func (service *SendScheduleService) Index(
}
// CountByUser returns the number of schedules owned by a user.
-func (service *SendScheduleService) CountByUser(
+func (service *MessageSendScheduleService) CountByUser(
ctx context.Context,
userID entities.UserID,
) (int, error) {
@@ -60,7 +60,7 @@ func (service *SendScheduleService) CountByUser(
}
// Load returns a single message send schedule for a user.
-func (service *SendScheduleService) Load(
+func (service *MessageSendScheduleService) Load(
ctx context.Context,
userID entities.UserID,
scheduleID uuid.UUID,
@@ -69,9 +69,9 @@ func (service *SendScheduleService) Load(
}
// Store creates a new message send schedule.
-func (service *SendScheduleService) Store(
+func (service *MessageSendScheduleService) Store(
ctx context.Context,
- params *SendScheduleUpsertParams,
+ params *MessageSendScheduleUpsertParams,
) (*entities.MessageSendSchedule, error) {
ctx, span := service.tracer.Start(ctx)
defer span.End()
@@ -101,11 +101,11 @@ func (service *SendScheduleService) Store(
}
// Update updates an existing message send schedule.
-func (service *SendScheduleService) Update(
+func (service *MessageSendScheduleService) Update(
ctx context.Context,
userID entities.UserID,
scheduleID uuid.UUID,
- params *SendScheduleUpsertParams,
+ params *MessageSendScheduleUpsertParams,
) (*entities.MessageSendSchedule, error) {
ctx, span := service.tracer.Start(ctx)
defer span.End()
@@ -135,7 +135,7 @@ func (service *SendScheduleService) Update(
}
// Delete removes a message send schedule for a user.
-func (service *SendScheduleService) Delete(
+func (service *MessageSendScheduleService) Delete(
ctx context.Context,
userID entities.UserID,
scheduleID uuid.UUID,
@@ -168,7 +168,7 @@ func sanitizeWindows(
}
// DeleteAllForUser removes all message send schedules owned by a user.
-func (service *SendScheduleService) DeleteAllForUser(
+func (service *MessageSendScheduleService) DeleteAllForUser(
ctx context.Context,
userID entities.UserID,
) error {
diff --git a/api/pkg/services/phone_notification_service.go b/api/pkg/services/phone_notification_service.go
index 24db0de5..9e6fb296 100644
--- a/api/pkg/services/phone_notification_service.go
+++ b/api/pkg/services/phone_notification_service.go
@@ -20,13 +20,13 @@ import (
// PhoneNotificationService sends out notifications to mobile phones
type PhoneNotificationService struct {
service
- logger telemetry.Logger
- tracer telemetry.Tracer
- phoneNotificationRepository repositories.PhoneNotificationRepository
- phoneRepository repositories.PhoneRepository
- sendScheduleRepository repositories.SendScheduleRepository
- messagingClient *messaging.Client
- eventDispatcher *EventDispatcher
+ logger telemetry.Logger
+ tracer telemetry.Tracer
+ phoneNotificationRepository repositories.PhoneNotificationRepository
+ phoneRepository repositories.PhoneRepository
+ messageSendScheduleRepository repositories.MessageSendScheduleRepository
+ messagingClient *messaging.Client
+ eventDispatcher *EventDispatcher
}
// NewNotificationService creates a new PhoneNotificationService
@@ -36,17 +36,17 @@ func NewNotificationService(
messagingClient *messaging.Client,
phoneRepository repositories.PhoneRepository,
phoneNotificationRepository repositories.PhoneNotificationRepository,
- sendScheduleRepository repositories.SendScheduleRepository,
+ messageSendScheduleRepository repositories.MessageSendScheduleRepository,
dispatcher *EventDispatcher,
) (s *PhoneNotificationService) {
return &PhoneNotificationService{
- logger: logger.WithService(fmt.Sprintf("%T", &PhoneNotificationService{})),
- tracer: tracer,
- messagingClient: messagingClient,
- phoneNotificationRepository: phoneNotificationRepository,
- phoneRepository: phoneRepository,
- sendScheduleRepository: sendScheduleRepository,
- eventDispatcher: dispatcher,
+ logger: logger.WithService(fmt.Sprintf("%T", &PhoneNotificationService{})),
+ tracer: tracer,
+ messagingClient: messagingClient,
+ phoneNotificationRepository: phoneNotificationRepository,
+ phoneRepository: phoneRepository,
+ messageSendScheduleRepository: messageSendScheduleRepository,
+ eventDispatcher: dispatcher,
}
}
@@ -228,7 +228,7 @@ func (service *PhoneNotificationService) Schedule(ctx context.Context, params *P
var schedule *entities.MessageSendSchedule
if phone.ScheduleID != nil {
- schedule, err = service.sendScheduleRepository.Load(ctx, params.UserID, *phone.ScheduleID)
+ schedule, err = service.messageSendScheduleRepository.Load(ctx, params.UserID, *phone.ScheduleID)
if stacktrace.GetCode(err) == repositories.ErrCodeNotFound {
schedule = nil
err = nil
diff --git a/api/pkg/validators/send_schedule_handler_validator.go b/api/pkg/validators/message_send_schedule_handler_validator.go
similarity index 69%
rename from api/pkg/validators/send_schedule_handler_validator.go
rename to api/pkg/validators/message_send_schedule_handler_validator.go
index d402fa5c..00e405ca 100644
--- a/api/pkg/validators/send_schedule_handler_validator.go
+++ b/api/pkg/validators/message_send_schedule_handler_validator.go
@@ -14,28 +14,28 @@ import (
const maxWindowsPerDay = 6
-// SendScheduleHandlerValidator validates send schedule HTTP requests.
-type SendScheduleHandlerValidator struct {
+// MessageSendScheduleHandlerValidator validates send schedule HTTP requests.
+type MessageSendScheduleHandlerValidator struct {
validator
logger telemetry.Logger
tracer telemetry.Tracer
}
-// NewSendScheduleHandlerValidator creates a new SendScheduleHandlerValidator.
-func NewSendScheduleHandlerValidator(
+// NewMessageSendScheduleHandlerValidator creates a new MessageSendScheduleHandlerValidator.
+func NewMessageSendScheduleHandlerValidator(
logger telemetry.Logger,
tracer telemetry.Tracer,
-) *SendScheduleHandlerValidator {
- return &SendScheduleHandlerValidator{
- logger: logger.WithService(fmt.Sprintf("%T", &SendScheduleHandlerValidator{})),
+) *MessageSendScheduleHandlerValidator {
+ return &MessageSendScheduleHandlerValidator{
+ logger: logger.WithService(fmt.Sprintf("%T", &MessageSendScheduleHandlerValidator{})),
tracer: tracer,
}
}
// ValidateStore validates a send schedule create or update request.
-func (validator *SendScheduleHandlerValidator) ValidateStore(
+func (validator *MessageSendScheduleHandlerValidator) ValidateStore(
_ context.Context,
- request requests.SendScheduleStore,
+ request requests.MessageSendScheduleStore,
) url.Values {
v := govalidator.New(govalidator.Options{
Data: &request,
@@ -57,9 +57,9 @@ func (validator *SendScheduleHandlerValidator) ValidateStore(
return result
}
-func (validator *SendScheduleHandlerValidator) validateWindows(
+func (validator *MessageSendScheduleHandlerValidator) validateWindows(
result url.Values,
- windows []requests.SendScheduleWindow,
+ windows []requests.MessageSendScheduleWindow,
) {
windowsPerDay := make(map[int]int)
@@ -73,10 +73,10 @@ func (validator *SendScheduleHandlerValidator) validateWindows(
validator.validateOverlappingWindows(result, windows)
}
-func (validator *SendScheduleHandlerValidator) validateDayOfWeek(
+func (validator *MessageSendScheduleHandlerValidator) validateDayOfWeek(
result url.Values,
index int,
- item requests.SendScheduleWindow,
+ item requests.MessageSendScheduleWindow,
windowsPerDay map[int]int,
) {
if item.DayOfWeek < 0 || item.DayOfWeek > 6 {
@@ -93,41 +93,41 @@ func (validator *SendScheduleHandlerValidator) validateDayOfWeek(
}
}
-func (validator *SendScheduleHandlerValidator) validateStartMinute(
+func (validator *MessageSendScheduleHandlerValidator) validateStartMinute(
result url.Values,
index int,
- item requests.SendScheduleWindow,
+ item requests.MessageSendScheduleWindow,
) {
if item.StartMinute < 0 || item.StartMinute > 1439 {
result.Add("windows", fmt.Sprintf("windows[%d].start_minute must be between 0 and 1439", index))
}
}
-func (validator *SendScheduleHandlerValidator) validateEndMinute(
+func (validator *MessageSendScheduleHandlerValidator) validateEndMinute(
result url.Values,
index int,
- item requests.SendScheduleWindow,
+ item requests.MessageSendScheduleWindow,
) {
if item.EndMinute < 1 || item.EndMinute > 1440 {
result.Add("windows", fmt.Sprintf("windows[%d].end_minute must be between 1 and 1440", index))
}
}
-func (validator *SendScheduleHandlerValidator) validateWindowRange(
+func (validator *MessageSendScheduleHandlerValidator) validateWindowRange(
result url.Values,
index int,
- item requests.SendScheduleWindow,
+ item requests.MessageSendScheduleWindow,
) {
if item.EndMinute <= item.StartMinute {
result.Add("windows", fmt.Sprintf("windows[%d].end_minute must be greater than start_minute", index))
}
}
-func (validator *SendScheduleHandlerValidator) validateOverlappingWindows(
+func (validator *MessageSendScheduleHandlerValidator) validateOverlappingWindows(
result url.Values,
- windows []requests.SendScheduleWindow,
+ windows []requests.MessageSendScheduleWindow,
) {
- grouped := make(map[int][]requests.SendScheduleWindow)
+ grouped := make(map[int][]requests.MessageSendScheduleWindow)
for _, item := range windows {
if item.DayOfWeek < 0 || item.DayOfWeek > 6 {