forked from loafle/openapi-generator-original
[cpp-restsdk] add support for oneOf via std::variant (#18821)
* Revert "Revert "[cpp-restsdk] add support for oneOf via std::variant (#18474)…" This reverts commit 8d398719c99fbcbfa6471e0bb938f9d384454f8f. * update samples * update pom * set cxx 17 * Revert "set cxx 17" This reverts commit 0cec8f725dd8017217b75e827a54da5440dd55d1. * install clang 6.0 * Update CI/circle_parallel.sh Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com> * fix include --------- Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
This commit is contained in:
parent
3aba42733b
commit
4be5971e0f
@ -41,6 +41,10 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
|
||||
# install cpprestsdk
|
||||
sudo apt-get install libcpprest-dev
|
||||
wget "https://github.com/aminya/setup-cpp/releases/download/v0.37.0/setup-cpp-x64-linux"
|
||||
chmod +x ./setup-cpp-x64-linux
|
||||
sudo ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true
|
||||
source ~/.cpprc # activate cpp environment variables
|
||||
|
||||
# run go integration tests
|
||||
(cd samples/client/petstore/go && mvn integration-test)
|
||||
|
@ -249,7 +249,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|Union|✗|OAS3
|
||||
|allOf|✗|OAS2,OAS3
|
||||
|anyOf|✗|OAS3
|
||||
|oneOf|✗|OAS3
|
||||
|oneOf|✓|OAS3
|
||||
|not|✗|OAS3
|
||||
|
||||
### Security Feature
|
||||
|
@ -105,7 +105,8 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
GlobalFeature.MultiServer
|
||||
)
|
||||
.includeSchemaSupportFeatures(
|
||||
SchemaSupportFeature.Polymorphism
|
||||
SchemaSupportFeature.Polymorphism,
|
||||
SchemaSupportFeature.oneOf
|
||||
)
|
||||
.excludeParameterFeatures(
|
||||
ParameterFeature.Cookie
|
||||
|
@ -265,7 +265,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{
|
||||
{{/authMethods}}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("{{httpMethod}}"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -299,7 +299,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{
|
||||
{{#vendorExtensions.x-codegen-response-ishttpcontent}}
|
||||
return localVarResponse.extract_vector();
|
||||
})
|
||||
.then([=](std::vector<unsigned char> localVarResponse)
|
||||
.then([=, this](std::vector<unsigned char> localVarResponse)
|
||||
{
|
||||
{{{returnType}}} localVarResult = std::make_shared<HttpContent>();
|
||||
std::shared_ptr<std::stringstream> stream = std::make_shared<std::stringstream>(std::string(localVarResponse.begin(), localVarResponse.end()));
|
||||
@ -309,7 +309,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{
|
||||
{{^vendorExtensions.x-codegen-response-ishttpcontent}}
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
{{^returnType}}
|
||||
return void();
|
||||
|
@ -8,16 +8,27 @@
|
||||
#
|
||||
# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
||||
cmake_minimum_required (VERSION 3.1)
|
||||
cmake_minimum_required (VERSION 3.5)
|
||||
|
||||
project({{{packageName}}})
|
||||
project({{{packageName}}} CXX)
|
||||
|
||||
# Force -fPIC even if the project is configured for building a static library.
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CXX_STANDARD_REQUIRED ON)
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
if(DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION OR
|
||||
DEFINED CMAKE_CXX20_EXTENSION_COMPILE_OPTION)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
elseif(DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION OR
|
||||
DEFINED CMAKE_CXX17_EXTENSION_COMPILE_OPTION)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
elseif(DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION OR
|
||||
DEFINED CMAKE_CXX14_EXTENSION_COMPILE_OPTION)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
@ -38,12 +49,12 @@ add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
|
||||
-Wall -Wno-unused-variable>
|
||||
-Wall -Wno-unused-variable -Wno-unused-lambda-capture>
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
@ -90,4 +101,4 @@ install(
|
||||
install(
|
||||
EXPORT ${PROJECT_NAME}Targets
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
||||
)
|
||||
)
|
||||
|
@ -8,6 +8,11 @@
|
||||
#ifndef {{modelHeaderGuardPrefix}}_{{classname}}_H_
|
||||
#define {{modelHeaderGuardPrefix}}_{{classname}}_H_
|
||||
|
||||
{{#oneOf}}
|
||||
{{#-first}}
|
||||
#include <variant>
|
||||
{{/-first}}
|
||||
{{/oneOf}}
|
||||
{{^parent}}
|
||||
{{{defaultInclude}}}
|
||||
#include "{{packageName}}/ModelBase.h"
|
||||
@ -24,6 +29,60 @@ namespace {{this}} {
|
||||
{{#vendorExtensions.x-forward-declarations}}{{.}}
|
||||
{{/vendorExtensions.x-forward-declarations}}
|
||||
{{/vendorExtensions.x-has-forward-declarations}}
|
||||
{{#oneOf}}{{#-first}}
|
||||
|
||||
class {{declspec}} {{classname}}
|
||||
{
|
||||
public:
|
||||
{{classname}}() = default;
|
||||
~{{classname}}() = default;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
||||
void validate();
|
||||
|
||||
web::json::value toJson() const;
|
||||
|
||||
template<typename Target>
|
||||
bool fromJson(const web::json::value& json) {
|
||||
// convert json to Target type
|
||||
Target target;
|
||||
if (!target.fromJson(json)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_variantValue = target;
|
||||
return true;
|
||||
}
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const;
|
||||
|
||||
template<typename Target>
|
||||
bool fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) {
|
||||
// convert multipart to Target type
|
||||
Target target;
|
||||
if (!target.fromMultiPart(multipart, namePrefix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_variantValue = target;
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// {{classname}} members
|
||||
|
||||
using VariantType = std::variant<{{#oneOf}}{{^-first}}, {{/-first}}{{{.}}}{{/oneOf}}>;
|
||||
|
||||
const VariantType& getVariant() const;
|
||||
void setVariant(VariantType value);
|
||||
|
||||
protected:
|
||||
VariantType m_variantValue;
|
||||
};
|
||||
|
||||
{{/-first}}{{/oneOf}}
|
||||
{{^oneOf}}
|
||||
{{#isEnum}}
|
||||
class {{declspec}} {{classname}}
|
||||
: public {{{parent}}}{{^parent}}ModelBase{{/parent}}
|
||||
@ -120,6 +179,7 @@ protected:
|
||||
};
|
||||
|
||||
{{/isEnum}}
|
||||
{{/oneOf}}
|
||||
|
||||
{{#modelNamespaceDeclarations}}
|
||||
}
|
||||
|
@ -6,7 +6,56 @@
|
||||
{{#modelNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
{{/modelNamespaceDeclarations}}
|
||||
{{#oneOf}}{{#-first}}
|
||||
|
||||
void {{classname}}::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
|
||||
const {{classname}}::VariantType& {{classname}}::getVariant() const
|
||||
{
|
||||
return m_variantValue;
|
||||
}
|
||||
|
||||
void {{classname}}::setVariant({{classname}}::VariantType value)
|
||||
{
|
||||
m_variantValue = value;
|
||||
}
|
||||
|
||||
web::json::value {{classname}}::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
std::visit([&](auto&& arg) {
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr (std::is_same_v<T, std::monostate>) {
|
||||
val = web::json::value::null();
|
||||
} else {
|
||||
val = arg.toJson();
|
||||
}
|
||||
}, m_variantValue);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void {{classname}}::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
std::visit([&](auto&& arg) {
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr (!std::is_same_v<T, std::monostate>) {
|
||||
arg.toMultipart(multipart, prefix);
|
||||
}
|
||||
}, m_variantValue);
|
||||
}
|
||||
|
||||
{{#oneOf}}
|
||||
template bool {{classname}}::fromJson<{{.}}>(const web::json::value& json);
|
||||
template bool {{classname}}::fromMultiPart<{{.}}>(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix);
|
||||
{{/oneOf}}
|
||||
|
||||
{{/-first}}{{/oneOf}}
|
||||
{{^oneOf}}
|
||||
{{#isEnum}}
|
||||
|
||||
namespace
|
||||
@ -269,6 +318,7 @@ void {{classname}}::unset{{name}}()
|
||||
{{/isInherited}}
|
||||
{{/vars}}
|
||||
{{/isEnum}}
|
||||
{{/oneOf}}
|
||||
{{#modelNamespaceDeclarations}}
|
||||
}
|
||||
{{/modelNamespaceDeclarations}}
|
||||
|
@ -569,6 +569,27 @@ paths:
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
/user_or_pet:
|
||||
post:
|
||||
tags:
|
||||
- user_or_pet
|
||||
summary: Create user or pet
|
||||
description: This can only be done by the logged in user or pet.
|
||||
operationId: createUserOrPet
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/User'
|
||||
- $ref: '#/components/schemas/Pet'
|
||||
description: Created user or pet object
|
||||
required: true
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
|
@ -16,8 +16,10 @@ include/CppRestPetstoreClient/Object.h
|
||||
include/CppRestPetstoreClient/api/PetApi.h
|
||||
include/CppRestPetstoreClient/api/StoreApi.h
|
||||
include/CppRestPetstoreClient/api/UserApi.h
|
||||
include/CppRestPetstoreClient/api/UserOrPetApi.h
|
||||
include/CppRestPetstoreClient/model/ApiResponse.h
|
||||
include/CppRestPetstoreClient/model/Category.h
|
||||
include/CppRestPetstoreClient/model/CreateUserOrPet_request.h
|
||||
include/CppRestPetstoreClient/model/Order.h
|
||||
include/CppRestPetstoreClient/model/Pet.h
|
||||
include/CppRestPetstoreClient/model/SchemaWithSet.h
|
||||
@ -37,8 +39,10 @@ src/Object.cpp
|
||||
src/api/PetApi.cpp
|
||||
src/api/StoreApi.cpp
|
||||
src/api/UserApi.cpp
|
||||
src/api/UserOrPetApi.cpp
|
||||
src/model/ApiResponse.cpp
|
||||
src/model/Category.cpp
|
||||
src/model/CreateUserOrPet_request.cpp
|
||||
src/model/Order.cpp
|
||||
src/model/Pet.cpp
|
||||
src/model/SchemaWithSet.cpp
|
||||
|
@ -8,16 +8,27 @@
|
||||
#
|
||||
# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
||||
cmake_minimum_required (VERSION 3.1)
|
||||
cmake_minimum_required (VERSION 3.5)
|
||||
|
||||
project(CppRestPetstoreClient)
|
||||
project(CppRestPetstoreClient CXX)
|
||||
|
||||
# Force -fPIC even if the project is configured for building a static library.
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CXX_STANDARD_REQUIRED ON)
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
if(DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION OR
|
||||
DEFINED CMAKE_CXX20_EXTENSION_COMPILE_OPTION)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
elseif(DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION OR
|
||||
DEFINED CMAKE_CXX17_EXTENSION_COMPILE_OPTION)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
elseif(DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION OR
|
||||
DEFINED CMAKE_CXX14_EXTENSION_COMPILE_OPTION)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
@ -38,12 +49,12 @@ add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
|
||||
-Wall -Wno-unused-variable>
|
||||
-Wall -Wno-unused-variable -Wno-unused-lambda-capture>
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
@ -90,4 +101,4 @@ install(
|
||||
install(
|
||||
EXPORT ${PROJECT_NAME}Targets
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
||||
)
|
||||
)
|
||||
|
@ -0,0 +1,66 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI-Generator 7.7.0-SNAPSHOT.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/*
|
||||
* UserOrPetApi.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ORG_OPENAPITOOLS_CLIENT_API_UserOrPetApi_H_
|
||||
#define ORG_OPENAPITOOLS_CLIENT_API_UserOrPetApi_H_
|
||||
|
||||
|
||||
|
||||
#include "CppRestPetstoreClient/ApiClient.h"
|
||||
|
||||
#include "CppRestPetstoreClient/model/CreateUserOrPet_request.h"
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
namespace openapitools {
|
||||
namespace client {
|
||||
namespace api {
|
||||
|
||||
using namespace org::openapitools::client::model;
|
||||
|
||||
|
||||
|
||||
class UserOrPetApi
|
||||
{
|
||||
public:
|
||||
|
||||
explicit UserOrPetApi( std::shared_ptr<const ApiClient> apiClient );
|
||||
|
||||
virtual ~UserOrPetApi();
|
||||
|
||||
/// <summary>
|
||||
/// Create user or pet
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This can only be done by the logged in user or pet.
|
||||
/// </remarks>
|
||||
/// <param name="createUserOrPetRequest">Created user or pet object</param>
|
||||
pplx::task<void> createUserOrPet(
|
||||
std::shared_ptr<CreateUserOrPet_request> createUserOrPetRequest
|
||||
) const;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<const ApiClient> m_ApiClient;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ORG_OPENAPITOOLS_CLIENT_API_UserOrPetApi_H_ */
|
||||
|
@ -29,6 +29,7 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes the result of uploading an image resource
|
||||
/// </summary>
|
||||
|
@ -29,6 +29,7 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A category for a pet
|
||||
/// </summary>
|
||||
|
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI-Generator 7.7.0-SNAPSHOT.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CreateUserOrPet_request.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_
|
||||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "CppRestPetstoreClient/ModelBase.h"
|
||||
|
||||
#include "CppRestPetstoreClient/model/User.h"
|
||||
#include "CppRestPetstoreClient/model/Tag.h"
|
||||
#include "CppRestPetstoreClient/model/Category.h"
|
||||
#include <cpprest/details/basic_types.h>
|
||||
#include "CppRestPetstoreClient/model/Pet.h"
|
||||
#include <vector>
|
||||
|
||||
namespace org {
|
||||
namespace openapitools {
|
||||
namespace client {
|
||||
namespace model {
|
||||
|
||||
class Category;
|
||||
class Tag;
|
||||
|
||||
|
||||
class CreateUserOrPet_request
|
||||
{
|
||||
public:
|
||||
CreateUserOrPet_request() = default;
|
||||
~CreateUserOrPet_request() = default;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
||||
void validate();
|
||||
|
||||
web::json::value toJson() const;
|
||||
|
||||
template<typename Target>
|
||||
bool fromJson(const web::json::value& json) {
|
||||
// convert json to Target type
|
||||
Target target;
|
||||
if (!target.fromJson(json)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_variantValue = target;
|
||||
return true;
|
||||
}
|
||||
|
||||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const;
|
||||
|
||||
template<typename Target>
|
||||
bool fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) {
|
||||
// convert multipart to Target type
|
||||
Target target;
|
||||
if (!target.fromMultiPart(multipart, namePrefix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_variantValue = target;
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// CreateUserOrPet_request members
|
||||
|
||||
using VariantType = std::variant<Pet, User>;
|
||||
|
||||
const VariantType& getVariant() const;
|
||||
void setVariant(VariantType value);
|
||||
|
||||
protected:
|
||||
VariantType m_variantValue;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_ */
|
@ -29,6 +29,7 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An order for a pets from the pet store
|
||||
/// </summary>
|
||||
|
@ -34,6 +34,7 @@ namespace model {
|
||||
class Category;
|
||||
class Tag;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A pet for sale in the pet store
|
||||
/// </summary>
|
||||
|
@ -32,6 +32,7 @@ namespace model {
|
||||
|
||||
class SchemaWithSet_vaccinationBook;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Schema with a set property
|
||||
/// </summary>
|
||||
|
@ -31,6 +31,7 @@ namespace model {
|
||||
|
||||
class Vaccine;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Vaccination book of the pet
|
||||
/// </summary>
|
||||
|
@ -29,6 +29,7 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A tag for a pet
|
||||
/// </summary>
|
||||
|
@ -29,6 +29,7 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A User who is purchasing from the pet store
|
||||
/// </summary>
|
||||
|
@ -29,6 +29,7 @@ namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -37,6 +37,7 @@
|
||||
<arguments>
|
||||
<argument>-DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include"</argument>
|
||||
<argument>-DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/opt/openssl/lib"</argument>
|
||||
<argument>-DCMAKE_BUILD_TYPE=Debug</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -128,7 +128,7 @@ pplx::task<std::shared_ptr<Pet>> PetApi::addPet(std::shared_ptr<Pet> pet) const
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -161,7 +161,7 @@ pplx::task<std::shared_ptr<Pet>> PetApi::addPet(std::shared_ptr<Pet> pet) const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<Pet> localVarResult(new Pet());
|
||||
|
||||
@ -256,7 +256,7 @@ pplx::task<void> PetApi::deletePet(int64_t petId, boost::optional<utility::strin
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -289,7 +289,7 @@ pplx::task<void> PetApi::deletePet(int64_t petId, boost::optional<utility::strin
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -366,7 +366,7 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByStatus(std::vect
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -399,7 +399,7 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByStatus(std::vect
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::vector<std::shared_ptr<Pet>> localVarResult;
|
||||
|
||||
@ -498,7 +498,7 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByTags(std::vector
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -531,7 +531,7 @@ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByTags(std::vector
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::vector<std::shared_ptr<Pet>> localVarResult;
|
||||
|
||||
@ -634,7 +634,7 @@ pplx::task<std::shared_ptr<Pet>> PetApi::getPetById(int64_t petId) const
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -667,7 +667,7 @@ pplx::task<std::shared_ptr<Pet>> PetApi::getPetById(int64_t petId) const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<Pet> localVarResult(new Pet());
|
||||
|
||||
@ -783,7 +783,7 @@ pplx::task<std::shared_ptr<Pet>> PetApi::updatePet(std::shared_ptr<Pet> pet) con
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -816,7 +816,7 @@ pplx::task<std::shared_ptr<Pet>> PetApi::updatePet(std::shared_ptr<Pet> pet) con
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<Pet> localVarResult(new Pet());
|
||||
|
||||
@ -916,7 +916,7 @@ pplx::task<void> PetApi::updatePetWithForm(int64_t petId, boost::optional<utilit
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -949,7 +949,7 @@ pplx::task<void> PetApi::updatePetWithForm(int64_t petId, boost::optional<utilit
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -1032,7 +1032,7 @@ pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, boost
|
||||
// oauth2 authentication is added automatically as part of the http_client_config
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -1065,7 +1065,7 @@ pplx::task<std::shared_ptr<ApiResponse>> PetApi::uploadFile(int64_t petId, boost
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<ApiResponse> localVarResult(new ApiResponse());
|
||||
|
||||
|
@ -101,7 +101,7 @@ pplx::task<void> StoreApi::deleteOrder(utility::string_t orderId) const
|
||||
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -134,7 +134,7 @@ pplx::task<void> StoreApi::deleteOrder(utility::string_t orderId) const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -213,7 +213,7 @@ pplx::task<std::map<utility::string_t, int32_t>> StoreApi::getInventory() const
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -246,7 +246,7 @@ pplx::task<std::map<utility::string_t, int32_t>> StoreApi::getInventory() const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::map<utility::string_t, int32_t> localVarResult;
|
||||
|
||||
@ -342,7 +342,7 @@ pplx::task<std::shared_ptr<Order>> StoreApi::getOrderById(int64_t orderId) const
|
||||
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -375,7 +375,7 @@ pplx::task<std::shared_ptr<Order>> StoreApi::getOrderById(int64_t orderId) const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<Order> localVarResult(new Order());
|
||||
|
||||
@ -488,7 +488,7 @@ pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> o
|
||||
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -521,7 +521,7 @@ pplx::task<std::shared_ptr<Order>> StoreApi::placeOrder(std::shared_ptr<Order> o
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<Order> localVarResult(new Order());
|
||||
|
||||
|
@ -131,7 +131,7 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> user) const
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -164,7 +164,7 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> user) const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -270,7 +270,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -303,7 +303,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -409,7 +409,7 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -442,7 +442,7 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -521,7 +521,7 @@ pplx::task<void> UserApi::deleteUser(utility::string_t username) const
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -554,7 +554,7 @@ pplx::task<void> UserApi::deleteUser(utility::string_t username) const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -627,7 +627,7 @@ pplx::task<std::shared_ptr<User>> UserApi::getUserByName(utility::string_t usern
|
||||
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -660,7 +660,7 @@ pplx::task<std::shared_ptr<User>> UserApi::getUserByName(utility::string_t usern
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
std::shared_ptr<User> localVarResult(new User());
|
||||
|
||||
@ -761,7 +761,7 @@ pplx::task<utility::string_t> UserApi::loginUser(utility::string_t username, uti
|
||||
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -794,7 +794,7 @@ pplx::task<utility::string_t> UserApi::loginUser(utility::string_t username, uti
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
utility::string_t localVarResult(utility::conversions::to_string_t(""));
|
||||
|
||||
@ -894,7 +894,7 @@ pplx::task<void> UserApi::logoutUser() const
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -927,7 +927,7 @@ pplx::task<void> UserApi::logoutUser() const
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
@ -1029,7 +1029,7 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=](web::http::http_response localVarResponse)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
@ -1062,7 +1062,7 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=](utility::string_t localVarResponse)
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
|
@ -0,0 +1,177 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI-Generator 7.7.0-SNAPSHOT.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
#include "CppRestPetstoreClient/api/UserOrPetApi.h"
|
||||
#include "CppRestPetstoreClient/IHttpBody.h"
|
||||
#include "CppRestPetstoreClient/JsonBody.h"
|
||||
#include "CppRestPetstoreClient/MultipartFormData.h"
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
namespace org {
|
||||
namespace openapitools {
|
||||
namespace client {
|
||||
namespace api {
|
||||
|
||||
using namespace org::openapitools::client::model;
|
||||
|
||||
UserOrPetApi::UserOrPetApi( std::shared_ptr<const ApiClient> apiClient )
|
||||
: m_ApiClient(apiClient)
|
||||
{
|
||||
}
|
||||
|
||||
UserOrPetApi::~UserOrPetApi()
|
||||
{
|
||||
}
|
||||
|
||||
pplx::task<void> UserOrPetApi::createUserOrPet(std::shared_ptr<CreateUserOrPet_request> createUserOrPetRequest) const
|
||||
{
|
||||
|
||||
// verify the required parameter 'createUserOrPetRequest' is set
|
||||
if (createUserOrPetRequest == nullptr)
|
||||
{
|
||||
throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'createUserOrPetRequest' when calling UserOrPetApi->createUserOrPet"));
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration( m_ApiClient->getConfiguration() );
|
||||
utility::string_t localVarPath = utility::conversions::to_string_t("/user_or_pet");
|
||||
|
||||
std::map<utility::string_t, utility::string_t> localVarQueryParams;
|
||||
std::map<utility::string_t, utility::string_t> localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() );
|
||||
std::map<utility::string_t, utility::string_t> localVarFormParams;
|
||||
std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams;
|
||||
|
||||
std::unordered_set<utility::string_t> localVarResponseHttpContentTypes;
|
||||
|
||||
utility::string_t localVarResponseHttpContentType;
|
||||
|
||||
// use JSON if possible
|
||||
if ( localVarResponseHttpContentTypes.size() == 0 )
|
||||
{
|
||||
localVarResponseHttpContentType = utility::conversions::to_string_t("application/json");
|
||||
}
|
||||
// JSON
|
||||
else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() )
|
||||
{
|
||||
localVarResponseHttpContentType = utility::conversions::to_string_t("application/json");
|
||||
}
|
||||
// multipart formdata
|
||||
else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() )
|
||||
{
|
||||
localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ApiException(400, utility::conversions::to_string_t("UserOrPetApi->createUserOrPet does not produce any supported media type"));
|
||||
}
|
||||
|
||||
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
|
||||
|
||||
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
|
||||
localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
|
||||
|
||||
|
||||
std::shared_ptr<IHttpBody> localVarHttpBody;
|
||||
utility::string_t localVarRequestHttpContentType;
|
||||
|
||||
// use JSON if possible
|
||||
if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() )
|
||||
{
|
||||
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
|
||||
web::json::value localVarJson;
|
||||
|
||||
localVarJson = ModelBase::toJson(createUserOrPetRequest);
|
||||
|
||||
|
||||
localVarHttpBody = std::shared_ptr<IHttpBody>( new JsonBody( localVarJson ) );
|
||||
}
|
||||
// multipart formdata
|
||||
else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() )
|
||||
{
|
||||
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
|
||||
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
|
||||
|
||||
if(createUserOrPetRequest.get())
|
||||
{
|
||||
createUserOrPetRequest->toMultipart(localVarMultipart, utility::conversions::to_string_t("createUserOrPetRequest"));
|
||||
}
|
||||
|
||||
|
||||
localVarHttpBody = localVarMultipart;
|
||||
localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
|
||||
}
|
||||
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
|
||||
{
|
||||
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ApiException(415, utility::conversions::to_string_t("UserOrPetApi->createUserOrPet does not consume any supported media type"));
|
||||
}
|
||||
|
||||
// authentication (api_key) required
|
||||
{
|
||||
utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
|
||||
if ( localVarApiKey.size() > 0 )
|
||||
{
|
||||
localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
|
||||
}
|
||||
}
|
||||
|
||||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
|
||||
.then([=, this](web::http::http_response localVarResponse)
|
||||
{
|
||||
if (m_ApiClient->getResponseHandler())
|
||||
{
|
||||
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), localVarResponse.headers());
|
||||
}
|
||||
|
||||
// 1xx - informational : OK
|
||||
// 2xx - successful : OK
|
||||
// 3xx - redirection : OK
|
||||
// 4xx - client error : not OK
|
||||
// 5xx - client error : not OK
|
||||
if (localVarResponse.status_code() >= 400)
|
||||
{
|
||||
throw ApiException(localVarResponse.status_code()
|
||||
, utility::conversions::to_string_t("error calling createUserOrPet: ") + localVarResponse.reason_phrase()
|
||||
, std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
|
||||
}
|
||||
|
||||
// check response content type
|
||||
if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type")))
|
||||
{
|
||||
utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")];
|
||||
if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos )
|
||||
{
|
||||
throw ApiException(500
|
||||
, utility::conversions::to_string_t("error calling createUserOrPet: unexpected response type: ") + localVarContentType
|
||||
, std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse.extract_string();
|
||||
})
|
||||
.then([=, this](utility::string_t localVarResponse)
|
||||
{
|
||||
return void();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI-Generator 7.7.0-SNAPSHOT.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "CppRestPetstoreClient/model/CreateUserOrPet_request.h"
|
||||
|
||||
namespace org {
|
||||
namespace openapitools {
|
||||
namespace client {
|
||||
namespace model {
|
||||
|
||||
|
||||
void CreateUserOrPet_request::validate()
|
||||
{
|
||||
// TODO: implement validation
|
||||
}
|
||||
|
||||
const CreateUserOrPet_request::VariantType& CreateUserOrPet_request::getVariant() const
|
||||
{
|
||||
return m_variantValue;
|
||||
}
|
||||
|
||||
void CreateUserOrPet_request::setVariant(CreateUserOrPet_request::VariantType value)
|
||||
{
|
||||
m_variantValue = value;
|
||||
}
|
||||
|
||||
web::json::value CreateUserOrPet_request::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
std::visit([&](auto&& arg) {
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr (std::is_same_v<T, std::monostate>) {
|
||||
val = web::json::value::null();
|
||||
} else {
|
||||
val = arg.toJson();
|
||||
}
|
||||
}, m_variantValue);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void CreateUserOrPet_request::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
std::visit([&](auto&& arg) {
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr (!std::is_same_v<T, std::monostate>) {
|
||||
arg.toMultipart(multipart, prefix);
|
||||
}
|
||||
}, m_variantValue);
|
||||
}
|
||||
|
||||
template bool CreateUserOrPet_request::fromJson<Pet>(const web::json::value& json);
|
||||
template bool CreateUserOrPet_request::fromMultiPart<Pet>(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix);
|
||||
template bool CreateUserOrPet_request::fromJson<User>(const web::json::value& json);
|
||||
template bool CreateUserOrPet_request::fromMultiPart<User>(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user