Files
schedtxt_api/docs/swagger.json
T
phoenixandphoenix a51979e724 tsk-58: Update names of Contact endpoint (#67)
Closes #58

Reviewed-on: phoenix/textsender-api#67
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2026-01-07 20:24:30 +00:00

1258 lines
41 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "Core API to send text messages",
"title": "textsender-api",
"contact": {},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/api/v1",
"paths": {
"/contact": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a contact record to have a recipient to send a text to (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "Get contact",
"parameters": [
{
"type": "string",
"description": "Contact Id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "User Id",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GetContactResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.GetContactResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.GetContactResponse"
}
}
}
}
},
"/contact/new": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Add a contact record to have a recipient to send a text to (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "Add contact",
"parameters": [
{
"description": "Data to add contact",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RequestAddContact"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.AddContactResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.AddContactResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.AddContactResponse"
}
}
}
}
},
"/contact/update": {
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update the first, last, or nickname of a Contact (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "Update names of Contact",
"parameters": [
{
"description": "Data to update contact's names",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.UpdateNameRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.UpdateNameResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.UpdateNameResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.UpdateNameResponse"
}
}
}
}
},
"/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": [
{
"BearerAuth": []
}
],
"description": "Get a message record to have a recipient to send a text to (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"messages"
],
"summary": "Get message",
"parameters": [
{
"type": "string",
"description": "Message Id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "User Id",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GetMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.GetMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.GetMessageResponse"
}
}
}
}
},
"/message/new": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Add a message record to send a text to (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"messages"
],
"summary": "Add message",
"parameters": [
{
"description": "Data to add message",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RequestAddMessage"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.AddMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.AddMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.AddMessageResponse"
}
}
}
}
},
"/schedule/message": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a scheduled message (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"scheduled messages"
],
"summary": "Get scheduled message",
"parameters": [
{
"type": "string",
"description": "Contact Id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "User Id",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GetScheduledMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.GetScheduledMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.GetScheduledMessageResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Adds a scheduled message (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"scheduled messages"
],
"summary": "Add scheduled message",
"parameters": [
{
"description": "Data to add scheduled message",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RequestAddScheduledMessage"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.AddScheduledMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.AddScheduledMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.AddScheduledMessageResponse"
}
}
}
}
},
"/schedule/message/event": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Gets a scheduled message event (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"scheduled message events"
],
"summary": "Get scheduled message event",
"parameters": [
{
"type": "string",
"description": "Contact Id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Scheduled Message Id",
"name": "scheduled_message_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GetScheduledMessageEventResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.GetScheduledMessageEventResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.GetScheduledMessageEventResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Add a scheduled message event (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"scheduled message events"
],
"summary": "Add scheduled message event",
"parameters": [
{
"description": "Data to add scheduled message event",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RequestAddScheduledMessageEvent"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.AddScheduledMessageEventResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.AddScheduledMessageEventResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.AddScheduledMessageEventResponse"
}
}
}
}
},
"/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": [
{
"BearerAuth": []
}
],
"description": "Deletes a scheduled message event (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"scheduled message events"
],
"summary": "Delete scheduled message event",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "scheduled message event Id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.DeleteScheduledMessageEventResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.DeleteScheduledMessageEventResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.DeleteScheduledMessageEventResponse"
}
}
}
}
},
"/schedule/message/fetch": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetches a scheduled message that is available to be processed (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"scheduled messages"
],
"summary": "Fetch scheduled message",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.FetchNextMessageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.FetchNextMessageResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.FetchNextMessageResponse"
}
}
}
}
},
"/schedule/message/status/update": {
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update the status of a scheduled message (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"status"
],
"summary": "Update status",
"parameters": [
{
"description": "Used to update scheduled message status",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.RequestScheduledMessageStatus"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handler.ScheduledMessageStatusResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.ScheduledMessageStatusResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handler.ScheduledMessageStatusResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.ScheduledMessageStatusResponse"
}
}
}
}
}
},
"definitions": {
"contact.Contact": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"id": {
"type": "string"
},
"last_name": {
"type": "string"
},
"nickname": {
"type": "string"
},
"phone_number": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"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": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/contact.Contact"
}
},
"message": {
"type": "string"
}
}
},
"handler.AddMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message.Message"
}
},
"message": {
"type": "string"
}
}
},
"handler.AddScheduledMessageEventResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/scheduling.ScheduledMessageEvent"
}
},
"message": {
"type": "string"
}
}
},
"handler.AddScheduledMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/scheduling.ScheduledMessage"
}
},
"message": {
"type": "string"
}
}
},
"handler.DeleteScheduledMessageEventResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/scheduling.ScheduledMessageEvent"
}
},
"message": {
"type": "string"
}
}
},
"handler.FetchNextMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/scheduling.ScheduledMessage"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetContactResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/contact.Contact"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetMessageEventResponseFetchedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/event.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message.Message"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetScheduledMessageEventResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/scheduling.ScheduledMessageEvent"
}
},
"message": {
"type": "string"
}
}
},
"handler.GetScheduledMessageResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/scheduling.ScheduledMessage"
}
},
"message": {
"type": "string"
}
}
},
"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": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"nickname": {
"type": "string"
},
"phone_number": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.RequestAddMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.RequestAddScheduledMessage": {
"type": "object",
"properties": {
"scheduled": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.RequestAddScheduledMessageEvent": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"message_id": {
"type": "string"
},
"scheduled_message_id": {
"type": "string"
}
}
},
"handler.RequestScheduledMessageStatus": {
"type": "object",
"properties": {
"scheduled_message_id": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"handler.ScheduledMessageChange": {
"type": "object",
"properties": {
"old_status": {
"type": "string"
},
"scheduled_message": {
"$ref": "#/definitions/scheduling.ScheduledMessage"
}
}
},
"handler.ScheduledMessageStatusResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/handler.ScheduledMessageChange"
}
},
"message": {
"type": "string"
}
}
},
"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/event.MessageEventResponse"
}
},
"message": {
"type": "string"
}
}
},
"handler.UpdateNameRequest": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"nickname": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"handler.UpdateNameResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/contact.Contact"
}
},
"message": {
"type": "string"
}
}
},
"message.Message": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"id": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"scheduling.ScheduledMessage": {
"type": "object",
"properties": {
"created": {
"type": "string"
},
"id": {
"type": "string"
},
"scheduled": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"scheduling.ScheduledMessageEvent": {
"type": "object",
"properties": {
"contact_id": {
"type": "string"
},
"created": {
"type": "string"
},
"id": {
"type": "string"
},
"message_id": {
"type": "string"
},
"scheduled_message_id": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "JWT Bearer Token",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}