From d3fb88a65d9bb8fe474f086ab8175f95b1fe2077 Mon Sep 17 00:00:00 2001 From: Guilherme Werner Date: Wed, 28 May 2025 13:56:37 -0300 Subject: [PATCH] Generate project with openapi generator --- .gitattributes | 1 + .gitignore | 1 + .openapi-generator-ignore | 2 + .openapi-generator/FILES | 108 +- CMakeLists.txt | 104 - Config.cmake.in | 5 - bootstrap.ps1 | 3 + include/tribufu++/AnyType.h | 55 + include/tribufu++/ApiClient.h | 111 + include/tribufu++/ApiConfiguration.h | 63 + include/tribufu++/ApiException.h | 57 + include/tribufu++/HttpContent.h | 66 + include/tribufu++/IHttpBody.h | 39 + include/tribufu++/JsonBody.h | 46 + include/tribufu++/ModelBase.h | 502 + include/tribufu++/MultipartFormData.h | 58 + include/tribufu++/Object.h | 59 + include/tribufu++/api/TribufuGeneratedApi.h | 844 ++ include/tribufu++/model/Account.h | 130 + include/tribufu++/model/Application.h | 225 + include/tribufu++/model/ApplicationType.h | 64 + include/tribufu++/model/AuthorizeRequest.h | 122 + include/tribufu++/model/CodeChallengeMethod.h | 64 + include/tribufu++/model/CryptoViewModel.h | 79 + include/tribufu++/model/Game.h | 313 + include/tribufu++/model/GameServer.h | 313 + include/tribufu++/model/GameServerCluster.h | 175 + include/tribufu++/model/GrantType.h | 66 + include/tribufu++/model/Group.h | 191 + include/tribufu++/model/GroupGame.h | 124 + include/tribufu++/model/GroupMember.h | 137 + include/tribufu++/model/GroupRank.h | 65 + include/tribufu++/model/HashViewModel.h | 71 + include/tribufu++/model/IntrospectRequest.h | 81 + include/tribufu++/model/IpAddress.h | 207 + include/tribufu++/model/LeaderboardItem.h | 111 + include/tribufu++/model/LeaderboardOrder.h | 64 + include/tribufu++/model/LoginProvider.h | 69 + include/tribufu++/model/LoginRequest.h | 79 + include/tribufu++/model/LoginResponse.h | 97 + include/tribufu++/model/Package.h | 159 + include/tribufu++/model/Profile.h | 207 + include/tribufu++/model/ProfileGame.h | 152 + include/tribufu++/model/ProfileGroup.h | 145 + include/tribufu++/model/RefreshRequest.h | 71 + include/tribufu++/model/RegisterRequest.h | 95 + include/tribufu++/model/ResponseType.h | 64 + include/tribufu++/model/RevokeRequest.h | 81 + include/tribufu++/model/SearchRequest.h | 97 + include/tribufu++/model/SearchType.h | 66 + include/tribufu++/model/ServerMetrics.h | 86 + include/tribufu++/model/ServerStatus.h | 65 + include/tribufu++/model/Subscription.h | 120 + include/tribufu++/model/TokenHintType.h | 64 + include/tribufu++/model/TokenRequest.h | 129 + include/tribufu++/model/TokenResponse.h | 113 + include/tribufu++/model/TokenType.h | 63 + include/tribufu++/model/UpdateProfile.h | 79 + include/tribufu++/model/UserInfo.h | 265 + include/tribufu++/model/UserType.h | 64 + scripts/cmake.ps1 | 7 + scripts/generate.ps1 | 2 +- scripts/gmake.sh | 7 - src/AnyType.cpp | 49 + src/ApiClient.cpp | 205 + src/ApiConfiguration.cpp | 82 + src/ApiException.cpp | 50 + src/HttpContent.cpp | 83 + src/JsonBody.cpp | 33 + src/ModelBase.cpp | 662 ++ src/MultipartFormData.cpp | 109 + src/Object.cpp | 88 + src/api/TribufuGeneratedApi.cpp | 9845 +++++++++++++++++ src/model/Account.cpp | 461 + src/model/Application.cpp | 1045 ++ src/model/ApplicationType.cpp | 118 + src/model/AuthorizeRequest.cpp | 413 + src/model/CodeChallengeMethod.cpp | 118 + src/model/CryptoViewModel.cpp | 170 + src/model/Game.cpp | 1577 +++ src/model/GameServer.cpp | 1581 +++ src/model/GameServerCluster.cpp | 756 ++ src/model/GrantType.cpp | 126 + src/model/Group.cpp | 850 ++ src/model/GroupGame.cpp | 412 + src/model/GroupMember.cpp | 511 + src/model/GroupRank.cpp | 122 + src/model/HashViewModel.cpp | 121 + src/model/IntrospectRequest.cpp | 169 + src/model/IpAddress.cpp | 950 ++ src/model/LeaderboardItem.cpp | 363 + src/model/LeaderboardOrder.cpp | 118 + src/model/LoginProvider.cpp | 138 + src/model/LoginRequest.cpp | 170 + src/model/LoginResponse.cpp | 266 + src/model/Package.cpp | 658 ++ src/model/Profile.cpp | 947 ++ src/model/ProfileGame.cpp | 607 + src/model/ProfileGroup.cpp | 558 + src/model/RefreshRequest.cpp | 121 + src/model/RegisterRequest.cpp | 268 + src/model/ResponseType.cpp | 118 + src/model/RevokeRequest.cpp | 169 + src/model/SearchRequest.cpp | 266 + src/model/SearchType.cpp | 126 + src/model/ServerMetrics.cpp | 216 + src/model/ServerStatus.cpp | 122 + src/model/Subscription.cpp | 413 + src/model/TokenHintType.cpp | 118 + src/model/TokenRequest.cpp | 463 + src/model/TokenResponse.cpp | 364 + src/model/TokenType.cpp | 114 + src/model/UpdateProfile.cpp | 170 + src/model/UserInfo.cpp | 1289 +++ src/model/UserType.cpp | 118 + src/premake5.lua | 27 +- 116 files changed, 36001 insertions(+), 184 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 Config.cmake.in create mode 100644 include/tribufu++/AnyType.h create mode 100644 include/tribufu++/ApiClient.h create mode 100644 include/tribufu++/ApiConfiguration.h create mode 100644 include/tribufu++/ApiException.h create mode 100644 include/tribufu++/HttpContent.h create mode 100644 include/tribufu++/IHttpBody.h create mode 100644 include/tribufu++/JsonBody.h create mode 100644 include/tribufu++/ModelBase.h create mode 100644 include/tribufu++/MultipartFormData.h create mode 100644 include/tribufu++/Object.h create mode 100644 include/tribufu++/api/TribufuGeneratedApi.h create mode 100644 include/tribufu++/model/Account.h create mode 100644 include/tribufu++/model/Application.h create mode 100644 include/tribufu++/model/ApplicationType.h create mode 100644 include/tribufu++/model/AuthorizeRequest.h create mode 100644 include/tribufu++/model/CodeChallengeMethod.h create mode 100644 include/tribufu++/model/CryptoViewModel.h create mode 100644 include/tribufu++/model/Game.h create mode 100644 include/tribufu++/model/GameServer.h create mode 100644 include/tribufu++/model/GameServerCluster.h create mode 100644 include/tribufu++/model/GrantType.h create mode 100644 include/tribufu++/model/Group.h create mode 100644 include/tribufu++/model/GroupGame.h create mode 100644 include/tribufu++/model/GroupMember.h create mode 100644 include/tribufu++/model/GroupRank.h create mode 100644 include/tribufu++/model/HashViewModel.h create mode 100644 include/tribufu++/model/IntrospectRequest.h create mode 100644 include/tribufu++/model/IpAddress.h create mode 100644 include/tribufu++/model/LeaderboardItem.h create mode 100644 include/tribufu++/model/LeaderboardOrder.h create mode 100644 include/tribufu++/model/LoginProvider.h create mode 100644 include/tribufu++/model/LoginRequest.h create mode 100644 include/tribufu++/model/LoginResponse.h create mode 100644 include/tribufu++/model/Package.h create mode 100644 include/tribufu++/model/Profile.h create mode 100644 include/tribufu++/model/ProfileGame.h create mode 100644 include/tribufu++/model/ProfileGroup.h create mode 100644 include/tribufu++/model/RefreshRequest.h create mode 100644 include/tribufu++/model/RegisterRequest.h create mode 100644 include/tribufu++/model/ResponseType.h create mode 100644 include/tribufu++/model/RevokeRequest.h create mode 100644 include/tribufu++/model/SearchRequest.h create mode 100644 include/tribufu++/model/SearchType.h create mode 100644 include/tribufu++/model/ServerMetrics.h create mode 100644 include/tribufu++/model/ServerStatus.h create mode 100644 include/tribufu++/model/Subscription.h create mode 100644 include/tribufu++/model/TokenHintType.h create mode 100644 include/tribufu++/model/TokenRequest.h create mode 100644 include/tribufu++/model/TokenResponse.h create mode 100644 include/tribufu++/model/TokenType.h create mode 100644 include/tribufu++/model/UpdateProfile.h create mode 100644 include/tribufu++/model/UserInfo.h create mode 100644 include/tribufu++/model/UserType.h create mode 100644 scripts/cmake.ps1 create mode 100644 src/AnyType.cpp create mode 100644 src/ApiClient.cpp create mode 100644 src/ApiConfiguration.cpp create mode 100644 src/ApiException.cpp create mode 100644 src/HttpContent.cpp create mode 100644 src/JsonBody.cpp create mode 100644 src/ModelBase.cpp create mode 100644 src/MultipartFormData.cpp create mode 100644 src/Object.cpp create mode 100644 src/api/TribufuGeneratedApi.cpp create mode 100644 src/model/Account.cpp create mode 100644 src/model/Application.cpp create mode 100644 src/model/ApplicationType.cpp create mode 100644 src/model/AuthorizeRequest.cpp create mode 100644 src/model/CodeChallengeMethod.cpp create mode 100644 src/model/CryptoViewModel.cpp create mode 100644 src/model/Game.cpp create mode 100644 src/model/GameServer.cpp create mode 100644 src/model/GameServerCluster.cpp create mode 100644 src/model/GrantType.cpp create mode 100644 src/model/Group.cpp create mode 100644 src/model/GroupGame.cpp create mode 100644 src/model/GroupMember.cpp create mode 100644 src/model/GroupRank.cpp create mode 100644 src/model/HashViewModel.cpp create mode 100644 src/model/IntrospectRequest.cpp create mode 100644 src/model/IpAddress.cpp create mode 100644 src/model/LeaderboardItem.cpp create mode 100644 src/model/LeaderboardOrder.cpp create mode 100644 src/model/LoginProvider.cpp create mode 100644 src/model/LoginRequest.cpp create mode 100644 src/model/LoginResponse.cpp create mode 100644 src/model/Package.cpp create mode 100644 src/model/Profile.cpp create mode 100644 src/model/ProfileGame.cpp create mode 100644 src/model/ProfileGroup.cpp create mode 100644 src/model/RefreshRequest.cpp create mode 100644 src/model/RegisterRequest.cpp create mode 100644 src/model/ResponseType.cpp create mode 100644 src/model/RevokeRequest.cpp create mode 100644 src/model/SearchRequest.cpp create mode 100644 src/model/SearchType.cpp create mode 100644 src/model/ServerMetrics.cpp create mode 100644 src/model/ServerStatus.cpp create mode 100644 src/model/Subscription.cpp create mode 100644 src/model/TokenHintType.cpp create mode 100644 src/model/TokenRequest.cpp create mode 100644 src/model/TokenResponse.cpp create mode 100644 src/model/TokenType.cpp create mode 100644 src/model/UpdateProfile.cpp create mode 100644 src/model/UserInfo.cpp create mode 100644 src/model/UserType.cpp diff --git a/.gitattributes b/.gitattributes index 6313b56c..5bc314da 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ * text=auto eol=lf +vendor/** linguist-vendored diff --git a/.gitignore b/.gitignore index 900b65c6..10aa2f78 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .vscode/ bin/ target/ +vendor/ .DS_Store .env diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 2d52b312..dee3576a 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -1,5 +1,7 @@ docs/ .gitignore +CMakeLists.txt +Config.cmake.in git_push.sh README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bfe436cd..203d398a 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,58 +1,56 @@ -CMakeLists.txt -Config.cmake.in -include/tribufu/AnyType.h -include/tribufu/ApiClient.h -include/tribufu/ApiConfiguration.h -include/tribufu/ApiException.h -include/tribufu/HttpContent.h -include/tribufu/IHttpBody.h -include/tribufu/JsonBody.h -include/tribufu/ModelBase.h -include/tribufu/MultipartFormData.h -include/tribufu/Object.h -include/tribufu/api/TribufuGeneratedApi.h -include/tribufu/model/Account.h -include/tribufu/model/Application.h -include/tribufu/model/ApplicationType.h -include/tribufu/model/AuthorizeRequest.h -include/tribufu/model/CodeChallengeMethod.h -include/tribufu/model/CryptoViewModel.h -include/tribufu/model/Game.h -include/tribufu/model/GameServer.h -include/tribufu/model/GameServerCluster.h -include/tribufu/model/GrantType.h -include/tribufu/model/Group.h -include/tribufu/model/GroupGame.h -include/tribufu/model/GroupMember.h -include/tribufu/model/GroupRank.h -include/tribufu/model/HashViewModel.h -include/tribufu/model/IntrospectRequest.h -include/tribufu/model/IpAddress.h -include/tribufu/model/LeaderboardItem.h -include/tribufu/model/LeaderboardOrder.h -include/tribufu/model/LoginProvider.h -include/tribufu/model/LoginRequest.h -include/tribufu/model/LoginResponse.h -include/tribufu/model/Package.h -include/tribufu/model/Profile.h -include/tribufu/model/ProfileGame.h -include/tribufu/model/ProfileGroup.h -include/tribufu/model/RefreshRequest.h -include/tribufu/model/RegisterRequest.h -include/tribufu/model/ResponseType.h -include/tribufu/model/RevokeRequest.h -include/tribufu/model/SearchRequest.h -include/tribufu/model/SearchType.h -include/tribufu/model/ServerMetrics.h -include/tribufu/model/ServerStatus.h -include/tribufu/model/Subscription.h -include/tribufu/model/TokenHintType.h -include/tribufu/model/TokenRequest.h -include/tribufu/model/TokenResponse.h -include/tribufu/model/TokenType.h -include/tribufu/model/UpdateProfile.h -include/tribufu/model/UserInfo.h -include/tribufu/model/UserType.h +include/tribufu++/AnyType.h +include/tribufu++/ApiClient.h +include/tribufu++/ApiConfiguration.h +include/tribufu++/ApiException.h +include/tribufu++/HttpContent.h +include/tribufu++/IHttpBody.h +include/tribufu++/JsonBody.h +include/tribufu++/ModelBase.h +include/tribufu++/MultipartFormData.h +include/tribufu++/Object.h +include/tribufu++/api/TribufuGeneratedApi.h +include/tribufu++/model/Account.h +include/tribufu++/model/Application.h +include/tribufu++/model/ApplicationType.h +include/tribufu++/model/AuthorizeRequest.h +include/tribufu++/model/CodeChallengeMethod.h +include/tribufu++/model/CryptoViewModel.h +include/tribufu++/model/Game.h +include/tribufu++/model/GameServer.h +include/tribufu++/model/GameServerCluster.h +include/tribufu++/model/GrantType.h +include/tribufu++/model/Group.h +include/tribufu++/model/GroupGame.h +include/tribufu++/model/GroupMember.h +include/tribufu++/model/GroupRank.h +include/tribufu++/model/HashViewModel.h +include/tribufu++/model/IntrospectRequest.h +include/tribufu++/model/IpAddress.h +include/tribufu++/model/LeaderboardItem.h +include/tribufu++/model/LeaderboardOrder.h +include/tribufu++/model/LoginProvider.h +include/tribufu++/model/LoginRequest.h +include/tribufu++/model/LoginResponse.h +include/tribufu++/model/Package.h +include/tribufu++/model/Profile.h +include/tribufu++/model/ProfileGame.h +include/tribufu++/model/ProfileGroup.h +include/tribufu++/model/RefreshRequest.h +include/tribufu++/model/RegisterRequest.h +include/tribufu++/model/ResponseType.h +include/tribufu++/model/RevokeRequest.h +include/tribufu++/model/SearchRequest.h +include/tribufu++/model/SearchType.h +include/tribufu++/model/ServerMetrics.h +include/tribufu++/model/ServerStatus.h +include/tribufu++/model/Subscription.h +include/tribufu++/model/TokenHintType.h +include/tribufu++/model/TokenRequest.h +include/tribufu++/model/TokenResponse.h +include/tribufu++/model/TokenType.h +include/tribufu++/model/UpdateProfile.h +include/tribufu++/model/UserInfo.h +include/tribufu++/model/UserType.h src/AnyType.cpp src/ApiClient.cpp src/ApiConfiguration.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 821b5678..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,104 +0,0 @@ -# -# Tribufu API -# REST API to access Tribufu services. -# -# 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 3.5) - -project(tribufu 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) -if(NOT CMAKE_CXX_STANDARD) - 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) - set(CMAKE_BUILD_TYPE Release) -endif() - -find_package(cpprestsdk REQUIRED) -find_package(Boost REQUIRED) - -include(GNUInstallDirs) -include(CMakePackageConfigHelpers) - -file(GLOB_RECURSE HEADER_FILES "include/*.h") -file(GLOB_RECURSE SOURCE_FILES "src/*.cpp") - -add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) - -target_compile_options(${PROJECT_NAME} - PRIVATE - $<$,$,$>: - -Wall -Wno-unused-variable -Wno-unused-lambda-capture> -) - -target_include_directories(${PROJECT_NAME} - PUBLIC - $ - $ -) - -if (UNIX) - message(STATUS "Building client library for Linux/Unix") - if (BUILD_SHARED_LIBS) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) - else() - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest crypto) - endif() -else() - message(STATUS "Building client library for Windows") - if (BUILD_SHARED_LIBS) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) - else() - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest bcrypt) - endif() -endif() - -configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" -) - -install( - TARGETS ${PROJECT_NAME} - EXPORT ${PROJECT_NAME}Targets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" -) - -install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) - -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} -) - -install( - EXPORT ${PROJECT_NAME}Targets - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} -) diff --git a/Config.cmake.in b/Config.cmake.in deleted file mode 100644 index 9015c2ba..00000000 --- a/Config.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -@PACKAGE_INIT@ - -include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake) - -check_required_components("@PROJECT_NAME@") diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 7fc2aaea..4d28db02 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -1,5 +1,8 @@ #!/usr/bin/env pwsh +$env:VCPKG_ROOT = "D:\Program Files\vcpkg" +$env:PATH = "$env:VCPKG_ROOT;$env:PATH" + git submodule update --init --recursive if ($IsWindows) diff --git a/include/tribufu++/AnyType.h b/include/tribufu++/AnyType.h new file mode 100644 index 00000000..0a4336e6 --- /dev/null +++ b/include/tribufu++/AnyType.h @@ -0,0 +1,55 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * AnyType.h + * + * This is the implementation of an any JSON type. + */ + +#ifndef TRIBUFU_MODELS_AnyType_H_ +#define TRIBUFU_MODELS_AnyType_H_ + + +#include "tribufu++/Object.h" + +#include +#include + +namespace tribufu { +namespace models { + +class AnyType : public Object { +public: + AnyType(); + virtual ~AnyType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value &json) override; + + void toMultipart(std::shared_ptr multipart, + const utility::string_t &namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, + const utility::string_t &namePrefix) override; + +private: + web::json::value m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_AnyType_H_ */ diff --git a/include/tribufu++/ApiClient.h b/include/tribufu++/ApiClient.h new file mode 100644 index 00000000..e24111d6 --- /dev/null +++ b/include/tribufu++/ApiClient.h @@ -0,0 +1,111 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ApiClient.h + * + * This is an API client responsible for stating the HTTP calls + */ + +#ifndef TRIBUFU_API_ApiClient_H_ +#define TRIBUFU_API_ApiClient_H_ + + +#include "tribufu++/ApiConfiguration.h" +#include "tribufu++/ApiException.h" +#include "tribufu++/IHttpBody.h" +#include "tribufu++/HttpContent.h" + +#if defined (_WIN32) || defined (_WIN64) +#undef U +#endif + +#include +#include + +#include +#include +#include + +namespace tribufu { +namespace api { + +using namespace tribufu::models; + +class ApiClient +{ +public: + ApiClient( std::shared_ptr configuration = nullptr ); + virtual ~ApiClient(); + + typedef std::function ResponseHandlerType; + + const ResponseHandlerType& getResponseHandler() const; + void setResponseHandler(const ResponseHandlerType& responseHandler); + + std::shared_ptr getConfiguration() const; + void setConfiguration(std::shared_ptr configuration); + + static utility::string_t parameterToString(utility::string_t value); + static utility::string_t parameterToString(int32_t value); + static utility::string_t parameterToString(int64_t value); + static utility::string_t parameterToString(float value); + static utility::string_t parameterToString(double value); + static utility::string_t parameterToString(const utility::datetime &value); + static utility::string_t parameterToString(bool value); + template + static utility::string_t parameterToString(const std::vector& value); + template + static utility::string_t parameterToString(const std::shared_ptr& value); + + pplx::task callApi( + const utility::string_t& path, + const utility::string_t& method, + const std::map& queryParams, + const std::shared_ptr postBody, + const std::map& headerParams, + const std::map& formParams, + const std::map>& fileParams, + const utility::string_t& contentType + ) const; + +protected: + + ResponseHandlerType m_ResponseHandler; + std::shared_ptr m_Configuration; +}; + +template +utility::string_t ApiClient::parameterToString(const std::vector& value) +{ + utility::stringstream_t ss; + + for( size_t i = 0; i < value.size(); i++) + { + if( i > 0) ss << utility::conversions::to_string_t(", "); + ss << ApiClient::parameterToString(value[i]); + } + + return ss.str(); +} + +template +utility::string_t ApiClient::parameterToString(const std::shared_ptr& value) +{ + return parameterToString(*value.get()); +} + + +} +} + +#endif /* TRIBUFU_API_ApiClient_H_ */ diff --git a/include/tribufu++/ApiConfiguration.h b/include/tribufu++/ApiConfiguration.h new file mode 100644 index 00000000..ef87ff14 --- /dev/null +++ b/include/tribufu++/ApiConfiguration.h @@ -0,0 +1,63 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ApiConfiguration.h + * + * This class represents a single item of a multipart-formdata request. + */ + +#ifndef TRIBUFU_API_ApiConfiguration_H_ +#define TRIBUFU_API_ApiConfiguration_H_ + + + +#include +#include + +#include + +namespace tribufu { +namespace api { + +class ApiConfiguration +{ +public: + ApiConfiguration(); + virtual ~ApiConfiguration(); + + const web::http::client::http_client_config& getHttpConfig() const; + void setHttpConfig( web::http::client::http_client_config& value ); + + utility::string_t getBaseUrl() const; + void setBaseUrl( const utility::string_t value ); + + utility::string_t getUserAgent() const; + void setUserAgent( const utility::string_t value ); + + std::map& getDefaultHeaders(); + const std::map& getDefaultHeaders() const; + + utility::string_t getApiKey( const utility::string_t& prefix) const; + void setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey ); + +protected: + utility::string_t m_BaseUrl; + std::map m_DefaultHeaders; + std::map m_ApiKeys; + web::http::client::http_client_config m_HttpConfig; + utility::string_t m_UserAgent; +}; + +} +} +#endif /* TRIBUFU_API_ApiConfiguration_H_ */ diff --git a/include/tribufu++/ApiException.h b/include/tribufu++/ApiException.h new file mode 100644 index 00000000..5bb141fc --- /dev/null +++ b/include/tribufu++/ApiException.h @@ -0,0 +1,57 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ApiException.h + * + * This is the exception being thrown in case the api call was not successful + */ + +#ifndef TRIBUFU_API_ApiException_H_ +#define TRIBUFU_API_ApiException_H_ + + + +#include +#include + +#include +#include + +namespace tribufu { +namespace api { + +class ApiException + : public web::http::http_exception +{ +public: + ApiException( int errorCode + , const utility::string_t& message + , std::shared_ptr content = nullptr ); + ApiException( int errorCode + , const utility::string_t& message + , std::map& headers + , std::shared_ptr content = nullptr ); + virtual ~ApiException(); + + std::map& getHeaders(); + std::shared_ptr getContent() const; + +protected: + std::shared_ptr m_Content; + std::map m_Headers; +}; + +} +} + +#endif /* TRIBUFU_API_ApiBase_H_ */ diff --git a/include/tribufu++/HttpContent.h b/include/tribufu++/HttpContent.h new file mode 100644 index 00000000..093b1d81 --- /dev/null +++ b/include/tribufu++/HttpContent.h @@ -0,0 +1,66 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * HttpContent.h + * + * This class represents a single item of a multipart-formdata request. + */ + +#ifndef TRIBUFU_MODELS_HttpContent_H_ +#define TRIBUFU_MODELS_HttpContent_H_ + + + +#include + +#include + +namespace tribufu { +namespace models { + +class HttpContent +{ +public: + HttpContent(); + virtual ~HttpContent(); + + virtual utility::string_t getContentDisposition() const; + virtual void setContentDisposition( const utility::string_t& value ); + + virtual utility::string_t getName() const; + virtual void setName( const utility::string_t& value ); + + virtual utility::string_t getFileName() const; + virtual void setFileName( const utility::string_t& value ); + + virtual utility::string_t getContentType() const; + virtual void setContentType( const utility::string_t& value ); + + virtual std::shared_ptr getData() const; + virtual void setData( std::shared_ptr value ); + + virtual void writeTo( std::ostream& stream ); + +protected: + // NOTE: no utility::string_t here because those strings can only contain ascii + utility::string_t m_ContentDisposition; + utility::string_t m_Name; + utility::string_t m_FileName; + utility::string_t m_ContentType; + std::shared_ptr m_Data; +}; + +} +} + +#endif /* TRIBUFU_MODELS_HttpContent_H_ */ diff --git a/include/tribufu++/IHttpBody.h b/include/tribufu++/IHttpBody.h new file mode 100644 index 00000000..cdb50fa5 --- /dev/null +++ b/include/tribufu++/IHttpBody.h @@ -0,0 +1,39 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * IHttpBody.h + * + * This is the interface for contents that can be sent to a remote HTTP server. + */ + +#ifndef TRIBUFU_MODELS_IHttpBody_H_ +#define TRIBUFU_MODELS_IHttpBody_H_ + + +#include + +namespace tribufu { +namespace models { + +class IHttpBody +{ +public: + virtual ~IHttpBody() { } + + virtual void writeTo( std::ostream& stream ) = 0; +}; + +} +} + +#endif /* TRIBUFU_MODELS_IHttpBody_H_ */ diff --git a/include/tribufu++/JsonBody.h b/include/tribufu++/JsonBody.h new file mode 100644 index 00000000..ab094917 --- /dev/null +++ b/include/tribufu++/JsonBody.h @@ -0,0 +1,46 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * JsonBody.h + * + * This is a JSON http body which can be submitted via http + */ + +#ifndef TRIBUFU_MODELS_JsonBody_H_ +#define TRIBUFU_MODELS_JsonBody_H_ + + +#include "tribufu++/IHttpBody.h" + +#include + +namespace tribufu { +namespace models { + +class JsonBody + : public IHttpBody +{ +public: + JsonBody( const web::json::value& value ); + virtual ~JsonBody(); + + void writeTo( std::ostream& target ) override; + +protected: + web::json::value m_Json; +}; + +} +} + +#endif /* TRIBUFU_MODELS_JsonBody_H_ */ diff --git a/include/tribufu++/ModelBase.h b/include/tribufu++/ModelBase.h new file mode 100644 index 00000000..cb78e844 --- /dev/null +++ b/include/tribufu++/ModelBase.h @@ -0,0 +1,502 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ModelBase.h + * + * This is the base class for all model classes + */ + +#ifndef TRIBUFU_MODELS_ModelBase_H_ +#define TRIBUFU_MODELS_ModelBase_H_ + + + +#include "tribufu++/HttpContent.h" +#include "tribufu++/MultipartFormData.h" + +#include +#include + +#include +#include +#include + +namespace tribufu { +namespace models { + +class ModelBase +{ +public: + ModelBase(); + virtual ~ModelBase(); + + virtual void validate() = 0; + + virtual web::json::value toJson() const = 0; + virtual bool fromJson( const web::json::value& json ) = 0; + + virtual void toMultipart( std::shared_ptr multipart, const utility::string_t& namePrefix ) const = 0; + virtual bool fromMultiPart( std::shared_ptr multipart, const utility::string_t& namePrefix ) = 0; + + virtual bool isSet() const; + + static utility::string_t toString( const bool val ); + static utility::string_t toString( const float val ); + static utility::string_t toString( const double val ); + static utility::string_t toString( const int32_t val ); + static utility::string_t toString( const int64_t val ); + static utility::string_t toString( const utility::string_t &val ); + static utility::string_t toString( const utility::datetime &val ); + static utility::string_t toString( const web::json::value &val ); + static utility::string_t toString( const std::shared_ptr& val ); + template + static utility::string_t toString( const std::shared_ptr& val ); + template + static utility::string_t toString( const std::vector & val ); + template + static utility::string_t toString( const std::set & val ); + + static web::json::value toJson( bool val ); + static web::json::value toJson( float val ); + static web::json::value toJson( double val ); + static web::json::value toJson( int32_t val ); + static web::json::value toJson( int64_t val ); + static web::json::value toJson( const utility::string_t& val ); + static web::json::value toJson( const utility::datetime& val ); + static web::json::value toJson( const web::json::value& val ); + static web::json::value toJson( const std::shared_ptr& val ); + template + static web::json::value toJson( const std::shared_ptr& val ); + static web::json::value toJson( const std::shared_ptr& val ); + template + static web::json::value toJson( const std::vector& val ); + template + static web::json::value toJson( const std::set& val ); + template + static web::json::value toJson( const std::map& val ); + + static bool fromString( const utility::string_t& val, bool & ); + static bool fromString( const utility::string_t& val, float & ); + static bool fromString( const utility::string_t& val, double & ); + static bool fromString( const utility::string_t& val, int32_t & ); + static bool fromString( const utility::string_t& val, int64_t & ); + static bool fromString( const utility::string_t& val, utility::string_t & ); + static bool fromString( const utility::string_t& val, utility::datetime & ); + static bool fromString( const utility::string_t& val, web::json::value & ); + static bool fromString( const utility::string_t& val, std::shared_ptr & ); + template + static bool fromString( const utility::string_t& val, std::shared_ptr& ); + static bool fromString( const utility::string_t& val, std::shared_ptr& outVal ); + template + static bool fromString( const utility::string_t& val, std::vector & ); + template + static bool fromString( const utility::string_t& val, std::set & ); + template + static bool fromString( const utility::string_t& val, std::map & ); + + static bool fromJson( const web::json::value& val, bool & ); + static bool fromJson( const web::json::value& val, float & ); + static bool fromJson( const web::json::value& val, double & ); + static bool fromJson( const web::json::value& val, int32_t & ); + static bool fromJson( const web::json::value& val, int64_t & ); + static bool fromJson( const web::json::value& val, utility::string_t & ); + static bool fromJson( const web::json::value& val, utility::datetime & ); + static bool fromJson( const web::json::value& val, web::json::value & ); + static bool fromJson( const web::json::value& val, std::shared_ptr & ); + template + static bool fromJson( const web::json::value& val, std::shared_ptr& ); + static bool fromJson( const web::json::value& val, std::shared_ptr &outVal ); + template + static bool fromJson( const web::json::value& val, std::vector & ); + template + static bool fromJson( const web::json::value& val, std::set & ); + template + static bool fromJson( const web::json::value& val, std::map & ); + + + static std::shared_ptr toHttpContent( const utility::string_t& name, bool value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + static std::shared_ptr toHttpContent( const utility::string_t& name, float value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + static std::shared_ptr toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + static std::shared_ptr toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + static std::shared_ptr toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + static std::shared_ptr toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType = utility::conversions::to_string_t("")); + static std::shared_ptr toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType = utility::conversions::to_string_t("")); + static std::shared_ptr toHttpContent( const utility::string_t& name, const web::json::value& value, const utility::string_t& contentType = utility::conversions::to_string_t("application/json") ); + static std::shared_ptr toHttpContent( const utility::string_t& name, const std::shared_ptr& ); + template + static std::shared_ptr toHttpContent( const utility::string_t& name, const std::shared_ptr& , const utility::string_t& contentType = utility::conversions::to_string_t("application/json") ); + static std::shared_ptr toHttpContent(const utility::string_t& name, const std::shared_ptr& value , const utility::string_t& contentType = utility::conversions::to_string_t("application/json") ); + template + static std::shared_ptr toHttpContent( const utility::string_t& name, const std::vector& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + template + static std::shared_ptr toHttpContent( const utility::string_t& name, const std::set& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + template + static std::shared_ptr toHttpContent( const utility::string_t& name, const std::map& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); + + static bool fromHttpContent( std::shared_ptr val, bool & ); + static bool fromHttpContent( std::shared_ptr val, float & ); + static bool fromHttpContent( std::shared_ptr val, double & ); + static bool fromHttpContent( std::shared_ptr val, int64_t & ); + static bool fromHttpContent( std::shared_ptr val, int32_t & ); + static bool fromHttpContent( std::shared_ptr val, utility::string_t & ); + static bool fromHttpContent( std::shared_ptr val, utility::datetime & ); + static bool fromHttpContent( std::shared_ptr val, web::json::value & ); + static bool fromHttpContent( std::shared_ptr val, std::shared_ptr& ); + template + static bool fromHttpContent( std::shared_ptr val, std::shared_ptr& ); + template + static bool fromHttpContent( std::shared_ptr val, std::vector & ); + template + static bool fromHttpContent( std::shared_ptr val, std::set & ); + template + static bool fromHttpContent( std::shared_ptr val, std::map & ); + + static utility::string_t toBase64( utility::string_t value ); + static utility::string_t toBase64( std::shared_ptr value ); + static std::shared_ptr fromBase64( const utility::string_t& encoded ); +protected: + bool m_IsSet; +}; + +template +utility::string_t ModelBase::toString( const std::shared_ptr& val ) +{ + utility::stringstream_t ss; + if( val != nullptr ) + { + val->toJson().serialize(ss); + } + return utility::string_t(ss.str()); +} + +// std::vector to string +template +utility::string_t ModelBase::toString( const std::vector & val ) +{ + utility::string_t strArray; + for ( const auto &item : val ) + { + strArray.append( toString(item) + "," ); + } + if (val.count() > 0) + { + strArray.pop_back(); + } + return strArray; +} + +// std::set to string +template +utility::string_t ModelBase::toString( const std::set & val ) +{ + utility::string_t strArray; + for ( const auto &item : val ) + { + strArray.append( toString(item) + "," ); + } + if (val.count() > 0) + { + strArray.pop_back(); + } + return strArray; +} + + +template +web::json::value ModelBase::toJson( const std::shared_ptr& val ) +{ + web::json::value retVal; + if(val != nullptr) + { + retVal = val->toJson(); + } + return retVal; +} + +// std::vector to json +template +web::json::value ModelBase::toJson( const std::vector& value ) +{ + std::vector ret; + for ( const auto& x : value ) + { + ret.push_back( toJson(x) ); + } + return web::json::value::array(ret); +} + +// std::set to json +template +web::json::value ModelBase::toJson( const std::set& value ) +{ + // There's no prototype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array. + std::vector ret; + for ( const auto& x : value ) + { + ret.push_back( toJson(x) ); + } + return web::json::value::array(ret); +} + + +template +web::json::value ModelBase::toJson( const std::map& val ) +{ + web::json::value obj; + for ( const auto &itemkey : val ) + { + obj[itemkey.first] = toJson( itemkey.second ); + } + return obj; +} +template +bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr& outVal ) +{ + bool ok = false; + if(outVal == nullptr) + { + outVal = std::make_shared(); + } + if( outVal != nullptr ) + { + ok = outVal->fromJson(web::json::value::parse(val)); + } + return ok; +} +template +bool ModelBase::fromString(const utility::string_t& val, std::vector& outVal ) +{ + bool ok = true; + web::json::value jsonValue = web::json::value::parse(val); + if (jsonValue.is_array()) + { + for (const web::json::value& jitem : jsonValue.as_array()) + { + T item; + ok &= fromJson(jitem, item); + outVal.push_back(item); + } + } + else + { + T item; + ok = fromJson(jsonValue, item); + outVal.push_back(item); + } + return ok; +} +template +bool ModelBase::fromString(const utility::string_t& val, std::set& outVal ) +{ + bool ok = true; + web::json::value jsonValue = web::json::value::parse(val); + if (jsonValue.is_array()) + { + for (const web::json::value& jitem : jsonValue.as_array()) + { + T item; + ok &= fromJson(jitem, item); + outVal.insert(item); + } + } + else + { + T item; + ok = fromJson(jsonValue, item); + outVal.insert(item); + } + return ok; +} +template +bool ModelBase::fromString(const utility::string_t& val, std::map& outVal ) +{ + bool ok = false; + web::json::value jsonValue = web::json::value::parse(val); + if (jsonValue.is_array()) + { + for (const web::json::value& jitem : jsonValue.as_array()) + { + T item; + ok &= fromJson(jitem, item); + outVal.insert({ val, item }); + } + } + else + { + T item; + ok = fromJson(jsonValue, item); + outVal.insert({ val, item }); + } + return ok; +} +template +bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr &outVal ) +{ + bool ok = false; + if(outVal == nullptr) + { + outVal = std::make_shared(); + } + if( outVal != nullptr ) + { + ok = outVal->fromJson(val); + } + return ok; +} +template +bool ModelBase::fromJson( const web::json::value& val, std::vector &outVal ) +{ + bool ok = true; + if (val.is_array()) + { + for (const web::json::value & jitem : val.as_array()) + { + T item; + ok &= fromJson(jitem, item); + outVal.push_back(item); + } + } + else + { + ok = false; + } + return ok; +} +template +bool ModelBase::fromJson(const web::json::value& val, std::set& outVal ) +{ + bool ok = true; + if (val.is_array()) + { + for (const web::json::value& jitem : val.as_array()) + { + T item; + ok &= fromJson(jitem, item); + outVal.insert(item); + } + } + else + { + T item; + ok = fromJson(val, item); + outVal.insert(item); + } + return ok; +} +template +bool ModelBase::fromJson( const web::json::value& jval, std::map &outVal ) +{ + bool ok = true; + if ( jval.is_object() ) + { + auto obj = jval.as_object(); + for( auto objItr = obj.begin() ; objItr != obj.end() ; objItr++ ) + { + T itemVal; + ok &= fromJson(objItr->second, itemVal); + outVal.insert(std::pair(objItr->first, itemVal)); + } + } + else + { + ok = false; + } + return ok; +} +template +std::shared_ptr ModelBase::toHttpContent(const utility::string_t& name, const std::shared_ptr& value , const utility::string_t& contentType ) +{ + std::shared_ptr content = std::make_shared(); + if (value != nullptr ) + { + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::make_shared( utility::conversions::to_utf8string(value->toJson().serialize()) ) ); + } + return content; +} + +template +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::vector& value, const utility::string_t& contentType ) +{ + web::json::value json_array = ModelBase::toJson(value); + std::shared_ptr content = std::make_shared(); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::make_shared( utility::conversions::to_utf8string(json_array.serialize()) ) ); + return content; +} +template +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::set& value, const utility::string_t& contentType ) +{ + web::json::value json_array = ModelBase::toJson(value); + std::shared_ptr content = std::make_shared(); + content->setName(name); + content->setContentDisposition(utility::conversions::to_string_t("form-data")); + content->setContentType(contentType); + content->setData( std::make_shared( utility::conversions::to_utf8string(json_array.serialize()) ) ); + return content; +} +template +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::map& value, const utility::string_t& contentType ) +{ + web::json::value jobj = ModelBase::toJson(value); + std::shared_ptr content = std::make_shared(); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::make_shared( utility::conversions::to_utf8string(jobj.serialize()) ) ); + return content; +} +template +bool ModelBase::fromHttpContent( std::shared_ptr val, std::shared_ptr& outVal ) +{ + utility::string_t str; + if(val == nullptr) return false; + if( outVal == nullptr ) + { + outVal = std::make_shared(); + } + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +template +bool ModelBase::fromHttpContent( std::shared_ptr val, std::vector & outVal ) +{ + utility::string_t str; + if (val == nullptr) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +template +bool ModelBase::fromHttpContent(std::shared_ptr val, std::set& outVal ) +{ + utility::string_t str; + if (val == nullptr) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +template +bool ModelBase::fromHttpContent( std::shared_ptr val, std::map & outVal ) +{ + utility::string_t str; + if (val == nullptr) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +} +} + +#endif /* TRIBUFU_MODELS_ModelBase_H_ */ diff --git a/include/tribufu++/MultipartFormData.h b/include/tribufu++/MultipartFormData.h new file mode 100644 index 00000000..e980a25a --- /dev/null +++ b/include/tribufu++/MultipartFormData.h @@ -0,0 +1,58 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * MultipartFormData.h + * + * This class represents a container for building application/x-multipart-formdata requests. + */ + +#ifndef TRIBUFU_MODELS_MultipartFormData_H_ +#define TRIBUFU_MODELS_MultipartFormData_H_ + + +#include "tribufu++/IHttpBody.h" +#include "tribufu++/HttpContent.h" + +#include + +#include +#include +#include + +namespace tribufu { +namespace models { + +class MultipartFormData + : public IHttpBody +{ +public: + MultipartFormData(); + MultipartFormData(const utility::string_t& boundary); + virtual ~MultipartFormData(); + + virtual void add( std::shared_ptr content ); + virtual utility::string_t getBoundary(); + virtual std::shared_ptr getContent(const utility::string_t& name) const; + virtual bool hasContent(const utility::string_t& name) const; + virtual void writeTo( std::ostream& target ); + +protected: + std::vector> m_Contents; + utility::string_t m_Boundary; + std::map> m_ContentLookup; +}; + +} +} + +#endif /* TRIBUFU_MODELS_MultipartFormData_H_ */ diff --git a/include/tribufu++/Object.h b/include/tribufu++/Object.h new file mode 100644 index 00000000..6f9464e8 --- /dev/null +++ b/include/tribufu++/Object.h @@ -0,0 +1,59 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Object.h + * + * This is the implementation of a JSON object. + */ + +#ifndef TRIBUFU_MODELS_Object_H_ +#define TRIBUFU_MODELS_Object_H_ + + +#include "tribufu++/ModelBase.h" + +#include +#include + +namespace tribufu { +namespace models { + +class Object : public ModelBase +{ +public: + Object(); + virtual ~Object(); + + ///////////////////////////////////////////// + /// ModelBase overrides + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + ///////////////////////////////////////////// + /// Object manipulation + web::json::value getValue(const utility::string_t& key) const; + void setValue(const utility::string_t& key, const web::json::value& value); + +private: + web::json::value m_object; +}; + +} +} + +#endif /* TRIBUFU_MODELS_Object_H_ */ diff --git a/include/tribufu++/api/TribufuGeneratedApi.h b/include/tribufu++/api/TribufuGeneratedApi.h new file mode 100644 index 00000000..c295cc2c --- /dev/null +++ b/include/tribufu++/api/TribufuGeneratedApi.h @@ -0,0 +1,844 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * TribufuGeneratedApi.h + * + * + */ + +#ifndef TRIBUFU_API_TribufuGeneratedApi_H_ +#define TRIBUFU_API_TribufuGeneratedApi_H_ + + + +#include "tribufu++/ApiClient.h" + +#include "tribufu++/model/Account.h" +#include "tribufu++/AnyType.h" +#include "tribufu++/model/AuthorizeRequest.h" +#include "tribufu++/model/CryptoViewModel.h" +#include "tribufu++/model/Game.h" +#include "tribufu++/model/GameServer.h" +#include "tribufu++/model/GameServerCluster.h" +#include "tribufu++/model/Group.h" +#include "tribufu++/model/GroupGame.h" +#include "tribufu++/model/GroupMember.h" +#include "tribufu++/model/HashViewModel.h" +#include "tribufu++/model/IntrospectRequest.h" +#include "tribufu++/model/IpAddress.h" +#include "tribufu++/model/LeaderboardItem.h" +#include "tribufu++/model/LeaderboardOrder.h" +#include "tribufu++/model/LoginRequest.h" +#include "tribufu++/model/LoginResponse.h" +#include "tribufu++/model/Package.h" +#include "tribufu++/model/Profile.h" +#include "tribufu++/model/ProfileGame.h" +#include "tribufu++/model/ProfileGroup.h" +#include "tribufu++/model/RefreshRequest.h" +#include "tribufu++/model/RegisterRequest.h" +#include "tribufu++/model/RevokeRequest.h" +#include "tribufu++/model/SearchRequest.h" +#include "tribufu++/model/ServerMetrics.h" +#include "tribufu++/model/Subscription.h" +#include "tribufu++/model/TokenRequest.h" +#include "tribufu++/model/TokenResponse.h" +#include "tribufu++/model/UpdateProfile.h" +#include "tribufu++/model/UserInfo.h" +#include +#include +#include +#include + +namespace tribufu { +namespace api { + +using namespace tribufu::models; + + + +class TribufuGeneratedApi +{ +public: + + explicit TribufuGeneratedApi( std::shared_ptr apiClient ); + + virtual ~TribufuGeneratedApi(); + + /// + /// Authorize the client to access the user information. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.authorize</code> + /// + /// (optional) + pplx::task authorize( + boost::optional> authorizeRequest + ) const; + /// + /// Change the email of a user. + /// + /// + /// This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.email.update</code> + /// + /// + /// (optional) + pplx::task changeEmail( + utility::string_t id, + boost::optional> body + ) const; + /// + /// Change the password of a user. + /// + /// + /// This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.password.update</code> + /// + /// + /// (optional) + pplx::task changePassword( + utility::string_t id, + boost::optional> body + ) const; + /// + /// Claim a game server. + /// + /// + /// This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.community.game.server.claim</code> + /// + /// + /// (optional) + pplx::task claimGameServer( + utility::string_t id, + boost::optional> body + ) const; + /// + /// Convert a string to base64 or vice versa. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.convert.base64</code> + /// + /// (optional) + pplx::task> convertBase64( + boost::optional> cryptoViewModel + ) const; + /// + /// Create a new game server. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.create</code> + /// + /// (optional) + pplx::task createGameServer( + boost::optional> body + ) const; + /// + /// Create a new game server cluster. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.create</code> + /// + /// (optional) + pplx::task createGameServerCluster( + boost::optional> body + ) const; + /// + /// Create a new group. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.create</code> + /// + /// (optional) + pplx::task createGroup( + boost::optional> body + ) const; + /// + /// Create a new token with grant type. + /// + /// + /// + /// + /// (optional) + pplx::task> createToken( + boost::optional> tokenRequest + ) const; + /// + /// Delete a game server. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.delete</code> + /// + /// + pplx::task deleteGameServer( + utility::string_t id + ) const; + /// + /// Delete a game server cluster. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.delete</code> + /// + /// + pplx::task deleteGameServerCluster( + utility::string_t id + ) const; + /// + /// Delete a group. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.delete</code> + /// + /// + pplx::task deleteGroup( + utility::string_t id + ) const; + /// + /// Generate one or more flake ids. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake</code> + /// + /// (optional, default to 0) + pplx::task> generateFlakeId( + boost::optional amount + ) const; + /// + /// Generate one or more flake ids from a timestamp. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake.timestamp</code> + /// + /// + /// (optional, default to 0) + pplx::task> generateFlakeIdFromTimestamp( + utility::string_t timestamp, + boost::optional amount + ) const; + /// + /// Generate a random password. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.password</code> + /// + /// (optional, default to 0) + /// (optional, default to false) + pplx::task> generatePassword( + boost::optional length, + boost::optional symbols + ) const; + /// + /// Generate one or more uuids with a specific version. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.uuid</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task> generateUuid( + boost::optional version, + boost::optional amount + ) const; + /// + /// Get current client information. + /// + /// + /// + /// + pplx::task getClientInfo( + ) const; + /// + /// Get current ip address location. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.current</code> + /// + pplx::task>> getCurrentIpAddress( + ) const; + /// + /// Get a game by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.get</code> + /// + /// + pplx::task> getGameById( + utility::string_t id + ) const; + /// + /// Get a list of game server clusters of a game. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + /// + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGameClustersByGameId( + utility::string_t id, + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of game items. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.item.list</code> + /// + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGameItems( + utility::string_t id, + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a game server by address and query port. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get.address</code> + /// + /// + /// + pplx::task> getGameServerByAddressAndQueryPort( + utility::string_t address, + int32_t port + ) const; + /// + /// Get a game server by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get</code> + /// + /// + pplx::task> getGameServerById( + utility::string_t id + ) const; + /// + /// Get a game server cluster by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.get</code> + /// + /// + pplx::task> getGameServerClusterById( + utility::string_t id + ) const; + /// + /// Get a list of game server clusters. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGameServerClusters( + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of game servers. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGameServers( + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of game servers from a country. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list.country</code> + /// + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGameServersByCountry( + utility::string_t country, + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of game servers of a game. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + /// + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGameServersByGameId( + utility::string_t id, + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of countries with the number of game servers. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.country.list</code> + /// + pplx::task> getGameServersCountries( + ) const; + /// + /// Get metrics about the tracked game servers. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.metric.get</code> + /// + pplx::task> getGameServersMetrics( + ) const; + /// + /// Get a list of games. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.list</code> + /// + pplx::task>> getGames( + ) const; + /// + /// Get a group by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get</code> + /// + /// + pplx::task> getGroupById( + utility::string_t id + ) const; + /// + /// Get a group by tag. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.tag</code> + /// + /// + pplx::task> getGroupByTag( + utility::string_t tag + ) const; + /// + /// Get a group by uuid. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.uuid</code> + /// + /// + pplx::task> getGroupByUuid( + utility::string_t uuid + ) const; + /// + /// Get a list of games of a group. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.game.list</code> + /// + /// + pplx::task>> getGroupGames( + utility::string_t id + ) const; + /// + /// Get a list of members in a group. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.member.list</code> + /// + /// + pplx::task>> getGroupMembers( + utility::string_t id + ) const; + /// + /// Get a list of groups. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getGroups( + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a ip address location. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.get</code> + /// + /// + pplx::task> getIpAddress( + utility::string_t address + ) const; + /// + /// Get a list of ip addresses. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getIpAddresses( + boost::optional page, + boost::optional limit + ) const; + /// + /// Get the top 20 leaderboard users. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.leaderboard.get</code> + /// + /// (optional, default to new LeaderboardOrder()) + pplx::task>> getLeaderboard( + boost::optional> order + ) const; + /// + /// Get current user information. + /// + /// + /// + /// + pplx::task> getMe( + ) const; + /// + /// Get a package by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.package.get</code> + /// + /// + pplx::task> getPackageById( + utility::string_t id + ) const; + /// + /// Get a list of packages. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.package.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getPackages( + boost::optional page, + boost::optional limit + ) const; + /// + /// Get the public keys for the client. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.client.keys</code> + /// + pplx::task getPublicKeys( + ) const; + /// + /// Get a subscription by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.get</code> + /// + /// + pplx::task> getSubscriptionById( + utility::string_t id + ) const; + /// + /// Get a list of subscriptions. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getSubscriptions( + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of connected accounts of the user. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.user.account.list</code> + /// + /// + pplx::task>> getUserAccounts( + utility::string_t id + ) const; + /// + /// Get a user profile by id. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get</code> + /// + /// + pplx::task> getUserById( + utility::string_t id + ) const; + /// + /// Get a user profile by name. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.name</code> + /// + /// + pplx::task> getUserByName( + utility::string_t name + ) const; + /// + /// Get a user profile by uuid. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.uuid</code> + /// + /// + pplx::task> getUserByUuid( + utility::string_t uuid + ) const; + /// + /// Get a list of friends of the user. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.friend.list</code> + /// + /// + pplx::task>> getUserFriends( + utility::string_t id + ) const; + /// + /// Get a list of games the user has played. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.list</code> + /// + /// + pplx::task>> getUserGames( + utility::string_t id + ) const; + /// + /// Get a list of groups the user is a member of. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.group.list</code> + /// + /// + pplx::task>> getUserGroups( + utility::string_t id + ) const; + /// + /// Get current user information. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.user.info</code> + /// + pplx::task> getUserInfo( + ) const; + /// + /// Get a list of punishments the user has received. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.punishment.list</code> + /// + /// + pplx::task>> getUserPunishments( + utility::string_t id + ) const; + /// + /// Get a list of servers the user is owner of. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.server.list</code> + /// + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getUserServers( + utility::string_t id, + boost::optional page, + boost::optional limit + ) const; + /// + /// Get a list of user profiles. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.list</code> + /// + /// (optional, default to 0) + /// (optional, default to 0) + pplx::task>> getUsers( + boost::optional page, + boost::optional limit + ) const; + /// + /// Hash a string using argon2. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.argon2</code> + /// + /// (optional) + pplx::task> hashArgon2( + boost::optional> hashViewModel + ) const; + /// + /// Hash a string using bcrypt. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.bcrypt</code> + /// + /// (optional) + pplx::task> hashBcrypt( + boost::optional> hashViewModel + ) const; + /// + /// Hash a string using md5. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.md5</code> + /// + /// (optional) + pplx::task> hashMd5( + boost::optional> hashViewModel + ) const; + /// + /// Hash a string using sha256. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.sha256</code> + /// + /// (optional) + pplx::task> hashSha256( + boost::optional> hashViewModel + ) const; + /// + /// Introspect a token. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.introspect</code> + /// + /// (optional) + pplx::task introspectToken( + boost::optional> introspectRequest + ) const; + /// + /// Login with name or email and password. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.create</code> + /// + /// (optional) + pplx::task> login( + boost::optional> loginRequest + ) const; + /// + /// Invalidate credentials. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.revoke</code> + /// + pplx::task logout( + ) const; + /// + /// Create a new user. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.user.create</code> + /// + /// (optional) + pplx::task> r_register( + boost::optional> registerRequest + ) const; + /// + /// Refresh credentials. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.refresh</code> + /// + /// (optional) + pplx::task> refresh( + boost::optional> refreshRequest + ) const; + /// + /// Revoke a token. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.revoke</code> + /// + /// (optional) + pplx::task revokeToken( + boost::optional> revokeRequest + ) const; + /// + /// Advanced search for servers or players. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.search</code> + /// + /// (optional) + pplx::task>> search( + boost::optional> searchRequest + ) const; + /// + /// Update a game server. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.update</code> + /// + /// + /// (optional) + pplx::task updateGameServer( + utility::string_t id, + boost::optional> body + ) const; + /// + /// Update a game server cluster. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.update</code> + /// + /// + /// (optional) + pplx::task updateGameServerCluster( + utility::string_t id, + boost::optional> body + ) const; + /// + /// Update a group. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.update</code> + /// + /// + /// (optional) + pplx::task updateGroup( + utility::string_t id, + boost::optional> body + ) const; + /// + /// Update a user profile. + /// + /// + /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.update</code> + /// + /// + /// (optional) + pplx::task> updateUserProfile( + utility::string_t id, + boost::optional> updateProfile + ) const; + +protected: + std::shared_ptr m_ApiClient; +}; + +} +} + +#endif /* TRIBUFU_API_TribufuGeneratedApi_H_ */ + diff --git a/include/tribufu++/model/Account.h b/include/tribufu++/model/Account.h new file mode 100644 index 00000000..b1f6e835 --- /dev/null +++ b/include/tribufu++/model/Account.h @@ -0,0 +1,130 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Account.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Account_H_ +#define TRIBUFU_MODELS_Account_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/AnyType.h" +#include "tribufu++/model/LoginProvider.h" + +namespace tribufu { +namespace models { + + + +class Account + : public ModelBase +{ +public: + Account(); + virtual ~Account(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Account members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + std::shared_ptr getProvider() const; + bool providerIsSet() const; + void unsetProvider(); + void setProvider(const std::shared_ptr& value); + + utility::string_t getUserId() const; + bool userIdIsSet() const; + void unsetUser_id(); + void setUserId(const utility::string_t& value); + + bool isAuthorized() const; + bool authorizedIsSet() const; + void unsetAuthorized(); + void setAuthorized(bool value); + + std::shared_ptr getFields() const; + bool fieldsIsSet() const; + void unsetFields(); + void setFields(const std::shared_ptr& value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + std::shared_ptr m_Provider; + bool m_ProviderIsSet; + + utility::string_t m_User_id; + bool m_User_idIsSet; + + bool m_Authorized; + bool m_AuthorizedIsSet; + + std::shared_ptr m_Fields; + bool m_FieldsIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Account_H_ */ diff --git a/include/tribufu++/model/Application.h b/include/tribufu++/model/Application.h new file mode 100644 index 00000000..f6536520 --- /dev/null +++ b/include/tribufu++/model/Application.h @@ -0,0 +1,225 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Application.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Application_H_ +#define TRIBUFU_MODELS_Application_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/ApplicationType.h" + +namespace tribufu { +namespace models { + + + +class Application + : public ModelBase +{ +public: + Application(); + virtual ~Application(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Application members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + std::shared_ptr getType() const; + bool typeIsSet() const; + void unsetType(); + void setType(const std::shared_ptr& value); + + utility::string_t getOrganizationId() const; + bool organizationIdIsSet() const; + void unsetOrganization_id(); + void setOrganizationId(const utility::string_t& value); + + utility::string_t getIconUrl() const; + bool iconUrlIsSet() const; + void unsetIcon_url(); + void setIconUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + utility::string_t getCapsuleImageUrl() const; + bool capsuleImageUrlIsSet() const; + void unsetCapsule_image_url(); + void setCapsuleImageUrl(const utility::string_t& value); + + utility::string_t getLibraryImageUrl() const; + bool libraryImageUrlIsSet() const; + void unsetLibrary_image_url(); + void setLibraryImageUrl(const utility::string_t& value); + + utility::string_t getParentId() const; + bool parentIdIsSet() const; + void unsetParent_id(); + void setParentId(const utility::string_t& value); + + utility::string_t getSlug() const; + bool slugIsSet() const; + void unsetSlug(); + void setSlug(const utility::string_t& value); + + int32_t getVisibility() const; + bool visibilityIsSet() const; + void unsetVisibility(); + void setVisibility(int32_t value); + + utility::string_t getPassword() const; + bool passwordIsSet() const; + void unsetPassword(); + void setPassword(const utility::string_t& value); + + int32_t getPrimary() const; + bool primaryIsSet() const; + void unsetPrimary(); + void setPrimary(int32_t value); + + int32_t getUserCount() const; + bool userCountIsSet() const; + void unsetUser_count(); + void setUserCount(int32_t value); + + int32_t getAchievementCount() const; + bool achievementCountIsSet() const; + void unsetAchievement_count(); + void setAchievementCount(int32_t value); + + int32_t getBadgeCount() const; + bool badgeCountIsSet() const; + void unsetBadge_count(); + void setBadgeCount(int32_t value); + + int32_t getDownloadCount() const; + bool downloadCountIsSet() const; + void unsetDownload_count(); + void setDownloadCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + std::shared_ptr m_Type; + bool m_TypeIsSet; + + utility::string_t m_Organization_id; + bool m_Organization_idIsSet; + + utility::string_t m_Icon_url; + bool m_Icon_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + utility::string_t m_Capsule_image_url; + bool m_Capsule_image_urlIsSet; + + utility::string_t m_Library_image_url; + bool m_Library_image_urlIsSet; + + utility::string_t m_Parent_id; + bool m_Parent_idIsSet; + + utility::string_t m_Slug; + bool m_SlugIsSet; + + int32_t m_Visibility; + bool m_VisibilityIsSet; + + utility::string_t m_Password; + bool m_PasswordIsSet; + + int32_t m_Primary; + bool m_PrimaryIsSet; + + int32_t m_User_count; + bool m_User_countIsSet; + + int32_t m_Achievement_count; + bool m_Achievement_countIsSet; + + int32_t m_Badge_count; + bool m_Badge_countIsSet; + + int32_t m_Download_count; + bool m_Download_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Application_H_ */ diff --git a/include/tribufu++/model/ApplicationType.h b/include/tribufu++/model/ApplicationType.h new file mode 100644 index 00000000..2349156b --- /dev/null +++ b/include/tribufu++/model/ApplicationType.h @@ -0,0 +1,64 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ApplicationType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_ApplicationType_H_ +#define TRIBUFU_MODELS_ApplicationType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class ApplicationType + : public ModelBase +{ +public: + ApplicationType(); + virtual ~ApplicationType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eApplicationType + { + ApplicationType_APPLICATION, + ApplicationType_GAME, + }; + + eApplicationType getValue() const; + void setValue(eApplicationType const value); + + protected: + eApplicationType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_ApplicationType_H_ */ diff --git a/include/tribufu++/model/AuthorizeRequest.h b/include/tribufu++/model/AuthorizeRequest.h new file mode 100644 index 00000000..c4414f30 --- /dev/null +++ b/include/tribufu++/model/AuthorizeRequest.h @@ -0,0 +1,122 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * AuthorizeRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_AuthorizeRequest_H_ +#define TRIBUFU_MODELS_AuthorizeRequest_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include "tribufu++/model/ResponseType.h" +#include +#include "tribufu++/model/CodeChallengeMethod.h" + +namespace tribufu { +namespace models { + + + +class AuthorizeRequest + : public ModelBase +{ +public: + AuthorizeRequest(); + virtual ~AuthorizeRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// AuthorizeRequest members + + + std::shared_ptr getResponseType() const; + bool responseTypeIsSet() const; + void unsetResponse_type(); + void setResponseType(const std::shared_ptr& value); + + utility::string_t getClientId() const; + bool clientIdIsSet() const; + void unsetClient_id(); + void setClientId(const utility::string_t& value); + + utility::string_t getCodeChallenge() const; + bool codeChallengeIsSet() const; + void unsetCode_challenge(); + void setCodeChallenge(const utility::string_t& value); + + std::shared_ptr getCodeChallengeMethod() const; + bool codeChallengeMethodIsSet() const; + void unsetCode_challenge_method(); + void setCodeChallengeMethod(const std::shared_ptr& value); + + utility::string_t getRedirectUri() const; + bool redirectUriIsSet() const; + void unsetRedirect_uri(); + void setRedirectUri(const utility::string_t& value); + + utility::string_t getScope() const; + bool scopeIsSet() const; + void unsetScope(); + void setScope(const utility::string_t& value); + + utility::string_t getState() const; + bool stateIsSet() const; + void unsetState(); + void setState(const utility::string_t& value); + + +protected: + std::shared_ptr m_Response_type; + bool m_Response_typeIsSet; + + utility::string_t m_Client_id; + bool m_Client_idIsSet; + + utility::string_t m_Code_challenge; + bool m_Code_challengeIsSet; + + std::shared_ptr m_Code_challenge_method; + bool m_Code_challenge_methodIsSet; + + utility::string_t m_Redirect_uri; + bool m_Redirect_uriIsSet; + + utility::string_t m_Scope; + bool m_ScopeIsSet; + + utility::string_t m_State; + bool m_StateIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_AuthorizeRequest_H_ */ diff --git a/include/tribufu++/model/CodeChallengeMethod.h b/include/tribufu++/model/CodeChallengeMethod.h new file mode 100644 index 00000000..27c64697 --- /dev/null +++ b/include/tribufu++/model/CodeChallengeMethod.h @@ -0,0 +1,64 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * CodeChallengeMethod.h + * + * + */ + +#ifndef TRIBUFU_MODELS_CodeChallengeMethod_H_ +#define TRIBUFU_MODELS_CodeChallengeMethod_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class CodeChallengeMethod + : public ModelBase +{ +public: + CodeChallengeMethod(); + virtual ~CodeChallengeMethod(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eCodeChallengeMethod + { + CodeChallengeMethod_PLAIN, + CodeChallengeMethod_S256, + }; + + eCodeChallengeMethod getValue() const; + void setValue(eCodeChallengeMethod const value); + + protected: + eCodeChallengeMethod m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_CodeChallengeMethod_H_ */ diff --git a/include/tribufu++/model/CryptoViewModel.h b/include/tribufu++/model/CryptoViewModel.h new file mode 100644 index 00000000..5cb52c71 --- /dev/null +++ b/include/tribufu++/model/CryptoViewModel.h @@ -0,0 +1,79 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * CryptoViewModel.h + * + * + */ + +#ifndef TRIBUFU_MODELS_CryptoViewModel_H_ +#define TRIBUFU_MODELS_CryptoViewModel_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class CryptoViewModel + : public ModelBase +{ +public: + CryptoViewModel(); + virtual ~CryptoViewModel(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// CryptoViewModel members + + + utility::string_t getEncoded() const; + bool encodedIsSet() const; + void unsetEncoded(); + void setEncoded(const utility::string_t& value); + + utility::string_t getDecoded() const; + bool decodedIsSet() const; + void unsetDecoded(); + void setDecoded(const utility::string_t& value); + + +protected: + utility::string_t m_Encoded; + bool m_EncodedIsSet; + + utility::string_t m_Decoded; + bool m_DecodedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_CryptoViewModel_H_ */ diff --git a/include/tribufu++/model/Game.h b/include/tribufu++/model/Game.h new file mode 100644 index 00000000..21639c81 --- /dev/null +++ b/include/tribufu++/model/Game.h @@ -0,0 +1,313 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Game.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Game_H_ +#define TRIBUFU_MODELS_Game_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/ApplicationType.h" + +namespace tribufu { +namespace models { + + + +class Game + : public ModelBase +{ +public: + Game(); + virtual ~Game(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Game members + + + int32_t getGamePort() const; + bool gamePortIsSet() const; + void unsetGame_port(); + void setGamePort(int32_t value); + + int32_t getQueryPort() const; + bool queryPortIsSet() const; + void unsetQuery_port(); + void setQueryPort(int32_t value); + + int32_t getRconPort() const; + bool rconPortIsSet() const; + void unsetRcon_port(); + void setRconPort(int32_t value); + + int32_t getServerCount() const; + bool serverCountIsSet() const; + void unsetServer_count(); + void setServerCount(int32_t value); + + int32_t getSteamAppId() const; + bool steamAppIdIsSet() const; + void unsetSteam_app_id(); + void setSteamAppId(int32_t value); + + int32_t getSteamServerAppId() const; + bool steamServerAppIdIsSet() const; + void unsetSteam_server_app_id(); + void setSteamServerAppId(int32_t value); + + bool isEnableServers() const; + bool enableServersIsSet() const; + void unsetEnable_servers(); + void setEnableServers(bool value); + + utility::string_t getRustGamedigId() const; + bool rustGamedigIdIsSet() const; + void unsetRust_gamedig_id(); + void setRustGamedigId(const utility::string_t& value); + + utility::string_t getNodeGamedigId() const; + bool nodeGamedigIdIsSet() const; + void unsetNode_gamedig_id(); + void setNodeGamedigId(const utility::string_t& value); + + utility::string_t getServerConnectUrl() const; + bool serverConnectUrlIsSet() const; + void unsetServer_connect_url(); + void setServerConnectUrl(const utility::string_t& value); + + utility::string_t getServerTags() const; + bool serverTagsIsSet() const; + void unsetServer_tags(); + void setServerTags(const utility::string_t& value); + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + std::shared_ptr getType() const; + bool typeIsSet() const; + void unsetType(); + void setType(const std::shared_ptr& value); + + utility::string_t getOrganizationId() const; + bool organizationIdIsSet() const; + void unsetOrganization_id(); + void setOrganizationId(const utility::string_t& value); + + utility::string_t getIconUrl() const; + bool iconUrlIsSet() const; + void unsetIcon_url(); + void setIconUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + utility::string_t getCapsuleImageUrl() const; + bool capsuleImageUrlIsSet() const; + void unsetCapsule_image_url(); + void setCapsuleImageUrl(const utility::string_t& value); + + utility::string_t getLibraryImageUrl() const; + bool libraryImageUrlIsSet() const; + void unsetLibrary_image_url(); + void setLibraryImageUrl(const utility::string_t& value); + + utility::string_t getParentId() const; + bool parentIdIsSet() const; + void unsetParent_id(); + void setParentId(const utility::string_t& value); + + utility::string_t getSlug() const; + bool slugIsSet() const; + void unsetSlug(); + void setSlug(const utility::string_t& value); + + int32_t getVisibility() const; + bool visibilityIsSet() const; + void unsetVisibility(); + void setVisibility(int32_t value); + + utility::string_t getPassword() const; + bool passwordIsSet() const; + void unsetPassword(); + void setPassword(const utility::string_t& value); + + int32_t getPrimary() const; + bool primaryIsSet() const; + void unsetPrimary(); + void setPrimary(int32_t value); + + int32_t getUserCount() const; + bool userCountIsSet() const; + void unsetUser_count(); + void setUserCount(int32_t value); + + int32_t getAchievementCount() const; + bool achievementCountIsSet() const; + void unsetAchievement_count(); + void setAchievementCount(int32_t value); + + int32_t getBadgeCount() const; + bool badgeCountIsSet() const; + void unsetBadge_count(); + void setBadgeCount(int32_t value); + + int32_t getDownloadCount() const; + bool downloadCountIsSet() const; + void unsetDownload_count(); + void setDownloadCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + int32_t m_Game_port; + bool m_Game_portIsSet; + + int32_t m_Query_port; + bool m_Query_portIsSet; + + int32_t m_Rcon_port; + bool m_Rcon_portIsSet; + + int32_t m_Server_count; + bool m_Server_countIsSet; + + int32_t m_Steam_app_id; + bool m_Steam_app_idIsSet; + + int32_t m_Steam_server_app_id; + bool m_Steam_server_app_idIsSet; + + bool m_Enable_servers; + bool m_Enable_serversIsSet; + + utility::string_t m_Rust_gamedig_id; + bool m_Rust_gamedig_idIsSet; + + utility::string_t m_Node_gamedig_id; + bool m_Node_gamedig_idIsSet; + + utility::string_t m_Server_connect_url; + bool m_Server_connect_urlIsSet; + + utility::string_t m_Server_tags; + bool m_Server_tagsIsSet; + + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + std::shared_ptr m_Type; + bool m_TypeIsSet; + + utility::string_t m_Organization_id; + bool m_Organization_idIsSet; + + utility::string_t m_Icon_url; + bool m_Icon_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + utility::string_t m_Capsule_image_url; + bool m_Capsule_image_urlIsSet; + + utility::string_t m_Library_image_url; + bool m_Library_image_urlIsSet; + + utility::string_t m_Parent_id; + bool m_Parent_idIsSet; + + utility::string_t m_Slug; + bool m_SlugIsSet; + + int32_t m_Visibility; + bool m_VisibilityIsSet; + + utility::string_t m_Password; + bool m_PasswordIsSet; + + int32_t m_Primary; + bool m_PrimaryIsSet; + + int32_t m_User_count; + bool m_User_countIsSet; + + int32_t m_Achievement_count; + bool m_Achievement_countIsSet; + + int32_t m_Badge_count; + bool m_Badge_countIsSet; + + int32_t m_Download_count; + bool m_Download_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Game_H_ */ diff --git a/include/tribufu++/model/GameServer.h b/include/tribufu++/model/GameServer.h new file mode 100644 index 00000000..b7cd0fbe --- /dev/null +++ b/include/tribufu++/model/GameServer.h @@ -0,0 +1,313 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * GameServer.h + * + * + */ + +#ifndef TRIBUFU_MODELS_GameServer_H_ +#define TRIBUFU_MODELS_GameServer_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/ServerStatus.h" + +namespace tribufu { +namespace models { + + + +class GameServer + : public ModelBase +{ +public: + GameServer(); + virtual ~GameServer(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// GameServer members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + utility::string_t getAddress() const; + bool addressIsSet() const; + void unsetAddress(); + void setAddress(const utility::string_t& value); + + int32_t getGamePort() const; + bool gamePortIsSet() const; + void unsetGame_port(); + void setGamePort(int32_t value); + + int32_t getQueryPort() const; + bool queryPortIsSet() const; + void unsetQuery_port(); + void setQueryPort(int32_t value); + + utility::string_t getGameId() const; + bool gameIdIsSet() const; + void unsetGame_id(); + void setGameId(const utility::string_t& value); + + utility::string_t getGameIconUrl() const; + bool gameIconUrlIsSet() const; + void unsetGame_icon_url(); + void setGameIconUrl(const utility::string_t& value); + + utility::string_t getVersion() const; + bool versionIsSet() const; + void unsetVersion(); + void setVersion(const utility::string_t& value); + + bool isFeatured() const; + bool featuredIsSet() const; + void unsetFeatured(); + void setFeatured(bool value); + + utility::string_t getClusterId() const; + bool clusterIdIsSet() const; + void unsetCluster_id(); + void setClusterId(const utility::string_t& value); + + utility::string_t getWebsiteUrl() const; + bool websiteUrlIsSet() const; + void unsetWebsite_url(); + void setWebsiteUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + utility::string_t getOwnerId() const; + bool ownerIdIsSet() const; + void unsetOwner_id(); + void setOwnerId(const utility::string_t& value); + + double getUptime() const; + bool uptimeIsSet() const; + void unsetUptime(); + void setUptime(double value); + + std::shared_ptr getStatus() const; + bool statusIsSet() const; + void unsetStatus(); + void setStatus(const std::shared_ptr& value); + + int32_t getPing() const; + bool pingIsSet() const; + void unsetPing(); + void setPing(int32_t value); + + utility::string_t getMap() const; + bool mapIsSet() const; + void unsetmap(); + void setMap(const utility::string_t& value); + + int32_t getUsedSlots() const; + bool usedSlotsIsSet() const; + void unsetUsed_slots(); + void setUsedSlots(int32_t value); + + int32_t getMaxSlots() const; + bool maxSlotsIsSet() const; + void unsetMax_slots(); + void setMaxSlots(int32_t value); + + utility::string_t getMotd() const; + bool motdIsSet() const; + void unsetMotd(); + void setMotd(const utility::string_t& value); + + utility::string_t getPlayers() const; + bool playersIsSet() const; + void unsetPlayers(); + void setPlayers(const utility::string_t& value); + + utility::datetime getLastOnline() const; + bool lastOnlineIsSet() const; + void unsetLast_online(); + void setLastOnline(const utility::datetime& value); + + utility::string_t getCountry() const; + bool countryIsSet() const; + void unsetCountry(); + void setCountry(const utility::string_t& value); + + bool isSteam() const; + bool steamIsSet() const; + void unsetSteam(); + void setSteam(bool value); + + utility::string_t getDiscordServerId() const; + bool discordServerIdIsSet() const; + void unsetDiscord_server_id(); + void setDiscordServerId(const utility::string_t& value); + + utility::string_t getYoutubeVideoUrl() const; + bool youtubeVideoUrlIsSet() const; + void unsetYoutube_video_url(); + void setYoutubeVideoUrl(const utility::string_t& value); + + utility::string_t getTags() const; + bool tagsIsSet() const; + void unsetTags(); + void setTags(const utility::string_t& value); + + int32_t getCommentCount() const; + bool commentCountIsSet() const; + void unsetComment_count(); + void setCommentCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + utility::string_t m_Address; + bool m_AddressIsSet; + + int32_t m_Game_port; + bool m_Game_portIsSet; + + int32_t m_Query_port; + bool m_Query_portIsSet; + + utility::string_t m_Game_id; + bool m_Game_idIsSet; + + utility::string_t m_Game_icon_url; + bool m_Game_icon_urlIsSet; + + utility::string_t m_Version; + bool m_VersionIsSet; + + bool m_Featured; + bool m_FeaturedIsSet; + + utility::string_t m_Cluster_id; + bool m_Cluster_idIsSet; + + utility::string_t m_Website_url; + bool m_Website_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + utility::string_t m_Owner_id; + bool m_Owner_idIsSet; + + double m_Uptime; + bool m_UptimeIsSet; + + std::shared_ptr m_Status; + bool m_StatusIsSet; + + int32_t m_Ping; + bool m_PingIsSet; + + utility::string_t m_map; + bool m_mapIsSet; + + int32_t m_Used_slots; + bool m_Used_slotsIsSet; + + int32_t m_Max_slots; + bool m_Max_slotsIsSet; + + utility::string_t m_Motd; + bool m_MotdIsSet; + + utility::string_t m_Players; + bool m_PlayersIsSet; + + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; + + utility::string_t m_Country; + bool m_CountryIsSet; + + bool m_Steam; + bool m_SteamIsSet; + + utility::string_t m_Discord_server_id; + bool m_Discord_server_idIsSet; + + utility::string_t m_Youtube_video_url; + bool m_Youtube_video_urlIsSet; + + utility::string_t m_Tags; + bool m_TagsIsSet; + + int32_t m_Comment_count; + bool m_Comment_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_GameServer_H_ */ diff --git a/include/tribufu++/model/GameServerCluster.h b/include/tribufu++/model/GameServerCluster.h new file mode 100644 index 00000000..a44a4615 --- /dev/null +++ b/include/tribufu++/model/GameServerCluster.h @@ -0,0 +1,175 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * GameServerCluster.h + * + * + */ + +#ifndef TRIBUFU_MODELS_GameServerCluster_H_ +#define TRIBUFU_MODELS_GameServerCluster_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class GameServerCluster + : public ModelBase +{ +public: + GameServerCluster(); + virtual ~GameServerCluster(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// GameServerCluster members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + utility::string_t getGameId() const; + bool gameIdIsSet() const; + void unsetGame_id(); + void setGameId(const utility::string_t& value); + + utility::string_t getWebsiteUrl() const; + bool websiteUrlIsSet() const; + void unsetWebsite_url(); + void setWebsiteUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + utility::string_t getOwnerId() const; + bool ownerIdIsSet() const; + void unsetOwner_id(); + void setOwnerId(const utility::string_t& value); + + utility::string_t getDiscordServerId() const; + bool discordServerIdIsSet() const; + void unsetDiscord_server_id(); + void setDiscordServerId(const utility::string_t& value); + + utility::string_t getYoutubeVideoUrl() const; + bool youtubeVideoUrlIsSet() const; + void unsetYoutube_video_url(); + void setYoutubeVideoUrl(const utility::string_t& value); + + utility::string_t getTags() const; + bool tagsIsSet() const; + void unsetTags(); + void setTags(const utility::string_t& value); + + int32_t getCommentCount() const; + bool commentCountIsSet() const; + void unsetComment_count(); + void setCommentCount(int32_t value); + + int32_t getServerCount() const; + bool serverCountIsSet() const; + void unsetServer_count(); + void setServerCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + utility::string_t m_Game_id; + bool m_Game_idIsSet; + + utility::string_t m_Website_url; + bool m_Website_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + utility::string_t m_Owner_id; + bool m_Owner_idIsSet; + + utility::string_t m_Discord_server_id; + bool m_Discord_server_idIsSet; + + utility::string_t m_Youtube_video_url; + bool m_Youtube_video_urlIsSet; + + utility::string_t m_Tags; + bool m_TagsIsSet; + + int32_t m_Comment_count; + bool m_Comment_countIsSet; + + int32_t m_Server_count; + bool m_Server_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_GameServerCluster_H_ */ diff --git a/include/tribufu++/model/GrantType.h b/include/tribufu++/model/GrantType.h new file mode 100644 index 00000000..58bdd607 --- /dev/null +++ b/include/tribufu++/model/GrantType.h @@ -0,0 +1,66 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * GrantType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_GrantType_H_ +#define TRIBUFU_MODELS_GrantType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class GrantType + : public ModelBase +{ +public: + GrantType(); + virtual ~GrantType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eGrantType + { + GrantType_AUTHORIZATION_CODE, + GrantType_CLIENT_CREDENTIALS, + GrantType_PASSWORD, + GrantType_REFRESH_TOKEN, + }; + + eGrantType getValue() const; + void setValue(eGrantType const value); + + protected: + eGrantType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_GrantType_H_ */ diff --git a/include/tribufu++/model/Group.h b/include/tribufu++/model/Group.h new file mode 100644 index 00000000..5afc79cc --- /dev/null +++ b/include/tribufu++/model/Group.h @@ -0,0 +1,191 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Group.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Group_H_ +#define TRIBUFU_MODELS_Group_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class Group + : public ModelBase +{ +public: + Group(); + virtual ~Group(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Group members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getTag() const; + bool tagIsSet() const; + void unsetTag(); + void setTag(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + int32_t getType() const; + bool typeIsSet() const; + void unsetType(); + void setType(int32_t value); + + int32_t getPrivacy() const; + bool privacyIsSet() const; + void unsetPrivacy(); + void setPrivacy(int32_t value); + + utility::string_t getOwnerId() const; + bool ownerIdIsSet() const; + void unsetOwner_id(); + void setOwnerId(const utility::string_t& value); + + bool isVerified() const; + bool verifiedIsSet() const; + void unsetVerified(); + void setVerified(bool value); + + utility::string_t getPhotoUrl() const; + bool photoUrlIsSet() const; + void unsetPhoto_url(); + void setPhotoUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + int32_t getMemberCount() const; + bool memberCountIsSet() const; + void unsetMember_count(); + void setMemberCount(int32_t value); + + int32_t getFollowerCount() const; + bool followerCountIsSet() const; + void unsetFollower_count(); + void setFollowerCount(int32_t value); + + int32_t getViewCount() const; + bool viewCountIsSet() const; + void unsetView_count(); + void setViewCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Uuid; + bool m_UuidIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Tag; + bool m_TagIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + int32_t m_Type; + bool m_TypeIsSet; + + int32_t m_Privacy; + bool m_PrivacyIsSet; + + utility::string_t m_Owner_id; + bool m_Owner_idIsSet; + + bool m_Verified; + bool m_VerifiedIsSet; + + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + int32_t m_Member_count; + bool m_Member_countIsSet; + + int32_t m_Follower_count; + bool m_Follower_countIsSet; + + int32_t m_View_count; + bool m_View_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Group_H_ */ diff --git a/include/tribufu++/model/GroupGame.h b/include/tribufu++/model/GroupGame.h new file mode 100644 index 00000000..7cbcc8b8 --- /dev/null +++ b/include/tribufu++/model/GroupGame.h @@ -0,0 +1,124 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * GroupGame.h + * + * + */ + +#ifndef TRIBUFU_MODELS_GroupGame_H_ +#define TRIBUFU_MODELS_GroupGame_H_ + + +#include "tribufu++/ModelBase.h" + +#include "tribufu++/model/Application.h" +#include +#include "tribufu++/model/Group.h" +#include "tribufu++/AnyType.h" + +namespace tribufu { +namespace models { + +class Group; +class Application; + + +class GroupGame + : public ModelBase +{ +public: + GroupGame(); + virtual ~GroupGame(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// GroupGame members + + + utility::string_t getGroupId() const; + bool groupIdIsSet() const; + void unsetGroup_id(); + void setGroupId(const utility::string_t& value); + + std::shared_ptr getGroup() const; + bool groupIsSet() const; + void unsetGroup(); + void setGroup(const std::shared_ptr& value); + + utility::string_t getApplicationId() const; + bool applicationIdIsSet() const; + void unsetApplication_id(); + void setApplicationId(const utility::string_t& value); + + std::shared_ptr getApplication() const; + bool applicationIsSet() const; + void unsetApplication(); + void setApplication(const std::shared_ptr& value); + + std::shared_ptr getStats() const; + bool statsIsSet() const; + void unsetStats(); + void setStats(const std::shared_ptr& value); + + utility::datetime getAcquired() const; + bool acquiredIsSet() const; + void unsetAcquired(); + void setAcquired(const utility::datetime& value); + + utility::datetime getLastUsed() const; + bool lastUsedIsSet() const; + void unsetLast_used(); + void setLastUsed(const utility::datetime& value); + + +protected: + utility::string_t m_Group_id; + bool m_Group_idIsSet; + + std::shared_ptr m_Group; + bool m_GroupIsSet; + + utility::string_t m_Application_id; + bool m_Application_idIsSet; + + std::shared_ptr m_Application; + bool m_ApplicationIsSet; + + std::shared_ptr m_Stats; + bool m_StatsIsSet; + + utility::datetime m_Acquired; + bool m_AcquiredIsSet; + + utility::datetime m_Last_used; + bool m_Last_usedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_GroupGame_H_ */ diff --git a/include/tribufu++/model/GroupMember.h b/include/tribufu++/model/GroupMember.h new file mode 100644 index 00000000..e336abf2 --- /dev/null +++ b/include/tribufu++/model/GroupMember.h @@ -0,0 +1,137 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * GroupMember.h + * + * + */ + +#ifndef TRIBUFU_MODELS_GroupMember_H_ +#define TRIBUFU_MODELS_GroupMember_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/GroupRank.h" + +namespace tribufu { +namespace models { + + + +class GroupMember + : public ModelBase +{ +public: + GroupMember(); + virtual ~GroupMember(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// GroupMember members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDisplayName() const; + bool displayNameIsSet() const; + void unsetDisplay_name(); + void setDisplayName(const utility::string_t& value); + + bool isVerified() const; + bool verifiedIsSet() const; + void unsetVerified(); + void setVerified(bool value); + + utility::string_t getPhotoUrl() const; + bool photoUrlIsSet() const; + void unsetPhoto_url(); + void setPhotoUrl(const utility::string_t& value); + + utility::datetime getLastOnline() const; + bool lastOnlineIsSet() const; + void unsetLast_online(); + void setLastOnline(const utility::datetime& value); + + std::shared_ptr getRank() const; + bool rankIsSet() const; + void unsetRank(); + void setRank(const std::shared_ptr& value); + + utility::datetime getSince() const; + bool sinceIsSet() const; + void unsetSince(); + void setSince(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Uuid; + bool m_UuidIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Display_name; + bool m_Display_nameIsSet; + + bool m_Verified; + bool m_VerifiedIsSet; + + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; + + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; + + std::shared_ptr m_Rank; + bool m_RankIsSet; + + utility::datetime m_Since; + bool m_SinceIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_GroupMember_H_ */ diff --git a/include/tribufu++/model/GroupRank.h b/include/tribufu++/model/GroupRank.h new file mode 100644 index 00000000..1eeaaadc --- /dev/null +++ b/include/tribufu++/model/GroupRank.h @@ -0,0 +1,65 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * GroupRank.h + * + * + */ + +#ifndef TRIBUFU_MODELS_GroupRank_H_ +#define TRIBUFU_MODELS_GroupRank_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class GroupRank + : public ModelBase +{ +public: + GroupRank(); + virtual ~GroupRank(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eGroupRank + { + GroupRank_MEMBER, + GroupRank_LEADER, + GroupRank_OWNER, + }; + + eGroupRank getValue() const; + void setValue(eGroupRank const value); + + protected: + eGroupRank m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_GroupRank_H_ */ diff --git a/include/tribufu++/model/HashViewModel.h b/include/tribufu++/model/HashViewModel.h new file mode 100644 index 00000000..6c105e0d --- /dev/null +++ b/include/tribufu++/model/HashViewModel.h @@ -0,0 +1,71 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * HashViewModel.h + * + * + */ + +#ifndef TRIBUFU_MODELS_HashViewModel_H_ +#define TRIBUFU_MODELS_HashViewModel_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class HashViewModel + : public ModelBase +{ +public: + HashViewModel(); + virtual ~HashViewModel(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// HashViewModel members + + + utility::string_t getValue() const; + bool valueIsSet() const; + void unsetValue(); + void setValue(const utility::string_t& value); + + +protected: + utility::string_t m_Value; + bool m_ValueIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_HashViewModel_H_ */ diff --git a/include/tribufu++/model/IntrospectRequest.h b/include/tribufu++/model/IntrospectRequest.h new file mode 100644 index 00000000..4cd53767 --- /dev/null +++ b/include/tribufu++/model/IntrospectRequest.h @@ -0,0 +1,81 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * IntrospectRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_IntrospectRequest_H_ +#define TRIBUFU_MODELS_IntrospectRequest_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/TokenHintType.h" + +namespace tribufu { +namespace models { + + + +class IntrospectRequest + : public ModelBase +{ +public: + IntrospectRequest(); + virtual ~IntrospectRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// IntrospectRequest members + + + utility::string_t getToken() const; + bool tokenIsSet() const; + void unsetToken(); + void setToken(const utility::string_t& value); + + std::shared_ptr getTokenTypeHint() const; + bool tokenTypeHintIsSet() const; + void unsetToken_type_hint(); + void setTokenTypeHint(const std::shared_ptr& value); + + +protected: + utility::string_t m_Token; + bool m_TokenIsSet; + + std::shared_ptr m_Token_type_hint; + bool m_Token_type_hintIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_IntrospectRequest_H_ */ diff --git a/include/tribufu++/model/IpAddress.h b/include/tribufu++/model/IpAddress.h new file mode 100644 index 00000000..70dc7e01 --- /dev/null +++ b/include/tribufu++/model/IpAddress.h @@ -0,0 +1,207 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * IpAddress.h + * + * + */ + +#ifndef TRIBUFU_MODELS_IpAddress_H_ +#define TRIBUFU_MODELS_IpAddress_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class IpAddress + : public ModelBase +{ +public: + IpAddress(); + virtual ~IpAddress(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// IpAddress members + + + utility::string_t getAddress() const; + bool addressIsSet() const; + void unsetAddress(); + void setAddress(const utility::string_t& value); + + int32_t getVersion() const; + bool versionIsSet() const; + void unsetVersion(); + void setVersion(int32_t value); + + utility::string_t getNetwork() const; + bool networkIsSet() const; + void unsetNetwork(); + void setNetwork(const utility::string_t& value); + + bool isReserved() const; + bool reservedIsSet() const; + void unsetReserved(); + void setReserved(bool value); + + utility::string_t getAsn() const; + bool asnIsSet() const; + void unsetAsn(); + void setAsn(const utility::string_t& value); + + utility::string_t getIsp() const; + bool ispIsSet() const; + void unsetIsp(); + void setIsp(const utility::string_t& value); + + utility::string_t getContinent() const; + bool continentIsSet() const; + void unsetContinent(); + void setContinent(const utility::string_t& value); + + utility::string_t getCountry() const; + bool countryIsSet() const; + void unsetCountry(); + void setCountry(const utility::string_t& value); + + utility::string_t getRegion() const; + bool regionIsSet() const; + void unsetRegion(); + void setRegion(const utility::string_t& value); + + utility::string_t getCity() const; + bool cityIsSet() const; + void unsetCity(); + void setCity(const utility::string_t& value); + + utility::string_t getPostalCode() const; + bool postalCodeIsSet() const; + void unsetPostal_code(); + void setPostalCode(const utility::string_t& value); + + utility::string_t getCallingCode() const; + bool callingCodeIsSet() const; + void unsetCalling_code(); + void setCallingCode(const utility::string_t& value); + + utility::string_t getTld() const; + bool tldIsSet() const; + void unsetTld(); + void setTld(const utility::string_t& value); + + utility::string_t getLanguage() const; + bool languageIsSet() const; + void unsetLanguage(); + void setLanguage(const utility::string_t& value); + + utility::string_t getTimezone() const; + bool timezoneIsSet() const; + void unsetTimezone(); + void setTimezone(const utility::string_t& value); + + utility::string_t getCurrency() const; + bool currencyIsSet() const; + void unsetCurrency(); + void setCurrency(const utility::string_t& value); + + float getLatitude() const; + bool latitudeIsSet() const; + void unsetLatitude(); + void setLatitude(float value); + + float getLongitude() const; + bool longitudeIsSet() const; + void unsetLongitude(); + void setLongitude(float value); + + +protected: + utility::string_t m_Address; + bool m_AddressIsSet; + + int32_t m_Version; + bool m_VersionIsSet; + + utility::string_t m_Network; + bool m_NetworkIsSet; + + bool m_Reserved; + bool m_ReservedIsSet; + + utility::string_t m_Asn; + bool m_AsnIsSet; + + utility::string_t m_Isp; + bool m_IspIsSet; + + utility::string_t m_Continent; + bool m_ContinentIsSet; + + utility::string_t m_Country; + bool m_CountryIsSet; + + utility::string_t m_Region; + bool m_RegionIsSet; + + utility::string_t m_City; + bool m_CityIsSet; + + utility::string_t m_Postal_code; + bool m_Postal_codeIsSet; + + utility::string_t m_Calling_code; + bool m_Calling_codeIsSet; + + utility::string_t m_Tld; + bool m_TldIsSet; + + utility::string_t m_Language; + bool m_LanguageIsSet; + + utility::string_t m_Timezone; + bool m_TimezoneIsSet; + + utility::string_t m_Currency; + bool m_CurrencyIsSet; + + float m_Latitude; + bool m_LatitudeIsSet; + + float m_Longitude; + bool m_LongitudeIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_IpAddress_H_ */ diff --git a/include/tribufu++/model/LeaderboardItem.h b/include/tribufu++/model/LeaderboardItem.h new file mode 100644 index 00000000..80548257 --- /dev/null +++ b/include/tribufu++/model/LeaderboardItem.h @@ -0,0 +1,111 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * LeaderboardItem.h + * + * + */ + +#ifndef TRIBUFU_MODELS_LeaderboardItem_H_ +#define TRIBUFU_MODELS_LeaderboardItem_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class LeaderboardItem + : public ModelBase +{ +public: + LeaderboardItem(); + virtual ~LeaderboardItem(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// LeaderboardItem members + + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDisplayName() const; + bool displayNameIsSet() const; + void unsetDisplay_name(); + void setDisplayName(const utility::string_t& value); + + utility::string_t getPhotoUrl() const; + bool photoUrlIsSet() const; + void unsetPhoto_url(); + void setPhotoUrl(const utility::string_t& value); + + int32_t getLevel() const; + bool levelIsSet() const; + void unsetLevel(); + void setLevel(int32_t value); + + double getExperience() const; + bool experienceIsSet() const; + void unsetExperience(); + void setExperience(double value); + + double getPoints() const; + bool pointsIsSet() const; + void unsetPoints(); + void setPoints(double value); + + +protected: + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Display_name; + bool m_Display_nameIsSet; + + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; + + int32_t m_Level; + bool m_LevelIsSet; + + double m_Experience; + bool m_ExperienceIsSet; + + double m_Points; + bool m_PointsIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_LeaderboardItem_H_ */ diff --git a/include/tribufu++/model/LeaderboardOrder.h b/include/tribufu++/model/LeaderboardOrder.h new file mode 100644 index 00000000..983d251a --- /dev/null +++ b/include/tribufu++/model/LeaderboardOrder.h @@ -0,0 +1,64 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * LeaderboardOrder.h + * + * + */ + +#ifndef TRIBUFU_MODELS_LeaderboardOrder_H_ +#define TRIBUFU_MODELS_LeaderboardOrder_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class LeaderboardOrder + : public ModelBase +{ +public: + LeaderboardOrder(); + virtual ~LeaderboardOrder(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eLeaderboardOrder + { + LeaderboardOrder_LEVEL, + LeaderboardOrder_POINTS, + }; + + eLeaderboardOrder getValue() const; + void setValue(eLeaderboardOrder const value); + + protected: + eLeaderboardOrder m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_LeaderboardOrder_H_ */ diff --git a/include/tribufu++/model/LoginProvider.h b/include/tribufu++/model/LoginProvider.h new file mode 100644 index 00000000..e5674912 --- /dev/null +++ b/include/tribufu++/model/LoginProvider.h @@ -0,0 +1,69 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * LoginProvider.h + * + * + */ + +#ifndef TRIBUFU_MODELS_LoginProvider_H_ +#define TRIBUFU_MODELS_LoginProvider_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class LoginProvider + : public ModelBase +{ +public: + LoginProvider(); + virtual ~LoginProvider(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eLoginProvider + { + LoginProvider_STEAM, + LoginProvider_EPIC, + LoginProvider_DISCORD, + LoginProvider_MICROSOFT, + LoginProvider_PLAYSTATION, + LoginProvider_GOOGLE, + LoginProvider_APPLE, + }; + + eLoginProvider getValue() const; + void setValue(eLoginProvider const value); + + protected: + eLoginProvider m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_LoginProvider_H_ */ diff --git a/include/tribufu++/model/LoginRequest.h b/include/tribufu++/model/LoginRequest.h new file mode 100644 index 00000000..6a93089f --- /dev/null +++ b/include/tribufu++/model/LoginRequest.h @@ -0,0 +1,79 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * LoginRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_LoginRequest_H_ +#define TRIBUFU_MODELS_LoginRequest_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class LoginRequest + : public ModelBase +{ +public: + LoginRequest(); + virtual ~LoginRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// LoginRequest members + + + utility::string_t getLogin() const; + bool loginIsSet() const; + void unsetLogin(); + void setLogin(const utility::string_t& value); + + utility::string_t getPassword() const; + bool passwordIsSet() const; + void unsetPassword(); + void setPassword(const utility::string_t& value); + + +protected: + utility::string_t m_Login; + bool m_LoginIsSet; + + utility::string_t m_Password; + bool m_PasswordIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_LoginRequest_H_ */ diff --git a/include/tribufu++/model/LoginResponse.h b/include/tribufu++/model/LoginResponse.h new file mode 100644 index 00000000..77ed19e9 --- /dev/null +++ b/include/tribufu++/model/LoginResponse.h @@ -0,0 +1,97 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * LoginResponse.h + * + * + */ + +#ifndef TRIBUFU_MODELS_LoginResponse_H_ +#define TRIBUFU_MODELS_LoginResponse_H_ + + +#include "tribufu++/ModelBase.h" + +#include "tribufu++/model/UserInfo.h" +#include + +namespace tribufu { +namespace models { + +class UserInfo; + + +class LoginResponse + : public ModelBase +{ +public: + LoginResponse(); + virtual ~LoginResponse(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// LoginResponse members + + + std::shared_ptr getUser() const; + bool userIsSet() const; + void unsetUser(); + void setUser(const std::shared_ptr& value); + + utility::string_t getAccessToken() const; + bool accessTokenIsSet() const; + void unsetAccess_token(); + void setAccessToken(const utility::string_t& value); + + utility::string_t getRefreshToken() const; + bool refreshTokenIsSet() const; + void unsetRefresh_token(); + void setRefreshToken(const utility::string_t& value); + + int64_t getExpiresIn() const; + bool expiresInIsSet() const; + void unsetExpires_in(); + void setExpiresIn(int64_t value); + + +protected: + std::shared_ptr m_User; + bool m_UserIsSet; + + utility::string_t m_Access_token; + bool m_Access_tokenIsSet; + + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; + + int64_t m_Expires_in; + bool m_Expires_inIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_LoginResponse_H_ */ diff --git a/include/tribufu++/model/Package.h b/include/tribufu++/model/Package.h new file mode 100644 index 00000000..c057b034 --- /dev/null +++ b/include/tribufu++/model/Package.h @@ -0,0 +1,159 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Package.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Package_H_ +#define TRIBUFU_MODELS_Package_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class Package + : public ModelBase +{ +public: + Package(); + virtual ~Package(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Package members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + utility::string_t getImageUrl() const; + bool imageUrlIsSet() const; + void unsetImage_url(); + void setImageUrl(const utility::string_t& value); + + utility::string_t getAuthorId() const; + bool authorIdIsSet() const; + void unsetAuthor_id(); + void setAuthorId(const utility::string_t& value); + + utility::string_t getVersion() const; + bool versionIsSet() const; + void unsetVersion(); + void setVersion(const utility::string_t& value); + + utility::string_t getFileUrl() const; + bool fileUrlIsSet() const; + void unsetFile_url(); + void setFileUrl(const utility::string_t& value); + + double getRawSize() const; + bool rawSizeIsSet() const; + void unsetRaw_size(); + void setRawSize(double value); + + int32_t getDownloadCount() const; + bool downloadCountIsSet() const; + void unsetDownload_count(); + void setDownloadCount(int32_t value); + + utility::datetime getLastDownload() const; + bool lastDownloadIsSet() const; + void unsetLast_download(); + void setLastDownload(const utility::datetime& value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + utility::string_t m_Image_url; + bool m_Image_urlIsSet; + + utility::string_t m_Author_id; + bool m_Author_idIsSet; + + utility::string_t m_Version; + bool m_VersionIsSet; + + utility::string_t m_File_url; + bool m_File_urlIsSet; + + double m_Raw_size; + bool m_Raw_sizeIsSet; + + int32_t m_Download_count; + bool m_Download_countIsSet; + + utility::datetime m_Last_download; + bool m_Last_downloadIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Package_H_ */ diff --git a/include/tribufu++/model/Profile.h b/include/tribufu++/model/Profile.h new file mode 100644 index 00000000..e45e6eee --- /dev/null +++ b/include/tribufu++/model/Profile.h @@ -0,0 +1,207 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Profile.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Profile_H_ +#define TRIBUFU_MODELS_Profile_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class Profile + : public ModelBase +{ +public: + Profile(); + virtual ~Profile(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Profile members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDisplayName() const; + bool displayNameIsSet() const; + void unsetDisplay_name(); + void setDisplayName(const utility::string_t& value); + + bool isVerified() const; + bool verifiedIsSet() const; + void unsetVerified(); + void setVerified(bool value); + + int32_t getLevel() const; + bool levelIsSet() const; + void unsetLevel(); + void setLevel(int32_t value); + + double getExperience() const; + bool experienceIsSet() const; + void unsetExperience(); + void setExperience(double value); + + bool isPublicBirthday() const; + bool publicBirthdayIsSet() const; + void unsetPublic_birthday(); + void setPublicBirthday(bool value); + + utility::datetime getBirthday() const; + bool birthdayIsSet() const; + void unsetBirthday(); + void setBirthday(const utility::datetime& value); + + double getPoints() const; + bool pointsIsSet() const; + void unsetPoints(); + void setPoints(double value); + + utility::string_t getLocation() const; + bool locationIsSet() const; + void unsetLocation(); + void setLocation(const utility::string_t& value); + + utility::string_t getPhotoUrl() const; + bool photoUrlIsSet() const; + void unsetPhoto_url(); + void setPhotoUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + utility::datetime getLastOnline() const; + bool lastOnlineIsSet() const; + void unsetLast_online(); + void setLastOnline(const utility::datetime& value); + + utility::string_t getBiography() const; + bool biographyIsSet() const; + void unsetBiography(); + void setBiography(const utility::string_t& value); + + int32_t getViewCount() const; + bool viewCountIsSet() const; + void unsetView_count(); + void setViewCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Uuid; + bool m_UuidIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Display_name; + bool m_Display_nameIsSet; + + bool m_Verified; + bool m_VerifiedIsSet; + + int32_t m_Level; + bool m_LevelIsSet; + + double m_Experience; + bool m_ExperienceIsSet; + + bool m_Public_birthday; + bool m_Public_birthdayIsSet; + + utility::datetime m_Birthday; + bool m_BirthdayIsSet; + + double m_Points; + bool m_PointsIsSet; + + utility::string_t m_Location; + bool m_LocationIsSet; + + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; + + utility::string_t m_Biography; + bool m_BiographyIsSet; + + int32_t m_View_count; + bool m_View_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Profile_H_ */ diff --git a/include/tribufu++/model/ProfileGame.h b/include/tribufu++/model/ProfileGame.h new file mode 100644 index 00000000..fdc939c9 --- /dev/null +++ b/include/tribufu++/model/ProfileGame.h @@ -0,0 +1,152 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ProfileGame.h + * + * + */ + +#ifndef TRIBUFU_MODELS_ProfileGame_H_ +#define TRIBUFU_MODELS_ProfileGame_H_ + + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/AnyType.h" + +namespace tribufu { +namespace models { + + + +class ProfileGame + : public ModelBase +{ +public: + ProfileGame(); + virtual ~ProfileGame(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// ProfileGame members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getCapsuleImageUrl() const; + bool capsuleImageUrlIsSet() const; + void unsetCapsule_image_url(); + void setCapsuleImageUrl(const utility::string_t& value); + + utility::string_t getLibraryImageUrl() const; + bool libraryImageUrlIsSet() const; + void unsetLibrary_image_url(); + void setLibraryImageUrl(const utility::string_t& value); + + utility::string_t getSlug() const; + bool slugIsSet() const; + void unsetSlug(); + void setSlug(const utility::string_t& value); + + double getTimeUsed() const; + bool timeUsedIsSet() const; + void unsetTime_used(); + void setTimeUsed(double value); + + int32_t getUnlockedAchievements() const; + bool unlockedAchievementsIsSet() const; + void unsetUnlocked_achievements(); + void setUnlockedAchievements(int32_t value); + + int32_t getTotalAchievements() const; + bool totalAchievementsIsSet() const; + void unsetTotal_achievements(); + void setTotalAchievements(int32_t value); + + std::shared_ptr getStats() const; + bool statsIsSet() const; + void unsetStats(); + void setStats(const std::shared_ptr& value); + + utility::datetime getAcquired() const; + bool acquiredIsSet() const; + void unsetAcquired(); + void setAcquired(const utility::datetime& value); + + utility::datetime getLastUsed() const; + bool lastUsedIsSet() const; + void unsetLast_used(); + void setLastUsed(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Capsule_image_url; + bool m_Capsule_image_urlIsSet; + + utility::string_t m_Library_image_url; + bool m_Library_image_urlIsSet; + + utility::string_t m_Slug; + bool m_SlugIsSet; + + double m_Time_used; + bool m_Time_usedIsSet; + + int32_t m_Unlocked_achievements; + bool m_Unlocked_achievementsIsSet; + + int32_t m_Total_achievements; + bool m_Total_achievementsIsSet; + + std::shared_ptr m_Stats; + bool m_StatsIsSet; + + utility::datetime m_Acquired; + bool m_AcquiredIsSet; + + utility::datetime m_Last_used; + bool m_Last_usedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_ProfileGame_H_ */ diff --git a/include/tribufu++/model/ProfileGroup.h b/include/tribufu++/model/ProfileGroup.h new file mode 100644 index 00000000..4b779dc7 --- /dev/null +++ b/include/tribufu++/model/ProfileGroup.h @@ -0,0 +1,145 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ProfileGroup.h + * + * + */ + +#ifndef TRIBUFU_MODELS_ProfileGroup_H_ +#define TRIBUFU_MODELS_ProfileGroup_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/GroupRank.h" + +namespace tribufu { +namespace models { + + + +class ProfileGroup + : public ModelBase +{ +public: + ProfileGroup(); + virtual ~ProfileGroup(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// ProfileGroup members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getTag() const; + bool tagIsSet() const; + void unsetTag(); + void setTag(const utility::string_t& value); + + int32_t getPrivacy() const; + bool privacyIsSet() const; + void unsetPrivacy(); + void setPrivacy(int32_t value); + + bool isVerified() const; + bool verifiedIsSet() const; + void unsetVerified(); + void setVerified(bool value); + + utility::string_t getPhotoUrl() const; + bool photoUrlIsSet() const; + void unsetPhoto_url(); + void setPhotoUrl(const utility::string_t& value); + + int32_t getMemberCount() const; + bool memberCountIsSet() const; + void unsetMember_count(); + void setMemberCount(int32_t value); + + std::shared_ptr getRank() const; + bool rankIsSet() const; + void unsetRank(); + void setRank(const std::shared_ptr& value); + + utility::datetime getSince() const; + bool sinceIsSet() const; + void unsetSince(); + void setSince(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Uuid; + bool m_UuidIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Tag; + bool m_TagIsSet; + + int32_t m_Privacy; + bool m_PrivacyIsSet; + + bool m_Verified; + bool m_VerifiedIsSet; + + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; + + int32_t m_Member_count; + bool m_Member_countIsSet; + + std::shared_ptr m_Rank; + bool m_RankIsSet; + + utility::datetime m_Since; + bool m_SinceIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_ProfileGroup_H_ */ diff --git a/include/tribufu++/model/RefreshRequest.h b/include/tribufu++/model/RefreshRequest.h new file mode 100644 index 00000000..456d33ea --- /dev/null +++ b/include/tribufu++/model/RefreshRequest.h @@ -0,0 +1,71 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * RefreshRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_RefreshRequest_H_ +#define TRIBUFU_MODELS_RefreshRequest_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class RefreshRequest + : public ModelBase +{ +public: + RefreshRequest(); + virtual ~RefreshRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// RefreshRequest members + + + utility::string_t getRefreshToken() const; + bool refreshTokenIsSet() const; + void unsetRefresh_token(); + void setRefreshToken(const utility::string_t& value); + + +protected: + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_RefreshRequest_H_ */ diff --git a/include/tribufu++/model/RegisterRequest.h b/include/tribufu++/model/RegisterRequest.h new file mode 100644 index 00000000..a0246c1c --- /dev/null +++ b/include/tribufu++/model/RegisterRequest.h @@ -0,0 +1,95 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * RegisterRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_RegisterRequest_H_ +#define TRIBUFU_MODELS_RegisterRequest_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class RegisterRequest + : public ModelBase +{ +public: + RegisterRequest(); + virtual ~RegisterRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// RegisterRequest members + + + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getEmail() const; + bool emailIsSet() const; + void unsetEmail(); + void setEmail(const utility::string_t& value); + + utility::string_t getPassword() const; + bool passwordIsSet() const; + void unsetPassword(); + void setPassword(const utility::string_t& value); + + +protected: + utility::string_t m_Uuid; + bool m_UuidIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Email; + bool m_EmailIsSet; + + utility::string_t m_Password; + bool m_PasswordIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_RegisterRequest_H_ */ diff --git a/include/tribufu++/model/ResponseType.h b/include/tribufu++/model/ResponseType.h new file mode 100644 index 00000000..cdb2c85e --- /dev/null +++ b/include/tribufu++/model/ResponseType.h @@ -0,0 +1,64 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ResponseType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_ResponseType_H_ +#define TRIBUFU_MODELS_ResponseType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class ResponseType + : public ModelBase +{ +public: + ResponseType(); + virtual ~ResponseType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eResponseType + { + ResponseType_CODE, + ResponseType_TOKEN, + }; + + eResponseType getValue() const; + void setValue(eResponseType const value); + + protected: + eResponseType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_ResponseType_H_ */ diff --git a/include/tribufu++/model/RevokeRequest.h b/include/tribufu++/model/RevokeRequest.h new file mode 100644 index 00000000..f05ae2ed --- /dev/null +++ b/include/tribufu++/model/RevokeRequest.h @@ -0,0 +1,81 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * RevokeRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_RevokeRequest_H_ +#define TRIBUFU_MODELS_RevokeRequest_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/TokenHintType.h" + +namespace tribufu { +namespace models { + + + +class RevokeRequest + : public ModelBase +{ +public: + RevokeRequest(); + virtual ~RevokeRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// RevokeRequest members + + + utility::string_t getToken() const; + bool tokenIsSet() const; + void unsetToken(); + void setToken(const utility::string_t& value); + + std::shared_ptr getTokenTypeHint() const; + bool tokenTypeHintIsSet() const; + void unsetToken_type_hint(); + void setTokenTypeHint(const std::shared_ptr& value); + + +protected: + utility::string_t m_Token; + bool m_TokenIsSet; + + std::shared_ptr m_Token_type_hint; + bool m_Token_type_hintIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_RevokeRequest_H_ */ diff --git a/include/tribufu++/model/SearchRequest.h b/include/tribufu++/model/SearchRequest.h new file mode 100644 index 00000000..47a54d3c --- /dev/null +++ b/include/tribufu++/model/SearchRequest.h @@ -0,0 +1,97 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * SearchRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_SearchRequest_H_ +#define TRIBUFU_MODELS_SearchRequest_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include "tribufu++/model/SearchType.h" +#include + +namespace tribufu { +namespace models { + + + +class SearchRequest + : public ModelBase +{ +public: + SearchRequest(); + virtual ~SearchRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// SearchRequest members + + + std::shared_ptr getType() const; + bool typeIsSet() const; + void unsetType(); + void setType(const std::shared_ptr& value); + + utility::string_t getQuery() const; + bool queryIsSet() const; + void unsetQuery(); + void setQuery(const utility::string_t& value); + + int32_t getPage() const; + bool pageIsSet() const; + void unsetPage(); + void setPage(int32_t value); + + utility::string_t getGameId() const; + bool gameIdIsSet() const; + void unsetGame_id(); + void setGameId(const utility::string_t& value); + + +protected: + std::shared_ptr m_Type; + bool m_TypeIsSet; + + utility::string_t m_Query; + bool m_QueryIsSet; + + int32_t m_Page; + bool m_PageIsSet; + + utility::string_t m_Game_id; + bool m_Game_idIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_SearchRequest_H_ */ diff --git a/include/tribufu++/model/SearchType.h b/include/tribufu++/model/SearchType.h new file mode 100644 index 00000000..40a21658 --- /dev/null +++ b/include/tribufu++/model/SearchType.h @@ -0,0 +1,66 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * SearchType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_SearchType_H_ +#define TRIBUFU_MODELS_SearchType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class SearchType + : public ModelBase +{ +public: + SearchType(); + virtual ~SearchType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eSearchType + { + SearchType_USER, + SearchType_GROUP, + SearchType_SERVER, + SearchType_CLUSTER, + }; + + eSearchType getValue() const; + void setValue(eSearchType const value); + + protected: + eSearchType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_SearchType_H_ */ diff --git a/include/tribufu++/model/ServerMetrics.h b/include/tribufu++/model/ServerMetrics.h new file mode 100644 index 00000000..bb523883 --- /dev/null +++ b/include/tribufu++/model/ServerMetrics.h @@ -0,0 +1,86 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ServerMetrics.h + * + * + */ + +#ifndef TRIBUFU_MODELS_ServerMetrics_H_ +#define TRIBUFU_MODELS_ServerMetrics_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + + +class ServerMetrics + : public ModelBase +{ +public: + ServerMetrics(); + virtual ~ServerMetrics(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// ServerMetrics members + + + int32_t getServerCount() const; + bool serverCountIsSet() const; + void unsetServer_count(); + void setServerCount(int32_t value); + + int32_t getPackageCount() const; + bool packageCountIsSet() const; + void unsetPackage_count(); + void setPackageCount(int32_t value); + + int32_t getCountryCount() const; + bool countryCountIsSet() const; + void unsetCountry_count(); + void setCountryCount(int32_t value); + + +protected: + int32_t m_Server_count; + bool m_Server_countIsSet; + + int32_t m_Package_count; + bool m_Package_countIsSet; + + int32_t m_Country_count; + bool m_Country_countIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_ServerMetrics_H_ */ diff --git a/include/tribufu++/model/ServerStatus.h b/include/tribufu++/model/ServerStatus.h new file mode 100644 index 00000000..e0d0c9bb --- /dev/null +++ b/include/tribufu++/model/ServerStatus.h @@ -0,0 +1,65 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * ServerStatus.h + * + * + */ + +#ifndef TRIBUFU_MODELS_ServerStatus_H_ +#define TRIBUFU_MODELS_ServerStatus_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class ServerStatus + : public ModelBase +{ +public: + ServerStatus(); + virtual ~ServerStatus(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eServerStatus + { + ServerStatus_UNKNOWN, + ServerStatus_OFFLINE, + ServerStatus_ONLINE, + }; + + eServerStatus getValue() const; + void setValue(eServerStatus const value); + + protected: + eServerStatus m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_ServerStatus_H_ */ diff --git a/include/tribufu++/model/Subscription.h b/include/tribufu++/model/Subscription.h new file mode 100644 index 00000000..5e56a7b3 --- /dev/null +++ b/include/tribufu++/model/Subscription.h @@ -0,0 +1,120 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * Subscription.h + * + * + */ + +#ifndef TRIBUFU_MODELS_Subscription_H_ +#define TRIBUFU_MODELS_Subscription_H_ + + +#include "tribufu++/ModelBase.h" + +#include +#include + +namespace tribufu { +namespace models { + + + +class Subscription + : public ModelBase +{ +public: + Subscription(); + virtual ~Subscription(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// Subscription members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDescription() const; + bool descriptionIsSet() const; + void unsetDescription(); + void setDescription(const utility::string_t& value); + + utility::string_t getImageUrl() const; + bool imageUrlIsSet() const; + void unsetImage_url(); + void setImageUrl(const utility::string_t& value); + + std::map getPrices() const; + bool pricesIsSet() const; + void unsetPrices(); + void setPrices(std::map value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Description; + bool m_DescriptionIsSet; + + utility::string_t m_Image_url; + bool m_Image_urlIsSet; + + std::map m_Prices; + bool m_PricesIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_Subscription_H_ */ diff --git a/include/tribufu++/model/TokenHintType.h b/include/tribufu++/model/TokenHintType.h new file mode 100644 index 00000000..da919615 --- /dev/null +++ b/include/tribufu++/model/TokenHintType.h @@ -0,0 +1,64 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * TokenHintType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_TokenHintType_H_ +#define TRIBUFU_MODELS_TokenHintType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class TokenHintType + : public ModelBase +{ +public: + TokenHintType(); + virtual ~TokenHintType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eTokenHintType + { + TokenHintType_ACCESS_TOKEN, + TokenHintType_REFRESH_TOKEN, + }; + + eTokenHintType getValue() const; + void setValue(eTokenHintType const value); + + protected: + eTokenHintType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_TokenHintType_H_ */ diff --git a/include/tribufu++/model/TokenRequest.h b/include/tribufu++/model/TokenRequest.h new file mode 100644 index 00000000..c5ce69de --- /dev/null +++ b/include/tribufu++/model/TokenRequest.h @@ -0,0 +1,129 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * TokenRequest.h + * + * + */ + +#ifndef TRIBUFU_MODELS_TokenRequest_H_ +#define TRIBUFU_MODELS_TokenRequest_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include +#include "tribufu++/model/GrantType.h" + +namespace tribufu { +namespace models { + + + +class TokenRequest + : public ModelBase +{ +public: + TokenRequest(); + virtual ~TokenRequest(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// TokenRequest members + + + std::shared_ptr getGrantType() const; + bool grantTypeIsSet() const; + void unsetGrant_type(); + void setGrantType(const std::shared_ptr& value); + + utility::string_t getCode() const; + bool codeIsSet() const; + void unsetCode(); + void setCode(const utility::string_t& value); + + utility::string_t getUsername() const; + bool usernameIsSet() const; + void unsetUsername(); + void setUsername(const utility::string_t& value); + + utility::string_t getPassword() const; + bool passwordIsSet() const; + void unsetPassword(); + void setPassword(const utility::string_t& value); + + utility::string_t getRefreshToken() const; + bool refreshTokenIsSet() const; + void unsetRefresh_token(); + void setRefreshToken(const utility::string_t& value); + + utility::string_t getClientId() const; + bool clientIdIsSet() const; + void unsetClient_id(); + void setClientId(const utility::string_t& value); + + utility::string_t getRedirectUri() const; + bool redirectUriIsSet() const; + void unsetRedirect_uri(); + void setRedirectUri(const utility::string_t& value); + + utility::string_t getCodeVerifier() const; + bool codeVerifierIsSet() const; + void unsetCode_verifier(); + void setCodeVerifier(const utility::string_t& value); + + +protected: + std::shared_ptr m_Grant_type; + bool m_Grant_typeIsSet; + + utility::string_t m_Code; + bool m_CodeIsSet; + + utility::string_t m_Username; + bool m_UsernameIsSet; + + utility::string_t m_Password; + bool m_PasswordIsSet; + + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; + + utility::string_t m_Client_id; + bool m_Client_idIsSet; + + utility::string_t m_Redirect_uri; + bool m_Redirect_uriIsSet; + + utility::string_t m_Code_verifier; + bool m_Code_verifierIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_TokenRequest_H_ */ diff --git a/include/tribufu++/model/TokenResponse.h b/include/tribufu++/model/TokenResponse.h new file mode 100644 index 00000000..779abf2d --- /dev/null +++ b/include/tribufu++/model/TokenResponse.h @@ -0,0 +1,113 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * TokenResponse.h + * + * + */ + +#ifndef TRIBUFU_MODELS_TokenResponse_H_ +#define TRIBUFU_MODELS_TokenResponse_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include "tribufu++/model/TokenType.h" +#include + +namespace tribufu { +namespace models { + + + +class TokenResponse + : public ModelBase +{ +public: + TokenResponse(); + virtual ~TokenResponse(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// TokenResponse members + + + std::shared_ptr getTokenType() const; + bool tokenTypeIsSet() const; + void unsetToken_type(); + void setTokenType(const std::shared_ptr& value); + + utility::string_t getAccessToken() const; + bool accessTokenIsSet() const; + void unsetAccess_token(); + void setAccessToken(const utility::string_t& value); + + utility::string_t getRefreshToken() const; + bool refreshTokenIsSet() const; + void unsetRefresh_token(); + void setRefreshToken(const utility::string_t& value); + + utility::string_t getScope() const; + bool scopeIsSet() const; + void unsetScope(); + void setScope(const utility::string_t& value); + + utility::string_t getState() const; + bool stateIsSet() const; + void unsetState(); + void setState(const utility::string_t& value); + + int64_t getExpiresIn() const; + bool expiresInIsSet() const; + void unsetExpires_in(); + void setExpiresIn(int64_t value); + + +protected: + std::shared_ptr m_Token_type; + bool m_Token_typeIsSet; + + utility::string_t m_Access_token; + bool m_Access_tokenIsSet; + + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; + + utility::string_t m_Scope; + bool m_ScopeIsSet; + + utility::string_t m_State; + bool m_StateIsSet; + + int64_t m_Expires_in; + bool m_Expires_inIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_TokenResponse_H_ */ diff --git a/include/tribufu++/model/TokenType.h b/include/tribufu++/model/TokenType.h new file mode 100644 index 00000000..ee012adc --- /dev/null +++ b/include/tribufu++/model/TokenType.h @@ -0,0 +1,63 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * TokenType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_TokenType_H_ +#define TRIBUFU_MODELS_TokenType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class TokenType + : public ModelBase +{ +public: + TokenType(); + virtual ~TokenType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eTokenType + { + TokenType_BEARER, + }; + + eTokenType getValue() const; + void setValue(eTokenType const value); + + protected: + eTokenType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_TokenType_H_ */ diff --git a/include/tribufu++/model/UpdateProfile.h b/include/tribufu++/model/UpdateProfile.h new file mode 100644 index 00000000..5907485f --- /dev/null +++ b/include/tribufu++/model/UpdateProfile.h @@ -0,0 +1,79 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * UpdateProfile.h + * + * + */ + +#ifndef TRIBUFU_MODELS_UpdateProfile_H_ +#define TRIBUFU_MODELS_UpdateProfile_H_ + + +#include "tribufu++/ModelBase.h" + +#include + +namespace tribufu { +namespace models { + + + +class UpdateProfile + : public ModelBase +{ +public: + UpdateProfile(); + virtual ~UpdateProfile(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// UpdateProfile members + + + utility::string_t getDisplayName() const; + bool displayNameIsSet() const; + void unsetDisplay_name(); + void setDisplayName(const utility::string_t& value); + + utility::string_t getBiography() const; + bool biographyIsSet() const; + void unsetBiography(); + void setBiography(const utility::string_t& value); + + +protected: + utility::string_t m_Display_name; + bool m_Display_nameIsSet; + + utility::string_t m_Biography; + bool m_BiographyIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_UpdateProfile_H_ */ diff --git a/include/tribufu++/model/UserInfo.h b/include/tribufu++/model/UserInfo.h new file mode 100644 index 00000000..2869039b --- /dev/null +++ b/include/tribufu++/model/UserInfo.h @@ -0,0 +1,265 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * UserInfo.h + * + * + */ + +#ifndef TRIBUFU_MODELS_UserInfo_H_ +#define TRIBUFU_MODELS_UserInfo_H_ + +#include + +#include "tribufu++/ModelBase.h" + +#include "tribufu++/model/UserType.h" +#include + +namespace tribufu { +namespace models { + + + +class UserInfo + : public ModelBase +{ +public: + UserInfo(); + virtual ~UserInfo(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// UserInfo members + + + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(const utility::string_t& value); + + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(const utility::string_t& value); + + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(const utility::string_t& value); + + utility::string_t getDisplayName() const; + bool displayNameIsSet() const; + void unsetDisplay_name(); + void setDisplayName(const utility::string_t& value); + + utility::string_t getEmail() const; + bool emailIsSet() const; + void unsetEmail(); + void setEmail(const utility::string_t& value); + + std::shared_ptr getType() const; + bool typeIsSet() const; + void unsetType(); + void setType(const std::shared_ptr& value); + + utility::string_t getFlags() const; + bool flagsIsSet() const; + void unsetFlags(); + void setFlags(const utility::string_t& value); + + utility::string_t getPermissions() const; + bool permissionsIsSet() const; + void unsetPermissions(); + void setPermissions(const utility::string_t& value); + + bool isVerified() const; + bool verifiedIsSet() const; + void unsetVerified(); + void setVerified(bool value); + + int32_t getLevel() const; + bool levelIsSet() const; + void unsetLevel(); + void setLevel(int32_t value); + + double getExperience() const; + bool experienceIsSet() const; + void unsetExperience(); + void setExperience(double value); + + bool isPublicBirthday() const; + bool publicBirthdayIsSet() const; + void unsetPublic_birthday(); + void setPublicBirthday(bool value); + + utility::datetime getBirthday() const; + bool birthdayIsSet() const; + void unsetBirthday(); + void setBirthday(const utility::datetime& value); + + double getPoints() const; + bool pointsIsSet() const; + void unsetPoints(); + void setPoints(double value); + + utility::string_t getLocation() const; + bool locationIsSet() const; + void unsetLocation(); + void setLocation(const utility::string_t& value); + + utility::string_t getLanguage() const; + bool languageIsSet() const; + void unsetLanguage(); + void setLanguage(const utility::string_t& value); + + utility::string_t getTimezone() const; + bool timezoneIsSet() const; + void unsetTimezone(); + void setTimezone(const utility::string_t& value); + + utility::string_t getCurrency() const; + bool currencyIsSet() const; + void unsetCurrency(); + void setCurrency(const utility::string_t& value); + + utility::string_t getPhotoUrl() const; + bool photoUrlIsSet() const; + void unsetPhoto_url(); + void setPhotoUrl(const utility::string_t& value); + + utility::string_t getBannerUrl() const; + bool bannerUrlIsSet() const; + void unsetBanner_url(); + void setBannerUrl(const utility::string_t& value); + + utility::datetime getLastOnline() const; + bool lastOnlineIsSet() const; + void unsetLast_online(); + void setLastOnline(const utility::datetime& value); + + utility::string_t getBiography() const; + bool biographyIsSet() const; + void unsetBiography(); + void setBiography(const utility::string_t& value); + + int32_t getViewCount() const; + bool viewCountIsSet() const; + void unsetView_count(); + void setViewCount(int32_t value); + + utility::datetime getCreated() const; + bool createdIsSet() const; + void unsetCreated(); + void setCreated(const utility::datetime& value); + + utility::datetime getUpdated() const; + bool updatedIsSet() const; + void unsetUpdated(); + void setUpdated(const utility::datetime& value); + + +protected: + utility::string_t m_Id; + bool m_IdIsSet; + + utility::string_t m_Uuid; + bool m_UuidIsSet; + + utility::string_t m_Name; + bool m_NameIsSet; + + utility::string_t m_Display_name; + bool m_Display_nameIsSet; + + utility::string_t m_Email; + bool m_EmailIsSet; + + std::shared_ptr m_Type; + bool m_TypeIsSet; + + utility::string_t m_Flags; + bool m_FlagsIsSet; + + utility::string_t m_Permissions; + bool m_PermissionsIsSet; + + bool m_Verified; + bool m_VerifiedIsSet; + + int32_t m_Level; + bool m_LevelIsSet; + + double m_Experience; + bool m_ExperienceIsSet; + + bool m_Public_birthday; + bool m_Public_birthdayIsSet; + + utility::datetime m_Birthday; + bool m_BirthdayIsSet; + + double m_Points; + bool m_PointsIsSet; + + utility::string_t m_Location; + bool m_LocationIsSet; + + utility::string_t m_Language; + bool m_LanguageIsSet; + + utility::string_t m_Timezone; + bool m_TimezoneIsSet; + + utility::string_t m_Currency; + bool m_CurrencyIsSet; + + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; + + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; + + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; + + utility::string_t m_Biography; + bool m_BiographyIsSet; + + int32_t m_View_count; + bool m_View_countIsSet; + + utility::datetime m_Created; + bool m_CreatedIsSet; + + utility::datetime m_Updated; + bool m_UpdatedIsSet; + +}; + + +} +} + +#endif /* TRIBUFU_MODELS_UserInfo_H_ */ diff --git a/include/tribufu++/model/UserType.h b/include/tribufu++/model/UserType.h new file mode 100644 index 00000000..cc833569 --- /dev/null +++ b/include/tribufu++/model/UserType.h @@ -0,0 +1,64 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * UserType.h + * + * + */ + +#ifndef TRIBUFU_MODELS_UserType_H_ +#define TRIBUFU_MODELS_UserType_H_ + + +#include "tribufu++/ModelBase.h" + + +namespace tribufu { +namespace models { + + +class UserType + : public ModelBase +{ +public: + UserType(); + virtual ~UserType(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + enum class eUserType + { + UserType_USER, + UserType_BOT, + }; + + eUserType getValue() const; + void setValue(eUserType const value); + + protected: + eUserType m_value; +}; + +} +} + +#endif /* TRIBUFU_MODELS_UserType_H_ */ diff --git a/scripts/cmake.ps1 b/scripts/cmake.ps1 new file mode 100644 index 00000000..ee4505ed --- /dev/null +++ b/scripts/cmake.ps1 @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +# cmake -G "Visual Studio 17 2022" -A x64 + +# cmake -B build -S . -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + +cmake -G "Unix Makefiles" diff --git a/scripts/generate.ps1 b/scripts/generate.ps1 index 658267c6..21ec11d3 100644 --- a/scripts/generate.ps1 +++ b/scripts/generate.ps1 @@ -5,6 +5,6 @@ java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate ` -g cpp-restsdk ` -o . ` --global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false ` - --additional-properties=packageName=tribufu,apiPackage=tribufu::api,modelPackage=tribufu::models ` + --additional-properties=packageName=tribufu++,apiPackage=tribufu.api,modelPackage=tribufu.models ` --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated ` --skip-validate-spec diff --git a/scripts/gmake.sh b/scripts/gmake.sh index 91baa13e..e279303e 100755 --- a/scripts/gmake.sh +++ b/scripts/gmake.sh @@ -1,10 +1,3 @@ #!/usr/bin/env sh -# Linux (x64) make config=debug_linux-x64 - -# Linux (x86) -make config=debug_linux-x86 - -# Linux (arm64) -make config=debug_linux-arm64 diff --git a/src/AnyType.cpp b/src/AnyType.cpp new file mode 100644 index 00000000..26bf7507 --- /dev/null +++ b/src/AnyType.cpp @@ -0,0 +1,49 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/AnyType.h" + +namespace tribufu { +namespace models { + +AnyType::AnyType() { m_value = web::json::value::null(); } + +AnyType::~AnyType() {} + +void AnyType::validate() {} + +web::json::value AnyType::toJson() const { return m_value; } + +bool AnyType::fromJson(const web::json::value &val) { + m_value = val; + m_IsSet = true; + return isSet(); +} + +void AnyType::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { + if (m_value.is_object()) { + return Object::toMultipart(multipart, prefix); + } + throw std::runtime_error("AnyType::toMultipart: unsupported type"); +} + +bool AnyType::fromMultiPart(std::shared_ptr multipart, + const utility::string_t &prefix) { + if (m_value.is_object()) { + return Object::fromMultiPart(multipart, prefix); + } + return false; +} + +} +} diff --git a/src/ApiClient.cpp b/src/ApiClient.cpp new file mode 100644 index 00000000..ab02bbe4 --- /dev/null +++ b/src/ApiClient.cpp @@ -0,0 +1,205 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/ApiClient.h" +#include "tribufu++/MultipartFormData.h" +#include "tribufu++/ModelBase.h" + +#include +#include +#include + +template +utility::string_t toString(const T value) +{ + utility::ostringstream_t out; + out << std::setprecision(std::numeric_limits::digits10) << std::fixed << value; + return out.str(); +} + +namespace tribufu { +namespace api { + +using namespace tribufu::models; + +ApiClient::ApiClient(std::shared_ptr configuration ) + : m_Configuration(configuration) +{ +} +ApiClient::~ApiClient() +{ +} + +const ApiClient::ResponseHandlerType& ApiClient::getResponseHandler() const { + return m_ResponseHandler; +} + +void ApiClient::setResponseHandler(const ResponseHandlerType& responseHandler) { + m_ResponseHandler = responseHandler; +} + +std::shared_ptr ApiClient::getConfiguration() const +{ + return m_Configuration; +} +void ApiClient::setConfiguration(std::shared_ptr configuration) +{ + m_Configuration = configuration; +} + + +utility::string_t ApiClient::parameterToString(utility::string_t value) +{ + return value; +} +utility::string_t ApiClient::parameterToString(int64_t value) +{ + std::stringstream valueAsStringStream; + valueAsStringStream << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); +} +utility::string_t ApiClient::parameterToString(int32_t value) +{ + std::stringstream valueAsStringStream; + valueAsStringStream << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); +} + +utility::string_t ApiClient::parameterToString(float value) +{ + return utility::conversions::to_string_t(toString(value)); +} + +utility::string_t ApiClient::parameterToString(double value) +{ + return utility::conversions::to_string_t(toString(value)); +} + +utility::string_t ApiClient::parameterToString(const utility::datetime &value) +{ + return utility::conversions::to_string_t(value.to_string(utility::datetime::ISO_8601)); +} + +utility::string_t ApiClient::parameterToString(bool value) +{ + std::stringstream valueAsStringStream; + valueAsStringStream << std::boolalpha << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); +} + +pplx::task ApiClient::callApi( + const utility::string_t& path, + const utility::string_t& method, + const std::map& queryParams, + const std::shared_ptr postBody, + const std::map& headerParams, + const std::map& formParams, + const std::map>& fileParams, + const utility::string_t& contentType +) const +{ + if (postBody != nullptr && formParams.size() != 0) + { + throw ApiException(400, utility::conversions::to_string_t("Cannot have body and form params")); + } + + if (postBody != nullptr && fileParams.size() != 0) + { + throw ApiException(400, utility::conversions::to_string_t("Cannot have body and file params")); + } + + if (fileParams.size() > 0 && contentType != utility::conversions::to_string_t("multipart/form-data")) + { + throw ApiException(400, utility::conversions::to_string_t("Operations with file parameters must be called with multipart/form-data")); + } + + web::http::client::http_client client(m_Configuration->getBaseUrl(), m_Configuration->getHttpConfig()); + + web::http::http_request request; + for (const auto& kvp : headerParams) + { + request.headers().add(kvp.first, kvp.second); + } + + if (fileParams.size() > 0) + { + MultipartFormData uploadData; + for (const auto& kvp : formParams) + { + uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second)); + } + for (const auto& kvp : fileParams) + { + uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second)); + } + std::stringstream data; + uploadData.writeTo(data); + auto bodyString = data.str(); + const auto length = bodyString.size(); + request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, utility::conversions::to_string_t("multipart/form-data; boundary=") + uploadData.getBoundary()); + } + else + { + if (postBody != nullptr) + { + std::stringstream data; + postBody->writeTo(data); + auto bodyString = data.str(); + const auto length = bodyString.size(); + request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType); + } + else + { + if (contentType == utility::conversions::to_string_t("application/json")) + { + web::json::value body_data = web::json::value::object(); + for (auto& kvp : formParams) + { + body_data[kvp.first] = ModelBase::toJson(kvp.second); + } + if (!formParams.empty()) + { + request.set_body(body_data); + } + } + else + { + web::http::uri_builder formData; + for (const auto& kvp : formParams) + { + formData.append_query(kvp.first, kvp.second); + } + if (!formParams.empty()) + { + request.set_body(formData.query(), utility::conversions::to_string_t("application/x-www-form-urlencoded")); + } + } + } + } + + web::http::uri_builder builder(path); + for (const auto& kvp : queryParams) + { + builder.append_query(kvp.first, kvp.second); + } + request.set_request_uri(builder.to_uri()); + request.set_method(method); + if ( !request.headers().has( web::http::header_names::user_agent ) ) + { + request.headers().add( web::http::header_names::user_agent, m_Configuration->getUserAgent() ); + } + + return client.request(request); +} + +} +} diff --git a/src/ApiConfiguration.cpp b/src/ApiConfiguration.cpp new file mode 100644 index 00000000..9973a88e --- /dev/null +++ b/src/ApiConfiguration.cpp @@ -0,0 +1,82 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/ApiConfiguration.h" + +namespace tribufu { +namespace api { + +ApiConfiguration::ApiConfiguration() +{ +} + +ApiConfiguration::~ApiConfiguration() +{ +} + +const web::http::client::http_client_config& ApiConfiguration::getHttpConfig() const +{ + return m_HttpConfig; +} + +void ApiConfiguration::setHttpConfig( web::http::client::http_client_config& value ) +{ + m_HttpConfig = value; +} + +utility::string_t ApiConfiguration::getBaseUrl() const +{ + return m_BaseUrl; +} + +void ApiConfiguration::setBaseUrl( const utility::string_t value ) +{ + m_BaseUrl = value; +} + +utility::string_t ApiConfiguration::getUserAgent() const +{ + return m_UserAgent; +} + +void ApiConfiguration::setUserAgent( const utility::string_t value ) +{ + m_UserAgent = value; +} + +std::map& ApiConfiguration::getDefaultHeaders() +{ + return m_DefaultHeaders; +} + +const std::map& ApiConfiguration::getDefaultHeaders() const +{ + return m_DefaultHeaders; +} + +utility::string_t ApiConfiguration::getApiKey( const utility::string_t& prefix) const +{ + auto result = m_ApiKeys.find(prefix); + if( result != m_ApiKeys.end() ) + { + return result->second; + } + return utility::conversions::to_string_t(""); +} + +void ApiConfiguration::setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey ) +{ + m_ApiKeys[prefix] = apiKey; +} + +} +} diff --git a/src/ApiException.cpp b/src/ApiException.cpp new file mode 100644 index 00000000..97dd932a --- /dev/null +++ b/src/ApiException.cpp @@ -0,0 +1,50 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/ApiException.h" + +namespace tribufu { +namespace api { + +ApiException::ApiException( int errorCode + , const utility::string_t& message + , std::shared_ptr content /*= nullptr*/ ) + : web::http::http_exception( errorCode, message ) + , m_Content(content) +{ +} +ApiException::ApiException( int errorCode + , const utility::string_t& message + , std::map& headers + , std::shared_ptr content /*= nullptr*/ ) + : web::http::http_exception( errorCode, message ) + , m_Content(content) + , m_Headers(headers) +{ +} + +ApiException::~ApiException() +{ +} + +std::shared_ptr ApiException::getContent() const +{ + return m_Content; +} + +std::map& ApiException::getHeaders() +{ + return m_Headers; +} + +} +} diff --git a/src/HttpContent.cpp b/src/HttpContent.cpp new file mode 100644 index 00000000..c2f6b5fe --- /dev/null +++ b/src/HttpContent.cpp @@ -0,0 +1,83 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/HttpContent.h" + +namespace tribufu { +namespace models { + +HttpContent::HttpContent() +{ +} + +HttpContent::~HttpContent() +{ +} + +utility::string_t HttpContent::getContentDisposition() const +{ + return m_ContentDisposition; +} + +void HttpContent::setContentDisposition( const utility::string_t & value ) +{ + m_ContentDisposition = value; +} + +utility::string_t HttpContent::getName() const +{ + return m_Name; +} + +void HttpContent::setName( const utility::string_t & value ) +{ + m_Name = value; +} + +utility::string_t HttpContent::getFileName() const +{ + return m_FileName; +} + +void HttpContent::setFileName( const utility::string_t & value ) +{ + m_FileName = value; +} + +utility::string_t HttpContent::getContentType() const +{ + return m_ContentType; +} + +void HttpContent::setContentType( const utility::string_t & value ) +{ + m_ContentType = value; +} + +std::shared_ptr HttpContent::getData() const +{ + return m_Data; +} + +void HttpContent::setData( std::shared_ptr value ) +{ + m_Data = value; +} + +void HttpContent::writeTo( std::ostream& stream ) +{ + m_Data->seekg( 0, m_Data->beg ); + stream << m_Data->rdbuf(); +} + +} +} diff --git a/src/JsonBody.cpp b/src/JsonBody.cpp new file mode 100644 index 00000000..6619009a --- /dev/null +++ b/src/JsonBody.cpp @@ -0,0 +1,33 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/JsonBody.h" + +namespace tribufu { +namespace models { + +JsonBody::JsonBody( const web::json::value& json) + : m_Json(json) +{ +} + +JsonBody::~JsonBody() +{ +} + +void JsonBody::writeTo( std::ostream& target ) +{ + m_Json.serialize(target); +} + +} +} diff --git a/src/ModelBase.cpp b/src/ModelBase.cpp new file mode 100644 index 00000000..18e2b197 --- /dev/null +++ b/src/ModelBase.cpp @@ -0,0 +1,662 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/ModelBase.h" + +namespace tribufu { +namespace models { + +ModelBase::ModelBase(): m_IsSet(false) +{ +} +ModelBase::~ModelBase() +{ +} +bool ModelBase::isSet() const +{ + return m_IsSet; +} +utility::string_t ModelBase::toString( const bool val ) +{ + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); +} +utility::string_t ModelBase::toString( const float val ) +{ + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); +} +utility::string_t ModelBase::toString( const double val ) +{ + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); +} +utility::string_t ModelBase::toString( const int32_t val ) +{ + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); +} +utility::string_t ModelBase::toString( const int64_t val ) +{ + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); +} +utility::string_t ModelBase::toString (const utility::string_t &val ) +{ + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); +} +utility::string_t ModelBase::toString( const utility::datetime &val ) +{ + return val.to_string(utility::datetime::ISO_8601); +} +utility::string_t ModelBase::toString( const web::json::value &val ) +{ + return val.serialize(); +} +utility::string_t ModelBase::toString( const std::shared_ptr& val ) +{ + utility::stringstream_t ss; + if( val != nullptr ) + { + ss << val->getData(); + } + return utility::string_t(ss.str()); +} +web::json::value ModelBase::toJson(bool value) +{ + return web::json::value::boolean(value); +} +web::json::value ModelBase::toJson( float value ) +{ + return web::json::value::number(value); +} +web::json::value ModelBase::toJson( double value ) +{ + return web::json::value::number(value); +} +web::json::value ModelBase::toJson( int32_t value ) +{ + return web::json::value::number(value); +} +web::json::value ModelBase::toJson( int64_t value ) +{ + return web::json::value::number(value); +} +web::json::value ModelBase::toJson( const utility::string_t& value ) +{ + return web::json::value::string(value); +} +web::json::value ModelBase::toJson( const utility::datetime& value ) +{ + return web::json::value::string(value.to_string(utility::datetime::ISO_8601)); +} +web::json::value ModelBase::toJson( const web::json::value& value ) +{ + return value; +} +web::json::value ModelBase::toJson( const std::shared_ptr& content ) +{ + web::json::value value; + if(content != nullptr) + { + value[utility::conversions::to_string_t("ContentDisposition")] = ModelBase::toJson(content->getContentDisposition()); + value[utility::conversions::to_string_t("ContentType")] = ModelBase::toJson(content->getContentType()); + value[utility::conversions::to_string_t("FileName")] = ModelBase::toJson(content->getFileName()); + value[utility::conversions::to_string_t("InputStream")] = web::json::value::string( ModelBase::toBase64(content->getData()) ); + } + return value; +} +web::json::value ModelBase::toJson( const std::shared_ptr& val ) +{ + web::json::value retVal; + if(val != nullptr) + { + retVal = toJson(*val); + } + return retVal; +} +bool ModelBase::fromString( const utility::string_t& val, bool &outVal ) +{ + utility::stringstream_t ss(val); + bool success = true; + try + { + ss >> outVal; + } + catch (...) + { + success = false; + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, float &outVal ) +{ + utility::stringstream_t ss(val); + bool success = true; + try + { + ss >> outVal; + } + catch (...) + { + int64_t intVal = 0; + success = ModelBase::fromString(val, intVal); + if(success) + { + outVal = static_cast(intVal); + } + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, double &outVal ) +{ + utility::stringstream_t ss(val); + bool success = true; + try + { + ss >> outVal; + } + catch (...) + { + int64_t intVal = 0; + success = ModelBase::fromString(val, intVal); + if(success) + { + outVal = static_cast(intVal); + } + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, int32_t &outVal ) +{ + utility::stringstream_t ss(val); + bool success = true; + try + { + ss >> outVal; + } + catch (...) + { + success = false; + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, int64_t &outVal ) +{ + utility::stringstream_t ss(val); + bool success = true; + try + { + ss >> outVal; + } + catch (...) + { + success = false; + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, utility::string_t &outVal ) +{ + utility::stringstream_t ss(val); + bool success = true; + try + { + ss >> outVal; + } + catch (...) + { + success = false; + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, utility::datetime &outVal ) +{ + bool success = true; + auto dt = utility::datetime::from_string(val, utility::datetime::ISO_8601); + if( dt.is_initialized() ) + { + outVal = dt; + } + else + { + success = false; + } + return success; +} +bool ModelBase::fromString( const utility::string_t& val, web::json::value &outVal ) +{ + outVal = web::json::value::parse(val); + return !outVal.is_null(); +} +bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr& outVal ) +{ + bool ok = true; + if(outVal == nullptr) + { + outVal = std::shared_ptr(new HttpContent()); + } + if(outVal != nullptr) + { + outVal->setData(std::shared_ptr(new std::stringstream(utility::conversions::to_utf8string(val)))); + } + else + { + ok = false; + } + return ok; +} +bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr& outVal ) +{ + bool ok = false; + if(outVal == nullptr) + { + outVal = std::shared_ptr(new utility::datetime()); + } + if( outVal != nullptr ) + { + ok = fromJson(web::json::value::parse(val), *outVal); + } + return ok; +} +bool ModelBase::fromJson( const web::json::value& val, bool & outVal ) +{ + outVal = !val.is_boolean() ? false : val.as_bool(); + return val.is_boolean(); +} +bool ModelBase::fromJson( const web::json::value& val, float & outVal ) +{ + outVal = (!val.is_double() && !val.is_integer()) ? std::numeric_limits::quiet_NaN(): static_cast(val.as_double()); + return val.is_double() || val.is_integer(); +} +bool ModelBase::fromJson( const web::json::value& val, double & outVal ) +{ + outVal = (!val.is_double() && !val.is_integer()) ? std::numeric_limits::quiet_NaN(): val.as_double(); + return val.is_double() || val.is_integer(); +} +bool ModelBase::fromJson( const web::json::value& val, int32_t & outVal ) +{ + outVal = !val.is_integer() ? std::numeric_limits::quiet_NaN() : val.as_integer(); + return val.is_integer(); +} +bool ModelBase::fromJson( const web::json::value& val, int64_t & outVal ) +{ + outVal = !val.is_number() ? std::numeric_limits::quiet_NaN() : val.as_number().to_int64(); + return val.is_number(); +} +bool ModelBase::fromJson( const web::json::value& val, utility::string_t & outVal ) +{ + outVal = val.is_string() ? val.as_string() : utility::conversions::to_string_t(""); + return val.is_string(); +} +bool ModelBase::fromJson( const web::json::value& val, utility::datetime & outVal ) +{ + outVal = val.is_null() ? utility::datetime::from_string(utility::conversions::to_string_t("NULL"), utility::datetime::ISO_8601) : utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601); + return outVal.is_initialized(); +} +bool ModelBase::fromJson( const web::json::value& val, web::json::value & outVal ) +{ + outVal = val; + return !val.is_null(); +} +bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr& content ) +{ + bool result = false; + if( content != nullptr) + { + result = true; + if(content == nullptr) + { + content = std::shared_ptr(new HttpContent()); + } + if(val.has_field(utility::conversions::to_string_t("ContentDisposition"))) + { + utility::string_t value; + result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("ContentDisposition")), value); + content->setContentDisposition( value ); + } + if(val.has_field(utility::conversions::to_string_t("ContentType"))) + { + utility::string_t value; + result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("ContentType")), value); + content->setContentType( value ); + } + if(val.has_field(utility::conversions::to_string_t("FileName"))) + { + utility::string_t value; + result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("FileName")), value); + content->setFileName( value ); + } + if(val.has_field(utility::conversions::to_string_t("InputStream"))) + { + utility::string_t value; + result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("InputStream")), value); + content->setData( ModelBase::fromBase64( value ) ); + } + } + return result; +} +bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr &outVal ) +{ + bool ok = false; + if(outVal == nullptr) + { + outVal = std::shared_ptr(new utility::datetime()); + } + if( outVal != nullptr ) + { + ok = fromJson(val, *outVal); + } + return ok; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, bool value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, float value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream) ) ; + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType) +{ + std::shared_ptr content(new HttpContent); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::shared_ptr( new std::stringstream( utility::conversions::to_utf8string(value) ) ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::shared_ptr( new std::stringstream( utility::conversions::to_utf8string(value.to_string(utility::datetime::ISO_8601) ) ) ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const web::json::value& value, const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::shared_ptr( new std::stringstream( utility::conversions::to_utf8string(value.serialize()) ) ) ); + return content; +} +std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::shared_ptr& value ) +{ + std::shared_ptr content( new HttpContent ); + if( value != nullptr ) + { + content->setName( name ); + content->setContentDisposition( value->getContentDisposition() ); + content->setContentType( value->getContentType() ); + content->setData( value->getData() ); + content->setFileName( value->getFileName() ); + } + return content; +} +std::shared_ptr ModelBase::toHttpContent(const utility::string_t& name, const std::shared_ptr& value , const utility::string_t& contentType ) +{ + std::shared_ptr content( new HttpContent ); + if (value != nullptr ) + { + content->setName( name ); + content->setContentDisposition( utility::conversions::to_string_t("form-data") ); + content->setContentType( contentType ); + content->setData( std::shared_ptr( new std::stringstream( utility::conversions::to_utf8string( toJson(*value).serialize() ) ) ) ); + } + return content; +} +bool ModelBase::fromHttpContent(std::shared_ptr val, bool & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +bool ModelBase::fromHttpContent(std::shared_ptr val, float & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +bool ModelBase::fromHttpContent(std::shared_ptr val, double & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +bool ModelBase::fromHttpContent(std::shared_ptr val, int32_t & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +bool ModelBase::fromHttpContent(std::shared_ptr val, int64_t & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +bool ModelBase::fromHttpContent(std::shared_ptr val, utility::string_t & outVal ) +{ + if( val == nullptr ) return false; + std::shared_ptr data = val->getData(); + data->seekg( 0, data->beg ); + + std::string str((std::istreambuf_iterator(*data.get())), + std::istreambuf_iterator()); + outVal = utility::conversions::to_string_t(str); + return true; +} +bool ModelBase::fromHttpContent(std::shared_ptr val, utility::datetime & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + outVal = utility::datetime::from_string(str, utility::datetime::ISO_8601); + return true; +} +bool ModelBase::fromHttpContent(std::shared_ptr val, web::json::value & outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +bool ModelBase::fromHttpContent(std::shared_ptr val, std::shared_ptr& outVal ) +{ + utility::string_t str; + if( val == nullptr ) return false; + if( outVal == nullptr ) + { + outVal = std::shared_ptr(new HttpContent()); + } + ModelBase::fromHttpContent(val, str); + return fromString(str, outVal); +} +// base64 encoding/decoding based on : https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64#C.2B.2B +const static char Base64Chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +const static char Base64PadChar = '='; +utility::string_t ModelBase::toBase64( utility::string_t value ) +{ + std::shared_ptr source( new std::stringstream( utility::conversions::to_utf8string(value) ) ); + return ModelBase::toBase64(source); +} +utility::string_t ModelBase::toBase64( std::shared_ptr value ) +{ + value->seekg( 0, value->end ); + size_t length = value->tellg(); + value->seekg( 0, value->beg ); + utility::string_t base64; + base64.reserve( ((length / 3) + (length % 3 > 0)) * 4 ); + char read[3] = { 0 }; + uint32_t temp; + for ( size_t idx = 0; idx < length / 3; idx++ ) + { + value->read( read, 3 ); + temp = (read[0]) << 16; + temp += (read[1]) << 8; + temp += (read[2]); + base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] ); + base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] ); + base64.append( 1, Base64Chars[(temp & 0x00000FC0) >> 6] ); + base64.append( 1, Base64Chars[(temp & 0x0000003F)] ); + } + switch ( length % 3 ) + { + case 1: + value->read( read, 1 ); + temp = read[0] << 16; + base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] ); + base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] ); + base64.append( 2, Base64PadChar ); + break; + case 2: + value->read( read, 2 ); + temp = read[0] << 16; + temp += read[1] << 8; + base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] ); + base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] ); + base64.append( 1, Base64Chars[(temp & 0x00000FC0) >> 6] ); + base64.append( 1, Base64PadChar ); + break; + } + return base64; +} +std::shared_ptr ModelBase::fromBase64( const utility::string_t& encoded ) +{ + std::shared_ptr result(new std::stringstream); + + char outBuf[3] = { 0 }; + uint32_t temp = 0; + + utility::string_t::const_iterator cursor = encoded.begin(); + while ( cursor < encoded.end() ) + { + for ( size_t quantumPosition = 0; quantumPosition < 4; quantumPosition++ ) + { + temp <<= 6; + if ( *cursor >= 0x41 && *cursor <= 0x5A ) + { + temp |= *cursor - 0x41; + } + else if ( *cursor >= 0x61 && *cursor <= 0x7A ) + { + temp |= *cursor - 0x47; + } + else if ( *cursor >= 0x30 && *cursor <= 0x39 ) + { + temp |= *cursor + 0x04; + } + else if ( *cursor == 0x2B ) + { + temp |= 0x3E; //change to 0x2D for URL alphabet + } + else if ( *cursor == 0x2F ) + { + temp |= 0x3F; //change to 0x5F for URL alphabet + } + else if ( *cursor == Base64PadChar ) //pad + { + switch ( encoded.end() - cursor ) + { + case 1: //One pad character + outBuf[0] = (temp >> 16) & 0x000000FF; + outBuf[1] = (temp >> 8) & 0x000000FF; + result->write( outBuf, 2 ); + return result; + case 2: //Two pad characters + outBuf[0] = (temp >> 10) & 0x000000FF; + result->write( outBuf, 1 ); + return result; + default: + throw web::json::json_exception( utility::conversions::to_string_t( "Invalid Padding in Base 64!" ).c_str() ); + } + } + else + { + throw web::json::json_exception( utility::conversions::to_string_t( "Non-Valid Character in Base 64!" ).c_str() ); + } + ++cursor; + } + + outBuf[0] = (temp >> 16) & 0x000000FF; + outBuf[1] = (temp >> 8) & 0x000000FF; + outBuf[2] = (temp) & 0x000000FF; + result->write( outBuf, 3 ); + } + + return result; +} + +} +} diff --git a/src/MultipartFormData.cpp b/src/MultipartFormData.cpp new file mode 100644 index 00000000..c73395c5 --- /dev/null +++ b/src/MultipartFormData.cpp @@ -0,0 +1,109 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/MultipartFormData.h" +#include "tribufu++/ModelBase.h" + +#include +#include + +namespace tribufu { +namespace models { + +MultipartFormData::MultipartFormData() +{ + utility::stringstream_t uuidString; + uuidString << boost::uuids::random_generator()(); + m_Boundary = uuidString.str(); +} + +MultipartFormData::MultipartFormData(const utility::string_t& boundary) + : m_Boundary(boundary) +{ + +} + +MultipartFormData::~MultipartFormData() +{ +} + +utility::string_t MultipartFormData::getBoundary() +{ + return m_Boundary; +} + +void MultipartFormData::add( std::shared_ptr content ) +{ + m_Contents.push_back( content ); + m_ContentLookup[content->getName()] = content; +} + +bool MultipartFormData::hasContent(const utility::string_t& name) const +{ + return m_ContentLookup.find(name) != m_ContentLookup.end(); +} + +std::shared_ptr MultipartFormData::getContent(const utility::string_t& name) const +{ + auto result = m_ContentLookup.find(name); + if(result == m_ContentLookup.end()) + { + return std::shared_ptr(nullptr); + } + return result->second; +} + +void MultipartFormData::writeTo( std::ostream& target ) +{ + for ( size_t i = 0; i < m_Contents.size(); i++ ) + { + std::shared_ptr content = m_Contents[i]; + + // boundary + target << "\r\n" << "--" << utility::conversions::to_utf8string( m_Boundary ) << "\r\n"; + + // headers + target << "Content-Disposition: " << utility::conversions::to_utf8string( content->getContentDisposition() ); + if ( content->getName().size() > 0 ) + { + target << "; name=\"" << utility::conversions::to_utf8string( content->getName() ) << "\""; + } + if ( content->getFileName().size() > 0 ) + { + target << "; filename=\"" << utility::conversions::to_utf8string( content->getFileName() ) << "\""; + } + target << "\r\n"; + + if ( content->getContentType().size() > 0 ) + { + target << "Content-Type: " << utility::conversions::to_utf8string( content->getContentType() ) << "\r\n"; + } + + target << "\r\n"; + + // body + std::shared_ptr data = content->getData(); + + data->seekg( 0, data->end ); + std::vector dataBytes( data->tellg() ); + + data->seekg( 0, data->beg ); + data->read( &dataBytes[0], dataBytes.size() ); + + std::copy( dataBytes.begin(), dataBytes.end(), std::ostreambuf_iterator( target ) ); + } + + target << "\r\n--" << utility::conversions::to_utf8string( m_Boundary ) << "--\r\n"; +} + +} +} diff --git a/src/Object.cpp b/src/Object.cpp new file mode 100644 index 00000000..9552ea80 --- /dev/null +++ b/src/Object.cpp @@ -0,0 +1,88 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "tribufu++/Object.h" + +namespace tribufu { +namespace models { + +Object::Object() +{ + m_object = web::json::value::object(); +} + +Object::~Object() +{ +} + +void Object::validate() +{ + +} + +web::json::value Object::toJson() const +{ + return m_object; +} + +bool Object::fromJson(const web::json::value& val) +{ + if (val.is_object()) + { + m_object = val; + m_IsSet = true; + } + return isSet(); +} + +void Object::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + { + namePrefix += utility::conversions::to_string_t("."); + } + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("object"), m_object)); +} + +bool Object::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + { + namePrefix += utility::conversions::to_string_t("."); + } + + if( ModelBase::fromHttpContent(multipart->getContent(namePrefix + utility::conversions::to_string_t("object")), m_object ) ) + { + m_IsSet = true; + } + return isSet(); +} + +web::json::value Object::getValue(const utility::string_t& key) const +{ + return m_object.at(key); +} + + +void Object::setValue(const utility::string_t& key, const web::json::value& value) +{ + if( !value.is_null() ) + { + m_object[key] = value; + m_IsSet = true; + } +} + +} +} diff --git a/src/api/TribufuGeneratedApi.cpp b/src/api/TribufuGeneratedApi.cpp new file mode 100644 index 00000000..f6af567d --- /dev/null +++ b/src/api/TribufuGeneratedApi.cpp @@ -0,0 +1,9845 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +#include "tribufu++/api/TribufuGeneratedApi.h" +#include "tribufu++/IHttpBody.h" +#include "tribufu++/JsonBody.h" +#include "tribufu++/MultipartFormData.h" + +#include + +#include + +namespace tribufu { +namespace api { + +using namespace tribufu::models; + +TribufuGeneratedApi::TribufuGeneratedApi( std::shared_ptr apiClient ) + : m_ApiClient(apiClient) +{ +} + +TribufuGeneratedApi::~TribufuGeneratedApi() +{ +} + +pplx::task TribufuGeneratedApi::authorize(boost::optional> authorizeRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/authorize"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->authorize does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (authorizeRequest) + localVarJson = ModelBase::toJson(*authorizeRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(authorizeRequest && (*authorizeRequest).get()) + { + (*authorizeRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("authorizeRequest")); + } + + + 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("TribufuGeneratedApi->authorize does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 authorize: ") + localVarResponse.reason_phrase() + , std::make_shared(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 authorize: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::changeEmail(utility::string_t id, boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/email"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->changeEmail does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->changeEmail does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 changeEmail: ") + localVarResponse.reason_phrase() + , std::make_shared(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 changeEmail: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::changePassword(utility::string_t id, boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/password"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->changePassword does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->changePassword does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 changePassword: ") + localVarResponse.reason_phrase() + , std::make_shared(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 changePassword: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::claimGameServer(utility::string_t id, boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}/claim"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->claimGameServer does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->claimGameServer does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 claimGameServer: ") + localVarResponse.reason_phrase() + , std::make_shared(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 claimGameServer: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::convertBase64(boost::optional> cryptoViewModel) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/base64"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->convertBase64 does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (cryptoViewModel) + localVarJson = ModelBase::toJson(*cryptoViewModel); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(cryptoViewModel && (*cryptoViewModel).get()) + { + (*cryptoViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("cryptoViewModel")); + } + + + 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("TribufuGeneratedApi->convertBase64 does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 convertBase64: ") + localVarResponse.reason_phrase() + , std::make_shared(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 convertBase64: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new CryptoViewModel()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling convertBase64: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::createGameServer(boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->createGameServer does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->createGameServer does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 createGameServer: ") + localVarResponse.reason_phrase() + , std::make_shared(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 createGameServer: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::createGameServerCluster(boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->createGameServerCluster does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->createGameServerCluster does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 createGameServerCluster: ") + localVarResponse.reason_phrase() + , std::make_shared(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 createGameServerCluster: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::createGroup(boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->createGroup does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->createGroup does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 createGroup: ") + localVarResponse.reason_phrase() + , std::make_shared(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 createGroup: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::createToken(boost::optional> tokenRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/token"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->createToken does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") ); + + + std::shared_ptr 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; + + if (tokenRequest) + localVarJson = ModelBase::toJson(*tokenRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(tokenRequest && (*tokenRequest).get()) + { + (*tokenRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("tokenRequest")); + } + + + 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("TribufuGeneratedApi->createToken does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 createToken: ") + localVarResponse.reason_phrase() + , std::make_shared(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 createToken: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new TokenResponse()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling createToken: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::deleteGameServer(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->deleteGameServer does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->deleteGameServer does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), 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 deleteGameServer: ") + localVarResponse.reason_phrase() + , std::make_shared(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 deleteGameServer: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::deleteGameServerCluster(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->deleteGameServerCluster does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->deleteGameServerCluster does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), 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 deleteGameServerCluster: ") + localVarResponse.reason_phrase() + , std::make_shared(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 deleteGameServerCluster: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::deleteGroup(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->deleteGroup does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->deleteGroup does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), 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 deleteGroup: ") + localVarResponse.reason_phrase() + , std::make_shared(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 deleteGroup: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::generateFlakeId(boost::optional amount) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/flake"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->generateFlakeId does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (amount) + { + localVarQueryParams[utility::conversions::to_string_t("amount")] = ApiClient::parameterToString(*amount); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->generateFlakeId does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 generateFlakeId: ") + localVarResponse.reason_phrase() + , std::make_shared(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 generateFlakeId: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + utility::string_t localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling generateFlakeId: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::generateFlakeIdFromTimestamp(utility::string_t timestamp, boost::optional amount) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/flake/{timestamp}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("timestamp") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(timestamp))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->generateFlakeIdFromTimestamp does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (amount) + { + localVarQueryParams[utility::conversions::to_string_t("amount")] = ApiClient::parameterToString(*amount); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->generateFlakeIdFromTimestamp does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 generateFlakeIdFromTimestamp: ") + localVarResponse.reason_phrase() + , std::make_shared(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 generateFlakeIdFromTimestamp: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + utility::string_t localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling generateFlakeIdFromTimestamp: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::generatePassword(boost::optional length, boost::optional symbols) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/password"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->generatePassword does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (length) + { + localVarQueryParams[utility::conversions::to_string_t("length")] = ApiClient::parameterToString(*length); + } + if (symbols) + { + localVarQueryParams[utility::conversions::to_string_t("symbols")] = ApiClient::parameterToString(*symbols); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->generatePassword does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 generatePassword: ") + localVarResponse.reason_phrase() + , std::make_shared(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 generatePassword: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new HashViewModel()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling generatePassword: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::generateUuid(boost::optional version, boost::optional amount) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/uuid"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->generateUuid does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (version) + { + localVarQueryParams[utility::conversions::to_string_t("version")] = ApiClient::parameterToString(*version); + } + if (amount) + { + localVarQueryParams[utility::conversions::to_string_t("amount")] = ApiClient::parameterToString(*amount); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->generateUuid does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 generateUuid: ") + localVarResponse.reason_phrase() + , std::make_shared(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 generateUuid: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + utility::string_t localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling generateUuid: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::getClientInfo() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/clientinfo"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->getClientInfo does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getClientInfo does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getClientInfo: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getClientInfo: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task>> TribufuGeneratedApi::getCurrentIpAddress() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/geoip"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getCurrentIpAddress does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getCurrentIpAddress does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getCurrentIpAddress: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getCurrentIpAddress: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getCurrentIpAddress: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGameById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Game()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGameClustersByGameId(utility::string_t id, boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}/clusters"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameClustersByGameId does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameClustersByGameId does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameClustersByGameId: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameClustersByGameId: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameClustersByGameId: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGameItems(utility::string_t id, boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}/items"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameItems does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameItems does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameItems: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameItems: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameItems: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGameServerByAddressAndQueryPort(utility::string_t address, int32_t port) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/address/{address}:{port}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("address") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(address))); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("port") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(port))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServerByAddressAndQueryPort does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServerByAddressAndQueryPort does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServerByAddressAndQueryPort: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServerByAddressAndQueryPort: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new GameServer()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServerByAddressAndQueryPort: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGameServerById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServerById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServerById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServerById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServerById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new GameServer()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServerById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGameServerClusterById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServerClusterById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServerClusterById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServerClusterById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServerClusterById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new GameServerCluster()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServerClusterById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGameServerClusters(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServerClusters does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServerClusters does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServerClusters: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServerClusters: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServerClusters: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGameServers(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServers does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServers does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServers: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServers: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServers: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGameServersByCountry(utility::string_t country, boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/country/{country}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("country") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(country))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServersByCountry does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServersByCountry does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServersByCountry: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServersByCountry: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServersByCountry: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGameServersByGameId(utility::string_t id, boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}/servers"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServersByGameId does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServersByGameId does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServersByGameId: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServersByGameId: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServersByGameId: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGameServersCountries() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/countries"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServersCountries does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServersCountries does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServersCountries: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServersCountries: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::map localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + for( auto& localVarItem : localVarJson.as_object() ) + { + int32_t localVarItemObj; + ModelBase::fromJson(localVarItem.second, localVarItemObj); + localVarResult[localVarItem.first] = localVarItemObj; + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServersCountries: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGameServersMetrics() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/metrics"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGameServersMetrics does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGameServersMetrics does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGameServersMetrics: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGameServersMetrics: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new ServerMetrics()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGameServersMetrics: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGames() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGames does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGames does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGames: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGames: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGames: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGroupById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGroupById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGroupById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGroupById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGroupById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Group()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGroupById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGroupByTag(utility::string_t tag) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/tag/{tag}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("tag") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(tag))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGroupByTag does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGroupByTag does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGroupByTag: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGroupByTag: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Group()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGroupByTag: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getGroupByUuid(utility::string_t uuid) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/uuid/{uuid}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("uuid") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(uuid))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGroupByUuid does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGroupByUuid does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGroupByUuid: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGroupByUuid: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Group()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGroupByUuid: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGroupGames(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}/games"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGroupGames does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGroupGames does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGroupGames: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGroupGames: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGroupGames: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGroupMembers(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}/members"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGroupMembers does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGroupMembers does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGroupMembers: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGroupMembers: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGroupMembers: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getGroups(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getGroups does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getGroups does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getGroups: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getGroups: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getGroups: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getIpAddress(utility::string_t address) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/geoip/addresses/{address}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("address") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(address))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getIpAddress does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getIpAddress does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getIpAddress: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getIpAddress: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new IpAddress()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getIpAddress: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getIpAddresses(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/geoip/addresses"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getIpAddresses does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getIpAddresses does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getIpAddresses: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getIpAddresses: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getIpAddresses: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getLeaderboard(boost::optional> order) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/leaderboard"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getLeaderboard does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (order && *order != nullptr) + { + localVarQueryParams[utility::conversions::to_string_t("Order")] = ApiClient::parameterToString(*order); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getLeaderboard does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getLeaderboard: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getLeaderboard: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getLeaderboard: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getMe() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/me"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getMe does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getMe does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getMe: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getMe: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new UserInfo()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getMe: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getPackageById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/packages/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getPackageById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getPackageById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getPackageById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getPackageById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Package()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getPackageById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getPackages(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/packages"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getPackages does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getPackages does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getPackages: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getPackages: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getPackages: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::getPublicKeys() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/jwks"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->getPublicKeys does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getPublicKeys does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getPublicKeys: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getPublicKeys: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::getSubscriptionById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/subscriptions/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getSubscriptionById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getSubscriptionById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getSubscriptionById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getSubscriptionById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Subscription()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getSubscriptionById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getSubscriptions(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/subscriptions"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getSubscriptions does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getSubscriptions does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getSubscriptions: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getSubscriptions: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getSubscriptions: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUserAccounts(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/accounts"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserAccounts does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserAccounts does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserAccounts: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserAccounts: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserAccounts: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getUserById(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserById does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserById does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserById: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Profile()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserById: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getUserByName(utility::string_t name) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/name/{name}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("name") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(name))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserByName does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserByName does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserByName: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserByName: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Profile()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserByName: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getUserByUuid(utility::string_t uuid) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/uuid/{uuid}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("uuid") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(uuid))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserByUuid does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserByUuid does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserByUuid: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserByUuid: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Profile()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserByUuid: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUserFriends(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/friends"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserFriends does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserFriends does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserFriends: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserFriends: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserFriends: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUserGames(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/games"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserGames does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserGames does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserGames: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserGames: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserGames: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUserGroups(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/groups"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserGroups does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserGroups does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserGroups: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserGroups: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserGroups: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::getUserInfo() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/userinfo"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserInfo does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserInfo does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserInfo: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserInfo: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new UserInfo()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserInfo: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUserPunishments(utility::string_t id) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/punishments"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserPunishments does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserPunishments does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserPunishments: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserPunishments: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserPunishments: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUserServers(utility::string_t id, boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/servers"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUserServers does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUserServers does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUserServers: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUserServers: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUserServers: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task>> TribufuGeneratedApi::getUsers(boost::optional page, boost::optional limit) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->getUsers does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->getUsers does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), 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 getUsers: ") + localVarResponse.reason_phrase() + , std::make_shared(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 getUsers: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling getUsers: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::hashArgon2(boost::optional> hashViewModel) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/argon2"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->hashArgon2 does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(hashViewModel && (*hashViewModel).get()) + { + (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); + } + + + 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("TribufuGeneratedApi->hashArgon2 does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 hashArgon2: ") + localVarResponse.reason_phrase() + , std::make_shared(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 hashArgon2: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new HashViewModel()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling hashArgon2: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::hashBcrypt(boost::optional> hashViewModel) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/bcrypt"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->hashBcrypt does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(hashViewModel && (*hashViewModel).get()) + { + (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); + } + + + 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("TribufuGeneratedApi->hashBcrypt does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 hashBcrypt: ") + localVarResponse.reason_phrase() + , std::make_shared(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 hashBcrypt: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new HashViewModel()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling hashBcrypt: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::hashMd5(boost::optional> hashViewModel) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/md5"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->hashMd5 does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(hashViewModel && (*hashViewModel).get()) + { + (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); + } + + + 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("TribufuGeneratedApi->hashMd5 does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 hashMd5: ") + localVarResponse.reason_phrase() + , std::make_shared(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 hashMd5: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new HashViewModel()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling hashMd5: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::hashSha256(boost::optional> hashViewModel) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/sha256"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->hashSha256 does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(hashViewModel && (*hashViewModel).get()) + { + (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); + } + + + 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("TribufuGeneratedApi->hashSha256 does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 hashSha256: ") + localVarResponse.reason_phrase() + , std::make_shared(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 hashSha256: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new HashViewModel()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling hashSha256: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::introspectToken(boost::optional> introspectRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/introspect"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->introspectToken does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") ); + + + std::shared_ptr 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; + + if (introspectRequest) + localVarJson = ModelBase::toJson(*introspectRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(introspectRequest && (*introspectRequest).get()) + { + (*introspectRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("introspectRequest")); + } + + + 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("TribufuGeneratedApi->introspectToken does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 introspectToken: ") + localVarResponse.reason_phrase() + , std::make_shared(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 introspectToken: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::login(boost::optional> loginRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/login"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->login does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (loginRequest) + localVarJson = ModelBase::toJson(*loginRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(loginRequest && (*loginRequest).get()) + { + (*loginRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("loginRequest")); + } + + + 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("TribufuGeneratedApi->login does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 login: ") + localVarResponse.reason_phrase() + , std::make_shared(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 login: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new LoginResponse()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling login: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::logout() const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/logout"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->logout does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + + + std::shared_ptr 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"); + } + // 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"); + } + 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("TribufuGeneratedApi->logout does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 logout: ") + localVarResponse.reason_phrase() + , std::make_shared(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 logout: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::r_register(boost::optional> registerRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/register"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->r_register does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (registerRequest) + localVarJson = ModelBase::toJson(*registerRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(registerRequest && (*registerRequest).get()) + { + (*registerRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("registerRequest")); + } + + + 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("TribufuGeneratedApi->r_register does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 r_register: ") + localVarResponse.reason_phrase() + , std::make_shared(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 r_register: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new LoginResponse()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling r_register: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task> TribufuGeneratedApi::refresh(boost::optional> refreshRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/refresh"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->refresh does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (refreshRequest) + localVarJson = ModelBase::toJson(*refreshRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(refreshRequest && (*refreshRequest).get()) + { + (*refreshRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("refreshRequest")); + } + + + 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("TribufuGeneratedApi->refresh does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 refresh: ") + localVarResponse.reason_phrase() + , std::make_shared(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 refresh: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new LoginResponse()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling refresh: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::revokeToken(boost::optional> revokeRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/revoke"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->revokeToken does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") ); + + + std::shared_ptr 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; + + if (revokeRequest) + localVarJson = ModelBase::toJson(*revokeRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(revokeRequest && (*revokeRequest).get()) + { + (*revokeRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("revokeRequest")); + } + + + 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("TribufuGeneratedApi->revokeToken does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 revokeToken: ") + localVarResponse.reason_phrase() + , std::make_shared(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 revokeToken: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task>> TribufuGeneratedApi::search(boost::optional> searchRequest) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/search"); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->search does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (searchRequest) + localVarJson = ModelBase::toJson(*searchRequest); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(searchRequest && (*searchRequest).get()) + { + (*searchRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("searchRequest")); + } + + + 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("TribufuGeneratedApi->search does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = 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 search: ") + localVarResponse.reason_phrase() + , std::make_shared(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 search: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::vector> localVarResult; + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + for( auto& localVarItem : localVarJson.as_array() ) + { + std::shared_ptr localVarItemObj; + ModelBase::fromJson(localVarItem, localVarItemObj); + localVarResult.push_back(localVarItemObj); + } + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling search: unsupported response type")); + } + + return localVarResult; + }); +} +pplx::task TribufuGeneratedApi::updateGameServer(utility::string_t id, boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->updateGameServer does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->updateGameServer does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 updateGameServer: ") + localVarResponse.reason_phrase() + , std::make_shared(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 updateGameServer: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::updateGameServerCluster(utility::string_t id, boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->updateGameServerCluster does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->updateGameServerCluster does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 updateGameServerCluster: ") + localVarResponse.reason_phrase() + , std::make_shared(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 updateGameServerCluster: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task TribufuGeneratedApi::updateGroup(utility::string_t id, boost::optional> body) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set 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("TribufuGeneratedApi->updateGroup does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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(body.get()); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get())); + + + 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("TribufuGeneratedApi->updateGroup does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 updateGroup: ") + localVarResponse.reason_phrase() + , std::make_shared(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 updateGroup: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + return void(); + }); +} +pplx::task> TribufuGeneratedApi::updateUserProfile(utility::string_t id, boost::optional> updateProfile) const +{ + + + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/profile"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") + utility::conversions::to_string_t("}"), web::uri::encode_uri(ApiClient::parameterToString(id))); + + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; + + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/plain") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + + 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("TribufuGeneratedApi->updateUserProfile does not produce any supported media type")); + } + + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json-patch+json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("text/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/*+json") ); + + + std::shared_ptr 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; + + if (updateProfile) + localVarJson = ModelBase::toJson(*updateProfile); + + localVarHttpBody = std::shared_ptr( 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 localVarMultipart(new MultipartFormData); + + if(updateProfile && (*updateProfile).get()) + { + (*updateProfile)->toMultipart(localVarMultipart, utility::conversions::to_string_t("updateProfile")); + } + + + 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("TribufuGeneratedApi->updateUserProfile does not consume any supported media type")); + } + + // authentication (ApiKey) required + { + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if ( localVarApiKey.size() > 0 ) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } + } + + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), 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 updateUserProfile: ") + localVarResponse.reason_phrase() + , std::make_shared(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 updateUserProfile: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); + } + } + + return localVarResponse.extract_string(); + }) + .then([=, this](utility::string_t localVarResponse) + { + std::shared_ptr localVarResult(new Profile()); + + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) + { + web::json::value localVarJson = web::json::value::parse(localVarResponse); + + ModelBase::fromJson(localVarJson, localVarResult); + } + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , utility::conversions::to_string_t("error calling updateUserProfile: unsupported response type")); + } + + return localVarResult; + }); +} + +} +} + diff --git a/src/model/Account.cpp b/src/model/Account.cpp new file mode 100644 index 00000000..c3fa062b --- /dev/null +++ b/src/model/Account.cpp @@ -0,0 +1,461 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Account.h" + +namespace tribufu { +namespace models { + +Account::Account() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_ProviderIsSet = false; + m_User_id = utility::conversions::to_string_t(""); + m_User_idIsSet = false; + m_Authorized = false; + m_AuthorizedIsSet = false; + m_FieldsIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Account::~Account() +{ +} + +void Account::validate() +{ + // TODO: implement validation +} + +web::json::value Account::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_ProviderIsSet) + { + + val[utility::conversions::to_string_t(U("provider"))] = ModelBase::toJson(m_Provider); + } + if(m_User_idIsSet) + { + + val[utility::conversions::to_string_t(U("user_id"))] = ModelBase::toJson(m_User_id); + } + if(m_AuthorizedIsSet) + { + + val[utility::conversions::to_string_t(U("authorized"))] = ModelBase::toJson(m_Authorized); + } + if(m_FieldsIsSet) + { + + val[utility::conversions::to_string_t(U("fields"))] = ModelBase::toJson(m_Fields); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Account::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("provider")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("provider"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setProvider; + ok &= ModelBase::fromJson(fieldValue, refVal_setProvider); + setProvider(refVal_setProvider); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("user_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("user_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUserId; + ok &= ModelBase::fromJson(fieldValue, refVal_setUserId); + setUserId(refVal_setUserId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("authorized")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("authorized"))); + if(!fieldValue.is_null()) + { + bool refVal_setAuthorized; + ok &= ModelBase::fromJson(fieldValue, refVal_setAuthorized); + setAuthorized(refVal_setAuthorized); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("fields")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("fields"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setFields; + ok &= ModelBase::fromJson(fieldValue, refVal_setFields); + setFields(refVal_setFields); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Account::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_ProviderIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("provider")), m_Provider)); + } + if(m_User_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("user_id")), m_User_id)); + } + if(m_AuthorizedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("authorized")), m_Authorized)); + } + if(m_FieldsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("fields")), m_Fields)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Account::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("provider")))) + { + std::shared_ptr refVal_setProvider; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("provider"))), refVal_setProvider ); + setProvider(refVal_setProvider); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("user_id")))) + { + utility::string_t refVal_setUserId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("user_id"))), refVal_setUserId ); + setUserId(refVal_setUserId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("authorized")))) + { + bool refVal_setAuthorized; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("authorized"))), refVal_setAuthorized ); + setAuthorized(refVal_setAuthorized); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("fields")))) + { + std::shared_ptr refVal_setFields; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("fields"))), refVal_setFields ); + setFields(refVal_setFields); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t Account::getId() const +{ + return m_Id; +} + + +void Account::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Account::idIsSet() const +{ + return m_IdIsSet; +} + +void Account::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Account::getName() const +{ + return m_Name; +} + + +void Account::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Account::nameIsSet() const +{ + return m_NameIsSet; +} + +void Account::unsetName() +{ + m_NameIsSet = false; +} +std::shared_ptr Account::getProvider() const +{ + return m_Provider; +} + + +void Account::setProvider(const std::shared_ptr& value) +{ + m_Provider = value; + m_ProviderIsSet = true; +} + +bool Account::providerIsSet() const +{ + return m_ProviderIsSet; +} + +void Account::unsetProvider() +{ + m_ProviderIsSet = false; +} +utility::string_t Account::getUserId() const +{ + return m_User_id; +} + + +void Account::setUserId(const utility::string_t& value) +{ + m_User_id = value; + m_User_idIsSet = true; +} + +bool Account::userIdIsSet() const +{ + return m_User_idIsSet; +} + +void Account::unsetUser_id() +{ + m_User_idIsSet = false; +} +bool Account::isAuthorized() const +{ + return m_Authorized; +} + +void Account::setAuthorized(bool value) +{ + m_Authorized = value; + m_AuthorizedIsSet = true; +} + +bool Account::authorizedIsSet() const +{ + return m_AuthorizedIsSet; +} + +void Account::unsetAuthorized() +{ + m_AuthorizedIsSet = false; +} +std::shared_ptr Account::getFields() const +{ + return m_Fields; +} + + +void Account::setFields(const std::shared_ptr& value) +{ + m_Fields = value; + m_FieldsIsSet = true; +} + +bool Account::fieldsIsSet() const +{ + return m_FieldsIsSet; +} + +void Account::unsetFields() +{ + m_FieldsIsSet = false; +} +utility::datetime Account::getCreated() const +{ + return m_Created; +} + + +void Account::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Account::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Account::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Account::getUpdated() const +{ + return m_Updated; +} + + +void Account::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Account::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Account::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/Application.cpp b/src/model/Application.cpp new file mode 100644 index 00000000..20f5fe6f --- /dev/null +++ b/src/model/Application.cpp @@ -0,0 +1,1045 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Application.h" + +namespace tribufu { +namespace models { + +Application::Application() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_TypeIsSet = false; + m_Organization_id = utility::conversions::to_string_t(""); + m_Organization_idIsSet = false; + m_Icon_url = utility::conversions::to_string_t(""); + m_Icon_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Capsule_image_url = utility::conversions::to_string_t(""); + m_Capsule_image_urlIsSet = false; + m_Library_image_url = utility::conversions::to_string_t(""); + m_Library_image_urlIsSet = false; + m_Parent_id = utility::conversions::to_string_t(""); + m_Parent_idIsSet = false; + m_Slug = utility::conversions::to_string_t(""); + m_SlugIsSet = false; + m_Visibility = 0; + m_VisibilityIsSet = false; + m_Password = utility::conversions::to_string_t(""); + m_PasswordIsSet = false; + m_Primary = 0; + m_PrimaryIsSet = false; + m_User_count = 0; + m_User_countIsSet = false; + m_Achievement_count = 0; + m_Achievement_countIsSet = false; + m_Badge_count = 0; + m_Badge_countIsSet = false; + m_Download_count = 0; + m_Download_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Application::~Application() +{ +} + +void Application::validate() +{ + // TODO: implement validation +} + +web::json::value Application::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_TypeIsSet) + { + + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); + } + if(m_Organization_idIsSet) + { + + val[utility::conversions::to_string_t(U("organization_id"))] = ModelBase::toJson(m_Organization_id); + } + if(m_Icon_urlIsSet) + { + + val[utility::conversions::to_string_t(U("icon_url"))] = ModelBase::toJson(m_Icon_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Capsule_image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("capsule_image_url"))] = ModelBase::toJson(m_Capsule_image_url); + } + if(m_Library_image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("library_image_url"))] = ModelBase::toJson(m_Library_image_url); + } + if(m_Parent_idIsSet) + { + + val[utility::conversions::to_string_t(U("parent_id"))] = ModelBase::toJson(m_Parent_id); + } + if(m_SlugIsSet) + { + + val[utility::conversions::to_string_t(U("slug"))] = ModelBase::toJson(m_Slug); + } + if(m_VisibilityIsSet) + { + + val[utility::conversions::to_string_t(U("visibility"))] = ModelBase::toJson(m_Visibility); + } + if(m_PasswordIsSet) + { + + val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); + } + if(m_PrimaryIsSet) + { + + val[utility::conversions::to_string_t(U("primary"))] = ModelBase::toJson(m_Primary); + } + if(m_User_countIsSet) + { + + val[utility::conversions::to_string_t(U("user_count"))] = ModelBase::toJson(m_User_count); + } + if(m_Achievement_countIsSet) + { + + val[utility::conversions::to_string_t(U("achievement_count"))] = ModelBase::toJson(m_Achievement_count); + } + if(m_Badge_countIsSet) + { + + val[utility::conversions::to_string_t(U("badge_count"))] = ModelBase::toJson(m_Badge_count); + } + if(m_Download_countIsSet) + { + + val[utility::conversions::to_string_t(U("download_count"))] = ModelBase::toJson(m_Download_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Application::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromJson(fieldValue, refVal_setType); + setType(refVal_setType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("organization_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("organization_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setOrganizationId; + ok &= ModelBase::fromJson(fieldValue, refVal_setOrganizationId); + setOrganizationId(refVal_setOrganizationId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("icon_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("icon_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setIconUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setIconUrl); + setIconUrl(refVal_setIconUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("capsule_image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("capsule_image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCapsuleImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setCapsuleImageUrl); + setCapsuleImageUrl(refVal_setCapsuleImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("library_image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("library_image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLibraryImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setLibraryImageUrl); + setLibraryImageUrl(refVal_setLibraryImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("parent_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("parent_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setParentId; + ok &= ModelBase::fromJson(fieldValue, refVal_setParentId); + setParentId(refVal_setParentId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("slug")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("slug"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setSlug; + ok &= ModelBase::fromJson(fieldValue, refVal_setSlug); + setSlug(refVal_setSlug); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("visibility")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("visibility"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setVisibility; + ok &= ModelBase::fromJson(fieldValue, refVal_setVisibility); + setVisibility(refVal_setVisibility); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("password")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); + setPassword(refVal_setPassword); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("primary")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("primary"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPrimary; + ok &= ModelBase::fromJson(fieldValue, refVal_setPrimary); + setPrimary(refVal_setPrimary); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("user_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("user_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setUserCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setUserCount); + setUserCount(refVal_setUserCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("achievement_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("achievement_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setAchievementCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setAchievementCount); + setAchievementCount(refVal_setAchievementCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("badge_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("badge_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setBadgeCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setBadgeCount); + setBadgeCount(refVal_setBadgeCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("download_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("download_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setDownloadCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount); + setDownloadCount(refVal_setDownloadCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Application::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_TypeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + } + if(m_Organization_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("organization_id")), m_Organization_id)); + } + if(m_Icon_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("icon_url")), m_Icon_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Capsule_image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("capsule_image_url")), m_Capsule_image_url)); + } + if(m_Library_image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("library_image_url")), m_Library_image_url)); + } + if(m_Parent_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("parent_id")), m_Parent_id)); + } + if(m_SlugIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("slug")), m_Slug)); + } + if(m_VisibilityIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("visibility")), m_Visibility)); + } + if(m_PasswordIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); + } + if(m_PrimaryIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("primary")), m_Primary)); + } + if(m_User_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("user_count")), m_User_count)); + } + if(m_Achievement_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("achievement_count")), m_Achievement_count)); + } + if(m_Badge_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("badge_count")), m_Badge_count)); + } + if(m_Download_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("download_count")), m_Download_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Application::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); + setType(refVal_setType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("organization_id")))) + { + utility::string_t refVal_setOrganizationId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("organization_id"))), refVal_setOrganizationId ); + setOrganizationId(refVal_setOrganizationId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("icon_url")))) + { + utility::string_t refVal_setIconUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("icon_url"))), refVal_setIconUrl ); + setIconUrl(refVal_setIconUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("capsule_image_url")))) + { + utility::string_t refVal_setCapsuleImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("capsule_image_url"))), refVal_setCapsuleImageUrl ); + setCapsuleImageUrl(refVal_setCapsuleImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("library_image_url")))) + { + utility::string_t refVal_setLibraryImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("library_image_url"))), refVal_setLibraryImageUrl ); + setLibraryImageUrl(refVal_setLibraryImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("parent_id")))) + { + utility::string_t refVal_setParentId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("parent_id"))), refVal_setParentId ); + setParentId(refVal_setParentId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("slug")))) + { + utility::string_t refVal_setSlug; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("slug"))), refVal_setSlug ); + setSlug(refVal_setSlug); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("visibility")))) + { + int32_t refVal_setVisibility; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("visibility"))), refVal_setVisibility ); + setVisibility(refVal_setVisibility); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); + setPassword(refVal_setPassword); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("primary")))) + { + int32_t refVal_setPrimary; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("primary"))), refVal_setPrimary ); + setPrimary(refVal_setPrimary); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("user_count")))) + { + int32_t refVal_setUserCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("user_count"))), refVal_setUserCount ); + setUserCount(refVal_setUserCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("achievement_count")))) + { + int32_t refVal_setAchievementCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("achievement_count"))), refVal_setAchievementCount ); + setAchievementCount(refVal_setAchievementCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("badge_count")))) + { + int32_t refVal_setBadgeCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("badge_count"))), refVal_setBadgeCount ); + setBadgeCount(refVal_setBadgeCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("download_count")))) + { + int32_t refVal_setDownloadCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("download_count"))), refVal_setDownloadCount ); + setDownloadCount(refVal_setDownloadCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t Application::getId() const +{ + return m_Id; +} + + +void Application::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Application::idIsSet() const +{ + return m_IdIsSet; +} + +void Application::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Application::getName() const +{ + return m_Name; +} + + +void Application::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Application::nameIsSet() const +{ + return m_NameIsSet; +} + +void Application::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t Application::getDescription() const +{ + return m_Description; +} + + +void Application::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool Application::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void Application::unsetDescription() +{ + m_DescriptionIsSet = false; +} +std::shared_ptr Application::getType() const +{ + return m_Type; +} + + +void Application::setType(const std::shared_ptr& value) +{ + m_Type = value; + m_TypeIsSet = true; +} + +bool Application::typeIsSet() const +{ + return m_TypeIsSet; +} + +void Application::unsetType() +{ + m_TypeIsSet = false; +} +utility::string_t Application::getOrganizationId() const +{ + return m_Organization_id; +} + + +void Application::setOrganizationId(const utility::string_t& value) +{ + m_Organization_id = value; + m_Organization_idIsSet = true; +} + +bool Application::organizationIdIsSet() const +{ + return m_Organization_idIsSet; +} + +void Application::unsetOrganization_id() +{ + m_Organization_idIsSet = false; +} +utility::string_t Application::getIconUrl() const +{ + return m_Icon_url; +} + + +void Application::setIconUrl(const utility::string_t& value) +{ + m_Icon_url = value; + m_Icon_urlIsSet = true; +} + +bool Application::iconUrlIsSet() const +{ + return m_Icon_urlIsSet; +} + +void Application::unsetIcon_url() +{ + m_Icon_urlIsSet = false; +} +utility::string_t Application::getBannerUrl() const +{ + return m_Banner_url; +} + + +void Application::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool Application::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void Application::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +utility::string_t Application::getCapsuleImageUrl() const +{ + return m_Capsule_image_url; +} + + +void Application::setCapsuleImageUrl(const utility::string_t& value) +{ + m_Capsule_image_url = value; + m_Capsule_image_urlIsSet = true; +} + +bool Application::capsuleImageUrlIsSet() const +{ + return m_Capsule_image_urlIsSet; +} + +void Application::unsetCapsule_image_url() +{ + m_Capsule_image_urlIsSet = false; +} +utility::string_t Application::getLibraryImageUrl() const +{ + return m_Library_image_url; +} + + +void Application::setLibraryImageUrl(const utility::string_t& value) +{ + m_Library_image_url = value; + m_Library_image_urlIsSet = true; +} + +bool Application::libraryImageUrlIsSet() const +{ + return m_Library_image_urlIsSet; +} + +void Application::unsetLibrary_image_url() +{ + m_Library_image_urlIsSet = false; +} +utility::string_t Application::getParentId() const +{ + return m_Parent_id; +} + + +void Application::setParentId(const utility::string_t& value) +{ + m_Parent_id = value; + m_Parent_idIsSet = true; +} + +bool Application::parentIdIsSet() const +{ + return m_Parent_idIsSet; +} + +void Application::unsetParent_id() +{ + m_Parent_idIsSet = false; +} +utility::string_t Application::getSlug() const +{ + return m_Slug; +} + + +void Application::setSlug(const utility::string_t& value) +{ + m_Slug = value; + m_SlugIsSet = true; +} + +bool Application::slugIsSet() const +{ + return m_SlugIsSet; +} + +void Application::unsetSlug() +{ + m_SlugIsSet = false; +} +int32_t Application::getVisibility() const +{ + return m_Visibility; +} + +void Application::setVisibility(int32_t value) +{ + m_Visibility = value; + m_VisibilityIsSet = true; +} + +bool Application::visibilityIsSet() const +{ + return m_VisibilityIsSet; +} + +void Application::unsetVisibility() +{ + m_VisibilityIsSet = false; +} +utility::string_t Application::getPassword() const +{ + return m_Password; +} + + +void Application::setPassword(const utility::string_t& value) +{ + m_Password = value; + m_PasswordIsSet = true; +} + +bool Application::passwordIsSet() const +{ + return m_PasswordIsSet; +} + +void Application::unsetPassword() +{ + m_PasswordIsSet = false; +} +int32_t Application::getPrimary() const +{ + return m_Primary; +} + +void Application::setPrimary(int32_t value) +{ + m_Primary = value; + m_PrimaryIsSet = true; +} + +bool Application::primaryIsSet() const +{ + return m_PrimaryIsSet; +} + +void Application::unsetPrimary() +{ + m_PrimaryIsSet = false; +} +int32_t Application::getUserCount() const +{ + return m_User_count; +} + +void Application::setUserCount(int32_t value) +{ + m_User_count = value; + m_User_countIsSet = true; +} + +bool Application::userCountIsSet() const +{ + return m_User_countIsSet; +} + +void Application::unsetUser_count() +{ + m_User_countIsSet = false; +} +int32_t Application::getAchievementCount() const +{ + return m_Achievement_count; +} + +void Application::setAchievementCount(int32_t value) +{ + m_Achievement_count = value; + m_Achievement_countIsSet = true; +} + +bool Application::achievementCountIsSet() const +{ + return m_Achievement_countIsSet; +} + +void Application::unsetAchievement_count() +{ + m_Achievement_countIsSet = false; +} +int32_t Application::getBadgeCount() const +{ + return m_Badge_count; +} + +void Application::setBadgeCount(int32_t value) +{ + m_Badge_count = value; + m_Badge_countIsSet = true; +} + +bool Application::badgeCountIsSet() const +{ + return m_Badge_countIsSet; +} + +void Application::unsetBadge_count() +{ + m_Badge_countIsSet = false; +} +int32_t Application::getDownloadCount() const +{ + return m_Download_count; +} + +void Application::setDownloadCount(int32_t value) +{ + m_Download_count = value; + m_Download_countIsSet = true; +} + +bool Application::downloadCountIsSet() const +{ + return m_Download_countIsSet; +} + +void Application::unsetDownload_count() +{ + m_Download_countIsSet = false; +} +utility::datetime Application::getCreated() const +{ + return m_Created; +} + + +void Application::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Application::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Application::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Application::getUpdated() const +{ + return m_Updated; +} + + +void Application::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Application::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Application::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/ApplicationType.cpp b/src/model/ApplicationType.cpp new file mode 100644 index 00000000..d3b042ce --- /dev/null +++ b/src/model/ApplicationType.cpp @@ -0,0 +1,118 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/ApplicationType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +ApplicationType::eApplicationType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("application"))) + return ApplicationType::eApplicationType::ApplicationType_APPLICATION; + if (val == utility::conversions::to_string_t(U("game"))) + return ApplicationType::eApplicationType::ApplicationType_GAME; + return {}; +} + +EnumUnderlyingType fromEnum(ApplicationType::eApplicationType e) +{ + switch (e) + { + case ApplicationType::eApplicationType::ApplicationType_APPLICATION: + return U("application"); + case ApplicationType::eApplicationType::ApplicationType_GAME: + return U("game"); + default: + break; + } + return {}; +} +} + +ApplicationType::ApplicationType() +{ +} + +ApplicationType::~ApplicationType() +{ +} + +void ApplicationType::validate() +{ + // TODO: implement validation +} + +web::json::value ApplicationType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool ApplicationType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void ApplicationType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool ApplicationType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +ApplicationType::eApplicationType ApplicationType::getValue() const +{ + return m_value; +} + +void ApplicationType::setValue(ApplicationType::eApplicationType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/AuthorizeRequest.cpp b/src/model/AuthorizeRequest.cpp new file mode 100644 index 00000000..94b0a078 --- /dev/null +++ b/src/model/AuthorizeRequest.cpp @@ -0,0 +1,413 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/AuthorizeRequest.h" + +namespace tribufu { +namespace models { + +AuthorizeRequest::AuthorizeRequest() +{ + m_Response_typeIsSet = false; + m_Client_id = utility::conversions::to_string_t(""); + m_Client_idIsSet = false; + m_Code_challenge = utility::conversions::to_string_t(""); + m_Code_challengeIsSet = false; + m_Code_challenge_methodIsSet = false; + m_Redirect_uri = utility::conversions::to_string_t(""); + m_Redirect_uriIsSet = false; + m_Scope = utility::conversions::to_string_t(""); + m_ScopeIsSet = false; + m_State = utility::conversions::to_string_t(""); + m_StateIsSet = false; +} + +AuthorizeRequest::~AuthorizeRequest() +{ +} + +void AuthorizeRequest::validate() +{ + // TODO: implement validation +} + +web::json::value AuthorizeRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Response_typeIsSet) + { + + val[utility::conversions::to_string_t(U("response_type"))] = ModelBase::toJson(m_Response_type); + } + if(m_Client_idIsSet) + { + + val[utility::conversions::to_string_t(U("client_id"))] = ModelBase::toJson(m_Client_id); + } + if(m_Code_challengeIsSet) + { + + val[utility::conversions::to_string_t(U("code_challenge"))] = ModelBase::toJson(m_Code_challenge); + } + if(m_Code_challenge_methodIsSet) + { + + val[utility::conversions::to_string_t(U("code_challenge_method"))] = ModelBase::toJson(m_Code_challenge_method); + } + if(m_Redirect_uriIsSet) + { + + val[utility::conversions::to_string_t(U("redirect_uri"))] = ModelBase::toJson(m_Redirect_uri); + } + if(m_ScopeIsSet) + { + + val[utility::conversions::to_string_t(U("scope"))] = ModelBase::toJson(m_Scope); + } + if(m_StateIsSet) + { + + val[utility::conversions::to_string_t(U("state"))] = ModelBase::toJson(m_State); + } + + return val; +} + +bool AuthorizeRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("response_type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("response_type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setResponseType; + ok &= ModelBase::fromJson(fieldValue, refVal_setResponseType); + setResponseType(refVal_setResponseType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("client_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("client_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setClientId; + ok &= ModelBase::fromJson(fieldValue, refVal_setClientId); + setClientId(refVal_setClientId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("code_challenge")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code_challenge"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCodeChallenge; + ok &= ModelBase::fromJson(fieldValue, refVal_setCodeChallenge); + setCodeChallenge(refVal_setCodeChallenge); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("code_challenge_method")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code_challenge_method"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setCodeChallengeMethod; + ok &= ModelBase::fromJson(fieldValue, refVal_setCodeChallengeMethod); + setCodeChallengeMethod(refVal_setCodeChallengeMethod); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("redirect_uri")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("redirect_uri"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRedirectUri; + ok &= ModelBase::fromJson(fieldValue, refVal_setRedirectUri); + setRedirectUri(refVal_setRedirectUri); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("scope")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("scope"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setScope; + ok &= ModelBase::fromJson(fieldValue, refVal_setScope); + setScope(refVal_setScope); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("state")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("state"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setState; + ok &= ModelBase::fromJson(fieldValue, refVal_setState); + setState(refVal_setState); + + } + } + return ok; +} + +void AuthorizeRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Response_typeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("response_type")), m_Response_type)); + } + if(m_Client_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("client_id")), m_Client_id)); + } + if(m_Code_challengeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code_challenge")), m_Code_challenge)); + } + if(m_Code_challenge_methodIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code_challenge_method")), m_Code_challenge_method)); + } + if(m_Redirect_uriIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("redirect_uri")), m_Redirect_uri)); + } + if(m_ScopeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("scope")), m_Scope)); + } + if(m_StateIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("state")), m_State)); + } +} + +bool AuthorizeRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("response_type")))) + { + std::shared_ptr refVal_setResponseType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("response_type"))), refVal_setResponseType ); + setResponseType(refVal_setResponseType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("client_id")))) + { + utility::string_t refVal_setClientId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("client_id"))), refVal_setClientId ); + setClientId(refVal_setClientId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("code_challenge")))) + { + utility::string_t refVal_setCodeChallenge; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code_challenge"))), refVal_setCodeChallenge ); + setCodeChallenge(refVal_setCodeChallenge); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("code_challenge_method")))) + { + std::shared_ptr refVal_setCodeChallengeMethod; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code_challenge_method"))), refVal_setCodeChallengeMethod ); + setCodeChallengeMethod(refVal_setCodeChallengeMethod); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("redirect_uri")))) + { + utility::string_t refVal_setRedirectUri; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("redirect_uri"))), refVal_setRedirectUri ); + setRedirectUri(refVal_setRedirectUri); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("scope")))) + { + utility::string_t refVal_setScope; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("scope"))), refVal_setScope ); + setScope(refVal_setScope); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("state")))) + { + utility::string_t refVal_setState; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("state"))), refVal_setState ); + setState(refVal_setState); + } + return ok; +} + + +std::shared_ptr AuthorizeRequest::getResponseType() const +{ + return m_Response_type; +} + + +void AuthorizeRequest::setResponseType(const std::shared_ptr& value) +{ + m_Response_type = value; + m_Response_typeIsSet = true; +} + +bool AuthorizeRequest::responseTypeIsSet() const +{ + return m_Response_typeIsSet; +} + +void AuthorizeRequest::unsetResponse_type() +{ + m_Response_typeIsSet = false; +} +utility::string_t AuthorizeRequest::getClientId() const +{ + return m_Client_id; +} + + +void AuthorizeRequest::setClientId(const utility::string_t& value) +{ + m_Client_id = value; + m_Client_idIsSet = true; +} + +bool AuthorizeRequest::clientIdIsSet() const +{ + return m_Client_idIsSet; +} + +void AuthorizeRequest::unsetClient_id() +{ + m_Client_idIsSet = false; +} +utility::string_t AuthorizeRequest::getCodeChallenge() const +{ + return m_Code_challenge; +} + + +void AuthorizeRequest::setCodeChallenge(const utility::string_t& value) +{ + m_Code_challenge = value; + m_Code_challengeIsSet = true; +} + +bool AuthorizeRequest::codeChallengeIsSet() const +{ + return m_Code_challengeIsSet; +} + +void AuthorizeRequest::unsetCode_challenge() +{ + m_Code_challengeIsSet = false; +} +std::shared_ptr AuthorizeRequest::getCodeChallengeMethod() const +{ + return m_Code_challenge_method; +} + + +void AuthorizeRequest::setCodeChallengeMethod(const std::shared_ptr& value) +{ + m_Code_challenge_method = value; + m_Code_challenge_methodIsSet = true; +} + +bool AuthorizeRequest::codeChallengeMethodIsSet() const +{ + return m_Code_challenge_methodIsSet; +} + +void AuthorizeRequest::unsetCode_challenge_method() +{ + m_Code_challenge_methodIsSet = false; +} +utility::string_t AuthorizeRequest::getRedirectUri() const +{ + return m_Redirect_uri; +} + + +void AuthorizeRequest::setRedirectUri(const utility::string_t& value) +{ + m_Redirect_uri = value; + m_Redirect_uriIsSet = true; +} + +bool AuthorizeRequest::redirectUriIsSet() const +{ + return m_Redirect_uriIsSet; +} + +void AuthorizeRequest::unsetRedirect_uri() +{ + m_Redirect_uriIsSet = false; +} +utility::string_t AuthorizeRequest::getScope() const +{ + return m_Scope; +} + + +void AuthorizeRequest::setScope(const utility::string_t& value) +{ + m_Scope = value; + m_ScopeIsSet = true; +} + +bool AuthorizeRequest::scopeIsSet() const +{ + return m_ScopeIsSet; +} + +void AuthorizeRequest::unsetScope() +{ + m_ScopeIsSet = false; +} +utility::string_t AuthorizeRequest::getState() const +{ + return m_State; +} + + +void AuthorizeRequest::setState(const utility::string_t& value) +{ + m_State = value; + m_StateIsSet = true; +} + +bool AuthorizeRequest::stateIsSet() const +{ + return m_StateIsSet; +} + +void AuthorizeRequest::unsetState() +{ + m_StateIsSet = false; +} + +} +} + + diff --git a/src/model/CodeChallengeMethod.cpp b/src/model/CodeChallengeMethod.cpp new file mode 100644 index 00000000..fdf6c5a3 --- /dev/null +++ b/src/model/CodeChallengeMethod.cpp @@ -0,0 +1,118 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/CodeChallengeMethod.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +CodeChallengeMethod::eCodeChallengeMethod toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("plain"))) + return CodeChallengeMethod::eCodeChallengeMethod::CodeChallengeMethod_PLAIN; + if (val == utility::conversions::to_string_t(U("S256"))) + return CodeChallengeMethod::eCodeChallengeMethod::CodeChallengeMethod_S256; + return {}; +} + +EnumUnderlyingType fromEnum(CodeChallengeMethod::eCodeChallengeMethod e) +{ + switch (e) + { + case CodeChallengeMethod::eCodeChallengeMethod::CodeChallengeMethod_PLAIN: + return U("plain"); + case CodeChallengeMethod::eCodeChallengeMethod::CodeChallengeMethod_S256: + return U("S256"); + default: + break; + } + return {}; +} +} + +CodeChallengeMethod::CodeChallengeMethod() +{ +} + +CodeChallengeMethod::~CodeChallengeMethod() +{ +} + +void CodeChallengeMethod::validate() +{ + // TODO: implement validation +} + +web::json::value CodeChallengeMethod::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool CodeChallengeMethod::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void CodeChallengeMethod::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool CodeChallengeMethod::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +CodeChallengeMethod::eCodeChallengeMethod CodeChallengeMethod::getValue() const +{ + return m_value; +} + +void CodeChallengeMethod::setValue(CodeChallengeMethod::eCodeChallengeMethod const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/CryptoViewModel.cpp b/src/model/CryptoViewModel.cpp new file mode 100644 index 00000000..e1f11607 --- /dev/null +++ b/src/model/CryptoViewModel.cpp @@ -0,0 +1,170 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/CryptoViewModel.h" + +namespace tribufu { +namespace models { + +CryptoViewModel::CryptoViewModel() +{ + m_Encoded = utility::conversions::to_string_t(""); + m_EncodedIsSet = false; + m_Decoded = utility::conversions::to_string_t(""); + m_DecodedIsSet = false; +} + +CryptoViewModel::~CryptoViewModel() +{ +} + +void CryptoViewModel::validate() +{ + // TODO: implement validation +} + +web::json::value CryptoViewModel::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_EncodedIsSet) + { + + val[utility::conversions::to_string_t(U("encoded"))] = ModelBase::toJson(m_Encoded); + } + if(m_DecodedIsSet) + { + + val[utility::conversions::to_string_t(U("decoded"))] = ModelBase::toJson(m_Decoded); + } + + return val; +} + +bool CryptoViewModel::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("encoded")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("encoded"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setEncoded; + ok &= ModelBase::fromJson(fieldValue, refVal_setEncoded); + setEncoded(refVal_setEncoded); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("decoded")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("decoded"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDecoded; + ok &= ModelBase::fromJson(fieldValue, refVal_setDecoded); + setDecoded(refVal_setDecoded); + + } + } + return ok; +} + +void CryptoViewModel::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_EncodedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("encoded")), m_Encoded)); + } + if(m_DecodedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("decoded")), m_Decoded)); + } +} + +bool CryptoViewModel::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("encoded")))) + { + utility::string_t refVal_setEncoded; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("encoded"))), refVal_setEncoded ); + setEncoded(refVal_setEncoded); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("decoded")))) + { + utility::string_t refVal_setDecoded; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("decoded"))), refVal_setDecoded ); + setDecoded(refVal_setDecoded); + } + return ok; +} + + +utility::string_t CryptoViewModel::getEncoded() const +{ + return m_Encoded; +} + + +void CryptoViewModel::setEncoded(const utility::string_t& value) +{ + m_Encoded = value; + m_EncodedIsSet = true; +} + +bool CryptoViewModel::encodedIsSet() const +{ + return m_EncodedIsSet; +} + +void CryptoViewModel::unsetEncoded() +{ + m_EncodedIsSet = false; +} +utility::string_t CryptoViewModel::getDecoded() const +{ + return m_Decoded; +} + + +void CryptoViewModel::setDecoded(const utility::string_t& value) +{ + m_Decoded = value; + m_DecodedIsSet = true; +} + +bool CryptoViewModel::decodedIsSet() const +{ + return m_DecodedIsSet; +} + +void CryptoViewModel::unsetDecoded() +{ + m_DecodedIsSet = false; +} + +} +} + + diff --git a/src/model/Game.cpp b/src/model/Game.cpp new file mode 100644 index 00000000..f16d9ebb --- /dev/null +++ b/src/model/Game.cpp @@ -0,0 +1,1577 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Game.h" + +namespace tribufu { +namespace models { + +Game::Game() +{ + m_Game_port = 0; + m_Game_portIsSet = false; + m_Query_port = 0; + m_Query_portIsSet = false; + m_Rcon_port = 0; + m_Rcon_portIsSet = false; + m_Server_count = 0; + m_Server_countIsSet = false; + m_Steam_app_id = 0; + m_Steam_app_idIsSet = false; + m_Steam_server_app_id = 0; + m_Steam_server_app_idIsSet = false; + m_Enable_servers = false; + m_Enable_serversIsSet = false; + m_Rust_gamedig_id = utility::conversions::to_string_t(""); + m_Rust_gamedig_idIsSet = false; + m_Node_gamedig_id = utility::conversions::to_string_t(""); + m_Node_gamedig_idIsSet = false; + m_Server_connect_url = utility::conversions::to_string_t(""); + m_Server_connect_urlIsSet = false; + m_Server_tags = utility::conversions::to_string_t(""); + m_Server_tagsIsSet = false; + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_TypeIsSet = false; + m_Organization_id = utility::conversions::to_string_t(""); + m_Organization_idIsSet = false; + m_Icon_url = utility::conversions::to_string_t(""); + m_Icon_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Capsule_image_url = utility::conversions::to_string_t(""); + m_Capsule_image_urlIsSet = false; + m_Library_image_url = utility::conversions::to_string_t(""); + m_Library_image_urlIsSet = false; + m_Parent_id = utility::conversions::to_string_t(""); + m_Parent_idIsSet = false; + m_Slug = utility::conversions::to_string_t(""); + m_SlugIsSet = false; + m_Visibility = 0; + m_VisibilityIsSet = false; + m_Password = utility::conversions::to_string_t(""); + m_PasswordIsSet = false; + m_Primary = 0; + m_PrimaryIsSet = false; + m_User_count = 0; + m_User_countIsSet = false; + m_Achievement_count = 0; + m_Achievement_countIsSet = false; + m_Badge_count = 0; + m_Badge_countIsSet = false; + m_Download_count = 0; + m_Download_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Game::~Game() +{ +} + +void Game::validate() +{ + // TODO: implement validation +} + +web::json::value Game::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Game_portIsSet) + { + + val[utility::conversions::to_string_t(U("game_port"))] = ModelBase::toJson(m_Game_port); + } + if(m_Query_portIsSet) + { + + val[utility::conversions::to_string_t(U("query_port"))] = ModelBase::toJson(m_Query_port); + } + if(m_Rcon_portIsSet) + { + + val[utility::conversions::to_string_t(U("rcon_port"))] = ModelBase::toJson(m_Rcon_port); + } + if(m_Server_countIsSet) + { + + val[utility::conversions::to_string_t(U("server_count"))] = ModelBase::toJson(m_Server_count); + } + if(m_Steam_app_idIsSet) + { + + val[utility::conversions::to_string_t(U("steam_app_id"))] = ModelBase::toJson(m_Steam_app_id); + } + if(m_Steam_server_app_idIsSet) + { + + val[utility::conversions::to_string_t(U("steam_server_app_id"))] = ModelBase::toJson(m_Steam_server_app_id); + } + if(m_Enable_serversIsSet) + { + + val[utility::conversions::to_string_t(U("enable_servers"))] = ModelBase::toJson(m_Enable_servers); + } + if(m_Rust_gamedig_idIsSet) + { + + val[utility::conversions::to_string_t(U("rust_gamedig_id"))] = ModelBase::toJson(m_Rust_gamedig_id); + } + if(m_Node_gamedig_idIsSet) + { + + val[utility::conversions::to_string_t(U("node_gamedig_id"))] = ModelBase::toJson(m_Node_gamedig_id); + } + if(m_Server_connect_urlIsSet) + { + + val[utility::conversions::to_string_t(U("server_connect_url"))] = ModelBase::toJson(m_Server_connect_url); + } + if(m_Server_tagsIsSet) + { + + val[utility::conversions::to_string_t(U("server_tags"))] = ModelBase::toJson(m_Server_tags); + } + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_TypeIsSet) + { + + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); + } + if(m_Organization_idIsSet) + { + + val[utility::conversions::to_string_t(U("organization_id"))] = ModelBase::toJson(m_Organization_id); + } + if(m_Icon_urlIsSet) + { + + val[utility::conversions::to_string_t(U("icon_url"))] = ModelBase::toJson(m_Icon_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Capsule_image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("capsule_image_url"))] = ModelBase::toJson(m_Capsule_image_url); + } + if(m_Library_image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("library_image_url"))] = ModelBase::toJson(m_Library_image_url); + } + if(m_Parent_idIsSet) + { + + val[utility::conversions::to_string_t(U("parent_id"))] = ModelBase::toJson(m_Parent_id); + } + if(m_SlugIsSet) + { + + val[utility::conversions::to_string_t(U("slug"))] = ModelBase::toJson(m_Slug); + } + if(m_VisibilityIsSet) + { + + val[utility::conversions::to_string_t(U("visibility"))] = ModelBase::toJson(m_Visibility); + } + if(m_PasswordIsSet) + { + + val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); + } + if(m_PrimaryIsSet) + { + + val[utility::conversions::to_string_t(U("primary"))] = ModelBase::toJson(m_Primary); + } + if(m_User_countIsSet) + { + + val[utility::conversions::to_string_t(U("user_count"))] = ModelBase::toJson(m_User_count); + } + if(m_Achievement_countIsSet) + { + + val[utility::conversions::to_string_t(U("achievement_count"))] = ModelBase::toJson(m_Achievement_count); + } + if(m_Badge_countIsSet) + { + + val[utility::conversions::to_string_t(U("badge_count"))] = ModelBase::toJson(m_Badge_count); + } + if(m_Download_countIsSet) + { + + val[utility::conversions::to_string_t(U("download_count"))] = ModelBase::toJson(m_Download_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Game::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("game_port")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_port"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setGamePort; + ok &= ModelBase::fromJson(fieldValue, refVal_setGamePort); + setGamePort(refVal_setGamePort); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("query_port")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("query_port"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setQueryPort; + ok &= ModelBase::fromJson(fieldValue, refVal_setQueryPort); + setQueryPort(refVal_setQueryPort); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("rcon_port")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("rcon_port"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setRconPort; + ok &= ModelBase::fromJson(fieldValue, refVal_setRconPort); + setRconPort(refVal_setRconPort); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("server_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("server_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setServerCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setServerCount); + setServerCount(refVal_setServerCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("steam_app_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("steam_app_id"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setSteamAppId; + ok &= ModelBase::fromJson(fieldValue, refVal_setSteamAppId); + setSteamAppId(refVal_setSteamAppId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("steam_server_app_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("steam_server_app_id"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setSteamServerAppId; + ok &= ModelBase::fromJson(fieldValue, refVal_setSteamServerAppId); + setSteamServerAppId(refVal_setSteamServerAppId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("enable_servers")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("enable_servers"))); + if(!fieldValue.is_null()) + { + bool refVal_setEnableServers; + ok &= ModelBase::fromJson(fieldValue, refVal_setEnableServers); + setEnableServers(refVal_setEnableServers); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("rust_gamedig_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("rust_gamedig_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRustGamedigId; + ok &= ModelBase::fromJson(fieldValue, refVal_setRustGamedigId); + setRustGamedigId(refVal_setRustGamedigId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("node_gamedig_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("node_gamedig_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setNodeGamedigId; + ok &= ModelBase::fromJson(fieldValue, refVal_setNodeGamedigId); + setNodeGamedigId(refVal_setNodeGamedigId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("server_connect_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("server_connect_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setServerConnectUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setServerConnectUrl); + setServerConnectUrl(refVal_setServerConnectUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("server_tags")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("server_tags"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setServerTags; + ok &= ModelBase::fromJson(fieldValue, refVal_setServerTags); + setServerTags(refVal_setServerTags); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromJson(fieldValue, refVal_setType); + setType(refVal_setType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("organization_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("organization_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setOrganizationId; + ok &= ModelBase::fromJson(fieldValue, refVal_setOrganizationId); + setOrganizationId(refVal_setOrganizationId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("icon_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("icon_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setIconUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setIconUrl); + setIconUrl(refVal_setIconUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("capsule_image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("capsule_image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCapsuleImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setCapsuleImageUrl); + setCapsuleImageUrl(refVal_setCapsuleImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("library_image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("library_image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLibraryImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setLibraryImageUrl); + setLibraryImageUrl(refVal_setLibraryImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("parent_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("parent_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setParentId; + ok &= ModelBase::fromJson(fieldValue, refVal_setParentId); + setParentId(refVal_setParentId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("slug")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("slug"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setSlug; + ok &= ModelBase::fromJson(fieldValue, refVal_setSlug); + setSlug(refVal_setSlug); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("visibility")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("visibility"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setVisibility; + ok &= ModelBase::fromJson(fieldValue, refVal_setVisibility); + setVisibility(refVal_setVisibility); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("password")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); + setPassword(refVal_setPassword); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("primary")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("primary"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPrimary; + ok &= ModelBase::fromJson(fieldValue, refVal_setPrimary); + setPrimary(refVal_setPrimary); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("user_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("user_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setUserCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setUserCount); + setUserCount(refVal_setUserCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("achievement_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("achievement_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setAchievementCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setAchievementCount); + setAchievementCount(refVal_setAchievementCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("badge_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("badge_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setBadgeCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setBadgeCount); + setBadgeCount(refVal_setBadgeCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("download_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("download_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setDownloadCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount); + setDownloadCount(refVal_setDownloadCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Game::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Game_portIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("game_port")), m_Game_port)); + } + if(m_Query_portIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("query_port")), m_Query_port)); + } + if(m_Rcon_portIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("rcon_port")), m_Rcon_port)); + } + if(m_Server_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("server_count")), m_Server_count)); + } + if(m_Steam_app_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("steam_app_id")), m_Steam_app_id)); + } + if(m_Steam_server_app_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("steam_server_app_id")), m_Steam_server_app_id)); + } + if(m_Enable_serversIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("enable_servers")), m_Enable_servers)); + } + if(m_Rust_gamedig_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("rust_gamedig_id")), m_Rust_gamedig_id)); + } + if(m_Node_gamedig_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("node_gamedig_id")), m_Node_gamedig_id)); + } + if(m_Server_connect_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("server_connect_url")), m_Server_connect_url)); + } + if(m_Server_tagsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("server_tags")), m_Server_tags)); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_TypeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + } + if(m_Organization_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("organization_id")), m_Organization_id)); + } + if(m_Icon_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("icon_url")), m_Icon_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Capsule_image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("capsule_image_url")), m_Capsule_image_url)); + } + if(m_Library_image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("library_image_url")), m_Library_image_url)); + } + if(m_Parent_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("parent_id")), m_Parent_id)); + } + if(m_SlugIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("slug")), m_Slug)); + } + if(m_VisibilityIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("visibility")), m_Visibility)); + } + if(m_PasswordIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); + } + if(m_PrimaryIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("primary")), m_Primary)); + } + if(m_User_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("user_count")), m_User_count)); + } + if(m_Achievement_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("achievement_count")), m_Achievement_count)); + } + if(m_Badge_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("badge_count")), m_Badge_count)); + } + if(m_Download_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("download_count")), m_Download_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Game::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("game_port")))) + { + int32_t refVal_setGamePort; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("game_port"))), refVal_setGamePort ); + setGamePort(refVal_setGamePort); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("query_port")))) + { + int32_t refVal_setQueryPort; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("query_port"))), refVal_setQueryPort ); + setQueryPort(refVal_setQueryPort); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("rcon_port")))) + { + int32_t refVal_setRconPort; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("rcon_port"))), refVal_setRconPort ); + setRconPort(refVal_setRconPort); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("server_count")))) + { + int32_t refVal_setServerCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("server_count"))), refVal_setServerCount ); + setServerCount(refVal_setServerCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("steam_app_id")))) + { + int32_t refVal_setSteamAppId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("steam_app_id"))), refVal_setSteamAppId ); + setSteamAppId(refVal_setSteamAppId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("steam_server_app_id")))) + { + int32_t refVal_setSteamServerAppId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("steam_server_app_id"))), refVal_setSteamServerAppId ); + setSteamServerAppId(refVal_setSteamServerAppId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("enable_servers")))) + { + bool refVal_setEnableServers; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("enable_servers"))), refVal_setEnableServers ); + setEnableServers(refVal_setEnableServers); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("rust_gamedig_id")))) + { + utility::string_t refVal_setRustGamedigId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("rust_gamedig_id"))), refVal_setRustGamedigId ); + setRustGamedigId(refVal_setRustGamedigId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("node_gamedig_id")))) + { + utility::string_t refVal_setNodeGamedigId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("node_gamedig_id"))), refVal_setNodeGamedigId ); + setNodeGamedigId(refVal_setNodeGamedigId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("server_connect_url")))) + { + utility::string_t refVal_setServerConnectUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("server_connect_url"))), refVal_setServerConnectUrl ); + setServerConnectUrl(refVal_setServerConnectUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("server_tags")))) + { + utility::string_t refVal_setServerTags; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("server_tags"))), refVal_setServerTags ); + setServerTags(refVal_setServerTags); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); + setType(refVal_setType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("organization_id")))) + { + utility::string_t refVal_setOrganizationId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("organization_id"))), refVal_setOrganizationId ); + setOrganizationId(refVal_setOrganizationId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("icon_url")))) + { + utility::string_t refVal_setIconUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("icon_url"))), refVal_setIconUrl ); + setIconUrl(refVal_setIconUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("capsule_image_url")))) + { + utility::string_t refVal_setCapsuleImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("capsule_image_url"))), refVal_setCapsuleImageUrl ); + setCapsuleImageUrl(refVal_setCapsuleImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("library_image_url")))) + { + utility::string_t refVal_setLibraryImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("library_image_url"))), refVal_setLibraryImageUrl ); + setLibraryImageUrl(refVal_setLibraryImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("parent_id")))) + { + utility::string_t refVal_setParentId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("parent_id"))), refVal_setParentId ); + setParentId(refVal_setParentId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("slug")))) + { + utility::string_t refVal_setSlug; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("slug"))), refVal_setSlug ); + setSlug(refVal_setSlug); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("visibility")))) + { + int32_t refVal_setVisibility; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("visibility"))), refVal_setVisibility ); + setVisibility(refVal_setVisibility); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); + setPassword(refVal_setPassword); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("primary")))) + { + int32_t refVal_setPrimary; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("primary"))), refVal_setPrimary ); + setPrimary(refVal_setPrimary); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("user_count")))) + { + int32_t refVal_setUserCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("user_count"))), refVal_setUserCount ); + setUserCount(refVal_setUserCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("achievement_count")))) + { + int32_t refVal_setAchievementCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("achievement_count"))), refVal_setAchievementCount ); + setAchievementCount(refVal_setAchievementCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("badge_count")))) + { + int32_t refVal_setBadgeCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("badge_count"))), refVal_setBadgeCount ); + setBadgeCount(refVal_setBadgeCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("download_count")))) + { + int32_t refVal_setDownloadCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("download_count"))), refVal_setDownloadCount ); + setDownloadCount(refVal_setDownloadCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +int32_t Game::getGamePort() const +{ + return m_Game_port; +} + +void Game::setGamePort(int32_t value) +{ + m_Game_port = value; + m_Game_portIsSet = true; +} + +bool Game::gamePortIsSet() const +{ + return m_Game_portIsSet; +} + +void Game::unsetGame_port() +{ + m_Game_portIsSet = false; +} +int32_t Game::getQueryPort() const +{ + return m_Query_port; +} + +void Game::setQueryPort(int32_t value) +{ + m_Query_port = value; + m_Query_portIsSet = true; +} + +bool Game::queryPortIsSet() const +{ + return m_Query_portIsSet; +} + +void Game::unsetQuery_port() +{ + m_Query_portIsSet = false; +} +int32_t Game::getRconPort() const +{ + return m_Rcon_port; +} + +void Game::setRconPort(int32_t value) +{ + m_Rcon_port = value; + m_Rcon_portIsSet = true; +} + +bool Game::rconPortIsSet() const +{ + return m_Rcon_portIsSet; +} + +void Game::unsetRcon_port() +{ + m_Rcon_portIsSet = false; +} +int32_t Game::getServerCount() const +{ + return m_Server_count; +} + +void Game::setServerCount(int32_t value) +{ + m_Server_count = value; + m_Server_countIsSet = true; +} + +bool Game::serverCountIsSet() const +{ + return m_Server_countIsSet; +} + +void Game::unsetServer_count() +{ + m_Server_countIsSet = false; +} +int32_t Game::getSteamAppId() const +{ + return m_Steam_app_id; +} + +void Game::setSteamAppId(int32_t value) +{ + m_Steam_app_id = value; + m_Steam_app_idIsSet = true; +} + +bool Game::steamAppIdIsSet() const +{ + return m_Steam_app_idIsSet; +} + +void Game::unsetSteam_app_id() +{ + m_Steam_app_idIsSet = false; +} +int32_t Game::getSteamServerAppId() const +{ + return m_Steam_server_app_id; +} + +void Game::setSteamServerAppId(int32_t value) +{ + m_Steam_server_app_id = value; + m_Steam_server_app_idIsSet = true; +} + +bool Game::steamServerAppIdIsSet() const +{ + return m_Steam_server_app_idIsSet; +} + +void Game::unsetSteam_server_app_id() +{ + m_Steam_server_app_idIsSet = false; +} +bool Game::isEnableServers() const +{ + return m_Enable_servers; +} + +void Game::setEnableServers(bool value) +{ + m_Enable_servers = value; + m_Enable_serversIsSet = true; +} + +bool Game::enableServersIsSet() const +{ + return m_Enable_serversIsSet; +} + +void Game::unsetEnable_servers() +{ + m_Enable_serversIsSet = false; +} +utility::string_t Game::getRustGamedigId() const +{ + return m_Rust_gamedig_id; +} + + +void Game::setRustGamedigId(const utility::string_t& value) +{ + m_Rust_gamedig_id = value; + m_Rust_gamedig_idIsSet = true; +} + +bool Game::rustGamedigIdIsSet() const +{ + return m_Rust_gamedig_idIsSet; +} + +void Game::unsetRust_gamedig_id() +{ + m_Rust_gamedig_idIsSet = false; +} +utility::string_t Game::getNodeGamedigId() const +{ + return m_Node_gamedig_id; +} + + +void Game::setNodeGamedigId(const utility::string_t& value) +{ + m_Node_gamedig_id = value; + m_Node_gamedig_idIsSet = true; +} + +bool Game::nodeGamedigIdIsSet() const +{ + return m_Node_gamedig_idIsSet; +} + +void Game::unsetNode_gamedig_id() +{ + m_Node_gamedig_idIsSet = false; +} +utility::string_t Game::getServerConnectUrl() const +{ + return m_Server_connect_url; +} + + +void Game::setServerConnectUrl(const utility::string_t& value) +{ + m_Server_connect_url = value; + m_Server_connect_urlIsSet = true; +} + +bool Game::serverConnectUrlIsSet() const +{ + return m_Server_connect_urlIsSet; +} + +void Game::unsetServer_connect_url() +{ + m_Server_connect_urlIsSet = false; +} +utility::string_t Game::getServerTags() const +{ + return m_Server_tags; +} + + +void Game::setServerTags(const utility::string_t& value) +{ + m_Server_tags = value; + m_Server_tagsIsSet = true; +} + +bool Game::serverTagsIsSet() const +{ + return m_Server_tagsIsSet; +} + +void Game::unsetServer_tags() +{ + m_Server_tagsIsSet = false; +} +utility::string_t Game::getId() const +{ + return m_Id; +} + + +void Game::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Game::idIsSet() const +{ + return m_IdIsSet; +} + +void Game::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Game::getName() const +{ + return m_Name; +} + + +void Game::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Game::nameIsSet() const +{ + return m_NameIsSet; +} + +void Game::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t Game::getDescription() const +{ + return m_Description; +} + + +void Game::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool Game::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void Game::unsetDescription() +{ + m_DescriptionIsSet = false; +} +std::shared_ptr Game::getType() const +{ + return m_Type; +} + + +void Game::setType(const std::shared_ptr& value) +{ + m_Type = value; + m_TypeIsSet = true; +} + +bool Game::typeIsSet() const +{ + return m_TypeIsSet; +} + +void Game::unsetType() +{ + m_TypeIsSet = false; +} +utility::string_t Game::getOrganizationId() const +{ + return m_Organization_id; +} + + +void Game::setOrganizationId(const utility::string_t& value) +{ + m_Organization_id = value; + m_Organization_idIsSet = true; +} + +bool Game::organizationIdIsSet() const +{ + return m_Organization_idIsSet; +} + +void Game::unsetOrganization_id() +{ + m_Organization_idIsSet = false; +} +utility::string_t Game::getIconUrl() const +{ + return m_Icon_url; +} + + +void Game::setIconUrl(const utility::string_t& value) +{ + m_Icon_url = value; + m_Icon_urlIsSet = true; +} + +bool Game::iconUrlIsSet() const +{ + return m_Icon_urlIsSet; +} + +void Game::unsetIcon_url() +{ + m_Icon_urlIsSet = false; +} +utility::string_t Game::getBannerUrl() const +{ + return m_Banner_url; +} + + +void Game::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool Game::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void Game::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +utility::string_t Game::getCapsuleImageUrl() const +{ + return m_Capsule_image_url; +} + + +void Game::setCapsuleImageUrl(const utility::string_t& value) +{ + m_Capsule_image_url = value; + m_Capsule_image_urlIsSet = true; +} + +bool Game::capsuleImageUrlIsSet() const +{ + return m_Capsule_image_urlIsSet; +} + +void Game::unsetCapsule_image_url() +{ + m_Capsule_image_urlIsSet = false; +} +utility::string_t Game::getLibraryImageUrl() const +{ + return m_Library_image_url; +} + + +void Game::setLibraryImageUrl(const utility::string_t& value) +{ + m_Library_image_url = value; + m_Library_image_urlIsSet = true; +} + +bool Game::libraryImageUrlIsSet() const +{ + return m_Library_image_urlIsSet; +} + +void Game::unsetLibrary_image_url() +{ + m_Library_image_urlIsSet = false; +} +utility::string_t Game::getParentId() const +{ + return m_Parent_id; +} + + +void Game::setParentId(const utility::string_t& value) +{ + m_Parent_id = value; + m_Parent_idIsSet = true; +} + +bool Game::parentIdIsSet() const +{ + return m_Parent_idIsSet; +} + +void Game::unsetParent_id() +{ + m_Parent_idIsSet = false; +} +utility::string_t Game::getSlug() const +{ + return m_Slug; +} + + +void Game::setSlug(const utility::string_t& value) +{ + m_Slug = value; + m_SlugIsSet = true; +} + +bool Game::slugIsSet() const +{ + return m_SlugIsSet; +} + +void Game::unsetSlug() +{ + m_SlugIsSet = false; +} +int32_t Game::getVisibility() const +{ + return m_Visibility; +} + +void Game::setVisibility(int32_t value) +{ + m_Visibility = value; + m_VisibilityIsSet = true; +} + +bool Game::visibilityIsSet() const +{ + return m_VisibilityIsSet; +} + +void Game::unsetVisibility() +{ + m_VisibilityIsSet = false; +} +utility::string_t Game::getPassword() const +{ + return m_Password; +} + + +void Game::setPassword(const utility::string_t& value) +{ + m_Password = value; + m_PasswordIsSet = true; +} + +bool Game::passwordIsSet() const +{ + return m_PasswordIsSet; +} + +void Game::unsetPassword() +{ + m_PasswordIsSet = false; +} +int32_t Game::getPrimary() const +{ + return m_Primary; +} + +void Game::setPrimary(int32_t value) +{ + m_Primary = value; + m_PrimaryIsSet = true; +} + +bool Game::primaryIsSet() const +{ + return m_PrimaryIsSet; +} + +void Game::unsetPrimary() +{ + m_PrimaryIsSet = false; +} +int32_t Game::getUserCount() const +{ + return m_User_count; +} + +void Game::setUserCount(int32_t value) +{ + m_User_count = value; + m_User_countIsSet = true; +} + +bool Game::userCountIsSet() const +{ + return m_User_countIsSet; +} + +void Game::unsetUser_count() +{ + m_User_countIsSet = false; +} +int32_t Game::getAchievementCount() const +{ + return m_Achievement_count; +} + +void Game::setAchievementCount(int32_t value) +{ + m_Achievement_count = value; + m_Achievement_countIsSet = true; +} + +bool Game::achievementCountIsSet() const +{ + return m_Achievement_countIsSet; +} + +void Game::unsetAchievement_count() +{ + m_Achievement_countIsSet = false; +} +int32_t Game::getBadgeCount() const +{ + return m_Badge_count; +} + +void Game::setBadgeCount(int32_t value) +{ + m_Badge_count = value; + m_Badge_countIsSet = true; +} + +bool Game::badgeCountIsSet() const +{ + return m_Badge_countIsSet; +} + +void Game::unsetBadge_count() +{ + m_Badge_countIsSet = false; +} +int32_t Game::getDownloadCount() const +{ + return m_Download_count; +} + +void Game::setDownloadCount(int32_t value) +{ + m_Download_count = value; + m_Download_countIsSet = true; +} + +bool Game::downloadCountIsSet() const +{ + return m_Download_countIsSet; +} + +void Game::unsetDownload_count() +{ + m_Download_countIsSet = false; +} +utility::datetime Game::getCreated() const +{ + return m_Created; +} + + +void Game::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Game::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Game::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Game::getUpdated() const +{ + return m_Updated; +} + + +void Game::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Game::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Game::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/GameServer.cpp b/src/model/GameServer.cpp new file mode 100644 index 00000000..f882a561 --- /dev/null +++ b/src/model/GameServer.cpp @@ -0,0 +1,1581 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/GameServer.h" + +namespace tribufu { +namespace models { + +GameServer::GameServer() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_Address = utility::conversions::to_string_t(""); + m_AddressIsSet = false; + m_Game_port = 0; + m_Game_portIsSet = false; + m_Query_port = 0; + m_Query_portIsSet = false; + m_Game_id = utility::conversions::to_string_t(""); + m_Game_idIsSet = false; + m_Game_icon_url = utility::conversions::to_string_t(""); + m_Game_icon_urlIsSet = false; + m_Version = utility::conversions::to_string_t(""); + m_VersionIsSet = false; + m_Featured = false; + m_FeaturedIsSet = false; + m_Cluster_id = utility::conversions::to_string_t(""); + m_Cluster_idIsSet = false; + m_Website_url = utility::conversions::to_string_t(""); + m_Website_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Owner_id = utility::conversions::to_string_t(""); + m_Owner_idIsSet = false; + m_Uptime = 0.0; + m_UptimeIsSet = false; + m_StatusIsSet = false; + m_Ping = 0; + m_PingIsSet = false; + m_map = utility::conversions::to_string_t(""); + m_mapIsSet = false; + m_Used_slots = 0; + m_Used_slotsIsSet = false; + m_Max_slots = 0; + m_Max_slotsIsSet = false; + m_Motd = utility::conversions::to_string_t(""); + m_MotdIsSet = false; + m_Players = utility::conversions::to_string_t(""); + m_PlayersIsSet = false; + m_Last_online = utility::datetime(); + m_Last_onlineIsSet = false; + m_Country = utility::conversions::to_string_t(""); + m_CountryIsSet = false; + m_Steam = false; + m_SteamIsSet = false; + m_Discord_server_id = utility::conversions::to_string_t(""); + m_Discord_server_idIsSet = false; + m_Youtube_video_url = utility::conversions::to_string_t(""); + m_Youtube_video_urlIsSet = false; + m_Tags = utility::conversions::to_string_t(""); + m_TagsIsSet = false; + m_Comment_count = 0; + m_Comment_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +GameServer::~GameServer() +{ +} + +void GameServer::validate() +{ + // TODO: implement validation +} + +web::json::value GameServer::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_AddressIsSet) + { + + val[utility::conversions::to_string_t(U("address"))] = ModelBase::toJson(m_Address); + } + if(m_Game_portIsSet) + { + + val[utility::conversions::to_string_t(U("game_port"))] = ModelBase::toJson(m_Game_port); + } + if(m_Query_portIsSet) + { + + val[utility::conversions::to_string_t(U("query_port"))] = ModelBase::toJson(m_Query_port); + } + if(m_Game_idIsSet) + { + + val[utility::conversions::to_string_t(U("game_id"))] = ModelBase::toJson(m_Game_id); + } + if(m_Game_icon_urlIsSet) + { + + val[utility::conversions::to_string_t(U("game_icon_url"))] = ModelBase::toJson(m_Game_icon_url); + } + if(m_VersionIsSet) + { + + val[utility::conversions::to_string_t(U("version"))] = ModelBase::toJson(m_Version); + } + if(m_FeaturedIsSet) + { + + val[utility::conversions::to_string_t(U("featured"))] = ModelBase::toJson(m_Featured); + } + if(m_Cluster_idIsSet) + { + + val[utility::conversions::to_string_t(U("cluster_id"))] = ModelBase::toJson(m_Cluster_id); + } + if(m_Website_urlIsSet) + { + + val[utility::conversions::to_string_t(U("website_url"))] = ModelBase::toJson(m_Website_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Owner_idIsSet) + { + + val[utility::conversions::to_string_t(U("owner_id"))] = ModelBase::toJson(m_Owner_id); + } + if(m_UptimeIsSet) + { + + val[utility::conversions::to_string_t(U("uptime"))] = ModelBase::toJson(m_Uptime); + } + if(m_StatusIsSet) + { + + val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status); + } + if(m_PingIsSet) + { + + val[utility::conversions::to_string_t(U("ping"))] = ModelBase::toJson(m_Ping); + } + if(m_mapIsSet) + { + + val[utility::conversions::to_string_t(U("map"))] = ModelBase::toJson(m_map); + } + if(m_Used_slotsIsSet) + { + + val[utility::conversions::to_string_t(U("used_slots"))] = ModelBase::toJson(m_Used_slots); + } + if(m_Max_slotsIsSet) + { + + val[utility::conversions::to_string_t(U("max_slots"))] = ModelBase::toJson(m_Max_slots); + } + if(m_MotdIsSet) + { + + val[utility::conversions::to_string_t(U("motd"))] = ModelBase::toJson(m_Motd); + } + if(m_PlayersIsSet) + { + + val[utility::conversions::to_string_t(U("players"))] = ModelBase::toJson(m_Players); + } + if(m_Last_onlineIsSet) + { + + val[utility::conversions::to_string_t(U("last_online"))] = ModelBase::toJson(m_Last_online); + } + if(m_CountryIsSet) + { + + val[utility::conversions::to_string_t(U("country"))] = ModelBase::toJson(m_Country); + } + if(m_SteamIsSet) + { + + val[utility::conversions::to_string_t(U("steam"))] = ModelBase::toJson(m_Steam); + } + if(m_Discord_server_idIsSet) + { + + val[utility::conversions::to_string_t(U("discord_server_id"))] = ModelBase::toJson(m_Discord_server_id); + } + if(m_Youtube_video_urlIsSet) + { + + val[utility::conversions::to_string_t(U("youtube_video_url"))] = ModelBase::toJson(m_Youtube_video_url); + } + if(m_TagsIsSet) + { + + val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags); + } + if(m_Comment_countIsSet) + { + + val[utility::conversions::to_string_t(U("comment_count"))] = ModelBase::toJson(m_Comment_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool GameServer::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("address")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("address"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setAddress; + ok &= ModelBase::fromJson(fieldValue, refVal_setAddress); + setAddress(refVal_setAddress); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("game_port")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_port"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setGamePort; + ok &= ModelBase::fromJson(fieldValue, refVal_setGamePort); + setGamePort(refVal_setGamePort); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("query_port")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("query_port"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setQueryPort; + ok &= ModelBase::fromJson(fieldValue, refVal_setQueryPort); + setQueryPort(refVal_setQueryPort); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("game_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setGameId; + ok &= ModelBase::fromJson(fieldValue, refVal_setGameId); + setGameId(refVal_setGameId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("game_icon_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_icon_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setGameIconUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setGameIconUrl); + setGameIconUrl(refVal_setGameIconUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("version")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("version"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setVersion; + ok &= ModelBase::fromJson(fieldValue, refVal_setVersion); + setVersion(refVal_setVersion); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("featured")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("featured"))); + if(!fieldValue.is_null()) + { + bool refVal_setFeatured; + ok &= ModelBase::fromJson(fieldValue, refVal_setFeatured); + setFeatured(refVal_setFeatured); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("cluster_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("cluster_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setClusterId; + ok &= ModelBase::fromJson(fieldValue, refVal_setClusterId); + setClusterId(refVal_setClusterId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("website_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("website_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setWebsiteUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setWebsiteUrl); + setWebsiteUrl(refVal_setWebsiteUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("owner_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("owner_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setOwnerId; + ok &= ModelBase::fromJson(fieldValue, refVal_setOwnerId); + setOwnerId(refVal_setOwnerId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("uptime")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uptime"))); + if(!fieldValue.is_null()) + { + double refVal_setUptime; + ok &= ModelBase::fromJson(fieldValue, refVal_setUptime); + setUptime(refVal_setUptime); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("status")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setStatus; + ok &= ModelBase::fromJson(fieldValue, refVal_setStatus); + setStatus(refVal_setStatus); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("ping")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("ping"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPing; + ok &= ModelBase::fromJson(fieldValue, refVal_setPing); + setPing(refVal_setPing); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("map")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("map"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setMap; + ok &= ModelBase::fromJson(fieldValue, refVal_setMap); + setMap(refVal_setMap); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("used_slots")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("used_slots"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setUsedSlots; + ok &= ModelBase::fromJson(fieldValue, refVal_setUsedSlots); + setUsedSlots(refVal_setUsedSlots); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("max_slots")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("max_slots"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setMaxSlots; + ok &= ModelBase::fromJson(fieldValue, refVal_setMaxSlots); + setMaxSlots(refVal_setMaxSlots); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("motd")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("motd"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setMotd; + ok &= ModelBase::fromJson(fieldValue, refVal_setMotd); + setMotd(refVal_setMotd); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("players")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("players"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPlayers; + ok &= ModelBase::fromJson(fieldValue, refVal_setPlayers); + setPlayers(refVal_setPlayers); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_online")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_online"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); + setLastOnline(refVal_setLastOnline); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("country")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("country"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCountry; + ok &= ModelBase::fromJson(fieldValue, refVal_setCountry); + setCountry(refVal_setCountry); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("steam")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("steam"))); + if(!fieldValue.is_null()) + { + bool refVal_setSteam; + ok &= ModelBase::fromJson(fieldValue, refVal_setSteam); + setSteam(refVal_setSteam); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("discord_server_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("discord_server_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDiscordServerId; + ok &= ModelBase::fromJson(fieldValue, refVal_setDiscordServerId); + setDiscordServerId(refVal_setDiscordServerId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("youtube_video_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("youtube_video_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setYoutubeVideoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setYoutubeVideoUrl); + setYoutubeVideoUrl(refVal_setYoutubeVideoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("tags")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tags"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTags; + ok &= ModelBase::fromJson(fieldValue, refVal_setTags); + setTags(refVal_setTags); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("comment_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("comment_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setCommentCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setCommentCount); + setCommentCount(refVal_setCommentCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void GameServer::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_AddressIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("address")), m_Address)); + } + if(m_Game_portIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("game_port")), m_Game_port)); + } + if(m_Query_portIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("query_port")), m_Query_port)); + } + if(m_Game_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("game_id")), m_Game_id)); + } + if(m_Game_icon_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("game_icon_url")), m_Game_icon_url)); + } + if(m_VersionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("version")), m_Version)); + } + if(m_FeaturedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("featured")), m_Featured)); + } + if(m_Cluster_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("cluster_id")), m_Cluster_id)); + } + if(m_Website_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("website_url")), m_Website_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Owner_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("owner_id")), m_Owner_id)); + } + if(m_UptimeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uptime")), m_Uptime)); + } + if(m_StatusIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status)); + } + if(m_PingIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("ping")), m_Ping)); + } + if(m_mapIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("map")), m_map)); + } + if(m_Used_slotsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("used_slots")), m_Used_slots)); + } + if(m_Max_slotsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("max_slots")), m_Max_slots)); + } + if(m_MotdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("motd")), m_Motd)); + } + if(m_PlayersIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("players")), m_Players)); + } + if(m_Last_onlineIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_online")), m_Last_online)); + } + if(m_CountryIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("country")), m_Country)); + } + if(m_SteamIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("steam")), m_Steam)); + } + if(m_Discord_server_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("discord_server_id")), m_Discord_server_id)); + } + if(m_Youtube_video_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("youtube_video_url")), m_Youtube_video_url)); + } + if(m_TagsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags)); + } + if(m_Comment_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("comment_count")), m_Comment_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool GameServer::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("address")))) + { + utility::string_t refVal_setAddress; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("address"))), refVal_setAddress ); + setAddress(refVal_setAddress); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("game_port")))) + { + int32_t refVal_setGamePort; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("game_port"))), refVal_setGamePort ); + setGamePort(refVal_setGamePort); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("query_port")))) + { + int32_t refVal_setQueryPort; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("query_port"))), refVal_setQueryPort ); + setQueryPort(refVal_setQueryPort); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("game_id")))) + { + utility::string_t refVal_setGameId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("game_id"))), refVal_setGameId ); + setGameId(refVal_setGameId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("game_icon_url")))) + { + utility::string_t refVal_setGameIconUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("game_icon_url"))), refVal_setGameIconUrl ); + setGameIconUrl(refVal_setGameIconUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("version")))) + { + utility::string_t refVal_setVersion; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("version"))), refVal_setVersion ); + setVersion(refVal_setVersion); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("featured")))) + { + bool refVal_setFeatured; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("featured"))), refVal_setFeatured ); + setFeatured(refVal_setFeatured); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("cluster_id")))) + { + utility::string_t refVal_setClusterId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("cluster_id"))), refVal_setClusterId ); + setClusterId(refVal_setClusterId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("website_url")))) + { + utility::string_t refVal_setWebsiteUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("website_url"))), refVal_setWebsiteUrl ); + setWebsiteUrl(refVal_setWebsiteUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("owner_id")))) + { + utility::string_t refVal_setOwnerId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("owner_id"))), refVal_setOwnerId ); + setOwnerId(refVal_setOwnerId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("uptime")))) + { + double refVal_setUptime; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uptime"))), refVal_setUptime ); + setUptime(refVal_setUptime); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) + { + std::shared_ptr refVal_setStatus; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); + setStatus(refVal_setStatus); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("ping")))) + { + int32_t refVal_setPing; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("ping"))), refVal_setPing ); + setPing(refVal_setPing); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("map")))) + { + utility::string_t refVal_setMap; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("map"))), refVal_setMap ); + setMap(refVal_setMap); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("used_slots")))) + { + int32_t refVal_setUsedSlots; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("used_slots"))), refVal_setUsedSlots ); + setUsedSlots(refVal_setUsedSlots); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("max_slots")))) + { + int32_t refVal_setMaxSlots; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("max_slots"))), refVal_setMaxSlots ); + setMaxSlots(refVal_setMaxSlots); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("motd")))) + { + utility::string_t refVal_setMotd; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("motd"))), refVal_setMotd ); + setMotd(refVal_setMotd); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("players")))) + { + utility::string_t refVal_setPlayers; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("players"))), refVal_setPlayers ); + setPlayers(refVal_setPlayers); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_online")))) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_online"))), refVal_setLastOnline ); + setLastOnline(refVal_setLastOnline); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("country")))) + { + utility::string_t refVal_setCountry; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("country"))), refVal_setCountry ); + setCountry(refVal_setCountry); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("steam")))) + { + bool refVal_setSteam; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("steam"))), refVal_setSteam ); + setSteam(refVal_setSteam); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("discord_server_id")))) + { + utility::string_t refVal_setDiscordServerId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("discord_server_id"))), refVal_setDiscordServerId ); + setDiscordServerId(refVal_setDiscordServerId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("youtube_video_url")))) + { + utility::string_t refVal_setYoutubeVideoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("youtube_video_url"))), refVal_setYoutubeVideoUrl ); + setYoutubeVideoUrl(refVal_setYoutubeVideoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("tags")))) + { + utility::string_t refVal_setTags; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_setTags ); + setTags(refVal_setTags); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("comment_count")))) + { + int32_t refVal_setCommentCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("comment_count"))), refVal_setCommentCount ); + setCommentCount(refVal_setCommentCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t GameServer::getId() const +{ + return m_Id; +} + + +void GameServer::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool GameServer::idIsSet() const +{ + return m_IdIsSet; +} + +void GameServer::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t GameServer::getName() const +{ + return m_Name; +} + + +void GameServer::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool GameServer::nameIsSet() const +{ + return m_NameIsSet; +} + +void GameServer::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t GameServer::getDescription() const +{ + return m_Description; +} + + +void GameServer::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool GameServer::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void GameServer::unsetDescription() +{ + m_DescriptionIsSet = false; +} +utility::string_t GameServer::getAddress() const +{ + return m_Address; +} + + +void GameServer::setAddress(const utility::string_t& value) +{ + m_Address = value; + m_AddressIsSet = true; +} + +bool GameServer::addressIsSet() const +{ + return m_AddressIsSet; +} + +void GameServer::unsetAddress() +{ + m_AddressIsSet = false; +} +int32_t GameServer::getGamePort() const +{ + return m_Game_port; +} + +void GameServer::setGamePort(int32_t value) +{ + m_Game_port = value; + m_Game_portIsSet = true; +} + +bool GameServer::gamePortIsSet() const +{ + return m_Game_portIsSet; +} + +void GameServer::unsetGame_port() +{ + m_Game_portIsSet = false; +} +int32_t GameServer::getQueryPort() const +{ + return m_Query_port; +} + +void GameServer::setQueryPort(int32_t value) +{ + m_Query_port = value; + m_Query_portIsSet = true; +} + +bool GameServer::queryPortIsSet() const +{ + return m_Query_portIsSet; +} + +void GameServer::unsetQuery_port() +{ + m_Query_portIsSet = false; +} +utility::string_t GameServer::getGameId() const +{ + return m_Game_id; +} + + +void GameServer::setGameId(const utility::string_t& value) +{ + m_Game_id = value; + m_Game_idIsSet = true; +} + +bool GameServer::gameIdIsSet() const +{ + return m_Game_idIsSet; +} + +void GameServer::unsetGame_id() +{ + m_Game_idIsSet = false; +} +utility::string_t GameServer::getGameIconUrl() const +{ + return m_Game_icon_url; +} + + +void GameServer::setGameIconUrl(const utility::string_t& value) +{ + m_Game_icon_url = value; + m_Game_icon_urlIsSet = true; +} + +bool GameServer::gameIconUrlIsSet() const +{ + return m_Game_icon_urlIsSet; +} + +void GameServer::unsetGame_icon_url() +{ + m_Game_icon_urlIsSet = false; +} +utility::string_t GameServer::getVersion() const +{ + return m_Version; +} + + +void GameServer::setVersion(const utility::string_t& value) +{ + m_Version = value; + m_VersionIsSet = true; +} + +bool GameServer::versionIsSet() const +{ + return m_VersionIsSet; +} + +void GameServer::unsetVersion() +{ + m_VersionIsSet = false; +} +bool GameServer::isFeatured() const +{ + return m_Featured; +} + +void GameServer::setFeatured(bool value) +{ + m_Featured = value; + m_FeaturedIsSet = true; +} + +bool GameServer::featuredIsSet() const +{ + return m_FeaturedIsSet; +} + +void GameServer::unsetFeatured() +{ + m_FeaturedIsSet = false; +} +utility::string_t GameServer::getClusterId() const +{ + return m_Cluster_id; +} + + +void GameServer::setClusterId(const utility::string_t& value) +{ + m_Cluster_id = value; + m_Cluster_idIsSet = true; +} + +bool GameServer::clusterIdIsSet() const +{ + return m_Cluster_idIsSet; +} + +void GameServer::unsetCluster_id() +{ + m_Cluster_idIsSet = false; +} +utility::string_t GameServer::getWebsiteUrl() const +{ + return m_Website_url; +} + + +void GameServer::setWebsiteUrl(const utility::string_t& value) +{ + m_Website_url = value; + m_Website_urlIsSet = true; +} + +bool GameServer::websiteUrlIsSet() const +{ + return m_Website_urlIsSet; +} + +void GameServer::unsetWebsite_url() +{ + m_Website_urlIsSet = false; +} +utility::string_t GameServer::getBannerUrl() const +{ + return m_Banner_url; +} + + +void GameServer::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool GameServer::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void GameServer::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +utility::string_t GameServer::getOwnerId() const +{ + return m_Owner_id; +} + + +void GameServer::setOwnerId(const utility::string_t& value) +{ + m_Owner_id = value; + m_Owner_idIsSet = true; +} + +bool GameServer::ownerIdIsSet() const +{ + return m_Owner_idIsSet; +} + +void GameServer::unsetOwner_id() +{ + m_Owner_idIsSet = false; +} +double GameServer::getUptime() const +{ + return m_Uptime; +} + +void GameServer::setUptime(double value) +{ + m_Uptime = value; + m_UptimeIsSet = true; +} + +bool GameServer::uptimeIsSet() const +{ + return m_UptimeIsSet; +} + +void GameServer::unsetUptime() +{ + m_UptimeIsSet = false; +} +std::shared_ptr GameServer::getStatus() const +{ + return m_Status; +} + + +void GameServer::setStatus(const std::shared_ptr& value) +{ + m_Status = value; + m_StatusIsSet = true; +} + +bool GameServer::statusIsSet() const +{ + return m_StatusIsSet; +} + +void GameServer::unsetStatus() +{ + m_StatusIsSet = false; +} +int32_t GameServer::getPing() const +{ + return m_Ping; +} + +void GameServer::setPing(int32_t value) +{ + m_Ping = value; + m_PingIsSet = true; +} + +bool GameServer::pingIsSet() const +{ + return m_PingIsSet; +} + +void GameServer::unsetPing() +{ + m_PingIsSet = false; +} +utility::string_t GameServer::getMap() const +{ + return m_map; +} + + +void GameServer::setMap(const utility::string_t& value) +{ + m_map = value; + m_mapIsSet = true; +} + +bool GameServer::mapIsSet() const +{ + return m_mapIsSet; +} + +void GameServer::unsetmap() +{ + m_mapIsSet = false; +} +int32_t GameServer::getUsedSlots() const +{ + return m_Used_slots; +} + +void GameServer::setUsedSlots(int32_t value) +{ + m_Used_slots = value; + m_Used_slotsIsSet = true; +} + +bool GameServer::usedSlotsIsSet() const +{ + return m_Used_slotsIsSet; +} + +void GameServer::unsetUsed_slots() +{ + m_Used_slotsIsSet = false; +} +int32_t GameServer::getMaxSlots() const +{ + return m_Max_slots; +} + +void GameServer::setMaxSlots(int32_t value) +{ + m_Max_slots = value; + m_Max_slotsIsSet = true; +} + +bool GameServer::maxSlotsIsSet() const +{ + return m_Max_slotsIsSet; +} + +void GameServer::unsetMax_slots() +{ + m_Max_slotsIsSet = false; +} +utility::string_t GameServer::getMotd() const +{ + return m_Motd; +} + + +void GameServer::setMotd(const utility::string_t& value) +{ + m_Motd = value; + m_MotdIsSet = true; +} + +bool GameServer::motdIsSet() const +{ + return m_MotdIsSet; +} + +void GameServer::unsetMotd() +{ + m_MotdIsSet = false; +} +utility::string_t GameServer::getPlayers() const +{ + return m_Players; +} + + +void GameServer::setPlayers(const utility::string_t& value) +{ + m_Players = value; + m_PlayersIsSet = true; +} + +bool GameServer::playersIsSet() const +{ + return m_PlayersIsSet; +} + +void GameServer::unsetPlayers() +{ + m_PlayersIsSet = false; +} +utility::datetime GameServer::getLastOnline() const +{ + return m_Last_online; +} + + +void GameServer::setLastOnline(const utility::datetime& value) +{ + m_Last_online = value; + m_Last_onlineIsSet = true; +} + +bool GameServer::lastOnlineIsSet() const +{ + return m_Last_onlineIsSet; +} + +void GameServer::unsetLast_online() +{ + m_Last_onlineIsSet = false; +} +utility::string_t GameServer::getCountry() const +{ + return m_Country; +} + + +void GameServer::setCountry(const utility::string_t& value) +{ + m_Country = value; + m_CountryIsSet = true; +} + +bool GameServer::countryIsSet() const +{ + return m_CountryIsSet; +} + +void GameServer::unsetCountry() +{ + m_CountryIsSet = false; +} +bool GameServer::isSteam() const +{ + return m_Steam; +} + +void GameServer::setSteam(bool value) +{ + m_Steam = value; + m_SteamIsSet = true; +} + +bool GameServer::steamIsSet() const +{ + return m_SteamIsSet; +} + +void GameServer::unsetSteam() +{ + m_SteamIsSet = false; +} +utility::string_t GameServer::getDiscordServerId() const +{ + return m_Discord_server_id; +} + + +void GameServer::setDiscordServerId(const utility::string_t& value) +{ + m_Discord_server_id = value; + m_Discord_server_idIsSet = true; +} + +bool GameServer::discordServerIdIsSet() const +{ + return m_Discord_server_idIsSet; +} + +void GameServer::unsetDiscord_server_id() +{ + m_Discord_server_idIsSet = false; +} +utility::string_t GameServer::getYoutubeVideoUrl() const +{ + return m_Youtube_video_url; +} + + +void GameServer::setYoutubeVideoUrl(const utility::string_t& value) +{ + m_Youtube_video_url = value; + m_Youtube_video_urlIsSet = true; +} + +bool GameServer::youtubeVideoUrlIsSet() const +{ + return m_Youtube_video_urlIsSet; +} + +void GameServer::unsetYoutube_video_url() +{ + m_Youtube_video_urlIsSet = false; +} +utility::string_t GameServer::getTags() const +{ + return m_Tags; +} + + +void GameServer::setTags(const utility::string_t& value) +{ + m_Tags = value; + m_TagsIsSet = true; +} + +bool GameServer::tagsIsSet() const +{ + return m_TagsIsSet; +} + +void GameServer::unsetTags() +{ + m_TagsIsSet = false; +} +int32_t GameServer::getCommentCount() const +{ + return m_Comment_count; +} + +void GameServer::setCommentCount(int32_t value) +{ + m_Comment_count = value; + m_Comment_countIsSet = true; +} + +bool GameServer::commentCountIsSet() const +{ + return m_Comment_countIsSet; +} + +void GameServer::unsetComment_count() +{ + m_Comment_countIsSet = false; +} +utility::datetime GameServer::getCreated() const +{ + return m_Created; +} + + +void GameServer::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool GameServer::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void GameServer::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime GameServer::getUpdated() const +{ + return m_Updated; +} + + +void GameServer::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool GameServer::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void GameServer::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/GameServerCluster.cpp b/src/model/GameServerCluster.cpp new file mode 100644 index 00000000..88a649e4 --- /dev/null +++ b/src/model/GameServerCluster.cpp @@ -0,0 +1,756 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/GameServerCluster.h" + +namespace tribufu { +namespace models { + +GameServerCluster::GameServerCluster() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_Game_id = utility::conversions::to_string_t(""); + m_Game_idIsSet = false; + m_Website_url = utility::conversions::to_string_t(""); + m_Website_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Owner_id = utility::conversions::to_string_t(""); + m_Owner_idIsSet = false; + m_Discord_server_id = utility::conversions::to_string_t(""); + m_Discord_server_idIsSet = false; + m_Youtube_video_url = utility::conversions::to_string_t(""); + m_Youtube_video_urlIsSet = false; + m_Tags = utility::conversions::to_string_t(""); + m_TagsIsSet = false; + m_Comment_count = 0; + m_Comment_countIsSet = false; + m_Server_count = 0; + m_Server_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +GameServerCluster::~GameServerCluster() +{ +} + +void GameServerCluster::validate() +{ + // TODO: implement validation +} + +web::json::value GameServerCluster::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_Game_idIsSet) + { + + val[utility::conversions::to_string_t(U("game_id"))] = ModelBase::toJson(m_Game_id); + } + if(m_Website_urlIsSet) + { + + val[utility::conversions::to_string_t(U("website_url"))] = ModelBase::toJson(m_Website_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Owner_idIsSet) + { + + val[utility::conversions::to_string_t(U("owner_id"))] = ModelBase::toJson(m_Owner_id); + } + if(m_Discord_server_idIsSet) + { + + val[utility::conversions::to_string_t(U("discord_server_id"))] = ModelBase::toJson(m_Discord_server_id); + } + if(m_Youtube_video_urlIsSet) + { + + val[utility::conversions::to_string_t(U("youtube_video_url"))] = ModelBase::toJson(m_Youtube_video_url); + } + if(m_TagsIsSet) + { + + val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags); + } + if(m_Comment_countIsSet) + { + + val[utility::conversions::to_string_t(U("comment_count"))] = ModelBase::toJson(m_Comment_count); + } + if(m_Server_countIsSet) + { + + val[utility::conversions::to_string_t(U("server_count"))] = ModelBase::toJson(m_Server_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool GameServerCluster::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("game_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setGameId; + ok &= ModelBase::fromJson(fieldValue, refVal_setGameId); + setGameId(refVal_setGameId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("website_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("website_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setWebsiteUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setWebsiteUrl); + setWebsiteUrl(refVal_setWebsiteUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("owner_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("owner_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setOwnerId; + ok &= ModelBase::fromJson(fieldValue, refVal_setOwnerId); + setOwnerId(refVal_setOwnerId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("discord_server_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("discord_server_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDiscordServerId; + ok &= ModelBase::fromJson(fieldValue, refVal_setDiscordServerId); + setDiscordServerId(refVal_setDiscordServerId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("youtube_video_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("youtube_video_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setYoutubeVideoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setYoutubeVideoUrl); + setYoutubeVideoUrl(refVal_setYoutubeVideoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("tags")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tags"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTags; + ok &= ModelBase::fromJson(fieldValue, refVal_setTags); + setTags(refVal_setTags); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("comment_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("comment_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setCommentCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setCommentCount); + setCommentCount(refVal_setCommentCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("server_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("server_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setServerCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setServerCount); + setServerCount(refVal_setServerCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void GameServerCluster::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_Game_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("game_id")), m_Game_id)); + } + if(m_Website_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("website_url")), m_Website_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Owner_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("owner_id")), m_Owner_id)); + } + if(m_Discord_server_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("discord_server_id")), m_Discord_server_id)); + } + if(m_Youtube_video_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("youtube_video_url")), m_Youtube_video_url)); + } + if(m_TagsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags)); + } + if(m_Comment_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("comment_count")), m_Comment_count)); + } + if(m_Server_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("server_count")), m_Server_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool GameServerCluster::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("game_id")))) + { + utility::string_t refVal_setGameId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("game_id"))), refVal_setGameId ); + setGameId(refVal_setGameId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("website_url")))) + { + utility::string_t refVal_setWebsiteUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("website_url"))), refVal_setWebsiteUrl ); + setWebsiteUrl(refVal_setWebsiteUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("owner_id")))) + { + utility::string_t refVal_setOwnerId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("owner_id"))), refVal_setOwnerId ); + setOwnerId(refVal_setOwnerId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("discord_server_id")))) + { + utility::string_t refVal_setDiscordServerId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("discord_server_id"))), refVal_setDiscordServerId ); + setDiscordServerId(refVal_setDiscordServerId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("youtube_video_url")))) + { + utility::string_t refVal_setYoutubeVideoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("youtube_video_url"))), refVal_setYoutubeVideoUrl ); + setYoutubeVideoUrl(refVal_setYoutubeVideoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("tags")))) + { + utility::string_t refVal_setTags; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_setTags ); + setTags(refVal_setTags); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("comment_count")))) + { + int32_t refVal_setCommentCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("comment_count"))), refVal_setCommentCount ); + setCommentCount(refVal_setCommentCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("server_count")))) + { + int32_t refVal_setServerCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("server_count"))), refVal_setServerCount ); + setServerCount(refVal_setServerCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t GameServerCluster::getId() const +{ + return m_Id; +} + + +void GameServerCluster::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool GameServerCluster::idIsSet() const +{ + return m_IdIsSet; +} + +void GameServerCluster::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t GameServerCluster::getName() const +{ + return m_Name; +} + + +void GameServerCluster::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool GameServerCluster::nameIsSet() const +{ + return m_NameIsSet; +} + +void GameServerCluster::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t GameServerCluster::getDescription() const +{ + return m_Description; +} + + +void GameServerCluster::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool GameServerCluster::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void GameServerCluster::unsetDescription() +{ + m_DescriptionIsSet = false; +} +utility::string_t GameServerCluster::getGameId() const +{ + return m_Game_id; +} + + +void GameServerCluster::setGameId(const utility::string_t& value) +{ + m_Game_id = value; + m_Game_idIsSet = true; +} + +bool GameServerCluster::gameIdIsSet() const +{ + return m_Game_idIsSet; +} + +void GameServerCluster::unsetGame_id() +{ + m_Game_idIsSet = false; +} +utility::string_t GameServerCluster::getWebsiteUrl() const +{ + return m_Website_url; +} + + +void GameServerCluster::setWebsiteUrl(const utility::string_t& value) +{ + m_Website_url = value; + m_Website_urlIsSet = true; +} + +bool GameServerCluster::websiteUrlIsSet() const +{ + return m_Website_urlIsSet; +} + +void GameServerCluster::unsetWebsite_url() +{ + m_Website_urlIsSet = false; +} +utility::string_t GameServerCluster::getBannerUrl() const +{ + return m_Banner_url; +} + + +void GameServerCluster::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool GameServerCluster::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void GameServerCluster::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +utility::string_t GameServerCluster::getOwnerId() const +{ + return m_Owner_id; +} + + +void GameServerCluster::setOwnerId(const utility::string_t& value) +{ + m_Owner_id = value; + m_Owner_idIsSet = true; +} + +bool GameServerCluster::ownerIdIsSet() const +{ + return m_Owner_idIsSet; +} + +void GameServerCluster::unsetOwner_id() +{ + m_Owner_idIsSet = false; +} +utility::string_t GameServerCluster::getDiscordServerId() const +{ + return m_Discord_server_id; +} + + +void GameServerCluster::setDiscordServerId(const utility::string_t& value) +{ + m_Discord_server_id = value; + m_Discord_server_idIsSet = true; +} + +bool GameServerCluster::discordServerIdIsSet() const +{ + return m_Discord_server_idIsSet; +} + +void GameServerCluster::unsetDiscord_server_id() +{ + m_Discord_server_idIsSet = false; +} +utility::string_t GameServerCluster::getYoutubeVideoUrl() const +{ + return m_Youtube_video_url; +} + + +void GameServerCluster::setYoutubeVideoUrl(const utility::string_t& value) +{ + m_Youtube_video_url = value; + m_Youtube_video_urlIsSet = true; +} + +bool GameServerCluster::youtubeVideoUrlIsSet() const +{ + return m_Youtube_video_urlIsSet; +} + +void GameServerCluster::unsetYoutube_video_url() +{ + m_Youtube_video_urlIsSet = false; +} +utility::string_t GameServerCluster::getTags() const +{ + return m_Tags; +} + + +void GameServerCluster::setTags(const utility::string_t& value) +{ + m_Tags = value; + m_TagsIsSet = true; +} + +bool GameServerCluster::tagsIsSet() const +{ + return m_TagsIsSet; +} + +void GameServerCluster::unsetTags() +{ + m_TagsIsSet = false; +} +int32_t GameServerCluster::getCommentCount() const +{ + return m_Comment_count; +} + +void GameServerCluster::setCommentCount(int32_t value) +{ + m_Comment_count = value; + m_Comment_countIsSet = true; +} + +bool GameServerCluster::commentCountIsSet() const +{ + return m_Comment_countIsSet; +} + +void GameServerCluster::unsetComment_count() +{ + m_Comment_countIsSet = false; +} +int32_t GameServerCluster::getServerCount() const +{ + return m_Server_count; +} + +void GameServerCluster::setServerCount(int32_t value) +{ + m_Server_count = value; + m_Server_countIsSet = true; +} + +bool GameServerCluster::serverCountIsSet() const +{ + return m_Server_countIsSet; +} + +void GameServerCluster::unsetServer_count() +{ + m_Server_countIsSet = false; +} +utility::datetime GameServerCluster::getCreated() const +{ + return m_Created; +} + + +void GameServerCluster::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool GameServerCluster::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void GameServerCluster::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime GameServerCluster::getUpdated() const +{ + return m_Updated; +} + + +void GameServerCluster::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool GameServerCluster::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void GameServerCluster::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/GrantType.cpp b/src/model/GrantType.cpp new file mode 100644 index 00000000..9e491f23 --- /dev/null +++ b/src/model/GrantType.cpp @@ -0,0 +1,126 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/GrantType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +GrantType::eGrantType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("authorization_code"))) + return GrantType::eGrantType::GrantType_AUTHORIZATION_CODE; + if (val == utility::conversions::to_string_t(U("client_credentials"))) + return GrantType::eGrantType::GrantType_CLIENT_CREDENTIALS; + if (val == utility::conversions::to_string_t(U("password"))) + return GrantType::eGrantType::GrantType_PASSWORD; + if (val == utility::conversions::to_string_t(U("refresh_token"))) + return GrantType::eGrantType::GrantType_REFRESH_TOKEN; + return {}; +} + +EnumUnderlyingType fromEnum(GrantType::eGrantType e) +{ + switch (e) + { + case GrantType::eGrantType::GrantType_AUTHORIZATION_CODE: + return U("authorization_code"); + case GrantType::eGrantType::GrantType_CLIENT_CREDENTIALS: + return U("client_credentials"); + case GrantType::eGrantType::GrantType_PASSWORD: + return U("password"); + case GrantType::eGrantType::GrantType_REFRESH_TOKEN: + return U("refresh_token"); + default: + break; + } + return {}; +} +} + +GrantType::GrantType() +{ +} + +GrantType::~GrantType() +{ +} + +void GrantType::validate() +{ + // TODO: implement validation +} + +web::json::value GrantType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool GrantType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void GrantType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool GrantType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +GrantType::eGrantType GrantType::getValue() const +{ + return m_value; +} + +void GrantType::setValue(GrantType::eGrantType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/Group.cpp b/src/model/Group.cpp new file mode 100644 index 00000000..f7ab4e32 --- /dev/null +++ b/src/model/Group.cpp @@ -0,0 +1,850 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Group.h" + +namespace tribufu { +namespace models { + +Group::Group() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Uuid = utility::conversions::to_string_t(""); + m_UuidIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Tag = utility::conversions::to_string_t(""); + m_TagIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_Type = 0; + m_TypeIsSet = false; + m_Privacy = 0; + m_PrivacyIsSet = false; + m_Owner_id = utility::conversions::to_string_t(""); + m_Owner_idIsSet = false; + m_Verified = false; + m_VerifiedIsSet = false; + m_Photo_url = utility::conversions::to_string_t(""); + m_Photo_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Member_count = 0; + m_Member_countIsSet = false; + m_Follower_count = 0; + m_Follower_countIsSet = false; + m_View_count = 0; + m_View_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Group::~Group() +{ +} + +void Group::validate() +{ + // TODO: implement validation +} + +web::json::value Group::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_UuidIsSet) + { + + val[utility::conversions::to_string_t(U("uuid"))] = ModelBase::toJson(m_Uuid); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_TagIsSet) + { + + val[utility::conversions::to_string_t(U("tag"))] = ModelBase::toJson(m_Tag); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_TypeIsSet) + { + + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); + } + if(m_PrivacyIsSet) + { + + val[utility::conversions::to_string_t(U("privacy"))] = ModelBase::toJson(m_Privacy); + } + if(m_Owner_idIsSet) + { + + val[utility::conversions::to_string_t(U("owner_id"))] = ModelBase::toJson(m_Owner_id); + } + if(m_VerifiedIsSet) + { + + val[utility::conversions::to_string_t(U("verified"))] = ModelBase::toJson(m_Verified); + } + if(m_Photo_urlIsSet) + { + + val[utility::conversions::to_string_t(U("photo_url"))] = ModelBase::toJson(m_Photo_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Member_countIsSet) + { + + val[utility::conversions::to_string_t(U("member_count"))] = ModelBase::toJson(m_Member_count); + } + if(m_Follower_countIsSet) + { + + val[utility::conversions::to_string_t(U("follower_count"))] = ModelBase::toJson(m_Follower_count); + } + if(m_View_countIsSet) + { + + val[utility::conversions::to_string_t(U("view_count"))] = ModelBase::toJson(m_View_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Group::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("uuid")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); + setUuid(refVal_setUuid); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("tag")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tag"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTag; + ok &= ModelBase::fromJson(fieldValue, refVal_setTag); + setTag(refVal_setTag); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setType; + ok &= ModelBase::fromJson(fieldValue, refVal_setType); + setType(refVal_setType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("privacy")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("privacy"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPrivacy; + ok &= ModelBase::fromJson(fieldValue, refVal_setPrivacy); + setPrivacy(refVal_setPrivacy); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("owner_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("owner_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setOwnerId; + ok &= ModelBase::fromJson(fieldValue, refVal_setOwnerId); + setOwnerId(refVal_setOwnerId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("verified")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("verified"))); + if(!fieldValue.is_null()) + { + bool refVal_setVerified; + ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); + setVerified(refVal_setVerified); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("photo_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photo_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); + setPhotoUrl(refVal_setPhotoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("member_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("member_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setMemberCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setMemberCount); + setMemberCount(refVal_setMemberCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("follower_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("follower_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setFollowerCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setFollowerCount); + setFollowerCount(refVal_setFollowerCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("view_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("view_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setViewCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setViewCount); + setViewCount(refVal_setViewCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Group::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_UuidIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uuid")), m_Uuid)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_TagIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tag")), m_Tag)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_TypeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + } + if(m_PrivacyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("privacy")), m_Privacy)); + } + if(m_Owner_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("owner_id")), m_Owner_id)); + } + if(m_VerifiedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("verified")), m_Verified)); + } + if(m_Photo_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photo_url")), m_Photo_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Member_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("member_count")), m_Member_count)); + } + if(m_Follower_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("follower_count")), m_Follower_count)); + } + if(m_View_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("view_count")), m_View_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Group::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("uuid")))) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uuid"))), refVal_setUuid ); + setUuid(refVal_setUuid); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("tag")))) + { + utility::string_t refVal_setTag; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tag"))), refVal_setTag ); + setTag(refVal_setTag); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) + { + int32_t refVal_setType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); + setType(refVal_setType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("privacy")))) + { + int32_t refVal_setPrivacy; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("privacy"))), refVal_setPrivacy ); + setPrivacy(refVal_setPrivacy); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("owner_id")))) + { + utility::string_t refVal_setOwnerId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("owner_id"))), refVal_setOwnerId ); + setOwnerId(refVal_setOwnerId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("verified")))) + { + bool refVal_setVerified; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("verified"))), refVal_setVerified ); + setVerified(refVal_setVerified); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("photo_url")))) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photo_url"))), refVal_setPhotoUrl ); + setPhotoUrl(refVal_setPhotoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("member_count")))) + { + int32_t refVal_setMemberCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("member_count"))), refVal_setMemberCount ); + setMemberCount(refVal_setMemberCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("follower_count")))) + { + int32_t refVal_setFollowerCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("follower_count"))), refVal_setFollowerCount ); + setFollowerCount(refVal_setFollowerCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("view_count")))) + { + int32_t refVal_setViewCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("view_count"))), refVal_setViewCount ); + setViewCount(refVal_setViewCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t Group::getId() const +{ + return m_Id; +} + + +void Group::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Group::idIsSet() const +{ + return m_IdIsSet; +} + +void Group::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Group::getUuid() const +{ + return m_Uuid; +} + + +void Group::setUuid(const utility::string_t& value) +{ + m_Uuid = value; + m_UuidIsSet = true; +} + +bool Group::uuidIsSet() const +{ + return m_UuidIsSet; +} + +void Group::unsetUuid() +{ + m_UuidIsSet = false; +} +utility::string_t Group::getName() const +{ + return m_Name; +} + + +void Group::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Group::nameIsSet() const +{ + return m_NameIsSet; +} + +void Group::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t Group::getTag() const +{ + return m_Tag; +} + + +void Group::setTag(const utility::string_t& value) +{ + m_Tag = value; + m_TagIsSet = true; +} + +bool Group::tagIsSet() const +{ + return m_TagIsSet; +} + +void Group::unsetTag() +{ + m_TagIsSet = false; +} +utility::string_t Group::getDescription() const +{ + return m_Description; +} + + +void Group::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool Group::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void Group::unsetDescription() +{ + m_DescriptionIsSet = false; +} +int32_t Group::getType() const +{ + return m_Type; +} + +void Group::setType(int32_t value) +{ + m_Type = value; + m_TypeIsSet = true; +} + +bool Group::typeIsSet() const +{ + return m_TypeIsSet; +} + +void Group::unsetType() +{ + m_TypeIsSet = false; +} +int32_t Group::getPrivacy() const +{ + return m_Privacy; +} + +void Group::setPrivacy(int32_t value) +{ + m_Privacy = value; + m_PrivacyIsSet = true; +} + +bool Group::privacyIsSet() const +{ + return m_PrivacyIsSet; +} + +void Group::unsetPrivacy() +{ + m_PrivacyIsSet = false; +} +utility::string_t Group::getOwnerId() const +{ + return m_Owner_id; +} + + +void Group::setOwnerId(const utility::string_t& value) +{ + m_Owner_id = value; + m_Owner_idIsSet = true; +} + +bool Group::ownerIdIsSet() const +{ + return m_Owner_idIsSet; +} + +void Group::unsetOwner_id() +{ + m_Owner_idIsSet = false; +} +bool Group::isVerified() const +{ + return m_Verified; +} + +void Group::setVerified(bool value) +{ + m_Verified = value; + m_VerifiedIsSet = true; +} + +bool Group::verifiedIsSet() const +{ + return m_VerifiedIsSet; +} + +void Group::unsetVerified() +{ + m_VerifiedIsSet = false; +} +utility::string_t Group::getPhotoUrl() const +{ + return m_Photo_url; +} + + +void Group::setPhotoUrl(const utility::string_t& value) +{ + m_Photo_url = value; + m_Photo_urlIsSet = true; +} + +bool Group::photoUrlIsSet() const +{ + return m_Photo_urlIsSet; +} + +void Group::unsetPhoto_url() +{ + m_Photo_urlIsSet = false; +} +utility::string_t Group::getBannerUrl() const +{ + return m_Banner_url; +} + + +void Group::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool Group::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void Group::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +int32_t Group::getMemberCount() const +{ + return m_Member_count; +} + +void Group::setMemberCount(int32_t value) +{ + m_Member_count = value; + m_Member_countIsSet = true; +} + +bool Group::memberCountIsSet() const +{ + return m_Member_countIsSet; +} + +void Group::unsetMember_count() +{ + m_Member_countIsSet = false; +} +int32_t Group::getFollowerCount() const +{ + return m_Follower_count; +} + +void Group::setFollowerCount(int32_t value) +{ + m_Follower_count = value; + m_Follower_countIsSet = true; +} + +bool Group::followerCountIsSet() const +{ + return m_Follower_countIsSet; +} + +void Group::unsetFollower_count() +{ + m_Follower_countIsSet = false; +} +int32_t Group::getViewCount() const +{ + return m_View_count; +} + +void Group::setViewCount(int32_t value) +{ + m_View_count = value; + m_View_countIsSet = true; +} + +bool Group::viewCountIsSet() const +{ + return m_View_countIsSet; +} + +void Group::unsetView_count() +{ + m_View_countIsSet = false; +} +utility::datetime Group::getCreated() const +{ + return m_Created; +} + + +void Group::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Group::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Group::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Group::getUpdated() const +{ + return m_Updated; +} + + +void Group::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Group::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Group::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/GroupGame.cpp b/src/model/GroupGame.cpp new file mode 100644 index 00000000..e615d1b6 --- /dev/null +++ b/src/model/GroupGame.cpp @@ -0,0 +1,412 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/GroupGame.h" + +namespace tribufu { +namespace models { + +GroupGame::GroupGame() +{ + m_Group_id = utility::conversions::to_string_t(""); + m_Group_idIsSet = false; + m_GroupIsSet = false; + m_Application_id = utility::conversions::to_string_t(""); + m_Application_idIsSet = false; + m_ApplicationIsSet = false; + m_StatsIsSet = false; + m_Acquired = utility::datetime(); + m_AcquiredIsSet = false; + m_Last_used = utility::datetime(); + m_Last_usedIsSet = false; +} + +GroupGame::~GroupGame() +{ +} + +void GroupGame::validate() +{ + // TODO: implement validation +} + +web::json::value GroupGame::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Group_idIsSet) + { + + val[utility::conversions::to_string_t(U("group_id"))] = ModelBase::toJson(m_Group_id); + } + if(m_GroupIsSet) + { + + val[utility::conversions::to_string_t(U("group"))] = ModelBase::toJson(m_Group); + } + if(m_Application_idIsSet) + { + + val[utility::conversions::to_string_t(U("application_id"))] = ModelBase::toJson(m_Application_id); + } + if(m_ApplicationIsSet) + { + + val[utility::conversions::to_string_t(U("application"))] = ModelBase::toJson(m_Application); + } + if(m_StatsIsSet) + { + + val[utility::conversions::to_string_t(U("stats"))] = ModelBase::toJson(m_Stats); + } + if(m_AcquiredIsSet) + { + + val[utility::conversions::to_string_t(U("acquired"))] = ModelBase::toJson(m_Acquired); + } + if(m_Last_usedIsSet) + { + + val[utility::conversions::to_string_t(U("last_used"))] = ModelBase::toJson(m_Last_used); + } + + return val; +} + +bool GroupGame::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("group_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("group_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setGroupId; + ok &= ModelBase::fromJson(fieldValue, refVal_setGroupId); + setGroupId(refVal_setGroupId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("group")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("group"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setGroup; + ok &= ModelBase::fromJson(fieldValue, refVal_setGroup); + setGroup(refVal_setGroup); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("application_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("application_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setApplicationId; + ok &= ModelBase::fromJson(fieldValue, refVal_setApplicationId); + setApplicationId(refVal_setApplicationId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("application")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("application"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setApplication; + ok &= ModelBase::fromJson(fieldValue, refVal_setApplication); + setApplication(refVal_setApplication); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("stats")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("stats"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setStats; + ok &= ModelBase::fromJson(fieldValue, refVal_setStats); + setStats(refVal_setStats); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("acquired")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("acquired"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setAcquired; + ok &= ModelBase::fromJson(fieldValue, refVal_setAcquired); + setAcquired(refVal_setAcquired); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_used")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_used"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastUsed; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastUsed); + setLastUsed(refVal_setLastUsed); + + } + } + return ok; +} + +void GroupGame::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Group_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("group_id")), m_Group_id)); + } + if(m_GroupIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("group")), m_Group)); + } + if(m_Application_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("application_id")), m_Application_id)); + } + if(m_ApplicationIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("application")), m_Application)); + } + if(m_StatsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("stats")), m_Stats)); + } + if(m_AcquiredIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("acquired")), m_Acquired)); + } + if(m_Last_usedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_used")), m_Last_used)); + } +} + +bool GroupGame::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("group_id")))) + { + utility::string_t refVal_setGroupId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("group_id"))), refVal_setGroupId ); + setGroupId(refVal_setGroupId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("group")))) + { + std::shared_ptr refVal_setGroup; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("group"))), refVal_setGroup ); + setGroup(refVal_setGroup); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("application_id")))) + { + utility::string_t refVal_setApplicationId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("application_id"))), refVal_setApplicationId ); + setApplicationId(refVal_setApplicationId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("application")))) + { + std::shared_ptr refVal_setApplication; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("application"))), refVal_setApplication ); + setApplication(refVal_setApplication); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("stats")))) + { + std::shared_ptr refVal_setStats; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("stats"))), refVal_setStats ); + setStats(refVal_setStats); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("acquired")))) + { + utility::datetime refVal_setAcquired; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("acquired"))), refVal_setAcquired ); + setAcquired(refVal_setAcquired); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_used")))) + { + utility::datetime refVal_setLastUsed; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_used"))), refVal_setLastUsed ); + setLastUsed(refVal_setLastUsed); + } + return ok; +} + + +utility::string_t GroupGame::getGroupId() const +{ + return m_Group_id; +} + + +void GroupGame::setGroupId(const utility::string_t& value) +{ + m_Group_id = value; + m_Group_idIsSet = true; +} + +bool GroupGame::groupIdIsSet() const +{ + return m_Group_idIsSet; +} + +void GroupGame::unsetGroup_id() +{ + m_Group_idIsSet = false; +} +std::shared_ptr GroupGame::getGroup() const +{ + return m_Group; +} + + +void GroupGame::setGroup(const std::shared_ptr& value) +{ + m_Group = value; + m_GroupIsSet = true; +} + +bool GroupGame::groupIsSet() const +{ + return m_GroupIsSet; +} + +void GroupGame::unsetGroup() +{ + m_GroupIsSet = false; +} +utility::string_t GroupGame::getApplicationId() const +{ + return m_Application_id; +} + + +void GroupGame::setApplicationId(const utility::string_t& value) +{ + m_Application_id = value; + m_Application_idIsSet = true; +} + +bool GroupGame::applicationIdIsSet() const +{ + return m_Application_idIsSet; +} + +void GroupGame::unsetApplication_id() +{ + m_Application_idIsSet = false; +} +std::shared_ptr GroupGame::getApplication() const +{ + return m_Application; +} + + +void GroupGame::setApplication(const std::shared_ptr& value) +{ + m_Application = value; + m_ApplicationIsSet = true; +} + +bool GroupGame::applicationIsSet() const +{ + return m_ApplicationIsSet; +} + +void GroupGame::unsetApplication() +{ + m_ApplicationIsSet = false; +} +std::shared_ptr GroupGame::getStats() const +{ + return m_Stats; +} + + +void GroupGame::setStats(const std::shared_ptr& value) +{ + m_Stats = value; + m_StatsIsSet = true; +} + +bool GroupGame::statsIsSet() const +{ + return m_StatsIsSet; +} + +void GroupGame::unsetStats() +{ + m_StatsIsSet = false; +} +utility::datetime GroupGame::getAcquired() const +{ + return m_Acquired; +} + + +void GroupGame::setAcquired(const utility::datetime& value) +{ + m_Acquired = value; + m_AcquiredIsSet = true; +} + +bool GroupGame::acquiredIsSet() const +{ + return m_AcquiredIsSet; +} + +void GroupGame::unsetAcquired() +{ + m_AcquiredIsSet = false; +} +utility::datetime GroupGame::getLastUsed() const +{ + return m_Last_used; +} + + +void GroupGame::setLastUsed(const utility::datetime& value) +{ + m_Last_used = value; + m_Last_usedIsSet = true; +} + +bool GroupGame::lastUsedIsSet() const +{ + return m_Last_usedIsSet; +} + +void GroupGame::unsetLast_used() +{ + m_Last_usedIsSet = false; +} + +} +} + + diff --git a/src/model/GroupMember.cpp b/src/model/GroupMember.cpp new file mode 100644 index 00000000..0b3ad3fb --- /dev/null +++ b/src/model/GroupMember.cpp @@ -0,0 +1,511 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/GroupMember.h" + +namespace tribufu { +namespace models { + +GroupMember::GroupMember() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Uuid = utility::conversions::to_string_t(""); + m_UuidIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Display_name = utility::conversions::to_string_t(""); + m_Display_nameIsSet = false; + m_Verified = false; + m_VerifiedIsSet = false; + m_Photo_url = utility::conversions::to_string_t(""); + m_Photo_urlIsSet = false; + m_Last_online = utility::datetime(); + m_Last_onlineIsSet = false; + m_RankIsSet = false; + m_Since = utility::datetime(); + m_SinceIsSet = false; +} + +GroupMember::~GroupMember() +{ +} + +void GroupMember::validate() +{ + // TODO: implement validation +} + +web::json::value GroupMember::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_UuidIsSet) + { + + val[utility::conversions::to_string_t(U("uuid"))] = ModelBase::toJson(m_Uuid); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_Display_nameIsSet) + { + + val[utility::conversions::to_string_t(U("display_name"))] = ModelBase::toJson(m_Display_name); + } + if(m_VerifiedIsSet) + { + + val[utility::conversions::to_string_t(U("verified"))] = ModelBase::toJson(m_Verified); + } + if(m_Photo_urlIsSet) + { + + val[utility::conversions::to_string_t(U("photo_url"))] = ModelBase::toJson(m_Photo_url); + } + if(m_Last_onlineIsSet) + { + + val[utility::conversions::to_string_t(U("last_online"))] = ModelBase::toJson(m_Last_online); + } + if(m_RankIsSet) + { + + val[utility::conversions::to_string_t(U("rank"))] = ModelBase::toJson(m_Rank); + } + if(m_SinceIsSet) + { + + val[utility::conversions::to_string_t(U("since"))] = ModelBase::toJson(m_Since); + } + + return val; +} + +bool GroupMember::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("uuid")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); + setUuid(refVal_setUuid); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("display_name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("display_name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); + setDisplayName(refVal_setDisplayName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("verified")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("verified"))); + if(!fieldValue.is_null()) + { + bool refVal_setVerified; + ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); + setVerified(refVal_setVerified); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("photo_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photo_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); + setPhotoUrl(refVal_setPhotoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_online")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_online"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); + setLastOnline(refVal_setLastOnline); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("rank")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("rank"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setRank; + ok &= ModelBase::fromJson(fieldValue, refVal_setRank); + setRank(refVal_setRank); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("since")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("since"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setSince; + ok &= ModelBase::fromJson(fieldValue, refVal_setSince); + setSince(refVal_setSince); + + } + } + return ok; +} + +void GroupMember::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_UuidIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uuid")), m_Uuid)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_Display_nameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("display_name")), m_Display_name)); + } + if(m_VerifiedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("verified")), m_Verified)); + } + if(m_Photo_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photo_url")), m_Photo_url)); + } + if(m_Last_onlineIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_online")), m_Last_online)); + } + if(m_RankIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("rank")), m_Rank)); + } + if(m_SinceIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("since")), m_Since)); + } +} + +bool GroupMember::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("uuid")))) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uuid"))), refVal_setUuid ); + setUuid(refVal_setUuid); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("display_name")))) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("display_name"))), refVal_setDisplayName ); + setDisplayName(refVal_setDisplayName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("verified")))) + { + bool refVal_setVerified; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("verified"))), refVal_setVerified ); + setVerified(refVal_setVerified); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("photo_url")))) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photo_url"))), refVal_setPhotoUrl ); + setPhotoUrl(refVal_setPhotoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_online")))) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_online"))), refVal_setLastOnline ); + setLastOnline(refVal_setLastOnline); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("rank")))) + { + std::shared_ptr refVal_setRank; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("rank"))), refVal_setRank ); + setRank(refVal_setRank); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("since")))) + { + utility::datetime refVal_setSince; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("since"))), refVal_setSince ); + setSince(refVal_setSince); + } + return ok; +} + + +utility::string_t GroupMember::getId() const +{ + return m_Id; +} + + +void GroupMember::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool GroupMember::idIsSet() const +{ + return m_IdIsSet; +} + +void GroupMember::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t GroupMember::getUuid() const +{ + return m_Uuid; +} + + +void GroupMember::setUuid(const utility::string_t& value) +{ + m_Uuid = value; + m_UuidIsSet = true; +} + +bool GroupMember::uuidIsSet() const +{ + return m_UuidIsSet; +} + +void GroupMember::unsetUuid() +{ + m_UuidIsSet = false; +} +utility::string_t GroupMember::getName() const +{ + return m_Name; +} + + +void GroupMember::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool GroupMember::nameIsSet() const +{ + return m_NameIsSet; +} + +void GroupMember::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t GroupMember::getDisplayName() const +{ + return m_Display_name; +} + + +void GroupMember::setDisplayName(const utility::string_t& value) +{ + m_Display_name = value; + m_Display_nameIsSet = true; +} + +bool GroupMember::displayNameIsSet() const +{ + return m_Display_nameIsSet; +} + +void GroupMember::unsetDisplay_name() +{ + m_Display_nameIsSet = false; +} +bool GroupMember::isVerified() const +{ + return m_Verified; +} + +void GroupMember::setVerified(bool value) +{ + m_Verified = value; + m_VerifiedIsSet = true; +} + +bool GroupMember::verifiedIsSet() const +{ + return m_VerifiedIsSet; +} + +void GroupMember::unsetVerified() +{ + m_VerifiedIsSet = false; +} +utility::string_t GroupMember::getPhotoUrl() const +{ + return m_Photo_url; +} + + +void GroupMember::setPhotoUrl(const utility::string_t& value) +{ + m_Photo_url = value; + m_Photo_urlIsSet = true; +} + +bool GroupMember::photoUrlIsSet() const +{ + return m_Photo_urlIsSet; +} + +void GroupMember::unsetPhoto_url() +{ + m_Photo_urlIsSet = false; +} +utility::datetime GroupMember::getLastOnline() const +{ + return m_Last_online; +} + + +void GroupMember::setLastOnline(const utility::datetime& value) +{ + m_Last_online = value; + m_Last_onlineIsSet = true; +} + +bool GroupMember::lastOnlineIsSet() const +{ + return m_Last_onlineIsSet; +} + +void GroupMember::unsetLast_online() +{ + m_Last_onlineIsSet = false; +} +std::shared_ptr GroupMember::getRank() const +{ + return m_Rank; +} + + +void GroupMember::setRank(const std::shared_ptr& value) +{ + m_Rank = value; + m_RankIsSet = true; +} + +bool GroupMember::rankIsSet() const +{ + return m_RankIsSet; +} + +void GroupMember::unsetRank() +{ + m_RankIsSet = false; +} +utility::datetime GroupMember::getSince() const +{ + return m_Since; +} + + +void GroupMember::setSince(const utility::datetime& value) +{ + m_Since = value; + m_SinceIsSet = true; +} + +bool GroupMember::sinceIsSet() const +{ + return m_SinceIsSet; +} + +void GroupMember::unsetSince() +{ + m_SinceIsSet = false; +} + +} +} + + diff --git a/src/model/GroupRank.cpp b/src/model/GroupRank.cpp new file mode 100644 index 00000000..1c27194c --- /dev/null +++ b/src/model/GroupRank.cpp @@ -0,0 +1,122 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/GroupRank.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +GroupRank::eGroupRank toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("member"))) + return GroupRank::eGroupRank::GroupRank_MEMBER; + if (val == utility::conversions::to_string_t(U("leader"))) + return GroupRank::eGroupRank::GroupRank_LEADER; + if (val == utility::conversions::to_string_t(U("owner"))) + return GroupRank::eGroupRank::GroupRank_OWNER; + return {}; +} + +EnumUnderlyingType fromEnum(GroupRank::eGroupRank e) +{ + switch (e) + { + case GroupRank::eGroupRank::GroupRank_MEMBER: + return U("member"); + case GroupRank::eGroupRank::GroupRank_LEADER: + return U("leader"); + case GroupRank::eGroupRank::GroupRank_OWNER: + return U("owner"); + default: + break; + } + return {}; +} +} + +GroupRank::GroupRank() +{ +} + +GroupRank::~GroupRank() +{ +} + +void GroupRank::validate() +{ + // TODO: implement validation +} + +web::json::value GroupRank::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool GroupRank::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void GroupRank::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool GroupRank::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +GroupRank::eGroupRank GroupRank::getValue() const +{ + return m_value; +} + +void GroupRank::setValue(GroupRank::eGroupRank const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/HashViewModel.cpp b/src/model/HashViewModel.cpp new file mode 100644 index 00000000..59fb06eb --- /dev/null +++ b/src/model/HashViewModel.cpp @@ -0,0 +1,121 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/HashViewModel.h" + +namespace tribufu { +namespace models { + +HashViewModel::HashViewModel() +{ + m_Value = utility::conversions::to_string_t(""); + m_ValueIsSet = false; +} + +HashViewModel::~HashViewModel() +{ +} + +void HashViewModel::validate() +{ + // TODO: implement validation +} + +web::json::value HashViewModel::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_ValueIsSet) + { + + val[utility::conversions::to_string_t(U("value"))] = ModelBase::toJson(m_Value); + } + + return val; +} + +bool HashViewModel::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("value")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("value"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setValue; + ok &= ModelBase::fromJson(fieldValue, refVal_setValue); + setValue(refVal_setValue); + + } + } + return ok; +} + +void HashViewModel::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_ValueIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("value")), m_Value)); + } +} + +bool HashViewModel::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("value")))) + { + utility::string_t refVal_setValue; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("value"))), refVal_setValue ); + setValue(refVal_setValue); + } + return ok; +} + + +utility::string_t HashViewModel::getValue() const +{ + return m_Value; +} + + +void HashViewModel::setValue(const utility::string_t& value) +{ + m_Value = value; + m_ValueIsSet = true; +} + +bool HashViewModel::valueIsSet() const +{ + return m_ValueIsSet; +} + +void HashViewModel::unsetValue() +{ + m_ValueIsSet = false; +} + +} +} + + diff --git a/src/model/IntrospectRequest.cpp b/src/model/IntrospectRequest.cpp new file mode 100644 index 00000000..033ce656 --- /dev/null +++ b/src/model/IntrospectRequest.cpp @@ -0,0 +1,169 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/IntrospectRequest.h" + +namespace tribufu { +namespace models { + +IntrospectRequest::IntrospectRequest() +{ + m_Token = utility::conversions::to_string_t(""); + m_TokenIsSet = false; + m_Token_type_hintIsSet = false; +} + +IntrospectRequest::~IntrospectRequest() +{ +} + +void IntrospectRequest::validate() +{ + // TODO: implement validation +} + +web::json::value IntrospectRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_TokenIsSet) + { + + val[utility::conversions::to_string_t(U("token"))] = ModelBase::toJson(m_Token); + } + if(m_Token_type_hintIsSet) + { + + val[utility::conversions::to_string_t(U("token_type_hint"))] = ModelBase::toJson(m_Token_type_hint); + } + + return val; +} + +bool IntrospectRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setToken); + setToken(refVal_setToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("token_type_hint")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token_type_hint"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setTokenTypeHint; + ok &= ModelBase::fromJson(fieldValue, refVal_setTokenTypeHint); + setTokenTypeHint(refVal_setTokenTypeHint); + + } + } + return ok; +} + +void IntrospectRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_TokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("token")), m_Token)); + } + if(m_Token_type_hintIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("token_type_hint")), m_Token_type_hint)); + } +} + +bool IntrospectRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("token")))) + { + utility::string_t refVal_setToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("token"))), refVal_setToken ); + setToken(refVal_setToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("token_type_hint")))) + { + std::shared_ptr refVal_setTokenTypeHint; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("token_type_hint"))), refVal_setTokenTypeHint ); + setTokenTypeHint(refVal_setTokenTypeHint); + } + return ok; +} + + +utility::string_t IntrospectRequest::getToken() const +{ + return m_Token; +} + + +void IntrospectRequest::setToken(const utility::string_t& value) +{ + m_Token = value; + m_TokenIsSet = true; +} + +bool IntrospectRequest::tokenIsSet() const +{ + return m_TokenIsSet; +} + +void IntrospectRequest::unsetToken() +{ + m_TokenIsSet = false; +} +std::shared_ptr IntrospectRequest::getTokenTypeHint() const +{ + return m_Token_type_hint; +} + + +void IntrospectRequest::setTokenTypeHint(const std::shared_ptr& value) +{ + m_Token_type_hint = value; + m_Token_type_hintIsSet = true; +} + +bool IntrospectRequest::tokenTypeHintIsSet() const +{ + return m_Token_type_hintIsSet; +} + +void IntrospectRequest::unsetToken_type_hint() +{ + m_Token_type_hintIsSet = false; +} + +} +} + + diff --git a/src/model/IpAddress.cpp b/src/model/IpAddress.cpp new file mode 100644 index 00000000..58599dd0 --- /dev/null +++ b/src/model/IpAddress.cpp @@ -0,0 +1,950 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/IpAddress.h" + +namespace tribufu { +namespace models { + +IpAddress::IpAddress() +{ + m_Address = utility::conversions::to_string_t(""); + m_AddressIsSet = false; + m_Version = 0; + m_VersionIsSet = false; + m_Network = utility::conversions::to_string_t(""); + m_NetworkIsSet = false; + m_Reserved = false; + m_ReservedIsSet = false; + m_Asn = utility::conversions::to_string_t(""); + m_AsnIsSet = false; + m_Isp = utility::conversions::to_string_t(""); + m_IspIsSet = false; + m_Continent = utility::conversions::to_string_t(""); + m_ContinentIsSet = false; + m_Country = utility::conversions::to_string_t(""); + m_CountryIsSet = false; + m_Region = utility::conversions::to_string_t(""); + m_RegionIsSet = false; + m_City = utility::conversions::to_string_t(""); + m_CityIsSet = false; + m_Postal_code = utility::conversions::to_string_t(""); + m_Postal_codeIsSet = false; + m_Calling_code = utility::conversions::to_string_t(""); + m_Calling_codeIsSet = false; + m_Tld = utility::conversions::to_string_t(""); + m_TldIsSet = false; + m_Language = utility::conversions::to_string_t(""); + m_LanguageIsSet = false; + m_Timezone = utility::conversions::to_string_t(""); + m_TimezoneIsSet = false; + m_Currency = utility::conversions::to_string_t(""); + m_CurrencyIsSet = false; + m_Latitude = 0.0f; + m_LatitudeIsSet = false; + m_Longitude = 0.0f; + m_LongitudeIsSet = false; +} + +IpAddress::~IpAddress() +{ +} + +void IpAddress::validate() +{ + // TODO: implement validation +} + +web::json::value IpAddress::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_AddressIsSet) + { + + val[utility::conversions::to_string_t(U("address"))] = ModelBase::toJson(m_Address); + } + if(m_VersionIsSet) + { + + val[utility::conversions::to_string_t(U("version"))] = ModelBase::toJson(m_Version); + } + if(m_NetworkIsSet) + { + + val[utility::conversions::to_string_t(U("network"))] = ModelBase::toJson(m_Network); + } + if(m_ReservedIsSet) + { + + val[utility::conversions::to_string_t(U("reserved"))] = ModelBase::toJson(m_Reserved); + } + if(m_AsnIsSet) + { + + val[utility::conversions::to_string_t(U("asn"))] = ModelBase::toJson(m_Asn); + } + if(m_IspIsSet) + { + + val[utility::conversions::to_string_t(U("isp"))] = ModelBase::toJson(m_Isp); + } + if(m_ContinentIsSet) + { + + val[utility::conversions::to_string_t(U("continent"))] = ModelBase::toJson(m_Continent); + } + if(m_CountryIsSet) + { + + val[utility::conversions::to_string_t(U("country"))] = ModelBase::toJson(m_Country); + } + if(m_RegionIsSet) + { + + val[utility::conversions::to_string_t(U("region"))] = ModelBase::toJson(m_Region); + } + if(m_CityIsSet) + { + + val[utility::conversions::to_string_t(U("city"))] = ModelBase::toJson(m_City); + } + if(m_Postal_codeIsSet) + { + + val[utility::conversions::to_string_t(U("postal_code"))] = ModelBase::toJson(m_Postal_code); + } + if(m_Calling_codeIsSet) + { + + val[utility::conversions::to_string_t(U("calling_code"))] = ModelBase::toJson(m_Calling_code); + } + if(m_TldIsSet) + { + + val[utility::conversions::to_string_t(U("tld"))] = ModelBase::toJson(m_Tld); + } + if(m_LanguageIsSet) + { + + val[utility::conversions::to_string_t(U("language"))] = ModelBase::toJson(m_Language); + } + if(m_TimezoneIsSet) + { + + val[utility::conversions::to_string_t(U("timezone"))] = ModelBase::toJson(m_Timezone); + } + if(m_CurrencyIsSet) + { + + val[utility::conversions::to_string_t(U("currency"))] = ModelBase::toJson(m_Currency); + } + if(m_LatitudeIsSet) + { + + val[utility::conversions::to_string_t(U("latitude"))] = ModelBase::toJson(m_Latitude); + } + if(m_LongitudeIsSet) + { + + val[utility::conversions::to_string_t(U("longitude"))] = ModelBase::toJson(m_Longitude); + } + + return val; +} + +bool IpAddress::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("address")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("address"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setAddress; + ok &= ModelBase::fromJson(fieldValue, refVal_setAddress); + setAddress(refVal_setAddress); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("version")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("version"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setVersion; + ok &= ModelBase::fromJson(fieldValue, refVal_setVersion); + setVersion(refVal_setVersion); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("network")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("network"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setNetwork; + ok &= ModelBase::fromJson(fieldValue, refVal_setNetwork); + setNetwork(refVal_setNetwork); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("reserved")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("reserved"))); + if(!fieldValue.is_null()) + { + bool refVal_setReserved; + ok &= ModelBase::fromJson(fieldValue, refVal_setReserved); + setReserved(refVal_setReserved); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("asn")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("asn"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setAsn; + ok &= ModelBase::fromJson(fieldValue, refVal_setAsn); + setAsn(refVal_setAsn); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("isp")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("isp"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setIsp; + ok &= ModelBase::fromJson(fieldValue, refVal_setIsp); + setIsp(refVal_setIsp); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("continent")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("continent"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setContinent; + ok &= ModelBase::fromJson(fieldValue, refVal_setContinent); + setContinent(refVal_setContinent); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("country")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("country"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCountry; + ok &= ModelBase::fromJson(fieldValue, refVal_setCountry); + setCountry(refVal_setCountry); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("region")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("region"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRegion; + ok &= ModelBase::fromJson(fieldValue, refVal_setRegion); + setRegion(refVal_setRegion); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("city")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("city"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCity; + ok &= ModelBase::fromJson(fieldValue, refVal_setCity); + setCity(refVal_setCity); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("postal_code")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("postal_code"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPostalCode; + ok &= ModelBase::fromJson(fieldValue, refVal_setPostalCode); + setPostalCode(refVal_setPostalCode); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("calling_code")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("calling_code"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCallingCode; + ok &= ModelBase::fromJson(fieldValue, refVal_setCallingCode); + setCallingCode(refVal_setCallingCode); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("tld")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tld"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTld; + ok &= ModelBase::fromJson(fieldValue, refVal_setTld); + setTld(refVal_setTld); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("language")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("language"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLanguage; + ok &= ModelBase::fromJson(fieldValue, refVal_setLanguage); + setLanguage(refVal_setLanguage); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("timezone")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("timezone"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTimezone; + ok &= ModelBase::fromJson(fieldValue, refVal_setTimezone); + setTimezone(refVal_setTimezone); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("currency")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("currency"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCurrency; + ok &= ModelBase::fromJson(fieldValue, refVal_setCurrency); + setCurrency(refVal_setCurrency); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("latitude")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("latitude"))); + if(!fieldValue.is_null()) + { + float refVal_setLatitude; + ok &= ModelBase::fromJson(fieldValue, refVal_setLatitude); + setLatitude(refVal_setLatitude); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("longitude")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("longitude"))); + if(!fieldValue.is_null()) + { + float refVal_setLongitude; + ok &= ModelBase::fromJson(fieldValue, refVal_setLongitude); + setLongitude(refVal_setLongitude); + + } + } + return ok; +} + +void IpAddress::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_AddressIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("address")), m_Address)); + } + if(m_VersionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("version")), m_Version)); + } + if(m_NetworkIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("network")), m_Network)); + } + if(m_ReservedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("reserved")), m_Reserved)); + } + if(m_AsnIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("asn")), m_Asn)); + } + if(m_IspIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("isp")), m_Isp)); + } + if(m_ContinentIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("continent")), m_Continent)); + } + if(m_CountryIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("country")), m_Country)); + } + if(m_RegionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("region")), m_Region)); + } + if(m_CityIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("city")), m_City)); + } + if(m_Postal_codeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("postal_code")), m_Postal_code)); + } + if(m_Calling_codeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("calling_code")), m_Calling_code)); + } + if(m_TldIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tld")), m_Tld)); + } + if(m_LanguageIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("language")), m_Language)); + } + if(m_TimezoneIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("timezone")), m_Timezone)); + } + if(m_CurrencyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("currency")), m_Currency)); + } + if(m_LatitudeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("latitude")), m_Latitude)); + } + if(m_LongitudeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("longitude")), m_Longitude)); + } +} + +bool IpAddress::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("address")))) + { + utility::string_t refVal_setAddress; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("address"))), refVal_setAddress ); + setAddress(refVal_setAddress); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("version")))) + { + int32_t refVal_setVersion; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("version"))), refVal_setVersion ); + setVersion(refVal_setVersion); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("network")))) + { + utility::string_t refVal_setNetwork; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("network"))), refVal_setNetwork ); + setNetwork(refVal_setNetwork); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("reserved")))) + { + bool refVal_setReserved; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("reserved"))), refVal_setReserved ); + setReserved(refVal_setReserved); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("asn")))) + { + utility::string_t refVal_setAsn; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("asn"))), refVal_setAsn ); + setAsn(refVal_setAsn); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("isp")))) + { + utility::string_t refVal_setIsp; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("isp"))), refVal_setIsp ); + setIsp(refVal_setIsp); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("continent")))) + { + utility::string_t refVal_setContinent; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("continent"))), refVal_setContinent ); + setContinent(refVal_setContinent); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("country")))) + { + utility::string_t refVal_setCountry; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("country"))), refVal_setCountry ); + setCountry(refVal_setCountry); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("region")))) + { + utility::string_t refVal_setRegion; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("region"))), refVal_setRegion ); + setRegion(refVal_setRegion); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("city")))) + { + utility::string_t refVal_setCity; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("city"))), refVal_setCity ); + setCity(refVal_setCity); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("postal_code")))) + { + utility::string_t refVal_setPostalCode; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("postal_code"))), refVal_setPostalCode ); + setPostalCode(refVal_setPostalCode); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("calling_code")))) + { + utility::string_t refVal_setCallingCode; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("calling_code"))), refVal_setCallingCode ); + setCallingCode(refVal_setCallingCode); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("tld")))) + { + utility::string_t refVal_setTld; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tld"))), refVal_setTld ); + setTld(refVal_setTld); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("language")))) + { + utility::string_t refVal_setLanguage; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("language"))), refVal_setLanguage ); + setLanguage(refVal_setLanguage); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("timezone")))) + { + utility::string_t refVal_setTimezone; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("timezone"))), refVal_setTimezone ); + setTimezone(refVal_setTimezone); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("currency")))) + { + utility::string_t refVal_setCurrency; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("currency"))), refVal_setCurrency ); + setCurrency(refVal_setCurrency); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("latitude")))) + { + float refVal_setLatitude; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("latitude"))), refVal_setLatitude ); + setLatitude(refVal_setLatitude); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("longitude")))) + { + float refVal_setLongitude; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("longitude"))), refVal_setLongitude ); + setLongitude(refVal_setLongitude); + } + return ok; +} + + +utility::string_t IpAddress::getAddress() const +{ + return m_Address; +} + + +void IpAddress::setAddress(const utility::string_t& value) +{ + m_Address = value; + m_AddressIsSet = true; +} + +bool IpAddress::addressIsSet() const +{ + return m_AddressIsSet; +} + +void IpAddress::unsetAddress() +{ + m_AddressIsSet = false; +} +int32_t IpAddress::getVersion() const +{ + return m_Version; +} + +void IpAddress::setVersion(int32_t value) +{ + m_Version = value; + m_VersionIsSet = true; +} + +bool IpAddress::versionIsSet() const +{ + return m_VersionIsSet; +} + +void IpAddress::unsetVersion() +{ + m_VersionIsSet = false; +} +utility::string_t IpAddress::getNetwork() const +{ + return m_Network; +} + + +void IpAddress::setNetwork(const utility::string_t& value) +{ + m_Network = value; + m_NetworkIsSet = true; +} + +bool IpAddress::networkIsSet() const +{ + return m_NetworkIsSet; +} + +void IpAddress::unsetNetwork() +{ + m_NetworkIsSet = false; +} +bool IpAddress::isReserved() const +{ + return m_Reserved; +} + +void IpAddress::setReserved(bool value) +{ + m_Reserved = value; + m_ReservedIsSet = true; +} + +bool IpAddress::reservedIsSet() const +{ + return m_ReservedIsSet; +} + +void IpAddress::unsetReserved() +{ + m_ReservedIsSet = false; +} +utility::string_t IpAddress::getAsn() const +{ + return m_Asn; +} + + +void IpAddress::setAsn(const utility::string_t& value) +{ + m_Asn = value; + m_AsnIsSet = true; +} + +bool IpAddress::asnIsSet() const +{ + return m_AsnIsSet; +} + +void IpAddress::unsetAsn() +{ + m_AsnIsSet = false; +} +utility::string_t IpAddress::getIsp() const +{ + return m_Isp; +} + + +void IpAddress::setIsp(const utility::string_t& value) +{ + m_Isp = value; + m_IspIsSet = true; +} + +bool IpAddress::ispIsSet() const +{ + return m_IspIsSet; +} + +void IpAddress::unsetIsp() +{ + m_IspIsSet = false; +} +utility::string_t IpAddress::getContinent() const +{ + return m_Continent; +} + + +void IpAddress::setContinent(const utility::string_t& value) +{ + m_Continent = value; + m_ContinentIsSet = true; +} + +bool IpAddress::continentIsSet() const +{ + return m_ContinentIsSet; +} + +void IpAddress::unsetContinent() +{ + m_ContinentIsSet = false; +} +utility::string_t IpAddress::getCountry() const +{ + return m_Country; +} + + +void IpAddress::setCountry(const utility::string_t& value) +{ + m_Country = value; + m_CountryIsSet = true; +} + +bool IpAddress::countryIsSet() const +{ + return m_CountryIsSet; +} + +void IpAddress::unsetCountry() +{ + m_CountryIsSet = false; +} +utility::string_t IpAddress::getRegion() const +{ + return m_Region; +} + + +void IpAddress::setRegion(const utility::string_t& value) +{ + m_Region = value; + m_RegionIsSet = true; +} + +bool IpAddress::regionIsSet() const +{ + return m_RegionIsSet; +} + +void IpAddress::unsetRegion() +{ + m_RegionIsSet = false; +} +utility::string_t IpAddress::getCity() const +{ + return m_City; +} + + +void IpAddress::setCity(const utility::string_t& value) +{ + m_City = value; + m_CityIsSet = true; +} + +bool IpAddress::cityIsSet() const +{ + return m_CityIsSet; +} + +void IpAddress::unsetCity() +{ + m_CityIsSet = false; +} +utility::string_t IpAddress::getPostalCode() const +{ + return m_Postal_code; +} + + +void IpAddress::setPostalCode(const utility::string_t& value) +{ + m_Postal_code = value; + m_Postal_codeIsSet = true; +} + +bool IpAddress::postalCodeIsSet() const +{ + return m_Postal_codeIsSet; +} + +void IpAddress::unsetPostal_code() +{ + m_Postal_codeIsSet = false; +} +utility::string_t IpAddress::getCallingCode() const +{ + return m_Calling_code; +} + + +void IpAddress::setCallingCode(const utility::string_t& value) +{ + m_Calling_code = value; + m_Calling_codeIsSet = true; +} + +bool IpAddress::callingCodeIsSet() const +{ + return m_Calling_codeIsSet; +} + +void IpAddress::unsetCalling_code() +{ + m_Calling_codeIsSet = false; +} +utility::string_t IpAddress::getTld() const +{ + return m_Tld; +} + + +void IpAddress::setTld(const utility::string_t& value) +{ + m_Tld = value; + m_TldIsSet = true; +} + +bool IpAddress::tldIsSet() const +{ + return m_TldIsSet; +} + +void IpAddress::unsetTld() +{ + m_TldIsSet = false; +} +utility::string_t IpAddress::getLanguage() const +{ + return m_Language; +} + + +void IpAddress::setLanguage(const utility::string_t& value) +{ + m_Language = value; + m_LanguageIsSet = true; +} + +bool IpAddress::languageIsSet() const +{ + return m_LanguageIsSet; +} + +void IpAddress::unsetLanguage() +{ + m_LanguageIsSet = false; +} +utility::string_t IpAddress::getTimezone() const +{ + return m_Timezone; +} + + +void IpAddress::setTimezone(const utility::string_t& value) +{ + m_Timezone = value; + m_TimezoneIsSet = true; +} + +bool IpAddress::timezoneIsSet() const +{ + return m_TimezoneIsSet; +} + +void IpAddress::unsetTimezone() +{ + m_TimezoneIsSet = false; +} +utility::string_t IpAddress::getCurrency() const +{ + return m_Currency; +} + + +void IpAddress::setCurrency(const utility::string_t& value) +{ + m_Currency = value; + m_CurrencyIsSet = true; +} + +bool IpAddress::currencyIsSet() const +{ + return m_CurrencyIsSet; +} + +void IpAddress::unsetCurrency() +{ + m_CurrencyIsSet = false; +} +float IpAddress::getLatitude() const +{ + return m_Latitude; +} + +void IpAddress::setLatitude(float value) +{ + m_Latitude = value; + m_LatitudeIsSet = true; +} + +bool IpAddress::latitudeIsSet() const +{ + return m_LatitudeIsSet; +} + +void IpAddress::unsetLatitude() +{ + m_LatitudeIsSet = false; +} +float IpAddress::getLongitude() const +{ + return m_Longitude; +} + +void IpAddress::setLongitude(float value) +{ + m_Longitude = value; + m_LongitudeIsSet = true; +} + +bool IpAddress::longitudeIsSet() const +{ + return m_LongitudeIsSet; +} + +void IpAddress::unsetLongitude() +{ + m_LongitudeIsSet = false; +} + +} +} + + diff --git a/src/model/LeaderboardItem.cpp b/src/model/LeaderboardItem.cpp new file mode 100644 index 00000000..db0db953 --- /dev/null +++ b/src/model/LeaderboardItem.cpp @@ -0,0 +1,363 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/LeaderboardItem.h" + +namespace tribufu { +namespace models { + +LeaderboardItem::LeaderboardItem() +{ + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Display_name = utility::conversions::to_string_t(""); + m_Display_nameIsSet = false; + m_Photo_url = utility::conversions::to_string_t(""); + m_Photo_urlIsSet = false; + m_Level = 0; + m_LevelIsSet = false; + m_Experience = 0.0; + m_ExperienceIsSet = false; + m_Points = 0.0; + m_PointsIsSet = false; +} + +LeaderboardItem::~LeaderboardItem() +{ +} + +void LeaderboardItem::validate() +{ + // TODO: implement validation +} + +web::json::value LeaderboardItem::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_Display_nameIsSet) + { + + val[utility::conversions::to_string_t(U("display_name"))] = ModelBase::toJson(m_Display_name); + } + if(m_Photo_urlIsSet) + { + + val[utility::conversions::to_string_t(U("photo_url"))] = ModelBase::toJson(m_Photo_url); + } + if(m_LevelIsSet) + { + + val[utility::conversions::to_string_t(U("level"))] = ModelBase::toJson(m_Level); + } + if(m_ExperienceIsSet) + { + + val[utility::conversions::to_string_t(U("experience"))] = ModelBase::toJson(m_Experience); + } + if(m_PointsIsSet) + { + + val[utility::conversions::to_string_t(U("points"))] = ModelBase::toJson(m_Points); + } + + return val; +} + +bool LeaderboardItem::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("display_name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("display_name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); + setDisplayName(refVal_setDisplayName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("photo_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photo_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); + setPhotoUrl(refVal_setPhotoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("level")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("level"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setLevel; + ok &= ModelBase::fromJson(fieldValue, refVal_setLevel); + setLevel(refVal_setLevel); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("experience")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("experience"))); + if(!fieldValue.is_null()) + { + double refVal_setExperience; + ok &= ModelBase::fromJson(fieldValue, refVal_setExperience); + setExperience(refVal_setExperience); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("points")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("points"))); + if(!fieldValue.is_null()) + { + double refVal_setPoints; + ok &= ModelBase::fromJson(fieldValue, refVal_setPoints); + setPoints(refVal_setPoints); + + } + } + return ok; +} + +void LeaderboardItem::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_Display_nameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("display_name")), m_Display_name)); + } + if(m_Photo_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photo_url")), m_Photo_url)); + } + if(m_LevelIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("level")), m_Level)); + } + if(m_ExperienceIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("experience")), m_Experience)); + } + if(m_PointsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("points")), m_Points)); + } +} + +bool LeaderboardItem::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("display_name")))) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("display_name"))), refVal_setDisplayName ); + setDisplayName(refVal_setDisplayName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("photo_url")))) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photo_url"))), refVal_setPhotoUrl ); + setPhotoUrl(refVal_setPhotoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("level")))) + { + int32_t refVal_setLevel; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("level"))), refVal_setLevel ); + setLevel(refVal_setLevel); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("experience")))) + { + double refVal_setExperience; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("experience"))), refVal_setExperience ); + setExperience(refVal_setExperience); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("points")))) + { + double refVal_setPoints; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("points"))), refVal_setPoints ); + setPoints(refVal_setPoints); + } + return ok; +} + + +utility::string_t LeaderboardItem::getName() const +{ + return m_Name; +} + + +void LeaderboardItem::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool LeaderboardItem::nameIsSet() const +{ + return m_NameIsSet; +} + +void LeaderboardItem::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t LeaderboardItem::getDisplayName() const +{ + return m_Display_name; +} + + +void LeaderboardItem::setDisplayName(const utility::string_t& value) +{ + m_Display_name = value; + m_Display_nameIsSet = true; +} + +bool LeaderboardItem::displayNameIsSet() const +{ + return m_Display_nameIsSet; +} + +void LeaderboardItem::unsetDisplay_name() +{ + m_Display_nameIsSet = false; +} +utility::string_t LeaderboardItem::getPhotoUrl() const +{ + return m_Photo_url; +} + + +void LeaderboardItem::setPhotoUrl(const utility::string_t& value) +{ + m_Photo_url = value; + m_Photo_urlIsSet = true; +} + +bool LeaderboardItem::photoUrlIsSet() const +{ + return m_Photo_urlIsSet; +} + +void LeaderboardItem::unsetPhoto_url() +{ + m_Photo_urlIsSet = false; +} +int32_t LeaderboardItem::getLevel() const +{ + return m_Level; +} + +void LeaderboardItem::setLevel(int32_t value) +{ + m_Level = value; + m_LevelIsSet = true; +} + +bool LeaderboardItem::levelIsSet() const +{ + return m_LevelIsSet; +} + +void LeaderboardItem::unsetLevel() +{ + m_LevelIsSet = false; +} +double LeaderboardItem::getExperience() const +{ + return m_Experience; +} + +void LeaderboardItem::setExperience(double value) +{ + m_Experience = value; + m_ExperienceIsSet = true; +} + +bool LeaderboardItem::experienceIsSet() const +{ + return m_ExperienceIsSet; +} + +void LeaderboardItem::unsetExperience() +{ + m_ExperienceIsSet = false; +} +double LeaderboardItem::getPoints() const +{ + return m_Points; +} + +void LeaderboardItem::setPoints(double value) +{ + m_Points = value; + m_PointsIsSet = true; +} + +bool LeaderboardItem::pointsIsSet() const +{ + return m_PointsIsSet; +} + +void LeaderboardItem::unsetPoints() +{ + m_PointsIsSet = false; +} + +} +} + + diff --git a/src/model/LeaderboardOrder.cpp b/src/model/LeaderboardOrder.cpp new file mode 100644 index 00000000..a485eacf --- /dev/null +++ b/src/model/LeaderboardOrder.cpp @@ -0,0 +1,118 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/LeaderboardOrder.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +LeaderboardOrder::eLeaderboardOrder toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("level"))) + return LeaderboardOrder::eLeaderboardOrder::LeaderboardOrder_LEVEL; + if (val == utility::conversions::to_string_t(U("points"))) + return LeaderboardOrder::eLeaderboardOrder::LeaderboardOrder_POINTS; + return {}; +} + +EnumUnderlyingType fromEnum(LeaderboardOrder::eLeaderboardOrder e) +{ + switch (e) + { + case LeaderboardOrder::eLeaderboardOrder::LeaderboardOrder_LEVEL: + return U("level"); + case LeaderboardOrder::eLeaderboardOrder::LeaderboardOrder_POINTS: + return U("points"); + default: + break; + } + return {}; +} +} + +LeaderboardOrder::LeaderboardOrder() +{ +} + +LeaderboardOrder::~LeaderboardOrder() +{ +} + +void LeaderboardOrder::validate() +{ + // TODO: implement validation +} + +web::json::value LeaderboardOrder::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool LeaderboardOrder::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void LeaderboardOrder::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool LeaderboardOrder::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +LeaderboardOrder::eLeaderboardOrder LeaderboardOrder::getValue() const +{ + return m_value; +} + +void LeaderboardOrder::setValue(LeaderboardOrder::eLeaderboardOrder const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/LoginProvider.cpp b/src/model/LoginProvider.cpp new file mode 100644 index 00000000..deb25835 --- /dev/null +++ b/src/model/LoginProvider.cpp @@ -0,0 +1,138 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/LoginProvider.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +LoginProvider::eLoginProvider toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("steam"))) + return LoginProvider::eLoginProvider::LoginProvider_STEAM; + if (val == utility::conversions::to_string_t(U("epic"))) + return LoginProvider::eLoginProvider::LoginProvider_EPIC; + if (val == utility::conversions::to_string_t(U("discord"))) + return LoginProvider::eLoginProvider::LoginProvider_DISCORD; + if (val == utility::conversions::to_string_t(U("microsoft"))) + return LoginProvider::eLoginProvider::LoginProvider_MICROSOFT; + if (val == utility::conversions::to_string_t(U("playstation"))) + return LoginProvider::eLoginProvider::LoginProvider_PLAYSTATION; + if (val == utility::conversions::to_string_t(U("google"))) + return LoginProvider::eLoginProvider::LoginProvider_GOOGLE; + if (val == utility::conversions::to_string_t(U("apple"))) + return LoginProvider::eLoginProvider::LoginProvider_APPLE; + return {}; +} + +EnumUnderlyingType fromEnum(LoginProvider::eLoginProvider e) +{ + switch (e) + { + case LoginProvider::eLoginProvider::LoginProvider_STEAM: + return U("steam"); + case LoginProvider::eLoginProvider::LoginProvider_EPIC: + return U("epic"); + case LoginProvider::eLoginProvider::LoginProvider_DISCORD: + return U("discord"); + case LoginProvider::eLoginProvider::LoginProvider_MICROSOFT: + return U("microsoft"); + case LoginProvider::eLoginProvider::LoginProvider_PLAYSTATION: + return U("playstation"); + case LoginProvider::eLoginProvider::LoginProvider_GOOGLE: + return U("google"); + case LoginProvider::eLoginProvider::LoginProvider_APPLE: + return U("apple"); + default: + break; + } + return {}; +} +} + +LoginProvider::LoginProvider() +{ +} + +LoginProvider::~LoginProvider() +{ +} + +void LoginProvider::validate() +{ + // TODO: implement validation +} + +web::json::value LoginProvider::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool LoginProvider::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void LoginProvider::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool LoginProvider::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +LoginProvider::eLoginProvider LoginProvider::getValue() const +{ + return m_value; +} + +void LoginProvider::setValue(LoginProvider::eLoginProvider const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/LoginRequest.cpp b/src/model/LoginRequest.cpp new file mode 100644 index 00000000..e1930e5d --- /dev/null +++ b/src/model/LoginRequest.cpp @@ -0,0 +1,170 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/LoginRequest.h" + +namespace tribufu { +namespace models { + +LoginRequest::LoginRequest() +{ + m_Login = utility::conversions::to_string_t(""); + m_LoginIsSet = false; + m_Password = utility::conversions::to_string_t(""); + m_PasswordIsSet = false; +} + +LoginRequest::~LoginRequest() +{ +} + +void LoginRequest::validate() +{ + // TODO: implement validation +} + +web::json::value LoginRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_LoginIsSet) + { + + val[utility::conversions::to_string_t(U("login"))] = ModelBase::toJson(m_Login); + } + if(m_PasswordIsSet) + { + + val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); + } + + return val; +} + +bool LoginRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("login")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("login"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLogin; + ok &= ModelBase::fromJson(fieldValue, refVal_setLogin); + setLogin(refVal_setLogin); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("password")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); + setPassword(refVal_setPassword); + + } + } + return ok; +} + +void LoginRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_LoginIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("login")), m_Login)); + } + if(m_PasswordIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); + } +} + +bool LoginRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("login")))) + { + utility::string_t refVal_setLogin; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("login"))), refVal_setLogin ); + setLogin(refVal_setLogin); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); + setPassword(refVal_setPassword); + } + return ok; +} + + +utility::string_t LoginRequest::getLogin() const +{ + return m_Login; +} + + +void LoginRequest::setLogin(const utility::string_t& value) +{ + m_Login = value; + m_LoginIsSet = true; +} + +bool LoginRequest::loginIsSet() const +{ + return m_LoginIsSet; +} + +void LoginRequest::unsetLogin() +{ + m_LoginIsSet = false; +} +utility::string_t LoginRequest::getPassword() const +{ + return m_Password; +} + + +void LoginRequest::setPassword(const utility::string_t& value) +{ + m_Password = value; + m_PasswordIsSet = true; +} + +bool LoginRequest::passwordIsSet() const +{ + return m_PasswordIsSet; +} + +void LoginRequest::unsetPassword() +{ + m_PasswordIsSet = false; +} + +} +} + + diff --git a/src/model/LoginResponse.cpp b/src/model/LoginResponse.cpp new file mode 100644 index 00000000..aa3c747c --- /dev/null +++ b/src/model/LoginResponse.cpp @@ -0,0 +1,266 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/LoginResponse.h" + +namespace tribufu { +namespace models { + +LoginResponse::LoginResponse() +{ + m_UserIsSet = false; + m_Access_token = utility::conversions::to_string_t(""); + m_Access_tokenIsSet = false; + m_Refresh_token = utility::conversions::to_string_t(""); + m_Refresh_tokenIsSet = false; + m_Expires_in = 0L; + m_Expires_inIsSet = false; +} + +LoginResponse::~LoginResponse() +{ +} + +void LoginResponse::validate() +{ + // TODO: implement validation +} + +web::json::value LoginResponse::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_UserIsSet) + { + + val[utility::conversions::to_string_t(U("user"))] = ModelBase::toJson(m_User); + } + if(m_Access_tokenIsSet) + { + + val[utility::conversions::to_string_t(U("access_token"))] = ModelBase::toJson(m_Access_token); + } + if(m_Refresh_tokenIsSet) + { + + val[utility::conversions::to_string_t(U("refresh_token"))] = ModelBase::toJson(m_Refresh_token); + } + if(m_Expires_inIsSet) + { + + val[utility::conversions::to_string_t(U("expires_in"))] = ModelBase::toJson(m_Expires_in); + } + + return val; +} + +bool LoginResponse::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("user")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("user"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setUser; + ok &= ModelBase::fromJson(fieldValue, refVal_setUser); + setUser(refVal_setUser); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("access_token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("access_token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setAccessToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setAccessToken); + setAccessToken(refVal_setAccessToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("refresh_token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("refresh_token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); + setRefreshToken(refVal_setRefreshToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("expires_in")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("expires_in"))); + if(!fieldValue.is_null()) + { + int64_t refVal_setExpiresIn; + ok &= ModelBase::fromJson(fieldValue, refVal_setExpiresIn); + setExpiresIn(refVal_setExpiresIn); + + } + } + return ok; +} + +void LoginResponse::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_UserIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("user")), m_User)); + } + if(m_Access_tokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("access_token")), m_Access_token)); + } + if(m_Refresh_tokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("refresh_token")), m_Refresh_token)); + } + if(m_Expires_inIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("expires_in")), m_Expires_in)); + } +} + +bool LoginResponse::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("user")))) + { + std::shared_ptr refVal_setUser; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("user"))), refVal_setUser ); + setUser(refVal_setUser); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("access_token")))) + { + utility::string_t refVal_setAccessToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("access_token"))), refVal_setAccessToken ); + setAccessToken(refVal_setAccessToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("refresh_token")))) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("refresh_token"))), refVal_setRefreshToken ); + setRefreshToken(refVal_setRefreshToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("expires_in")))) + { + int64_t refVal_setExpiresIn; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("expires_in"))), refVal_setExpiresIn ); + setExpiresIn(refVal_setExpiresIn); + } + return ok; +} + + +std::shared_ptr LoginResponse::getUser() const +{ + return m_User; +} + + +void LoginResponse::setUser(const std::shared_ptr& value) +{ + m_User = value; + m_UserIsSet = true; +} + +bool LoginResponse::userIsSet() const +{ + return m_UserIsSet; +} + +void LoginResponse::unsetUser() +{ + m_UserIsSet = false; +} +utility::string_t LoginResponse::getAccessToken() const +{ + return m_Access_token; +} + + +void LoginResponse::setAccessToken(const utility::string_t& value) +{ + m_Access_token = value; + m_Access_tokenIsSet = true; +} + +bool LoginResponse::accessTokenIsSet() const +{ + return m_Access_tokenIsSet; +} + +void LoginResponse::unsetAccess_token() +{ + m_Access_tokenIsSet = false; +} +utility::string_t LoginResponse::getRefreshToken() const +{ + return m_Refresh_token; +} + + +void LoginResponse::setRefreshToken(const utility::string_t& value) +{ + m_Refresh_token = value; + m_Refresh_tokenIsSet = true; +} + +bool LoginResponse::refreshTokenIsSet() const +{ + return m_Refresh_tokenIsSet; +} + +void LoginResponse::unsetRefresh_token() +{ + m_Refresh_tokenIsSet = false; +} +int64_t LoginResponse::getExpiresIn() const +{ + return m_Expires_in; +} + +void LoginResponse::setExpiresIn(int64_t value) +{ + m_Expires_in = value; + m_Expires_inIsSet = true; +} + +bool LoginResponse::expiresInIsSet() const +{ + return m_Expires_inIsSet; +} + +void LoginResponse::unsetExpires_in() +{ + m_Expires_inIsSet = false; +} + +} +} + + diff --git a/src/model/Package.cpp b/src/model/Package.cpp new file mode 100644 index 00000000..14c0202e --- /dev/null +++ b/src/model/Package.cpp @@ -0,0 +1,658 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Package.h" + +namespace tribufu { +namespace models { + +Package::Package() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_Image_url = utility::conversions::to_string_t(""); + m_Image_urlIsSet = false; + m_Author_id = utility::conversions::to_string_t(""); + m_Author_idIsSet = false; + m_Version = utility::conversions::to_string_t(""); + m_VersionIsSet = false; + m_File_url = utility::conversions::to_string_t(""); + m_File_urlIsSet = false; + m_Raw_size = 0.0; + m_Raw_sizeIsSet = false; + m_Download_count = 0; + m_Download_countIsSet = false; + m_Last_download = utility::datetime(); + m_Last_downloadIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Package::~Package() +{ +} + +void Package::validate() +{ + // TODO: implement validation +} + +web::json::value Package::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_Image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("image_url"))] = ModelBase::toJson(m_Image_url); + } + if(m_Author_idIsSet) + { + + val[utility::conversions::to_string_t(U("author_id"))] = ModelBase::toJson(m_Author_id); + } + if(m_VersionIsSet) + { + + val[utility::conversions::to_string_t(U("version"))] = ModelBase::toJson(m_Version); + } + if(m_File_urlIsSet) + { + + val[utility::conversions::to_string_t(U("file_url"))] = ModelBase::toJson(m_File_url); + } + if(m_Raw_sizeIsSet) + { + + val[utility::conversions::to_string_t(U("raw_size"))] = ModelBase::toJson(m_Raw_size); + } + if(m_Download_countIsSet) + { + + val[utility::conversions::to_string_t(U("download_count"))] = ModelBase::toJson(m_Download_count); + } + if(m_Last_downloadIsSet) + { + + val[utility::conversions::to_string_t(U("last_download"))] = ModelBase::toJson(m_Last_download); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Package::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setImageUrl); + setImageUrl(refVal_setImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("author_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("author_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setAuthorId; + ok &= ModelBase::fromJson(fieldValue, refVal_setAuthorId); + setAuthorId(refVal_setAuthorId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("version")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("version"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setVersion; + ok &= ModelBase::fromJson(fieldValue, refVal_setVersion); + setVersion(refVal_setVersion); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("file_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("file_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setFileUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setFileUrl); + setFileUrl(refVal_setFileUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("raw_size")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("raw_size"))); + if(!fieldValue.is_null()) + { + double refVal_setRawSize; + ok &= ModelBase::fromJson(fieldValue, refVal_setRawSize); + setRawSize(refVal_setRawSize); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("download_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("download_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setDownloadCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount); + setDownloadCount(refVal_setDownloadCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_download")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_download"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastDownload; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastDownload); + setLastDownload(refVal_setLastDownload); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Package::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_Image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("image_url")), m_Image_url)); + } + if(m_Author_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("author_id")), m_Author_id)); + } + if(m_VersionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("version")), m_Version)); + } + if(m_File_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("file_url")), m_File_url)); + } + if(m_Raw_sizeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("raw_size")), m_Raw_size)); + } + if(m_Download_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("download_count")), m_Download_count)); + } + if(m_Last_downloadIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_download")), m_Last_download)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Package::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("image_url")))) + { + utility::string_t refVal_setImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("image_url"))), refVal_setImageUrl ); + setImageUrl(refVal_setImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("author_id")))) + { + utility::string_t refVal_setAuthorId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("author_id"))), refVal_setAuthorId ); + setAuthorId(refVal_setAuthorId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("version")))) + { + utility::string_t refVal_setVersion; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("version"))), refVal_setVersion ); + setVersion(refVal_setVersion); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("file_url")))) + { + utility::string_t refVal_setFileUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("file_url"))), refVal_setFileUrl ); + setFileUrl(refVal_setFileUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("raw_size")))) + { + double refVal_setRawSize; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("raw_size"))), refVal_setRawSize ); + setRawSize(refVal_setRawSize); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("download_count")))) + { + int32_t refVal_setDownloadCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("download_count"))), refVal_setDownloadCount ); + setDownloadCount(refVal_setDownloadCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_download")))) + { + utility::datetime refVal_setLastDownload; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_download"))), refVal_setLastDownload ); + setLastDownload(refVal_setLastDownload); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t Package::getId() const +{ + return m_Id; +} + + +void Package::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Package::idIsSet() const +{ + return m_IdIsSet; +} + +void Package::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Package::getName() const +{ + return m_Name; +} + + +void Package::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Package::nameIsSet() const +{ + return m_NameIsSet; +} + +void Package::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t Package::getDescription() const +{ + return m_Description; +} + + +void Package::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool Package::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void Package::unsetDescription() +{ + m_DescriptionIsSet = false; +} +utility::string_t Package::getImageUrl() const +{ + return m_Image_url; +} + + +void Package::setImageUrl(const utility::string_t& value) +{ + m_Image_url = value; + m_Image_urlIsSet = true; +} + +bool Package::imageUrlIsSet() const +{ + return m_Image_urlIsSet; +} + +void Package::unsetImage_url() +{ + m_Image_urlIsSet = false; +} +utility::string_t Package::getAuthorId() const +{ + return m_Author_id; +} + + +void Package::setAuthorId(const utility::string_t& value) +{ + m_Author_id = value; + m_Author_idIsSet = true; +} + +bool Package::authorIdIsSet() const +{ + return m_Author_idIsSet; +} + +void Package::unsetAuthor_id() +{ + m_Author_idIsSet = false; +} +utility::string_t Package::getVersion() const +{ + return m_Version; +} + + +void Package::setVersion(const utility::string_t& value) +{ + m_Version = value; + m_VersionIsSet = true; +} + +bool Package::versionIsSet() const +{ + return m_VersionIsSet; +} + +void Package::unsetVersion() +{ + m_VersionIsSet = false; +} +utility::string_t Package::getFileUrl() const +{ + return m_File_url; +} + + +void Package::setFileUrl(const utility::string_t& value) +{ + m_File_url = value; + m_File_urlIsSet = true; +} + +bool Package::fileUrlIsSet() const +{ + return m_File_urlIsSet; +} + +void Package::unsetFile_url() +{ + m_File_urlIsSet = false; +} +double Package::getRawSize() const +{ + return m_Raw_size; +} + +void Package::setRawSize(double value) +{ + m_Raw_size = value; + m_Raw_sizeIsSet = true; +} + +bool Package::rawSizeIsSet() const +{ + return m_Raw_sizeIsSet; +} + +void Package::unsetRaw_size() +{ + m_Raw_sizeIsSet = false; +} +int32_t Package::getDownloadCount() const +{ + return m_Download_count; +} + +void Package::setDownloadCount(int32_t value) +{ + m_Download_count = value; + m_Download_countIsSet = true; +} + +bool Package::downloadCountIsSet() const +{ + return m_Download_countIsSet; +} + +void Package::unsetDownload_count() +{ + m_Download_countIsSet = false; +} +utility::datetime Package::getLastDownload() const +{ + return m_Last_download; +} + + +void Package::setLastDownload(const utility::datetime& value) +{ + m_Last_download = value; + m_Last_downloadIsSet = true; +} + +bool Package::lastDownloadIsSet() const +{ + return m_Last_downloadIsSet; +} + +void Package::unsetLast_download() +{ + m_Last_downloadIsSet = false; +} +utility::datetime Package::getCreated() const +{ + return m_Created; +} + + +void Package::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Package::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Package::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Package::getUpdated() const +{ + return m_Updated; +} + + +void Package::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Package::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Package::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/Profile.cpp b/src/model/Profile.cpp new file mode 100644 index 00000000..93a12880 --- /dev/null +++ b/src/model/Profile.cpp @@ -0,0 +1,947 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Profile.h" + +namespace tribufu { +namespace models { + +Profile::Profile() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Uuid = utility::conversions::to_string_t(""); + m_UuidIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Display_name = utility::conversions::to_string_t(""); + m_Display_nameIsSet = false; + m_Verified = false; + m_VerifiedIsSet = false; + m_Level = 0; + m_LevelIsSet = false; + m_Experience = 0.0; + m_ExperienceIsSet = false; + m_Public_birthday = false; + m_Public_birthdayIsSet = false; + m_BirthdayIsSet = false; + m_Points = 0.0; + m_PointsIsSet = false; + m_Location = utility::conversions::to_string_t(""); + m_LocationIsSet = false; + m_Photo_url = utility::conversions::to_string_t(""); + m_Photo_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Last_online = utility::datetime(); + m_Last_onlineIsSet = false; + m_Biography = utility::conversions::to_string_t(""); + m_BiographyIsSet = false; + m_View_count = 0; + m_View_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Profile::~Profile() +{ +} + +void Profile::validate() +{ + // TODO: implement validation +} + +web::json::value Profile::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_UuidIsSet) + { + + val[utility::conversions::to_string_t(U("uuid"))] = ModelBase::toJson(m_Uuid); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_Display_nameIsSet) + { + + val[utility::conversions::to_string_t(U("display_name"))] = ModelBase::toJson(m_Display_name); + } + if(m_VerifiedIsSet) + { + + val[utility::conversions::to_string_t(U("verified"))] = ModelBase::toJson(m_Verified); + } + if(m_LevelIsSet) + { + + val[utility::conversions::to_string_t(U("level"))] = ModelBase::toJson(m_Level); + } + if(m_ExperienceIsSet) + { + + val[utility::conversions::to_string_t(U("experience"))] = ModelBase::toJson(m_Experience); + } + if(m_Public_birthdayIsSet) + { + + val[utility::conversions::to_string_t(U("public_birthday"))] = ModelBase::toJson(m_Public_birthday); + } + if(m_BirthdayIsSet) + { + + val[utility::conversions::to_string_t(U("birthday"))] = ModelBase::toJson(m_Birthday); + } + if(m_PointsIsSet) + { + + val[utility::conversions::to_string_t(U("points"))] = ModelBase::toJson(m_Points); + } + if(m_LocationIsSet) + { + + val[utility::conversions::to_string_t(U("location"))] = ModelBase::toJson(m_Location); + } + if(m_Photo_urlIsSet) + { + + val[utility::conversions::to_string_t(U("photo_url"))] = ModelBase::toJson(m_Photo_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Last_onlineIsSet) + { + + val[utility::conversions::to_string_t(U("last_online"))] = ModelBase::toJson(m_Last_online); + } + if(m_BiographyIsSet) + { + + val[utility::conversions::to_string_t(U("biography"))] = ModelBase::toJson(m_Biography); + } + if(m_View_countIsSet) + { + + val[utility::conversions::to_string_t(U("view_count"))] = ModelBase::toJson(m_View_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Profile::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("uuid")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); + setUuid(refVal_setUuid); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("display_name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("display_name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); + setDisplayName(refVal_setDisplayName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("verified")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("verified"))); + if(!fieldValue.is_null()) + { + bool refVal_setVerified; + ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); + setVerified(refVal_setVerified); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("level")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("level"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setLevel; + ok &= ModelBase::fromJson(fieldValue, refVal_setLevel); + setLevel(refVal_setLevel); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("experience")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("experience"))); + if(!fieldValue.is_null()) + { + double refVal_setExperience; + ok &= ModelBase::fromJson(fieldValue, refVal_setExperience); + setExperience(refVal_setExperience); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("public_birthday")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("public_birthday"))); + if(!fieldValue.is_null()) + { + bool refVal_setPublicBirthday; + ok &= ModelBase::fromJson(fieldValue, refVal_setPublicBirthday); + setPublicBirthday(refVal_setPublicBirthday); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("birthday")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("birthday"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setBirthday; + ok &= ModelBase::fromJson(fieldValue, refVal_setBirthday); + setBirthday(refVal_setBirthday); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("points")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("points"))); + if(!fieldValue.is_null()) + { + double refVal_setPoints; + ok &= ModelBase::fromJson(fieldValue, refVal_setPoints); + setPoints(refVal_setPoints); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("location")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("location"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLocation; + ok &= ModelBase::fromJson(fieldValue, refVal_setLocation); + setLocation(refVal_setLocation); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("photo_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photo_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); + setPhotoUrl(refVal_setPhotoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_online")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_online"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); + setLastOnline(refVal_setLastOnline); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("biography")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("biography"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBiography; + ok &= ModelBase::fromJson(fieldValue, refVal_setBiography); + setBiography(refVal_setBiography); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("view_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("view_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setViewCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setViewCount); + setViewCount(refVal_setViewCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Profile::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_UuidIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uuid")), m_Uuid)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_Display_nameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("display_name")), m_Display_name)); + } + if(m_VerifiedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("verified")), m_Verified)); + } + if(m_LevelIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("level")), m_Level)); + } + if(m_ExperienceIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("experience")), m_Experience)); + } + if(m_Public_birthdayIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("public_birthday")), m_Public_birthday)); + } + if(m_BirthdayIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("birthday")), m_Birthday)); + } + if(m_PointsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("points")), m_Points)); + } + if(m_LocationIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("location")), m_Location)); + } + if(m_Photo_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photo_url")), m_Photo_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Last_onlineIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_online")), m_Last_online)); + } + if(m_BiographyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("biography")), m_Biography)); + } + if(m_View_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("view_count")), m_View_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Profile::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("uuid")))) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uuid"))), refVal_setUuid ); + setUuid(refVal_setUuid); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("display_name")))) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("display_name"))), refVal_setDisplayName ); + setDisplayName(refVal_setDisplayName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("verified")))) + { + bool refVal_setVerified; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("verified"))), refVal_setVerified ); + setVerified(refVal_setVerified); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("level")))) + { + int32_t refVal_setLevel; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("level"))), refVal_setLevel ); + setLevel(refVal_setLevel); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("experience")))) + { + double refVal_setExperience; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("experience"))), refVal_setExperience ); + setExperience(refVal_setExperience); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("public_birthday")))) + { + bool refVal_setPublicBirthday; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("public_birthday"))), refVal_setPublicBirthday ); + setPublicBirthday(refVal_setPublicBirthday); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("birthday")))) + { + utility::datetime refVal_setBirthday; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("birthday"))), refVal_setBirthday ); + setBirthday(refVal_setBirthday); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("points")))) + { + double refVal_setPoints; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("points"))), refVal_setPoints ); + setPoints(refVal_setPoints); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("location")))) + { + utility::string_t refVal_setLocation; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("location"))), refVal_setLocation ); + setLocation(refVal_setLocation); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("photo_url")))) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photo_url"))), refVal_setPhotoUrl ); + setPhotoUrl(refVal_setPhotoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_online")))) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_online"))), refVal_setLastOnline ); + setLastOnline(refVal_setLastOnline); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("biography")))) + { + utility::string_t refVal_setBiography; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("biography"))), refVal_setBiography ); + setBiography(refVal_setBiography); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("view_count")))) + { + int32_t refVal_setViewCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("view_count"))), refVal_setViewCount ); + setViewCount(refVal_setViewCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t Profile::getId() const +{ + return m_Id; +} + + +void Profile::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Profile::idIsSet() const +{ + return m_IdIsSet; +} + +void Profile::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Profile::getUuid() const +{ + return m_Uuid; +} + + +void Profile::setUuid(const utility::string_t& value) +{ + m_Uuid = value; + m_UuidIsSet = true; +} + +bool Profile::uuidIsSet() const +{ + return m_UuidIsSet; +} + +void Profile::unsetUuid() +{ + m_UuidIsSet = false; +} +utility::string_t Profile::getName() const +{ + return m_Name; +} + + +void Profile::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Profile::nameIsSet() const +{ + return m_NameIsSet; +} + +void Profile::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t Profile::getDisplayName() const +{ + return m_Display_name; +} + + +void Profile::setDisplayName(const utility::string_t& value) +{ + m_Display_name = value; + m_Display_nameIsSet = true; +} + +bool Profile::displayNameIsSet() const +{ + return m_Display_nameIsSet; +} + +void Profile::unsetDisplay_name() +{ + m_Display_nameIsSet = false; +} +bool Profile::isVerified() const +{ + return m_Verified; +} + +void Profile::setVerified(bool value) +{ + m_Verified = value; + m_VerifiedIsSet = true; +} + +bool Profile::verifiedIsSet() const +{ + return m_VerifiedIsSet; +} + +void Profile::unsetVerified() +{ + m_VerifiedIsSet = false; +} +int32_t Profile::getLevel() const +{ + return m_Level; +} + +void Profile::setLevel(int32_t value) +{ + m_Level = value; + m_LevelIsSet = true; +} + +bool Profile::levelIsSet() const +{ + return m_LevelIsSet; +} + +void Profile::unsetLevel() +{ + m_LevelIsSet = false; +} +double Profile::getExperience() const +{ + return m_Experience; +} + +void Profile::setExperience(double value) +{ + m_Experience = value; + m_ExperienceIsSet = true; +} + +bool Profile::experienceIsSet() const +{ + return m_ExperienceIsSet; +} + +void Profile::unsetExperience() +{ + m_ExperienceIsSet = false; +} +bool Profile::isPublicBirthday() const +{ + return m_Public_birthday; +} + +void Profile::setPublicBirthday(bool value) +{ + m_Public_birthday = value; + m_Public_birthdayIsSet = true; +} + +bool Profile::publicBirthdayIsSet() const +{ + return m_Public_birthdayIsSet; +} + +void Profile::unsetPublic_birthday() +{ + m_Public_birthdayIsSet = false; +} +utility::datetime Profile::getBirthday() const +{ + return m_Birthday; +} + + +void Profile::setBirthday(const utility::datetime& value) +{ + m_Birthday = value; + m_BirthdayIsSet = true; +} + +bool Profile::birthdayIsSet() const +{ + return m_BirthdayIsSet; +} + +void Profile::unsetBirthday() +{ + m_BirthdayIsSet = false; +} +double Profile::getPoints() const +{ + return m_Points; +} + +void Profile::setPoints(double value) +{ + m_Points = value; + m_PointsIsSet = true; +} + +bool Profile::pointsIsSet() const +{ + return m_PointsIsSet; +} + +void Profile::unsetPoints() +{ + m_PointsIsSet = false; +} +utility::string_t Profile::getLocation() const +{ + return m_Location; +} + + +void Profile::setLocation(const utility::string_t& value) +{ + m_Location = value; + m_LocationIsSet = true; +} + +bool Profile::locationIsSet() const +{ + return m_LocationIsSet; +} + +void Profile::unsetLocation() +{ + m_LocationIsSet = false; +} +utility::string_t Profile::getPhotoUrl() const +{ + return m_Photo_url; +} + + +void Profile::setPhotoUrl(const utility::string_t& value) +{ + m_Photo_url = value; + m_Photo_urlIsSet = true; +} + +bool Profile::photoUrlIsSet() const +{ + return m_Photo_urlIsSet; +} + +void Profile::unsetPhoto_url() +{ + m_Photo_urlIsSet = false; +} +utility::string_t Profile::getBannerUrl() const +{ + return m_Banner_url; +} + + +void Profile::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool Profile::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void Profile::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +utility::datetime Profile::getLastOnline() const +{ + return m_Last_online; +} + + +void Profile::setLastOnline(const utility::datetime& value) +{ + m_Last_online = value; + m_Last_onlineIsSet = true; +} + +bool Profile::lastOnlineIsSet() const +{ + return m_Last_onlineIsSet; +} + +void Profile::unsetLast_online() +{ + m_Last_onlineIsSet = false; +} +utility::string_t Profile::getBiography() const +{ + return m_Biography; +} + + +void Profile::setBiography(const utility::string_t& value) +{ + m_Biography = value; + m_BiographyIsSet = true; +} + +bool Profile::biographyIsSet() const +{ + return m_BiographyIsSet; +} + +void Profile::unsetBiography() +{ + m_BiographyIsSet = false; +} +int32_t Profile::getViewCount() const +{ + return m_View_count; +} + +void Profile::setViewCount(int32_t value) +{ + m_View_count = value; + m_View_countIsSet = true; +} + +bool Profile::viewCountIsSet() const +{ + return m_View_countIsSet; +} + +void Profile::unsetView_count() +{ + m_View_countIsSet = false; +} +utility::datetime Profile::getCreated() const +{ + return m_Created; +} + + +void Profile::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Profile::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Profile::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Profile::getUpdated() const +{ + return m_Updated; +} + + +void Profile::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Profile::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Profile::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/ProfileGame.cpp b/src/model/ProfileGame.cpp new file mode 100644 index 00000000..7d6bdcf3 --- /dev/null +++ b/src/model/ProfileGame.cpp @@ -0,0 +1,607 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/ProfileGame.h" + +namespace tribufu { +namespace models { + +ProfileGame::ProfileGame() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Capsule_image_url = utility::conversions::to_string_t(""); + m_Capsule_image_urlIsSet = false; + m_Library_image_url = utility::conversions::to_string_t(""); + m_Library_image_urlIsSet = false; + m_Slug = utility::conversions::to_string_t(""); + m_SlugIsSet = false; + m_Time_used = 0.0; + m_Time_usedIsSet = false; + m_Unlocked_achievements = 0; + m_Unlocked_achievementsIsSet = false; + m_Total_achievements = 0; + m_Total_achievementsIsSet = false; + m_StatsIsSet = false; + m_Acquired = utility::datetime(); + m_AcquiredIsSet = false; + m_Last_used = utility::datetime(); + m_Last_usedIsSet = false; +} + +ProfileGame::~ProfileGame() +{ +} + +void ProfileGame::validate() +{ + // TODO: implement validation +} + +web::json::value ProfileGame::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_Capsule_image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("capsule_image_url"))] = ModelBase::toJson(m_Capsule_image_url); + } + if(m_Library_image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("library_image_url"))] = ModelBase::toJson(m_Library_image_url); + } + if(m_SlugIsSet) + { + + val[utility::conversions::to_string_t(U("slug"))] = ModelBase::toJson(m_Slug); + } + if(m_Time_usedIsSet) + { + + val[utility::conversions::to_string_t(U("time_used"))] = ModelBase::toJson(m_Time_used); + } + if(m_Unlocked_achievementsIsSet) + { + + val[utility::conversions::to_string_t(U("unlocked_achievements"))] = ModelBase::toJson(m_Unlocked_achievements); + } + if(m_Total_achievementsIsSet) + { + + val[utility::conversions::to_string_t(U("total_achievements"))] = ModelBase::toJson(m_Total_achievements); + } + if(m_StatsIsSet) + { + + val[utility::conversions::to_string_t(U("stats"))] = ModelBase::toJson(m_Stats); + } + if(m_AcquiredIsSet) + { + + val[utility::conversions::to_string_t(U("acquired"))] = ModelBase::toJson(m_Acquired); + } + if(m_Last_usedIsSet) + { + + val[utility::conversions::to_string_t(U("last_used"))] = ModelBase::toJson(m_Last_used); + } + + return val; +} + +bool ProfileGame::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("capsule_image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("capsule_image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCapsuleImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setCapsuleImageUrl); + setCapsuleImageUrl(refVal_setCapsuleImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("library_image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("library_image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLibraryImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setLibraryImageUrl); + setLibraryImageUrl(refVal_setLibraryImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("slug")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("slug"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setSlug; + ok &= ModelBase::fromJson(fieldValue, refVal_setSlug); + setSlug(refVal_setSlug); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("time_used")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("time_used"))); + if(!fieldValue.is_null()) + { + double refVal_setTimeUsed; + ok &= ModelBase::fromJson(fieldValue, refVal_setTimeUsed); + setTimeUsed(refVal_setTimeUsed); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("unlocked_achievements")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("unlocked_achievements"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setUnlockedAchievements; + ok &= ModelBase::fromJson(fieldValue, refVal_setUnlockedAchievements); + setUnlockedAchievements(refVal_setUnlockedAchievements); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("total_achievements")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("total_achievements"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setTotalAchievements; + ok &= ModelBase::fromJson(fieldValue, refVal_setTotalAchievements); + setTotalAchievements(refVal_setTotalAchievements); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("stats")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("stats"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setStats; + ok &= ModelBase::fromJson(fieldValue, refVal_setStats); + setStats(refVal_setStats); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("acquired")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("acquired"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setAcquired; + ok &= ModelBase::fromJson(fieldValue, refVal_setAcquired); + setAcquired(refVal_setAcquired); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_used")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_used"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastUsed; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastUsed); + setLastUsed(refVal_setLastUsed); + + } + } + return ok; +} + +void ProfileGame::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_Capsule_image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("capsule_image_url")), m_Capsule_image_url)); + } + if(m_Library_image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("library_image_url")), m_Library_image_url)); + } + if(m_SlugIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("slug")), m_Slug)); + } + if(m_Time_usedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("time_used")), m_Time_used)); + } + if(m_Unlocked_achievementsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("unlocked_achievements")), m_Unlocked_achievements)); + } + if(m_Total_achievementsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("total_achievements")), m_Total_achievements)); + } + if(m_StatsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("stats")), m_Stats)); + } + if(m_AcquiredIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("acquired")), m_Acquired)); + } + if(m_Last_usedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_used")), m_Last_used)); + } +} + +bool ProfileGame::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("capsule_image_url")))) + { + utility::string_t refVal_setCapsuleImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("capsule_image_url"))), refVal_setCapsuleImageUrl ); + setCapsuleImageUrl(refVal_setCapsuleImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("library_image_url")))) + { + utility::string_t refVal_setLibraryImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("library_image_url"))), refVal_setLibraryImageUrl ); + setLibraryImageUrl(refVal_setLibraryImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("slug")))) + { + utility::string_t refVal_setSlug; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("slug"))), refVal_setSlug ); + setSlug(refVal_setSlug); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("time_used")))) + { + double refVal_setTimeUsed; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("time_used"))), refVal_setTimeUsed ); + setTimeUsed(refVal_setTimeUsed); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("unlocked_achievements")))) + { + int32_t refVal_setUnlockedAchievements; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("unlocked_achievements"))), refVal_setUnlockedAchievements ); + setUnlockedAchievements(refVal_setUnlockedAchievements); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("total_achievements")))) + { + int32_t refVal_setTotalAchievements; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("total_achievements"))), refVal_setTotalAchievements ); + setTotalAchievements(refVal_setTotalAchievements); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("stats")))) + { + std::shared_ptr refVal_setStats; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("stats"))), refVal_setStats ); + setStats(refVal_setStats); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("acquired")))) + { + utility::datetime refVal_setAcquired; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("acquired"))), refVal_setAcquired ); + setAcquired(refVal_setAcquired); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_used")))) + { + utility::datetime refVal_setLastUsed; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_used"))), refVal_setLastUsed ); + setLastUsed(refVal_setLastUsed); + } + return ok; +} + + +utility::string_t ProfileGame::getId() const +{ + return m_Id; +} + + +void ProfileGame::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool ProfileGame::idIsSet() const +{ + return m_IdIsSet; +} + +void ProfileGame::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t ProfileGame::getName() const +{ + return m_Name; +} + + +void ProfileGame::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool ProfileGame::nameIsSet() const +{ + return m_NameIsSet; +} + +void ProfileGame::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t ProfileGame::getCapsuleImageUrl() const +{ + return m_Capsule_image_url; +} + + +void ProfileGame::setCapsuleImageUrl(const utility::string_t& value) +{ + m_Capsule_image_url = value; + m_Capsule_image_urlIsSet = true; +} + +bool ProfileGame::capsuleImageUrlIsSet() const +{ + return m_Capsule_image_urlIsSet; +} + +void ProfileGame::unsetCapsule_image_url() +{ + m_Capsule_image_urlIsSet = false; +} +utility::string_t ProfileGame::getLibraryImageUrl() const +{ + return m_Library_image_url; +} + + +void ProfileGame::setLibraryImageUrl(const utility::string_t& value) +{ + m_Library_image_url = value; + m_Library_image_urlIsSet = true; +} + +bool ProfileGame::libraryImageUrlIsSet() const +{ + return m_Library_image_urlIsSet; +} + +void ProfileGame::unsetLibrary_image_url() +{ + m_Library_image_urlIsSet = false; +} +utility::string_t ProfileGame::getSlug() const +{ + return m_Slug; +} + + +void ProfileGame::setSlug(const utility::string_t& value) +{ + m_Slug = value; + m_SlugIsSet = true; +} + +bool ProfileGame::slugIsSet() const +{ + return m_SlugIsSet; +} + +void ProfileGame::unsetSlug() +{ + m_SlugIsSet = false; +} +double ProfileGame::getTimeUsed() const +{ + return m_Time_used; +} + +void ProfileGame::setTimeUsed(double value) +{ + m_Time_used = value; + m_Time_usedIsSet = true; +} + +bool ProfileGame::timeUsedIsSet() const +{ + return m_Time_usedIsSet; +} + +void ProfileGame::unsetTime_used() +{ + m_Time_usedIsSet = false; +} +int32_t ProfileGame::getUnlockedAchievements() const +{ + return m_Unlocked_achievements; +} + +void ProfileGame::setUnlockedAchievements(int32_t value) +{ + m_Unlocked_achievements = value; + m_Unlocked_achievementsIsSet = true; +} + +bool ProfileGame::unlockedAchievementsIsSet() const +{ + return m_Unlocked_achievementsIsSet; +} + +void ProfileGame::unsetUnlocked_achievements() +{ + m_Unlocked_achievementsIsSet = false; +} +int32_t ProfileGame::getTotalAchievements() const +{ + return m_Total_achievements; +} + +void ProfileGame::setTotalAchievements(int32_t value) +{ + m_Total_achievements = value; + m_Total_achievementsIsSet = true; +} + +bool ProfileGame::totalAchievementsIsSet() const +{ + return m_Total_achievementsIsSet; +} + +void ProfileGame::unsetTotal_achievements() +{ + m_Total_achievementsIsSet = false; +} +std::shared_ptr ProfileGame::getStats() const +{ + return m_Stats; +} + + +void ProfileGame::setStats(const std::shared_ptr& value) +{ + m_Stats = value; + m_StatsIsSet = true; +} + +bool ProfileGame::statsIsSet() const +{ + return m_StatsIsSet; +} + +void ProfileGame::unsetStats() +{ + m_StatsIsSet = false; +} +utility::datetime ProfileGame::getAcquired() const +{ + return m_Acquired; +} + + +void ProfileGame::setAcquired(const utility::datetime& value) +{ + m_Acquired = value; + m_AcquiredIsSet = true; +} + +bool ProfileGame::acquiredIsSet() const +{ + return m_AcquiredIsSet; +} + +void ProfileGame::unsetAcquired() +{ + m_AcquiredIsSet = false; +} +utility::datetime ProfileGame::getLastUsed() const +{ + return m_Last_used; +} + + +void ProfileGame::setLastUsed(const utility::datetime& value) +{ + m_Last_used = value; + m_Last_usedIsSet = true; +} + +bool ProfileGame::lastUsedIsSet() const +{ + return m_Last_usedIsSet; +} + +void ProfileGame::unsetLast_used() +{ + m_Last_usedIsSet = false; +} + +} +} + + diff --git a/src/model/ProfileGroup.cpp b/src/model/ProfileGroup.cpp new file mode 100644 index 00000000..1cf222cd --- /dev/null +++ b/src/model/ProfileGroup.cpp @@ -0,0 +1,558 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/ProfileGroup.h" + +namespace tribufu { +namespace models { + +ProfileGroup::ProfileGroup() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Uuid = utility::conversions::to_string_t(""); + m_UuidIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Tag = utility::conversions::to_string_t(""); + m_TagIsSet = false; + m_Privacy = 0; + m_PrivacyIsSet = false; + m_Verified = false; + m_VerifiedIsSet = false; + m_Photo_url = utility::conversions::to_string_t(""); + m_Photo_urlIsSet = false; + m_Member_count = 0; + m_Member_countIsSet = false; + m_RankIsSet = false; + m_Since = utility::datetime(); + m_SinceIsSet = false; +} + +ProfileGroup::~ProfileGroup() +{ +} + +void ProfileGroup::validate() +{ + // TODO: implement validation +} + +web::json::value ProfileGroup::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_UuidIsSet) + { + + val[utility::conversions::to_string_t(U("uuid"))] = ModelBase::toJson(m_Uuid); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_TagIsSet) + { + + val[utility::conversions::to_string_t(U("tag"))] = ModelBase::toJson(m_Tag); + } + if(m_PrivacyIsSet) + { + + val[utility::conversions::to_string_t(U("privacy"))] = ModelBase::toJson(m_Privacy); + } + if(m_VerifiedIsSet) + { + + val[utility::conversions::to_string_t(U("verified"))] = ModelBase::toJson(m_Verified); + } + if(m_Photo_urlIsSet) + { + + val[utility::conversions::to_string_t(U("photo_url"))] = ModelBase::toJson(m_Photo_url); + } + if(m_Member_countIsSet) + { + + val[utility::conversions::to_string_t(U("member_count"))] = ModelBase::toJson(m_Member_count); + } + if(m_RankIsSet) + { + + val[utility::conversions::to_string_t(U("rank"))] = ModelBase::toJson(m_Rank); + } + if(m_SinceIsSet) + { + + val[utility::conversions::to_string_t(U("since"))] = ModelBase::toJson(m_Since); + } + + return val; +} + +bool ProfileGroup::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("uuid")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); + setUuid(refVal_setUuid); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("tag")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tag"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTag; + ok &= ModelBase::fromJson(fieldValue, refVal_setTag); + setTag(refVal_setTag); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("privacy")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("privacy"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPrivacy; + ok &= ModelBase::fromJson(fieldValue, refVal_setPrivacy); + setPrivacy(refVal_setPrivacy); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("verified")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("verified"))); + if(!fieldValue.is_null()) + { + bool refVal_setVerified; + ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); + setVerified(refVal_setVerified); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("photo_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photo_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); + setPhotoUrl(refVal_setPhotoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("member_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("member_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setMemberCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setMemberCount); + setMemberCount(refVal_setMemberCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("rank")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("rank"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setRank; + ok &= ModelBase::fromJson(fieldValue, refVal_setRank); + setRank(refVal_setRank); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("since")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("since"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setSince; + ok &= ModelBase::fromJson(fieldValue, refVal_setSince); + setSince(refVal_setSince); + + } + } + return ok; +} + +void ProfileGroup::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_UuidIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uuid")), m_Uuid)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_TagIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tag")), m_Tag)); + } + if(m_PrivacyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("privacy")), m_Privacy)); + } + if(m_VerifiedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("verified")), m_Verified)); + } + if(m_Photo_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photo_url")), m_Photo_url)); + } + if(m_Member_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("member_count")), m_Member_count)); + } + if(m_RankIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("rank")), m_Rank)); + } + if(m_SinceIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("since")), m_Since)); + } +} + +bool ProfileGroup::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("uuid")))) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uuid"))), refVal_setUuid ); + setUuid(refVal_setUuid); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("tag")))) + { + utility::string_t refVal_setTag; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tag"))), refVal_setTag ); + setTag(refVal_setTag); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("privacy")))) + { + int32_t refVal_setPrivacy; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("privacy"))), refVal_setPrivacy ); + setPrivacy(refVal_setPrivacy); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("verified")))) + { + bool refVal_setVerified; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("verified"))), refVal_setVerified ); + setVerified(refVal_setVerified); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("photo_url")))) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photo_url"))), refVal_setPhotoUrl ); + setPhotoUrl(refVal_setPhotoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("member_count")))) + { + int32_t refVal_setMemberCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("member_count"))), refVal_setMemberCount ); + setMemberCount(refVal_setMemberCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("rank")))) + { + std::shared_ptr refVal_setRank; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("rank"))), refVal_setRank ); + setRank(refVal_setRank); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("since")))) + { + utility::datetime refVal_setSince; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("since"))), refVal_setSince ); + setSince(refVal_setSince); + } + return ok; +} + + +utility::string_t ProfileGroup::getId() const +{ + return m_Id; +} + + +void ProfileGroup::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool ProfileGroup::idIsSet() const +{ + return m_IdIsSet; +} + +void ProfileGroup::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t ProfileGroup::getUuid() const +{ + return m_Uuid; +} + + +void ProfileGroup::setUuid(const utility::string_t& value) +{ + m_Uuid = value; + m_UuidIsSet = true; +} + +bool ProfileGroup::uuidIsSet() const +{ + return m_UuidIsSet; +} + +void ProfileGroup::unsetUuid() +{ + m_UuidIsSet = false; +} +utility::string_t ProfileGroup::getName() const +{ + return m_Name; +} + + +void ProfileGroup::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool ProfileGroup::nameIsSet() const +{ + return m_NameIsSet; +} + +void ProfileGroup::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t ProfileGroup::getTag() const +{ + return m_Tag; +} + + +void ProfileGroup::setTag(const utility::string_t& value) +{ + m_Tag = value; + m_TagIsSet = true; +} + +bool ProfileGroup::tagIsSet() const +{ + return m_TagIsSet; +} + +void ProfileGroup::unsetTag() +{ + m_TagIsSet = false; +} +int32_t ProfileGroup::getPrivacy() const +{ + return m_Privacy; +} + +void ProfileGroup::setPrivacy(int32_t value) +{ + m_Privacy = value; + m_PrivacyIsSet = true; +} + +bool ProfileGroup::privacyIsSet() const +{ + return m_PrivacyIsSet; +} + +void ProfileGroup::unsetPrivacy() +{ + m_PrivacyIsSet = false; +} +bool ProfileGroup::isVerified() const +{ + return m_Verified; +} + +void ProfileGroup::setVerified(bool value) +{ + m_Verified = value; + m_VerifiedIsSet = true; +} + +bool ProfileGroup::verifiedIsSet() const +{ + return m_VerifiedIsSet; +} + +void ProfileGroup::unsetVerified() +{ + m_VerifiedIsSet = false; +} +utility::string_t ProfileGroup::getPhotoUrl() const +{ + return m_Photo_url; +} + + +void ProfileGroup::setPhotoUrl(const utility::string_t& value) +{ + m_Photo_url = value; + m_Photo_urlIsSet = true; +} + +bool ProfileGroup::photoUrlIsSet() const +{ + return m_Photo_urlIsSet; +} + +void ProfileGroup::unsetPhoto_url() +{ + m_Photo_urlIsSet = false; +} +int32_t ProfileGroup::getMemberCount() const +{ + return m_Member_count; +} + +void ProfileGroup::setMemberCount(int32_t value) +{ + m_Member_count = value; + m_Member_countIsSet = true; +} + +bool ProfileGroup::memberCountIsSet() const +{ + return m_Member_countIsSet; +} + +void ProfileGroup::unsetMember_count() +{ + m_Member_countIsSet = false; +} +std::shared_ptr ProfileGroup::getRank() const +{ + return m_Rank; +} + + +void ProfileGroup::setRank(const std::shared_ptr& value) +{ + m_Rank = value; + m_RankIsSet = true; +} + +bool ProfileGroup::rankIsSet() const +{ + return m_RankIsSet; +} + +void ProfileGroup::unsetRank() +{ + m_RankIsSet = false; +} +utility::datetime ProfileGroup::getSince() const +{ + return m_Since; +} + + +void ProfileGroup::setSince(const utility::datetime& value) +{ + m_Since = value; + m_SinceIsSet = true; +} + +bool ProfileGroup::sinceIsSet() const +{ + return m_SinceIsSet; +} + +void ProfileGroup::unsetSince() +{ + m_SinceIsSet = false; +} + +} +} + + diff --git a/src/model/RefreshRequest.cpp b/src/model/RefreshRequest.cpp new file mode 100644 index 00000000..3543e614 --- /dev/null +++ b/src/model/RefreshRequest.cpp @@ -0,0 +1,121 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/RefreshRequest.h" + +namespace tribufu { +namespace models { + +RefreshRequest::RefreshRequest() +{ + m_Refresh_token = utility::conversions::to_string_t(""); + m_Refresh_tokenIsSet = false; +} + +RefreshRequest::~RefreshRequest() +{ +} + +void RefreshRequest::validate() +{ + // TODO: implement validation +} + +web::json::value RefreshRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Refresh_tokenIsSet) + { + + val[utility::conversions::to_string_t(U("refresh_token"))] = ModelBase::toJson(m_Refresh_token); + } + + return val; +} + +bool RefreshRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("refresh_token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("refresh_token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); + setRefreshToken(refVal_setRefreshToken); + + } + } + return ok; +} + +void RefreshRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Refresh_tokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("refresh_token")), m_Refresh_token)); + } +} + +bool RefreshRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("refresh_token")))) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("refresh_token"))), refVal_setRefreshToken ); + setRefreshToken(refVal_setRefreshToken); + } + return ok; +} + + +utility::string_t RefreshRequest::getRefreshToken() const +{ + return m_Refresh_token; +} + + +void RefreshRequest::setRefreshToken(const utility::string_t& value) +{ + m_Refresh_token = value; + m_Refresh_tokenIsSet = true; +} + +bool RefreshRequest::refreshTokenIsSet() const +{ + return m_Refresh_tokenIsSet; +} + +void RefreshRequest::unsetRefresh_token() +{ + m_Refresh_tokenIsSet = false; +} + +} +} + + diff --git a/src/model/RegisterRequest.cpp b/src/model/RegisterRequest.cpp new file mode 100644 index 00000000..cbcd5b03 --- /dev/null +++ b/src/model/RegisterRequest.cpp @@ -0,0 +1,268 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/RegisterRequest.h" + +namespace tribufu { +namespace models { + +RegisterRequest::RegisterRequest() +{ + m_Uuid = utility::conversions::to_string_t(""); + m_UuidIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Email = utility::conversions::to_string_t(""); + m_EmailIsSet = false; + m_Password = utility::conversions::to_string_t(""); + m_PasswordIsSet = false; +} + +RegisterRequest::~RegisterRequest() +{ +} + +void RegisterRequest::validate() +{ + // TODO: implement validation +} + +web::json::value RegisterRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_UuidIsSet) + { + + val[utility::conversions::to_string_t(U("uuid"))] = ModelBase::toJson(m_Uuid); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_EmailIsSet) + { + + val[utility::conversions::to_string_t(U("email"))] = ModelBase::toJson(m_Email); + } + if(m_PasswordIsSet) + { + + val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); + } + + return val; +} + +bool RegisterRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("uuid")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); + setUuid(refVal_setUuid); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("email")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("email"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setEmail; + ok &= ModelBase::fromJson(fieldValue, refVal_setEmail); + setEmail(refVal_setEmail); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("password")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); + setPassword(refVal_setPassword); + + } + } + return ok; +} + +void RegisterRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_UuidIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uuid")), m_Uuid)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_EmailIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("email")), m_Email)); + } + if(m_PasswordIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); + } +} + +bool RegisterRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("uuid")))) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uuid"))), refVal_setUuid ); + setUuid(refVal_setUuid); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("email")))) + { + utility::string_t refVal_setEmail; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("email"))), refVal_setEmail ); + setEmail(refVal_setEmail); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); + setPassword(refVal_setPassword); + } + return ok; +} + + +utility::string_t RegisterRequest::getUuid() const +{ + return m_Uuid; +} + + +void RegisterRequest::setUuid(const utility::string_t& value) +{ + m_Uuid = value; + m_UuidIsSet = true; +} + +bool RegisterRequest::uuidIsSet() const +{ + return m_UuidIsSet; +} + +void RegisterRequest::unsetUuid() +{ + m_UuidIsSet = false; +} +utility::string_t RegisterRequest::getName() const +{ + return m_Name; +} + + +void RegisterRequest::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool RegisterRequest::nameIsSet() const +{ + return m_NameIsSet; +} + +void RegisterRequest::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t RegisterRequest::getEmail() const +{ + return m_Email; +} + + +void RegisterRequest::setEmail(const utility::string_t& value) +{ + m_Email = value; + m_EmailIsSet = true; +} + +bool RegisterRequest::emailIsSet() const +{ + return m_EmailIsSet; +} + +void RegisterRequest::unsetEmail() +{ + m_EmailIsSet = false; +} +utility::string_t RegisterRequest::getPassword() const +{ + return m_Password; +} + + +void RegisterRequest::setPassword(const utility::string_t& value) +{ + m_Password = value; + m_PasswordIsSet = true; +} + +bool RegisterRequest::passwordIsSet() const +{ + return m_PasswordIsSet; +} + +void RegisterRequest::unsetPassword() +{ + m_PasswordIsSet = false; +} + +} +} + + diff --git a/src/model/ResponseType.cpp b/src/model/ResponseType.cpp new file mode 100644 index 00000000..be8051c8 --- /dev/null +++ b/src/model/ResponseType.cpp @@ -0,0 +1,118 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/ResponseType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +ResponseType::eResponseType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("code"))) + return ResponseType::eResponseType::ResponseType_CODE; + if (val == utility::conversions::to_string_t(U("token"))) + return ResponseType::eResponseType::ResponseType_TOKEN; + return {}; +} + +EnumUnderlyingType fromEnum(ResponseType::eResponseType e) +{ + switch (e) + { + case ResponseType::eResponseType::ResponseType_CODE: + return U("code"); + case ResponseType::eResponseType::ResponseType_TOKEN: + return U("token"); + default: + break; + } + return {}; +} +} + +ResponseType::ResponseType() +{ +} + +ResponseType::~ResponseType() +{ +} + +void ResponseType::validate() +{ + // TODO: implement validation +} + +web::json::value ResponseType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool ResponseType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void ResponseType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool ResponseType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +ResponseType::eResponseType ResponseType::getValue() const +{ + return m_value; +} + +void ResponseType::setValue(ResponseType::eResponseType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/RevokeRequest.cpp b/src/model/RevokeRequest.cpp new file mode 100644 index 00000000..23d9e2b4 --- /dev/null +++ b/src/model/RevokeRequest.cpp @@ -0,0 +1,169 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/RevokeRequest.h" + +namespace tribufu { +namespace models { + +RevokeRequest::RevokeRequest() +{ + m_Token = utility::conversions::to_string_t(""); + m_TokenIsSet = false; + m_Token_type_hintIsSet = false; +} + +RevokeRequest::~RevokeRequest() +{ +} + +void RevokeRequest::validate() +{ + // TODO: implement validation +} + +web::json::value RevokeRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_TokenIsSet) + { + + val[utility::conversions::to_string_t(U("token"))] = ModelBase::toJson(m_Token); + } + if(m_Token_type_hintIsSet) + { + + val[utility::conversions::to_string_t(U("token_type_hint"))] = ModelBase::toJson(m_Token_type_hint); + } + + return val; +} + +bool RevokeRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setToken); + setToken(refVal_setToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("token_type_hint")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token_type_hint"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setTokenTypeHint; + ok &= ModelBase::fromJson(fieldValue, refVal_setTokenTypeHint); + setTokenTypeHint(refVal_setTokenTypeHint); + + } + } + return ok; +} + +void RevokeRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_TokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("token")), m_Token)); + } + if(m_Token_type_hintIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("token_type_hint")), m_Token_type_hint)); + } +} + +bool RevokeRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("token")))) + { + utility::string_t refVal_setToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("token"))), refVal_setToken ); + setToken(refVal_setToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("token_type_hint")))) + { + std::shared_ptr refVal_setTokenTypeHint; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("token_type_hint"))), refVal_setTokenTypeHint ); + setTokenTypeHint(refVal_setTokenTypeHint); + } + return ok; +} + + +utility::string_t RevokeRequest::getToken() const +{ + return m_Token; +} + + +void RevokeRequest::setToken(const utility::string_t& value) +{ + m_Token = value; + m_TokenIsSet = true; +} + +bool RevokeRequest::tokenIsSet() const +{ + return m_TokenIsSet; +} + +void RevokeRequest::unsetToken() +{ + m_TokenIsSet = false; +} +std::shared_ptr RevokeRequest::getTokenTypeHint() const +{ + return m_Token_type_hint; +} + + +void RevokeRequest::setTokenTypeHint(const std::shared_ptr& value) +{ + m_Token_type_hint = value; + m_Token_type_hintIsSet = true; +} + +bool RevokeRequest::tokenTypeHintIsSet() const +{ + return m_Token_type_hintIsSet; +} + +void RevokeRequest::unsetToken_type_hint() +{ + m_Token_type_hintIsSet = false; +} + +} +} + + diff --git a/src/model/SearchRequest.cpp b/src/model/SearchRequest.cpp new file mode 100644 index 00000000..3768c0a1 --- /dev/null +++ b/src/model/SearchRequest.cpp @@ -0,0 +1,266 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/SearchRequest.h" + +namespace tribufu { +namespace models { + +SearchRequest::SearchRequest() +{ + m_TypeIsSet = false; + m_Query = utility::conversions::to_string_t(""); + m_QueryIsSet = false; + m_Page = 0; + m_PageIsSet = false; + m_Game_id = utility::conversions::to_string_t(""); + m_Game_idIsSet = false; +} + +SearchRequest::~SearchRequest() +{ +} + +void SearchRequest::validate() +{ + // TODO: implement validation +} + +web::json::value SearchRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_TypeIsSet) + { + + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); + } + if(m_QueryIsSet) + { + + val[utility::conversions::to_string_t(U("query"))] = ModelBase::toJson(m_Query); + } + if(m_PageIsSet) + { + + val[utility::conversions::to_string_t(U("page"))] = ModelBase::toJson(m_Page); + } + if(m_Game_idIsSet) + { + + val[utility::conversions::to_string_t(U("game_id"))] = ModelBase::toJson(m_Game_id); + } + + return val; +} + +bool SearchRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromJson(fieldValue, refVal_setType); + setType(refVal_setType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("query")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("query"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setQuery; + ok &= ModelBase::fromJson(fieldValue, refVal_setQuery); + setQuery(refVal_setQuery); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("page")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("page"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPage; + ok &= ModelBase::fromJson(fieldValue, refVal_setPage); + setPage(refVal_setPage); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("game_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setGameId; + ok &= ModelBase::fromJson(fieldValue, refVal_setGameId); + setGameId(refVal_setGameId); + + } + } + return ok; +} + +void SearchRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_TypeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + } + if(m_QueryIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("query")), m_Query)); + } + if(m_PageIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("page")), m_Page)); + } + if(m_Game_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("game_id")), m_Game_id)); + } +} + +bool SearchRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); + setType(refVal_setType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("query")))) + { + utility::string_t refVal_setQuery; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("query"))), refVal_setQuery ); + setQuery(refVal_setQuery); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("page")))) + { + int32_t refVal_setPage; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("page"))), refVal_setPage ); + setPage(refVal_setPage); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("game_id")))) + { + utility::string_t refVal_setGameId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("game_id"))), refVal_setGameId ); + setGameId(refVal_setGameId); + } + return ok; +} + + +std::shared_ptr SearchRequest::getType() const +{ + return m_Type; +} + + +void SearchRequest::setType(const std::shared_ptr& value) +{ + m_Type = value; + m_TypeIsSet = true; +} + +bool SearchRequest::typeIsSet() const +{ + return m_TypeIsSet; +} + +void SearchRequest::unsetType() +{ + m_TypeIsSet = false; +} +utility::string_t SearchRequest::getQuery() const +{ + return m_Query; +} + + +void SearchRequest::setQuery(const utility::string_t& value) +{ + m_Query = value; + m_QueryIsSet = true; +} + +bool SearchRequest::queryIsSet() const +{ + return m_QueryIsSet; +} + +void SearchRequest::unsetQuery() +{ + m_QueryIsSet = false; +} +int32_t SearchRequest::getPage() const +{ + return m_Page; +} + +void SearchRequest::setPage(int32_t value) +{ + m_Page = value; + m_PageIsSet = true; +} + +bool SearchRequest::pageIsSet() const +{ + return m_PageIsSet; +} + +void SearchRequest::unsetPage() +{ + m_PageIsSet = false; +} +utility::string_t SearchRequest::getGameId() const +{ + return m_Game_id; +} + + +void SearchRequest::setGameId(const utility::string_t& value) +{ + m_Game_id = value; + m_Game_idIsSet = true; +} + +bool SearchRequest::gameIdIsSet() const +{ + return m_Game_idIsSet; +} + +void SearchRequest::unsetGame_id() +{ + m_Game_idIsSet = false; +} + +} +} + + diff --git a/src/model/SearchType.cpp b/src/model/SearchType.cpp new file mode 100644 index 00000000..e6e06b65 --- /dev/null +++ b/src/model/SearchType.cpp @@ -0,0 +1,126 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/SearchType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +SearchType::eSearchType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("user"))) + return SearchType::eSearchType::SearchType_USER; + if (val == utility::conversions::to_string_t(U("group"))) + return SearchType::eSearchType::SearchType_GROUP; + if (val == utility::conversions::to_string_t(U("server"))) + return SearchType::eSearchType::SearchType_SERVER; + if (val == utility::conversions::to_string_t(U("cluster"))) + return SearchType::eSearchType::SearchType_CLUSTER; + return {}; +} + +EnumUnderlyingType fromEnum(SearchType::eSearchType e) +{ + switch (e) + { + case SearchType::eSearchType::SearchType_USER: + return U("user"); + case SearchType::eSearchType::SearchType_GROUP: + return U("group"); + case SearchType::eSearchType::SearchType_SERVER: + return U("server"); + case SearchType::eSearchType::SearchType_CLUSTER: + return U("cluster"); + default: + break; + } + return {}; +} +} + +SearchType::SearchType() +{ +} + +SearchType::~SearchType() +{ +} + +void SearchType::validate() +{ + // TODO: implement validation +} + +web::json::value SearchType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool SearchType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void SearchType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool SearchType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +SearchType::eSearchType SearchType::getValue() const +{ + return m_value; +} + +void SearchType::setValue(SearchType::eSearchType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/ServerMetrics.cpp b/src/model/ServerMetrics.cpp new file mode 100644 index 00000000..9b9c8979 --- /dev/null +++ b/src/model/ServerMetrics.cpp @@ -0,0 +1,216 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/ServerMetrics.h" + +namespace tribufu { +namespace models { + +ServerMetrics::ServerMetrics() +{ + m_Server_count = 0; + m_Server_countIsSet = false; + m_Package_count = 0; + m_Package_countIsSet = false; + m_Country_count = 0; + m_Country_countIsSet = false; +} + +ServerMetrics::~ServerMetrics() +{ +} + +void ServerMetrics::validate() +{ + // TODO: implement validation +} + +web::json::value ServerMetrics::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Server_countIsSet) + { + + val[utility::conversions::to_string_t(U("server_count"))] = ModelBase::toJson(m_Server_count); + } + if(m_Package_countIsSet) + { + + val[utility::conversions::to_string_t(U("package_count"))] = ModelBase::toJson(m_Package_count); + } + if(m_Country_countIsSet) + { + + val[utility::conversions::to_string_t(U("country_count"))] = ModelBase::toJson(m_Country_count); + } + + return val; +} + +bool ServerMetrics::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("server_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("server_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setServerCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setServerCount); + setServerCount(refVal_setServerCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("package_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("package_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setPackageCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setPackageCount); + setPackageCount(refVal_setPackageCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("country_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("country_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setCountryCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setCountryCount); + setCountryCount(refVal_setCountryCount); + + } + } + return ok; +} + +void ServerMetrics::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Server_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("server_count")), m_Server_count)); + } + if(m_Package_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("package_count")), m_Package_count)); + } + if(m_Country_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("country_count")), m_Country_count)); + } +} + +bool ServerMetrics::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("server_count")))) + { + int32_t refVal_setServerCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("server_count"))), refVal_setServerCount ); + setServerCount(refVal_setServerCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("package_count")))) + { + int32_t refVal_setPackageCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("package_count"))), refVal_setPackageCount ); + setPackageCount(refVal_setPackageCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("country_count")))) + { + int32_t refVal_setCountryCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("country_count"))), refVal_setCountryCount ); + setCountryCount(refVal_setCountryCount); + } + return ok; +} + + +int32_t ServerMetrics::getServerCount() const +{ + return m_Server_count; +} + +void ServerMetrics::setServerCount(int32_t value) +{ + m_Server_count = value; + m_Server_countIsSet = true; +} + +bool ServerMetrics::serverCountIsSet() const +{ + return m_Server_countIsSet; +} + +void ServerMetrics::unsetServer_count() +{ + m_Server_countIsSet = false; +} +int32_t ServerMetrics::getPackageCount() const +{ + return m_Package_count; +} + +void ServerMetrics::setPackageCount(int32_t value) +{ + m_Package_count = value; + m_Package_countIsSet = true; +} + +bool ServerMetrics::packageCountIsSet() const +{ + return m_Package_countIsSet; +} + +void ServerMetrics::unsetPackage_count() +{ + m_Package_countIsSet = false; +} +int32_t ServerMetrics::getCountryCount() const +{ + return m_Country_count; +} + +void ServerMetrics::setCountryCount(int32_t value) +{ + m_Country_count = value; + m_Country_countIsSet = true; +} + +bool ServerMetrics::countryCountIsSet() const +{ + return m_Country_countIsSet; +} + +void ServerMetrics::unsetCountry_count() +{ + m_Country_countIsSet = false; +} + +} +} + + diff --git a/src/model/ServerStatus.cpp b/src/model/ServerStatus.cpp new file mode 100644 index 00000000..82aba53a --- /dev/null +++ b/src/model/ServerStatus.cpp @@ -0,0 +1,122 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/ServerStatus.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +ServerStatus::eServerStatus toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("unknown"))) + return ServerStatus::eServerStatus::ServerStatus_UNKNOWN; + if (val == utility::conversions::to_string_t(U("offline"))) + return ServerStatus::eServerStatus::ServerStatus_OFFLINE; + if (val == utility::conversions::to_string_t(U("online"))) + return ServerStatus::eServerStatus::ServerStatus_ONLINE; + return {}; +} + +EnumUnderlyingType fromEnum(ServerStatus::eServerStatus e) +{ + switch (e) + { + case ServerStatus::eServerStatus::ServerStatus_UNKNOWN: + return U("unknown"); + case ServerStatus::eServerStatus::ServerStatus_OFFLINE: + return U("offline"); + case ServerStatus::eServerStatus::ServerStatus_ONLINE: + return U("online"); + default: + break; + } + return {}; +} +} + +ServerStatus::ServerStatus() +{ +} + +ServerStatus::~ServerStatus() +{ +} + +void ServerStatus::validate() +{ + // TODO: implement validation +} + +web::json::value ServerStatus::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool ServerStatus::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void ServerStatus::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool ServerStatus::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +ServerStatus::eServerStatus ServerStatus::getValue() const +{ + return m_value; +} + +void ServerStatus::setValue(ServerStatus::eServerStatus const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/Subscription.cpp b/src/model/Subscription.cpp new file mode 100644 index 00000000..ef3e4149 --- /dev/null +++ b/src/model/Subscription.cpp @@ -0,0 +1,413 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/Subscription.h" + +namespace tribufu { +namespace models { + +Subscription::Subscription() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Description = utility::conversions::to_string_t(""); + m_DescriptionIsSet = false; + m_Image_url = utility::conversions::to_string_t(""); + m_Image_urlIsSet = false; + m_PricesIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +Subscription::~Subscription() +{ +} + +void Subscription::validate() +{ + // TODO: implement validation +} + +web::json::value Subscription::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_DescriptionIsSet) + { + + val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description); + } + if(m_Image_urlIsSet) + { + + val[utility::conversions::to_string_t(U("image_url"))] = ModelBase::toJson(m_Image_url); + } + if(m_PricesIsSet) + { + + val[utility::conversions::to_string_t(U("prices"))] = ModelBase::toJson(m_Prices); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool Subscription::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("description")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); + setDescription(refVal_setDescription); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("image_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("image_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setImageUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setImageUrl); + setImageUrl(refVal_setImageUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("prices")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("prices"))); + if(!fieldValue.is_null()) + { + std::map refVal_setPrices; + ok &= ModelBase::fromJson(fieldValue, refVal_setPrices); + setPrices(refVal_setPrices); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void Subscription::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_DescriptionIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("description")), m_Description)); + } + if(m_Image_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("image_url")), m_Image_url)); + } + if(m_PricesIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("prices")), m_Prices)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool Subscription::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("description")))) + { + utility::string_t refVal_setDescription; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("description"))), refVal_setDescription ); + setDescription(refVal_setDescription); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("image_url")))) + { + utility::string_t refVal_setImageUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("image_url"))), refVal_setImageUrl ); + setImageUrl(refVal_setImageUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("prices")))) + { + std::map refVal_setPrices; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("prices"))), refVal_setPrices ); + setPrices(refVal_setPrices); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t Subscription::getId() const +{ + return m_Id; +} + + +void Subscription::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool Subscription::idIsSet() const +{ + return m_IdIsSet; +} + +void Subscription::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t Subscription::getName() const +{ + return m_Name; +} + + +void Subscription::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool Subscription::nameIsSet() const +{ + return m_NameIsSet; +} + +void Subscription::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t Subscription::getDescription() const +{ + return m_Description; +} + + +void Subscription::setDescription(const utility::string_t& value) +{ + m_Description = value; + m_DescriptionIsSet = true; +} + +bool Subscription::descriptionIsSet() const +{ + return m_DescriptionIsSet; +} + +void Subscription::unsetDescription() +{ + m_DescriptionIsSet = false; +} +utility::string_t Subscription::getImageUrl() const +{ + return m_Image_url; +} + + +void Subscription::setImageUrl(const utility::string_t& value) +{ + m_Image_url = value; + m_Image_urlIsSet = true; +} + +bool Subscription::imageUrlIsSet() const +{ + return m_Image_urlIsSet; +} + +void Subscription::unsetImage_url() +{ + m_Image_urlIsSet = false; +} +std::map Subscription::getPrices() const +{ + return m_Prices; +} + +void Subscription::setPrices(std::map value) +{ + m_Prices = value; + m_PricesIsSet = true; +} + +bool Subscription::pricesIsSet() const +{ + return m_PricesIsSet; +} + +void Subscription::unsetPrices() +{ + m_PricesIsSet = false; +} +utility::datetime Subscription::getCreated() const +{ + return m_Created; +} + + +void Subscription::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool Subscription::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void Subscription::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime Subscription::getUpdated() const +{ + return m_Updated; +} + + +void Subscription::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool Subscription::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void Subscription::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/TokenHintType.cpp b/src/model/TokenHintType.cpp new file mode 100644 index 00000000..324e8159 --- /dev/null +++ b/src/model/TokenHintType.cpp @@ -0,0 +1,118 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/TokenHintType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +TokenHintType::eTokenHintType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("access_token"))) + return TokenHintType::eTokenHintType::TokenHintType_ACCESS_TOKEN; + if (val == utility::conversions::to_string_t(U("refresh_token"))) + return TokenHintType::eTokenHintType::TokenHintType_REFRESH_TOKEN; + return {}; +} + +EnumUnderlyingType fromEnum(TokenHintType::eTokenHintType e) +{ + switch (e) + { + case TokenHintType::eTokenHintType::TokenHintType_ACCESS_TOKEN: + return U("access_token"); + case TokenHintType::eTokenHintType::TokenHintType_REFRESH_TOKEN: + return U("refresh_token"); + default: + break; + } + return {}; +} +} + +TokenHintType::TokenHintType() +{ +} + +TokenHintType::~TokenHintType() +{ +} + +void TokenHintType::validate() +{ + // TODO: implement validation +} + +web::json::value TokenHintType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool TokenHintType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void TokenHintType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool TokenHintType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +TokenHintType::eTokenHintType TokenHintType::getValue() const +{ + return m_value; +} + +void TokenHintType::setValue(TokenHintType::eTokenHintType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/TokenRequest.cpp b/src/model/TokenRequest.cpp new file mode 100644 index 00000000..2d2c659c --- /dev/null +++ b/src/model/TokenRequest.cpp @@ -0,0 +1,463 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/TokenRequest.h" + +namespace tribufu { +namespace models { + +TokenRequest::TokenRequest() +{ + m_Grant_typeIsSet = false; + m_Code = utility::conversions::to_string_t(""); + m_CodeIsSet = false; + m_Username = utility::conversions::to_string_t(""); + m_UsernameIsSet = false; + m_Password = utility::conversions::to_string_t(""); + m_PasswordIsSet = false; + m_Refresh_token = utility::conversions::to_string_t(""); + m_Refresh_tokenIsSet = false; + m_Client_id = utility::conversions::to_string_t(""); + m_Client_idIsSet = false; + m_Redirect_uri = utility::conversions::to_string_t(""); + m_Redirect_uriIsSet = false; + m_Code_verifier = utility::conversions::to_string_t(""); + m_Code_verifierIsSet = false; +} + +TokenRequest::~TokenRequest() +{ +} + +void TokenRequest::validate() +{ + // TODO: implement validation +} + +web::json::value TokenRequest::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Grant_typeIsSet) + { + + val[utility::conversions::to_string_t(U("grant_type"))] = ModelBase::toJson(m_Grant_type); + } + if(m_CodeIsSet) + { + + val[utility::conversions::to_string_t(U("code"))] = ModelBase::toJson(m_Code); + } + if(m_UsernameIsSet) + { + + val[utility::conversions::to_string_t(U("username"))] = ModelBase::toJson(m_Username); + } + if(m_PasswordIsSet) + { + + val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); + } + if(m_Refresh_tokenIsSet) + { + + val[utility::conversions::to_string_t(U("refresh_token"))] = ModelBase::toJson(m_Refresh_token); + } + if(m_Client_idIsSet) + { + + val[utility::conversions::to_string_t(U("client_id"))] = ModelBase::toJson(m_Client_id); + } + if(m_Redirect_uriIsSet) + { + + val[utility::conversions::to_string_t(U("redirect_uri"))] = ModelBase::toJson(m_Redirect_uri); + } + if(m_Code_verifierIsSet) + { + + val[utility::conversions::to_string_t(U("code_verifier"))] = ModelBase::toJson(m_Code_verifier); + } + + return val; +} + +bool TokenRequest::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("grant_type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("grant_type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setGrantType; + ok &= ModelBase::fromJson(fieldValue, refVal_setGrantType); + setGrantType(refVal_setGrantType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("code")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCode; + ok &= ModelBase::fromJson(fieldValue, refVal_setCode); + setCode(refVal_setCode); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("username")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("username"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUsername; + ok &= ModelBase::fromJson(fieldValue, refVal_setUsername); + setUsername(refVal_setUsername); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("password")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); + setPassword(refVal_setPassword); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("refresh_token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("refresh_token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); + setRefreshToken(refVal_setRefreshToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("client_id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("client_id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setClientId; + ok &= ModelBase::fromJson(fieldValue, refVal_setClientId); + setClientId(refVal_setClientId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("redirect_uri")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("redirect_uri"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRedirectUri; + ok &= ModelBase::fromJson(fieldValue, refVal_setRedirectUri); + setRedirectUri(refVal_setRedirectUri); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("code_verifier")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code_verifier"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCodeVerifier; + ok &= ModelBase::fromJson(fieldValue, refVal_setCodeVerifier); + setCodeVerifier(refVal_setCodeVerifier); + + } + } + return ok; +} + +void TokenRequest::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Grant_typeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("grant_type")), m_Grant_type)); + } + if(m_CodeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code")), m_Code)); + } + if(m_UsernameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("username")), m_Username)); + } + if(m_PasswordIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); + } + if(m_Refresh_tokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("refresh_token")), m_Refresh_token)); + } + if(m_Client_idIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("client_id")), m_Client_id)); + } + if(m_Redirect_uriIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("redirect_uri")), m_Redirect_uri)); + } + if(m_Code_verifierIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code_verifier")), m_Code_verifier)); + } +} + +bool TokenRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("grant_type")))) + { + std::shared_ptr refVal_setGrantType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("grant_type"))), refVal_setGrantType ); + setGrantType(refVal_setGrantType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("code")))) + { + utility::string_t refVal_setCode; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code"))), refVal_setCode ); + setCode(refVal_setCode); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("username")))) + { + utility::string_t refVal_setUsername; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("username"))), refVal_setUsername ); + setUsername(refVal_setUsername); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) + { + utility::string_t refVal_setPassword; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); + setPassword(refVal_setPassword); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("refresh_token")))) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("refresh_token"))), refVal_setRefreshToken ); + setRefreshToken(refVal_setRefreshToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("client_id")))) + { + utility::string_t refVal_setClientId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("client_id"))), refVal_setClientId ); + setClientId(refVal_setClientId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("redirect_uri")))) + { + utility::string_t refVal_setRedirectUri; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("redirect_uri"))), refVal_setRedirectUri ); + setRedirectUri(refVal_setRedirectUri); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("code_verifier")))) + { + utility::string_t refVal_setCodeVerifier; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code_verifier"))), refVal_setCodeVerifier ); + setCodeVerifier(refVal_setCodeVerifier); + } + return ok; +} + + +std::shared_ptr TokenRequest::getGrantType() const +{ + return m_Grant_type; +} + + +void TokenRequest::setGrantType(const std::shared_ptr& value) +{ + m_Grant_type = value; + m_Grant_typeIsSet = true; +} + +bool TokenRequest::grantTypeIsSet() const +{ + return m_Grant_typeIsSet; +} + +void TokenRequest::unsetGrant_type() +{ + m_Grant_typeIsSet = false; +} +utility::string_t TokenRequest::getCode() const +{ + return m_Code; +} + + +void TokenRequest::setCode(const utility::string_t& value) +{ + m_Code = value; + m_CodeIsSet = true; +} + +bool TokenRequest::codeIsSet() const +{ + return m_CodeIsSet; +} + +void TokenRequest::unsetCode() +{ + m_CodeIsSet = false; +} +utility::string_t TokenRequest::getUsername() const +{ + return m_Username; +} + + +void TokenRequest::setUsername(const utility::string_t& value) +{ + m_Username = value; + m_UsernameIsSet = true; +} + +bool TokenRequest::usernameIsSet() const +{ + return m_UsernameIsSet; +} + +void TokenRequest::unsetUsername() +{ + m_UsernameIsSet = false; +} +utility::string_t TokenRequest::getPassword() const +{ + return m_Password; +} + + +void TokenRequest::setPassword(const utility::string_t& value) +{ + m_Password = value; + m_PasswordIsSet = true; +} + +bool TokenRequest::passwordIsSet() const +{ + return m_PasswordIsSet; +} + +void TokenRequest::unsetPassword() +{ + m_PasswordIsSet = false; +} +utility::string_t TokenRequest::getRefreshToken() const +{ + return m_Refresh_token; +} + + +void TokenRequest::setRefreshToken(const utility::string_t& value) +{ + m_Refresh_token = value; + m_Refresh_tokenIsSet = true; +} + +bool TokenRequest::refreshTokenIsSet() const +{ + return m_Refresh_tokenIsSet; +} + +void TokenRequest::unsetRefresh_token() +{ + m_Refresh_tokenIsSet = false; +} +utility::string_t TokenRequest::getClientId() const +{ + return m_Client_id; +} + + +void TokenRequest::setClientId(const utility::string_t& value) +{ + m_Client_id = value; + m_Client_idIsSet = true; +} + +bool TokenRequest::clientIdIsSet() const +{ + return m_Client_idIsSet; +} + +void TokenRequest::unsetClient_id() +{ + m_Client_idIsSet = false; +} +utility::string_t TokenRequest::getRedirectUri() const +{ + return m_Redirect_uri; +} + + +void TokenRequest::setRedirectUri(const utility::string_t& value) +{ + m_Redirect_uri = value; + m_Redirect_uriIsSet = true; +} + +bool TokenRequest::redirectUriIsSet() const +{ + return m_Redirect_uriIsSet; +} + +void TokenRequest::unsetRedirect_uri() +{ + m_Redirect_uriIsSet = false; +} +utility::string_t TokenRequest::getCodeVerifier() const +{ + return m_Code_verifier; +} + + +void TokenRequest::setCodeVerifier(const utility::string_t& value) +{ + m_Code_verifier = value; + m_Code_verifierIsSet = true; +} + +bool TokenRequest::codeVerifierIsSet() const +{ + return m_Code_verifierIsSet; +} + +void TokenRequest::unsetCode_verifier() +{ + m_Code_verifierIsSet = false; +} + +} +} + + diff --git a/src/model/TokenResponse.cpp b/src/model/TokenResponse.cpp new file mode 100644 index 00000000..22854714 --- /dev/null +++ b/src/model/TokenResponse.cpp @@ -0,0 +1,364 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/TokenResponse.h" + +namespace tribufu { +namespace models { + +TokenResponse::TokenResponse() +{ + m_Token_typeIsSet = false; + m_Access_token = utility::conversions::to_string_t(""); + m_Access_tokenIsSet = false; + m_Refresh_token = utility::conversions::to_string_t(""); + m_Refresh_tokenIsSet = false; + m_Scope = utility::conversions::to_string_t(""); + m_ScopeIsSet = false; + m_State = utility::conversions::to_string_t(""); + m_StateIsSet = false; + m_Expires_in = 0L; + m_Expires_inIsSet = false; +} + +TokenResponse::~TokenResponse() +{ +} + +void TokenResponse::validate() +{ + // TODO: implement validation +} + +web::json::value TokenResponse::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Token_typeIsSet) + { + + val[utility::conversions::to_string_t(U("token_type"))] = ModelBase::toJson(m_Token_type); + } + if(m_Access_tokenIsSet) + { + + val[utility::conversions::to_string_t(U("access_token"))] = ModelBase::toJson(m_Access_token); + } + if(m_Refresh_tokenIsSet) + { + + val[utility::conversions::to_string_t(U("refresh_token"))] = ModelBase::toJson(m_Refresh_token); + } + if(m_ScopeIsSet) + { + + val[utility::conversions::to_string_t(U("scope"))] = ModelBase::toJson(m_Scope); + } + if(m_StateIsSet) + { + + val[utility::conversions::to_string_t(U("state"))] = ModelBase::toJson(m_State); + } + if(m_Expires_inIsSet) + { + + val[utility::conversions::to_string_t(U("expires_in"))] = ModelBase::toJson(m_Expires_in); + } + + return val; +} + +bool TokenResponse::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("token_type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token_type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setTokenType; + ok &= ModelBase::fromJson(fieldValue, refVal_setTokenType); + setTokenType(refVal_setTokenType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("access_token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("access_token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setAccessToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setAccessToken); + setAccessToken(refVal_setAccessToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("refresh_token")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("refresh_token"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); + setRefreshToken(refVal_setRefreshToken); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("scope")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("scope"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setScope; + ok &= ModelBase::fromJson(fieldValue, refVal_setScope); + setScope(refVal_setScope); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("state")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("state"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setState; + ok &= ModelBase::fromJson(fieldValue, refVal_setState); + setState(refVal_setState); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("expires_in")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("expires_in"))); + if(!fieldValue.is_null()) + { + int64_t refVal_setExpiresIn; + ok &= ModelBase::fromJson(fieldValue, refVal_setExpiresIn); + setExpiresIn(refVal_setExpiresIn); + + } + } + return ok; +} + +void TokenResponse::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Token_typeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("token_type")), m_Token_type)); + } + if(m_Access_tokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("access_token")), m_Access_token)); + } + if(m_Refresh_tokenIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("refresh_token")), m_Refresh_token)); + } + if(m_ScopeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("scope")), m_Scope)); + } + if(m_StateIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("state")), m_State)); + } + if(m_Expires_inIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("expires_in")), m_Expires_in)); + } +} + +bool TokenResponse::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("token_type")))) + { + std::shared_ptr refVal_setTokenType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("token_type"))), refVal_setTokenType ); + setTokenType(refVal_setTokenType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("access_token")))) + { + utility::string_t refVal_setAccessToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("access_token"))), refVal_setAccessToken ); + setAccessToken(refVal_setAccessToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("refresh_token")))) + { + utility::string_t refVal_setRefreshToken; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("refresh_token"))), refVal_setRefreshToken ); + setRefreshToken(refVal_setRefreshToken); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("scope")))) + { + utility::string_t refVal_setScope; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("scope"))), refVal_setScope ); + setScope(refVal_setScope); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("state")))) + { + utility::string_t refVal_setState; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("state"))), refVal_setState ); + setState(refVal_setState); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("expires_in")))) + { + int64_t refVal_setExpiresIn; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("expires_in"))), refVal_setExpiresIn ); + setExpiresIn(refVal_setExpiresIn); + } + return ok; +} + + +std::shared_ptr TokenResponse::getTokenType() const +{ + return m_Token_type; +} + + +void TokenResponse::setTokenType(const std::shared_ptr& value) +{ + m_Token_type = value; + m_Token_typeIsSet = true; +} + +bool TokenResponse::tokenTypeIsSet() const +{ + return m_Token_typeIsSet; +} + +void TokenResponse::unsetToken_type() +{ + m_Token_typeIsSet = false; +} +utility::string_t TokenResponse::getAccessToken() const +{ + return m_Access_token; +} + + +void TokenResponse::setAccessToken(const utility::string_t& value) +{ + m_Access_token = value; + m_Access_tokenIsSet = true; +} + +bool TokenResponse::accessTokenIsSet() const +{ + return m_Access_tokenIsSet; +} + +void TokenResponse::unsetAccess_token() +{ + m_Access_tokenIsSet = false; +} +utility::string_t TokenResponse::getRefreshToken() const +{ + return m_Refresh_token; +} + + +void TokenResponse::setRefreshToken(const utility::string_t& value) +{ + m_Refresh_token = value; + m_Refresh_tokenIsSet = true; +} + +bool TokenResponse::refreshTokenIsSet() const +{ + return m_Refresh_tokenIsSet; +} + +void TokenResponse::unsetRefresh_token() +{ + m_Refresh_tokenIsSet = false; +} +utility::string_t TokenResponse::getScope() const +{ + return m_Scope; +} + + +void TokenResponse::setScope(const utility::string_t& value) +{ + m_Scope = value; + m_ScopeIsSet = true; +} + +bool TokenResponse::scopeIsSet() const +{ + return m_ScopeIsSet; +} + +void TokenResponse::unsetScope() +{ + m_ScopeIsSet = false; +} +utility::string_t TokenResponse::getState() const +{ + return m_State; +} + + +void TokenResponse::setState(const utility::string_t& value) +{ + m_State = value; + m_StateIsSet = true; +} + +bool TokenResponse::stateIsSet() const +{ + return m_StateIsSet; +} + +void TokenResponse::unsetState() +{ + m_StateIsSet = false; +} +int64_t TokenResponse::getExpiresIn() const +{ + return m_Expires_in; +} + +void TokenResponse::setExpiresIn(int64_t value) +{ + m_Expires_in = value; + m_Expires_inIsSet = true; +} + +bool TokenResponse::expiresInIsSet() const +{ + return m_Expires_inIsSet; +} + +void TokenResponse::unsetExpires_in() +{ + m_Expires_inIsSet = false; +} + +} +} + + diff --git a/src/model/TokenType.cpp b/src/model/TokenType.cpp new file mode 100644 index 00000000..32de1016 --- /dev/null +++ b/src/model/TokenType.cpp @@ -0,0 +1,114 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/TokenType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +TokenType::eTokenType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("bearer"))) + return TokenType::eTokenType::TokenType_BEARER; + return {}; +} + +EnumUnderlyingType fromEnum(TokenType::eTokenType e) +{ + switch (e) + { + case TokenType::eTokenType::TokenType_BEARER: + return U("bearer"); + default: + break; + } + return {}; +} +} + +TokenType::TokenType() +{ +} + +TokenType::~TokenType() +{ +} + +void TokenType::validate() +{ + // TODO: implement validation +} + +web::json::value TokenType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool TokenType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void TokenType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool TokenType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +TokenType::eTokenType TokenType::getValue() const +{ + return m_value; +} + +void TokenType::setValue(TokenType::eTokenType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/model/UpdateProfile.cpp b/src/model/UpdateProfile.cpp new file mode 100644 index 00000000..19f607c8 --- /dev/null +++ b/src/model/UpdateProfile.cpp @@ -0,0 +1,170 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/UpdateProfile.h" + +namespace tribufu { +namespace models { + +UpdateProfile::UpdateProfile() +{ + m_Display_name = utility::conversions::to_string_t(""); + m_Display_nameIsSet = false; + m_Biography = utility::conversions::to_string_t(""); + m_BiographyIsSet = false; +} + +UpdateProfile::~UpdateProfile() +{ +} + +void UpdateProfile::validate() +{ + // TODO: implement validation +} + +web::json::value UpdateProfile::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_Display_nameIsSet) + { + + val[utility::conversions::to_string_t(U("display_name"))] = ModelBase::toJson(m_Display_name); + } + if(m_BiographyIsSet) + { + + val[utility::conversions::to_string_t(U("biography"))] = ModelBase::toJson(m_Biography); + } + + return val; +} + +bool UpdateProfile::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("display_name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("display_name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); + setDisplayName(refVal_setDisplayName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("biography")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("biography"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBiography; + ok &= ModelBase::fromJson(fieldValue, refVal_setBiography); + setBiography(refVal_setBiography); + + } + } + return ok; +} + +void UpdateProfile::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_Display_nameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("display_name")), m_Display_name)); + } + if(m_BiographyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("biography")), m_Biography)); + } +} + +bool UpdateProfile::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("display_name")))) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("display_name"))), refVal_setDisplayName ); + setDisplayName(refVal_setDisplayName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("biography")))) + { + utility::string_t refVal_setBiography; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("biography"))), refVal_setBiography ); + setBiography(refVal_setBiography); + } + return ok; +} + + +utility::string_t UpdateProfile::getDisplayName() const +{ + return m_Display_name; +} + + +void UpdateProfile::setDisplayName(const utility::string_t& value) +{ + m_Display_name = value; + m_Display_nameIsSet = true; +} + +bool UpdateProfile::displayNameIsSet() const +{ + return m_Display_nameIsSet; +} + +void UpdateProfile::unsetDisplay_name() +{ + m_Display_nameIsSet = false; +} +utility::string_t UpdateProfile::getBiography() const +{ + return m_Biography; +} + + +void UpdateProfile::setBiography(const utility::string_t& value) +{ + m_Biography = value; + m_BiographyIsSet = true; +} + +bool UpdateProfile::biographyIsSet() const +{ + return m_BiographyIsSet; +} + +void UpdateProfile::unsetBiography() +{ + m_BiographyIsSet = false; +} + +} +} + + diff --git a/src/model/UserInfo.cpp b/src/model/UserInfo.cpp new file mode 100644 index 00000000..bf5efb35 --- /dev/null +++ b/src/model/UserInfo.cpp @@ -0,0 +1,1289 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/UserInfo.h" + +namespace tribufu { +namespace models { + +UserInfo::UserInfo() +{ + m_Id = utility::conversions::to_string_t(""); + m_IdIsSet = false; + m_Uuid = utility::conversions::to_string_t(""); + m_UuidIsSet = false; + m_Name = utility::conversions::to_string_t(""); + m_NameIsSet = false; + m_Display_name = utility::conversions::to_string_t(""); + m_Display_nameIsSet = false; + m_Email = utility::conversions::to_string_t(""); + m_EmailIsSet = false; + m_TypeIsSet = false; + m_Flags = utility::conversions::to_string_t(""); + m_FlagsIsSet = false; + m_Permissions = utility::conversions::to_string_t(""); + m_PermissionsIsSet = false; + m_Verified = false; + m_VerifiedIsSet = false; + m_Level = 0; + m_LevelIsSet = false; + m_Experience = 0.0; + m_ExperienceIsSet = false; + m_Public_birthday = false; + m_Public_birthdayIsSet = false; + m_BirthdayIsSet = false; + m_Points = 0.0; + m_PointsIsSet = false; + m_Location = utility::conversions::to_string_t(""); + m_LocationIsSet = false; + m_Language = utility::conversions::to_string_t(""); + m_LanguageIsSet = false; + m_Timezone = utility::conversions::to_string_t(""); + m_TimezoneIsSet = false; + m_Currency = utility::conversions::to_string_t(""); + m_CurrencyIsSet = false; + m_Photo_url = utility::conversions::to_string_t(""); + m_Photo_urlIsSet = false; + m_Banner_url = utility::conversions::to_string_t(""); + m_Banner_urlIsSet = false; + m_Last_online = utility::datetime(); + m_Last_onlineIsSet = false; + m_Biography = utility::conversions::to_string_t(""); + m_BiographyIsSet = false; + m_View_count = 0; + m_View_countIsSet = false; + m_Created = utility::datetime(); + m_CreatedIsSet = false; + m_Updated = utility::datetime(); + m_UpdatedIsSet = false; +} + +UserInfo::~UserInfo() +{ +} + +void UserInfo::validate() +{ + // TODO: implement validation +} + +web::json::value UserInfo::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_IdIsSet) + { + + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + } + if(m_UuidIsSet) + { + + val[utility::conversions::to_string_t(U("uuid"))] = ModelBase::toJson(m_Uuid); + } + if(m_NameIsSet) + { + + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + } + if(m_Display_nameIsSet) + { + + val[utility::conversions::to_string_t(U("display_name"))] = ModelBase::toJson(m_Display_name); + } + if(m_EmailIsSet) + { + + val[utility::conversions::to_string_t(U("email"))] = ModelBase::toJson(m_Email); + } + if(m_TypeIsSet) + { + + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); + } + if(m_FlagsIsSet) + { + + val[utility::conversions::to_string_t(U("flags"))] = ModelBase::toJson(m_Flags); + } + if(m_PermissionsIsSet) + { + + val[utility::conversions::to_string_t(U("permissions"))] = ModelBase::toJson(m_Permissions); + } + if(m_VerifiedIsSet) + { + + val[utility::conversions::to_string_t(U("verified"))] = ModelBase::toJson(m_Verified); + } + if(m_LevelIsSet) + { + + val[utility::conversions::to_string_t(U("level"))] = ModelBase::toJson(m_Level); + } + if(m_ExperienceIsSet) + { + + val[utility::conversions::to_string_t(U("experience"))] = ModelBase::toJson(m_Experience); + } + if(m_Public_birthdayIsSet) + { + + val[utility::conversions::to_string_t(U("public_birthday"))] = ModelBase::toJson(m_Public_birthday); + } + if(m_BirthdayIsSet) + { + + val[utility::conversions::to_string_t(U("birthday"))] = ModelBase::toJson(m_Birthday); + } + if(m_PointsIsSet) + { + + val[utility::conversions::to_string_t(U("points"))] = ModelBase::toJson(m_Points); + } + if(m_LocationIsSet) + { + + val[utility::conversions::to_string_t(U("location"))] = ModelBase::toJson(m_Location); + } + if(m_LanguageIsSet) + { + + val[utility::conversions::to_string_t(U("language"))] = ModelBase::toJson(m_Language); + } + if(m_TimezoneIsSet) + { + + val[utility::conversions::to_string_t(U("timezone"))] = ModelBase::toJson(m_Timezone); + } + if(m_CurrencyIsSet) + { + + val[utility::conversions::to_string_t(U("currency"))] = ModelBase::toJson(m_Currency); + } + if(m_Photo_urlIsSet) + { + + val[utility::conversions::to_string_t(U("photo_url"))] = ModelBase::toJson(m_Photo_url); + } + if(m_Banner_urlIsSet) + { + + val[utility::conversions::to_string_t(U("banner_url"))] = ModelBase::toJson(m_Banner_url); + } + if(m_Last_onlineIsSet) + { + + val[utility::conversions::to_string_t(U("last_online"))] = ModelBase::toJson(m_Last_online); + } + if(m_BiographyIsSet) + { + + val[utility::conversions::to_string_t(U("biography"))] = ModelBase::toJson(m_Biography); + } + if(m_View_countIsSet) + { + + val[utility::conversions::to_string_t(U("view_count"))] = ModelBase::toJson(m_View_count); + } + if(m_CreatedIsSet) + { + + val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created); + } + if(m_UpdatedIsSet) + { + + val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated); + } + + return val; +} + +bool UserInfo::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(U("id")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromJson(fieldValue, refVal_setId); + setId(refVal_setId); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("uuid")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); + setUuid(refVal_setUuid); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromJson(fieldValue, refVal_setName); + setName(refVal_setName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("display_name")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("display_name"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); + setDisplayName(refVal_setDisplayName); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("email")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("email"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setEmail; + ok &= ModelBase::fromJson(fieldValue, refVal_setEmail); + setEmail(refVal_setEmail); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("type")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); + if(!fieldValue.is_null()) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromJson(fieldValue, refVal_setType); + setType(refVal_setType); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("flags")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("flags"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setFlags; + ok &= ModelBase::fromJson(fieldValue, refVal_setFlags); + setFlags(refVal_setFlags); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("permissions")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("permissions"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPermissions; + ok &= ModelBase::fromJson(fieldValue, refVal_setPermissions); + setPermissions(refVal_setPermissions); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("verified")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("verified"))); + if(!fieldValue.is_null()) + { + bool refVal_setVerified; + ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); + setVerified(refVal_setVerified); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("level")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("level"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setLevel; + ok &= ModelBase::fromJson(fieldValue, refVal_setLevel); + setLevel(refVal_setLevel); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("experience")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("experience"))); + if(!fieldValue.is_null()) + { + double refVal_setExperience; + ok &= ModelBase::fromJson(fieldValue, refVal_setExperience); + setExperience(refVal_setExperience); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("public_birthday")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("public_birthday"))); + if(!fieldValue.is_null()) + { + bool refVal_setPublicBirthday; + ok &= ModelBase::fromJson(fieldValue, refVal_setPublicBirthday); + setPublicBirthday(refVal_setPublicBirthday); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("birthday")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("birthday"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setBirthday; + ok &= ModelBase::fromJson(fieldValue, refVal_setBirthday); + setBirthday(refVal_setBirthday); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("points")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("points"))); + if(!fieldValue.is_null()) + { + double refVal_setPoints; + ok &= ModelBase::fromJson(fieldValue, refVal_setPoints); + setPoints(refVal_setPoints); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("location")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("location"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLocation; + ok &= ModelBase::fromJson(fieldValue, refVal_setLocation); + setLocation(refVal_setLocation); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("language")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("language"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setLanguage; + ok &= ModelBase::fromJson(fieldValue, refVal_setLanguage); + setLanguage(refVal_setLanguage); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("timezone")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("timezone"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setTimezone; + ok &= ModelBase::fromJson(fieldValue, refVal_setTimezone); + setTimezone(refVal_setTimezone); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("currency")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("currency"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setCurrency; + ok &= ModelBase::fromJson(fieldValue, refVal_setCurrency); + setCurrency(refVal_setCurrency); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("photo_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photo_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); + setPhotoUrl(refVal_setPhotoUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("banner_url")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("banner_url"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); + setBannerUrl(refVal_setBannerUrl); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("last_online")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_online"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); + setLastOnline(refVal_setLastOnline); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("biography")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("biography"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setBiography; + ok &= ModelBase::fromJson(fieldValue, refVal_setBiography); + setBiography(refVal_setBiography); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("view_count")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("view_count"))); + if(!fieldValue.is_null()) + { + int32_t refVal_setViewCount; + ok &= ModelBase::fromJson(fieldValue, refVal_setViewCount); + setViewCount(refVal_setViewCount); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("created")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); + setCreated(refVal_setCreated); + + } + } + if(val.has_field(utility::conversions::to_string_t(U("updated")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated"))); + if(!fieldValue.is_null()) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); + setUpdated(refVal_setUpdated); + + } + } + return ok; +} + +void UserInfo::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + if(m_IdIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } + if(m_UuidIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("uuid")), m_Uuid)); + } + if(m_NameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } + if(m_Display_nameIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("display_name")), m_Display_name)); + } + if(m_EmailIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("email")), m_Email)); + } + if(m_TypeIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + } + if(m_FlagsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("flags")), m_Flags)); + } + if(m_PermissionsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("permissions")), m_Permissions)); + } + if(m_VerifiedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("verified")), m_Verified)); + } + if(m_LevelIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("level")), m_Level)); + } + if(m_ExperienceIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("experience")), m_Experience)); + } + if(m_Public_birthdayIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("public_birthday")), m_Public_birthday)); + } + if(m_BirthdayIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("birthday")), m_Birthday)); + } + if(m_PointsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("points")), m_Points)); + } + if(m_LocationIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("location")), m_Location)); + } + if(m_LanguageIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("language")), m_Language)); + } + if(m_TimezoneIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("timezone")), m_Timezone)); + } + if(m_CurrencyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("currency")), m_Currency)); + } + if(m_Photo_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photo_url")), m_Photo_url)); + } + if(m_Banner_urlIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("banner_url")), m_Banner_url)); + } + if(m_Last_onlineIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("last_online")), m_Last_online)); + } + if(m_BiographyIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("biography")), m_Biography)); + } + if(m_View_countIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("view_count")), m_View_count)); + } + if(m_CreatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("created")), m_Created)); + } + if(m_UpdatedIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("updated")), m_Updated)); + } +} + +bool UserInfo::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + { + namePrefix += utility::conversions::to_string_t(U(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + { + utility::string_t refVal_setId; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + setId(refVal_setId); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("uuid")))) + { + utility::string_t refVal_setUuid; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("uuid"))), refVal_setUuid ); + setUuid(refVal_setUuid); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + { + utility::string_t refVal_setName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + setName(refVal_setName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("display_name")))) + { + utility::string_t refVal_setDisplayName; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("display_name"))), refVal_setDisplayName ); + setDisplayName(refVal_setDisplayName); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("email")))) + { + utility::string_t refVal_setEmail; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("email"))), refVal_setEmail ); + setEmail(refVal_setEmail); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) + { + std::shared_ptr refVal_setType; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); + setType(refVal_setType); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("flags")))) + { + utility::string_t refVal_setFlags; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("flags"))), refVal_setFlags ); + setFlags(refVal_setFlags); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("permissions")))) + { + utility::string_t refVal_setPermissions; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("permissions"))), refVal_setPermissions ); + setPermissions(refVal_setPermissions); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("verified")))) + { + bool refVal_setVerified; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("verified"))), refVal_setVerified ); + setVerified(refVal_setVerified); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("level")))) + { + int32_t refVal_setLevel; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("level"))), refVal_setLevel ); + setLevel(refVal_setLevel); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("experience")))) + { + double refVal_setExperience; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("experience"))), refVal_setExperience ); + setExperience(refVal_setExperience); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("public_birthday")))) + { + bool refVal_setPublicBirthday; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("public_birthday"))), refVal_setPublicBirthday ); + setPublicBirthday(refVal_setPublicBirthday); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("birthday")))) + { + utility::datetime refVal_setBirthday; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("birthday"))), refVal_setBirthday ); + setBirthday(refVal_setBirthday); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("points")))) + { + double refVal_setPoints; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("points"))), refVal_setPoints ); + setPoints(refVal_setPoints); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("location")))) + { + utility::string_t refVal_setLocation; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("location"))), refVal_setLocation ); + setLocation(refVal_setLocation); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("language")))) + { + utility::string_t refVal_setLanguage; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("language"))), refVal_setLanguage ); + setLanguage(refVal_setLanguage); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("timezone")))) + { + utility::string_t refVal_setTimezone; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("timezone"))), refVal_setTimezone ); + setTimezone(refVal_setTimezone); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("currency")))) + { + utility::string_t refVal_setCurrency; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("currency"))), refVal_setCurrency ); + setCurrency(refVal_setCurrency); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("photo_url")))) + { + utility::string_t refVal_setPhotoUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photo_url"))), refVal_setPhotoUrl ); + setPhotoUrl(refVal_setPhotoUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("banner_url")))) + { + utility::string_t refVal_setBannerUrl; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("banner_url"))), refVal_setBannerUrl ); + setBannerUrl(refVal_setBannerUrl); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("last_online")))) + { + utility::datetime refVal_setLastOnline; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("last_online"))), refVal_setLastOnline ); + setLastOnline(refVal_setLastOnline); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("biography")))) + { + utility::string_t refVal_setBiography; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("biography"))), refVal_setBiography ); + setBiography(refVal_setBiography); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("view_count")))) + { + int32_t refVal_setViewCount; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("view_count"))), refVal_setViewCount ); + setViewCount(refVal_setViewCount); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("created")))) + { + utility::datetime refVal_setCreated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("created"))), refVal_setCreated ); + setCreated(refVal_setCreated); + } + if(multipart->hasContent(utility::conversions::to_string_t(U("updated")))) + { + utility::datetime refVal_setUpdated; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("updated"))), refVal_setUpdated ); + setUpdated(refVal_setUpdated); + } + return ok; +} + + +utility::string_t UserInfo::getId() const +{ + return m_Id; +} + + +void UserInfo::setId(const utility::string_t& value) +{ + m_Id = value; + m_IdIsSet = true; +} + +bool UserInfo::idIsSet() const +{ + return m_IdIsSet; +} + +void UserInfo::unsetId() +{ + m_IdIsSet = false; +} +utility::string_t UserInfo::getUuid() const +{ + return m_Uuid; +} + + +void UserInfo::setUuid(const utility::string_t& value) +{ + m_Uuid = value; + m_UuidIsSet = true; +} + +bool UserInfo::uuidIsSet() const +{ + return m_UuidIsSet; +} + +void UserInfo::unsetUuid() +{ + m_UuidIsSet = false; +} +utility::string_t UserInfo::getName() const +{ + return m_Name; +} + + +void UserInfo::setName(const utility::string_t& value) +{ + m_Name = value; + m_NameIsSet = true; +} + +bool UserInfo::nameIsSet() const +{ + return m_NameIsSet; +} + +void UserInfo::unsetName() +{ + m_NameIsSet = false; +} +utility::string_t UserInfo::getDisplayName() const +{ + return m_Display_name; +} + + +void UserInfo::setDisplayName(const utility::string_t& value) +{ + m_Display_name = value; + m_Display_nameIsSet = true; +} + +bool UserInfo::displayNameIsSet() const +{ + return m_Display_nameIsSet; +} + +void UserInfo::unsetDisplay_name() +{ + m_Display_nameIsSet = false; +} +utility::string_t UserInfo::getEmail() const +{ + return m_Email; +} + + +void UserInfo::setEmail(const utility::string_t& value) +{ + m_Email = value; + m_EmailIsSet = true; +} + +bool UserInfo::emailIsSet() const +{ + return m_EmailIsSet; +} + +void UserInfo::unsetEmail() +{ + m_EmailIsSet = false; +} +std::shared_ptr UserInfo::getType() const +{ + return m_Type; +} + + +void UserInfo::setType(const std::shared_ptr& value) +{ + m_Type = value; + m_TypeIsSet = true; +} + +bool UserInfo::typeIsSet() const +{ + return m_TypeIsSet; +} + +void UserInfo::unsetType() +{ + m_TypeIsSet = false; +} +utility::string_t UserInfo::getFlags() const +{ + return m_Flags; +} + + +void UserInfo::setFlags(const utility::string_t& value) +{ + m_Flags = value; + m_FlagsIsSet = true; +} + +bool UserInfo::flagsIsSet() const +{ + return m_FlagsIsSet; +} + +void UserInfo::unsetFlags() +{ + m_FlagsIsSet = false; +} +utility::string_t UserInfo::getPermissions() const +{ + return m_Permissions; +} + + +void UserInfo::setPermissions(const utility::string_t& value) +{ + m_Permissions = value; + m_PermissionsIsSet = true; +} + +bool UserInfo::permissionsIsSet() const +{ + return m_PermissionsIsSet; +} + +void UserInfo::unsetPermissions() +{ + m_PermissionsIsSet = false; +} +bool UserInfo::isVerified() const +{ + return m_Verified; +} + +void UserInfo::setVerified(bool value) +{ + m_Verified = value; + m_VerifiedIsSet = true; +} + +bool UserInfo::verifiedIsSet() const +{ + return m_VerifiedIsSet; +} + +void UserInfo::unsetVerified() +{ + m_VerifiedIsSet = false; +} +int32_t UserInfo::getLevel() const +{ + return m_Level; +} + +void UserInfo::setLevel(int32_t value) +{ + m_Level = value; + m_LevelIsSet = true; +} + +bool UserInfo::levelIsSet() const +{ + return m_LevelIsSet; +} + +void UserInfo::unsetLevel() +{ + m_LevelIsSet = false; +} +double UserInfo::getExperience() const +{ + return m_Experience; +} + +void UserInfo::setExperience(double value) +{ + m_Experience = value; + m_ExperienceIsSet = true; +} + +bool UserInfo::experienceIsSet() const +{ + return m_ExperienceIsSet; +} + +void UserInfo::unsetExperience() +{ + m_ExperienceIsSet = false; +} +bool UserInfo::isPublicBirthday() const +{ + return m_Public_birthday; +} + +void UserInfo::setPublicBirthday(bool value) +{ + m_Public_birthday = value; + m_Public_birthdayIsSet = true; +} + +bool UserInfo::publicBirthdayIsSet() const +{ + return m_Public_birthdayIsSet; +} + +void UserInfo::unsetPublic_birthday() +{ + m_Public_birthdayIsSet = false; +} +utility::datetime UserInfo::getBirthday() const +{ + return m_Birthday; +} + + +void UserInfo::setBirthday(const utility::datetime& value) +{ + m_Birthday = value; + m_BirthdayIsSet = true; +} + +bool UserInfo::birthdayIsSet() const +{ + return m_BirthdayIsSet; +} + +void UserInfo::unsetBirthday() +{ + m_BirthdayIsSet = false; +} +double UserInfo::getPoints() const +{ + return m_Points; +} + +void UserInfo::setPoints(double value) +{ + m_Points = value; + m_PointsIsSet = true; +} + +bool UserInfo::pointsIsSet() const +{ + return m_PointsIsSet; +} + +void UserInfo::unsetPoints() +{ + m_PointsIsSet = false; +} +utility::string_t UserInfo::getLocation() const +{ + return m_Location; +} + + +void UserInfo::setLocation(const utility::string_t& value) +{ + m_Location = value; + m_LocationIsSet = true; +} + +bool UserInfo::locationIsSet() const +{ + return m_LocationIsSet; +} + +void UserInfo::unsetLocation() +{ + m_LocationIsSet = false; +} +utility::string_t UserInfo::getLanguage() const +{ + return m_Language; +} + + +void UserInfo::setLanguage(const utility::string_t& value) +{ + m_Language = value; + m_LanguageIsSet = true; +} + +bool UserInfo::languageIsSet() const +{ + return m_LanguageIsSet; +} + +void UserInfo::unsetLanguage() +{ + m_LanguageIsSet = false; +} +utility::string_t UserInfo::getTimezone() const +{ + return m_Timezone; +} + + +void UserInfo::setTimezone(const utility::string_t& value) +{ + m_Timezone = value; + m_TimezoneIsSet = true; +} + +bool UserInfo::timezoneIsSet() const +{ + return m_TimezoneIsSet; +} + +void UserInfo::unsetTimezone() +{ + m_TimezoneIsSet = false; +} +utility::string_t UserInfo::getCurrency() const +{ + return m_Currency; +} + + +void UserInfo::setCurrency(const utility::string_t& value) +{ + m_Currency = value; + m_CurrencyIsSet = true; +} + +bool UserInfo::currencyIsSet() const +{ + return m_CurrencyIsSet; +} + +void UserInfo::unsetCurrency() +{ + m_CurrencyIsSet = false; +} +utility::string_t UserInfo::getPhotoUrl() const +{ + return m_Photo_url; +} + + +void UserInfo::setPhotoUrl(const utility::string_t& value) +{ + m_Photo_url = value; + m_Photo_urlIsSet = true; +} + +bool UserInfo::photoUrlIsSet() const +{ + return m_Photo_urlIsSet; +} + +void UserInfo::unsetPhoto_url() +{ + m_Photo_urlIsSet = false; +} +utility::string_t UserInfo::getBannerUrl() const +{ + return m_Banner_url; +} + + +void UserInfo::setBannerUrl(const utility::string_t& value) +{ + m_Banner_url = value; + m_Banner_urlIsSet = true; +} + +bool UserInfo::bannerUrlIsSet() const +{ + return m_Banner_urlIsSet; +} + +void UserInfo::unsetBanner_url() +{ + m_Banner_urlIsSet = false; +} +utility::datetime UserInfo::getLastOnline() const +{ + return m_Last_online; +} + + +void UserInfo::setLastOnline(const utility::datetime& value) +{ + m_Last_online = value; + m_Last_onlineIsSet = true; +} + +bool UserInfo::lastOnlineIsSet() const +{ + return m_Last_onlineIsSet; +} + +void UserInfo::unsetLast_online() +{ + m_Last_onlineIsSet = false; +} +utility::string_t UserInfo::getBiography() const +{ + return m_Biography; +} + + +void UserInfo::setBiography(const utility::string_t& value) +{ + m_Biography = value; + m_BiographyIsSet = true; +} + +bool UserInfo::biographyIsSet() const +{ + return m_BiographyIsSet; +} + +void UserInfo::unsetBiography() +{ + m_BiographyIsSet = false; +} +int32_t UserInfo::getViewCount() const +{ + return m_View_count; +} + +void UserInfo::setViewCount(int32_t value) +{ + m_View_count = value; + m_View_countIsSet = true; +} + +bool UserInfo::viewCountIsSet() const +{ + return m_View_countIsSet; +} + +void UserInfo::unsetView_count() +{ + m_View_countIsSet = false; +} +utility::datetime UserInfo::getCreated() const +{ + return m_Created; +} + + +void UserInfo::setCreated(const utility::datetime& value) +{ + m_Created = value; + m_CreatedIsSet = true; +} + +bool UserInfo::createdIsSet() const +{ + return m_CreatedIsSet; +} + +void UserInfo::unsetCreated() +{ + m_CreatedIsSet = false; +} +utility::datetime UserInfo::getUpdated() const +{ + return m_Updated; +} + + +void UserInfo::setUpdated(const utility::datetime& value) +{ + m_Updated = value; + m_UpdatedIsSet = true; +} + +bool UserInfo::updatedIsSet() const +{ + return m_UpdatedIsSet; +} + +void UserInfo::unsetUpdated() +{ + m_UpdatedIsSet = false; +} + +} +} + + diff --git a/src/model/UserType.cpp b/src/model/UserType.cpp new file mode 100644 index 00000000..b9284afa --- /dev/null +++ b/src/model/UserType.cpp @@ -0,0 +1,118 @@ +/** + * Tribufu API + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.12.0. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "tribufu++/model/UserType.h" + +namespace tribufu { +namespace models { + +namespace +{ +using EnumUnderlyingType = utility::string_t; + +UserType::eUserType toEnum(const EnumUnderlyingType& val) +{ + if (val == utility::conversions::to_string_t(U("user"))) + return UserType::eUserType::UserType_USER; + if (val == utility::conversions::to_string_t(U("bot"))) + return UserType::eUserType::UserType_BOT; + return {}; +} + +EnumUnderlyingType fromEnum(UserType::eUserType e) +{ + switch (e) + { + case UserType::eUserType::UserType_USER: + return U("user"); + case UserType::eUserType::UserType_BOT: + return U("bot"); + default: + break; + } + return {}; +} +} + +UserType::UserType() +{ +} + +UserType::~UserType() +{ +} + +void UserType::validate() +{ + // TODO: implement validation +} + +web::json::value UserType::toJson() const +{ + auto val = fromEnum(m_value); + return web::json::value(val); +} + +bool UserType::fromJson(const web::json::value& val) +{ + m_value = toEnum(val.as_string()); + return true; +} + +void UserType::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); +} + +bool UserType::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if (!namePrefix.empty() && namePrefix.back() != U('.')) + { + namePrefix.push_back(U('.')); + } + { + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } + } + return ok; +} + +UserType::eUserType UserType::getValue() const +{ + return m_value; +} + +void UserType::setValue(UserType::eUserType const value) +{ + m_value = value; +} + +} +} + + diff --git a/src/premake5.lua b/src/premake5.lua index 04a50aac..1016a83c 100644 --- a/src/premake5.lua +++ b/src/premake5.lua @@ -13,20 +13,19 @@ project "tribufu" { "./**.cpp", "./**.h", - "../include/tribufu/**.h", + "../include/**.h", } vpaths { ["Sources"] = { "./**.cpp" }, - ["Headers"] = { "./**.h", "../include/tribufu/**.h" }, + ["Headers"] = { "./**.h", "../include/**.h" }, } includedirs { "../include", "../vendor/*/include", - "../vendor/*/vendor/*/include", } libdirs @@ -71,14 +70,16 @@ project "tribufu" defines { - "TRIBUFU_WINDOWS", "TRIBUFU_DESKTOP", "TRIBUFU_DYNAMIC", "TRIBUFU_LIBRARY", + "TRIBUFU_WINDOWS", } links { + "bcrypt", + "cpprest_2_10.lib", } prelinkcommands @@ -98,15 +99,16 @@ project "tribufu" defines { - "TRIBUFU_MAC", "TRIBUFU_APPLE", "TRIBUFU_DESKTOP", "TRIBUFU_DYNAMIC", "TRIBUFU_LIBRARY", + "TRIBUFU_MAC", } links { + "crypto", } prelinkcommands @@ -125,15 +127,16 @@ project "tribufu" defines { - "TRIBUFU_LINUX", - "TRIBUFU_UNIX", "TRIBUFU_DESKTOP", "TRIBUFU_DYNAMIC", "TRIBUFU_LIBRARY", + "TRIBUFU_LINUX", + "TRIBUFU_UNIX", } links { + "crypto", } prelinkcommands @@ -153,10 +156,10 @@ project "tribufu" defines { "TRIBUFU_ANDROID", - "TRIBUFU_UNIX", - "TRIBUFU_MOBILE", "TRIBUFU_DYNAMIC", "TRIBUFU_LIBRARY", + "TRIBUFU_MOBILE", + "TRIBUFU_UNIX", } links @@ -206,8 +209,8 @@ project "tribufu" defines { - "TRIBUFU_X86", "TRIBUFU_32BITS", + "TRIBUFU_X86", } filter { "platforms:*-x64" } @@ -215,8 +218,8 @@ project "tribufu" defines { - "TRIBUFU_X64", "TRIBUFU_64BITS", + "TRIBUFU_X64", } filter { "platforms:*-arm64" } @@ -224,6 +227,6 @@ project "tribufu" defines { - "TRIBUFU_ARM64", "TRIBUFU_64BITS", + "TRIBUFU_ARM64", }