tsk-59: Get MessageEventResponse endpoint (#61)

Closes #59

Reviewed-on: phoenix/textsender-api#61
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2026-01-01 05:28:49 +00:00
committed by phoenix
parent 6641f384ab
commit 59c9aa0ff1
10 changed files with 712 additions and 113 deletions
+200 -29
View File
@@ -490,6 +490,106 @@ const docTemplate = `{
}
}
},
"/schedule/message/event/response": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetches a MessageEventResponse given a user id (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Fetcht MessageEventResponse",
"parameters": [
{
"type": "string",
"description": "User Id",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GetMessageEventResponseFetchedResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.GetMessageEventResponseFetchedResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.GetMessageEventResponseFetchedResponse"
}
}
}
}
},
"/schedule/message/event/response/record": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Saves the result of sending a text message (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Record MessageEventResponse",
"parameters": [
{
"description": "Data to add MessageEventResponse",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RecordEventRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.RecordEventResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.RecordEventResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.RecordEventResponse"
}
}
}
}
},
"/schedule/message/event/{id}": {
"delete": {
"security": [
@@ -642,9 +742,18 @@ const docTemplate = `{
"contact.Contact": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"id": {
"type": "string"
},
"last_name": {
"type": "string"
},
"nickname": {
"type": "string"
},
"phone_number": {
"type": "string"
},
@@ -653,6 +762,36 @@ const docTemplate = `{
}
}
},
"event.MessageEventResponse": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"id": {
"type": "string"
},
"message_id": {
"type": "string"
},
"response": {
"type": "object",
"additionalProperties": {}
},
"scheduled_message_event_id": {
"type": "string"
},
"sent": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.AddContactResponse": {
"type": "object",
"properties": {
@@ -751,6 +890,20 @@ const docTemplate = `{
}
}
},
"handler.GetMessageEventResponseFetchedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetMessageResponse": {
"type": "object",
"properties": {
@@ -793,6 +946,47 @@ const docTemplate = `{
}
}
},
"handler.RecordEventRequest": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"message_id": {
"type": "string"
},
"response": {
"type": "object",
"additionalProperties": {}
},
"scheduled_message_event_id": {
"type": "string"
},
"sent": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.RecordEventResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"handler.RequestAddContact": {
"type": "object",
"properties": {
@@ -832,10 +1026,10 @@ const docTemplate = `{
"handler.RequestAddScheduledMessageEvent": {
"type": "object",
"properties": {
"message_id": {
"contact_id": {
"type": "string"
},
"recipient_id": {
"message_id": {
"type": "string"
},
"scheduled_message_id": {
@@ -902,7 +1096,7 @@ const docTemplate = `{
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message.MessageEventResponse"
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
@@ -924,29 +1118,6 @@ 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": {
@@ -970,6 +1141,9 @@ const docTemplate = `{
"scheduling.ScheduledMessageEvent": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"created": {
"type": "string"
},
@@ -979,9 +1153,6 @@ const docTemplate = `{
"message_id": {
"type": "string"
},
"recipient_id": {
"type": "string"
},
"scheduled_message_id": {
"type": "string"
}
+200 -29
View File
@@ -484,6 +484,106 @@
}
}
},
"/schedule/message/event/response": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetches a MessageEventResponse given a user id (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Fetcht MessageEventResponse",
"parameters": [
{
"type": "string",
"description": "User Id",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GetMessageEventResponseFetchedResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.GetMessageEventResponseFetchedResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.GetMessageEventResponseFetchedResponse"
}
}
}
}
},
"/schedule/message/event/response/record": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Saves the result of sending a text message (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"message"
],
"summary": "Record MessageEventResponse",
"parameters": [
{
"description": "Data to add MessageEventResponse",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RecordEventRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.RecordEventResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.RecordEventResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.RecordEventResponse"
}
}
}
}
},
"/schedule/message/event/{id}": {
"delete": {
"security": [
@@ -636,9 +736,18 @@
"contact.Contact": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"id": {
"type": "string"
},
"last_name": {
"type": "string"
},
"nickname": {
"type": "string"
},
"phone_number": {
"type": "string"
},
@@ -647,6 +756,36 @@
}
}
},
"event.MessageEventResponse": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"id": {
"type": "string"
},
"message_id": {
"type": "string"
},
"response": {
"type": "object",
"additionalProperties": {}
},
"scheduled_message_event_id": {
"type": "string"
},
"sent": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.AddContactResponse": {
"type": "object",
"properties": {
@@ -745,6 +884,20 @@
}
}
},
"handler.GetMessageEventResponseFetchedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetMessageResponse": {
"type": "object",
"properties": {
@@ -787,6 +940,47 @@
}
}
},
"handler.RecordEventRequest": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"message_id": {
"type": "string"
},
"response": {
"type": "object",
"additionalProperties": {}
},
"scheduled_message_event_id": {
"type": "string"
},
"sent": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.RecordEventResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"handler.RequestAddContact": {
"type": "object",
"properties": {
@@ -826,10 +1020,10 @@
"handler.RequestAddScheduledMessageEvent": {
"type": "object",
"properties": {
"message_id": {
"contact_id": {
"type": "string"
},
"recipient_id": {
"message_id": {
"type": "string"
},
"scheduled_message_id": {
@@ -896,7 +1090,7 @@
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message.MessageEventResponse"
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
@@ -918,29 +1112,6 @@
}
}
},
"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": {
@@ -964,6 +1135,9 @@
"scheduling.ScheduledMessageEvent": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"created": {
"type": "string"
},
@@ -973,9 +1147,6 @@
"message_id": {
"type": "string"
},
"recipient_id": {
"type": "string"
},
"scheduled_message_id": {
"type": "string"
}
+130 -20
View File
@@ -2,13 +2,39 @@ basePath: /api/v1
definitions:
contact.Contact:
properties:
first_name:
type: string
id:
type: string
last_name:
type: string
nickname:
type: string
phone_number:
type: string
user_id:
type: string
type: object
event.MessageEventResponse:
properties:
contact_id:
type: string
id:
type: string
message_id:
type: string
response:
additionalProperties: {}
type: object
scheduled_message_event_id:
type: string
sent:
type: string
status:
type: string
user_id:
type: string
type: object
handler.AddContactResponse:
properties:
data:
@@ -72,6 +98,15 @@ definitions:
message:
type: string
type: object
handler.GetMessageEventResponseFetchedResponse:
properties:
data:
items:
$ref: '#/definitions/event.MessageEventResponse'
type: array
message:
type: string
type: object
handler.GetMessageResponse:
properties:
data:
@@ -99,6 +134,33 @@ definitions:
message:
type: string
type: object
handler.RecordEventRequest:
properties:
contact_id:
type: string
message_id:
type: string
response:
additionalProperties: {}
type: object
scheduled_message_event_id:
type: string
sent:
type: string
status:
type: string
user_id:
type: string
type: object
handler.RecordEventResponse:
properties:
data:
items:
$ref: '#/definitions/event.MessageEventResponse'
type: array
message:
type: string
type: object
handler.RequestAddContact:
properties:
phone_number:
@@ -124,9 +186,9 @@ definitions:
type: object
handler.RequestAddScheduledMessageEvent:
properties:
message_id:
contact_id:
type: string
recipient_id:
message_id:
type: string
scheduled_message_id:
type: string
@@ -169,7 +231,7 @@ definitions:
properties:
data:
items:
$ref: '#/definitions/message.MessageEventResponse'
$ref: '#/definitions/event.MessageEventResponse'
type: array
message:
type: string
@@ -183,21 +245,6 @@ 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:
@@ -213,14 +260,14 @@ definitions:
type: object
scheduling.ScheduledMessageEvent:
properties:
contact_id:
type: string
created:
type: string
id:
type: string
message_id:
type: string
recipient_id:
type: string
scheduled_message_id:
type: string
type: object
@@ -569,6 +616,69 @@ paths:
summary: Delete scheduled message event
tags:
- scheduled message events
/schedule/message/event/response:
get:
consumes:
- application/json
description: Fetches a MessageEventResponse given a user id (requires JWT)
parameters:
- description: User Id
in: path
name: user_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.GetMessageEventResponseFetchedResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handler.GetMessageEventResponseFetchedResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handler.GetMessageEventResponseFetchedResponse'
security:
- BearerAuth: []
summary: Fetcht MessageEventResponse
tags:
- message
/schedule/message/event/response/record:
post:
consumes:
- application/json
description: Saves the result of sending a text message (requires JWT)
parameters:
- description: Data to add MessageEventResponse
in: body
name: request
required: true
schema:
$ref: '#/definitions/handler.RecordEventRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/handler.RecordEventResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handler.RecordEventResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handler.RecordEventResponse'
security:
- BearerAuth: []
summary: Record MessageEventResponse
tags:
- message
/schedule/message/fetch:
get:
consumes: