MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / post

Method post

app/src/API/Handlers/NotificationsHandler.cpp:157–174  ·  view source on GitHub ↗

* @brief Post a notification at the explicitly specified level. */

Source from the content-addressed store, hash-verified

155 * @brief Post a notification at the explicitly specified level.
156 */
157API::CommandResponse API::Handlers::NotificationsHandler::post(const QString& id,
158 const QJsonObject& params)
159{
160 if (!params.contains(QStringLiteral("level")))
161 return CommandResponse::makeError(
162 id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: level"));
163
164 const int level = params.value(QStringLiteral("level")).toInt(0);
165 QString channel, title, subtitle;
166 readEventStrings(params, channel, title, subtitle);
167
168 DataModel::NotificationCenter::instance().post(level, channel, title, subtitle);
169
170 return CommandResponse::makeSuccess(id,
171 QJsonObject{
172 {QStringLiteral("posted"), true}
173 });
174}
175
176/**
177 * @brief Emit a companion Info-level event marking the issue as resolved.

Callers 3

AnthropicReplyMethod · 0.45
GeminiReplyMethod · 0.45
issueRequestMethod · 0.45

Calls 3

readEventStringsFunction · 0.85
containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected