From 4ce994a11157c89b390b7724776914d83a0f7fb9 Mon Sep 17 00:00:00 2001 From: Guilherme Werner Date: Wed, 28 May 2025 15:37:13 -0300 Subject: [PATCH] Format c++ files on generation --- include/tribufu++/AnyType.h | 42 +- include/tribufu++/ApiClient.h | 136 +- include/tribufu++/ApiConfiguration.h | 54 +- include/tribufu++/ApiException.h | 45 +- include/tribufu++/HttpContent.h | 58 +- include/tribufu++/IHttpBody.h | 23 +- include/tribufu++/JsonBody.h | 28 +- include/tribufu++/ModelBase.h | 935 +- include/tribufu++/MultipartFormData.h | 46 +- include/tribufu++/Object.h | 49 +- include/tribufu++/api/TribufuGeneratedApi.h | 1453 +- include/tribufu++/model/Account.h | 148 +- include/tribufu++/model/Application.h | 292 +- include/tribufu++/model/ApplicationType.h | 68 +- include/tribufu++/model/AuthorizeRequest.h | 136 +- include/tribufu++/model/CodeChallengeMethod.h | 68 +- include/tribufu++/model/CryptoViewModel.h | 75 +- include/tribufu++/model/Game.h | 486 +- include/tribufu++/model/GameServer.h | 486 +- include/tribufu++/model/GameServerCluster.h | 219 +- include/tribufu++/model/GrantType.h | 72 +- include/tribufu++/model/Group.h | 243 +- include/tribufu++/model/GroupGame.h | 144 +- include/tribufu++/model/GroupMember.h | 160 +- include/tribufu++/model/GroupRank.h | 70 +- include/tribufu++/model/HashViewModel.h | 63 +- include/tribufu++/model/IntrospectRequest.h | 76 +- include/tribufu++/model/IpAddress.h | 267 +- include/tribufu++/model/LeaderboardItem.h | 123 +- include/tribufu++/model/LeaderboardOrder.h | 68 +- include/tribufu++/model/LoginProvider.h | 78 +- include/tribufu++/model/LoginRequest.h | 75 +- include/tribufu++/model/LoginResponse.h | 100 +- include/tribufu++/model/Package.h | 195 +- include/tribufu++/model/Profile.h | 267 +- include/tribufu++/model/ProfileGame.h | 185 +- include/tribufu++/model/ProfileGroup.h | 172 +- include/tribufu++/model/RefreshRequest.h | 63 +- include/tribufu++/model/RegisterRequest.h | 99 +- include/tribufu++/model/ResponseType.h | 68 +- include/tribufu++/model/RevokeRequest.h | 76 +- include/tribufu++/model/SearchRequest.h | 98 +- include/tribufu++/model/SearchType.h | 72 +- include/tribufu++/model/ServerMetrics.h | 88 +- include/tribufu++/model/ServerStatus.h | 70 +- include/tribufu++/model/Subscription.h | 135 +- include/tribufu++/model/TokenHintType.h | 68 +- include/tribufu++/model/TokenRequest.h | 148 +- include/tribufu++/model/TokenResponse.h | 122 +- include/tribufu++/model/TokenType.h | 66 +- include/tribufu++/model/UpdateProfile.h | 75 +- include/tribufu++/model/UserInfo.h | 350 +- include/tribufu++/model/UserType.h | 68 +- scripts/generate.ps1 | 3 + src/AnyType.cpp | 73 +- src/ApiClient.cpp | 318 +- src/ApiConfiguration.cpp | 130 +- src/ApiException.cpp | 57 +- src/HttpContent.cpp | 110 +- src/JsonBody.cpp | 29 +- src/ModelBase.cpp | 1264 +- src/MultipartFormData.cpp | 177 +- src/Object.cpp | 132 +- src/api/TribufuGeneratedApi.cpp | 19857 +++++++++------- src/model/Account.cpp | 851 +- src/model/Application.cpp | 1982 +- src/model/ApplicationType.cpp | 194 +- src/model/AuthorizeRequest.cpp | 767 +- src/model/CodeChallengeMethod.cpp | 194 +- src/model/CryptoViewModel.cpp | 295 +- src/model/Game.cpp | 3016 +-- src/model/GameServer.cpp | 3012 +-- src/model/GameServerCluster.cpp | 1423 +- src/model/GrantType.cpp | 208 +- src/model/Group.cpp | 1603 +- src/model/GroupGame.cpp | 758 +- src/model/GroupMember.cpp | 948 +- src/model/GroupRank.cpp | 200 +- src/model/HashViewModel.cpp | 200 +- src/model/IntrospectRequest.cpp | 294 +- src/model/IpAddress.cpp | 1793 +- src/model/LeaderboardItem.cpp | 668 +- src/model/LeaderboardOrder.cpp | 194 +- src/model/LoginProvider.cpp | 233 +- src/model/LoginRequest.cpp | 294 +- src/model/LoginResponse.cpp | 480 +- src/model/Package.cpp | 1232 +- src/model/Profile.cpp | 1789 +- src/model/ProfileGame.cpp | 1142 +- src/model/ProfileGroup.cpp | 1040 +- src/model/RefreshRequest.cpp | 202 +- src/model/RegisterRequest.cpp | 483 +- src/model/ResponseType.cpp | 193 +- src/model/RevokeRequest.cpp | 293 +- src/model/SearchRequest.cpp | 479 +- src/model/SearchType.cpp | 209 +- src/model/ServerMetrics.cpp | 387 +- src/model/ServerStatus.cpp | 201 +- src/model/Subscription.cpp | 760 +- src/model/TokenHintType.cpp | 193 +- src/model/TokenRequest.cpp | 858 +- src/model/TokenResponse.cpp | 668 +- src/model/TokenType.cpp | 184 +- src/model/UpdateProfile.cpp | 294 +- src/model/UserInfo.cpp | 2445 +- src/model/UserType.cpp | 192 +- 106 files changed, 32592 insertions(+), 31280 deletions(-) diff --git a/include/tribufu++/AnyType.h b/include/tribufu++/AnyType.h index 0a4336e6..10dff4aa 100644 --- a/include/tribufu++/AnyType.h +++ b/include/tribufu++/AnyType.h @@ -19,37 +19,39 @@ #ifndef TRIBUFU_MODELS_AnyType_H_ #define TRIBUFU_MODELS_AnyType_H_ - #include "tribufu++/Object.h" #include #include -namespace tribufu { -namespace models { +namespace tribufu +{ + namespace models + { -class AnyType : public Object { -public: - AnyType(); - virtual ~AnyType(); + class AnyType : public Object + { + public: + AnyType(); + virtual ~AnyType(); - ///////////////////////////////////////////// - /// ModelBase overrides - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides + void validate() override; - web::json::value toJson() const override; - bool fromJson(const web::json::value &json) 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; + 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; -}; + private: + web::json::value m_value; + }; -} + } } #endif /* TRIBUFU_MODELS_AnyType_H_ */ diff --git a/include/tribufu++/ApiClient.h b/include/tribufu++/ApiClient.h index e24111d6..f38c6241 100644 --- a/include/tribufu++/ApiClient.h +++ b/include/tribufu++/ApiClient.h @@ -19,93 +19,87 @@ #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" +#include "tribufu++/IHttpBody.h" -#if defined (_WIN32) || defined (_WIN64) +#if defined(_WIN32) || defined(_WIN64) #undef U #endif #include #include +#include #include #include -#include -namespace tribufu { -namespace api { - -using namespace tribufu::models; - -class ApiClient +namespace tribufu { -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++) + namespace api { - if( i > 0) ss << utility::conversions::to_string_t(", "); - ss << ApiClient::parameterToString(value[i]); + + 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()); + } + } - - 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 index ef87ff14..e9222feb 100644 --- a/include/tribufu++/ApiConfiguration.h +++ b/include/tribufu++/ApiConfiguration.h @@ -19,45 +19,45 @@ #ifndef TRIBUFU_API_ApiConfiguration_H_ #define TRIBUFU_API_ApiConfiguration_H_ - - #include #include #include -namespace tribufu { -namespace api { - -class ApiConfiguration +namespace tribufu { -public: - ApiConfiguration(); - virtual ~ApiConfiguration(); + namespace api + { - const web::http::client::http_client_config& getHttpConfig() const; - void setHttpConfig( web::http::client::http_client_config& value ); + class ApiConfiguration + { + public: + ApiConfiguration(); + virtual ~ApiConfiguration(); - utility::string_t getBaseUrl() const; - void setBaseUrl( const utility::string_t value ); + const web::http::client::http_client_config &getHttpConfig() const; + void setHttpConfig(web::http::client::http_client_config &value); - utility::string_t getUserAgent() const; - void setUserAgent( const utility::string_t value ); + utility::string_t getBaseUrl() const; + void setBaseUrl(const utility::string_t value); - std::map& getDefaultHeaders(); - const std::map& getDefaultHeaders() const; + utility::string_t getUserAgent() const; + void setUserAgent(const utility::string_t value); - utility::string_t getApiKey( const utility::string_t& prefix) const; - void setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey ); + std::map &getDefaultHeaders(); + const std::map &getDefaultHeaders() const; -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; -}; + 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 index 5bb141fc..311e9508 100644 --- a/include/tribufu++/ApiException.h +++ b/include/tribufu++/ApiException.h @@ -19,39 +19,36 @@ #ifndef TRIBUFU_API_ApiException_H_ #define TRIBUFU_API_ApiException_H_ - - #include #include -#include #include +#include -namespace tribufu { -namespace api { - -class ApiException - : public web::http::http_exception +namespace tribufu { -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(); + namespace api + { - std::map& getHeaders(); - std::shared_ptr getContent() const; + 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(); -protected: - std::shared_ptr m_Content; - std::map m_Headers; -}; + 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 index 093b1d81..cc0d305a 100644 --- a/include/tribufu++/HttpContent.h +++ b/include/tribufu++/HttpContent.h @@ -19,48 +19,48 @@ #ifndef TRIBUFU_MODELS_HttpContent_H_ #define TRIBUFU_MODELS_HttpContent_H_ - - #include #include -namespace tribufu { -namespace models { - -class HttpContent +namespace tribufu { -public: - HttpContent(); - virtual ~HttpContent(); + namespace models + { - virtual utility::string_t getContentDisposition() const; - virtual void setContentDisposition( const utility::string_t& value ); + class HttpContent + { + public: + HttpContent(); + virtual ~HttpContent(); - virtual utility::string_t getName() const; - virtual void setName( const utility::string_t& value ); + virtual utility::string_t getContentDisposition() const; + virtual void setContentDisposition(const utility::string_t &value); - virtual utility::string_t getFileName() const; - virtual void setFileName( const utility::string_t& value ); + virtual utility::string_t getName() const; + virtual void setName(const utility::string_t &value); - virtual utility::string_t getContentType() const; - virtual void setContentType( const utility::string_t& value ); + virtual utility::string_t getFileName() const; + virtual void setFileName(const utility::string_t &value); - virtual std::shared_ptr getData() const; - virtual void setData( std::shared_ptr value ); + virtual utility::string_t getContentType() const; + virtual void setContentType(const utility::string_t &value); - virtual void writeTo( std::ostream& stream ); + virtual std::shared_ptr getData() const; + virtual void setData(std::shared_ptr value); -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; -}; + 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 index cdb50fa5..81c768c4 100644 --- a/include/tribufu++/IHttpBody.h +++ b/include/tribufu++/IHttpBody.h @@ -19,21 +19,24 @@ #ifndef TRIBUFU_MODELS_IHttpBody_H_ #define TRIBUFU_MODELS_IHttpBody_H_ - #include -namespace tribufu { -namespace models { - -class IHttpBody +namespace tribufu { -public: - virtual ~IHttpBody() { } + namespace models + { - virtual void writeTo( std::ostream& stream ) = 0; -}; + 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 index ab094917..20870eeb 100644 --- a/include/tribufu++/JsonBody.h +++ b/include/tribufu++/JsonBody.h @@ -19,28 +19,28 @@ #ifndef TRIBUFU_MODELS_JsonBody_H_ #define TRIBUFU_MODELS_JsonBody_H_ - #include "tribufu++/IHttpBody.h" #include -namespace tribufu { -namespace models { - -class JsonBody - : public IHttpBody +namespace tribufu { -public: - JsonBody( const web::json::value& value ); - virtual ~JsonBody(); + namespace models + { - void writeTo( std::ostream& target ) override; + class JsonBody : public IHttpBody + { + public: + JsonBody(const web::json::value &value); + virtual ~JsonBody(); -protected: - web::json::value m_Json; -}; + 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 index cb78e844..e70502e2 100644 --- a/include/tribufu++/ModelBase.h +++ b/include/tribufu++/ModelBase.h @@ -19,8 +19,6 @@ #ifndef TRIBUFU_MODELS_ModelBase_H_ #define TRIBUFU_MODELS_ModelBase_H_ - - #include "tribufu++/HttpContent.h" #include "tribufu++/MultipartFormData.h" @@ -31,472 +29,485 @@ #include #include -namespace tribufu { -namespace models { - -class ModelBase +namespace tribufu { -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 ) + namespace models { - 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()) + class ModelBase { - T item; - ok &= fromJson(jitem, item); - outVal.push_back(item); + 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); } } - 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 index e980a25a..359dd4e1 100644 --- a/include/tribufu++/MultipartFormData.h +++ b/include/tribufu++/MultipartFormData.h @@ -19,40 +19,40 @@ #ifndef TRIBUFU_MODELS_MultipartFormData_H_ #define TRIBUFU_MODELS_MultipartFormData_H_ - -#include "tribufu++/IHttpBody.h" #include "tribufu++/HttpContent.h" +#include "tribufu++/IHttpBody.h" #include -#include #include #include +#include -namespace tribufu { -namespace models { - -class MultipartFormData - : public IHttpBody +namespace tribufu { -public: - MultipartFormData(); - MultipartFormData(const utility::string_t& boundary); - virtual ~MultipartFormData(); + namespace models + { - 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 ); + class MultipartFormData : public IHttpBody + { + public: + MultipartFormData(); + MultipartFormData(const utility::string_t &boundary); + virtual ~MultipartFormData(); -protected: - std::vector> m_Contents; - utility::string_t m_Boundary; - std::map> m_ContentLookup; -}; + 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 index 6f9464e8..5c78fcde 100644 --- a/include/tribufu++/Object.h +++ b/include/tribufu++/Object.h @@ -19,41 +19,44 @@ #ifndef TRIBUFU_MODELS_Object_H_ #define TRIBUFU_MODELS_Object_H_ - #include "tribufu++/ModelBase.h" #include #include -namespace tribufu { -namespace models { - -class Object : public ModelBase +namespace tribufu { -public: - Object(); - virtual ~Object(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides - void validate() override; + class Object : public ModelBase + { + public: + Object(); + virtual ~Object(); - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + ///////////////////////////////////////////// + /// ModelBase overrides + void validate() 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; + web::json::value toJson() const override; + bool fromJson(const web::json::value &json) 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); + 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_object; -}; + ///////////////////////////////////////////// + /// 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 index c295cc2c..6ebd2dae 100644 --- a/include/tribufu++/api/TribufuGeneratedApi.h +++ b/include/tribufu++/api/TribufuGeneratedApi.h @@ -13,18 +13,16 @@ /* * 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/Account.h" #include "tribufu++/model/AuthorizeRequest.h" #include "tribufu++/model/CryptoViewModel.h" #include "tribufu++/model/Game.h" @@ -54,791 +52,686 @@ #include "tribufu++/model/TokenResponse.h" #include "tribufu++/model/UpdateProfile.h" #include "tribufu++/model/UserInfo.h" +#include +#include #include #include -#include -#include -namespace tribufu { -namespace api { - -using namespace tribufu::models; - - - -class TribufuGeneratedApi +namespace tribufu { -public: + namespace api + { - explicit TribufuGeneratedApi( std::shared_ptr apiClient ); + using namespace tribufu::models; - virtual ~TribufuGeneratedApi(); + class TribufuGeneratedApi + { + public: + explicit TribufuGeneratedApi(std::shared_ptr apiClient); - /// - /// 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; + virtual ~TribufuGeneratedApi(); -protected: - std::shared_ptr m_ApiClient; -}; + /// + /// 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 index b1f6e835..f380461d 100644 --- a/include/tribufu++/model/Account.h +++ b/include/tribufu++/model/Account.h @@ -13,7 +13,7 @@ /* * Account.h * - * + * */ #ifndef TRIBUFU_MODELS_Account_H_ @@ -23,108 +23,104 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/AnyType.h" #include "tribufu++/model/LoginProvider.h" +#include -namespace tribufu { -namespace models { - - - -class Account - : public ModelBase +namespace tribufu { -public: - Account(); - virtual ~Account(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Account : public ModelBase + { + public: + Account(); + virtual ~Account(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// Account members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 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); - 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); - 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); - 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + std::shared_ptr m_Provider; + bool m_ProviderIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_User_id; + bool m_User_idIsSet; - std::shared_ptr m_Provider; - bool m_ProviderIsSet; + bool m_Authorized; + bool m_AuthorizedIsSet; - utility::string_t m_User_id; - bool m_User_idIsSet; + std::shared_ptr m_Fields; + bool m_FieldsIsSet; - bool m_Authorized; - bool m_AuthorizedIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - std::shared_ptr m_Fields; - bool m_FieldsIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index f6536520..2cc0a47d 100644 --- a/include/tribufu++/model/Application.h +++ b/include/tribufu++/model/Application.h @@ -13,7 +13,7 @@ /* * Application.h * - * + * */ #ifndef TRIBUFU_MODELS_Application_H_ @@ -23,203 +23,199 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/ApplicationType.h" +#include -namespace tribufu { -namespace models { - - - -class Application - : public ModelBase +namespace tribufu { -public: - Application(); - virtual ~Application(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Application : public ModelBase + { + public: + Application(); + virtual ~Application(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// Application members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 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 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); - 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 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 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 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 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 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 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); - 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); - 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); - 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 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 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 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 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + std::shared_ptr m_Type; + bool m_TypeIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + utility::string_t m_Organization_id; + bool m_Organization_idIsSet; - std::shared_ptr m_Type; - bool m_TypeIsSet; + utility::string_t m_Icon_url; + bool m_Icon_urlIsSet; - utility::string_t m_Organization_id; - bool m_Organization_idIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Icon_url; - bool m_Icon_urlIsSet; + utility::string_t m_Capsule_image_url; + bool m_Capsule_image_urlIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + utility::string_t m_Library_image_url; + bool m_Library_image_urlIsSet; - utility::string_t m_Capsule_image_url; - bool m_Capsule_image_urlIsSet; + utility::string_t m_Parent_id; + bool m_Parent_idIsSet; - utility::string_t m_Library_image_url; - bool m_Library_image_urlIsSet; + utility::string_t m_Slug; + bool m_SlugIsSet; - utility::string_t m_Parent_id; - bool m_Parent_idIsSet; + int32_t m_Visibility; + bool m_VisibilityIsSet; - utility::string_t m_Slug; - bool m_SlugIsSet; + utility::string_t m_Password; + bool m_PasswordIsSet; - int32_t m_Visibility; - bool m_VisibilityIsSet; + int32_t m_Primary; + bool m_PrimaryIsSet; - utility::string_t m_Password; - bool m_PasswordIsSet; + int32_t m_User_count; + bool m_User_countIsSet; - int32_t m_Primary; - bool m_PrimaryIsSet; + int32_t m_Achievement_count; + bool m_Achievement_countIsSet; - int32_t m_User_count; - bool m_User_countIsSet; + int32_t m_Badge_count; + bool m_Badge_countIsSet; - int32_t m_Achievement_count; - bool m_Achievement_countIsSet; + int32_t m_Download_count; + bool m_Download_countIsSet; - int32_t m_Badge_count; - bool m_Badge_countIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_Download_count; - bool m_Download_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index 2349156b..e9353649 100644 --- a/include/tribufu++/model/ApplicationType.h +++ b/include/tribufu++/model/ApplicationType.h @@ -13,52 +13,52 @@ /* * ApplicationType.h * - * + * */ #ifndef TRIBUFU_MODELS_ApplicationType_H_ #define TRIBUFU_MODELS_ApplicationType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class ApplicationType - : public ModelBase +namespace tribufu { -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 + namespace models { - ApplicationType_APPLICATION, - ApplicationType_GAME, - }; - eApplicationType getValue() const; - void setValue(eApplicationType const value); + class ApplicationType : public ModelBase + { + public: + ApplicationType(); + virtual ~ApplicationType(); - protected: - eApplicationType m_value; -}; + ///////////////////////////////////////////// + /// 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 index c4414f30..26928036 100644 --- a/include/tribufu++/model/AuthorizeRequest.h +++ b/include/tribufu++/model/AuthorizeRequest.h @@ -13,7 +13,7 @@ /* * AuthorizeRequest.h * - * + * */ #ifndef TRIBUFU_MODELS_AuthorizeRequest_H_ @@ -23,100 +23,96 @@ #include "tribufu++/ModelBase.h" +#include "tribufu++/model/CodeChallengeMethod.h" #include "tribufu++/model/ResponseType.h" #include -#include "tribufu++/model/CodeChallengeMethod.h" -namespace tribufu { -namespace models { - - - -class AuthorizeRequest - : public ModelBase +namespace tribufu { -public: - AuthorizeRequest(); - virtual ~AuthorizeRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class AuthorizeRequest : public ModelBase + { + public: + AuthorizeRequest(); + virtual ~AuthorizeRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// AuthorizeRequest members + std::shared_ptr getResponseType() const; + bool responseTypeIsSet() const; + void unsetResponse_type(); + void setResponseType(const std::shared_ptr &value); - 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 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); - 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); - 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 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 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); - 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; -protected: - std::shared_ptr m_Response_type; - bool m_Response_typeIsSet; + utility::string_t m_Code_challenge; + bool m_Code_challengeIsSet; - utility::string_t m_Client_id; - bool m_Client_idIsSet; + std::shared_ptr m_Code_challenge_method; + bool m_Code_challenge_methodIsSet; - utility::string_t m_Code_challenge; - bool m_Code_challengeIsSet; + utility::string_t m_Redirect_uri; + bool m_Redirect_uriIsSet; - std::shared_ptr m_Code_challenge_method; - bool m_Code_challenge_methodIsSet; + utility::string_t m_Scope; + bool m_ScopeIsSet; - utility::string_t m_Redirect_uri; - bool m_Redirect_uriIsSet; + utility::string_t m_State; + bool m_StateIsSet; + }; - 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 index 27c64697..9211efc9 100644 --- a/include/tribufu++/model/CodeChallengeMethod.h +++ b/include/tribufu++/model/CodeChallengeMethod.h @@ -13,52 +13,52 @@ /* * CodeChallengeMethod.h * - * + * */ #ifndef TRIBUFU_MODELS_CodeChallengeMethod_H_ #define TRIBUFU_MODELS_CodeChallengeMethod_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class CodeChallengeMethod - : public ModelBase +namespace tribufu { -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 + namespace models { - CodeChallengeMethod_PLAIN, - CodeChallengeMethod_S256, - }; - eCodeChallengeMethod getValue() const; - void setValue(eCodeChallengeMethod const value); + class CodeChallengeMethod : public ModelBase + { + public: + CodeChallengeMethod(); + virtual ~CodeChallengeMethod(); - protected: - eCodeChallengeMethod m_value; -}; + ///////////////////////////////////////////// + /// 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 index 5cb52c71..3ca17382 100644 --- a/include/tribufu++/model/CryptoViewModel.h +++ b/include/tribufu++/model/CryptoViewModel.h @@ -13,67 +13,62 @@ /* * 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 +namespace tribufu { -public: - CryptoViewModel(); - virtual ~CryptoViewModel(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class CryptoViewModel : public ModelBase + { + public: + CryptoViewModel(); + virtual ~CryptoViewModel(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// CryptoViewModel members + utility::string_t getEncoded() const; + bool encodedIsSet() const; + void unsetEncoded(); + void setEncoded(const utility::string_t &value); - 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); - 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; + }; -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 index 21639c81..95125f3e 100644 --- a/include/tribufu++/model/Game.h +++ b/include/tribufu++/model/Game.h @@ -13,7 +13,7 @@ /* * Game.h * - * + * */ #ifndef TRIBUFU_MODELS_Game_H_ @@ -23,291 +23,287 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/ApplicationType.h" +#include -namespace tribufu { -namespace models { - - - -class Game - : public ModelBase +namespace tribufu { -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); + 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 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 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 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 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); - 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 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); - 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; -protected: - int32_t m_Game_port; - bool m_Game_portIsSet; + int32_t m_Rcon_port; + bool m_Rcon_portIsSet; - int32_t m_Query_port; - bool m_Query_portIsSet; + int32_t m_Server_count; + bool m_Server_countIsSet; - int32_t m_Rcon_port; - bool m_Rcon_portIsSet; + int32_t m_Steam_app_id; + bool m_Steam_app_idIsSet; - int32_t m_Server_count; - bool m_Server_countIsSet; + int32_t m_Steam_server_app_id; + bool m_Steam_server_app_idIsSet; - int32_t m_Steam_app_id; - bool m_Steam_app_idIsSet; + bool m_Enable_servers; + bool m_Enable_serversIsSet; - int32_t m_Steam_server_app_id; - bool m_Steam_server_app_idIsSet; + utility::string_t m_Rust_gamedig_id; + bool m_Rust_gamedig_idIsSet; - bool m_Enable_servers; - bool m_Enable_serversIsSet; + utility::string_t m_Node_gamedig_id; + bool m_Node_gamedig_idIsSet; - utility::string_t m_Rust_gamedig_id; - bool m_Rust_gamedig_idIsSet; + utility::string_t m_Server_connect_url; + bool m_Server_connect_urlIsSet; - utility::string_t m_Node_gamedig_id; - bool m_Node_gamedig_idIsSet; + utility::string_t m_Server_tags; + bool m_Server_tagsIsSet; - utility::string_t m_Server_connect_url; - bool m_Server_connect_urlIsSet; + utility::string_t m_Id; + bool m_IdIsSet; - utility::string_t m_Server_tags; - bool m_Server_tagsIsSet; + utility::string_t m_Name; + bool m_NameIsSet; - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + std::shared_ptr m_Type; + bool m_TypeIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + utility::string_t m_Organization_id; + bool m_Organization_idIsSet; - std::shared_ptr m_Type; - bool m_TypeIsSet; + utility::string_t m_Icon_url; + bool m_Icon_urlIsSet; - utility::string_t m_Organization_id; - bool m_Organization_idIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Icon_url; - bool m_Icon_urlIsSet; + utility::string_t m_Capsule_image_url; + bool m_Capsule_image_urlIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + utility::string_t m_Library_image_url; + bool m_Library_image_urlIsSet; - utility::string_t m_Capsule_image_url; - bool m_Capsule_image_urlIsSet; + utility::string_t m_Parent_id; + bool m_Parent_idIsSet; - utility::string_t m_Library_image_url; - bool m_Library_image_urlIsSet; + utility::string_t m_Slug; + bool m_SlugIsSet; - utility::string_t m_Parent_id; - bool m_Parent_idIsSet; + int32_t m_Visibility; + bool m_VisibilityIsSet; - utility::string_t m_Slug; - bool m_SlugIsSet; + utility::string_t m_Password; + bool m_PasswordIsSet; - int32_t m_Visibility; - bool m_VisibilityIsSet; + int32_t m_Primary; + bool m_PrimaryIsSet; - utility::string_t m_Password; - bool m_PasswordIsSet; + int32_t m_User_count; + bool m_User_countIsSet; - int32_t m_Primary; - bool m_PrimaryIsSet; + int32_t m_Achievement_count; + bool m_Achievement_countIsSet; - int32_t m_User_count; - bool m_User_countIsSet; + int32_t m_Badge_count; + bool m_Badge_countIsSet; - int32_t m_Achievement_count; - bool m_Achievement_countIsSet; + int32_t m_Download_count; + bool m_Download_countIsSet; - int32_t m_Badge_count; - bool m_Badge_countIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_Download_count; - bool m_Download_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index b7cd0fbe..61b59afc 100644 --- a/include/tribufu++/model/GameServer.h +++ b/include/tribufu++/model/GameServer.h @@ -13,7 +13,7 @@ /* * GameServer.h * - * + * */ #ifndef TRIBUFU_MODELS_GameServer_H_ @@ -23,291 +23,287 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/ServerStatus.h" +#include -namespace tribufu { -namespace models { - - - -class GameServer - : public ModelBase +namespace tribufu { -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); + 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); - 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 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 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); - 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 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Address; + bool m_AddressIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + int32_t m_Game_port; + bool m_Game_portIsSet; - utility::string_t m_Address; - bool m_AddressIsSet; + int32_t m_Query_port; + bool m_Query_portIsSet; - int32_t m_Game_port; - bool m_Game_portIsSet; + utility::string_t m_Game_id; + bool m_Game_idIsSet; - int32_t m_Query_port; - bool m_Query_portIsSet; + utility::string_t m_Game_icon_url; + bool m_Game_icon_urlIsSet; - utility::string_t m_Game_id; - bool m_Game_idIsSet; + utility::string_t m_Version; + bool m_VersionIsSet; - utility::string_t m_Game_icon_url; - bool m_Game_icon_urlIsSet; + bool m_Featured; + bool m_FeaturedIsSet; - utility::string_t m_Version; - bool m_VersionIsSet; + utility::string_t m_Cluster_id; + bool m_Cluster_idIsSet; - bool m_Featured; - bool m_FeaturedIsSet; + utility::string_t m_Website_url; + bool m_Website_urlIsSet; - utility::string_t m_Cluster_id; - bool m_Cluster_idIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Website_url; - bool m_Website_urlIsSet; + utility::string_t m_Owner_id; + bool m_Owner_idIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + double m_Uptime; + bool m_UptimeIsSet; - utility::string_t m_Owner_id; - bool m_Owner_idIsSet; + std::shared_ptr m_Status; + bool m_StatusIsSet; - double m_Uptime; - bool m_UptimeIsSet; + int32_t m_Ping; + bool m_PingIsSet; - std::shared_ptr m_Status; - bool m_StatusIsSet; + utility::string_t m_map; + bool m_mapIsSet; - int32_t m_Ping; - bool m_PingIsSet; + int32_t m_Used_slots; + bool m_Used_slotsIsSet; - utility::string_t m_map; - bool m_mapIsSet; + int32_t m_Max_slots; + bool m_Max_slotsIsSet; - int32_t m_Used_slots; - bool m_Used_slotsIsSet; + utility::string_t m_Motd; + bool m_MotdIsSet; - int32_t m_Max_slots; - bool m_Max_slotsIsSet; + utility::string_t m_Players; + bool m_PlayersIsSet; - utility::string_t m_Motd; - bool m_MotdIsSet; + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; - utility::string_t m_Players; - bool m_PlayersIsSet; + utility::string_t m_Country; + bool m_CountryIsSet; - utility::datetime m_Last_online; - bool m_Last_onlineIsSet; + bool m_Steam; + bool m_SteamIsSet; - utility::string_t m_Country; - bool m_CountryIsSet; + utility::string_t m_Discord_server_id; + bool m_Discord_server_idIsSet; - bool m_Steam; - bool m_SteamIsSet; + utility::string_t m_Youtube_video_url; + bool m_Youtube_video_urlIsSet; - utility::string_t m_Discord_server_id; - bool m_Discord_server_idIsSet; + utility::string_t m_Tags; + bool m_TagsIsSet; - utility::string_t m_Youtube_video_url; - bool m_Youtube_video_urlIsSet; + int32_t m_Comment_count; + bool m_Comment_countIsSet; - utility::string_t m_Tags; - bool m_TagsIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_Comment_count; - bool m_Comment_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index a44a4615..e43127f5 100644 --- a/include/tribufu++/model/GameServerCluster.h +++ b/include/tribufu++/model/GameServerCluster.h @@ -13,163 +13,158 @@ /* * 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 +namespace tribufu { -public: - GameServerCluster(); - virtual ~GameServerCluster(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class GameServerCluster : public ModelBase + { + public: + GameServerCluster(); + virtual ~GameServerCluster(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// GameServerCluster members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 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 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 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 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 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 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 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 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); - 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 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Game_id; + bool m_Game_idIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + utility::string_t m_Website_url; + bool m_Website_urlIsSet; - utility::string_t m_Game_id; - bool m_Game_idIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Website_url; - bool m_Website_urlIsSet; + utility::string_t m_Owner_id; + bool m_Owner_idIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + utility::string_t m_Discord_server_id; + bool m_Discord_server_idIsSet; - utility::string_t m_Owner_id; - bool m_Owner_idIsSet; + utility::string_t m_Youtube_video_url; + bool m_Youtube_video_urlIsSet; - utility::string_t m_Discord_server_id; - bool m_Discord_server_idIsSet; + utility::string_t m_Tags; + bool m_TagsIsSet; - utility::string_t m_Youtube_video_url; - bool m_Youtube_video_urlIsSet; + int32_t m_Comment_count; + bool m_Comment_countIsSet; - utility::string_t m_Tags; - bool m_TagsIsSet; + int32_t m_Server_count; + bool m_Server_countIsSet; - int32_t m_Comment_count; - bool m_Comment_countIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_Server_count; - bool m_Server_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index 58bdd607..64135be5 100644 --- a/include/tribufu++/model/GrantType.h +++ b/include/tribufu++/model/GrantType.h @@ -13,54 +13,54 @@ /* * GrantType.h * - * + * */ #ifndef TRIBUFU_MODELS_GrantType_H_ #define TRIBUFU_MODELS_GrantType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class GrantType - : public ModelBase +namespace tribufu { -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 + namespace models { - GrantType_AUTHORIZATION_CODE, - GrantType_CLIENT_CREDENTIALS, - GrantType_PASSWORD, - GrantType_REFRESH_TOKEN, - }; - eGrantType getValue() const; - void setValue(eGrantType const value); + class GrantType : public ModelBase + { + public: + GrantType(); + virtual ~GrantType(); - protected: - eGrantType m_value; -}; + ///////////////////////////////////////////// + /// 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 index 5afc79cc..2c0cf235 100644 --- a/include/tribufu++/model/Group.h +++ b/include/tribufu++/model/Group.h @@ -13,179 +13,174 @@ /* * 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 +namespace tribufu { -public: - Group(); - virtual ~Group(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Group : public ModelBase + { + public: + Group(); + virtual ~Group(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// Group members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(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 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 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); - 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 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); - 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); - 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); - 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 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::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 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 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Name; + bool m_NameIsSet; - utility::string_t m_Uuid; - bool m_UuidIsSet; + utility::string_t m_Tag; + bool m_TagIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Tag; - bool m_TagIsSet; + int32_t m_Type; + bool m_TypeIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + int32_t m_Privacy; + bool m_PrivacyIsSet; - int32_t m_Type; - bool m_TypeIsSet; + utility::string_t m_Owner_id; + bool m_Owner_idIsSet; - int32_t m_Privacy; - bool m_PrivacyIsSet; + bool m_Verified; + bool m_VerifiedIsSet; - utility::string_t m_Owner_id; - bool m_Owner_idIsSet; + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; - bool m_Verified; - bool m_VerifiedIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Photo_url; - bool m_Photo_urlIsSet; + int32_t m_Member_count; + bool m_Member_countIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + int32_t m_Follower_count; + bool m_Follower_countIsSet; - int32_t m_Member_count; - bool m_Member_countIsSet; + int32_t m_View_count; + bool m_View_countIsSet; - int32_t m_Follower_count; - bool m_Follower_countIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_View_count; - bool m_View_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index 7cbcc8b8..8e01d084 100644 --- a/include/tribufu++/model/GroupGame.h +++ b/include/tribufu++/model/GroupGame.h @@ -13,112 +13,108 @@ /* * 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" +#include "tribufu++/model/Application.h" +#include "tribufu++/model/Group.h" +#include -namespace tribufu { -namespace models { - -class Group; -class Application; - - -class GroupGame - : public ModelBase +namespace tribufu { -public: - GroupGame(); - virtual ~GroupGame(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Group; + class Application; - void validate() override; + class GroupGame : public ModelBase + { + public: + GroupGame(); + virtual ~GroupGame(); - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + ///////////////////////////////////////////// + /// ModelBase overrides - 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; + void validate() override; + web::json::value toJson() const override; + bool fromJson(const web::json::value &json) override; - ///////////////////////////////////////////// - /// GroupGame members + 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); + 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); + 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); + 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 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); + 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 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); + 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; -protected: - utility::string_t m_Group_id; - bool m_Group_idIsSet; + std::shared_ptr m_Group; + bool m_GroupIsSet; - std::shared_ptr m_Group; - bool m_GroupIsSet; + utility::string_t m_Application_id; + bool m_Application_idIsSet; - utility::string_t m_Application_id; - bool m_Application_idIsSet; + std::shared_ptr m_Application; + bool m_ApplicationIsSet; - std::shared_ptr m_Application; - bool m_ApplicationIsSet; + std::shared_ptr m_Stats; + bool m_StatsIsSet; - std::shared_ptr m_Stats; - bool m_StatsIsSet; + utility::datetime m_Acquired; + bool m_AcquiredIsSet; - utility::datetime m_Acquired; - bool m_AcquiredIsSet; + utility::datetime m_Last_used; + bool m_Last_usedIsSet; + }; - 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 index e336abf2..c09f2f58 100644 --- a/include/tribufu++/model/GroupMember.h +++ b/include/tribufu++/model/GroupMember.h @@ -13,7 +13,7 @@ /* * GroupMember.h * - * + * */ #ifndef TRIBUFU_MODELS_GroupMember_H_ @@ -23,115 +23,111 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/GroupRank.h" +#include -namespace tribufu { -namespace models { - - - -class GroupMember - : public ModelBase +namespace tribufu { -public: - GroupMember(); - virtual ~GroupMember(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class GroupMember : public ModelBase + { + public: + GroupMember(); + virtual ~GroupMember(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// GroupMember members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(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 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 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); - 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 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); - 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); - 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Name; + bool m_NameIsSet; - utility::string_t m_Uuid; - bool m_UuidIsSet; + utility::string_t m_Display_name; + bool m_Display_nameIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + bool m_Verified; + bool m_VerifiedIsSet; - utility::string_t m_Display_name; - bool m_Display_nameIsSet; + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; - bool m_Verified; - bool m_VerifiedIsSet; + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; - utility::string_t m_Photo_url; - bool m_Photo_urlIsSet; + std::shared_ptr m_Rank; + bool m_RankIsSet; - utility::datetime m_Last_online; - bool m_Last_onlineIsSet; + utility::datetime m_Since; + bool m_SinceIsSet; + }; - 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 index 1eeaaadc..47fd0d1d 100644 --- a/include/tribufu++/model/GroupRank.h +++ b/include/tribufu++/model/GroupRank.h @@ -13,53 +13,53 @@ /* * GroupRank.h * - * + * */ #ifndef TRIBUFU_MODELS_GroupRank_H_ #define TRIBUFU_MODELS_GroupRank_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class GroupRank - : public ModelBase +namespace tribufu { -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 + namespace models { - GroupRank_MEMBER, - GroupRank_LEADER, - GroupRank_OWNER, - }; - eGroupRank getValue() const; - void setValue(eGroupRank const value); + class GroupRank : public ModelBase + { + public: + GroupRank(); + virtual ~GroupRank(); - protected: - eGroupRank m_value; -}; + ///////////////////////////////////////////// + /// 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 index 6c105e0d..1a361df2 100644 --- a/include/tribufu++/model/HashViewModel.h +++ b/include/tribufu++/model/HashViewModel.h @@ -13,59 +13,54 @@ /* * 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 +namespace tribufu { -public: - HashViewModel(); - virtual ~HashViewModel(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class HashViewModel : public ModelBase + { + public: + HashViewModel(); + virtual ~HashViewModel(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// HashViewModel members + utility::string_t getValue() const; + bool valueIsSet() const; + void unsetValue(); + void setValue(const utility::string_t &value); - 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; + }; - -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 index 4cd53767..73ba38f0 100644 --- a/include/tribufu++/model/IntrospectRequest.h +++ b/include/tribufu++/model/IntrospectRequest.h @@ -13,7 +13,7 @@ /* * IntrospectRequest.h * - * + * */ #ifndef TRIBUFU_MODELS_IntrospectRequest_H_ @@ -23,59 +23,55 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/TokenHintType.h" +#include -namespace tribufu { -namespace models { - - - -class IntrospectRequest - : public ModelBase +namespace tribufu { -public: - IntrospectRequest(); - virtual ~IntrospectRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class IntrospectRequest : public ModelBase + { + public: + IntrospectRequest(); + virtual ~IntrospectRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// IntrospectRequest members + utility::string_t getToken() const; + bool tokenIsSet() const; + void unsetToken(); + void setToken(const utility::string_t &value); - 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); - 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; + }; -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 index 70dc7e01..3732ad6d 100644 --- a/include/tribufu++/model/IpAddress.h +++ b/include/tribufu++/model/IpAddress.h @@ -13,195 +13,190 @@ /* * 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 +namespace tribufu { -public: - IpAddress(); - virtual ~IpAddress(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class IpAddress : public ModelBase + { + public: + IpAddress(); + virtual ~IpAddress(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// IpAddress members + utility::string_t getAddress() const; + bool addressIsSet() const; + void unsetAddress(); + void setAddress(const utility::string_t &value); - 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); - 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); - 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); - 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 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 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 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 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 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 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 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 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 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 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 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 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 getLatitude() const; - bool latitudeIsSet() const; - void unsetLatitude(); - void setLatitude(float value); + float getLongitude() const; + bool longitudeIsSet() const; + void unsetLongitude(); + void setLongitude(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; -protected: - utility::string_t m_Address; - bool m_AddressIsSet; + utility::string_t m_Network; + bool m_NetworkIsSet; - int32_t m_Version; - bool m_VersionIsSet; + bool m_Reserved; + bool m_ReservedIsSet; - utility::string_t m_Network; - bool m_NetworkIsSet; + utility::string_t m_Asn; + bool m_AsnIsSet; - bool m_Reserved; - bool m_ReservedIsSet; + utility::string_t m_Isp; + bool m_IspIsSet; - utility::string_t m_Asn; - bool m_AsnIsSet; + utility::string_t m_Continent; + bool m_ContinentIsSet; - utility::string_t m_Isp; - bool m_IspIsSet; + utility::string_t m_Country; + bool m_CountryIsSet; - utility::string_t m_Continent; - bool m_ContinentIsSet; + utility::string_t m_Region; + bool m_RegionIsSet; - utility::string_t m_Country; - bool m_CountryIsSet; + utility::string_t m_City; + bool m_CityIsSet; - utility::string_t m_Region; - bool m_RegionIsSet; + utility::string_t m_Postal_code; + bool m_Postal_codeIsSet; - utility::string_t m_City; - bool m_CityIsSet; + utility::string_t m_Calling_code; + bool m_Calling_codeIsSet; - utility::string_t m_Postal_code; - bool m_Postal_codeIsSet; + utility::string_t m_Tld; + bool m_TldIsSet; - utility::string_t m_Calling_code; - bool m_Calling_codeIsSet; + utility::string_t m_Language; + bool m_LanguageIsSet; - utility::string_t m_Tld; - bool m_TldIsSet; + utility::string_t m_Timezone; + bool m_TimezoneIsSet; - utility::string_t m_Language; - bool m_LanguageIsSet; + utility::string_t m_Currency; + bool m_CurrencyIsSet; - utility::string_t m_Timezone; - bool m_TimezoneIsSet; + float m_Latitude; + bool m_LatitudeIsSet; - utility::string_t m_Currency; - bool m_CurrencyIsSet; + float m_Longitude; + bool m_LongitudeIsSet; + }; - 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 index 80548257..d62fb8d2 100644 --- a/include/tribufu++/model/LeaderboardItem.h +++ b/include/tribufu++/model/LeaderboardItem.h @@ -13,99 +13,94 @@ /* * 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 +namespace tribufu { -public: - LeaderboardItem(); - virtual ~LeaderboardItem(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class LeaderboardItem : public ModelBase + { + public: + LeaderboardItem(); + virtual ~LeaderboardItem(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// LeaderboardItem members + utility::string_t getName() const; + bool nameIsSet() const; + void unsetName(); + void setName(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 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); - 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); - 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 getExperience() const; - bool experienceIsSet() const; - void unsetExperience(); - void setExperience(double value); + double getPoints() const; + bool pointsIsSet() const; + void unsetPoints(); + void setPoints(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; -protected: - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; - utility::string_t m_Display_name; - bool m_Display_nameIsSet; + int32_t m_Level; + bool m_LevelIsSet; - utility::string_t m_Photo_url; - bool m_Photo_urlIsSet; + double m_Experience; + bool m_ExperienceIsSet; - int32_t m_Level; - bool m_LevelIsSet; + double m_Points; + bool m_PointsIsSet; + }; - 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 index 983d251a..83d3f354 100644 --- a/include/tribufu++/model/LeaderboardOrder.h +++ b/include/tribufu++/model/LeaderboardOrder.h @@ -13,52 +13,52 @@ /* * LeaderboardOrder.h * - * + * */ #ifndef TRIBUFU_MODELS_LeaderboardOrder_H_ #define TRIBUFU_MODELS_LeaderboardOrder_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class LeaderboardOrder - : public ModelBase +namespace tribufu { -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 + namespace models { - LeaderboardOrder_LEVEL, - LeaderboardOrder_POINTS, - }; - eLeaderboardOrder getValue() const; - void setValue(eLeaderboardOrder const value); + class LeaderboardOrder : public ModelBase + { + public: + LeaderboardOrder(); + virtual ~LeaderboardOrder(); - protected: - eLeaderboardOrder m_value; -}; + ///////////////////////////////////////////// + /// 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 index e5674912..9eb3b464 100644 --- a/include/tribufu++/model/LoginProvider.h +++ b/include/tribufu++/model/LoginProvider.h @@ -13,57 +13,57 @@ /* * LoginProvider.h * - * + * */ #ifndef TRIBUFU_MODELS_LoginProvider_H_ #define TRIBUFU_MODELS_LoginProvider_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class LoginProvider - : public ModelBase +namespace tribufu { -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 + namespace models { - LoginProvider_STEAM, - LoginProvider_EPIC, - LoginProvider_DISCORD, - LoginProvider_MICROSOFT, - LoginProvider_PLAYSTATION, - LoginProvider_GOOGLE, - LoginProvider_APPLE, - }; - eLoginProvider getValue() const; - void setValue(eLoginProvider const value); + class LoginProvider : public ModelBase + { + public: + LoginProvider(); + virtual ~LoginProvider(); - protected: - eLoginProvider m_value; -}; + ///////////////////////////////////////////// + /// 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 index 6a93089f..db83d881 100644 --- a/include/tribufu++/model/LoginRequest.h +++ b/include/tribufu++/model/LoginRequest.h @@ -13,67 +13,62 @@ /* * 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 +namespace tribufu { -public: - LoginRequest(); - virtual ~LoginRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class LoginRequest : public ModelBase + { + public: + LoginRequest(); + virtual ~LoginRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// LoginRequest members + utility::string_t getLogin() const; + bool loginIsSet() const; + void unsetLogin(); + void setLogin(const utility::string_t &value); - 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); - 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; + }; -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 index 77ed19e9..64b790f6 100644 --- a/include/tribufu++/model/LoginResponse.h +++ b/include/tribufu++/model/LoginResponse.h @@ -13,85 +13,81 @@ /* * 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 +namespace tribufu { -public: - LoginResponse(); - virtual ~LoginResponse(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class UserInfo; - void validate() override; + class LoginResponse : public ModelBase + { + public: + LoginResponse(); + virtual ~LoginResponse(); - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + ///////////////////////////////////////////// + /// ModelBase overrides - 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; + void validate() override; + web::json::value toJson() const override; + bool fromJson(const web::json::value &json) override; - ///////////////////////////////////////////// - /// LoginResponse members + 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); + 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 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 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); + int64_t getExpiresIn() const; + bool expiresInIsSet() const; + void unsetExpires_in(); + void setExpiresIn(int64_t value); + protected: + std::shared_ptr m_User; + bool m_UserIsSet; -protected: - std::shared_ptr m_User; - bool m_UserIsSet; + utility::string_t m_Access_token; + bool m_Access_tokenIsSet; - utility::string_t m_Access_token; - bool m_Access_tokenIsSet; + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; - utility::string_t m_Refresh_token; - bool m_Refresh_tokenIsSet; + int64_t m_Expires_in; + bool m_Expires_inIsSet; + }; - 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 index c057b034..4ee382aa 100644 --- a/include/tribufu++/model/Package.h +++ b/include/tribufu++/model/Package.h @@ -13,147 +13,142 @@ /* * 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 +namespace tribufu { -public: - Package(); - virtual ~Package(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Package : public ModelBase + { + public: + Package(); + virtual ~Package(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// Package members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 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 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 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 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 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); - 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); - 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); - 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 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Image_url; + bool m_Image_urlIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + utility::string_t m_Author_id; + bool m_Author_idIsSet; - utility::string_t m_Image_url; - bool m_Image_urlIsSet; + utility::string_t m_Version; + bool m_VersionIsSet; - utility::string_t m_Author_id; - bool m_Author_idIsSet; + utility::string_t m_File_url; + bool m_File_urlIsSet; - utility::string_t m_Version; - bool m_VersionIsSet; + double m_Raw_size; + bool m_Raw_sizeIsSet; - utility::string_t m_File_url; - bool m_File_urlIsSet; + int32_t m_Download_count; + bool m_Download_countIsSet; - double m_Raw_size; - bool m_Raw_sizeIsSet; + utility::datetime m_Last_download; + bool m_Last_downloadIsSet; - int32_t m_Download_count; - bool m_Download_countIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - utility::datetime m_Last_download; - bool m_Last_downloadIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index e45e6eee..fc668ba6 100644 --- a/include/tribufu++/model/Profile.h +++ b/include/tribufu++/model/Profile.h @@ -13,195 +13,190 @@ /* * 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 +namespace tribufu { -public: - Profile(); - virtual ~Profile(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Profile : public ModelBase + { + public: + Profile(); + virtual ~Profile(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// Profile members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(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 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 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); - 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); - 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 getExperience() const; - bool experienceIsSet() const; - void unsetExperience(); - void setExperience(double value); + bool isPublicBirthday() const; + bool publicBirthdayIsSet() const; + void unsetPublic_birthday(); + void setPublicBirthday(bool 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); - 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); - 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 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 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::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::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); - 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Name; + bool m_NameIsSet; - utility::string_t m_Uuid; - bool m_UuidIsSet; + utility::string_t m_Display_name; + bool m_Display_nameIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + bool m_Verified; + bool m_VerifiedIsSet; - utility::string_t m_Display_name; - bool m_Display_nameIsSet; + int32_t m_Level; + bool m_LevelIsSet; - bool m_Verified; - bool m_VerifiedIsSet; + double m_Experience; + bool m_ExperienceIsSet; - int32_t m_Level; - bool m_LevelIsSet; + bool m_Public_birthday; + bool m_Public_birthdayIsSet; - double m_Experience; - bool m_ExperienceIsSet; + utility::datetime m_Birthday; + bool m_BirthdayIsSet; - bool m_Public_birthday; - bool m_Public_birthdayIsSet; + double m_Points; + bool m_PointsIsSet; - utility::datetime m_Birthday; - bool m_BirthdayIsSet; + utility::string_t m_Location; + bool m_LocationIsSet; - double m_Points; - bool m_PointsIsSet; + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; - utility::string_t m_Location; - bool m_LocationIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Photo_url; - bool m_Photo_urlIsSet; + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + utility::string_t m_Biography; + bool m_BiographyIsSet; - utility::datetime m_Last_online; - bool m_Last_onlineIsSet; + int32_t m_View_count; + bool m_View_countIsSet; - utility::string_t m_Biography; - bool m_BiographyIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_View_count; - bool m_View_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index fdc939c9..004899f5 100644 --- a/include/tribufu++/model/ProfileGame.h +++ b/include/tribufu++/model/ProfileGame.h @@ -13,140 +13,135 @@ /* * ProfileGame.h * - * + * */ #ifndef TRIBUFU_MODELS_ProfileGame_H_ #define TRIBUFU_MODELS_ProfileGame_H_ - #include "tribufu++/ModelBase.h" -#include #include "tribufu++/AnyType.h" +#include -namespace tribufu { -namespace models { - - - -class ProfileGame - : public ModelBase +namespace tribufu { -public: - ProfileGame(); - virtual ~ProfileGame(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class ProfileGame : public ModelBase + { + public: + ProfileGame(); + virtual ~ProfileGame(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// ProfileGame members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 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 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 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); - 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); - 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 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); - 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Capsule_image_url; + bool m_Capsule_image_urlIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Library_image_url; + bool m_Library_image_urlIsSet; - utility::string_t m_Capsule_image_url; - bool m_Capsule_image_urlIsSet; + utility::string_t m_Slug; + bool m_SlugIsSet; - utility::string_t m_Library_image_url; - bool m_Library_image_urlIsSet; + double m_Time_used; + bool m_Time_usedIsSet; - utility::string_t m_Slug; - bool m_SlugIsSet; + int32_t m_Unlocked_achievements; + bool m_Unlocked_achievementsIsSet; - double m_Time_used; - bool m_Time_usedIsSet; + int32_t m_Total_achievements; + bool m_Total_achievementsIsSet; - int32_t m_Unlocked_achievements; - bool m_Unlocked_achievementsIsSet; + std::shared_ptr m_Stats; + bool m_StatsIsSet; - int32_t m_Total_achievements; - bool m_Total_achievementsIsSet; + utility::datetime m_Acquired; + bool m_AcquiredIsSet; - std::shared_ptr m_Stats; - bool m_StatsIsSet; + utility::datetime m_Last_used; + bool m_Last_usedIsSet; + }; - 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 index 4b779dc7..2bd4ef7f 100644 --- a/include/tribufu++/model/ProfileGroup.h +++ b/include/tribufu++/model/ProfileGroup.h @@ -13,7 +13,7 @@ /* * ProfileGroup.h * - * + * */ #ifndef TRIBUFU_MODELS_ProfileGroup_H_ @@ -23,123 +23,119 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/GroupRank.h" +#include -namespace tribufu { -namespace models { - - - -class ProfileGroup - : public ModelBase +namespace tribufu { -public: - ProfileGroup(); - virtual ~ProfileGroup(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class ProfileGroup : public ModelBase + { + public: + ProfileGroup(); + virtual ~ProfileGroup(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// ProfileGroup members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(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 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 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); - 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); - 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 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); - 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); - 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Name; + bool m_NameIsSet; - utility::string_t m_Uuid; - bool m_UuidIsSet; + utility::string_t m_Tag; + bool m_TagIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + int32_t m_Privacy; + bool m_PrivacyIsSet; - utility::string_t m_Tag; - bool m_TagIsSet; + bool m_Verified; + bool m_VerifiedIsSet; - int32_t m_Privacy; - bool m_PrivacyIsSet; + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; - bool m_Verified; - bool m_VerifiedIsSet; + int32_t m_Member_count; + bool m_Member_countIsSet; - utility::string_t m_Photo_url; - bool m_Photo_urlIsSet; + std::shared_ptr m_Rank; + bool m_RankIsSet; - int32_t m_Member_count; - bool m_Member_countIsSet; + utility::datetime m_Since; + bool m_SinceIsSet; + }; - 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 index 456d33ea..de46a104 100644 --- a/include/tribufu++/model/RefreshRequest.h +++ b/include/tribufu++/model/RefreshRequest.h @@ -13,59 +13,54 @@ /* * 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 +namespace tribufu { -public: - RefreshRequest(); - virtual ~RefreshRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class RefreshRequest : public ModelBase + { + public: + RefreshRequest(); + virtual ~RefreshRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// RefreshRequest members + utility::string_t getRefreshToken() const; + bool refreshTokenIsSet() const; + void unsetRefresh_token(); + void setRefreshToken(const utility::string_t &value); - 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; + }; - -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 index a0246c1c..d59e6aaa 100644 --- a/include/tribufu++/model/RegisterRequest.h +++ b/include/tribufu++/model/RegisterRequest.h @@ -13,83 +13,78 @@ /* * 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 +namespace tribufu { -public: - RegisterRequest(); - virtual ~RegisterRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class RegisterRequest : public ModelBase + { + public: + RegisterRequest(); + virtual ~RegisterRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// RegisterRequest members + utility::string_t getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(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 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 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); - 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; -protected: - utility::string_t m_Uuid; - bool m_UuidIsSet; + utility::string_t m_Email; + bool m_EmailIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Password; + bool m_PasswordIsSet; + }; - 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 index cdb2c85e..752569b4 100644 --- a/include/tribufu++/model/ResponseType.h +++ b/include/tribufu++/model/ResponseType.h @@ -13,52 +13,52 @@ /* * ResponseType.h * - * + * */ #ifndef TRIBUFU_MODELS_ResponseType_H_ #define TRIBUFU_MODELS_ResponseType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class ResponseType - : public ModelBase +namespace tribufu { -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 + namespace models { - ResponseType_CODE, - ResponseType_TOKEN, - }; - eResponseType getValue() const; - void setValue(eResponseType const value); + class ResponseType : public ModelBase + { + public: + ResponseType(); + virtual ~ResponseType(); - protected: - eResponseType m_value; -}; + ///////////////////////////////////////////// + /// 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 index f05ae2ed..da241578 100644 --- a/include/tribufu++/model/RevokeRequest.h +++ b/include/tribufu++/model/RevokeRequest.h @@ -13,7 +13,7 @@ /* * RevokeRequest.h * - * + * */ #ifndef TRIBUFU_MODELS_RevokeRequest_H_ @@ -23,59 +23,55 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/TokenHintType.h" +#include -namespace tribufu { -namespace models { - - - -class RevokeRequest - : public ModelBase +namespace tribufu { -public: - RevokeRequest(); - virtual ~RevokeRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class RevokeRequest : public ModelBase + { + public: + RevokeRequest(); + virtual ~RevokeRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// RevokeRequest members + utility::string_t getToken() const; + bool tokenIsSet() const; + void unsetToken(); + void setToken(const utility::string_t &value); - 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); - 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; + }; -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 index 47a54d3c..dd73786b 100644 --- a/include/tribufu++/model/SearchRequest.h +++ b/include/tribufu++/model/SearchRequest.h @@ -13,7 +13,7 @@ /* * SearchRequest.h * - * + * */ #ifndef TRIBUFU_MODELS_SearchRequest_H_ @@ -26,72 +26,68 @@ #include "tribufu++/model/SearchType.h" #include -namespace tribufu { -namespace models { - - - -class SearchRequest - : public ModelBase +namespace tribufu { -public: - SearchRequest(); - virtual ~SearchRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class SearchRequest : public ModelBase + { + public: + SearchRequest(); + virtual ~SearchRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// SearchRequest members + std::shared_ptr getType() const; + bool typeIsSet() const; + void unsetType(); + void setType(const std::shared_ptr &value); - 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); - 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); - 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); - 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; -protected: - std::shared_ptr m_Type; - bool m_TypeIsSet; + int32_t m_Page; + bool m_PageIsSet; - utility::string_t m_Query; - bool m_QueryIsSet; + utility::string_t m_Game_id; + bool m_Game_idIsSet; + }; - 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 index 40a21658..3271783b 100644 --- a/include/tribufu++/model/SearchType.h +++ b/include/tribufu++/model/SearchType.h @@ -13,54 +13,54 @@ /* * SearchType.h * - * + * */ #ifndef TRIBUFU_MODELS_SearchType_H_ #define TRIBUFU_MODELS_SearchType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class SearchType - : public ModelBase +namespace tribufu { -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 + namespace models { - SearchType_USER, - SearchType_GROUP, - SearchType_SERVER, - SearchType_CLUSTER, - }; - eSearchType getValue() const; - void setValue(eSearchType const value); + class SearchType : public ModelBase + { + public: + SearchType(); + virtual ~SearchType(); - protected: - eSearchType m_value; -}; + ///////////////////////////////////////////// + /// 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 index bb523883..bf63deb3 100644 --- a/include/tribufu++/model/ServerMetrics.h +++ b/include/tribufu++/model/ServerMetrics.h @@ -13,74 +13,68 @@ /* * ServerMetrics.h * - * + * */ #ifndef TRIBUFU_MODELS_ServerMetrics_H_ #define TRIBUFU_MODELS_ServerMetrics_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - - -class ServerMetrics - : public ModelBase +namespace tribufu { -public: - ServerMetrics(); - virtual ~ServerMetrics(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class ServerMetrics : public ModelBase + { + public: + ServerMetrics(); + virtual ~ServerMetrics(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// ServerMetrics members + int32_t getServerCount() const; + bool serverCountIsSet() const; + void unsetServer_count(); + void setServerCount(int32_t value); - 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 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); - 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; -protected: - int32_t m_Server_count; - bool m_Server_countIsSet; + int32_t m_Country_count; + bool m_Country_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 index e0d0c9bb..71b7ef27 100644 --- a/include/tribufu++/model/ServerStatus.h +++ b/include/tribufu++/model/ServerStatus.h @@ -13,53 +13,53 @@ /* * ServerStatus.h * - * + * */ #ifndef TRIBUFU_MODELS_ServerStatus_H_ #define TRIBUFU_MODELS_ServerStatus_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class ServerStatus - : public ModelBase +namespace tribufu { -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 + namespace models { - ServerStatus_UNKNOWN, - ServerStatus_OFFLINE, - ServerStatus_ONLINE, - }; - eServerStatus getValue() const; - void setValue(eServerStatus const value); + class ServerStatus : public ModelBase + { + public: + ServerStatus(); + virtual ~ServerStatus(); - protected: - eServerStatus m_value; -}; + ///////////////////////////////////////////// + /// 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 index 5e56a7b3..45926adc 100644 --- a/include/tribufu++/model/Subscription.h +++ b/include/tribufu++/model/Subscription.h @@ -13,108 +13,103 @@ /* * 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 +namespace tribufu { -public: - Subscription(); - virtual ~Subscription(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class Subscription : public ModelBase + { + public: + Subscription(); + virtual ~Subscription(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// Subscription members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 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 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 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Description; + bool m_DescriptionIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Image_url; + bool m_Image_urlIsSet; - utility::string_t m_Description; - bool m_DescriptionIsSet; + std::map m_Prices; + bool m_PricesIsSet; - utility::string_t m_Image_url; - bool m_Image_urlIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - std::map m_Prices; - bool m_PricesIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index da919615..8d042d2f 100644 --- a/include/tribufu++/model/TokenHintType.h +++ b/include/tribufu++/model/TokenHintType.h @@ -13,52 +13,52 @@ /* * TokenHintType.h * - * + * */ #ifndef TRIBUFU_MODELS_TokenHintType_H_ #define TRIBUFU_MODELS_TokenHintType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class TokenHintType - : public ModelBase +namespace tribufu { -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 + namespace models { - TokenHintType_ACCESS_TOKEN, - TokenHintType_REFRESH_TOKEN, - }; - eTokenHintType getValue() const; - void setValue(eTokenHintType const value); + class TokenHintType : public ModelBase + { + public: + TokenHintType(); + virtual ~TokenHintType(); - protected: - eTokenHintType m_value; -}; + ///////////////////////////////////////////// + /// 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 index c5ce69de..2b046e5c 100644 --- a/include/tribufu++/model/TokenRequest.h +++ b/include/tribufu++/model/TokenRequest.h @@ -13,7 +13,7 @@ /* * TokenRequest.h * - * + * */ #ifndef TRIBUFU_MODELS_TokenRequest_H_ @@ -23,107 +23,103 @@ #include "tribufu++/ModelBase.h" -#include #include "tribufu++/model/GrantType.h" +#include -namespace tribufu { -namespace models { - - - -class TokenRequest - : public ModelBase +namespace tribufu { -public: - TokenRequest(); - virtual ~TokenRequest(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class TokenRequest : public ModelBase + { + public: + TokenRequest(); + virtual ~TokenRequest(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// TokenRequest members + std::shared_ptr getGrantType() const; + bool grantTypeIsSet() const; + void unsetGrant_type(); + void setGrantType(const std::shared_ptr &value); - 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 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 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 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 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 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 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); - 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; -protected: - std::shared_ptr m_Grant_type; - bool m_Grant_typeIsSet; + utility::string_t m_Username; + bool m_UsernameIsSet; - utility::string_t m_Code; - bool m_CodeIsSet; + utility::string_t m_Password; + bool m_PasswordIsSet; - utility::string_t m_Username; - bool m_UsernameIsSet; + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; - utility::string_t m_Password; - bool m_PasswordIsSet; + utility::string_t m_Client_id; + bool m_Client_idIsSet; - utility::string_t m_Refresh_token; - bool m_Refresh_tokenIsSet; + utility::string_t m_Redirect_uri; + bool m_Redirect_uriIsSet; - utility::string_t m_Client_id; - bool m_Client_idIsSet; + utility::string_t m_Code_verifier; + bool m_Code_verifierIsSet; + }; - 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 index 779abf2d..e08beda3 100644 --- a/include/tribufu++/model/TokenResponse.h +++ b/include/tribufu++/model/TokenResponse.h @@ -13,7 +13,7 @@ /* * TokenResponse.h * - * + * */ #ifndef TRIBUFU_MODELS_TokenResponse_H_ @@ -26,88 +26,84 @@ #include "tribufu++/model/TokenType.h" #include -namespace tribufu { -namespace models { - - - -class TokenResponse - : public ModelBase +namespace tribufu { -public: - TokenResponse(); - virtual ~TokenResponse(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class TokenResponse : public ModelBase + { + public: + TokenResponse(); + virtual ~TokenResponse(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// TokenResponse members + std::shared_ptr getTokenType() const; + bool tokenTypeIsSet() const; + void unsetToken_type(); + void setTokenType(const std::shared_ptr &value); - 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 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 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 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); - 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); - 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; -protected: - std::shared_ptr m_Token_type; - bool m_Token_typeIsSet; + utility::string_t m_Refresh_token; + bool m_Refresh_tokenIsSet; - utility::string_t m_Access_token; - bool m_Access_tokenIsSet; + utility::string_t m_Scope; + bool m_ScopeIsSet; - utility::string_t m_Refresh_token; - bool m_Refresh_tokenIsSet; + utility::string_t m_State; + bool m_StateIsSet; - utility::string_t m_Scope; - bool m_ScopeIsSet; + int64_t m_Expires_in; + bool m_Expires_inIsSet; + }; - 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 index ee012adc..0a37e0af 100644 --- a/include/tribufu++/model/TokenType.h +++ b/include/tribufu++/model/TokenType.h @@ -13,51 +13,51 @@ /* * TokenType.h * - * + * */ #ifndef TRIBUFU_MODELS_TokenType_H_ #define TRIBUFU_MODELS_TokenType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class TokenType - : public ModelBase +namespace tribufu { -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 + namespace models { - TokenType_BEARER, - }; - eTokenType getValue() const; - void setValue(eTokenType const value); + class TokenType : public ModelBase + { + public: + TokenType(); + virtual ~TokenType(); - protected: - eTokenType m_value; -}; + ///////////////////////////////////////////// + /// 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 index 5907485f..9d1da85f 100644 --- a/include/tribufu++/model/UpdateProfile.h +++ b/include/tribufu++/model/UpdateProfile.h @@ -13,67 +13,62 @@ /* * 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 +namespace tribufu { -public: - UpdateProfile(); - virtual ~UpdateProfile(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class UpdateProfile : public ModelBase + { + public: + UpdateProfile(); + virtual ~UpdateProfile(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// UpdateProfile members + utility::string_t getDisplayName() const; + bool displayNameIsSet() const; + void unsetDisplay_name(); + void setDisplayName(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 getBiography() const; + bool biographyIsSet() const; + void unsetBiography(); + void setBiography(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; + }; -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 index 2869039b..8031119f 100644 --- a/include/tribufu++/model/UserInfo.h +++ b/include/tribufu++/model/UserInfo.h @@ -13,7 +13,7 @@ /* * UserInfo.h * - * + * */ #ifndef TRIBUFU_MODELS_UserInfo_H_ @@ -26,240 +26,236 @@ #include "tribufu++/model/UserType.h" #include -namespace tribufu { -namespace models { - - - -class UserInfo - : public ModelBase +namespace tribufu { -public: - UserInfo(); - virtual ~UserInfo(); + namespace models + { - ///////////////////////////////////////////// - /// ModelBase overrides + class UserInfo : public ModelBase + { + public: + UserInfo(); + virtual ~UserInfo(); - void validate() override; + ///////////////////////////////////////////// + /// ModelBase overrides - web::json::value toJson() const override; - bool fromJson(const web::json::value& json) override; + void validate() 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; + 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 + ///////////////////////////////////////////// + /// UserInfo members + utility::string_t getId() const; + bool idIsSet() const; + void unsetId(); + void setId(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 getUuid() const; + bool uuidIsSet() const; + void unsetUuid(); + void setUuid(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 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 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); - 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); - 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 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); - 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); - 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); - 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 getExperience() const; - bool experienceIsSet() const; - void unsetExperience(); - void setExperience(double value); + bool isPublicBirthday() const; + bool publicBirthdayIsSet() const; + void unsetPublic_birthday(); + void setPublicBirthday(bool 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); - 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); - 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 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 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 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 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 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::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::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); - 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); - 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 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); - 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; -protected: - utility::string_t m_Id; - bool m_IdIsSet; + utility::string_t m_Name; + bool m_NameIsSet; - utility::string_t m_Uuid; - bool m_UuidIsSet; + utility::string_t m_Display_name; + bool m_Display_nameIsSet; - utility::string_t m_Name; - bool m_NameIsSet; + utility::string_t m_Email; + bool m_EmailIsSet; - utility::string_t m_Display_name; - bool m_Display_nameIsSet; + std::shared_ptr m_Type; + bool m_TypeIsSet; - utility::string_t m_Email; - bool m_EmailIsSet; + utility::string_t m_Flags; + bool m_FlagsIsSet; - std::shared_ptr m_Type; - bool m_TypeIsSet; + utility::string_t m_Permissions; + bool m_PermissionsIsSet; - utility::string_t m_Flags; - bool m_FlagsIsSet; + bool m_Verified; + bool m_VerifiedIsSet; - utility::string_t m_Permissions; - bool m_PermissionsIsSet; + int32_t m_Level; + bool m_LevelIsSet; - bool m_Verified; - bool m_VerifiedIsSet; + double m_Experience; + bool m_ExperienceIsSet; - int32_t m_Level; - bool m_LevelIsSet; + bool m_Public_birthday; + bool m_Public_birthdayIsSet; - double m_Experience; - bool m_ExperienceIsSet; + utility::datetime m_Birthday; + bool m_BirthdayIsSet; - bool m_Public_birthday; - bool m_Public_birthdayIsSet; + double m_Points; + bool m_PointsIsSet; - utility::datetime m_Birthday; - bool m_BirthdayIsSet; + utility::string_t m_Location; + bool m_LocationIsSet; - double m_Points; - bool m_PointsIsSet; + utility::string_t m_Language; + bool m_LanguageIsSet; - utility::string_t m_Location; - bool m_LocationIsSet; + utility::string_t m_Timezone; + bool m_TimezoneIsSet; - utility::string_t m_Language; - bool m_LanguageIsSet; + utility::string_t m_Currency; + bool m_CurrencyIsSet; - utility::string_t m_Timezone; - bool m_TimezoneIsSet; + utility::string_t m_Photo_url; + bool m_Photo_urlIsSet; - utility::string_t m_Currency; - bool m_CurrencyIsSet; + utility::string_t m_Banner_url; + bool m_Banner_urlIsSet; - utility::string_t m_Photo_url; - bool m_Photo_urlIsSet; + utility::datetime m_Last_online; + bool m_Last_onlineIsSet; - utility::string_t m_Banner_url; - bool m_Banner_urlIsSet; + utility::string_t m_Biography; + bool m_BiographyIsSet; - utility::datetime m_Last_online; - bool m_Last_onlineIsSet; + int32_t m_View_count; + bool m_View_countIsSet; - utility::string_t m_Biography; - bool m_BiographyIsSet; + utility::datetime m_Created; + bool m_CreatedIsSet; - int32_t m_View_count; - bool m_View_countIsSet; + utility::datetime m_Updated; + bool m_UpdatedIsSet; + }; - 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 index cc833569..c0203709 100644 --- a/include/tribufu++/model/UserType.h +++ b/include/tribufu++/model/UserType.h @@ -13,52 +13,52 @@ /* * UserType.h * - * + * */ #ifndef TRIBUFU_MODELS_UserType_H_ #define TRIBUFU_MODELS_UserType_H_ - #include "tribufu++/ModelBase.h" - -namespace tribufu { -namespace models { - - -class UserType - : public ModelBase +namespace tribufu { -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 + namespace models { - UserType_USER, - UserType_BOT, - }; - eUserType getValue() const; - void setValue(eUserType const value); + class UserType : public ModelBase + { + public: + UserType(); + virtual ~UserType(); - protected: - eUserType m_value; -}; + ///////////////////////////////////////////// + /// 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/generate.ps1 b/scripts/generate.ps1 index 21ec11d3..e0eb1930 100644 --- a/scripts/generate.ps1 +++ b/scripts/generate.ps1 @@ -1,9 +1,12 @@ #!/usr/bin/env pwsh +$env:CPP_POST_PROCESS_FILE = "clang-format -i" + java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate ` -i https://api.tribufu.com/openapi.json ` -g cpp-restsdk ` -o . ` + --enable-post-process-file ` --global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false ` --additional-properties=packageName=tribufu++,apiPackage=tribufu.api,modelPackage=tribufu.models ` --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated ` diff --git a/src/AnyType.cpp b/src/AnyType.cpp index 26bf7507..2f2a3946 100644 --- a/src/AnyType.cpp +++ b/src/AnyType.cpp @@ -12,38 +12,53 @@ #include "tribufu++/AnyType.h" -namespace tribufu { -namespace models { +namespace tribufu +{ + namespace models + { -AnyType::AnyType() { m_value = web::json::value::null(); } + AnyType::AnyType() + { + m_value = web::json::value::null(); + } -AnyType::~AnyType() {} + AnyType::~AnyType() + { + } -void AnyType::validate() {} + void AnyType::validate() + { + } -web::json::value AnyType::toJson() const { return m_value; } + 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; -} - -} + 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 index ab02bbe4..aee64086 100644 --- a/src/ApiClient.cpp +++ b/src/ApiClient.cpp @@ -11,195 +11,199 @@ */ #include "tribufu++/ApiClient.h" -#include "tribufu++/MultipartFormData.h" #include "tribufu++/ModelBase.h" +#include "tribufu++/MultipartFormData.h" -#include -#include #include +#include +#include -template -utility::string_t toString(const T value) +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(); + 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) +namespace tribufu { -} -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) + namespace api { - 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")); - } + using namespace tribufu::models; - 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) + ApiClient::ApiClient(std::shared_ptr configuration) : m_Configuration(configuration) { - uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second)); } - for (const auto& kvp : fileParams) + ApiClient::~ApiClient() { - 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) + + const ApiClient::ResponseHandlerType &ApiClient::getResponseHandler() const { - 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); + return m_ResponseHandler; } - else + + void ApiClient::setResponseHandler(const ResponseHandlerType &responseHandler) { - if (contentType == utility::conversions::to_string_t("application/json")) + 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) { - web::json::value body_data = web::json::value::object(); - for (auto& kvp : formParams) + 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) { - body_data[kvp.first] = ModelBase::toJson(kvp.second); + uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second)); } - if (!formParams.empty()) + for (const auto &kvp : fileParams) { - request.set_body(body_data); + 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 { - web::http::uri_builder formData; - for (const auto& kvp : formParams) + if (postBody != nullptr) { - formData.append_query(kvp.first, kvp.second); + 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); } - if (!formParams.empty()) + else { - request.set_body(formData.query(), utility::conversions::to_string_t("application/x-www-form-urlencoded")); + 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); } - } - 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 index 9973a88e..792a576a 100644 --- a/src/ApiConfiguration.cpp +++ b/src/ApiConfiguration.cpp @@ -12,71 +12,73 @@ #include "tribufu++/ApiConfiguration.h" -namespace tribufu { -namespace api { - -ApiConfiguration::ApiConfiguration() +namespace tribufu { -} - -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() ) + namespace api { - return result->second; + + 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; + } + } - 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 index 97dd932a..3103dc14 100644 --- a/src/ApiException.cpp +++ b/src/ApiException.cpp @@ -12,39 +12,36 @@ #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) +namespace tribufu { -} -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) -{ -} + namespace api + { -ApiException::~ApiException() -{ -} + 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) + { + } -std::shared_ptr ApiException::getContent() const -{ - return m_Content; -} + ApiException::~ApiException() + { + } -std::map& ApiException::getHeaders() -{ - return m_Headers; -} + 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 index c2f6b5fe..68f01b7b 100644 --- a/src/HttpContent.cpp +++ b/src/HttpContent.cpp @@ -12,72 +12,74 @@ #include "tribufu++/HttpContent.h" -namespace tribufu { -namespace models { - -HttpContent::HttpContent() +namespace tribufu { -} + namespace models + { -HttpContent::~HttpContent() -{ -} + HttpContent::HttpContent() + { + } -utility::string_t HttpContent::getContentDisposition() const -{ - return m_ContentDisposition; -} + HttpContent::~HttpContent() + { + } -void HttpContent::setContentDisposition( const utility::string_t & value ) -{ - m_ContentDisposition = value; -} + utility::string_t HttpContent::getContentDisposition() const + { + return m_ContentDisposition; + } -utility::string_t HttpContent::getName() const -{ - return m_Name; -} + void HttpContent::setContentDisposition(const utility::string_t &value) + { + m_ContentDisposition = value; + } -void HttpContent::setName( const utility::string_t & value ) -{ - m_Name = value; -} + utility::string_t HttpContent::getName() const + { + return m_Name; + } -utility::string_t HttpContent::getFileName() const -{ - return m_FileName; -} + void HttpContent::setName(const utility::string_t &value) + { + m_Name = value; + } -void HttpContent::setFileName( const utility::string_t & value ) -{ - m_FileName = value; -} + utility::string_t HttpContent::getFileName() const + { + return m_FileName; + } -utility::string_t HttpContent::getContentType() const -{ - return m_ContentType; -} + void HttpContent::setFileName(const utility::string_t &value) + { + m_FileName = value; + } -void HttpContent::setContentType( const utility::string_t & value ) -{ - m_ContentType = value; -} + utility::string_t HttpContent::getContentType() const + { + return m_ContentType; + } -std::shared_ptr HttpContent::getData() const -{ - return m_Data; -} + void HttpContent::setContentType(const utility::string_t &value) + { + m_ContentType = value; + } -void HttpContent::setData( std::shared_ptr value ) -{ - m_Data = value; -} + std::shared_ptr HttpContent::getData() const + { + return m_Data; + } -void HttpContent::writeTo( std::ostream& stream ) -{ - m_Data->seekg( 0, m_Data->beg ); - stream << m_Data->rdbuf(); -} + 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 index 6619009a..7e9b87ee 100644 --- a/src/JsonBody.cpp +++ b/src/JsonBody.cpp @@ -12,22 +12,23 @@ #include "tribufu++/JsonBody.h" -namespace tribufu { -namespace models { - -JsonBody::JsonBody( const web::json::value& json) - : m_Json(json) +namespace tribufu { -} + namespace models + { -JsonBody::~JsonBody() -{ -} + JsonBody::JsonBody(const web::json::value &json) : m_Json(json) + { + } -void JsonBody::writeTo( std::ostream& target ) -{ - m_Json.serialize(target); -} + JsonBody::~JsonBody() + { + } -} + void JsonBody::writeTo(std::ostream &target) + { + m_Json.serialize(target); + } + + } } diff --git a/src/ModelBase.cpp b/src/ModelBase.cpp index 18e2b197..7642168b 100644 --- a/src/ModelBase.cpp +++ b/src/ModelBase.cpp @@ -12,651 +12,693 @@ #include "tribufu++/ModelBase.h" -namespace tribufu { -namespace models { +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) + ModelBase::ModelBase() : m_IsSet(false) { - 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) + ModelBase::~ModelBase() { - 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) + bool ModelBase::isSet() const { - content = std::shared_ptr(new HttpContent()); + return m_IsSet; } - if(val.has_field(utility::conversions::to_string_t("ContentDisposition"))) + utility::string_t ModelBase::toString(const bool val) { - utility::string_t value; - result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("ContentDisposition")), value); - content->setContentDisposition( value ); + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); } - if(val.has_field(utility::conversions::to_string_t("ContentType"))) + utility::string_t ModelBase::toString(const float val) { - utility::string_t value; - result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("ContentType")), value); - content->setContentType( value ); + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); } - if(val.has_field(utility::conversions::to_string_t("FileName"))) + utility::string_t ModelBase::toString(const double val) { - utility::string_t value; - result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("FileName")), value); - content->setFileName( value ); + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); } - if(val.has_field(utility::conversions::to_string_t("InputStream"))) + utility::string_t ModelBase::toString(const int32_t val) { - utility::string_t value; - result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("InputStream")), value); - content->setData( ModelBase::fromBase64( value ) ); + utility::stringstream_t ss; + ss << val; + return utility::string_t(ss.str()); } - } - 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++ ) + utility::string_t ModelBase::toString(const int64_t val) { - temp <<= 6; - if ( *cursor >= 0x41 && *cursor <= 0x5A ) + 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) { - temp |= *cursor - 0x41; + ss << val->getData(); } - else if ( *cursor >= 0x61 && *cursor <= 0x7A ) + 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) { - temp |= *cursor - 0x47; + 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())); } - else if ( *cursor >= 0x30 && *cursor <= 0x39 ) + return value; + } + web::json::value ModelBase::toJson(const std::shared_ptr &val) + { + web::json::value retVal; + if (val != nullptr) { - temp |= *cursor + 0x04; + retVal = toJson(*val); } - else if ( *cursor == 0x2B ) + return retVal; + } + bool ModelBase::fromString(const utility::string_t &val, bool &outVal) + { + utility::stringstream_t ss(val); + bool success = true; + try { - temp |= 0x3E; //change to 0x2D for URL alphabet + ss >> outVal; } - else if ( *cursor == 0x2F ) + catch (...) { - temp |= 0x3F; //change to 0x5F for URL alphabet + success = false; } - else if ( *cursor == Base64PadChar ) //pad + return success; + } + bool ModelBase::fromString(const utility::string_t &val, float &outVal) + { + utility::stringstream_t ss(val); + bool success = true; + try { - switch ( encoded.end() - cursor ) + ss >> outVal; + } + catch (...) + { + int64_t intVal = 0; + success = ModelBase::fromString(val, intVal); + if (success) { - 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() ); + 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 { - throw web::json::json_exception( utility::conversions::to_string_t( "Non-Valid Character in Base 64!" ).c_str() ); + success = false; } - ++cursor; + 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; } - 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 index c73395c5..329a5347 100644 --- a/src/MultipartFormData.cpp +++ b/src/MultipartFormData.cpp @@ -16,94 +16,97 @@ #include #include -namespace tribufu { -namespace models { - -MultipartFormData::MultipartFormData() +namespace tribufu { - 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()) + namespace models { - return std::shared_ptr(nullptr); + + 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"; + } + } - 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 index 9552ea80..b988cce7 100644 --- a/src/Object.cpp +++ b/src/Object.cpp @@ -12,77 +12,81 @@ #include "tribufu++/Object.h" -namespace tribufu { -namespace models { - -Object::Object() +namespace tribufu { - 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()) + namespace models { - 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)); -} + Object::Object() + { + m_object = web::json::value::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("."); - } + Object::~Object() + { + } - if( ModelBase::fromHttpContent(multipart->getContent(namePrefix + utility::conversions::to_string_t("object")), m_object ) ) - { - m_IsSet = true; - } - return isSet(); -} + void Object::validate() + { + } -web::json::value Object::getValue(const utility::string_t& key) const -{ - return m_object.at(key); -} + 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; + } + } -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 index f6af567d..cfc42b55 100644 --- a/src/api/TribufuGeneratedApi.cpp +++ b/src/api/TribufuGeneratedApi.cpp @@ -10,7 +10,6 @@ * Do not edit the class manually. */ - #include "tribufu++/api/TribufuGeneratedApi.h" #include "tribufu++/IHttpBody.h" #include "tribufu++/JsonBody.h" @@ -20,9826 +19,11200 @@ #include -namespace tribufu { -namespace api { - -using namespace tribufu::models; - -TribufuGeneratedApi::TribufuGeneratedApi( std::shared_ptr apiClient ) - : m_ApiClient(apiClient) +namespace tribufu { -} + namespace api + { -TribufuGeneratedApi::~TribufuGeneratedApi() -{ -} + using namespace tribufu::models; -pplx::task TribufuGeneratedApi::authorize(boost::optional> authorizeRequest) const -{ + TribufuGeneratedApi::TribufuGeneratedApi(std::shared_ptr apiClient) : m_ApiClient(apiClient) + { + } + TribufuGeneratedApi::~TribufuGeneratedApi() + { + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/authorize"); + pplx::task TribufuGeneratedApi::authorize( + boost::optional> authorizeRequest) const + { - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + std::shared_ptr localVarApiConfiguration(m_ApiClient->getConfiguration()); + utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/authorize"); - std::unordered_set localVarResponseHttpContentTypes; + std::map localVarQueryParams; + std::map localVarHeaderParams( + localVarApiConfiguration->getDefaultHeaders()); + std::map localVarFormParams; + std::map> localVarFileParams; - utility::string_t localVarResponseHttpContentType; + std::unordered_set localVarResponseHttpContentTypes; - // 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")); - } + utility::string_t localVarResponseHttpContentType; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = 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")); + } - 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") ); + 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; + 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; + // 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); + 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); + 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")); + } - if(authorizeRequest && (*authorizeRequest).get()) - { - (*authorizeRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("authorizeRequest")); - } - + // 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; + } + } - 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + 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")); - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling authorize: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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())); - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task TribufuGeneratedApi::changeEmail(utility::string_t id, boost::optional> body) const -{ + 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; + } + } - 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))); + 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set localVarResponseHttpContentTypes; + 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")); - utility::string_t localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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")); - } + // 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; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + localVarJson = ModelBase::toJson(body.get()); - 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") ); + 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + // 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; + } + } - // 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; + 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")); + } - localVarJson = ModelBase::toJson(body.get()); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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())); - + 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")); - 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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; - } - } + // 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; - 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()); - } + localVarJson = ModelBase::toJson(body.get()); - // 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())); - } + 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())); - // 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 ) + 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()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling changeEmail: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task TribufuGeneratedApi::changePassword(utility::string_t id, boost::optional> body) const -{ + // 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")); + } - 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))); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + 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::unordered_set localVarResponseHttpContentTypes; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - utility::string_t localVarResponseHttpContentType; + // 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; - // 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")); - } + if (cryptoViewModel) + localVarJson = ModelBase::toJson(*cryptoViewModel); - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + 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")); + } - 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") ); + // 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; + 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")); - localVarJson = ModelBase::toJson(body.get()); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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())); - + // 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; - 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")); - } + localVarJson = ModelBase::toJson(body.get()); - // 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; - } - } + 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())); - 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()); - } + 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")); + } - // 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())); - } + // 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; + } + } - // 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 ) + 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) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling changePassword: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task TribufuGeneratedApi::claimGameServer(utility::string_t id, boost::optional> body) const -{ + 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 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::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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; - std::unordered_set localVarResponseHttpContentTypes; + localVarJson = ModelBase::toJson(body.get()); - utility::string_t localVarResponseHttpContentType; + 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())); - // 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")); - } + 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")); + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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; + } + } - 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") ); + 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::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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")); - // 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; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - localVarJson = ModelBase::toJson(body.get()); + // 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; - 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())); - + localVarJson = ModelBase::toJson(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")); - } + 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())); - // 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()); - } + 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")); + } - // 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())); - } + // 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; + } + } - // 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 ) + 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) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling claimGameServer: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task> TribufuGeneratedApi::convertBase64(boost::optional> cryptoViewModel) const -{ + 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 localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/base64"); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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; - 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") ); + if (tokenRequest) + localVarJson = ModelBase::toJson(*tokenRequest); - utility::string_t localVarResponseHttpContentType; + 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); - // 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")); - } + if (tokenRequest && (*tokenRequest).get()) + { + (*tokenRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("tokenRequest")); + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + 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")); + } - 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") ); + // 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; + std::unordered_set localVarConsumeHttpContentTypes; - if (cryptoViewModel) - localVarJson = ModelBase::toJson(*cryptoViewModel); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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); + // 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")); + } - if(cryptoViewModel && (*cryptoViewModel).get()) - { - (*cryptoViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("cryptoViewModel")); - } - + // 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; + } + } - 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling convertBase64: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new CryptoViewModel()); + // 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; + } + } - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + 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")); + } - 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")); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - return localVarResult; - }); -} -pplx::task TribufuGeneratedApi::createGameServer(boost::optional> body) const -{ + std::unordered_set localVarConsumeHttpContentTypes; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers"); + // 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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; + } + } - std::unordered_set localVarResponseHttpContentTypes; + 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")); + } - utility::string_t localVarResponseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = 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")); - } + std::unordered_set localVarConsumeHttpContentTypes; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + if (amount) + { + localVarQueryParams[utility::conversions::to_string_t("amount")] = + ApiClient::parameterToString(*amount); + } - 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"); + } + // 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + // 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; + } + } - // 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; + 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")); + } - localVarJson = ModelBase::toJson(body.get()); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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())); - + std::unordered_set localVarConsumeHttpContentTypes; - 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")); - } + if (amount) + { + localVarQueryParams[utility::conversions::to_string_t("amount")] = + ApiClient::parameterToString(*amount); + } - // 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; - } - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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()); - } + // 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")); + } - // 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())); - } + // 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; + } + } - // 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 ) + 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) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling createGameServer: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task TribufuGeneratedApi::createGameServerCluster(boost::optional> body) const -{ + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters"); + 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::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::unordered_set localVarResponseHttpContentTypes; + // 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")); + } - utility::string_t localVarResponseHttpContentType; + // 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; + } + } - // 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")); - } + 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; + 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::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; + 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; + // 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")); + } - localVarJson = ModelBase::toJson(body.get()); + // 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; + } + } - 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())); - + 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")); + } - 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling createGameServerCluster: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task TribufuGeneratedApi::createGroup(boost::optional> body) const -{ + // 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")); + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups"); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + std::unordered_set localVarConsumeHttpContentTypes; - std::unordered_set localVarResponseHttpContentTypes; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - utility::string_t localVarResponseHttpContentType; + // 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")); + } - // 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")); - } + // 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; + } + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + 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")); + } - 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") ); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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; + // 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")); + } - localVarJson = ModelBase::toJson(body.get()); + // 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; + } + } - 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())); - + 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")); + } - 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")); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; - } - } + std::unordered_set localVarConsumeHttpContentTypes; - 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()); - } + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling createGroup: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task> TribufuGeneratedApi::createToken(boost::optional> tokenRequest) const -{ + // 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; + } + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/token"); + 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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") ); + std::unordered_set localVarConsumeHttpContentTypes; - utility::string_t localVarResponseHttpContentType; + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } - // 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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")); + } - 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") ); + // 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; + std::unordered_set localVarConsumeHttpContentTypes; - if (tokenRequest) - localVarJson = ModelBase::toJson(*tokenRequest); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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); + // 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")); + } - if(tokenRequest && (*tokenRequest).get()) - { - (*tokenRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("tokenRequest")); - } - + // 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; + } + } - 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling createToken: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new TokenResponse()); + // 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; + } + } - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + 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")); + } - 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")); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - return localVarResult; - }); -} -pplx::task TribufuGeneratedApi::deleteGameServer(utility::string_t id) const -{ + std::unordered_set localVarConsumeHttpContentTypes; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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))); + // 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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; + } + } - std::unordered_set localVarResponseHttpContentTypes; + 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")); + } - utility::string_t localVarResponseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = 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")); - } + std::unordered_set localVarConsumeHttpContentTypes; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + 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::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->getGameServerClusters does not consume any supported media type")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + // 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; + } + } - // 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 ) + 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) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling getUserInfo: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } - } - - 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 ) + // JSON + else if (localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarResponseHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling getUserPunishments: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } - } - - 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() ) + // multipart formdata + else if (localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != + localVarResponseHttpContentTypes.end()) { - std::shared_ptr localVarItemObj; - ModelBase::fromJson(localVarItem, localVarItemObj); - localVarResult.push_back(localVarItemObj); + 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")); } - } - // 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()); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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())); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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 ) + if (page) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling getUserServers: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); } - } - - 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() ) + if (limit) { - std::shared_ptr localVarItemObj; - ModelBase::fromJson(localVarItem, localVarItemObj); - localVarResult.push_back(localVarItemObj); + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); } - } - // 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 localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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; + // 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")); + } - 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") ); + // 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; + } + } - utility::string_t localVarResponseHttpContentType; + 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")); + } - // 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; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - 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); + } - 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; - 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")); + } - // 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; + } + } - // 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")); + } - 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()); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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())); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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 ) + if (page) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling getUsers: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::vector> localVarResult; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); - for( auto& localVarItem : localVarJson.as_array() ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - std::shared_ptr localVarItemObj; - ModelBase::fromJson(localVarItem, localVarItemObj); - localVarResult.push_back(localVarItemObj); + 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")); } - } - // 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 -{ + // 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")); + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/argon2"); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + std::unordered_set localVarConsumeHttpContentTypes; - 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") ); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - utility::string_t localVarResponseHttpContentType; + // 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")); + } - // 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")); - } + // 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; + } + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + 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")); + } - 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") ); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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; + // 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")); + } - if (hashViewModel) - localVarJson = ModelBase::toJson(*hashViewModel); + // 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; + } + } - 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); + 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")); + } - if(hashViewModel && (*hashViewModel).get()) - { - (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); - } - + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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; - } - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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()); - } + // 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")); + } - // 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())); - } + // 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; + } + } - // 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 ) + 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) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling hashArgon2: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new HashViewModel()); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + std::unordered_set localVarConsumeHttpContentTypes; - 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - return localVarResult; - }); -} -pplx::task> TribufuGeneratedApi::hashBcrypt(boost::optional> hashViewModel) const -{ + // 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; + } + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/bcrypt"); + 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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") ); + std::unordered_set localVarConsumeHttpContentTypes; - utility::string_t localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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")); - } + // 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")); + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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; + } + } - 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") ); + 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::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - // 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; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - if (hashViewModel) - localVarJson = ModelBase::toJson(*hashViewModel); + // 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")); + } - 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); + // 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; + } + } - if(hashViewModel && (*hashViewModel).get()) - { - (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); - } - + 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")); + } - 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")); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; - } - } + std::unordered_set localVarConsumeHttpContentTypes; - 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()); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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())); - } + // 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")); + } - // 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 ) + // authentication (ApiKey) required { - throw ApiException(500 - , utility::conversions::to_string_t("error calling hashBcrypt: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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 localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new HashViewModel()); + 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")); + } - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + std::unordered_set localVarConsumeHttpContentTypes; - return localVarResult; - }); -} -pplx::task> TribufuGeneratedApi::hashMd5(boost::optional> hashViewModel) const -{ + 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")); + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/md5"); + // 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; + } + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + 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")); + } - 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") ); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - utility::string_t localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - // 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")); - } + if (page) + { + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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") ); + // 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; + } + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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")); + } - // 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; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - if (hashViewModel) - localVarJson = ModelBase::toJson(*hashViewModel); + std::unordered_set localVarConsumeHttpContentTypes; - 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); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - if(hashViewModel && (*hashViewModel).get()) - { - (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); - } - + // 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")); + } - 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; + } + } - // 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")); + } - 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()); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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())); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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 ) + if (page) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling hashMd5: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); } - } - - 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); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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")); - } + // 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")); + } - return localVarResult; - }); -} -pplx::task> TribufuGeneratedApi::hashSha256(boost::optional> hashViewModel) const -{ + // 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")); + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/sha256"); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + std::unordered_set localVarConsumeHttpContentTypes; - 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") ); + if (order && *order != nullptr) + { + localVarQueryParams[utility::conversions::to_string_t("Order")] = ApiClient::parameterToString(*order); + } - utility::string_t localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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")); - } + // 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")); + } - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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; + } + } - 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") ); + 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::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - // 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; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - if (hashViewModel) - localVarJson = ModelBase::toJson(*hashViewModel); + // 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")); + } - 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); + // 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; + } + } - if(hashViewModel && (*hashViewModel).get()) - { - (*hashViewModel)->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel")); - } - + 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")); + } - 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")); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; - } - } + std::unordered_set localVarConsumeHttpContentTypes; - 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()); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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())); - } + // 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")); + } - // 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 ) + // authentication (ApiKey) required { - throw ApiException(500 - , utility::conversions::to_string_t("error calling hashSha256: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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 localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new HashViewModel()); + 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")); + } - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + std::unordered_set localVarConsumeHttpContentTypes; - return localVarResult; - }); -} -pplx::task TribufuGeneratedApi::introspectToken(boost::optional> introspectRequest) const -{ + 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; - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/introspect"); + // 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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; + } + } - std::unordered_set localVarResponseHttpContentTypes; + 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")); + } - utility::string_t localVarResponseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = 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")); - } + std::unordered_set localVarConsumeHttpContentTypes; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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") ); + // 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; + } + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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")); + } - // 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; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - if (introspectRequest) - localVarJson = ModelBase::toJson(*introspectRequest); + std::unordered_set localVarConsumeHttpContentTypes; - 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); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - if(introspectRequest && (*introspectRequest).get()) - { - (*introspectRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("introspectRequest")); - } - + // 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")); + } - 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; + } + } - // 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")); + } - 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()); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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())); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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 ) + if (page) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling introspectToken: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page); + } + if (limit) + { + localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task> TribufuGeneratedApi::login(boost::optional> loginRequest) const -{ + 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")); + } - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/login"); + // 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; + } + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + 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")); + } - 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") ); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - utility::string_t localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - // 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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")); + } - 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") ); + // 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; + std::unordered_set localVarConsumeHttpContentTypes; - if (loginRequest) - localVarJson = ModelBase::toJson(*loginRequest); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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); + // 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")); + } - if(loginRequest && (*loginRequest).get()) - { - (*loginRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("loginRequest")); - } - + // 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; + } + } - 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling login: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - 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); + // 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; + } + } - 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 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")); + } - return localVarResult; - }); -} -pplx::task TribufuGeneratedApi::logout() const -{ + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/logout"); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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")); + } - std::unordered_set localVarResponseHttpContentTypes; + // 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; + } + } - utility::string_t localVarResponseHttpContentType; + 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")); + } - // 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; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + // 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; + } + } - // 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling logout: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - 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"); + // 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; + } + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + 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")); + } - 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") ); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - utility::string_t localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - // 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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")); + } - 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") ); + // 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - // 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; + std::unordered_set localVarConsumeHttpContentTypes; - if (registerRequest) - localVarJson = ModelBase::toJson(*registerRequest); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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); + // 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")); + } - if(registerRequest && (*registerRequest).get()) - { - (*registerRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("registerRequest")); - } - + // 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; + } + } - 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + std::unordered_set localVarConsumeHttpContentTypes; - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling r_register: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new LoginResponse()); + // 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; + } + } - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + 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")); + } - 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")); - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - return localVarResult; - }); -} -pplx::task> TribufuGeneratedApi::refresh(boost::optional> refreshRequest) const -{ + 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 localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/refresh"); + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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")); + } - 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") ); + // 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; + } + } - utility::string_t localVarResponseHttpContentType; + 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")); + } - // 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; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::unordered_set localVarConsumeHttpContentTypes; - 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") ); + 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; - 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")); + } - // 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; + // 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; + } + } - if (refreshRequest) - localVarJson = ModelBase::toJson(*refreshRequest); + 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")); + } - 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); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - if(refreshRequest && (*refreshRequest).get()) - { - (*refreshRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("refreshRequest")); - } - + 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")); - 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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; - } - } + // 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; - 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()); - } + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); - // 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())); - } + 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")); + } - // 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 ) + // authentication (ApiKey) required { - throw ApiException(500 - , utility::conversions::to_string_t("error calling refresh: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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 localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - std::shared_ptr localVarResult(new LoginResponse()); + 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")); + } - if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) - { - web::json::value localVarJson = web::json::value::parse(localVarResponse); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + 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")); - return localVarResult; - }); -} -pplx::task TribufuGeneratedApi::revokeToken(boost::optional> revokeRequest) const -{ + 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; - std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/revoke"); + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + 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")); + } - std::unordered_set localVarResponseHttpContentTypes; + // 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; + } + } - utility::string_t localVarResponseHttpContentType; + 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")); + } - // 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; - 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::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; - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); - // 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; + 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")); + } - if (revokeRequest) - localVarJson = ModelBase::toJson(*revokeRequest); + // 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; + } + } - 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); + 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")); + } - if(revokeRequest && (*revokeRequest).get()) - { - (*revokeRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("revokeRequest")); - } - + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + 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")); - // 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; - } - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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()); - } + // 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; - // 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())); - } + if (hashViewModel) + localVarJson = ModelBase::toJson(*hashViewModel); - // 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 ) + localVarHttpBody = std::shared_ptr(new JsonBody(localVarJson)); + } + // multipart formdata + else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling revokeToken: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - 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"); + // 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; + } + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + 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")); + } - 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") ); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - utility::string_t 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")); - // 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + // 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; - 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") ); + 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + // 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; + } + } - // 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; + 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")); + } - if (searchRequest) - localVarJson = ModelBase::toJson(*searchRequest); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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); + 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")); - if(searchRequest && (*searchRequest).get()) - { - (*searchRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("searchRequest")); - } - + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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")); - } + // 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; - // 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; - } - } + if (loginRequest) + localVarJson = ModelBase::toJson(*loginRequest); - 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()); - } + 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); - // 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())); - } + if (loginRequest && (*loginRequest).get()) + { + (*loginRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("loginRequest")); + } - // 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 ) + 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()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling search: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - 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() ) + // authentication (ApiKey) required { - std::shared_ptr localVarItemObj; - ModelBase::fromJson(localVarItem, localVarItemObj); - localVarResult.push_back(localVarItemObj); + utility::string_t localVarApiKey = + localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization")); + if (localVarApiKey.size() > 0) + { + localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey; + } } - } - // 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 -{ + 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::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::unordered_set localVarConsumeHttpContentTypes; - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - std::unordered_set localVarResponseHttpContentTypes; + // 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")); + } - utility::string_t localVarResponseHttpContentType; + // 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; + } + } - // 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")); - } + 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; + 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::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; - 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; - // 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); - 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); + + 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")); + } - 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())); - + // 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; + } + } - 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")); - } + 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")); + } - // 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; - } - } + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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()); - } + 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")); - // 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())); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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 ) + // use JSON if possible + if (localVarConsumeHttpContentTypes.size() == 0 || + localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != + localVarConsumeHttpContentTypes.end()) { - 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 -{ + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; + if (refreshRequest) + localVarJson = ModelBase::toJson(*refreshRequest); - 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))); + 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + // 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; + } + } - std::unordered_set localVarResponseHttpContentTypes; + 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")); + } - utility::string_t localVarResponseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = 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")); - } + 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")); - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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") ); + // 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); - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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")); + } - // 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; + // 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; + } + } - localVarJson = ModelBase::toJson(body.get()); + 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")); + } - 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())); - + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + 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")); - // 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; - } - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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()); - } + // 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; - // 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())); - } + if (searchRequest) + localVarJson = ModelBase::toJson(*searchRequest); - // 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 ) + localVarHttpBody = std::shared_ptr(new JsonBody(localVarJson)); + } + // multipart formdata + else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling updateGameServerCluster: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - return localVarResponse.extract_string(); - }) - .then([=, this](utility::string_t localVarResponse) - { - return void(); - }); -} -pplx::task TribufuGeneratedApi::updateGroup(utility::string_t id, boost::optional> body) const -{ + // 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; + } + } - 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))); + 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")); + } - std::map localVarQueryParams; - std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); - std::map localVarFormParams; - std::map> localVarFileParams; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set localVarResponseHttpContentTypes; + 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")); - utility::string_t localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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")); - } + // 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; - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + localVarJson = ModelBase::toJson(body.get()); - 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") ); + 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")); + } - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + // 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; + } + } - // 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; + 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")); + } - localVarJson = ModelBase::toJson(body.get()); + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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())); - + 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")); - 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")); - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - // 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; - } - } + // 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; - 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()); - } + localVarJson = ModelBase::toJson(body.get()); - // 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())); - } + 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())); - // 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 ) + 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()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling updateGroup: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - 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; + // 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; + } + } - 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") ); + 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")); + } - utility::string_t localVarResponseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = 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")); - } + 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")); - localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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") ); + // 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()); - std::shared_ptr localVarHttpBody; - utility::string_t localVarRequestHttpContentType; + 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())); - // 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; + 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")); + } - if (updateProfile) - localVarJson = ModelBase::toJson(*updateProfile); + // 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; + } + } - 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); + 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")); + } - if(updateProfile && (*updateProfile).get()) - { - (*updateProfile)->toMultipart(localVarMultipart, utility::conversions::to_string_t("updateProfile")); - } - + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - 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")); - } + 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")); - // 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; - } - } + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; - 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()); - } + // 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; - // 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())); - } + if (updateProfile) + localVarJson = ModelBase::toJson(*updateProfile); - // 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 ) + localVarHttpBody = std::shared_ptr(new JsonBody(localVarJson)); + } + // multipart formdata + else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != + localVarConsumeHttpContentTypes.end()) { - throw ApiException(500 - , utility::conversions::to_string_t("error calling updateUserProfile: unexpected response type: ") + localVarContentType - , std::make_shared(localVarResponse.extract_utf8string(true).get())); + 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")); } - } - - 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); + // 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; + } + } - 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 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; + }); } - return localVarResult; - }); -} - -} + } } - diff --git a/src/model/Account.cpp b/src/model/Account.cpp index c3fa062b..5f32dee3 100644 --- a/src/model/Account.cpp +++ b/src/model/Account.cpp @@ -10,452 +10,451 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Account.h" -namespace tribufu { -namespace models { - -Account::Account() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + Account::Account() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + Account::~Account() { - 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()) + + void Account::validate() { - std::shared_ptr refVal_setProvider; - ok &= ModelBase::fromJson(fieldValue, refVal_setProvider); - setProvider(refVal_setProvider); - + // TODO: implement validation } - } - 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()) + + web::json::value Account::toJson() const { - utility::string_t refVal_setUserId; - ok &= ModelBase::fromJson(fieldValue, refVal_setUserId); - setUserId(refVal_setUserId); - + 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; } - } - 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 Account::fromJson(const web::json::value &val) { - bool refVal_setAuthorized; - ok &= ModelBase::fromJson(fieldValue, refVal_setAuthorized); - setAuthorized(refVal_setAuthorized); - + 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; } - } - 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()) + + void Account::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - std::shared_ptr refVal_setFields; - ok &= ModelBase::fromJson(fieldValue, refVal_setFields); - setFields(refVal_setFields); - + 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)); + } } - } - 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()) + + bool Account::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + 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; } - } - 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::string_t Account::getId() const { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index 20f5fe6f..32cfee49 100644 --- a/src/model/Application.cpp +++ b/src/model/Application.cpp @@ -10,1036 +10,1046 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Application.h" -namespace tribufu { -namespace models { - -Application::Application() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + Application::Application() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + Application::~Application() { - 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()) + + void Application::validate() { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + // TODO: implement validation } - } - 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()) + + web::json::value Application::toJson() const { - std::shared_ptr refVal_setType; - ok &= ModelBase::fromJson(fieldValue, refVal_setType); - setType(refVal_setType); - + 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; } - } - 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()) + + bool Application::fromJson(const web::json::value &val) { - utility::string_t refVal_setOrganizationId; - ok &= ModelBase::fromJson(fieldValue, refVal_setOrganizationId); - setOrganizationId(refVal_setOrganizationId); - + 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; } - } - 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()) + + void Application::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - utility::string_t refVal_setIconUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setIconUrl); - setIconUrl(refVal_setIconUrl); - + 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)); + } } - } - 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()) + + bool Application::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + 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; } - } - 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 Application::getId() const { - utility::string_t refVal_setCapsuleImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setCapsuleImageUrl); - setCapsuleImageUrl(refVal_setCapsuleImageUrl); - + return m_Id; } - } - 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()) + + void Application::setId(const utility::string_t &value) { - utility::string_t refVal_setLibraryImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setLibraryImageUrl); - setLibraryImageUrl(refVal_setLibraryImageUrl); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool Application::idIsSet() const { - utility::string_t refVal_setParentId; - ok &= ModelBase::fromJson(fieldValue, refVal_setParentId); - setParentId(refVal_setParentId); - + return m_IdIsSet; } - } - 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()) + + void Application::unsetId() { - utility::string_t refVal_setSlug; - ok &= ModelBase::fromJson(fieldValue, refVal_setSlug); - setSlug(refVal_setSlug); - + m_IdIsSet = false; } - } - 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()) + utility::string_t Application::getName() const { - int32_t refVal_setVisibility; - ok &= ModelBase::fromJson(fieldValue, refVal_setVisibility); - setVisibility(refVal_setVisibility); - + return m_Name; } - } - 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()) + + void Application::setName(const utility::string_t &value) { - utility::string_t refVal_setPassword; - ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); - setPassword(refVal_setPassword); - + m_Name = value; + m_NameIsSet = true; } - } - 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()) + + bool Application::nameIsSet() const { - int32_t refVal_setPrimary; - ok &= ModelBase::fromJson(fieldValue, refVal_setPrimary); - setPrimary(refVal_setPrimary); - + return m_NameIsSet; } - } - 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()) + + void Application::unsetName() { - int32_t refVal_setUserCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setUserCount); - setUserCount(refVal_setUserCount); - + m_NameIsSet = false; } - } - 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()) + utility::string_t Application::getDescription() const { - int32_t refVal_setAchievementCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setAchievementCount); - setAchievementCount(refVal_setAchievementCount); - + return m_Description; } - } - 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()) + + void Application::setDescription(const utility::string_t &value) { - int32_t refVal_setBadgeCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setBadgeCount); - setBadgeCount(refVal_setBadgeCount); - + m_Description = value; + m_DescriptionIsSet = true; } - } - 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()) + + bool Application::descriptionIsSet() const { - int32_t refVal_setDownloadCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount); - setDownloadCount(refVal_setDownloadCount); - + return m_DescriptionIsSet; } - } - 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()) + + void Application::unsetDescription() { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + m_DescriptionIsSet = false; } - } - 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()) + std::shared_ptr Application::getType() const { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index d3b042ce..25662917 100644 --- a/src/model/ApplicationType.cpp +++ b/src/model/ApplicationType.cpp @@ -10,109 +10,109 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/ApplicationType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index 94b0a078..e635b7a7 100644 --- a/src/model/AuthorizeRequest.cpp +++ b/src/model/AuthorizeRequest.cpp @@ -10,404 +10,411 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/AuthorizeRequest.h" -namespace tribufu { -namespace models { - -AuthorizeRequest::AuthorizeRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("response_type"))); - if(!fieldValue.is_null()) + + AuthorizeRequest::AuthorizeRequest() { - std::shared_ptr refVal_setResponseType; - ok &= ModelBase::fromJson(fieldValue, refVal_setResponseType); - setResponseType(refVal_setResponseType); - + 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; } - } - 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()) + + AuthorizeRequest::~AuthorizeRequest() { - 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()) + + void AuthorizeRequest::validate() { - utility::string_t refVal_setCodeChallenge; - ok &= ModelBase::fromJson(fieldValue, refVal_setCodeChallenge); - setCodeChallenge(refVal_setCodeChallenge); - + // TODO: implement validation } - } - 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()) + + web::json::value AuthorizeRequest::toJson() const { - std::shared_ptr refVal_setCodeChallengeMethod; - ok &= ModelBase::fromJson(fieldValue, refVal_setCodeChallengeMethod); - setCodeChallengeMethod(refVal_setCodeChallengeMethod); - + 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; } - } - 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()) + + bool AuthorizeRequest::fromJson(const web::json::value &val) { - utility::string_t refVal_setRedirectUri; - ok &= ModelBase::fromJson(fieldValue, refVal_setRedirectUri); - setRedirectUri(refVal_setRedirectUri); - + 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; } - } - 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()) + + void AuthorizeRequest::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - utility::string_t refVal_setScope; - ok &= ModelBase::fromJson(fieldValue, refVal_setScope); - setScope(refVal_setScope); - + 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)); + } } - } - 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()) + + bool AuthorizeRequest::fromMultiPart(std::shared_ptr multipart, + const utility::string_t &prefix) { - utility::string_t refVal_setState; - ok &= ModelBase::fromJson(fieldValue, refVal_setState); - setState(refVal_setState); - + 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; } - } - 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 index fdf6c5a3..fe6798c7 100644 --- a/src/model/CodeChallengeMethod.cpp +++ b/src/model/CodeChallengeMethod.cpp @@ -10,109 +10,109 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/CodeChallengeMethod.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index e1f11607..c1f6d1f0 100644 --- a/src/model/CryptoViewModel.cpp +++ b/src/model/CryptoViewModel.cpp @@ -10,161 +10,162 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/CryptoViewModel.h" -namespace tribufu { -namespace models { - -CryptoViewModel::CryptoViewModel() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("encoded"))); - if(!fieldValue.is_null()) + + CryptoViewModel::CryptoViewModel() { - utility::string_t refVal_setEncoded; - ok &= ModelBase::fromJson(fieldValue, refVal_setEncoded); - setEncoded(refVal_setEncoded); - + m_Encoded = utility::conversions::to_string_t(""); + m_EncodedIsSet = false; + m_Decoded = utility::conversions::to_string_t(""); + m_DecodedIsSet = false; } - } - 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()) + + CryptoViewModel::~CryptoViewModel() { - 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)); + 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; + } + } } - -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 index f16d9ebb..bb081c83 100644 --- a/src/model/Game.cpp +++ b/src/model/Game.cpp @@ -10,1568 +10,1592 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Game.h" -namespace tribufu { -namespace models { - -Game::Game() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("game_port"))); - if(!fieldValue.is_null()) + + Game::Game() { - int32_t refVal_setGamePort; - ok &= ModelBase::fromJson(fieldValue, refVal_setGamePort); - setGamePort(refVal_setGamePort); - + 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; } - } - 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()) + + Game::~Game() { - 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()) + + void Game::validate() { - int32_t refVal_setRconPort; - ok &= ModelBase::fromJson(fieldValue, refVal_setRconPort); - setRconPort(refVal_setRconPort); - + // TODO: implement validation } - } - 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()) + + web::json::value Game::toJson() const { - int32_t refVal_setServerCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setServerCount); - setServerCount(refVal_setServerCount); - + 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; } - } - 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()) + + bool Game::fromJson(const web::json::value &val) { - int32_t refVal_setSteamAppId; - ok &= ModelBase::fromJson(fieldValue, refVal_setSteamAppId); - setSteamAppId(refVal_setSteamAppId); - + 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; } - } - 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()) + + void Game::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - int32_t refVal_setSteamServerAppId; - ok &= ModelBase::fromJson(fieldValue, refVal_setSteamServerAppId); - setSteamServerAppId(refVal_setSteamServerAppId); - + 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)); + } } - } - 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 Game::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - bool refVal_setEnableServers; - ok &= ModelBase::fromJson(fieldValue, refVal_setEnableServers); - setEnableServers(refVal_setEnableServers); - + 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; } - } - 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()) + + int32_t Game::getGamePort() const { - utility::string_t refVal_setRustGamedigId; - ok &= ModelBase::fromJson(fieldValue, refVal_setRustGamedigId); - setRustGamedigId(refVal_setRustGamedigId); - + return m_Game_port; } - } - 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()) + + void Game::setGamePort(int32_t value) { - utility::string_t refVal_setNodeGamedigId; - ok &= ModelBase::fromJson(fieldValue, refVal_setNodeGamedigId); - setNodeGamedigId(refVal_setNodeGamedigId); - + m_Game_port = value; + m_Game_portIsSet = true; } - } - 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()) + + bool Game::gamePortIsSet() const { - utility::string_t refVal_setServerConnectUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setServerConnectUrl); - setServerConnectUrl(refVal_setServerConnectUrl); - + return m_Game_portIsSet; } - } - 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()) + + void Game::unsetGame_port() { - utility::string_t refVal_setServerTags; - ok &= ModelBase::fromJson(fieldValue, refVal_setServerTags); - setServerTags(refVal_setServerTags); - + m_Game_portIsSet = false; } - } - 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()) + int32_t Game::getQueryPort() const { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + return m_Query_port; } - } - 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()) + + void Game::setQueryPort(int32_t value) { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + m_Query_port = value; + m_Query_portIsSet = true; } - } - 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()) + + bool Game::queryPortIsSet() const { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + return m_Query_portIsSet; } - } - 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()) + + void Game::unsetQuery_port() { - std::shared_ptr refVal_setType; - ok &= ModelBase::fromJson(fieldValue, refVal_setType); - setType(refVal_setType); - + m_Query_portIsSet = false; } - } - 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()) + int32_t Game::getRconPort() const { - utility::string_t refVal_setOrganizationId; - ok &= ModelBase::fromJson(fieldValue, refVal_setOrganizationId); - setOrganizationId(refVal_setOrganizationId); - + return m_Rcon_port; } - } - 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()) + + void Game::setRconPort(int32_t value) { - utility::string_t refVal_setIconUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setIconUrl); - setIconUrl(refVal_setIconUrl); - + m_Rcon_port = value; + m_Rcon_portIsSet = true; } - } - 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()) + + bool Game::rconPortIsSet() const { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + return m_Rcon_portIsSet; } - } - 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()) + + void Game::unsetRcon_port() { - utility::string_t refVal_setCapsuleImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setCapsuleImageUrl); - setCapsuleImageUrl(refVal_setCapsuleImageUrl); - + m_Rcon_portIsSet = false; } - } - 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()) + int32_t Game::getServerCount() const { - utility::string_t refVal_setLibraryImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setLibraryImageUrl); - setLibraryImageUrl(refVal_setLibraryImageUrl); - + return m_Server_count; } - } - 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()) + + void Game::setServerCount(int32_t value) { - utility::string_t refVal_setParentId; - ok &= ModelBase::fromJson(fieldValue, refVal_setParentId); - setParentId(refVal_setParentId); - + m_Server_count = value; + m_Server_countIsSet = true; } - } - 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()) + + bool Game::serverCountIsSet() const { - utility::string_t refVal_setSlug; - ok &= ModelBase::fromJson(fieldValue, refVal_setSlug); - setSlug(refVal_setSlug); - + return m_Server_countIsSet; } - } - 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()) + + void Game::unsetServer_count() { - int32_t refVal_setVisibility; - ok &= ModelBase::fromJson(fieldValue, refVal_setVisibility); - setVisibility(refVal_setVisibility); - + m_Server_countIsSet = false; } - } - 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()) + int32_t Game::getSteamAppId() const { - utility::string_t refVal_setPassword; - ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); - setPassword(refVal_setPassword); - + return m_Steam_app_id; } - } - 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()) + + void Game::setSteamAppId(int32_t value) { - int32_t refVal_setPrimary; - ok &= ModelBase::fromJson(fieldValue, refVal_setPrimary); - setPrimary(refVal_setPrimary); - + m_Steam_app_id = value; + m_Steam_app_idIsSet = true; } - } - 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()) + + bool Game::steamAppIdIsSet() const { - int32_t refVal_setUserCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setUserCount); - setUserCount(refVal_setUserCount); - + return m_Steam_app_idIsSet; } - } - 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()) + + void Game::unsetSteam_app_id() { - int32_t refVal_setAchievementCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setAchievementCount); - setAchievementCount(refVal_setAchievementCount); - + m_Steam_app_idIsSet = false; } - } - 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 Game::getSteamServerAppId() const { - int32_t refVal_setBadgeCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setBadgeCount); - setBadgeCount(refVal_setBadgeCount); - + return m_Steam_server_app_id; } - } - 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()) + + void Game::setSteamServerAppId(int32_t value) { - int32_t refVal_setDownloadCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount); - setDownloadCount(refVal_setDownloadCount); - + m_Steam_server_app_id = value; + m_Steam_server_app_idIsSet = true; } - } - 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()) + + bool Game::steamServerAppIdIsSet() const { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + return m_Steam_server_app_idIsSet; } - } - 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()) + + void Game::unsetSteam_server_app_id() { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index f882a561..281bc181 100644 --- a/src/model/GameServer.cpp +++ b/src/model/GameServer.cpp @@ -10,1572 +10,1584 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/GameServer.h" -namespace tribufu { -namespace models { - -GameServer::GameServer() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + GameServer::GameServer() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + GameServer::~GameServer() { - 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()) + + void GameServer::validate() { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + // TODO: implement validation } - } - 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()) + + web::json::value GameServer::toJson() const { - utility::string_t refVal_setAddress; - ok &= ModelBase::fromJson(fieldValue, refVal_setAddress); - setAddress(refVal_setAddress); - + 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; } - } - 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()) + + bool GameServer::fromJson(const web::json::value &val) { - int32_t refVal_setGamePort; - ok &= ModelBase::fromJson(fieldValue, refVal_setGamePort); - setGamePort(refVal_setGamePort); - + 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; } - } - 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()) + + void GameServer::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - int32_t refVal_setQueryPort; - ok &= ModelBase::fromJson(fieldValue, refVal_setQueryPort); - setQueryPort(refVal_setQueryPort); - + 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)); + } } - } - 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()) + + bool GameServer::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setGameId; - ok &= ModelBase::fromJson(fieldValue, refVal_setGameId); - setGameId(refVal_setGameId); - + 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; } - } - 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 GameServer::getId() const { - utility::string_t refVal_setGameIconUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setGameIconUrl); - setGameIconUrl(refVal_setGameIconUrl); - + return m_Id; } - } - 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()) + + void GameServer::setId(const utility::string_t &value) { - utility::string_t refVal_setVersion; - ok &= ModelBase::fromJson(fieldValue, refVal_setVersion); - setVersion(refVal_setVersion); - + m_Id = value; + m_IdIsSet = true; } - } - 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 GameServer::idIsSet() const { - bool refVal_setFeatured; - ok &= ModelBase::fromJson(fieldValue, refVal_setFeatured); - setFeatured(refVal_setFeatured); - + return m_IdIsSet; } - } - 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()) + + void GameServer::unsetId() { - utility::string_t refVal_setClusterId; - ok &= ModelBase::fromJson(fieldValue, refVal_setClusterId); - setClusterId(refVal_setClusterId); - + m_IdIsSet = false; } - } - 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 GameServer::getName() const { - utility::string_t refVal_setWebsiteUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setWebsiteUrl); - setWebsiteUrl(refVal_setWebsiteUrl); - + return m_Name; } - } - 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()) + + void GameServer::setName(const utility::string_t &value) { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + m_Name = value; + m_NameIsSet = true; } - } - 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()) + + bool GameServer::nameIsSet() const { - utility::string_t refVal_setOwnerId; - ok &= ModelBase::fromJson(fieldValue, refVal_setOwnerId); - setOwnerId(refVal_setOwnerId); - + return m_NameIsSet; } - } - 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()) + + void GameServer::unsetName() { - double refVal_setUptime; - ok &= ModelBase::fromJson(fieldValue, refVal_setUptime); - setUptime(refVal_setUptime); - + m_NameIsSet = false; } - } - 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()) + utility::string_t GameServer::getDescription() const { - std::shared_ptr refVal_setStatus; - ok &= ModelBase::fromJson(fieldValue, refVal_setStatus); - setStatus(refVal_setStatus); - + return m_Description; } - } - 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()) + + void GameServer::setDescription(const utility::string_t &value) { - int32_t refVal_setPing; - ok &= ModelBase::fromJson(fieldValue, refVal_setPing); - setPing(refVal_setPing); - + m_Description = value; + m_DescriptionIsSet = true; } - } - 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()) + + bool GameServer::descriptionIsSet() const { - utility::string_t refVal_setMap; - ok &= ModelBase::fromJson(fieldValue, refVal_setMap); - setMap(refVal_setMap); - + return m_DescriptionIsSet; } - } - 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()) + + void GameServer::unsetDescription() { - int32_t refVal_setUsedSlots; - ok &= ModelBase::fromJson(fieldValue, refVal_setUsedSlots); - setUsedSlots(refVal_setUsedSlots); - + m_DescriptionIsSet = false; } - } - 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()) + utility::string_t GameServer::getAddress() const { - int32_t refVal_setMaxSlots; - ok &= ModelBase::fromJson(fieldValue, refVal_setMaxSlots); - setMaxSlots(refVal_setMaxSlots); - + return m_Address; } - } - 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()) + + void GameServer::setAddress(const utility::string_t &value) { - utility::string_t refVal_setMotd; - ok &= ModelBase::fromJson(fieldValue, refVal_setMotd); - setMotd(refVal_setMotd); - + m_Address = value; + m_AddressIsSet = true; } - } - 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()) + + bool GameServer::addressIsSet() const { - utility::string_t refVal_setPlayers; - ok &= ModelBase::fromJson(fieldValue, refVal_setPlayers); - setPlayers(refVal_setPlayers); - + return m_AddressIsSet; } - } - 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()) + + void GameServer::unsetAddress() { - utility::datetime refVal_setLastOnline; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); - setLastOnline(refVal_setLastOnline); - + m_AddressIsSet = false; } - } - 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()) + int32_t GameServer::getGamePort() const { - utility::string_t refVal_setCountry; - ok &= ModelBase::fromJson(fieldValue, refVal_setCountry); - setCountry(refVal_setCountry); - + return m_Game_port; } - } - 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()) + + void GameServer::setGamePort(int32_t value) { - bool refVal_setSteam; - ok &= ModelBase::fromJson(fieldValue, refVal_setSteam); - setSteam(refVal_setSteam); - + m_Game_port = value; + m_Game_portIsSet = true; } - } - 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()) + + bool GameServer::gamePortIsSet() const { - utility::string_t refVal_setDiscordServerId; - ok &= ModelBase::fromJson(fieldValue, refVal_setDiscordServerId); - setDiscordServerId(refVal_setDiscordServerId); - + return m_Game_portIsSet; } - } - 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()) + + void GameServer::unsetGame_port() { - utility::string_t refVal_setYoutubeVideoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setYoutubeVideoUrl); - setYoutubeVideoUrl(refVal_setYoutubeVideoUrl); - + m_Game_portIsSet = false; } - } - 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()) + int32_t GameServer::getQueryPort() const { - utility::string_t refVal_setTags; - ok &= ModelBase::fromJson(fieldValue, refVal_setTags); - setTags(refVal_setTags); - + return m_Query_port; } - } - 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()) + + void GameServer::setQueryPort(int32_t value) { - int32_t refVal_setCommentCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setCommentCount); - setCommentCount(refVal_setCommentCount); - + m_Query_port = value; + m_Query_portIsSet = true; } - } - 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()) + + bool GameServer::queryPortIsSet() const { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + return m_Query_portIsSet; } - } - 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()) + + void GameServer::unsetQuery_port() { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index 88a649e4..d684aef4 100644 --- a/src/model/GameServerCluster.cpp +++ b/src/model/GameServerCluster.cpp @@ -10,747 +10,752 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/GameServerCluster.h" -namespace tribufu { -namespace models { - -GameServerCluster::GameServerCluster() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + GameServerCluster::GameServerCluster() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + GameServerCluster::~GameServerCluster() { - 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()) + + void GameServerCluster::validate() { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + // TODO: implement validation } - } - 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()) + + web::json::value GameServerCluster::toJson() const { - utility::string_t refVal_setGameId; - ok &= ModelBase::fromJson(fieldValue, refVal_setGameId); - setGameId(refVal_setGameId); - + 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; } - } - 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()) + + bool GameServerCluster::fromJson(const web::json::value &val) { - utility::string_t refVal_setWebsiteUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setWebsiteUrl); - setWebsiteUrl(refVal_setWebsiteUrl); - + 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; } - } - 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()) + + void GameServerCluster::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + 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)); + } } - } - 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()) + + bool GameServerCluster::fromMultiPart(std::shared_ptr multipart, + const utility::string_t &prefix) { - utility::string_t refVal_setOwnerId; - ok &= ModelBase::fromJson(fieldValue, refVal_setOwnerId); - setOwnerId(refVal_setOwnerId); - + 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; } - } - 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 GameServerCluster::getId() const { - utility::string_t refVal_setDiscordServerId; - ok &= ModelBase::fromJson(fieldValue, refVal_setDiscordServerId); - setDiscordServerId(refVal_setDiscordServerId); - + return m_Id; } - } - 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()) + + void GameServerCluster::setId(const utility::string_t &value) { - utility::string_t refVal_setYoutubeVideoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setYoutubeVideoUrl); - setYoutubeVideoUrl(refVal_setYoutubeVideoUrl); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool GameServerCluster::idIsSet() const { - utility::string_t refVal_setTags; - ok &= ModelBase::fromJson(fieldValue, refVal_setTags); - setTags(refVal_setTags); - + return m_IdIsSet; } - } - 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()) + + void GameServerCluster::unsetId() { - int32_t refVal_setCommentCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setCommentCount); - setCommentCount(refVal_setCommentCount); - + m_IdIsSet = false; } - } - 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()) + utility::string_t GameServerCluster::getName() const { - int32_t refVal_setServerCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setServerCount); - setServerCount(refVal_setServerCount); - + return m_Name; } - } - 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()) + + void GameServerCluster::setName(const utility::string_t &value) { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + m_Name = value; + m_NameIsSet = true; } - } - 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()) + + bool GameServerCluster::nameIsSet() const { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index 9e491f23..a7d87779 100644 --- a/src/model/GrantType.cpp +++ b/src/model/GrantType.cpp @@ -10,117 +10,115 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/GrantType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index f7ab4e32..0e6a47b8 100644 --- a/src/model/Group.cpp +++ b/src/model/Group.cpp @@ -10,841 +10,846 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Group.h" -namespace tribufu { -namespace models { - -Group::Group() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + Group::Group() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + Group::~Group() { - 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()) + + void Group::validate() { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + // TODO: implement validation } - } - 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()) + + web::json::value Group::toJson() const { - utility::string_t refVal_setTag; - ok &= ModelBase::fromJson(fieldValue, refVal_setTag); - setTag(refVal_setTag); - + 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; } - } - 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()) + + bool Group::fromJson(const web::json::value &val) { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + 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; } - } - 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()) + + void Group::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - int32_t refVal_setType; - ok &= ModelBase::fromJson(fieldValue, refVal_setType); - setType(refVal_setType); - + 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)); + } } - } - 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()) + + bool Group::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - int32_t refVal_setPrivacy; - ok &= ModelBase::fromJson(fieldValue, refVal_setPrivacy); - setPrivacy(refVal_setPrivacy); - + 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; } - } - 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 Group::getId() const { - utility::string_t refVal_setOwnerId; - ok &= ModelBase::fromJson(fieldValue, refVal_setOwnerId); - setOwnerId(refVal_setOwnerId); - + return m_Id; } - } - 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()) + + void Group::setId(const utility::string_t &value) { - bool refVal_setVerified; - ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); - setVerified(refVal_setVerified); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool Group::idIsSet() const { - utility::string_t refVal_setPhotoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); - setPhotoUrl(refVal_setPhotoUrl); - + return m_IdIsSet; } - } - 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()) + + void Group::unsetId() { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + m_IdIsSet = false; } - } - 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()) + utility::string_t Group::getUuid() const { - int32_t refVal_setMemberCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setMemberCount); - setMemberCount(refVal_setMemberCount); - + return m_Uuid; } - } - 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()) + + void Group::setUuid(const utility::string_t &value) { - int32_t refVal_setFollowerCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setFollowerCount); - setFollowerCount(refVal_setFollowerCount); - + m_Uuid = value; + m_UuidIsSet = true; } - } - 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()) + + bool Group::uuidIsSet() const { - int32_t refVal_setViewCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setViewCount); - setViewCount(refVal_setViewCount); - + return m_UuidIsSet; } - } - 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()) + + void Group::unsetUuid() { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + m_UuidIsSet = false; } - } - 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::string_t Group::getName() const { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index e615d1b6..f94a3339 100644 --- a/src/model/GroupGame.cpp +++ b/src/model/GroupGame.cpp @@ -10,403 +10,403 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/GroupGame.h" -namespace tribufu { -namespace models { - -GroupGame::GroupGame() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("group_id"))); - if(!fieldValue.is_null()) + + GroupGame::GroupGame() { - utility::string_t refVal_setGroupId; - ok &= ModelBase::fromJson(fieldValue, refVal_setGroupId); - setGroupId(refVal_setGroupId); - + 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; } - } - 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()) + + GroupGame::~GroupGame() { - 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()) + + void GroupGame::validate() { - utility::string_t refVal_setApplicationId; - ok &= ModelBase::fromJson(fieldValue, refVal_setApplicationId); - setApplicationId(refVal_setApplicationId); - + // TODO: implement validation } - } - 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()) + + web::json::value GroupGame::toJson() const { - std::shared_ptr refVal_setApplication; - ok &= ModelBase::fromJson(fieldValue, refVal_setApplication); - setApplication(refVal_setApplication); - + 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; } - } - 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()) + + bool GroupGame::fromJson(const web::json::value &val) { - std::shared_ptr refVal_setStats; - ok &= ModelBase::fromJson(fieldValue, refVal_setStats); - setStats(refVal_setStats); - + 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; } - } - 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()) + + void GroupGame::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - utility::datetime refVal_setAcquired; - ok &= ModelBase::fromJson(fieldValue, refVal_setAcquired); - setAcquired(refVal_setAcquired); - + 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)); + } } - } - 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()) + + bool GroupGame::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::datetime refVal_setLastUsed; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastUsed); - setLastUsed(refVal_setLastUsed); - + 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; } - } - 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 index 0b3ad3fb..861068e5 100644 --- a/src/model/GroupMember.cpp +++ b/src/model/GroupMember.cpp @@ -10,502 +10,502 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/GroupMember.h" -namespace tribufu { -namespace models { - -GroupMember::GroupMember() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + GroupMember::GroupMember() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + GroupMember::~GroupMember() { - 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()) + + void GroupMember::validate() { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + // TODO: implement validation } - } - 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()) + + web::json::value GroupMember::toJson() const { - utility::string_t refVal_setDisplayName; - ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); - setDisplayName(refVal_setDisplayName); - + 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; } - } - 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 GroupMember::fromJson(const web::json::value &val) { - bool refVal_setVerified; - ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); - setVerified(refVal_setVerified); - + 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; } - } - 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()) + + void GroupMember::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - utility::string_t refVal_setPhotoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); - setPhotoUrl(refVal_setPhotoUrl); - + 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)); + } } - } - 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()) + + bool GroupMember::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::datetime refVal_setLastOnline; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); - setLastOnline(refVal_setLastOnline); - + 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; } - } - 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()) + + utility::string_t GroupMember::getId() const { - std::shared_ptr refVal_setRank; - ok &= ModelBase::fromJson(fieldValue, refVal_setRank); - setRank(refVal_setRank); - + return m_Id; } - } - 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()) + + void GroupMember::setId(const utility::string_t &value) { - utility::datetime refVal_setSince; - ok &= ModelBase::fromJson(fieldValue, refVal_setSince); - setSince(refVal_setSince); - + 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; } - } - 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 index 1c27194c..3d235bd3 100644 --- a/src/model/GroupRank.cpp +++ b/src/model/GroupRank.cpp @@ -10,113 +10,111 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/GroupRank.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index 59fb06eb..90074003 100644 --- a/src/model/HashViewModel.cpp +++ b/src/model/HashViewModel.cpp @@ -10,112 +10,112 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/HashViewModel.h" -namespace tribufu { -namespace models { - -HashViewModel::HashViewModel() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("value"))); - if(!fieldValue.is_null()) + + HashViewModel::HashViewModel() { - utility::string_t refVal_setValue; - ok &= ModelBase::fromJson(fieldValue, refVal_setValue); - setValue(refVal_setValue); - + 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; } - } - 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 index 033ce656..3d20fa21 100644 --- a/src/model/IntrospectRequest.cpp +++ b/src/model/IntrospectRequest.cpp @@ -10,160 +10,162 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/IntrospectRequest.h" -namespace tribufu { -namespace models { - -IntrospectRequest::IntrospectRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token"))); - if(!fieldValue.is_null()) + + IntrospectRequest::IntrospectRequest() { - utility::string_t refVal_setToken; - ok &= ModelBase::fromJson(fieldValue, refVal_setToken); - setToken(refVal_setToken); - + m_Token = utility::conversions::to_string_t(""); + m_TokenIsSet = false; + m_Token_type_hintIsSet = false; } - } - 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()) + + IntrospectRequest::~IntrospectRequest() { - 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)); + 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; + } + } } - -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 index 58599dd0..283f0463 100644 --- a/src/model/IpAddress.cpp +++ b/src/model/IpAddress.cpp @@ -10,941 +10,944 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/IpAddress.h" -namespace tribufu { -namespace models { - -IpAddress::IpAddress() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("address"))); - if(!fieldValue.is_null()) + + IpAddress::IpAddress() { - utility::string_t refVal_setAddress; - ok &= ModelBase::fromJson(fieldValue, refVal_setAddress); - setAddress(refVal_setAddress); - + 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; } - } - 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()) + + IpAddress::~IpAddress() { - 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()) + + void IpAddress::validate() { - utility::string_t refVal_setNetwork; - ok &= ModelBase::fromJson(fieldValue, refVal_setNetwork); - setNetwork(refVal_setNetwork); - + // TODO: implement validation } - } - 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()) + + web::json::value IpAddress::toJson() const { - bool refVal_setReserved; - ok &= ModelBase::fromJson(fieldValue, refVal_setReserved); - setReserved(refVal_setReserved); - + 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; } - } - 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()) + + bool IpAddress::fromJson(const web::json::value &val) { - utility::string_t refVal_setAsn; - ok &= ModelBase::fromJson(fieldValue, refVal_setAsn); - setAsn(refVal_setAsn); - + 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; } - } - 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()) + + void IpAddress::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - utility::string_t refVal_setIsp; - ok &= ModelBase::fromJson(fieldValue, refVal_setIsp); - setIsp(refVal_setIsp); - + 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)); + } } - } - 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()) + + bool IpAddress::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setContinent; - ok &= ModelBase::fromJson(fieldValue, refVal_setContinent); - setContinent(refVal_setContinent); - + 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; } - } - 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 IpAddress::getAddress() const { - utility::string_t refVal_setCountry; - ok &= ModelBase::fromJson(fieldValue, refVal_setCountry); - setCountry(refVal_setCountry); - + return m_Address; } - } - 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()) + + void IpAddress::setAddress(const utility::string_t &value) { - utility::string_t refVal_setRegion; - ok &= ModelBase::fromJson(fieldValue, refVal_setRegion); - setRegion(refVal_setRegion); - + m_Address = value; + m_AddressIsSet = true; } - } - 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()) + + bool IpAddress::addressIsSet() const { - utility::string_t refVal_setCity; - ok &= ModelBase::fromJson(fieldValue, refVal_setCity); - setCity(refVal_setCity); - + return m_AddressIsSet; } - } - 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()) + + void IpAddress::unsetAddress() { - utility::string_t refVal_setPostalCode; - ok &= ModelBase::fromJson(fieldValue, refVal_setPostalCode); - setPostalCode(refVal_setPostalCode); - + m_AddressIsSet = false; } - } - 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()) + int32_t IpAddress::getVersion() const { - utility::string_t refVal_setCallingCode; - ok &= ModelBase::fromJson(fieldValue, refVal_setCallingCode); - setCallingCode(refVal_setCallingCode); - + return m_Version; } - } - 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()) + + void IpAddress::setVersion(int32_t value) { - utility::string_t refVal_setTld; - ok &= ModelBase::fromJson(fieldValue, refVal_setTld); - setTld(refVal_setTld); - + m_Version = value; + m_VersionIsSet = true; } - } - 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()) + + bool IpAddress::versionIsSet() const { - utility::string_t refVal_setLanguage; - ok &= ModelBase::fromJson(fieldValue, refVal_setLanguage); - setLanguage(refVal_setLanguage); - + return m_VersionIsSet; } - } - 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()) + + void IpAddress::unsetVersion() { - utility::string_t refVal_setTimezone; - ok &= ModelBase::fromJson(fieldValue, refVal_setTimezone); - setTimezone(refVal_setTimezone); - + m_VersionIsSet = false; } - } - 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 IpAddress::getNetwork() const { - utility::string_t refVal_setCurrency; - ok &= ModelBase::fromJson(fieldValue, refVal_setCurrency); - setCurrency(refVal_setCurrency); - + return m_Network; } - } - 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()) + + void IpAddress::setNetwork(const utility::string_t &value) { - float refVal_setLatitude; - ok &= ModelBase::fromJson(fieldValue, refVal_setLatitude); - setLatitude(refVal_setLatitude); - + m_Network = value; + m_NetworkIsSet = true; } - } - 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()) + + bool IpAddress::networkIsSet() const { - float refVal_setLongitude; - ok &= ModelBase::fromJson(fieldValue, refVal_setLongitude); - setLongitude(refVal_setLongitude); - + 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; } - } - 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 index db0db953..7b5f8a79 100644 --- a/src/model/LeaderboardItem.cpp +++ b/src/model/LeaderboardItem.cpp @@ -10,354 +10,358 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/LeaderboardItem.h" -namespace tribufu { -namespace models { - -LeaderboardItem::LeaderboardItem() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); - if(!fieldValue.is_null()) + + LeaderboardItem::LeaderboardItem() { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + 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; } - } - 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()) + + LeaderboardItem::~LeaderboardItem() { - 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()) + + void LeaderboardItem::validate() { - utility::string_t refVal_setPhotoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); - setPhotoUrl(refVal_setPhotoUrl); - + // TODO: implement validation } - } - 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()) + + web::json::value LeaderboardItem::toJson() const { - int32_t refVal_setLevel; - ok &= ModelBase::fromJson(fieldValue, refVal_setLevel); - setLevel(refVal_setLevel); - + 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; } - } - 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()) + + bool LeaderboardItem::fromJson(const web::json::value &val) { - double refVal_setExperience; - ok &= ModelBase::fromJson(fieldValue, refVal_setExperience); - setExperience(refVal_setExperience); - + 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; } - } - 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()) + + void LeaderboardItem::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - double refVal_setPoints; - ok &= ModelBase::fromJson(fieldValue, refVal_setPoints); - setPoints(refVal_setPoints); - + 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; } - } - 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 index a485eacf..553baab1 100644 --- a/src/model/LeaderboardOrder.cpp +++ b/src/model/LeaderboardOrder.cpp @@ -10,109 +10,109 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/LeaderboardOrder.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index deb25835..a8d29a65 100644 --- a/src/model/LoginProvider.cpp +++ b/src/model/LoginProvider.cpp @@ -10,129 +10,128 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/LoginProvider.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index e1930e5d..1ca06624 100644 --- a/src/model/LoginRequest.cpp +++ b/src/model/LoginRequest.cpp @@ -10,161 +10,161 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/LoginRequest.h" -namespace tribufu { -namespace models { - -LoginRequest::LoginRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("login"))); - if(!fieldValue.is_null()) + + LoginRequest::LoginRequest() { - utility::string_t refVal_setLogin; - ok &= ModelBase::fromJson(fieldValue, refVal_setLogin); - setLogin(refVal_setLogin); - + m_Login = utility::conversions::to_string_t(""); + m_LoginIsSet = false; + m_Password = utility::conversions::to_string_t(""); + m_PasswordIsSet = false; } - } - 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()) + + LoginRequest::~LoginRequest() { - 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)); + 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; + } + } } - -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 index aa3c747c..69a0017a 100644 --- a/src/model/LoginResponse.cpp +++ b/src/model/LoginResponse.cpp @@ -10,257 +10,259 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/LoginResponse.h" -namespace tribufu { -namespace models { - -LoginResponse::LoginResponse() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("user"))); - if(!fieldValue.is_null()) + + LoginResponse::LoginResponse() { - std::shared_ptr refVal_setUser; - ok &= ModelBase::fromJson(fieldValue, refVal_setUser); - setUser(refVal_setUser); - + 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; } - } - 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()) + + LoginResponse::~LoginResponse() { - 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()) + + void LoginResponse::validate() { - utility::string_t refVal_setRefreshToken; - ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); - setRefreshToken(refVal_setRefreshToken); - + // TODO: implement validation } - } - 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()) + + web::json::value LoginResponse::toJson() const { - int64_t refVal_setExpiresIn; - ok &= ModelBase::fromJson(fieldValue, refVal_setExpiresIn); - setExpiresIn(refVal_setExpiresIn); - + 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; } - } - 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 index 14c0202e..36bbb527 100644 --- a/src/model/Package.cpp +++ b/src/model/Package.cpp @@ -10,649 +10,651 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Package.h" -namespace tribufu { -namespace models { - -Package::Package() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + Package::Package() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + Package::~Package() { - 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()) + + void Package::validate() { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + // TODO: implement validation } - } - 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()) + + web::json::value Package::toJson() const { - utility::string_t refVal_setImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setImageUrl); - setImageUrl(refVal_setImageUrl); - + 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; } - } - 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()) + + bool Package::fromJson(const web::json::value &val) { - utility::string_t refVal_setAuthorId; - ok &= ModelBase::fromJson(fieldValue, refVal_setAuthorId); - setAuthorId(refVal_setAuthorId); - + 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; } - } - 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()) + + void Package::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - utility::string_t refVal_setVersion; - ok &= ModelBase::fromJson(fieldValue, refVal_setVersion); - setVersion(refVal_setVersion); - + 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)); + } } - } - 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()) + + bool Package::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setFileUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setFileUrl); - setFileUrl(refVal_setFileUrl); - + 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; } - } - 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()) + + utility::string_t Package::getId() const { - double refVal_setRawSize; - ok &= ModelBase::fromJson(fieldValue, refVal_setRawSize); - setRawSize(refVal_setRawSize); - + return m_Id; } - } - 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()) + + void Package::setId(const utility::string_t &value) { - int32_t refVal_setDownloadCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount); - setDownloadCount(refVal_setDownloadCount); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool Package::idIsSet() const { - utility::datetime refVal_setLastDownload; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastDownload); - setLastDownload(refVal_setLastDownload); - + return m_IdIsSet; } - } - 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()) + + void Package::unsetId() { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + m_IdIsSet = false; } - } - 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::string_t Package::getName() const { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index 93a12880..aa4f161a 100644 --- a/src/model/Profile.cpp +++ b/src/model/Profile.cpp @@ -10,938 +10,943 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Profile.h" -namespace tribufu { -namespace models { - -Profile::Profile() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + Profile::Profile() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + Profile::~Profile() { - 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()) + + void Profile::validate() { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + // TODO: implement validation } - } - 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()) + + web::json::value Profile::toJson() const { - utility::string_t refVal_setDisplayName; - ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); - setDisplayName(refVal_setDisplayName); - + 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; } - } - 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 Profile::fromJson(const web::json::value &val) { - bool refVal_setVerified; - ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); - setVerified(refVal_setVerified); - + 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; } - } - 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()) + + void Profile::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - int32_t refVal_setLevel; - ok &= ModelBase::fromJson(fieldValue, refVal_setLevel); - setLevel(refVal_setLevel); - + 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)); + } } - } - 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()) + + bool Profile::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - double refVal_setExperience; - ok &= ModelBase::fromJson(fieldValue, refVal_setExperience); - setExperience(refVal_setExperience); - + 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; } - } - 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()) + + utility::string_t Profile::getId() const { - bool refVal_setPublicBirthday; - ok &= ModelBase::fromJson(fieldValue, refVal_setPublicBirthday); - setPublicBirthday(refVal_setPublicBirthday); - + return m_Id; } - } - 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()) + + void Profile::setId(const utility::string_t &value) { - utility::datetime refVal_setBirthday; - ok &= ModelBase::fromJson(fieldValue, refVal_setBirthday); - setBirthday(refVal_setBirthday); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool Profile::idIsSet() const { - double refVal_setPoints; - ok &= ModelBase::fromJson(fieldValue, refVal_setPoints); - setPoints(refVal_setPoints); - + return m_IdIsSet; } - } - 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()) + + void Profile::unsetId() { - utility::string_t refVal_setLocation; - ok &= ModelBase::fromJson(fieldValue, refVal_setLocation); - setLocation(refVal_setLocation); - + m_IdIsSet = false; } - } - 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 Profile::getUuid() const { - utility::string_t refVal_setPhotoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); - setPhotoUrl(refVal_setPhotoUrl); - + return m_Uuid; } - } - 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()) + + void Profile::setUuid(const utility::string_t &value) { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + m_Uuid = value; + m_UuidIsSet = true; } - } - 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()) + + bool Profile::uuidIsSet() const { - utility::datetime refVal_setLastOnline; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); - setLastOnline(refVal_setLastOnline); - + return m_UuidIsSet; } - } - 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()) + + void Profile::unsetUuid() { - utility::string_t refVal_setBiography; - ok &= ModelBase::fromJson(fieldValue, refVal_setBiography); - setBiography(refVal_setBiography); - + m_UuidIsSet = false; } - } - 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()) + utility::string_t Profile::getName() const { - int32_t refVal_setViewCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setViewCount); - setViewCount(refVal_setViewCount); - + return m_Name; } - } - 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()) + + void Profile::setName(const utility::string_t &value) { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + m_Name = value; + m_NameIsSet = true; } - } - 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()) + + bool Profile::nameIsSet() const { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index 7d6bdcf3..cc4087f9 100644 --- a/src/model/ProfileGame.cpp +++ b/src/model/ProfileGame.cpp @@ -10,598 +10,608 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/ProfileGame.h" -namespace tribufu { -namespace models { - -ProfileGame::ProfileGame() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + ProfileGame::ProfileGame() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + ProfileGame::~ProfileGame() { - 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()) + + void ProfileGame::validate() { - utility::string_t refVal_setCapsuleImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setCapsuleImageUrl); - setCapsuleImageUrl(refVal_setCapsuleImageUrl); - + // TODO: implement validation } - } - 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()) + + web::json::value ProfileGame::toJson() const { - utility::string_t refVal_setLibraryImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setLibraryImageUrl); - setLibraryImageUrl(refVal_setLibraryImageUrl); - + 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; } - } - 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()) + + bool ProfileGame::fromJson(const web::json::value &val) { - utility::string_t refVal_setSlug; - ok &= ModelBase::fromJson(fieldValue, refVal_setSlug); - setSlug(refVal_setSlug); - + 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; } - } - 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()) + + void ProfileGame::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - double refVal_setTimeUsed; - ok &= ModelBase::fromJson(fieldValue, refVal_setTimeUsed); - setTimeUsed(refVal_setTimeUsed); - + 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)); + } } - } - 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()) + + bool ProfileGame::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - int32_t refVal_setUnlockedAchievements; - ok &= ModelBase::fromJson(fieldValue, refVal_setUnlockedAchievements); - setUnlockedAchievements(refVal_setUnlockedAchievements); - + 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; } - } - 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()) + + utility::string_t ProfileGame::getId() const { - int32_t refVal_setTotalAchievements; - ok &= ModelBase::fromJson(fieldValue, refVal_setTotalAchievements); - setTotalAchievements(refVal_setTotalAchievements); - + return m_Id; } - } - 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()) + + void ProfileGame::setId(const utility::string_t &value) { - std::shared_ptr refVal_setStats; - ok &= ModelBase::fromJson(fieldValue, refVal_setStats); - setStats(refVal_setStats); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool ProfileGame::idIsSet() const { - utility::datetime refVal_setAcquired; - ok &= ModelBase::fromJson(fieldValue, refVal_setAcquired); - setAcquired(refVal_setAcquired); - + return m_IdIsSet; } - } - 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()) + + void ProfileGame::unsetId() { - utility::datetime refVal_setLastUsed; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastUsed); - setLastUsed(refVal_setLastUsed); - + 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; } - } - 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 index 1cf222cd..f34ec261 100644 --- a/src/model/ProfileGroup.cpp +++ b/src/model/ProfileGroup.cpp @@ -10,549 +10,551 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/ProfileGroup.h" -namespace tribufu { -namespace models { - -ProfileGroup::ProfileGroup() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + ProfileGroup::ProfileGroup() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + ProfileGroup::~ProfileGroup() { - 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()) + + void ProfileGroup::validate() { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + // TODO: implement validation } - } - 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()) + + web::json::value ProfileGroup::toJson() const { - utility::string_t refVal_setTag; - ok &= ModelBase::fromJson(fieldValue, refVal_setTag); - setTag(refVal_setTag); - + 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; } - } - 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()) + + bool ProfileGroup::fromJson(const web::json::value &val) { - int32_t refVal_setPrivacy; - ok &= ModelBase::fromJson(fieldValue, refVal_setPrivacy); - setPrivacy(refVal_setPrivacy); - + 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; } - } - 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()) + + void ProfileGroup::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - bool refVal_setVerified; - ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); - setVerified(refVal_setVerified); - + 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)); + } } - } - 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()) + + bool ProfileGroup::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setPhotoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); - setPhotoUrl(refVal_setPhotoUrl); - + 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; } - } - 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()) + + utility::string_t ProfileGroup::getId() const { - int32_t refVal_setMemberCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setMemberCount); - setMemberCount(refVal_setMemberCount); - + return m_Id; } - } - 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()) + + void ProfileGroup::setId(const utility::string_t &value) { - std::shared_ptr refVal_setRank; - ok &= ModelBase::fromJson(fieldValue, refVal_setRank); - setRank(refVal_setRank); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool ProfileGroup::idIsSet() const { - utility::datetime refVal_setSince; - ok &= ModelBase::fromJson(fieldValue, refVal_setSince); - setSince(refVal_setSince); - + 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; } - } - 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 index 3543e614..c264d9a2 100644 --- a/src/model/RefreshRequest.cpp +++ b/src/model/RefreshRequest.cpp @@ -10,112 +10,114 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/RefreshRequest.h" -namespace tribufu { -namespace models { - -RefreshRequest::RefreshRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("refresh_token"))); - if(!fieldValue.is_null()) + + RefreshRequest::RefreshRequest() { - utility::string_t refVal_setRefreshToken; - ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); - setRefreshToken(refVal_setRefreshToken); - + 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; } - } - 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 index cbcd5b03..baf9e8e7 100644 --- a/src/model/RegisterRequest.cpp +++ b/src/model/RegisterRequest.cpp @@ -10,259 +10,260 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/RegisterRequest.h" -namespace tribufu { -namespace models { - -RegisterRequest::RegisterRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("uuid"))); - if(!fieldValue.is_null()) + + RegisterRequest::RegisterRequest() { - utility::string_t refVal_setUuid; - ok &= ModelBase::fromJson(fieldValue, refVal_setUuid); - setUuid(refVal_setUuid); - + 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; } - } - 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()) + + RegisterRequest::~RegisterRequest() { - 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()) + + void RegisterRequest::validate() { - utility::string_t refVal_setEmail; - ok &= ModelBase::fromJson(fieldValue, refVal_setEmail); - setEmail(refVal_setEmail); - + // TODO: implement validation } - } - 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()) + + web::json::value RegisterRequest::toJson() const { - utility::string_t refVal_setPassword; - ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); - setPassword(refVal_setPassword); - + 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; } - } - 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 index be8051c8..ef47b6a9 100644 --- a/src/model/ResponseType.cpp +++ b/src/model/ResponseType.cpp @@ -10,109 +10,108 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/ResponseType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index 23d9e2b4..89a8c5b9 100644 --- a/src/model/RevokeRequest.cpp +++ b/src/model/RevokeRequest.cpp @@ -10,160 +10,161 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/RevokeRequest.h" -namespace tribufu { -namespace models { - -RevokeRequest::RevokeRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token"))); - if(!fieldValue.is_null()) + + RevokeRequest::RevokeRequest() { - utility::string_t refVal_setToken; - ok &= ModelBase::fromJson(fieldValue, refVal_setToken); - setToken(refVal_setToken); - + m_Token = utility::conversions::to_string_t(""); + m_TokenIsSet = false; + m_Token_type_hintIsSet = false; } - } - 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()) + + RevokeRequest::~RevokeRequest() { - 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)); + 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; + } + } } - -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 index 3768c0a1..00df8deb 100644 --- a/src/model/SearchRequest.cpp +++ b/src/model/SearchRequest.cpp @@ -10,257 +10,258 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/SearchRequest.h" -namespace tribufu { -namespace models { - -SearchRequest::SearchRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); - if(!fieldValue.is_null()) + + SearchRequest::SearchRequest() { - std::shared_ptr refVal_setType; - ok &= ModelBase::fromJson(fieldValue, refVal_setType); - setType(refVal_setType); - + 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; } - } - 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()) + + SearchRequest::~SearchRequest() { - 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()) + + void SearchRequest::validate() { - int32_t refVal_setPage; - ok &= ModelBase::fromJson(fieldValue, refVal_setPage); - setPage(refVal_setPage); - + // TODO: implement validation } - } - 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()) + + web::json::value SearchRequest::toJson() const { - utility::string_t refVal_setGameId; - ok &= ModelBase::fromJson(fieldValue, refVal_setGameId); - setGameId(refVal_setGameId); - + 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; } - } - 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 index e6e06b65..c33b27ff 100644 --- a/src/model/SearchType.cpp +++ b/src/model/SearchType.cpp @@ -10,117 +10,116 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/SearchType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index 9b9c8979..a7d45cfe 100644 --- a/src/model/ServerMetrics.cpp +++ b/src/model/ServerMetrics.cpp @@ -10,207 +10,212 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/ServerMetrics.h" -namespace tribufu { -namespace models { - -ServerMetrics::ServerMetrics() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("server_count"))); - if(!fieldValue.is_null()) + + ServerMetrics::ServerMetrics() { - int32_t refVal_setServerCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setServerCount); - setServerCount(refVal_setServerCount); - + m_Server_count = 0; + m_Server_countIsSet = false; + m_Package_count = 0; + m_Package_countIsSet = false; + m_Country_count = 0; + m_Country_countIsSet = false; } - } - 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()) + + ServerMetrics::~ServerMetrics() { - 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()) + + void ServerMetrics::validate() { - int32_t refVal_setCountryCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setCountryCount); - setCountryCount(refVal_setCountryCount); - + // 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; } - } - 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 index 82aba53a..d19ad29d 100644 --- a/src/model/ServerStatus.cpp +++ b/src/model/ServerStatus.cpp @@ -10,113 +10,112 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/ServerStatus.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index ef3e4149..03cd5541 100644 --- a/src/model/Subscription.cpp +++ b/src/model/Subscription.cpp @@ -10,404 +10,404 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/Subscription.h" -namespace tribufu { -namespace models { - -Subscription::Subscription() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + Subscription::Subscription() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + Subscription::~Subscription() { - 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()) + + void Subscription::validate() { - utility::string_t refVal_setDescription; - ok &= ModelBase::fromJson(fieldValue, refVal_setDescription); - setDescription(refVal_setDescription); - + // TODO: implement validation } - } - 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()) + + web::json::value Subscription::toJson() const { - utility::string_t refVal_setImageUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setImageUrl); - setImageUrl(refVal_setImageUrl); - + 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; } - } - 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()) + + bool Subscription::fromJson(const web::json::value &val) { - std::map refVal_setPrices; - ok &= ModelBase::fromJson(fieldValue, refVal_setPrices); - setPrices(refVal_setPrices); - + 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; } - } - 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()) + + void Subscription::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + 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)); + } } - } - 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()) + + bool Subscription::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index 324e8159..34bdd13c 100644 --- a/src/model/TokenHintType.cpp +++ b/src/model/TokenHintType.cpp @@ -10,109 +10,108 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/TokenHintType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index 2d2c659c..e743f29d 100644 --- a/src/model/TokenRequest.cpp +++ b/src/model/TokenRequest.cpp @@ -10,454 +10,456 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/TokenRequest.h" -namespace tribufu { -namespace models { - -TokenRequest::TokenRequest() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("grant_type"))); - if(!fieldValue.is_null()) + + TokenRequest::TokenRequest() { - std::shared_ptr refVal_setGrantType; - ok &= ModelBase::fromJson(fieldValue, refVal_setGrantType); - setGrantType(refVal_setGrantType); - + 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; } - } - 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()) + + TokenRequest::~TokenRequest() { - 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()) + + void TokenRequest::validate() { - utility::string_t refVal_setUsername; - ok &= ModelBase::fromJson(fieldValue, refVal_setUsername); - setUsername(refVal_setUsername); - + // TODO: implement validation } - } - 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()) + + web::json::value TokenRequest::toJson() const { - utility::string_t refVal_setPassword; - ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); - setPassword(refVal_setPassword); - + 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; } - } - 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()) + + bool TokenRequest::fromJson(const web::json::value &val) { - utility::string_t refVal_setRefreshToken; - ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); - setRefreshToken(refVal_setRefreshToken); - + 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; } - } - 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()) + + void TokenRequest::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - utility::string_t refVal_setClientId; - ok &= ModelBase::fromJson(fieldValue, refVal_setClientId); - setClientId(refVal_setClientId); - + 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)); + } } - } - 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()) + + bool TokenRequest::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setRedirectUri; - ok &= ModelBase::fromJson(fieldValue, refVal_setRedirectUri); - setRedirectUri(refVal_setRedirectUri); - + 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; } - } - 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()) + + std::shared_ptr TokenRequest::getGrantType() const { - utility::string_t refVal_setCodeVerifier; - ok &= ModelBase::fromJson(fieldValue, refVal_setCodeVerifier); - setCodeVerifier(refVal_setCodeVerifier); - + 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; } - } - 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 index 22854714..c5bc1808 100644 --- a/src/model/TokenResponse.cpp +++ b/src/model/TokenResponse.cpp @@ -10,355 +10,357 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/TokenResponse.h" -namespace tribufu { -namespace models { - -TokenResponse::TokenResponse() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("token_type"))); - if(!fieldValue.is_null()) + + TokenResponse::TokenResponse() { - std::shared_ptr refVal_setTokenType; - ok &= ModelBase::fromJson(fieldValue, refVal_setTokenType); - setTokenType(refVal_setTokenType); - + 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; } - } - 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()) + + TokenResponse::~TokenResponse() { - 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()) + + void TokenResponse::validate() { - utility::string_t refVal_setRefreshToken; - ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken); - setRefreshToken(refVal_setRefreshToken); - + // TODO: implement validation } - } - 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()) + + web::json::value TokenResponse::toJson() const { - utility::string_t refVal_setScope; - ok &= ModelBase::fromJson(fieldValue, refVal_setScope); - setScope(refVal_setScope); - + 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; } - } - 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()) + + bool TokenResponse::fromJson(const web::json::value &val) { - utility::string_t refVal_setState; - ok &= ModelBase::fromJson(fieldValue, refVal_setState); - setState(refVal_setState); - + 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; } - } - 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()) + + void TokenResponse::toMultipart(std::shared_ptr multipart, + const utility::string_t &prefix) const { - int64_t refVal_setExpiresIn; - ok &= ModelBase::fromJson(fieldValue, refVal_setExpiresIn); - setExpiresIn(refVal_setExpiresIn); - + 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; } - } - 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 index 32de1016..25006c34 100644 --- a/src/model/TokenType.cpp +++ b/src/model/TokenType.cpp @@ -10,105 +10,103 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/TokenType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - 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 index 19f607c8..9adf890c 100644 --- a/src/model/UpdateProfile.cpp +++ b/src/model/UpdateProfile.cpp @@ -10,161 +10,161 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/UpdateProfile.h" -namespace tribufu { -namespace models { - -UpdateProfile::UpdateProfile() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("display_name"))); - if(!fieldValue.is_null()) + + UpdateProfile::UpdateProfile() { - utility::string_t refVal_setDisplayName; - ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); - setDisplayName(refVal_setDisplayName); - + m_Display_name = utility::conversions::to_string_t(""); + m_Display_nameIsSet = false; + m_Biography = utility::conversions::to_string_t(""); + m_BiographyIsSet = false; } - } - 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()) + + UpdateProfile::~UpdateProfile() { - 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)); + 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; + } + } } - -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 index bf5efb35..3cb16305 100644 --- a/src/model/UserInfo.cpp +++ b/src/model/UserInfo.cpp @@ -10,1280 +10,1285 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/UserInfo.h" -namespace tribufu { -namespace models { - -UserInfo::UserInfo() +namespace tribufu { - 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")))) + namespace models { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); - if(!fieldValue.is_null()) + + UserInfo::UserInfo() { - utility::string_t refVal_setId; - ok &= ModelBase::fromJson(fieldValue, refVal_setId); - setId(refVal_setId); - + 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; } - } - 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()) + + UserInfo::~UserInfo() { - 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()) + + void UserInfo::validate() { - utility::string_t refVal_setName; - ok &= ModelBase::fromJson(fieldValue, refVal_setName); - setName(refVal_setName); - + // TODO: implement validation } - } - 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()) + + web::json::value UserInfo::toJson() const { - utility::string_t refVal_setDisplayName; - ok &= ModelBase::fromJson(fieldValue, refVal_setDisplayName); - setDisplayName(refVal_setDisplayName); - + 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; } - } - 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()) + + bool UserInfo::fromJson(const web::json::value &val) { - utility::string_t refVal_setEmail; - ok &= ModelBase::fromJson(fieldValue, refVal_setEmail); - setEmail(refVal_setEmail); - + 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; } - } - 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()) + + void UserInfo::toMultipart(std::shared_ptr multipart, const utility::string_t &prefix) const { - std::shared_ptr refVal_setType; - ok &= ModelBase::fromJson(fieldValue, refVal_setType); - setType(refVal_setType); - + 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)); + } } - } - 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()) + + bool UserInfo::fromMultiPart(std::shared_ptr multipart, const utility::string_t &prefix) { - utility::string_t refVal_setFlags; - ok &= ModelBase::fromJson(fieldValue, refVal_setFlags); - setFlags(refVal_setFlags); - + 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; } - } - 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 UserInfo::getId() const { - utility::string_t refVal_setPermissions; - ok &= ModelBase::fromJson(fieldValue, refVal_setPermissions); - setPermissions(refVal_setPermissions); - + return m_Id; } - } - 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()) + + void UserInfo::setId(const utility::string_t &value) { - bool refVal_setVerified; - ok &= ModelBase::fromJson(fieldValue, refVal_setVerified); - setVerified(refVal_setVerified); - + m_Id = value; + m_IdIsSet = true; } - } - 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()) + + bool UserInfo::idIsSet() const { - int32_t refVal_setLevel; - ok &= ModelBase::fromJson(fieldValue, refVal_setLevel); - setLevel(refVal_setLevel); - + return m_IdIsSet; } - } - 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()) + + void UserInfo::unsetId() { - double refVal_setExperience; - ok &= ModelBase::fromJson(fieldValue, refVal_setExperience); - setExperience(refVal_setExperience); - + m_IdIsSet = false; } - } - 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()) + utility::string_t UserInfo::getUuid() const { - bool refVal_setPublicBirthday; - ok &= ModelBase::fromJson(fieldValue, refVal_setPublicBirthday); - setPublicBirthday(refVal_setPublicBirthday); - + return m_Uuid; } - } - 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()) + + void UserInfo::setUuid(const utility::string_t &value) { - utility::datetime refVal_setBirthday; - ok &= ModelBase::fromJson(fieldValue, refVal_setBirthday); - setBirthday(refVal_setBirthday); - + m_Uuid = value; + m_UuidIsSet = true; } - } - 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()) + + bool UserInfo::uuidIsSet() const { - double refVal_setPoints; - ok &= ModelBase::fromJson(fieldValue, refVal_setPoints); - setPoints(refVal_setPoints); - + return m_UuidIsSet; } - } - 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()) + + void UserInfo::unsetUuid() { - utility::string_t refVal_setLocation; - ok &= ModelBase::fromJson(fieldValue, refVal_setLocation); - setLocation(refVal_setLocation); - + m_UuidIsSet = false; } - } - 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 UserInfo::getName() const { - utility::string_t refVal_setLanguage; - ok &= ModelBase::fromJson(fieldValue, refVal_setLanguage); - setLanguage(refVal_setLanguage); - + return m_Name; } - } - 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()) + + void UserInfo::setName(const utility::string_t &value) { - utility::string_t refVal_setTimezone; - ok &= ModelBase::fromJson(fieldValue, refVal_setTimezone); - setTimezone(refVal_setTimezone); - + m_Name = value; + m_NameIsSet = true; } - } - 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()) + + bool UserInfo::nameIsSet() const { - utility::string_t refVal_setCurrency; - ok &= ModelBase::fromJson(fieldValue, refVal_setCurrency); - setCurrency(refVal_setCurrency); - + return m_NameIsSet; } - } - 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()) + + void UserInfo::unsetName() { - utility::string_t refVal_setPhotoUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrl); - setPhotoUrl(refVal_setPhotoUrl); - + m_NameIsSet = false; } - } - 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 UserInfo::getDisplayName() const { - utility::string_t refVal_setBannerUrl; - ok &= ModelBase::fromJson(fieldValue, refVal_setBannerUrl); - setBannerUrl(refVal_setBannerUrl); - + return m_Display_name; } - } - 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()) + + void UserInfo::setDisplayName(const utility::string_t &value) { - utility::datetime refVal_setLastOnline; - ok &= ModelBase::fromJson(fieldValue, refVal_setLastOnline); - setLastOnline(refVal_setLastOnline); - + m_Display_name = value; + m_Display_nameIsSet = true; } - } - 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()) + + bool UserInfo::displayNameIsSet() const { - utility::string_t refVal_setBiography; - ok &= ModelBase::fromJson(fieldValue, refVal_setBiography); - setBiography(refVal_setBiography); - + return m_Display_nameIsSet; } - } - 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()) + + void UserInfo::unsetDisplay_name() { - int32_t refVal_setViewCount; - ok &= ModelBase::fromJson(fieldValue, refVal_setViewCount); - setViewCount(refVal_setViewCount); - + m_Display_nameIsSet = false; } - } - 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::string_t UserInfo::getEmail() const { - utility::datetime refVal_setCreated; - ok &= ModelBase::fromJson(fieldValue, refVal_setCreated); - setCreated(refVal_setCreated); - + return m_Email; } - } - 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()) + + void UserInfo::setEmail(const utility::string_t &value) { - utility::datetime refVal_setUpdated; - ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated); - setUpdated(refVal_setUpdated); - + 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; } - } - 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 index b9284afa..c01b0dbc 100644 --- a/src/model/UserType.cpp +++ b/src/model/UserType.cpp @@ -10,109 +10,107 @@ * Do not edit the class manually. */ - - #include "tribufu++/model/UserType.h" -namespace tribufu { -namespace models { - -namespace +namespace tribufu { -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) + namespace models { - 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) + namespace { - auto v = toEnum(e); - setValue(v); + 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; + } + } - return ok; } - -UserType::eUserType UserType::getValue() const -{ - return m_value; -} - -void UserType::setValue(UserType::eUserType const value) -{ - m_value = value; -} - -} -} - -