| 268 | } |
| 269 | |
| 270 | ChannelLinter::ChannelCommand::ChannelCommand(json const& commandDefinition) : m_ArgumentsForm(commandDefinition.at("arguments")) |
| 271 | { |
| 272 | if (!commandDefinition.contains("id")) |
| 273 | throw std::invalid_argument{ "Command definition must contain 'id' property. Invalid command:\n" + commandDefinition.dump(4) }; |
| 274 | m_Id = commandDefinition["id"].get<uint16_t>(); |
| 275 | if (!commandDefinition.contains("name")) |
| 276 | throw std::invalid_argument{ "Command definition id = " + std::to_string(m_Id) + " must contain 'name' property" }; |
| 277 | m_Name = commandDefinition["name"].get<std::string>(); |
| 278 | } |
| 279 | } |