diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index db36abac3..cb240e552 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -12522,6 +12522,12 @@ margin-bottom: 20px;
  • featuresetGet
  • +
  • + instanceFeatureSetDelete +
  • +
  • + instanceFeatureSetPost +
  • instanceAMBEDevicesDelete @@ -32547,6 +32553,719 @@ except ApiException as e:
    +
    +
    +
    +

    instanceFeatureSetDelete

    +

    +
    +
    +
    +

    +

    Remove last feature set. The GUI version does not remove the first feature set.

    +

    +
    +
    /sdrangel/featureset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X DELETE "http://localhost/sdrangel/featureset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetDelete();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetDelete();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance instanceFeatureSetDeleteWithCompletionHandler: 
    +              ^(SuccessResponse output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.instanceFeatureSetDelete(callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class instanceFeatureSetDeleteExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +
    +            try
    +            {
    +                SuccessResponse result = apiInstance.instanceFeatureSetDelete();
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.instanceFeatureSetDelete: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +
    +try {
    +    $result = $api_instance->instanceFeatureSetDelete();
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->instanceFeatureSetDelete: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +
    +eval { 
    +    my $result = $api_instance->instanceFeatureSetDelete();
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->instanceFeatureSetDelete: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.FeatureSetApi()
    +
    +try: 
    +    api_response = api_instance.instance_feature_set_delete()
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->instanceFeatureSetDelete: %s\n" % e)
    +
    +
    + +

    Parameters

    + + + + + + +

    Responses

    +

    Status: 202 - Message to remove last feature set was sent successfully

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - No more feature sets to be deleted

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +

    instanceFeatureSetPost

    +

    +
    +
    +
    +

    +

    Add (append) a new feature set

    +

    +
    +
    /sdrangel/featureset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost/sdrangel/featureset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetPost();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetPost();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance instanceFeatureSetPostWithCompletionHandler: 
    +              ^(SuccessResponse output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.instanceFeatureSetPost(callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class instanceFeatureSetPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +
    +            try
    +            {
    +                SuccessResponse result = apiInstance.instanceFeatureSetPost();
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.instanceFeatureSetPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +
    +try {
    +    $result = $api_instance->instanceFeatureSetPost();
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->instanceFeatureSetPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +
    +eval { 
    +    my $result = $api_instance->instanceFeatureSetPost();
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->instanceFeatureSetPost: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.FeatureSetApi()
    +
    +try: 
    +    api_response = api_instance.instance_feature_set_post()
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->instanceFeatureSetPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + + + + + + +

    Responses

    +

    Status: 202 - Message to add a new feature set was sent successfully

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    +

    Instance

    @@ -47005,7 +47724,7 @@ except ApiException as e:
    - Generated 2021-07-12T19:39:02.669+02:00 + Generated 2021-08-21T12:00:48.492+02:00
    diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index a7c33c47e..cd6abe0fe 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1873,6 +1873,41 @@ paths: "501": $ref: "#/responses/Response_501" + /sdrangel/featureset: + x-swagger-router-controller: instance + post: + description: Add (append) a new feature set + operationId: instanceFeatureSetPost + tags: + - FeatureSet + responses: + "202": + description: Message to add a new feature set was sent successfully + schema: + $ref: "#/definitions/SuccessResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + delete: + description: Remove last feature set. The GUI version does not remove the first feature set. + operationId: instanceFeatureSetDelete + tags: + - FeatureSet + responses: + "202": + description: Message to remove last feature set was sent successfully + schema: + $ref: "#/definitions/SuccessResponse" + "404": + description: "No more feature sets to be deleted" + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + /sdrangel/featureset/{featureSetIndex}: x-swagger-router-controller: featureset get: diff --git a/sdrbase/webapi/webapiadapter.cpp b/sdrbase/webapi/webapiadapter.cpp index 7d3311511..25bda5cbc 100644 --- a/sdrbase/webapi/webapiadapter.cpp +++ b/sdrbase/webapi/webapiadapter.cpp @@ -1427,6 +1427,28 @@ int WebAPIAdapter::instanceDeviceSetDelete( } } +int WebAPIAdapter::instanceFeatureSetPost( + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error) +{ + (void) response; + error.init(); + *error.getMessage() = "Not implemented"; + + return 501; +} + +int WebAPIAdapter::instanceFeatureSetDelete( + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error) +{ + (void) response; + error.init(); + *error.getMessage() = "Not implemented"; + + return 501; +} + int WebAPIAdapter::devicesetGet( int deviceSetIndex, SWGSDRangel::SWGDeviceSet& response, diff --git a/sdrbase/webapi/webapiadapter.h b/sdrbase/webapi/webapiadapter.h index 1e545fb45..71654c3a6 100644 --- a/sdrbase/webapi/webapiadapter.h +++ b/sdrbase/webapi/webapiadapter.h @@ -208,6 +208,14 @@ public: SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error); + virtual int instanceFeatureSetPost( + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error); + + virtual int instanceFeatureSetDelete( + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error); + virtual int devicesetGet( int deviceSetIndex, SWGSDRangel::SWGDeviceSet& response, diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index 67a71bf8c..3730b0604 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -41,6 +41,8 @@ QString WebAPIAdapterInterface::instancePresetURL = "/sdrangel/preset"; QString WebAPIAdapterInterface::instancePresetFileURL = "/sdrangel/preset/file"; QString WebAPIAdapterInterface::instanceDeviceSetsURL = "/sdrangel/devicesets"; QString WebAPIAdapterInterface::instanceDeviceSetURL = "/sdrangel/deviceset"; +QString WebAPIAdapterInterface::instanceFeatureSetsURL = "/sdrangel/featuresets"; +QString WebAPIAdapterInterface::instanceFeatureSetURL = "/sdrangel/featureset"; std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$"); std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0-9]{1,2})/focus$"); diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index 41628e875..8bbea9a03 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -678,6 +678,48 @@ public: return 501; } + /** + * Handler of /sdrangel/featurets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int instanceFeatureSetsGet( + SWGSDRangel::SWGFeatureSetList& response, + SWGSDRangel::SWGErrorResponse& error) + { + (void) response; + error.init(); + *error.getMessage() = QString("Function not implemented"); + return 501; + } + + /** + * Handler of /sdrangel/featureset (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int instanceFeatureSetPost( + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error) + { + (void) response; + error.init(); + *error.getMessage() = QString("Function not implemented"); + return 501; + } + + /** + * Handler of /sdrangel/deviceset (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int instanceFeatureSetDelete( + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error) + { + (void) response; + error.init(); + *error.getMessage() = QString("Function not implemented"); + return 501; + } + /** * Handler of /sdrangel/deviceset/{devicesetIndex} (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels * returns the Http status code (default 501: not implemented) @@ -1333,6 +1375,8 @@ public: static QString instancePresetFileURL; static QString instanceDeviceSetsURL; static QString instanceDeviceSetURL; + static QString instanceFeatureSetsURL; + static QString instanceFeatureSetURL; static std::regex devicesetURLRe; static std::regex devicesetFocusURLRe; static std::regex devicesetSpectrumSettingsURLRe; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index abc72b147..f7c50fe72 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -151,6 +151,10 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http instanceDeviceSetsService(request, response); } else if (path == WebAPIAdapterInterface::instanceDeviceSetURL) { instanceDeviceSetService(request, response); + } else if (path == WebAPIAdapterInterface::instanceFeatureSetsURL) { + instanceFeatureSetsService(request, response); + } else if (path == WebAPIAdapterInterface::instanceFeatureSetURL) { + instanceFeatureSetService(request, response); } else { @@ -1360,6 +1364,33 @@ void WebAPIRequestMapper::instanceDeviceSetsService(qtwebapp::HttpRequest& reque } } +void WebAPIRequestMapper::instanceFeatureSetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) +{ + SWGSDRangel::SWGErrorResponse errorResponse; + response.setHeader("Content-Type", "application/json"); + response.setHeader("Access-Control-Allow-Origin", "*"); + + if (request.getMethod() == "GET") + { + SWGSDRangel::SWGFeatureSetList normalResponse; + int status = m_adapter->instanceFeatureSetsGet(normalResponse, errorResponse); + response.setStatus(status); + + if (status/100 == 2) { + response.write(normalResponse.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(405,"Invalid HTTP method"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid HTTP method"; + response.write(errorResponse.asJson().toUtf8()); + } +} + void WebAPIRequestMapper::instanceDeviceSetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) { SWGSDRangel::SWGErrorResponse errorResponse; @@ -1411,6 +1442,46 @@ void WebAPIRequestMapper::instanceDeviceSetService(qtwebapp::HttpRequest& reques } } +void WebAPIRequestMapper::instanceFeatureSetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) +{ + SWGSDRangel::SWGErrorResponse errorResponse; + response.setHeader("Content-Type", "application/json"); + response.setHeader("Access-Control-Allow-Origin", "*"); + + if (request.getMethod() == "POST") + { + SWGSDRangel::SWGSuccessResponse normalResponse; + + int status = m_adapter->instanceFeatureSetPost(normalResponse, errorResponse); + response.setStatus(status); + + if (status/100 == 2) { + response.write(normalResponse.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else if (request.getMethod() == "DELETE") + { + SWGSDRangel::SWGSuccessResponse normalResponse; + int status = m_adapter->instanceFeatureSetDelete(normalResponse, errorResponse); + response.setStatus(status); + + if (status/100 == 2) { + response.write(normalResponse.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(405,"Invalid HTTP method"); + errorResponse.init(); + *errorResponse.getMessage() = "Invalid HTTP method"; + response.write(errorResponse.asJson().toUtf8()); + } +} + void WebAPIRequestMapper::devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) { SWGSDRangel::SWGErrorResponse errorResponse; diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index 639d3d6c0..c9de42355 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -77,6 +77,8 @@ private: void instancePresetFileService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceDeviceSetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void instanceDeviceSetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); + void instanceFeatureSetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); + void instanceFeatureSetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetFocusService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 8bf3c64e6..402283d39 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1873,6 +1873,41 @@ paths: "501": $ref: "#/responses/Response_501" + /sdrangel/featureset: + x-swagger-router-controller: instance + post: + description: Add (append) a new feature set + operationId: instanceFeatureSetPost + tags: + - FeatureSet + responses: + "202": + description: Message to add a new feature set was sent successfully + schema: + $ref: "#/definitions/SuccessResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + delete: + description: Remove last feature set. The GUI version does not remove the first feature set. + operationId: instanceFeatureSetDelete + tags: + - FeatureSet + responses: + "202": + description: Message to remove last feature set was sent successfully + schema: + $ref: "#/definitions/SuccessResponse" + "404": + description: "No more feature sets to be deleted" + schema: + $ref: "#/definitions/ErrorResponse" + "500": + $ref: "#/responses/Response_500" + "501": + $ref: "#/responses/Response_501" + /sdrangel/featureset/{featureSetIndex}: x-swagger-router-controller: featureset get: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index db36abac3..cb240e552 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -12522,6 +12522,12 @@ margin-bottom: 20px;
  • featuresetGet
  • +
  • + instanceFeatureSetDelete +
  • +
  • + instanceFeatureSetPost +
  • instanceAMBEDevicesDelete @@ -32547,6 +32553,719 @@ except ApiException as e:
    +
    +
    +
    +

    instanceFeatureSetDelete

    +

    +
    +
    +
    +

    +

    Remove last feature set. The GUI version does not remove the first feature set.

    +

    +
    +
    /sdrangel/featureset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X DELETE "http://localhost/sdrangel/featureset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetDelete();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetDelete();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance instanceFeatureSetDeleteWithCompletionHandler: 
    +              ^(SuccessResponse output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.instanceFeatureSetDelete(callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class instanceFeatureSetDeleteExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +
    +            try
    +            {
    +                SuccessResponse result = apiInstance.instanceFeatureSetDelete();
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.instanceFeatureSetDelete: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +
    +try {
    +    $result = $api_instance->instanceFeatureSetDelete();
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->instanceFeatureSetDelete: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +
    +eval { 
    +    my $result = $api_instance->instanceFeatureSetDelete();
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->instanceFeatureSetDelete: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.FeatureSetApi()
    +
    +try: 
    +    api_response = api_instance.instance_feature_set_delete()
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->instanceFeatureSetDelete: %s\n" % e)
    +
    +
    + +

    Parameters

    + + + + + + +

    Responses

    +

    Status: 202 - Message to remove last feature set was sent successfully

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - No more feature sets to be deleted

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +

    instanceFeatureSetPost

    +

    +
    +
    +
    +

    +

    Add (append) a new feature set

    +

    +
    +
    /sdrangel/featureset
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost/sdrangel/featureset"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.FeatureSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetPost();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.FeatureSetApi;
    +
    +public class FeatureSetApiExample {
    +
    +    public static void main(String[] args) {
    +        FeatureSetApi apiInstance = new FeatureSetApi();
    +        try {
    +            SuccessResponse result = apiInstance.instanceFeatureSetPost();
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling FeatureSetApi#instanceFeatureSetPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    
    +FeatureSetApi *apiInstance = [[FeatureSetApi alloc] init];
    +
    +[apiInstance instanceFeatureSetPostWithCompletionHandler: 
    +              ^(SuccessResponse output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.FeatureSetApi()
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.instanceFeatureSetPost(callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class instanceFeatureSetPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new FeatureSetApi();
    +
    +            try
    +            {
    +                SuccessResponse result = apiInstance.instanceFeatureSetPost();
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling FeatureSetApi.instanceFeatureSetPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\FeatureSetApi();
    +
    +try {
    +    $result = $api_instance->instanceFeatureSetPost();
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling FeatureSetApi->instanceFeatureSetPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::FeatureSetApi;
    +
    +my $api_instance = SWGSDRangel::FeatureSetApi->new();
    +
    +eval { 
    +    my $result = $api_instance->instanceFeatureSetPost();
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling FeatureSetApi->instanceFeatureSetPost: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.FeatureSetApi()
    +
    +try: 
    +    api_response = api_instance.instance_feature_set_post()
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling FeatureSetApi->instanceFeatureSetPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + + + + + + +

    Responses

    +

    Status: 202 - Message to add a new feature set was sent successfully

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
  • Instance

    @@ -47005,7 +47724,7 @@ except ApiException as e:
    - Generated 2021-07-12T19:39:02.669+02:00 + Generated 2021-08-21T12:00:48.492+02:00
    diff --git a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp index 8092c23a7..8219feb84 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.cpp @@ -652,5 +652,109 @@ SWGFeatureSetApi::featuresetGetCallback(SWGHttpRequestWorker * worker) { } } +void +SWGFeatureSetApi::instanceFeatureSetDelete() { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset"); + + + + SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); + SWGHttpRequestInput input(fullPath, "DELETE"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &SWGHttpRequestWorker::on_execution_finished, + this, + &SWGFeatureSetApi::instanceFeatureSetDeleteCallback); + + worker->execute(&input); +} + +void +SWGFeatureSetApi::instanceFeatureSetDeleteCallback(SWGHttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGSuccessResponse* output = static_cast(create(json, QString("SWGSuccessResponse"))); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit instanceFeatureSetDeleteSignal(output); + } else { + emit instanceFeatureSetDeleteSignalE(output, error_type, error_str); + emit instanceFeatureSetDeleteSignalEFull(worker, error_type, error_str); + } +} + +void +SWGFeatureSetApi::instanceFeatureSetPost() { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/featureset"); + + + + SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); + SWGHttpRequestInput input(fullPath, "POST"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &SWGHttpRequestWorker::on_execution_finished, + this, + &SWGFeatureSetApi::instanceFeatureSetPostCallback); + + worker->execute(&input); +} + +void +SWGFeatureSetApi::instanceFeatureSetPostCallback(SWGHttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGSuccessResponse* output = static_cast(create(json, QString("SWGSuccessResponse"))); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit instanceFeatureSetPostSignal(output); + } else { + emit instanceFeatureSetPostSignalE(output, error_type, error_str); + emit instanceFeatureSetPostSignalEFull(worker, error_type, error_str); + } +} + } diff --git a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h index a6cdfc54b..74cdf482b 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGFeatureSetApi.h @@ -50,6 +50,8 @@ public: void featuresetFeatureSettingsGet(qint32 feature_set_index, qint32 feature_index); void featuresetFeatureSettingsPatch(qint32 feature_set_index, qint32 feature_index, SWGFeatureSettings& body); void featuresetGet(qint32 feature_set_index); + void instanceFeatureSetDelete(); + void instanceFeatureSetPost(); private: void featuresetFEatureSettingsPutCallback (SWGHttpRequestWorker * worker); @@ -63,6 +65,8 @@ private: void featuresetFeatureSettingsGetCallback (SWGHttpRequestWorker * worker); void featuresetFeatureSettingsPatchCallback (SWGHttpRequestWorker * worker); void featuresetGetCallback (SWGHttpRequestWorker * worker); + void instanceFeatureSetDeleteCallback (SWGHttpRequestWorker * worker); + void instanceFeatureSetPostCallback (SWGHttpRequestWorker * worker); signals: void featuresetFEatureSettingsPutSignal(SWGFeatureSettings* summary); @@ -76,6 +80,8 @@ signals: void featuresetFeatureSettingsGetSignal(SWGFeatureSettings* summary); void featuresetFeatureSettingsPatchSignal(SWGFeatureSettings* summary); void featuresetGetSignal(SWGFeatureSet* summary); + void instanceFeatureSetDeleteSignal(SWGSuccessResponse* summary); + void instanceFeatureSetPostSignal(SWGSuccessResponse* summary); void featuresetFEatureSettingsPutSignalE(SWGFeatureSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFeatureActionsPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); @@ -88,6 +94,8 @@ signals: void featuresetFeatureSettingsGetSignalE(SWGFeatureSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFeatureSettingsPatchSignalE(SWGFeatureSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetGetSignalE(SWGFeatureSet* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void instanceFeatureSetDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void instanceFeatureSetPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFEatureSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFeatureActionsPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); @@ -100,6 +108,8 @@ signals: void featuresetFeatureSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetFeatureSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void featuresetGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void instanceFeatureSetDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void instanceFeatureSetPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); };