mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 15:57:06 +00:00
[C++][CppRest] Add CMake file template to generate CMakeLists build file (#5561)
* Add operationId in exception message * add number data type mapping * removing mergetool lines * first draft of cmake file * compiles generated source files with 64 bit cpprest and boost * using glob recurs to add source files * using glob recurse for source files * cmake to build statuc library * add cmake style comments, use project source dir and lib * fix_issue5488: Add supporting files and source files separately * fix_issue5488: Add supporting files and source files separately * fix_issue5488: Add supporting files and source files separately * fix_issue5488 - updated header comments * updated samples
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@@ -39,12 +39,6 @@ PetApi::~PetApi()
|
||||
pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body)
|
||||
{
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == nullptr)
|
||||
{
|
||||
throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->addPet"));
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("/pet");
|
||||
@@ -55,8 +49,8 @@ pplx::task<void> PetApi::addPet(std::shared_ptr<Pet> body)
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -172,8 +166,8 @@ pplx::task<void> PetApi::deletePet(int64_t petId, utility::string_t apiKey)
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -277,8 +271,8 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByStatus(std::vect
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -407,8 +401,8 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByTags(std::vector
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -538,8 +532,8 @@ pplx::task<std::shared_ptr<Pet>> PetApi::getPetById(int64_t petId)
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -589,6 +583,8 @@ pplx::task<std::shared_ptr<Pet>> PetApi::getPetById(int64_t petId)
|
||||
//Set the request content type in the header.
|
||||
headerParams[U("Content-Type")] = requestHttpContentType;
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
// authentication (api_key) required
|
||||
{
|
||||
utility::string_t apiKey = apiConfiguration->getApiKey(U("api_key"));
|
||||
@@ -653,12 +649,6 @@ pplx::task<std::shared_ptr<Pet>> PetApi::getPetById(int64_t petId)
|
||||
pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body)
|
||||
{
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == nullptr)
|
||||
{
|
||||
throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->updatePet"));
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t path = U("/pet");
|
||||
@@ -669,8 +659,8 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body)
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -772,7 +762,7 @@ pplx::task<void> PetApi::updatePet(std::shared_ptr<Pet> body)
|
||||
return void();
|
||||
});
|
||||
}
|
||||
pplx::task<void> PetApi::updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status)
|
||||
pplx::task<void> PetApi::updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status)
|
||||
{
|
||||
|
||||
|
||||
@@ -786,8 +776,8 @@ pplx::task<void> PetApi::updatePetWithForm(int64_t petId, utility::string_t name
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -883,7 +873,7 @@ pplx::task<void> PetApi::updatePetWithForm(int64_t petId, utility::string_t name
|
||||
return void();
|
||||
});
|
||||
}
|
||||
pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr<HttpContent> file)
|
||||
pplx::task<void> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr<HttpContent> file)
|
||||
{
|
||||
|
||||
|
||||
@@ -898,6 +888,7 @@ pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, utili
|
||||
|
||||
std::unordered_set<utility::string_t> responseHttpContentTypes;
|
||||
responseHttpContentTypes.insert( U("application/json") );
|
||||
responseHttpContentTypes.insert( U("application/xml") );
|
||||
|
||||
utility::string_t responseHttpContentType;
|
||||
|
||||
@@ -990,25 +981,7 @@ pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, utili
|
||||
})
|
||||
.then([=](utility::string_t response)
|
||||
{
|
||||
std::shared_ptr<ApiResponse> result(new ApiResponse());
|
||||
|
||||
if(responseHttpContentType == U("application/json"))
|
||||
{
|
||||
web::json::value json = web::json::value::parse(response);
|
||||
|
||||
result->fromJson(json);
|
||||
}
|
||||
// else if(responseHttpContentType == U("multipart/form-data"))
|
||||
// {
|
||||
// TODO multipart response parsing
|
||||
// }
|
||||
else
|
||||
{
|
||||
throw ApiException(500
|
||||
, U("error calling uploadFile: unsupported response type"));
|
||||
}
|
||||
|
||||
return result;
|
||||
return void();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user