All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cpp-tiny.service.Service.h.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
#ifndef TINY_CPP_CLIENT_ABSTRACTSERVICE_H_
#define TINY_CPP_CLIENT_ABSTRACTSERVICE_H_
{{#isESP8266}}
#include 
#include 
{{/isESP8266}}

{{#isESP32}}
#include "HTTPClient.h"
{{/isESP32}}
#include "Response.h"
#include 
namespace Tiny {

/**
*  Class
* Generated with openapi::tiny-cpp-client
*/
class Service {
    public:
        HTTPClient http;
        {{#isESP8266}}
        WiFiClient client;
        {{/isESP8266}}
        std::string basepath = "https://petstore3.swagger.io/api/v3"; // TODO: change to your url
        std::string url = "";
        std::string payload = "";
        std::list> queryParams;
        std::list> formParams;

        int sendRequest(std::string url, const char * type, uint8_t * payload, size_t size);
        String getResponseBody();

        void addQueryParam(std::string key, std::string value);
        void addFormParam(std::string key, std::string value);
        void addHeader(std::string key, std::string value);

        {{#isESP32}}
        // Go and comment out a certificate in root.cert, if you get an error here
        // Certificate from file
        const char* test_root_ca =
        #include "../../root.cert"
        ;
        {{/isESP32}}

    private:
        void begin(std::string url);
        void prepareRequest();
        std::string encodeKeyValueTuple(std::list> params);

}; // end class
}// namespace Tinyclient

#endif /* TINY_CPP_CLIENT_ABSTRACTSERVICE_H_ */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy