bump api version and clean up config methods

This commit is contained in:
Michael Zanetti 2017-10-29 21:48:53 +01:00
parent 072e93cbfc
commit 28b518107b
4 changed files with 24 additions and 20 deletions

View File

@ -6,7 +6,7 @@ GUH_PLUGINS_PATH=/usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/gu
# define protocol versions # define protocol versions
JSON_PROTOCOL_VERSION_MAJOR=0 JSON_PROTOCOL_VERSION_MAJOR=0
JSON_PROTOCOL_VERSION_MINOR=51 JSON_PROTOCOL_VERSION_MINOR=52
REST_API_VERSION=1 REST_API_VERSION=1
DEFINES += GUH_VERSION_STRING=\\\"$${GUH_VERSION_STRING}\\\" \ DEFINES += GUH_VERSION_STRING=\\\"$${GUH_VERSION_STRING}\\\" \

View File

@ -99,6 +99,9 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent):
QVariantList webSocketServerConfigurations; QVariantList webSocketServerConfigurations;
webSocketServerConfigurations.append(JsonTypes::serverConfigurationRef()); webSocketServerConfigurations.append(JsonTypes::serverConfigurationRef());
returns.insert("webSocketServerConfigurations", webSocketServerConfigurations); returns.insert("webSocketServerConfigurations", webSocketServerConfigurations);
QVariantMap cloudConfiguration;
cloudConfiguration.insert("enabled", JsonTypes::basicTypeToString(JsonTypes::Bool));
returns.insert("cloud", cloudConfiguration);
setReturns("GetConfigurations", returns); setReturns("GetConfigurations", returns);
params.clear(); returns.clear(); params.clear(); returns.clear();
@ -164,12 +167,6 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent):
returns.insert("configurationError", JsonTypes::configurationErrorRef()); returns.insert("configurationError", JsonTypes::configurationErrorRef());
setReturns("DeleteWebServerConfiguration", returns); setReturns("DeleteWebServerConfiguration", returns);
params.clear(); returns.clear();
setDescription("GetCloudEnabled", "Returns whether the cloud connection is enabled or disabled in the settings.");
setParams("GetCloudEnabled", params);
returns.insert("enabled", JsonTypes::basicTypeToString(QVariant::Bool));
setReturns("GetCloudEnabled", returns);
params.clear(); returns.clear(); params.clear(); returns.clear();
setDescription("SetCloudEnabled", "Sets whether the cloud connection is enabled or disabled in the settings."); setDescription("SetCloudEnabled", "Sets whether the cloud connection is enabled or disabled in the settings.");
params.insert("enabled", JsonTypes::basicTypeToString(QVariant::Bool)); params.insert("enabled", JsonTypes::basicTypeToString(QVariant::Bool));
@ -248,6 +245,10 @@ JsonReply *ConfigurationHandler::GetConfigurations(const QVariantMap &params) co
} }
returns.insert("webSocketServerConfigurations", webSocketServerConfigs); returns.insert("webSocketServerConfigurations", webSocketServerConfigs);
QVariantMap cloudConfig;
cloudConfig.insert("enabled", GuhCore::instance()->configuration()->cloudEnabled());
returns.insert("cloud", cloudConfig);
return createReply(returns); return createReply(returns);
} }
@ -402,14 +403,6 @@ JsonReply *ConfigurationHandler::DeleteWebSocketServerConfiguration(const QVaria
return createReply(statusToReply(GuhConfiguration::ConfigurationErrorNoError)); return createReply(statusToReply(GuhConfiguration::ConfigurationErrorNoError));
} }
JsonReply *ConfigurationHandler::GetCloudEnabled(const QVariantMap &params) const
{
Q_UNUSED(params)
QVariantMap ret;
ret.insert("enabled", GuhCore::instance()->configuration()->cloudEnabled());
return createReply(ret);
}
JsonReply *ConfigurationHandler::SetCloudEnabled(const QVariantMap &params) const JsonReply *ConfigurationHandler::SetCloudEnabled(const QVariantMap &params) const
{ {
bool enabled = params.value("enabled").toBool(); bool enabled = params.value("enabled").toBool();

View File

@ -47,7 +47,6 @@ public:
Q_INVOKABLE JsonReply *DeleteWebServerConfiguration(const QVariantMap &params) const; Q_INVOKABLE JsonReply *DeleteWebServerConfiguration(const QVariantMap &params) const;
Q_INVOKABLE JsonReply *SetWebSocketServerConfiguration(const QVariantMap &params) const; Q_INVOKABLE JsonReply *SetWebSocketServerConfiguration(const QVariantMap &params) const;
Q_INVOKABLE JsonReply *DeleteWebSocketServerConfiguration(const QVariantMap &params) const; Q_INVOKABLE JsonReply *DeleteWebSocketServerConfiguration(const QVariantMap &params) const;
Q_INVOKABLE JsonReply *GetCloudEnabled(const QVariantMap &params) const;
Q_INVOKABLE JsonReply *SetCloudEnabled(const QVariantMap &params) const; Q_INVOKABLE JsonReply *SetCloudEnabled(const QVariantMap &params) const;
signals: signals:

View File

@ -1,4 +1,4 @@
0.51 0.52
{ {
"methods": { "methods": {
"Actions.ExecuteAction": { "Actions.ExecuteAction": {
@ -80,6 +80,9 @@
"serverUuid": "Uuid", "serverUuid": "Uuid",
"timeZone": "String" "timeZone": "String"
}, },
"cloud": {
"enabled": "Bool"
},
"tcpServerConfigurations": [ "tcpServerConfigurations": [
"$ref:ServerConfiguration" "$ref:ServerConfiguration"
], ],
@ -101,6 +104,15 @@
] ]
} }
}, },
"Configuration.SetCloudEnabled": {
"description": "Sets whether the cloud connection is enabled or disabled in the settings.",
"params": {
"enabled": "Bool"
},
"returns": {
"configurationError": "$ref:ConfigurationError"
}
},
"Configuration.SetLanguage": { "Configuration.SetLanguage": {
"description": "Sets the server language to the given language. See also: \"GetAvailableLanguages\"", "description": "Sets the server language to the given language. See also: \"GetAvailableLanguages\"",
"params": { "params": {
@ -458,11 +470,11 @@
"JSONRPC.SetupRemoteAccess": { "JSONRPC.SetupRemoteAccess": {
"description": "Setup the remote connection by providing AWS token information", "description": "Setup the remote connection by providing AWS token information",
"params": { "params": {
"authToken": "String", "idToken": "String",
"cognitoId": "String", "userId": "String"
"idToken": "String"
}, },
"returns": { "returns": {
"message": "String",
"status": "Int" "status": "Int"
} }
}, },