Files
schedtxt_api/docs/swagger.yaml
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

811 lines
20 KiB
YAML

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