* @brief Post a notification at the explicitly specified level. */
| 155 | * @brief Post a notification at the explicitly specified level. |
| 156 | */ |
| 157 | API::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. |
no test coverage detected