1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Web API: renamed /sdrangel/preset GET to /sdrangel/presets GET as this returns the list of presets

This commit is contained in:
f4exb 2017-12-21 00:50:58 +01:00
parent 322ff52723
commit 88e56d1a37
12 changed files with 31 additions and 17 deletions

View File

@ -13052,7 +13052,7 @@ $(document).ready(function() {
<p class="marked">List all presets in the instance</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/preset</span></code></pre>
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/presets</span></code></pre>
<p>
<h3>Usage and SDK Samples</h3>
</p>
@ -13072,7 +13072,7 @@ $(document).ready(function() {
<div class="tab-content">
<div class="tab-pane active" id="examples-Instance-instancePresetGet-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/preset"</code></pre>
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/presets"</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instancePresetGet-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
@ -15011,7 +15011,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2017-12-20T14:24:11.587+01:00
Generated 2017-12-21T00:41:40.926+01:00
</div>
</div>
</div>

View File

@ -25,6 +25,7 @@ QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging";
QString WebAPIAdapterInterface::instanceAudioURL = "/sdrangel/audio";
QString WebAPIAdapterInterface::instanceLocationURL = "/sdrangel/location";
QString WebAPIAdapterInterface::instanceDVSerialURL = "/sdrangel/dvserial";
QString WebAPIAdapterInterface::instancePresetsURL = "/sdrangel/presets";
QString WebAPIAdapterInterface::instancePresetURL = "/sdrangel/preset";
QString WebAPIAdapterInterface::instancePresetFileURL = "/sdrangel/preset/file";
QString WebAPIAdapterInterface::instanceDeviceSetsURL = "/sdrangel/devicesets";

View File

@ -200,10 +200,10 @@ public:
}
/**
* Handler of /sdrangel/preset (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* Handler of /sdrangel/presets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
*/
virtual int instancePresetGet(
virtual int instancePresetsGet(
SWGSDRangel::SWGPresets& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error)
{
@ -502,6 +502,7 @@ public:
static QString instanceAudioURL;
static QString instanceLocationURL;
static QString instanceDVSerialURL;
static QString instancePresetsURL;
static QString instancePresetURL;
static QString instancePresetFileURL;
static QString instanceDeviceSetsURL;

View File

@ -82,6 +82,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
instanceLocationService(request, response);
} else if (path == WebAPIAdapterInterface::instanceDVSerialURL) {
instanceDVSerialService(request, response);
} else if (path == WebAPIAdapterInterface::instancePresetsURL) {
instancePresetsService(request, response);
} else if (path == WebAPIAdapterInterface::instancePresetURL) {
instancePresetService(request, response);
} else if (path == WebAPIAdapterInterface::instancePresetFileURL) {
@ -422,7 +424,7 @@ void WebAPIRequestMapper::instanceDVSerialService(qtwebapp::HttpRequest& request
}
}
void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
void WebAPIRequestMapper::instancePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
@ -430,7 +432,7 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request,
if (request.getMethod() == "GET")
{
SWGSDRangel::SWGPresets normalResponse;
int status = m_adapter->instancePresetGet(normalResponse, errorResponse);
int status = m_adapter->instancePresetsGet(normalResponse, errorResponse);
response.setStatus(status);
if (status == 200) {
@ -439,7 +441,14 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request,
response.write(errorResponse.asJson().toUtf8());
}
}
else if (request.getMethod() == "PATCH")
}
void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json");
if (request.getMethod() == "PATCH")
{
SWGSDRangel::SWGPresetTransfer query;
SWGSDRangel::SWGPresetIdentifier normalResponse;

View File

@ -52,6 +52,7 @@ private:
void instanceAudioService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceLocationService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceDVSerialService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instancePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instancePresetFileService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
void instanceDeviceSetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);

View File

@ -326,7 +326,7 @@ int WebAPIAdapterGUI::instanceDVSerialPatch(
return 200;
}
int WebAPIAdapterGUI::instancePresetGet(
int WebAPIAdapterGUI::instancePresetsGet(
SWGSDRangel::SWGPresets& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{

View File

@ -74,7 +74,7 @@ public:
SWGSDRangel::SWGDVSeralDevices& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int instancePresetGet(
virtual int instancePresetsGet(
SWGSDRangel::SWGPresets& response,
SWGSDRangel::SWGErrorResponse& error);

View File

@ -441,7 +441,7 @@ int WebAPIAdapterSrv::instancePresetFilePost(
}
}
int WebAPIAdapterSrv::instancePresetGet(
int WebAPIAdapterSrv::instancePresetsGet(
SWGSDRangel::SWGPresets& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{

View File

@ -89,7 +89,7 @@ public:
SWGSDRangel::SWGPresetIdentifier& response,
SWGSDRangel::SWGErrorResponse& error);
virtual int instancePresetGet(
virtual int instancePresetsGet(
SWGSDRangel::SWGPresets& response,
SWGSDRangel::SWGErrorResponse& error);

View File

@ -285,7 +285,7 @@ paths:
$ref: "#/definitions/ErrorResponse"
"501":
description: Function not implemented
/sdrangel/preset:
/sdrangel/presets:
x-swagger-router-controller: instance
get:
description: List all presets in the instance
@ -303,6 +303,8 @@ paths:
$ref: "#/definitions/ErrorResponse"
"501":
description: Function not implemented
/sdrangel/preset:
x-swagger-router-controller: instance
patch:
description: Load a preset in a device set
operationId: instancePresetPatch

View File

@ -13052,7 +13052,7 @@ $(document).ready(function() {
<p class="marked">List all presets in the instance</p>
<p></p>
<br />
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/preset</span></code></pre>
<pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/sdrangel/presets</span></code></pre>
<p>
<h3>Usage and SDK Samples</h3>
</p>
@ -13072,7 +13072,7 @@ $(document).ready(function() {
<div class="tab-content">
<div class="tab-pane active" id="examples-Instance-instancePresetGet-0-curl">
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/preset"</code></pre>
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/presets"</code></pre>
</div>
<div class="tab-pane" id="examples-Instance-instancePresetGet-0-java">
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
@ -15011,7 +15011,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2017-12-20T14:24:11.587+01:00
Generated 2017-12-21T00:41:40.926+01:00
</div>
</div>
</div>

View File

@ -843,7 +843,7 @@ SWGInstanceApi::instancePresetFilePutCallback(HttpRequestWorker * worker) {
void
SWGInstanceApi::instancePresetGet() {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
fullPath.append(this->host).append(this->basePath).append("/sdrangel/presets");