feat: complete cmpp platform phases 0-5
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://cmpp-platform.local/schemas/gateway-queue-messages.schema.json",
|
||||
"title": "CMPP Gateway Queue Messages",
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/SubmitCommand" },
|
||||
{ "$ref": "#/$defs/SubmitResult" },
|
||||
{ "$ref": "#/$defs/ReceiptEvent" },
|
||||
{ "$ref": "#/$defs/UplinkEvent" }
|
||||
],
|
||||
"$defs": {
|
||||
"Envelope": {
|
||||
"type": "object",
|
||||
"required": ["schemaVersion", "messageType", "traceId", "messageId", "channelId", "createdAt"],
|
||||
"properties": {
|
||||
"schemaVersion": { "const": "v1" },
|
||||
"messageType": {
|
||||
"enum": ["SubmitCommand", "SubmitResult", "ReceiptEvent", "UplinkEvent"]
|
||||
},
|
||||
"traceId": { "type": "string", "minLength": 8 },
|
||||
"messageId": { "type": "string", "minLength": 8 },
|
||||
"channelId": { "type": "string", "minLength": 1 },
|
||||
"createdAt": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
},
|
||||
"SubmitCommand": {
|
||||
"allOf": [
|
||||
{ "$ref": "#/$defs/Envelope" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"messageType",
|
||||
"tenantId",
|
||||
"applicationId",
|
||||
"submitId",
|
||||
"phoneNumber",
|
||||
"content",
|
||||
"signature",
|
||||
"templateId",
|
||||
"billingUnits",
|
||||
"route",
|
||||
"cmpp",
|
||||
"retry"
|
||||
],
|
||||
"properties": {
|
||||
"messageType": { "const": "SubmitCommand" },
|
||||
"tenantId": { "type": "string", "minLength": 1 },
|
||||
"applicationId": { "type": "string", "minLength": 1 },
|
||||
"taskId": { "type": "string" },
|
||||
"submitId": { "type": "string", "minLength": 1 },
|
||||
"phoneNumber": { "type": "string", "pattern": "^1[3-9][0-9]{9}$" },
|
||||
"content": { "type": "string", "minLength": 1 },
|
||||
"signature": { "type": "string", "minLength": 1 },
|
||||
"templateId": { "type": "string", "minLength": 1 },
|
||||
"billingUnits": { "type": "integer", "minimum": 1 },
|
||||
"route": {
|
||||
"type": "object",
|
||||
"required": ["channelCode", "cmppAccountCode", "priority"],
|
||||
"properties": {
|
||||
"channelCode": { "type": "string", "minLength": 1 },
|
||||
"cmppAccountCode": { "type": "string", "minLength": 1 },
|
||||
"priority": { "type": "integer", "minimum": 0 },
|
||||
"rateLimitPerSecond": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
},
|
||||
"cmpp": {
|
||||
"type": "object",
|
||||
"required": ["serviceId", "srcId", "registeredDelivery", "msgFmt"],
|
||||
"properties": {
|
||||
"serviceId": { "type": "string", "minLength": 1 },
|
||||
"srcId": { "type": "string", "minLength": 1 },
|
||||
"registeredDelivery": { "type": "integer", "enum": [0, 1] },
|
||||
"msgFmt": { "type": "integer", "enum": [8, 15] },
|
||||
"feeUserType": { "type": "integer", "minimum": 0 },
|
||||
"feeCode": { "type": "string" },
|
||||
"feeType": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"retry": {
|
||||
"type": "object",
|
||||
"required": ["attempt", "maxAttempts"],
|
||||
"properties": {
|
||||
"attempt": { "type": "integer", "minimum": 0 },
|
||||
"maxAttempts": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"SubmitResult": {
|
||||
"allOf": [
|
||||
{ "$ref": "#/$defs/Envelope" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["messageType", "sequenceId", "gatewayMessageId", "submitStatus", "submittedAt"],
|
||||
"properties": {
|
||||
"messageType": { "const": "SubmitResult" },
|
||||
"sequenceId": { "type": "integer", "minimum": 0 },
|
||||
"gatewayMessageId": { "type": "string", "minLength": 1 },
|
||||
"submitStatus": { "enum": ["accepted", "rejected", "timeout"] },
|
||||
"errorCode": { "type": "string" },
|
||||
"errorMessage": { "type": "string" },
|
||||
"submittedAt": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ReceiptEvent": {
|
||||
"allOf": [
|
||||
{ "$ref": "#/$defs/Envelope" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["messageType", "sequenceId", "gatewayMessageId", "receiptStatus", "rawStatus", "deliveredAt"],
|
||||
"properties": {
|
||||
"messageType": { "const": "ReceiptEvent" },
|
||||
"sequenceId": { "type": "integer", "minimum": 0 },
|
||||
"gatewayMessageId": { "type": "string", "minLength": 1 },
|
||||
"receiptStatus": { "enum": ["delivered", "undelivered", "unknown"] },
|
||||
"rawStatus": { "type": "string", "minLength": 1 },
|
||||
"errorCode": { "type": "string" },
|
||||
"deliveredAt": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"UplinkEvent": {
|
||||
"allOf": [
|
||||
{ "$ref": "#/$defs/Envelope" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["messageType", "sequenceId", "phoneNumber", "destId", "content", "receivedAt"],
|
||||
"properties": {
|
||||
"messageType": { "const": "UplinkEvent" },
|
||||
"sequenceId": { "type": "integer", "minimum": 0 },
|
||||
"phoneNumber": { "type": "string", "pattern": "^1[3-9][0-9]{9}$" },
|
||||
"destId": { "type": "string", "minLength": 1 },
|
||||
"content": { "type": "string", "minLength": 1 },
|
||||
"receivedAt": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user