* @brief Register all licensing commands with the registry. */
| 36 | * @brief Register all licensing commands with the registry. |
| 37 | */ |
| 38 | void API::Handlers::LicensingHandler::registerCommands() |
| 39 | { |
| 40 | auto& registry = CommandRegistry::instance(); |
| 41 | |
| 42 | { |
| 43 | QJsonObject props; |
| 44 | props[QStringLiteral("licenseKey")] = QJsonObject{ |
| 45 | { QStringLiteral("type"), QStringLiteral("string")}, |
| 46 | {QStringLiteral("description"), QStringLiteral("License key UUID")} |
| 47 | }; |
| 48 | QJsonObject schema; |
| 49 | schema[QStringLiteral("type")] = QStringLiteral("object"); |
| 50 | schema[QStringLiteral("properties")] = props; |
| 51 | schema[QStringLiteral("required")] = QJsonArray{QStringLiteral("licenseKey")}; |
| 52 | registry.registerCommand(QStringLiteral("licensing.setLicense"), |
| 53 | QStringLiteral("Set the license key (params: licenseKey)"), |
| 54 | schema, |
| 55 | &setLicense); |
| 56 | } |
| 57 | |
| 58 | { |
| 59 | QJsonObject emptySchema; |
| 60 | emptySchema.insert("type", "object"); |
| 61 | emptySchema.insert("properties", QJsonObject()); |
| 62 | registry.registerCommand(QStringLiteral("licensing.activate"), |
| 63 | QStringLiteral("Activate the stored license key against the server"), |
| 64 | emptySchema, |
| 65 | &activate); |
| 66 | } |
| 67 | |
| 68 | registerOfflineCommand(); |
| 69 | |
| 70 | { |
| 71 | QJsonObject emptySchema; |
| 72 | emptySchema.insert("type", "object"); |
| 73 | emptySchema.insert("properties", QJsonObject()); |
| 74 | registry.registerCommand( |
| 75 | QStringLiteral("licensing.deactivate"), |
| 76 | QStringLiteral("Deactivate the license on this machine, freeing a seat"), |
| 77 | emptySchema, |
| 78 | &deactivate); |
| 79 | } |
| 80 | |
| 81 | { |
| 82 | QJsonObject emptySchema; |
| 83 | emptySchema.insert("type", "object"); |
| 84 | emptySchema.insert("properties", QJsonObject()); |
| 85 | registry.registerCommand(QStringLiteral("licensing.validate"), |
| 86 | QStringLiteral("Re-validate the current license with the server"), |
| 87 | emptySchema, |
| 88 | &validate); |
| 89 | } |
| 90 | |
| 91 | { |
| 92 | QJsonObject emptySchema; |
| 93 | emptySchema.insert("type", "object"); |
| 94 | emptySchema.insert("properties", QJsonObject()); |
| 95 | registry.registerCommand(QStringLiteral("licensing.getStatus"), |
nothing calls this directly
no test coverage detected