diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache index e7374f4a1018..9536512f0f73 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache @@ -8,6 +8,9 @@ #ifndef {{modelHeaderGuardPrefix}}_{{classname}}_H_ #define {{modelHeaderGuardPrefix}}_{{classname}}_H_ +{{#hasEnums}} +#include +{{/hasEnums}} {{#oneOf}} {{#-first}} #include @@ -146,34 +149,64 @@ public: 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; + ///////////////////////////////////////////// /// {{classname}} members - {{#vars}} - {{^isInherited}} + {{! ENUM DEFINITIONS }} + {{#vars}}{{^isInherited}}{{#isEnum}} + enum class {{#isContainer}}{{{enumName}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}{{/isContainer}} + { + {{#allowableValues}}{{#enumVars}}{{value}}, + {{/enumVars}}{{/allowableValues}} + }; /// /// {{description}} /// - {{#isContainer}}{{{dataType}}}& {{getter}}(); - {{/isContainer}}{{^isContainer}}{{{dataType}}} {{getter}}() const; - {{/isContainer}}bool {{nameInCamelCase}}IsSet() const; + {{/isEnum}}{{/isInherited}}{{/vars}}{{#vars}}{{^isInherited}}{{#isEnum}}{{#isContainer}} + {{! ENUM CONVERSIONS }} + {{{enumName}}} to{{{enumName}}}(const utility::string_t& value) const; + const utility::string_t from{{{enumName}}}(const {{{enumName}}} value) const; + {{#isArray}} + {{{datatypeWithEnum}}} to{{{enumName}}}(const {{{dataType}}}& value) const; + {{{dataType}}} from{{{enumName}}}(const {{{datatypeWithEnum}}}& value) const; + {{/isArray}}{{/isContainer}}{{^isContainer}} + {{{datatypeWithEnum}}} to{{{datatypeWithEnum}}}(const utility::string_t& value) const; + const utility::string_t from{{{datatypeWithEnum}}}(const {{{datatypeWithEnum}}} value) const; + {{/isContainer}}{{/isEnum}}{{/isInherited}}{{/vars}} + + {{! SETTER AND GETTERS }} + {{#vars}}{{^isInherited}} + /// + /// {{description}} + /// + {{#isContainer}}{{^isEnum}} + {{{dataType}}} {{getter}}() const; + {{/isEnum}}{{/isContainer}}{{^isContainer}}{{^isEnum}} + {{{dataType}}} {{getter}}() const; + {{/isEnum}}{{/isContainer}} + {{#isEnum}}{{^isMap}} + {{{datatypeWithEnum}}} {{getter}}() const; + {{/isMap}}{{#isMap}} + {{{dataType}}} {{getter}}() const; + {{/isMap}}{{/isEnum}} + bool {{nameInCamelCase}}IsSet() const; void unset{{name}}(); - {{#isPrimitiveType}} void {{setter}}({{{dataType}}} value); - {{/isPrimitiveType}} - {{^isPrimitiveType}} + {{/isPrimitiveType}}{{^isPrimitiveType}}{{^isEnum}} void {{setter}}(const {{{dataType}}}& value); - {{/isPrimitiveType}} - - {{/isInherited}} - {{/vars}} + {{/isEnum}}{{/isPrimitiveType}}{{#isEnum}} + void {{setter}}(const {{^isMap}}{{{datatypeWithEnum}}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} value); + {{/isEnum}}{{/isInherited}}{{/vars}} protected: {{#vars}} - {{^isInherited}} + {{^isInherited}}{{^isEnum}} {{{dataType}}} m_{{name}}; - bool m_{{name}}IsSet; + {{/isEnum}}{{#isEnum}} + {{^isMap}}{{{datatypeWithEnum}}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} m_{{name}}; + {{/isEnum}}bool m_{{name}}IsSet; {{/isInherited}} {{/vars}} }; diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index 49e9894da568..175c0401d247 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -175,7 +175,6 @@ void {{classname}}::setValue({{classname}}::e{{classname}} const value) } {{/isEnum}} - {{^isEnum}} {{classname}}::{{classname}}() @@ -183,6 +182,7 @@ void {{classname}}::setValue({{classname}}::e{{classname}} const value) {{#vars}} {{^isInherited}} {{^isContainer}} + {{^isEnum}} {{#isPrimitiveType}} m_{{name}} = {{{defaultValue}}}; {{/isPrimitiveType}} @@ -194,6 +194,7 @@ void {{classname}}::setValue({{classname}}::e{{classname}} const value) m_{{name}} = {{{defaultValue}}}; {{/isDateTime}} {{/isPrimitiveType}} + {{/isEnum}} {{/isContainer}} m_{{name}}IsSet = false; {{/isInherited}} @@ -212,15 +213,27 @@ void {{classname}}::validate() web::json::value {{classname}}::toJson() const { {{#parent}} - web::json::value val = this->{{{.}}}::toJson();{{/parent}} + web::json::value val = this->{{{.}}}::toJson(); + {{/parent}} {{^parent}} web::json::value val = web::json::value::object(); {{/parent}} {{#vars}}{{^isInherited}} if(m_{{name}}IsSet) - { + { + {{#isEnum}}{{#isContainer}}{{#isArray}} + {{{dataType}}} refVal = from{{{enumName}}}(m_{{name}}); + {{/isArray}}{{#isMap}} val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); - }{{/isInherited}}{{/vars}} + {{/isMap}}{{/isContainer}}{{^isContainer}} + utility::string_t refVal = from{{{datatypeWithEnum}}}(m_{{name}}); + {{/isContainer}}{{^isMap}}val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(refVal); + {{/isMap}}{{/isEnum}} + {{^isEnum}} + val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); + {{/isEnum}} + } + {{/isInherited}}{{/vars}} return val; } @@ -239,7 +252,16 @@ bool {{classname}}::fromJson(const web::json::value& val) { {{{dataType}}} refVal_{{setter}}; ok &= ModelBase::fromJson(fieldValue, refVal_{{setter}}); + {{^isEnum}} + {{setter}}(refVal_{{setter}}); + {{/isEnum}} + {{#isEnum}}{{#isContainer}}{{#isArray}} + {{setter}}(to{{{enumName}}}(refVal_{{setter}})); + {{/isArray}}{{#isMap}} {{setter}}(refVal_{{setter}}); + {{/isMap}}{{/isContainer}}{{^isContainer}} + {{setter}}(to{{{datatypeWithEnum}}}(refVal_{{setter}})); + {{/isContainer}}{{/isEnum}} } }{{/isInherited}}{{/vars}} return ok; @@ -255,7 +277,16 @@ void {{classname}}::toMultipart(std::shared_ptr multipart, co {{#vars}} if(m_{{name}}IsSet) { + {{^isEnum}} multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); + {{/isEnum}} + {{#isEnum}}{{#isContainer}}{{#isArray}} + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), from{{{enumName}}}(m_{{name}}))); + {{/isArray}}{{#isMap}} + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); + {{/isMap}}{{/isContainer}}{{^isContainer}} + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), from{{{datatypeWithEnum}}}(m_{{name}}))); + {{/isContainer}}{{/isEnum}} } {{/vars}} } @@ -274,33 +305,93 @@ bool {{classname}}::fromMultiPart(std::shared_ptr multipart, { {{{dataType}}} refVal_{{setter}}; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("{{baseName}}"))), refVal_{{setter}} ); + {{^isEnum}} + {{setter}}(refVal_{{setter}}); + {{/isEnum}} + {{#isEnum}}{{#isContainer}}{{#isArray}} + {{setter}}(to{{{enumName}}}(refVal_{{setter}})); + {{/isArray}}{{#isMap}} {{setter}}(refVal_{{setter}}); + {{/isMap}}{{/isContainer}}{{^isContainer}} + {{setter}}(to{{{datatypeWithEnum}}}(refVal_{{setter}})); + {{/isContainer}}{{/isEnum}} } {{/vars}} return ok; } -{{#vars}} -{{^isInherited}} +{{#vars}}{{^isInherited}}{{#isEnum}}{{#isContainer}} +{{classname}}::{{{enumName}}} {{classname}}::to{{{enumName}}}(const utility::string_t& value) const +{{/isContainer}}{{^isContainer}} +{{classname}}::{{{datatypeWithEnum}}} {{classname}}::to{{{datatypeWithEnum}}}(const {{dataType}}& value) const +{{/isContainer}} +{ + {{#allowableValues}}{{#enumVars}} + if (value == utility::conversions::to_string_t("{{value}}")) { + return {{#isContainer}}{{{enumName}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}{{/isContainer}}::{{value}}; + } + {{/enumVars}}{{/allowableValues}} + throw std::invalid_argument("Invalid value for conversion to {{{datatypeWithEnum}}}"); +} + {{#isContainer}} -{{{dataType}}}& {{classname}}::{{getter}}() +const utility::string_t {{classname}}::from{{{enumName}}}(const {{{enumName}}} value) const +{{/isContainer}}{{^isContainer}} +const {{dataType}} {{classname}}::from{{{datatypeWithEnum}}}(const {{{datatypeWithEnum}}} value) const +{{/isContainer}} +{ + switch(value) + { + {{#allowableValues}}{{#enumVars}} + case {{#isContainer}}{{{enumName}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}{{/isContainer}}::{{value}}: return utility::conversions::to_string_t("{{value}}"); + {{/enumVars}}{{/allowableValues}} + } +} + +{{#isContainer}}{{#isArray}} +{{{dataType}}} {{{classname}}}::from{{{enumName}}}(const {{{datatypeWithEnum}}}& value) const +{ + {{{dataType}}} ret; + for (auto it = value.begin(); it != value.end(); it++) { + ret.push_back(from{{{enumName}}}(*it)); + } + return ret; +} + +{{{baseType}}}<{{classname}}::{{{enumName}}}> {{{classname}}}::to{{{enumName}}}(const {{{dataType}}}& value) const +{ + {{{datatypeWithEnum}}} ret; + for (auto it = value.begin(); it != value.end(); it++) { + ret.push_back(to{{{enumName}}}(*it)); + } + return ret; +} +{{/isArray}}{{/isContainer}}{{/isEnum}}{{/isInherited}}{{/vars}} + +{{#vars}}{{^isInherited}}{{#isContainer}}{{^isEnum}} +{{{dataType}}} {{classname}}::{{getter}}() const { return m_{{name}}; } -{{/isContainer}} -{{^isContainer}} +{{/isEnum}}{{/isContainer}}{{^isContainer}}{{^isEnum}} {{{dataType}}} {{classname}}::{{getter}}() const { return m_{{name}}; } -{{/isContainer}} +{{/isEnum}}{{/isContainer}}{{#isEnum}} +{{^isMap}}{{#isArray}}{{{baseType}}}<{{/isArray}}{{{classname}}}::{{{enumName}}}{{#isArray}}>{{/isArray}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} {{classname}}::{{getter}}() const +{ + return m_{{name}}; +} +{{/isEnum}} {{#isPrimitiveType}} void {{classname}}::{{setter}}({{{dataType}}} value) -{{/isPrimitiveType}} -{{^isPrimitiveType}} +{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isEnum}} void {{classname}}::{{setter}}(const {{{dataType}}}& value) -{{/isPrimitiveType}} +{{/isEnum}}{{/isPrimitiveType}}{{#isEnum}} +void {{classname}}::{{setter}}(const {{^isMap}}{{{datatypeWithEnum}}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} value) +{{/isEnum}} { m_{{name}} = value; m_{{name}}IsSet = true; @@ -315,8 +406,7 @@ void {{classname}}::unset{{name}}() { m_{{name}}IsSet = false; } -{{/isInherited}} -{{/vars}} +{{/isInherited}}{{/vars}} {{/isEnum}} {{/oneOf}} {{#modelNamespaceDeclarations}} diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h index 963f20198f5f..b55e9882e05a 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h @@ -51,42 +51,57 @@ class ApiResponse 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; + ///////////////////////////////////////////// /// ApiResponse members + + + /// /// /// + int32_t getCode() const; + + bool codeIsSet() const; void unsetCode(); - void setCode(int32_t value); - + /// /// /// + utility::string_t getType() const; + + bool typeIsSet() const; void unsetType(); void setType(const utility::string_t& value); - + /// /// /// + utility::string_t getMessage() const; + + bool messageIsSet() const; void unsetMessage(); void setMessage(const utility::string_t& value); - + protected: + int32_t m_Code; bool m_CodeIsSet; + utility::string_t m_Type; bool m_TypeIsSet; + utility::string_t m_Message; bool m_MessageIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h index 39d87d3be430..8a03a0b36fbc 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h @@ -51,31 +51,42 @@ class Category 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; + ///////////////////////////////////////////// /// Category members + + + /// /// /// + int64_t getId() const; + + bool idIsSet() const; void unsetId(); - void setId(int64_t value); - + /// /// /// + utility::string_t getName() const; + + bool nameIsSet() const; void unsetName(); void setName(const utility::string_t& value); - + protected: + int64_t m_Id; bool m_IdIsSet; + utility::string_t m_Name; bool m_NameIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h index 2e281caeecc8..3b2298187f8f 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/CreateUserOrPet_request.h @@ -18,6 +18,7 @@ #ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_ #define ORG_OPENAPITOOLS_CLIENT_MODEL_CreateUserOrPet_request_H_ +#include #include #include "CppRestPetstoreClient/ModelBase.h" diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h index 1ff5ef63302c..3b3550337d03 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h @@ -18,6 +18,7 @@ #ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_Order_H_ #define ORG_OPENAPITOOLS_CLIENT_MODEL_Order_H_ +#include #include "CppRestPetstoreClient/ModelBase.h" @@ -51,75 +52,113 @@ class Order 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; + ///////////////////////////////////////////// /// Order members + + enum class StatusEnum + { + placed, + approved, + delivered, + + }; + /// + /// Order Status + /// + + StatusEnum toStatusEnum(const utility::string_t& value) const; + const utility::string_t fromStatusEnum(const StatusEnum value) const; + + + /// /// /// + int64_t getId() const; + + bool idIsSet() const; void unsetId(); - void setId(int64_t value); - + /// /// /// + int64_t getPetId() const; + + bool petIdIsSet() const; void unsetPetId(); - void setPetId(int64_t value); - + /// /// /// + int32_t getQuantity() const; + + bool quantityIsSet() const; void unsetQuantity(); - void setQuantity(int32_t value); - + /// /// /// + utility::datetime getShipDate() const; + + bool shipDateIsSet() const; void unsetShipDate(); void setShipDate(const utility::datetime& value); - + /// /// Order Status /// - utility::string_t getStatus() const; + + + StatusEnum getStatus() const; + bool statusIsSet() const; void unsetStatus(); - void setStatus(const utility::string_t& value); - + void setStatus(const StatusEnum value); + /// /// /// + bool isComplete() const; + + bool completeIsSet() const; void unsetComplete(); - void setComplete(bool value); - + protected: + int64_t m_Id; bool m_IdIsSet; + int64_t m_PetId; bool m_PetIdIsSet; + int32_t m_Quantity; bool m_QuantityIsSet; + utility::datetime m_ShipDate; bool m_ShipDateIsSet; - utility::string_t m_Status; + + StatusEnum m_Status; bool m_StatusIsSet; + bool m_Complete; bool m_CompleteIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h index 8bad675814c4..b58758a315ba 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h @@ -18,6 +18,7 @@ #ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_Pet_H_ #define ORG_OPENAPITOOLS_CLIENT_MODEL_Pet_H_ +#include #include "CppRestPetstoreClient/ModelBase.h" @@ -56,76 +57,117 @@ class Pet 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; + ///////////////////////////////////////////// /// Pet members + + enum class StatusEnum + { + available, + pending, + sold, + + }; + /// + /// pet status in the store + /// + + StatusEnum toStatusEnum(const utility::string_t& value) const; + const utility::string_t fromStatusEnum(const StatusEnum value) const; + + + /// /// /// + int64_t getId() const; + + bool idIsSet() const; void unsetId(); - void setId(int64_t value); - + /// /// /// + std::shared_ptr getCategory() const; + + bool categoryIsSet() const; void unsetCategory(); void setCategory(const std::shared_ptr& value); - + /// /// /// + utility::string_t getName() const; + + bool nameIsSet() const; void unsetName(); void setName(const utility::string_t& value); - + /// /// /// - std::vector& getPhotoUrls(); + + std::vector getPhotoUrls() const; + + bool photoUrlsIsSet() const; void unsetPhotoUrls(); void setPhotoUrls(const std::vector& value); - + /// /// /// - std::vector>& getTags(); + + std::vector> getTags() const; + + bool tagsIsSet() const; void unsetTags(); void setTags(const std::vector>& value); - + /// /// pet status in the store /// - utility::string_t getStatus() const; + + + StatusEnum getStatus() const; + bool statusIsSet() const; void unsetStatus(); - void setStatus(const utility::string_t& value); - + void setStatus(const StatusEnum value); + protected: + int64_t m_Id; bool m_IdIsSet; + std::shared_ptr m_Category; bool m_CategoryIsSet; + utility::string_t m_Name; bool m_NameIsSet; + std::vector m_PhotoUrls; bool m_PhotoUrlsIsSet; + std::vector> m_Tags; bool m_TagsIsSet; - utility::string_t m_Status; + + StatusEnum m_Status; bool m_StatusIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h index 37bb836179a1..e86218543f74 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h @@ -54,31 +54,43 @@ class SchemaWithSet 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; + ///////////////////////////////////////////// /// SchemaWithSet members + + + /// /// pedigree and other certificates /// - std::set& getCertificates(); + + std::set getCertificates() const; + + bool certificatesIsSet() const; void unsetCertificates(); void setCertificates(const std::set& value); - + /// /// /// + std::shared_ptr getVaccinationBook() const; + + bool vaccinationBookIsSet() const; void unsetVaccinationBook(); void setVaccinationBook(const std::shared_ptr& value); - + protected: + std::set m_Certificates; bool m_CertificatesIsSet; + std::shared_ptr m_VaccinationBook; bool m_VaccinationBookIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h index 875f84b018d2..f5305db80c3f 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h @@ -53,20 +53,28 @@ class SchemaWithSet_vaccinationBook 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; + ///////////////////////////////////////////// /// SchemaWithSet_vaccinationBook members + + + /// /// /// - std::set>& getVaccines(); + + std::set> getVaccines() const; + + bool vaccinesIsSet() const; void unsetVaccines(); void setVaccines(const std::set>& value); - + protected: + std::set> m_Vaccines; bool m_VaccinesIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h index 583b21f1ddc2..827924a2105e 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h @@ -51,31 +51,42 @@ class Tag 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; + ///////////////////////////////////////////// /// Tag members + + + /// /// /// + int64_t getId() const; + + bool idIsSet() const; void unsetId(); - void setId(int64_t value); - + /// /// /// + utility::string_t getName() const; + + bool nameIsSet() const; void unsetName(); void setName(const utility::string_t& value); - + protected: + int64_t m_Id; bool m_IdIsSet; + utility::string_t m_Name; bool m_NameIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h index 63c6a899b6e1..d27325f56dbb 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h @@ -51,97 +51,131 @@ class User 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; + ///////////////////////////////////////////// /// User members + + + /// /// /// + int64_t getId() const; + + bool idIsSet() const; void unsetId(); - void setId(int64_t value); - + /// /// /// + utility::string_t getUsername() const; + + bool usernameIsSet() const; void unsetUsername(); void setUsername(const utility::string_t& value); - + /// /// /// + utility::string_t getFirstName() const; + + bool firstNameIsSet() const; void unsetFirstName(); void setFirstName(const utility::string_t& value); - + /// /// /// + utility::string_t getLastName() const; + + bool lastNameIsSet() const; void unsetLastName(); void setLastName(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 getPhone() const; + + bool phoneIsSet() const; void unsetPhone(); void setPhone(const utility::string_t& value); - + /// /// User Status /// + int32_t getUserStatus() const; + + bool userStatusIsSet() const; void unsetUserStatus(); - void setUserStatus(int32_t value); - + protected: + int64_t m_Id; bool m_IdIsSet; + utility::string_t m_Username; bool m_UsernameIsSet; + utility::string_t m_FirstName; bool m_FirstNameIsSet; + utility::string_t m_LastName; bool m_LastNameIsSet; + utility::string_t m_Email; bool m_EmailIsSet; + utility::string_t m_Password; bool m_PasswordIsSet; + utility::string_t m_Phone; bool m_PhoneIsSet; + int32_t m_UserStatus; bool m_UserStatusIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h index b85a70919663..c7d418d28bc5 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h @@ -51,31 +51,42 @@ class Vaccine 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; + ///////////////////////////////////////////// /// Vaccine members + + + /// /// vaccination date /// + std::shared_ptr getDate() const; + + bool dateIsSet() const; void unsetdate(); void setDate(const std::shared_ptr& value); - + /// /// true if a booster is still needed to complete the vaccination /// + bool isBoosterRequired() const; + + bool boosterRequiredIsSet() const; void unsetBoosterRequired(); - void setBoosterRequired(bool value); - + protected: + std::shared_ptr m_date; bool m_dateIsSet; + bool m_BoosterRequired; bool m_BoosterRequiredIsSet; }; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp index 84f8dd3c047a..b2d6a8cd80f4 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - ApiResponse::ApiResponse() { m_Code = 0; @@ -41,21 +40,26 @@ void ApiResponse::validate() web::json::value ApiResponse::toJson() const { - web::json::value val = web::json::value::object(); if(m_CodeIsSet) - { + { + val[utility::conversions::to_string_t(U("code"))] = ModelBase::toJson(m_Code); } + if(m_TypeIsSet) - { + { + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); } + if(m_MessageIsSet) - { + { + val[utility::conversions::to_string_t(U("message"))] = ModelBase::toJson(m_Message); } + return val; } @@ -72,6 +76,7 @@ bool ApiResponse::fromJson(const web::json::value& val) int32_t refVal_setCode; ok &= ModelBase::fromJson(fieldValue, refVal_setCode); setCode(refVal_setCode); + } } if(val.has_field(utility::conversions::to_string_t(U("type")))) @@ -82,6 +87,7 @@ bool ApiResponse::fromJson(const web::json::value& val) utility::string_t refVal_setType; ok &= ModelBase::fromJson(fieldValue, refVal_setType); setType(refVal_setType); + } } if(val.has_field(utility::conversions::to_string_t(U("message")))) @@ -92,6 +98,7 @@ bool ApiResponse::fromJson(const web::json::value& val) utility::string_t refVal_setMessage; ok &= ModelBase::fromJson(fieldValue, refVal_setMessage); setMessage(refVal_setMessage); + } } return ok; @@ -107,14 +114,17 @@ void ApiResponse::toMultipart(std::shared_ptr multipart, cons if(m_CodeIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code")), m_Code)); + } if(m_TypeIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + } if(m_MessageIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("message")), m_Message)); + } } @@ -132,22 +142,28 @@ bool ApiResponse::fromMultiPart(std::shared_ptr multipart, co int32_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("type")))) { utility::string_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("message")))) { utility::string_t refVal_setMessage; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("message"))), refVal_setMessage ); setMessage(refVal_setMessage); + } return ok; } + + + int32_t ApiResponse::getCode() const { return m_Code; @@ -168,11 +184,13 @@ void ApiResponse::unsetCode() { m_CodeIsSet = false; } + utility::string_t ApiResponse::getType() const { return m_Type; } + void ApiResponse::setType(const utility::string_t& value) { m_Type = value; @@ -188,11 +206,13 @@ void ApiResponse::unsetType() { m_TypeIsSet = false; } + utility::string_t ApiResponse::getMessage() const { return m_Message; } + void ApiResponse::setMessage(const utility::string_t& value) { m_Message = value; @@ -208,6 +228,7 @@ void ApiResponse::unsetMessage() { m_MessageIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp index b4cd3d4197e2..05c8050ee89e 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - Category::Category() { m_Id = 0L; @@ -39,17 +38,20 @@ void Category::validate() web::json::value Category::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); } + return val; } @@ -66,6 +68,7 @@ bool Category::fromJson(const web::json::value& val) int64_t refVal_setId; ok &= ModelBase::fromJson(fieldValue, refVal_setId); setId(refVal_setId); + } } if(val.has_field(utility::conversions::to_string_t(U("name")))) @@ -76,6 +79,7 @@ bool Category::fromJson(const web::json::value& val) utility::string_t refVal_setName; ok &= ModelBase::fromJson(fieldValue, refVal_setName); setName(refVal_setName); + } } return ok; @@ -91,10 +95,12 @@ void Category::toMultipart(std::shared_ptr multipart, const 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)); + } } @@ -112,16 +118,21 @@ bool Category::fromMultiPart(std::shared_ptr multipart, const int64_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); + } return ok; } + + + int64_t Category::getId() const { return m_Id; @@ -142,11 +153,13 @@ void Category::unsetId() { m_IdIsSet = false; } + utility::string_t Category::getName() const { return m_Name; } + void Category::setName(const utility::string_t& value) { m_Name = value; @@ -162,6 +175,7 @@ void Category::unsetName() { m_NameIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp index 8e48cd916b33..3ed8a4a47cca 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - Order::Order() { m_Id = 0L; @@ -30,7 +29,6 @@ Order::Order() m_QuantityIsSet = false; m_ShipDate = utility::datetime(); m_ShipDateIsSet = false; - m_Status = utility::conversions::to_string_t(""); m_StatusIsSet = false; m_Complete = false; m_CompleteIsSet = false; @@ -47,33 +45,46 @@ void Order::validate() web::json::value Order::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_PetIdIsSet) - { + { + val[utility::conversions::to_string_t(U("petId"))] = ModelBase::toJson(m_PetId); } + if(m_QuantityIsSet) - { + { + val[utility::conversions::to_string_t(U("quantity"))] = ModelBase::toJson(m_Quantity); } + if(m_ShipDateIsSet) - { + { + val[utility::conversions::to_string_t(U("shipDate"))] = ModelBase::toJson(m_ShipDate); } + if(m_StatusIsSet) - { - val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status); + { + + utility::string_t refVal = fromStatusEnum(m_Status); + val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(refVal); + } + if(m_CompleteIsSet) - { + { + val[utility::conversions::to_string_t(U("complete"))] = ModelBase::toJson(m_Complete); } + return val; } @@ -90,6 +101,7 @@ bool Order::fromJson(const web::json::value& val) int64_t refVal_setId; ok &= ModelBase::fromJson(fieldValue, refVal_setId); setId(refVal_setId); + } } if(val.has_field(utility::conversions::to_string_t(U("petId")))) @@ -100,6 +112,7 @@ bool Order::fromJson(const web::json::value& val) int64_t refVal_setPetId; ok &= ModelBase::fromJson(fieldValue, refVal_setPetId); setPetId(refVal_setPetId); + } } if(val.has_field(utility::conversions::to_string_t(U("quantity")))) @@ -110,6 +123,7 @@ bool Order::fromJson(const web::json::value& val) int32_t refVal_setQuantity; ok &= ModelBase::fromJson(fieldValue, refVal_setQuantity); setQuantity(refVal_setQuantity); + } } if(val.has_field(utility::conversions::to_string_t(U("shipDate")))) @@ -120,6 +134,7 @@ bool Order::fromJson(const web::json::value& val) utility::datetime refVal_setShipDate; ok &= ModelBase::fromJson(fieldValue, refVal_setShipDate); setShipDate(refVal_setShipDate); + } } if(val.has_field(utility::conversions::to_string_t(U("status")))) @@ -129,7 +144,9 @@ bool Order::fromJson(const web::json::value& val) { utility::string_t refVal_setStatus; ok &= ModelBase::fromJson(fieldValue, refVal_setStatus); - setStatus(refVal_setStatus); + + setStatus(toStatusEnum(refVal_setStatus)); + } } if(val.has_field(utility::conversions::to_string_t(U("complete")))) @@ -140,6 +157,7 @@ bool Order::fromJson(const web::json::value& val) bool refVal_setComplete; ok &= ModelBase::fromJson(fieldValue, refVal_setComplete); setComplete(refVal_setComplete); + } } return ok; @@ -155,26 +173,33 @@ void Order::toMultipart(std::shared_ptr multipart, const util if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } if(m_PetIdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("petId")), m_PetId)); + } if(m_QuantityIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("quantity")), m_Quantity)); + } if(m_ShipDateIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("shipDate")), m_ShipDate)); + } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status)); + + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), fromStatusEnum(m_Status))); + } if(m_CompleteIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("complete")), m_Complete)); + } } @@ -192,40 +217,84 @@ bool Order::fromMultiPart(std::shared_ptr multipart, const ut int64_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("petId")))) { int64_t refVal_setPetId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("petId"))), refVal_setPetId ); setPetId(refVal_setPetId); + } if(multipart->hasContent(utility::conversions::to_string_t(U("quantity")))) { int32_t refVal_setQuantity; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("quantity"))), refVal_setQuantity ); setQuantity(refVal_setQuantity); + } if(multipart->hasContent(utility::conversions::to_string_t(U("shipDate")))) { utility::datetime refVal_setShipDate; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("shipDate"))), refVal_setShipDate ); setShipDate(refVal_setShipDate); + } if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) { utility::string_t refVal_setStatus; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); - setStatus(refVal_setStatus); + + setStatus(toStatusEnum(refVal_setStatus)); + } if(multipart->hasContent(utility::conversions::to_string_t(U("complete")))) { bool refVal_setComplete; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_setComplete ); setComplete(refVal_setComplete); + } return ok; } + +Order::StatusEnum Order::toStatusEnum(const utility::string_t& value) const +{ + + if (value == utility::conversions::to_string_t("placed")) { + return StatusEnum::placed; + } + + if (value == utility::conversions::to_string_t("approved")) { + return StatusEnum::approved; + } + + if (value == utility::conversions::to_string_t("delivered")) { + return StatusEnum::delivered; + } + + throw std::invalid_argument("Invalid value for conversion to StatusEnum"); +} + + +const utility::string_t Order::fromStatusEnum(const StatusEnum value) const +{ + switch(value) + { + + case StatusEnum::placed: return utility::conversions::to_string_t("placed"); + + case StatusEnum::approved: return utility::conversions::to_string_t("approved"); + + case StatusEnum::delivered: return utility::conversions::to_string_t("delivered"); + + } +} + + + + int64_t Order::getId() const { return m_Id; @@ -246,6 +315,7 @@ void Order::unsetId() { m_IdIsSet = false; } + int64_t Order::getPetId() const { return m_PetId; @@ -266,6 +336,7 @@ void Order::unsetPetId() { m_PetIdIsSet = false; } + int32_t Order::getQuantity() const { return m_Quantity; @@ -286,11 +357,13 @@ void Order::unsetQuantity() { m_QuantityIsSet = false; } + utility::datetime Order::getShipDate() const { return m_ShipDate; } + void Order::setShipDate(const utility::datetime& value) { m_ShipDate = value; @@ -306,12 +379,14 @@ void Order::unsetShipDate() { m_ShipDateIsSet = false; } -utility::string_t Order::getStatus() const + +Order::StatusEnum Order::getStatus() const { return m_Status; } -void Order::setStatus(const utility::string_t& value) + +void Order::setStatus(const StatusEnum value) { m_Status = value; m_StatusIsSet = true; @@ -326,6 +401,7 @@ void Order::unsetStatus() { m_StatusIsSet = false; } + bool Order::isComplete() const { return m_Complete; @@ -346,6 +422,7 @@ void Order::unsetComplete() { m_CompleteIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp index 6c7ba1692daa..7647fd2e38da 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - Pet::Pet() { m_Id = 0L; @@ -29,7 +28,6 @@ Pet::Pet() m_NameIsSet = false; m_PhotoUrlsIsSet = false; m_TagsIsSet = false; - m_Status = utility::conversions::to_string_t(""); m_StatusIsSet = false; } @@ -44,33 +42,46 @@ void Pet::validate() web::json::value Pet::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_CategoryIsSet) - { + { + val[utility::conversions::to_string_t(U("category"))] = ModelBase::toJson(m_Category); } + if(m_NameIsSet) - { + { + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } + if(m_PhotoUrlsIsSet) - { + { + val[utility::conversions::to_string_t(U("photoUrls"))] = ModelBase::toJson(m_PhotoUrls); } + if(m_TagsIsSet) - { + { + val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags); } + if(m_StatusIsSet) - { - val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status); + { + + utility::string_t refVal = fromStatusEnum(m_Status); + val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(refVal); + } + return val; } @@ -87,6 +98,7 @@ bool Pet::fromJson(const web::json::value& val) int64_t refVal_setId; ok &= ModelBase::fromJson(fieldValue, refVal_setId); setId(refVal_setId); + } } if(val.has_field(utility::conversions::to_string_t(U("category")))) @@ -97,6 +109,7 @@ bool Pet::fromJson(const web::json::value& val) std::shared_ptr refVal_setCategory; ok &= ModelBase::fromJson(fieldValue, refVal_setCategory); setCategory(refVal_setCategory); + } } if(val.has_field(utility::conversions::to_string_t(U("name")))) @@ -107,6 +120,7 @@ bool Pet::fromJson(const web::json::value& val) utility::string_t refVal_setName; ok &= ModelBase::fromJson(fieldValue, refVal_setName); setName(refVal_setName); + } } if(val.has_field(utility::conversions::to_string_t(U("photoUrls")))) @@ -117,6 +131,7 @@ bool Pet::fromJson(const web::json::value& val) std::vector refVal_setPhotoUrls; ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrls); setPhotoUrls(refVal_setPhotoUrls); + } } if(val.has_field(utility::conversions::to_string_t(U("tags")))) @@ -127,6 +142,7 @@ bool Pet::fromJson(const web::json::value& val) std::vector> refVal_setTags; ok &= ModelBase::fromJson(fieldValue, refVal_setTags); setTags(refVal_setTags); + } } if(val.has_field(utility::conversions::to_string_t(U("status")))) @@ -136,7 +152,9 @@ bool Pet::fromJson(const web::json::value& val) { utility::string_t refVal_setStatus; ok &= ModelBase::fromJson(fieldValue, refVal_setStatus); - setStatus(refVal_setStatus); + + setStatus(toStatusEnum(refVal_setStatus)); + } } return ok; @@ -152,26 +170,33 @@ void Pet::toMultipart(std::shared_ptr multipart, const utilit if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } if(m_CategoryIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("category")), m_Category)); + } if(m_NameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + } if(m_PhotoUrlsIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photoUrls")), m_PhotoUrls)); + } if(m_TagsIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags)); + } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status)); + + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), fromStatusEnum(m_Status))); + } } @@ -189,40 +214,84 @@ bool Pet::fromMultiPart(std::shared_ptr multipart, const util int64_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("category")))) { std::shared_ptr refVal_setCategory; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("category"))), refVal_setCategory ); setCategory(refVal_setCategory); + } 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("photoUrls")))) { std::vector refVal_setPhotoUrls; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photoUrls"))), refVal_setPhotoUrls ); setPhotoUrls(refVal_setPhotoUrls); + } if(multipart->hasContent(utility::conversions::to_string_t(U("tags")))) { std::vector> 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("status")))) { utility::string_t refVal_setStatus; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); - setStatus(refVal_setStatus); + + setStatus(toStatusEnum(refVal_setStatus)); + } return ok; } + +Pet::StatusEnum Pet::toStatusEnum(const utility::string_t& value) const +{ + + if (value == utility::conversions::to_string_t("available")) { + return StatusEnum::available; + } + + if (value == utility::conversions::to_string_t("pending")) { + return StatusEnum::pending; + } + + if (value == utility::conversions::to_string_t("sold")) { + return StatusEnum::sold; + } + + throw std::invalid_argument("Invalid value for conversion to StatusEnum"); +} + + +const utility::string_t Pet::fromStatusEnum(const StatusEnum value) const +{ + switch(value) + { + + case StatusEnum::available: return utility::conversions::to_string_t("available"); + + case StatusEnum::pending: return utility::conversions::to_string_t("pending"); + + case StatusEnum::sold: return utility::conversions::to_string_t("sold"); + + } +} + + + + int64_t Pet::getId() const { return m_Id; @@ -243,11 +312,13 @@ void Pet::unsetId() { m_IdIsSet = false; } + std::shared_ptr Pet::getCategory() const { return m_Category; } + void Pet::setCategory(const std::shared_ptr& value) { m_Category = value; @@ -263,11 +334,13 @@ void Pet::unsetCategory() { m_CategoryIsSet = false; } + utility::string_t Pet::getName() const { return m_Name; } + void Pet::setName(const utility::string_t& value) { m_Name = value; @@ -283,11 +356,13 @@ void Pet::unsetName() { m_NameIsSet = false; } -std::vector& Pet::getPhotoUrls() + +std::vector Pet::getPhotoUrls() const { return m_PhotoUrls; } + void Pet::setPhotoUrls(const std::vector& value) { m_PhotoUrls = value; @@ -303,11 +378,13 @@ void Pet::unsetPhotoUrls() { m_PhotoUrlsIsSet = false; } -std::vector>& Pet::getTags() + +std::vector> Pet::getTags() const { return m_Tags; } + void Pet::setTags(const std::vector>& value) { m_Tags = value; @@ -323,12 +400,14 @@ void Pet::unsetTags() { m_TagsIsSet = false; } -utility::string_t Pet::getStatus() const + +Pet::StatusEnum Pet::getStatus() const { return m_Status; } -void Pet::setStatus(const utility::string_t& value) + +void Pet::setStatus(const StatusEnum value) { m_Status = value; m_StatusIsSet = true; @@ -343,6 +422,7 @@ void Pet::unsetStatus() { m_StatusIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp index 37ea0a015a30..29422af3d2fe 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - SchemaWithSet::SchemaWithSet() { m_CertificatesIsSet = false; @@ -37,17 +36,20 @@ void SchemaWithSet::validate() web::json::value SchemaWithSet::toJson() const { - web::json::value val = web::json::value::object(); if(m_CertificatesIsSet) - { + { + val[utility::conversions::to_string_t(U("certificates"))] = ModelBase::toJson(m_Certificates); } + if(m_VaccinationBookIsSet) - { + { + val[utility::conversions::to_string_t(U("vaccinationBook"))] = ModelBase::toJson(m_VaccinationBook); } + return val; } @@ -64,6 +66,7 @@ bool SchemaWithSet::fromJson(const web::json::value& val) std::set refVal_setCertificates; ok &= ModelBase::fromJson(fieldValue, refVal_setCertificates); setCertificates(refVal_setCertificates); + } } if(val.has_field(utility::conversions::to_string_t(U("vaccinationBook")))) @@ -74,6 +77,7 @@ bool SchemaWithSet::fromJson(const web::json::value& val) std::shared_ptr refVal_setVaccinationBook; ok &= ModelBase::fromJson(fieldValue, refVal_setVaccinationBook); setVaccinationBook(refVal_setVaccinationBook); + } } return ok; @@ -89,10 +93,12 @@ void SchemaWithSet::toMultipart(std::shared_ptr multipart, co if(m_CertificatesIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("certificates")), m_Certificates)); + } if(m_VaccinationBookIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccinationBook")), m_VaccinationBook)); + } } @@ -110,21 +116,27 @@ bool SchemaWithSet::fromMultiPart(std::shared_ptr multipart, std::set refVal_setCertificates; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("certificates"))), refVal_setCertificates ); setCertificates(refVal_setCertificates); + } if(multipart->hasContent(utility::conversions::to_string_t(U("vaccinationBook")))) { std::shared_ptr refVal_setVaccinationBook; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccinationBook"))), refVal_setVaccinationBook ); setVaccinationBook(refVal_setVaccinationBook); + } return ok; } -std::set& SchemaWithSet::getCertificates() + + + +std::set SchemaWithSet::getCertificates() const { return m_Certificates; } + void SchemaWithSet::setCertificates(const std::set& value) { m_Certificates = value; @@ -140,11 +152,13 @@ void SchemaWithSet::unsetCertificates() { m_CertificatesIsSet = false; } + std::shared_ptr SchemaWithSet::getVaccinationBook() const { return m_VaccinationBook; } + void SchemaWithSet::setVaccinationBook(const std::shared_ptr& value) { m_VaccinationBook = value; @@ -160,6 +174,7 @@ void SchemaWithSet::unsetVaccinationBook() { m_VaccinationBookIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp index c22185da938d..bda33971719c 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - SchemaWithSet_vaccinationBook::SchemaWithSet_vaccinationBook() { m_VaccinesIsSet = false; @@ -36,13 +35,14 @@ void SchemaWithSet_vaccinationBook::validate() web::json::value SchemaWithSet_vaccinationBook::toJson() const { - web::json::value val = web::json::value::object(); if(m_VaccinesIsSet) - { + { + val[utility::conversions::to_string_t(U("vaccines"))] = ModelBase::toJson(m_Vaccines); } + return val; } @@ -59,6 +59,7 @@ bool SchemaWithSet_vaccinationBook::fromJson(const web::json::value& val) std::set> refVal_setVaccines; ok &= ModelBase::fromJson(fieldValue, refVal_setVaccines); setVaccines(refVal_setVaccines); + } } return ok; @@ -74,6 +75,7 @@ void SchemaWithSet_vaccinationBook::toMultipart(std::shared_ptradd(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccines")), m_Vaccines)); + } } @@ -91,15 +93,20 @@ bool SchemaWithSet_vaccinationBook::fromMultiPart(std::shared_ptr> refVal_setVaccines; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccines"))), refVal_setVaccines ); setVaccines(refVal_setVaccines); + } return ok; } -std::set>& SchemaWithSet_vaccinationBook::getVaccines() + + + +std::set> SchemaWithSet_vaccinationBook::getVaccines() const { return m_Vaccines; } + void SchemaWithSet_vaccinationBook::setVaccines(const std::set>& value) { m_Vaccines = value; @@ -115,6 +122,7 @@ void SchemaWithSet_vaccinationBook::unsetVaccines() { m_VaccinesIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp index 7841956a2bb0..7eff6d389a04 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - Tag::Tag() { m_Id = 0L; @@ -39,17 +38,20 @@ void Tag::validate() web::json::value Tag::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); } + return val; } @@ -66,6 +68,7 @@ bool Tag::fromJson(const web::json::value& val) int64_t refVal_setId; ok &= ModelBase::fromJson(fieldValue, refVal_setId); setId(refVal_setId); + } } if(val.has_field(utility::conversions::to_string_t(U("name")))) @@ -76,6 +79,7 @@ bool Tag::fromJson(const web::json::value& val) utility::string_t refVal_setName; ok &= ModelBase::fromJson(fieldValue, refVal_setName); setName(refVal_setName); + } } return ok; @@ -91,10 +95,12 @@ void Tag::toMultipart(std::shared_ptr multipart, const utilit 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)); + } } @@ -112,16 +118,21 @@ bool Tag::fromMultiPart(std::shared_ptr multipart, const util int64_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); + } return ok; } + + + int64_t Tag::getId() const { return m_Id; @@ -142,11 +153,13 @@ void Tag::unsetId() { m_IdIsSet = false; } + utility::string_t Tag::getName() const { return m_Name; } + void Tag::setName(const utility::string_t& value) { m_Name = value; @@ -162,6 +175,7 @@ void Tag::unsetName() { m_NameIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp index a3a8446ec4bc..ebcc2e534a52 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - User::User() { m_Id = 0L; @@ -51,41 +50,56 @@ void User::validate() web::json::value User::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_UsernameIsSet) - { + { + val[utility::conversions::to_string_t(U("username"))] = ModelBase::toJson(m_Username); } + if(m_FirstNameIsSet) - { + { + val[utility::conversions::to_string_t(U("firstName"))] = ModelBase::toJson(m_FirstName); } + if(m_LastNameIsSet) - { + { + val[utility::conversions::to_string_t(U("lastName"))] = ModelBase::toJson(m_LastName); } + 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); } + if(m_PhoneIsSet) - { + { + val[utility::conversions::to_string_t(U("phone"))] = ModelBase::toJson(m_Phone); } + if(m_UserStatusIsSet) - { + { + val[utility::conversions::to_string_t(U("userStatus"))] = ModelBase::toJson(m_UserStatus); } + return val; } @@ -102,6 +116,7 @@ bool User::fromJson(const web::json::value& val) int64_t refVal_setId; ok &= ModelBase::fromJson(fieldValue, refVal_setId); setId(refVal_setId); + } } if(val.has_field(utility::conversions::to_string_t(U("username")))) @@ -112,6 +127,7 @@ bool User::fromJson(const web::json::value& val) utility::string_t refVal_setUsername; ok &= ModelBase::fromJson(fieldValue, refVal_setUsername); setUsername(refVal_setUsername); + } } if(val.has_field(utility::conversions::to_string_t(U("firstName")))) @@ -122,6 +138,7 @@ bool User::fromJson(const web::json::value& val) utility::string_t refVal_setFirstName; ok &= ModelBase::fromJson(fieldValue, refVal_setFirstName); setFirstName(refVal_setFirstName); + } } if(val.has_field(utility::conversions::to_string_t(U("lastName")))) @@ -132,6 +149,7 @@ bool User::fromJson(const web::json::value& val) utility::string_t refVal_setLastName; ok &= ModelBase::fromJson(fieldValue, refVal_setLastName); setLastName(refVal_setLastName); + } } if(val.has_field(utility::conversions::to_string_t(U("email")))) @@ -142,6 +160,7 @@ bool User::fromJson(const web::json::value& val) 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")))) @@ -152,6 +171,7 @@ bool User::fromJson(const web::json::value& val) utility::string_t refVal_setPassword; ok &= ModelBase::fromJson(fieldValue, refVal_setPassword); setPassword(refVal_setPassword); + } } if(val.has_field(utility::conversions::to_string_t(U("phone")))) @@ -162,6 +182,7 @@ bool User::fromJson(const web::json::value& val) utility::string_t refVal_setPhone; ok &= ModelBase::fromJson(fieldValue, refVal_setPhone); setPhone(refVal_setPhone); + } } if(val.has_field(utility::conversions::to_string_t(U("userStatus")))) @@ -172,6 +193,7 @@ bool User::fromJson(const web::json::value& val) int32_t refVal_setUserStatus; ok &= ModelBase::fromJson(fieldValue, refVal_setUserStatus); setUserStatus(refVal_setUserStatus); + } } return ok; @@ -187,34 +209,42 @@ void User::toMultipart(std::shared_ptr multipart, const utili if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + } if(m_UsernameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("username")), m_Username)); + } if(m_FirstNameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("firstName")), m_FirstName)); + } if(m_LastNameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("lastName")), m_LastName)); + } 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)); + } if(m_PhoneIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("phone")), m_Phone)); + } if(m_UserStatusIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("userStatus")), m_UserStatus)); + } } @@ -232,52 +262,63 @@ bool User::fromMultiPart(std::shared_ptr multipart, const uti int64_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("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("firstName")))) { utility::string_t refVal_setFirstName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("firstName"))), refVal_setFirstName ); setFirstName(refVal_setFirstName); + } if(multipart->hasContent(utility::conversions::to_string_t(U("lastName")))) { utility::string_t refVal_setLastName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("lastName"))), refVal_setLastName ); setLastName(refVal_setLastName); + } 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); + } if(multipart->hasContent(utility::conversions::to_string_t(U("phone")))) { utility::string_t refVal_setPhone; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("phone"))), refVal_setPhone ); setPhone(refVal_setPhone); + } if(multipart->hasContent(utility::conversions::to_string_t(U("userStatus")))) { int32_t refVal_setUserStatus; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("userStatus"))), refVal_setUserStatus ); setUserStatus(refVal_setUserStatus); + } return ok; } + + + int64_t User::getId() const { return m_Id; @@ -298,11 +339,13 @@ void User::unsetId() { m_IdIsSet = false; } + utility::string_t User::getUsername() const { return m_Username; } + void User::setUsername(const utility::string_t& value) { m_Username = value; @@ -318,11 +361,13 @@ void User::unsetUsername() { m_UsernameIsSet = false; } + utility::string_t User::getFirstName() const { return m_FirstName; } + void User::setFirstName(const utility::string_t& value) { m_FirstName = value; @@ -338,11 +383,13 @@ void User::unsetFirstName() { m_FirstNameIsSet = false; } + utility::string_t User::getLastName() const { return m_LastName; } + void User::setLastName(const utility::string_t& value) { m_LastName = value; @@ -358,11 +405,13 @@ void User::unsetLastName() { m_LastNameIsSet = false; } + utility::string_t User::getEmail() const { return m_Email; } + void User::setEmail(const utility::string_t& value) { m_Email = value; @@ -378,11 +427,13 @@ void User::unsetEmail() { m_EmailIsSet = false; } + utility::string_t User::getPassword() const { return m_Password; } + void User::setPassword(const utility::string_t& value) { m_Password = value; @@ -398,11 +449,13 @@ void User::unsetPassword() { m_PasswordIsSet = false; } + utility::string_t User::getPhone() const { return m_Phone; } + void User::setPhone(const utility::string_t& value) { m_Phone = value; @@ -418,6 +471,7 @@ void User::unsetPhone() { m_PhoneIsSet = false; } + int32_t User::getUserStatus() const { return m_UserStatus; @@ -438,6 +492,7 @@ void User::unsetUserStatus() { m_UserStatusIsSet = false; } + } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp index b4a338d8ee79..b7da86e76164 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp @@ -19,7 +19,6 @@ namespace client { namespace model { - Vaccine::Vaccine() { m_dateIsSet = false; @@ -38,17 +37,20 @@ void Vaccine::validate() web::json::value Vaccine::toJson() const { - web::json::value val = web::json::value::object(); if(m_dateIsSet) - { + { + val[utility::conversions::to_string_t(U("date"))] = ModelBase::toJson(m_date); } + if(m_BoosterRequiredIsSet) - { + { + val[utility::conversions::to_string_t(U("boosterRequired"))] = ModelBase::toJson(m_BoosterRequired); } + return val; } @@ -65,6 +67,7 @@ bool Vaccine::fromJson(const web::json::value& val) std::shared_ptr refVal_setDate; ok &= ModelBase::fromJson(fieldValue, refVal_setDate); setDate(refVal_setDate); + } } if(val.has_field(utility::conversions::to_string_t(U("boosterRequired")))) @@ -75,6 +78,7 @@ bool Vaccine::fromJson(const web::json::value& val) bool refVal_setBoosterRequired; ok &= ModelBase::fromJson(fieldValue, refVal_setBoosterRequired); setBoosterRequired(refVal_setBoosterRequired); + } } return ok; @@ -90,10 +94,12 @@ void Vaccine::toMultipart(std::shared_ptr multipart, const ut if(m_dateIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("date")), m_date)); + } if(m_BoosterRequiredIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("boosterRequired")), m_BoosterRequired)); + } } @@ -111,21 +117,27 @@ bool Vaccine::fromMultiPart(std::shared_ptr multipart, const std::shared_ptr refVal_setDate; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("date"))), refVal_setDate ); setDate(refVal_setDate); + } if(multipart->hasContent(utility::conversions::to_string_t(U("boosterRequired")))) { bool refVal_setBoosterRequired; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("boosterRequired"))), refVal_setBoosterRequired ); setBoosterRequired(refVal_setBoosterRequired); + } return ok; } + + + std::shared_ptr Vaccine::getDate() const { return m_date; } + void Vaccine::setDate(const std::shared_ptr& value) { m_date = value; @@ -141,6 +153,7 @@ void Vaccine::unsetdate() { m_dateIsSet = false; } + bool Vaccine::isBoosterRequired() const { return m_BoosterRequired; @@ -161,6 +174,7 @@ void Vaccine::unsetBoosterRequired() { m_BoosterRequiredIsSet = false; } + } } }