Anders Aaen Springborg c741b10fb7
cpp-tiny 3.0 (#10739)
* int get generated as long

* test revised

* moved network logic to abstract service

* New service hooks in services

* bourne version

* remove comment from cert

* sendRequest remove direct link to http request

* Network logic into AbstractService

* Rename AbstractService to Service

* add query params

* Remove unused comment

* Change files in openapi

* amazon root CA 1 default ssl certificate

* rename service

* duplicate line

* Set todo

* lint whitespace fix

* uncomment array querey paramns

* Form params in service body

* this is nice

* added form params

* remove random mustache variable

* change form map to list, as it would overwrite if there was duplicates

* maven build and doc gen
2021-11-04 10:24:13 +08:00

44 lines
1.3 KiB
C++

#ifndef TINY_CPP_CLIENT_ABSTRACTSERVICE_H_
#define TINY_CPP_CLIENT_ABSTRACTSERVICE_H_
#include "HTTPClient.h"
#include "Response.h"
#include <list>
namespace Tiny {
/**
* Class
* Generated with openapi::tiny-cpp-client
*/
class Service {
public:
HTTPClient http;
std::string basepath = "https://petstore3.swagger.io/api/v3"; // TODO: change to your url
std::string url = "";
std::string payload = "";
std::list<std::tuple<std::string, std::string>> queryParams;
std::list<std::tuple<std::string, std::string>> 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);
// 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"
;
private:
void begin(std::string url);
void prepareRequest();
std::string encodeKeyValueTuple(std::list<std::tuple<std::string, std::string>> params);
}; // end class
}// namespace Tinyclient
#endif /* TINY_CPP_CLIENT_ABSTRACTSERVICE_H_ */