Skip to content

Commit

Permalink
[docs] add export endpoint to swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Dec 31, 2024
1 parent c9f9ad0 commit d708a6d
Showing 1 changed file with 164 additions and 33 deletions.
197 changes: 164 additions & 33 deletions docs/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"paths": {
"/message": {
"/messages": {
"post": {
"tags": [
"Messages"
Expand Down Expand Up @@ -75,7 +75,7 @@
]
}
},
"/message/{id}": {
"/messages/{id}": {
"get": {
"tags": [
"Messages"
Expand Down Expand Up @@ -417,6 +417,74 @@
}
]
}
},
"/messages/inbox/export": {
"post": {
"summary": "Request inbox messages export",
"description": "Initiates process of inbox messages export via webhooks. For each message the `sms:received` webhook will be triggered. The webhooks will be triggered without specific order.",
"operationId": "post-messages-inbox-export",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"since": {
"type": "string",
"description": "The start of the time range to export.",
"format": "date-time",
"writeOnly": true
},
"until": {
"type": "string",
"description": "The end of the time range to export",
"format": "date-time",
"writeOnly": true
},
"deviceId": {
"type": "string",
"description": "The ID of the device to export messages for. Not required for Local mode."
}
},
"required": [
"since",
"until",
"deviceId"
]
}
}
}
},
"responses": {
"202": {
"description": "Accepted"
},
"400": {
"$ref": "#/components/responses/ErrorResponse"
},
"401": {
"$ref": "#/components/responses/ErrorResponse"
},
"500": {
"$ref": "#/components/responses/ErrorResponse"
}
},
"security": [
{
"BasicAuth": []
}
],
"servers": [
{
"url": "http://device-ip:8080",
"description": "Local Server"
},
{
"url": "https://api.sms-gate.app/3rdparty/v1",
"description": "Cloud Server"
}
]
}
}
},
"tags": [
Expand Down Expand Up @@ -581,9 +649,11 @@
"enum": [
"sms:received",
"sms:sent",
"system:ping"
"system:ping",
"sms:delivered",
"sms:failed"
],
"description": "The type of event being reported. For example, 'sms:received'.",
"description": "The type of event being reported",
"example": "sms:received"
},
"id": {
Expand Down Expand Up @@ -623,7 +693,9 @@
"enum": [
"sms:received",
"sms:sent",
"system:ping"
"system:ping",
"sms:delivered",
"sms:failed"
],
"description": "The type of event that triggered the webhook."
},
Expand All @@ -636,6 +708,12 @@
{
"$ref": "#/components/schemas/SmsSentPayload"
},
{
"$ref": "#/components/schemas/SmsDeliveredPayload"
},
{
"$ref": "#/components/schemas/SmsFailedPayload"
},
{
"$ref": "#/components/schemas/SystemPingPayload"
}
Expand All @@ -644,55 +722,108 @@
}
},
"SmsReceivedPayload": {
"type": "object",
"title": "SmsReceivedPayload",
"description": "Payload of `sms:received` event",
"allOf": [
{
"$ref": "#/components/schemas/SmsEventPayload"
},
{
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The content of the SMS message received."
},
"receivedAt": {
"type": "string",
"description": "The timestamp when the SMS message was received.",
"format": "date-time"
}
}
}
]
},
"SmsEventPayload": {
"type": "object",
"title": "SmsEventPayload",
"description": "Base payload of SMS-related events",
"properties": {
"message": {
"messageId": {
"type": "string",
"description": "The content of the SMS message received."
"description": "The unique identifier of the SMS message."
},
"phoneNumber": {
"type": "string",
"description": "The phone number from which the SMS message was sent."
"description": "The phone number of the sender (for incoming messages) or recipient (for outgoing messages)."
},
"simNumber": {
"type": "integer",
"nullable": true,
"description": "The SIM card number that received the SMS. May be null on some Android devices.",
"minimum": 1
},
"receivedAt": {
"type": "string",
"description": "The timestamp when the SMS message was received.",
"format": "date-time"
"description": "The SIM card number that sent the SMS. May be `null` if the SIM can't be determined or the default was used."
}
}
},
"SmsSentPayload": {
"type": "object",
"title": "SmsSentPayload",
"description": "Payload of `sms:sent` event",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier of the SMS message."
"allOf": [
{
"$ref": "#/components/schemas/SmsEventPayload"
},
"phoneNumber": {
"type": "string",
"description": "The phone number to which the SMS message was sent."
{
"type": "object",
"properties": {
"sentAt": {
"type": "string",
"description": "The timestamp when the SMS message was sent.",
"format": "date-time"
}
}
}
]
},
"SmsDeliveredPayload": {
"title": "SmsDeliveredPayload",
"description": "Payload of `sms:delivered` event",
"allOf": [
{
"$ref": "#/components/schemas/SmsEventPayload"
},
"simNumber": {
"type": "integer",
"nullable": true,
"description": "The SIM card number that sent the SMS. May be `null` if default SIM is used."
{
"type": "object",
"properties": {
"deliveredAt": {
"type": "string",
"description": "The timestamp when the SMS message was delivered.",
"format": "date-time"
}
}
}
]
},
"SmsFailedPayload": {
"title": "SmsFailedPayload",
"description": "Payload of `sms:failed` event",
"allOf": [
{
"$ref": "#/components/schemas/SmsEventPayload"
},
"sentAt": {
"type": "string",
"description": "The timestamp when the SMS message was sent.",
"format": "date-time"
{
"type": "object",
"properties": {
"failedAt": {
"type": "string",
"description": "The timestamp when the SMS message was failed.",
"format": "date-time"
},
"reason": {
"type": "string",
"description": "The reason description"
}
}
}
}
]
},
"SystemPingPayload": {
"type": "object",
Expand Down

0 comments on commit d708a6d

Please sign in to comment.