forked from loafle/openapi-generator-original
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
This commit is contained in:
committed by
GitHub
parent
a7242cc8d0
commit
c741b10fb7
@@ -15,31 +15,34 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet"; //
|
||||
// Query |
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query |
|
||||
|
||||
// Form |
|
||||
// Body | pet
|
||||
addHeader("Content-Type", "application/json");
|
||||
|
||||
|
||||
|
||||
|
||||
begin(url);
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | POST
|
||||
http.addHeader("Content-Type", "application/json");
|
||||
// Body | pet
|
||||
|
||||
|
||||
|
||||
payload = pet.toJson().dump();
|
||||
|
||||
int httpCode = http.sendRequest("POST", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
int httpCode = sendRequest(url, "POST", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -64,10 +67,16 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet/{petId}"; //petId
|
||||
|
||||
|
||||
// Headers | apiKey
|
||||
addHeader("api_key",apiKey);
|
||||
|
||||
// Query |
|
||||
// Headers | apiKey
|
||||
|
||||
// Form |
|
||||
// Body |
|
||||
|
||||
|
||||
|
||||
std::string s_petId("{");
|
||||
s_petId.append("petId");
|
||||
@@ -78,19 +87,17 @@ using namespace Tiny;
|
||||
url.erase(pos, s_petId.length());
|
||||
url.insert(pos, stringify(petId));
|
||||
|
||||
begin(url);
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | DELETE
|
||||
int httpCode = http.sendRequest("DELETE", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
// Body |
|
||||
int httpCode = sendRequest(url, "DELETE", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
Response<String> response(output, httpCode);
|
||||
return response;
|
||||
@@ -107,25 +114,31 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet/findByStatus"; //
|
||||
// Query | status
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query | status
|
||||
for (auto &x : status){
|
||||
addQueryParam("status", std::string(x));
|
||||
}
|
||||
|
||||
// Form |
|
||||
// Body |
|
||||
|
||||
|
||||
begin(url);
|
||||
|
||||
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | GET
|
||||
int httpCode = http.sendRequest("GET", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
// Body |
|
||||
int httpCode = sendRequest(url, "GET", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
|
||||
std::list<Pet> obj = std::list<Pet>();
|
||||
@@ -167,25 +180,31 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet/findByTags"; //
|
||||
// Query | tags
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query | tags
|
||||
for (auto &x : tags){
|
||||
addQueryParam("tags", std::string(x));
|
||||
}
|
||||
|
||||
// Form |
|
||||
// Body |
|
||||
|
||||
|
||||
begin(url);
|
||||
|
||||
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | GET
|
||||
int httpCode = http.sendRequest("GET", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
// Body |
|
||||
int httpCode = sendRequest(url, "GET", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
|
||||
std::list<Pet> obj = std::list<Pet>();
|
||||
@@ -227,10 +246,15 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet/{petId}"; //petId
|
||||
// Query |
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query |
|
||||
|
||||
// Form |
|
||||
// Body |
|
||||
|
||||
|
||||
|
||||
std::string s_petId("{");
|
||||
s_petId.append("petId");
|
||||
@@ -241,19 +265,17 @@ using namespace Tiny;
|
||||
url.erase(pos, s_petId.length());
|
||||
url.insert(pos, stringify(petId));
|
||||
|
||||
begin(url);
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | GET
|
||||
int httpCode = http.sendRequest("GET", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
// Body |
|
||||
int httpCode = sendRequest(url, "GET", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -275,31 +297,34 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet"; //
|
||||
// Query |
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query |
|
||||
|
||||
// Form |
|
||||
// Body | pet
|
||||
addHeader("Content-Type", "application/json");
|
||||
|
||||
|
||||
|
||||
|
||||
begin(url);
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | PUT
|
||||
http.addHeader("Content-Type", "application/json");
|
||||
// Body | pet
|
||||
|
||||
|
||||
|
||||
payload = pet.toJson().dump();
|
||||
|
||||
int httpCode = http.sendRequest("PUT", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
int httpCode = sendRequest(url, "PUT", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -327,10 +352,18 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet/{petId}"; //petId
|
||||
// Query |
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query |
|
||||
|
||||
// Form | name status
|
||||
// Body |
|
||||
addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
addFormParam("name",name);
|
||||
addFormParam("status",status);
|
||||
|
||||
|
||||
std::string s_petId("{");
|
||||
s_petId.append("petId");
|
||||
@@ -341,19 +374,17 @@ using namespace Tiny;
|
||||
url.erase(pos, s_petId.length());
|
||||
url.insert(pos, stringify(petId));
|
||||
|
||||
begin(url);
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | POST
|
||||
int httpCode = http.sendRequest("POST", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
// Body |
|
||||
int httpCode = sendRequest(url, "POST", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
Response<String> response(output, httpCode);
|
||||
return response;
|
||||
@@ -376,10 +407,18 @@ using namespace Tiny;
|
||||
)
|
||||
{
|
||||
std::string url = basepath + "/pet/{petId}/uploadImage"; //petId
|
||||
// Query |
|
||||
|
||||
|
||||
// Headers |
|
||||
|
||||
// Query |
|
||||
|
||||
// Form | additionalMetadata file
|
||||
// Body |
|
||||
addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
addFormParam("additionalMetadata",additionalMetadata);
|
||||
addFormParam("file",file);
|
||||
|
||||
|
||||
std::string s_petId("{");
|
||||
s_petId.append("petId");
|
||||
@@ -390,19 +429,17 @@ using namespace Tiny;
|
||||
url.erase(pos, s_petId.length());
|
||||
url.insert(pos, stringify(petId));
|
||||
|
||||
begin(url);
|
||||
|
||||
std::string payload = "";
|
||||
// Send Request
|
||||
// METHOD | POST
|
||||
int httpCode = http.sendRequest("POST", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
// Body |
|
||||
int httpCode = sendRequest(url, "POST", reinterpret_cast<uint8_t*>(&payload[0]), payload.length());
|
||||
|
||||
// Handle Request
|
||||
String output = http.getString();
|
||||
String output = getResponseBody();
|
||||
std::string output_string = output.c_str();
|
||||
|
||||
http.end();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user