ChatTest sends a test message through the pipe to verify the full pipeline. @Title ChatTest @Tag Pipe API @Description send a test chat message through a pipe @Param id query string true "The id of the pipe (owner/name)" @Param chatId query string true "The chat/channel ID to send the message to" @P
()
| 207 | // @Success 200 {object} controllers.Response The Response object |
| 208 | // @router /api/chat-test [post] |
| 209 | func (c *ApiController) ChatTest() { |
| 210 | id := c.Input().Get("id") |
| 211 | chatId := c.Input().Get("chatId") |
| 212 | message := c.Input().Get("message") |
| 213 | |
| 214 | pipe, err := object.GetPipe(id) |
| 215 | if err != nil { |
| 216 | c.ResponseError(err.Error()) |
| 217 | return |
| 218 | } |
| 219 | if pipe == nil { |
| 220 | c.ResponseError("pipe not found") |
| 221 | return |
| 222 | } |
| 223 | |
| 224 | pipeObj, err := pipe.GetProvider(c.GetAcceptLanguage()) |
| 225 | if err != nil { |
| 226 | c.ResponseError(err.Error()) |
| 227 | return |
| 228 | } |
| 229 | |
| 230 | if err = pipeObj.SendMessage(chatId, message); err != nil { |
| 231 | c.ResponseError(err.Error()) |
| 232 | return |
| 233 | } |
| 234 | |
| 235 | c.ResponseOk("message sent") |
| 236 | } |
nothing calls this directly
no test coverage detected