Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing swagger docs #293

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions pkg/server/apihandlers/message_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ const DefaultMessageLimit = 100
// The function updates the message's metadata with the new metadata and saves the updated message back to the database.
// It then responds with the updated message as a JSON object.
//
// @Summary Updates the metadata of a specific message
// @Description update message metadata by session id and message id
// @Tags messages
// @Accept json
// @Produce json
// @Param sessionId path string true "Session ID"
// @Param messageId path string true "Message ID"
// @Param body body models.Message true "New Metadata"
// @Success 200 {object} Message
// @Failure 404 {object} APIError "Not Found"
// @Failure 500 {object} APIError "Internal Server Error"
// @Router /api/v1/session/{sessionId}/message/{messageId} [patch]
// @Summary Updates the metadata of a specific message
// @Description update message metadata by session id and message id
// @Tags messages
// @Accept json
// @Produce json
// @Param sessionId path string true "Session ID"
// @Param messageId path string true "Message ID"
// @Param body body models.Message true "New Metadata"
// @Success 200 {object} models.Message
// @Failure 404 {object} APIError "Not Found"
// @Failure 500 {object} APIError "Internal Server Error"
// @Router /api/v1/session/{sessionId}/message/{messageId} [patch]
func UpdateMessageMetadataHandler(appState *models.AppState) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
sessionID := chi.URLParam(r, "sessionId")
Expand Down Expand Up @@ -90,17 +90,17 @@ func UpdateMessageMetadataHandler(appState *models.AppState) http.HandlerFunc {
// If the session ID or message ID does not exist, the function responds with a 404 Not Found status code.
// If there is an error while fetching the message, the function responds with a 500 Internal Server Error status code.
//
// @Summary Retrieves a specific message
// @Description get message by session id and message id
// @Tags messages
// @Accept json
// @Produce json
// @Param sessionId path string true "Session ID"
// @Param messageId path string true "Message ID"
// @Success 200 {object} Message
// @Failure 404 {object} APIError "Not Found"
// @Failure 500 {object} APIError "Internal Server Error"
// @Router /api/v1/session/{sessionId}/message/{messageId} [get]
// @Summary Retrieves a specific message
// @Description get message by session id and message id
// @Tags messages
// @Accept json
// @Produce json
// @Param sessionId path string true "Session ID"
// @Param messageId path string true "Message ID"
// @Success 200 {object} models.Message
// @Failure 404 {object} APIError "Not Found"
// @Failure 500 {object} APIError "Internal Server Error"
// @Router /api/v1/session/{sessionId}/message/{messageId} [get]
func GetMessageHandler(appState *models.AppState) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
sessionID := chi.URLParam(r, "sessionId")
Expand Down Expand Up @@ -135,16 +135,16 @@ func GetMessageHandler(appState *models.AppState) http.HandlerFunc {
// If the session ID does not exist, the function responds with a 404 Not Found status code.
// If there is an error while fetching the messages, the function responds with a 500 Internal Server Error status code.
//
// @Summary Retrieves all messages for a specific session
// @Description get messages by session id
// @Tags messages
// @Accept json
// @Produce json
// @Param sessionId path string true "Session ID"
// @Success 200 {array} Message
// @Failure 404 {object} APIError "Not Found"
// @Failure 500 {object} APIError "Internal Server Error"
// @Router /api/v1/session/{sessionId}/messages [get]
// @Summary Retrieves all messages for a specific session
// @Description get messages by session id
// @Tags messages
// @Accept json
// @Produce json
// @Param sessionId path string true "Session ID"
// @Success 200 {array} models.Message
// @Failure 404 {object} APIError "Not Found"
// @Failure 500 {object} APIError "Internal Server Error"
// @Router /api/v1/session/{sessionId}/messages [get]
func GetMessagesForSessionHandler(appState *models.AppState) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
sessionID := chi.URLParam(r, "sessionId")
Expand Down
Loading