From 5e97e76fc04dab2caec3f03a1e3fe209875ce55e Mon Sep 17 00:00:00 2001 From: etherealjoy Date: Thu, 6 Jun 2019 00:59:50 +0200 Subject: [PATCH 1/2] Add examples and test for cpprestsdk --- bin/cpp-restsdk-petstore.sh | 2 +- bin/windows/cpp-restsdk-petstore.bat | 2 +- .../petstore/cpp-restsdk/CMakeLists.txt | 91 ++++++++---------- .../petstore/cpp-restsdk/PetApiTests.cpp | 92 +++++++++++++++++++ .../client/petstore/cpp-restsdk/PetApiTests.h | 34 +++++++ .../cpp-restsdk/{ => client}/ApiClient.cpp | 4 +- .../cpp-restsdk/{ => client}/ApiClient.h | 4 +- .../{ => client}/ApiConfiguration.cpp | 4 +- .../{ => client}/ApiConfiguration.h | 4 +- .../cpp-restsdk/{ => client}/ApiException.cpp | 4 +- .../cpp-restsdk/{ => client}/ApiException.h | 4 +- .../cpp-restsdk/client/CMakeLists.txt | 54 +++++++++++ .../cpp-restsdk/{ => client}/HttpContent.cpp | 4 +- .../cpp-restsdk/{ => client}/HttpContent.h | 4 +- .../cpp-restsdk/{ => client}/IHttpBody.h | 4 +- .../cpp-restsdk/{ => client}/JsonBody.cpp | 4 +- .../cpp-restsdk/{ => client}/JsonBody.h | 4 +- .../cpp-restsdk/{ => client}/ModelBase.cpp | 4 +- .../cpp-restsdk/{ => client}/ModelBase.h | 4 +- .../{ => client}/MultipartFormData.cpp | 4 +- .../{ => client}/MultipartFormData.h | 4 +- .../cpp-restsdk/{ => client}/Object.cpp | 4 +- .../cpp-restsdk/{ => client}/Object.h | 4 +- .../cpp-restsdk/{ => client}/README.md | 0 .../cpp-restsdk/{ => client}/api/PetApi.cpp | 4 +- .../cpp-restsdk/{ => client}/api/PetApi.h | 4 +- .../cpp-restsdk/{ => client}/api/StoreApi.cpp | 4 +- .../cpp-restsdk/{ => client}/api/StoreApi.h | 4 +- .../cpp-restsdk/{ => client}/api/UserApi.cpp | 4 +- .../cpp-restsdk/{ => client}/api/UserApi.h | 4 +- .../cpp-restsdk/{ => client}/git_push.sh | 0 .../{ => client}/model/ApiResponse.cpp | 4 +- .../{ => client}/model/ApiResponse.h | 4 +- .../{ => client}/model/Category.cpp | 4 +- .../cpp-restsdk/{ => client}/model/Category.h | 4 +- .../cpp-restsdk/{ => client}/model/Order.cpp | 4 +- .../cpp-restsdk/{ => client}/model/Order.h | 4 +- .../cpp-restsdk/{ => client}/model/Pet.cpp | 4 +- .../cpp-restsdk/{ => client}/model/Pet.h | 4 +- .../cpp-restsdk/{ => client}/model/Tag.cpp | 4 +- .../cpp-restsdk/{ => client}/model/Tag.h | 4 +- .../cpp-restsdk/{ => client}/model/User.cpp | 4 +- .../cpp-restsdk/{ => client}/model/User.h | 4 +- .../petstore/cpp-restsdk/{ => client}/pom.xml | 0 samples/client/petstore/cpp-restsdk/main.cpp | 6 ++ 45 files changed, 295 insertions(+), 126 deletions(-) create mode 100644 samples/client/petstore/cpp-restsdk/PetApiTests.cpp create mode 100644 samples/client/petstore/cpp-restsdk/PetApiTests.h rename samples/client/petstore/cpp-restsdk/{ => client}/ApiClient.cpp (98%) rename samples/client/petstore/cpp-restsdk/{ => client}/ApiClient.h (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/ApiConfiguration.cpp (93%) rename samples/client/petstore/cpp-restsdk/{ => client}/ApiConfiguration.h (93%) rename samples/client/petstore/cpp-restsdk/{ => client}/ApiException.cpp (91%) rename samples/client/petstore/cpp-restsdk/{ => client}/ApiException.h (92%) create mode 100644 samples/client/petstore/cpp-restsdk/client/CMakeLists.txt rename samples/client/petstore/cpp-restsdk/{ => client}/HttpContent.cpp (92%) rename samples/client/petstore/cpp-restsdk/{ => client}/HttpContent.h (93%) rename samples/client/petstore/cpp-restsdk/{ => client}/IHttpBody.h (87%) rename samples/client/petstore/cpp-restsdk/{ => client}/JsonBody.cpp (83%) rename samples/client/petstore/cpp-restsdk/{ => client}/JsonBody.h (88%) rename samples/client/petstore/cpp-restsdk/{ => client}/ModelBase.cpp (99%) rename samples/client/petstore/cpp-restsdk/{ => client}/ModelBase.h (98%) rename samples/client/petstore/cpp-restsdk/{ => client}/MultipartFormData.cpp (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/MultipartFormData.h (93%) rename samples/client/petstore/cpp-restsdk/{ => client}/Object.cpp (94%) rename samples/client/petstore/cpp-restsdk/{ => client}/Object.h (92%) rename samples/client/petstore/cpp-restsdk/{ => client}/README.md (100%) rename samples/client/petstore/cpp-restsdk/{ => client}/api/PetApi.cpp (99%) rename samples/client/petstore/cpp-restsdk/{ => client}/api/PetApi.h (97%) rename samples/client/petstore/cpp-restsdk/{ => client}/api/StoreApi.cpp (99%) rename samples/client/petstore/cpp-restsdk/{ => client}/api/StoreApi.h (95%) rename samples/client/petstore/cpp-restsdk/{ => client}/api/UserApi.cpp (99%) rename samples/client/petstore/cpp-restsdk/{ => client}/api/UserApi.h (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/git_push.sh (100%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/ApiResponse.cpp (97%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/ApiResponse.h (94%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Category.cpp (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Category.h (94%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Order.cpp (98%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Order.h (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Pet.cpp (98%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Pet.h (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Tag.cpp (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/Tag.h (93%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/User.cpp (98%) rename samples/client/petstore/cpp-restsdk/{ => client}/model/User.h (96%) rename samples/client/petstore/cpp-restsdk/{ => client}/pom.xml (100%) create mode 100644 samples/client/petstore/cpp-restsdk/main.cpp diff --git a/bin/cpp-restsdk-petstore.sh b/bin/cpp-restsdk-petstore.sh index 1c5f0ad54e58..ad9090d0b5c3 100755 --- a/bin/cpp-restsdk-petstore.sh +++ b/bin/cpp-restsdk-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk $@" +ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk/client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/cpp-restsdk-petstore.bat b/bin/windows/cpp-restsdk-petstore.bat index be6046bc59c6..074bef986684 100755 --- a/bin/windows/cpp-restsdk-petstore.bat +++ b/bin/windows/cpp-restsdk-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restsdk -o samples\client\petstore\cpp-restsdk +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restsdk -o samples\client\petstore\cpp-restsdk\client java %JAVA_OPTS% -jar %executable% %ags% diff --git a/samples/client/petstore/cpp-restsdk/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/CMakeLists.txt index 6c7bfafe813c..6aec7474b595 100644 --- a/samples/client/petstore/cpp-restsdk/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/CMakeLists.txt @@ -1,54 +1,37 @@ -# -# 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. -# -# OpenAPI spec version: 1.0.0 -# -# https://openapi-generator.tech -# -# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). - -cmake_minimum_required (VERSION 2.8) - -#PROJECT's NAME -project(CppRestOpenAPIClient) - - -# THE LOCATION OF OUTPUT BINARIES -set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) -set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_DIR}) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -# BUILD TYPE -message("A ${CMAKE_BUILD_TYPE} build configuration is detected") - -# Update require components as necessary -#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) - -# build and set path to cpp rest sdk -set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/3rdParty/cpprest) -set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) -set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) - -include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR}) - - -# If using vcpkg, set include directories. Also comment out CPPREST section above since vcpkg will handle it. -# To install required vcpkg packages execute: -# > vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows -# set(VCPKG_ROOT "C:\\vcpkg\\installed\\x64-windows") -# set(VCPKG_INCLUDE_DIR ${VCPKG_ROOT}/include) -# set(VCPKG_LIBRARY_DIR ${VCPKG_ROOT}/lib) -# include_directories(${PROJECT_SOURCE_DIR} api model ${VCPKG_INCLUDE_DIR}) - -#SUPPORTING FILES -set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object") -#SOURCE FILES -file(GLOB SOURCE_FILES "api/*" "model/*") - -add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) +cmake_minimum_required (VERSION 3.2) + +project(cpprest-petstore) +set(CMAKE_VERBOSE_MAKEFILE ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14 -Wall -Wno-unused-variable") + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -g3") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -g3") +set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_PREFIX_PATH /usr/lib/x86_64-linux-gnu/cmake) +find_package(cpprestsdk REQUIRED) +find_package(Boost REQUIRED) +add_subdirectory(client) + +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/client + ${CMAKE_CURRENT_SOURCE_DIR}/client/model + ${CMAKE_CURRENT_SOURCE_DIR}/client/api +) + +link_directories( + ${Boost_LIBRARY_DIRS} +) +add_executable(${PROJECT_NAME} ${SRCS}) +add_dependencies(${PROJECT_NAME} CppRestOpenAPIClient ) +target_link_libraries(${PROJECT_NAME} CppRestOpenAPIClient cpprest pthread boost_system crypto) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) + +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) diff --git a/samples/client/petstore/cpp-restsdk/PetApiTests.cpp b/samples/client/petstore/cpp-restsdk/PetApiTests.cpp new file mode 100644 index 000000000000..934fad9cfe87 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/PetApiTests.cpp @@ -0,0 +1,92 @@ +#include "PetApiTests.h" +#include +#include +#include +#include + +OAIPetApiTests::OAIPetApiTests(std::string host, std::string basePath){ + apiconfiguration = std::make_shared(); + apiconfiguration->setBaseUrl(host + basePath); + apiconfiguration->setUserAgent(U("OpenAPI Client")); + apiclient = std::make_shared(apiconfiguration); + api = std::make_shared(apiclient); +} + +OAIPetApiTests::~OAIPetApiTests() { + +} + +void OAIPetApiTests::runTests(){ + testAddPet(); + testFindPetsByStatus(); + testGetPetById(); +} + +void OAIPetApiTests::testAddPet(){ + auto req = std::make_shared(); + req->setId(12345); + req->setName("cpprest-pet"); + req->setStatus(U("123")); + + std::function f = []() + { + std::cout << "added pet successfully" << std::endl; + }; + + auto reqTask = api->addPet(req).then(f); + try{ + reqTask.wait(); + } + catch(const ApiException& ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } + catch(const std::exception &ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } +} + +void OAIPetApiTests::testFindPetsByStatus(){ + auto req = std::vector(); + req.push_back(U("pending")); + auto reqTask = api->findPetsByStatus(req) + .then([=](std::vector> pets) + { + std::cout << "found pet successfully" << std::endl; + }); + try{ + reqTask.wait(); + } + catch(const ApiException& ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } + catch(const std::exception &ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } +} + +void OAIPetApiTests::testGetPetById(){ + int req = 12345; + auto f = std::bind(&OAIPetApiTests::getPetByIdCallback, this, std::placeholders::_1); + + auto reqTask = api->getPetById(req).then(f); + + try{ + reqTask.wait(); + } + catch(const ApiException& ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } + catch(const std::exception &ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } +} + +void OAIPetApiTests::getPetByIdCallback(std::shared_ptr pet){ + std::cout << "found pet by id successfully" << std::endl; +} diff --git a/samples/client/petstore/cpp-restsdk/PetApiTests.h b/samples/client/petstore/cpp-restsdk/PetApiTests.h new file mode 100644 index 000000000000..7727a6437fd1 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/PetApiTests.h @@ -0,0 +1,34 @@ +#ifndef OAI_PETAPI_TESTS_H +#define OAI_PETAPI_TESTS_H + +#include +#include "client/ApiClient.h" +#include "client/ApiConfiguration.h" +#include "client/api/PetApi.h" +#include "client/model/Pet.h" + + +using namespace std; +using namespace org::openapitools::client::api; + +class OAIPetApiTests +{ +public: + explicit OAIPetApiTests(std::string host = U("http://petstore.swagger.io"), std::string basePath = U("/v2")); + + virtual ~OAIPetApiTests(); +public: + void runTests(); +private: + void testAddPet(); + void testFindPetsByStatus(); + void testGetPetById(); + + void getPetByIdCallback(std::shared_ptr pet); + + std::shared_ptr apiconfiguration; + std::shared_ptr apiclient; + std::shared_ptr api; +}; + +#endif // OAI_PETAPI_TESTS_H diff --git a/samples/client/petstore/cpp-restsdk/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/ApiClient.cpp rename to samples/client/petstore/cpp-restsdk/client/ApiClient.cpp index f9445bd20c68..384eb8a8bc54 100644 --- a/samples/client/petstore/cpp-restsdk/ApiClient.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiClient.h b/samples/client/petstore/cpp-restsdk/client/ApiClient.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/ApiClient.h rename to samples/client/petstore/cpp-restsdk/client/ApiClient.h index 2e34724d596f..5c5d78c765e2 100644 --- a/samples/client/petstore/cpp-restsdk/ApiClient.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp similarity index 93% rename from samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp rename to samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp index 531320239fbf..251b0d0d2992 100644 --- a/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiConfiguration.h b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/ApiConfiguration.h rename to samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h index d89fea879e4d..f6f352059908 100644 --- a/samples/client/petstore/cpp-restsdk/ApiConfiguration.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiException.cpp b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp similarity index 91% rename from samples/client/petstore/cpp-restsdk/ApiException.cpp rename to samples/client/petstore/cpp-restsdk/client/ApiException.cpp index 124bf391142d..b0a637cf6003 100644 --- a/samples/client/petstore/cpp-restsdk/ApiException.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiException.h b/samples/client/petstore/cpp-restsdk/client/ApiException.h similarity index 92% rename from samples/client/petstore/cpp-restsdk/ApiException.h rename to samples/client/petstore/cpp-restsdk/client/ApiException.h index d419f13f3dda..30f5ef51df32 100644 --- a/samples/client/petstore/cpp-restsdk/ApiException.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt new file mode 100644 index 000000000000..86565fec65e0 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt @@ -0,0 +1,54 @@ +# +# 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 +# +# https://openapi-generator.tech +# +# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). + +cmake_minimum_required (VERSION 2.8) + +#PROJECT's NAME +project(CppRestOpenAPIClient) + + +# THE LOCATION OF OUTPUT BINARIES +set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_DIR}) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# BUILD TYPE +message("A ${CMAKE_BUILD_TYPE} build configuration is detected") + +# Update require components as necessary +#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) + +# build and set path to cpp rest sdk +set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/3rdParty/cpprest) +set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) +set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) + +include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR}) + + +# If using vcpkg, set include directories. Also comment out CPPREST section above since vcpkg will handle it. +# To install required vcpkg packages execute: +# > vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows +# set(VCPKG_ROOT "C:\\vcpkg\\installed\\x64-windows") +# set(VCPKG_INCLUDE_DIR ${VCPKG_ROOT}/include) +# set(VCPKG_LIBRARY_DIR ${VCPKG_ROOT}/lib) +# include_directories(${PROJECT_SOURCE_DIR} api model ${VCPKG_INCLUDE_DIR}) + +#SUPPORTING FILES +set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object") +#SOURCE FILES +file(GLOB SOURCE_FILES "api/*" "model/*") + +add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) diff --git a/samples/client/petstore/cpp-restsdk/HttpContent.cpp b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp similarity index 92% rename from samples/client/petstore/cpp-restsdk/HttpContent.cpp rename to samples/client/petstore/cpp-restsdk/client/HttpContent.cpp index 0c0cce5fcdd7..6dedcd299088 100644 --- a/samples/client/petstore/cpp-restsdk/HttpContent.cpp +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/HttpContent.h b/samples/client/petstore/cpp-restsdk/client/HttpContent.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/HttpContent.h rename to samples/client/petstore/cpp-restsdk/client/HttpContent.h index 25dd1d5c6e0c..b357475da38b 100644 --- a/samples/client/petstore/cpp-restsdk/HttpContent.h +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/IHttpBody.h b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h similarity index 87% rename from samples/client/petstore/cpp-restsdk/IHttpBody.h rename to samples/client/petstore/cpp-restsdk/client/IHttpBody.h index 07d0e5c84ceb..865bd467f304 100644 --- a/samples/client/petstore/cpp-restsdk/IHttpBody.h +++ b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/JsonBody.cpp b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp similarity index 83% rename from samples/client/petstore/cpp-restsdk/JsonBody.cpp rename to samples/client/petstore/cpp-restsdk/client/JsonBody.cpp index b523ba6f67c7..e2edc1b67ef4 100644 --- a/samples/client/petstore/cpp-restsdk/JsonBody.cpp +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/JsonBody.h b/samples/client/petstore/cpp-restsdk/client/JsonBody.h similarity index 88% rename from samples/client/petstore/cpp-restsdk/JsonBody.h rename to samples/client/petstore/cpp-restsdk/client/JsonBody.h index dacf42985c97..fba123dfc425 100644 --- a/samples/client/petstore/cpp-restsdk/JsonBody.h +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ModelBase.cpp b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/ModelBase.cpp rename to samples/client/petstore/cpp-restsdk/client/ModelBase.cpp index ec9192c14e28..8b9f859dd6e8 100644 --- a/samples/client/petstore/cpp-restsdk/ModelBase.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/ModelBase.h similarity index 98% rename from samples/client/petstore/cpp-restsdk/ModelBase.h rename to samples/client/petstore/cpp-restsdk/client/ModelBase.h index 80e8a76edbf4..26459aa58951 100644 --- a/samples/client/petstore/cpp-restsdk/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp similarity index 96% rename from samples/client/petstore/cpp-restsdk/MultipartFormData.cpp rename to samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp index fda5c805bdd6..ec6af2de5e0e 100644 --- a/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/MultipartFormData.h b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/MultipartFormData.h rename to samples/client/petstore/cpp-restsdk/client/MultipartFormData.h index cff61c6cb5c4..96d8c3a662a7 100644 --- a/samples/client/petstore/cpp-restsdk/MultipartFormData.h +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/Object.cpp b/samples/client/petstore/cpp-restsdk/client/Object.cpp similarity index 94% rename from samples/client/petstore/cpp-restsdk/Object.cpp rename to samples/client/petstore/cpp-restsdk/client/Object.cpp index a63e69cea484..3624e24a0172 100644 --- a/samples/client/petstore/cpp-restsdk/Object.cpp +++ b/samples/client/petstore/cpp-restsdk/client/Object.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/Object.h b/samples/client/petstore/cpp-restsdk/client/Object.h similarity index 92% rename from samples/client/petstore/cpp-restsdk/Object.h rename to samples/client/petstore/cpp-restsdk/client/Object.h index 99179be55bdd..bc2c7aa7573c 100644 --- a/samples/client/petstore/cpp-restsdk/Object.h +++ b/samples/client/petstore/cpp-restsdk/client/Object.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/README.md b/samples/client/petstore/cpp-restsdk/client/README.md similarity index 100% rename from samples/client/petstore/cpp-restsdk/README.md rename to samples/client/petstore/cpp-restsdk/client/README.md diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/api/PetApi.cpp rename to samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp index d8530e324c0d..0c67b5ecbf5b 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h similarity index 97% rename from samples/client/petstore/cpp-restsdk/api/PetApi.h rename to samples/client/petstore/cpp-restsdk/client/api/PetApi.h index bb7b6f7b1997..09b2f06da9bc 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/api/StoreApi.cpp rename to samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp index 0ec396c54e4b..a7bcf614ee2e 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h similarity index 95% rename from samples/client/petstore/cpp-restsdk/api/StoreApi.h rename to samples/client/petstore/cpp-restsdk/client/api/StoreApi.h index 700f788df276..2aaf9bf59699 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/api/UserApi.cpp rename to samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp index ba8769d344a0..a4c4f1bf462b 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/api/UserApi.h rename to samples/client/petstore/cpp-restsdk/client/api/UserApi.h index fc76cfc91773..aa840cf1f900 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/git_push.sh b/samples/client/petstore/cpp-restsdk/client/git_push.sh similarity index 100% rename from samples/client/petstore/cpp-restsdk/git_push.sh rename to samples/client/petstore/cpp-restsdk/client/git_push.sh diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp similarity index 97% rename from samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp rename to samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp index 4122b863fb64..3fa6061fb049 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h similarity index 94% rename from samples/client/petstore/cpp-restsdk/model/ApiResponse.h rename to samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h index 83115c794ab9..9b1d7abc1a72 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Category.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Category.cpp index ad6422cb906a..8d21469964cd 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.h b/samples/client/petstore/cpp-restsdk/client/model/Category.h similarity index 94% rename from samples/client/petstore/cpp-restsdk/model/Category.h rename to samples/client/petstore/cpp-restsdk/client/model/Category.h index 026ec8607287..1d425850a5bb 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/model/Order.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Order.cpp index a15f779237c4..e137a045fa60 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.h b/samples/client/petstore/cpp-restsdk/client/model/Order.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Order.h rename to samples/client/petstore/cpp-restsdk/client/model/Order.h index c5d4153cfcdb..9d6975874041 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/model/Pet.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Pet.cpp index 6e4ebb69c4d7..76a39be3db67 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/model/Pet.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Pet.h rename to samples/client/petstore/cpp-restsdk/client/model/Pet.h index 881685336df5..3ebb80bf285a 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Tag.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Tag.cpp index 9f5f5b14636c..a4af089387e2 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/model/Tag.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/model/Tag.h rename to samples/client/petstore/cpp-restsdk/client/model/Tag.h index 9df0f2c2e7e9..db92cc2549c9 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/model/User.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/model/User.cpp rename to samples/client/petstore/cpp-restsdk/client/model/User.cpp index 93a64fbb3604..8ffd2ea50d08 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/User.cpp @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.h b/samples/client/petstore/cpp-restsdk/client/model/User.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/User.h rename to samples/client/petstore/cpp-restsdk/client/model/User.h index 851dcc57a25f..e3a970cb4df7 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/model/User.h @@ -2,9 +2,9 @@ * 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. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/pom.xml b/samples/client/petstore/cpp-restsdk/client/pom.xml similarity index 100% rename from samples/client/petstore/cpp-restsdk/pom.xml rename to samples/client/petstore/cpp-restsdk/client/pom.xml diff --git a/samples/client/petstore/cpp-restsdk/main.cpp b/samples/client/petstore/cpp-restsdk/main.cpp new file mode 100644 index 000000000000..27ca41ceb641 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/main.cpp @@ -0,0 +1,6 @@ +#include "PetApiTests.h" + +int main(int argc, char *argv[]) { + auto petTest = std::make_shared(); + petTest->runTests(); +} From 5fcb05917d0d42cdc339ce0b54a408e61aefb7de Mon Sep 17 00:00:00 2001 From: etherealjoy Date: Fri, 7 Jun 2019 22:06:45 +0200 Subject: [PATCH 2/2] Update after review --- samples/client/petstore/cpp-restsdk/PetApiTests.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/client/petstore/cpp-restsdk/PetApiTests.cpp b/samples/client/petstore/cpp-restsdk/PetApiTests.cpp index 934fad9cfe87..c8a1bdad1a09 100644 --- a/samples/client/petstore/cpp-restsdk/PetApiTests.cpp +++ b/samples/client/petstore/cpp-restsdk/PetApiTests.cpp @@ -28,12 +28,12 @@ void OAIPetApiTests::testAddPet(){ req->setName("cpprest-pet"); req->setStatus(U("123")); - std::function f = []() + std::function responseCallback = []() { std::cout << "added pet successfully" << std::endl; }; - auto reqTask = api->addPet(req).then(f); + auto reqTask = api->addPet(req).then(responseCallback); try{ reqTask.wait(); } @@ -49,7 +49,7 @@ void OAIPetApiTests::testAddPet(){ void OAIPetApiTests::testFindPetsByStatus(){ auto req = std::vector(); - req.push_back(U("pending")); + req.push_back(U("123")); auto reqTask = api->findPetsByStatus(req) .then([=](std::vector> pets) { @@ -70,9 +70,9 @@ void OAIPetApiTests::testFindPetsByStatus(){ void OAIPetApiTests::testGetPetById(){ int req = 12345; - auto f = std::bind(&OAIPetApiTests::getPetByIdCallback, this, std::placeholders::_1); + auto responseCallback = std::bind(&OAIPetApiTests::getPetByIdCallback, this, std::placeholders::_1); - auto reqTask = api->getPetById(req).then(f); + auto reqTask = api->getPetById(req).then(responseCallback); try{ reqTask.wait();