tsk-51: Send message endpoint (#52)

Closes #51

Reviewed-on: phoenix/textsender-api#52
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-12-10 21:35:02 +00:00
committed by phoenix
parent 20ffc45f89
commit 0d252bc261
32 changed files with 753 additions and 96 deletions
+105
View File
@@ -122,6 +122,57 @@ const docTemplate = `{
}
}
},
"/instant/message": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Send a message without the constraints of scheduled messages (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"messages"
],
"summary": "Send instant message",
"parameters": [
{
"description": "Send an instnt message",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageResponse"
}
}
}
}
},
"/message": {
"get": {
"security": [
@@ -828,6 +879,37 @@ const docTemplate = `{
}
}
},
"handler.SendInstantMessageRequest": {
"type": "object",
"properties": {
"contact_ids": {
"type": "array",
"items": {
"type": "string"
}
},
"message_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.SendInstantMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"message.Message": {
"type": "object",
"properties": {
@@ -842,6 +924,29 @@ const docTemplate = `{
}
}
},
"message.MessageEventResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"response": {
"type": "array",
"items": {
"type": "integer"
}
},
"scheduled_message_event_id": {
"type": "string"
},
"sent": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"scheduling.ScheduledMessage": {
"type": "object",
"properties": {
+105
View File
@@ -116,6 +116,57 @@
}
}
},
"/instant/message": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Send a message without the constraints of scheduled messages (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"messages"
],
"summary": "Send instant message",
"parameters": [
{
"description": "Send an instnt message",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.SendInstantMessageResponse"
}
}
}
}
},
"/message": {
"get": {
"security": [
@@ -822,6 +873,37 @@
}
}
},
"handler.SendInstantMessageRequest": {
"type": "object",
"properties": {
"contact_ids": {
"type": "array",
"items": {
"type": "string"
}
},
"message_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.SendInstantMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"message.Message": {
"type": "object",
"properties": {
@@ -836,6 +918,29 @@
}
}
},
"message.MessageEventResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"response": {
"type": "array",
"items": {
"type": "integer"
}
},
"scheduled_message_event_id": {
"type": "string"
},
"sent": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"scheduling.ScheduledMessage": {
"type": "object",
"properties": {
+68
View File
@@ -154,6 +154,26 @@ definitions:
message:
type: string
type: object
handler.SendInstantMessageRequest:
properties:
contact_ids:
items:
type: string
type: array
message_id:
type: string
user_id:
type: string
type: object
handler.SendInstantMessageResponse:
properties:
data:
items:
$ref: '#/definitions/message.MessageEventResponse'
type: array
message:
type: string
type: object
message.Message:
properties:
content:
@@ -163,6 +183,21 @@ definitions:
user_id:
type: string
type: object
message.MessageEventResponse:
properties:
id:
type: string
response:
items:
type: integer
type: array
scheduled_message_event_id:
type: string
sent:
type: string
user_id:
type: string
type: object
scheduling.ScheduledMessage:
properties:
created:
@@ -266,6 +301,39 @@ paths:
summary: Add contact
tags:
- contacts
/instant/message:
post:
consumes:
- application/json
description: Send a message without the constraints of scheduled messages (requires
JWT)
parameters:
- description: Send an instnt message
in: body
name: request
required: true
schema:
$ref: '#/definitions/handler.SendInstantMessageRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/handler.SendInstantMessageResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handler.SendInstantMessageResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handler.SendInstantMessageResponse'
security:
- BearerAuth: []
summary: Send instant message
tags:
- messages
/message:
get:
consumes: