Documentation
¶
Index ¶
- func RunServer(ctx context.Context, cfg *domain.Config, router *gin.Engine)
- func SetupRouter(logger *slog.Logger, queueHandler *QueueHandler, ...) *gin.Engine
- type MessageHandler
- type QueueHandler
- func (q *QueueHandler) Cleanup(c *gin.Context)
- func (q *QueueHandler) Create(c *gin.Context)
- func (q *QueueHandler) Delete(c *gin.Context)
- func (q *QueueHandler) Get(c *gin.Context)
- func (q *QueueHandler) List(c *gin.Context)
- func (q *QueueHandler) Purge(c *gin.Context)
- func (q *QueueHandler) Stats(c *gin.Context)
- func (q *QueueHandler) Update(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupRouter ¶
func SetupRouter(logger *slog.Logger, queueHandler *QueueHandler, messageHandler *MessageHandler) *gin.Engine
Types ¶
type MessageHandler ¶
type MessageHandler struct {
// contains filtered or unexported fields
}
Message exposes a REST API for domain.MessageService.
func NewMessageHandler ¶
func NewMessageHandler(messageService domain.MessageService) *MessageHandler
NewMessageHandler returns a new MessageHandler.
func (*MessageHandler) Ack ¶
func (m *MessageHandler) Ack(c *gin.Context)
Ack a message.
@Summary Ack a message
@Tags messages
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Param message_id path string true "Message id"
@Success 204 "No Content"
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id}/messages/{message_id}/ack [put]
func (*MessageHandler) Create ¶
func (m *MessageHandler) Create(c *gin.Context)
Create a message.
@Summary Add a message
@Tags messages
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Param request body messageRequest true "Add a message"
@Success 204 "No Content"
@Failure 400 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queue/{queue_id}/messages [post]
func (*MessageHandler) List ¶
func (m *MessageHandler) List(c *gin.Context)
List messages.
@Summary List messages
@Tags messages
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Param label path string false "Filter by label"
@Param limit query int false "The limit indicates the maximum number of items to return"
@Success 200 {object} messageListResponse
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id}/messages [get]
func (*MessageHandler) Nack ¶
func (m *MessageHandler) Nack(c *gin.Context)
Nack a message.
@Summary Nack a message
@Tags messages
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Param message_id path string true "Message id"
@Param request body messageNackRequest true "Nack a message"
@Success 204 "No Content"
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id}/messages/{message_id}/nack [put]
type QueueHandler ¶
type QueueHandler struct {
// contains filtered or unexported fields
}
Queue exposes a REST API for domain.QueueService.
func NewQueueHandler ¶
func NewQueueHandler(queueService domain.QueueService) *QueueHandler
NewQueueHandler returns a new QueueHandler.
func (*QueueHandler) Cleanup ¶
func (q *QueueHandler) Cleanup(c *gin.Context)
Cleanup a queue.
@Summary Cleanup a queue removing expired and acked messages
@Tags queues
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Success 204 "No Content"
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id}/cleanup [put]
func (*QueueHandler) Create ¶
func (q *QueueHandler) Create(c *gin.Context)
Create a queue.
@Summary Add a queue
@Tags queues
@Accept json
@Produce json
@Param request body queueRequest true "Add a queue"
@Success 201 {object} queueResponse
@Failure 400 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues [post]
func (*QueueHandler) Delete ¶
func (q *QueueHandler) Delete(c *gin.Context)
Delete a queue.
@Summary Delete a queue
@Tags queues
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Success 204 "No Content"
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id} [delete]
func (*QueueHandler) Get ¶
func (q *QueueHandler) Get(c *gin.Context)
Get a queue.
@Summary Show a queue
@Tags queues
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Success 200 {object} queueResponse
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id} [get]
func (*QueueHandler) List ¶
func (q *QueueHandler) List(c *gin.Context)
List queues.
@Summary List queues
@Tags queues
@Accept json
@Produce json
@Param limit query int false "The limit indicates the maximum number of items to return"
@Param offset query int false "The offset indicates the starting position of the query in relation to the complete set of unpaginated items"
@Success 200 {object} queueListResponse
@Failure 500 {object} errorResponse
@Router /queues [get]
func (*QueueHandler) Purge ¶
func (q *QueueHandler) Purge(c *gin.Context)
Purge a queue.
@Summary Purge a queue
@Tags queues
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Success 204 "No Content"
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id}/purge [put]
func (*QueueHandler) Stats ¶
func (q *QueueHandler) Stats(c *gin.Context)
Get the queue stats.
@Summary Get the queue stats
@Tags queues
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Success 200 {object} queueStatsResponse
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id}/stats [get]
func (*QueueHandler) Update ¶
func (q *QueueHandler) Update(c *gin.Context)
Update a queue.
@Summary Update a queue
@Tags queues
@Accept json
@Produce json
@Param queue_id path string true "Queue id"
@Param request body queueUpdateRequest true "Update a queue"
@Success 200 {object} queueResponse
@Failure 400 {object} errorResponse
@Failure 404 {object} errorResponse
@Failure 500 {object} errorResponse
@Router /queues/{queue_id} [put]
Click to show internal directories.
Click to hide internal directories.