Files
sdk-cpp/src/model/Subscription.cpp

418 lines
14 KiB
C++

/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI-Generator 7.14.0-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "tribufu++/model/Subscription.h"
namespace tribufu
{
namespace models
{
Subscription::Subscription()
{
m_Id = utility::conversions::to_string_t("");
m_IdIsSet = false;
m_Name = utility::conversions::to_string_t("");
m_NameIsSet = false;
m_Description = utility::conversions::to_string_t("");
m_DescriptionIsSet = false;
m_Image_url = utility::conversions::to_string_t("");
m_Image_urlIsSet = false;
m_PricesIsSet = false;
m_Created = utility::datetime();
m_CreatedIsSet = false;
m_Updated = utility::datetime();
m_UpdatedIsSet = false;
}
Subscription::~Subscription()
{
}
void Subscription::validate()
{
// TODO: implement validation
}
web::json::value Subscription::toJson() const
{
web::json::value val = web::json::value::object();
if (m_IdIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("id"))] = ModelBase::toJson(m_Id);
}
if (m_NameIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("name"))] = ModelBase::toJson(m_Name);
}
if (m_DescriptionIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("description"))] = ModelBase::toJson(m_Description);
}
if (m_Image_urlIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("image_url"))] = ModelBase::toJson(m_Image_url);
}
if (m_PricesIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("prices"))] = ModelBase::toJson(m_Prices);
}
if (m_CreatedIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("created"))] = ModelBase::toJson(m_Created);
}
if (m_UpdatedIsSet)
{
val[utility::conversions::to_string_t(_XPLATSTR("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(_XPLATSTR("id"))))
{
const web::json::value &fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("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(_XPLATSTR("name"))))
{
const web::json::value &fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("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(_XPLATSTR("description"))))
{
const web::json::value &fieldValue =
val.at(utility::conversions::to_string_t(_XPLATSTR("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(_XPLATSTR("image_url"))))
{
const web::json::value &fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("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(_XPLATSTR("prices"))))
{
const web::json::value &fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("prices")));
if (!fieldValue.is_null())
{
std::map<utility::string_t, double> refVal_setPrices;
ok &= ModelBase::fromJson(fieldValue, refVal_setPrices);
setPrices(refVal_setPrices);
}
}
if (val.has_field(utility::conversions::to_string_t(_XPLATSTR("created"))))
{
const web::json::value &fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("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(_XPLATSTR("updated"))))
{
const web::json::value &fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("updated")));
if (!fieldValue.is_null())
{
utility::datetime refVal_setUpdated;
ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated);
setUpdated(refVal_setUpdated);
}
}
return ok;
}
void Subscription::toMultipart(std::shared_ptr<MultipartFormData> 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(_XPLATSTR(".")))
{
namePrefix += utility::conversions::to_string_t(_XPLATSTR("."));
}
if (m_IdIsSet)
{
multipart->add(
ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("id")), m_Id));
}
if (m_NameIsSet)
{
multipart->add(ModelBase::toHttpContent(
namePrefix + utility::conversions::to_string_t(_XPLATSTR("name")), m_Name));
}
if (m_DescriptionIsSet)
{
multipart->add(ModelBase::toHttpContent(
namePrefix + utility::conversions::to_string_t(_XPLATSTR("description")), m_Description));
}
if (m_Image_urlIsSet)
{
multipart->add(ModelBase::toHttpContent(
namePrefix + utility::conversions::to_string_t(_XPLATSTR("image_url")), m_Image_url));
}
if (m_PricesIsSet)
{
multipart->add(ModelBase::toHttpContent(
namePrefix + utility::conversions::to_string_t(_XPLATSTR("prices")), m_Prices));
}
if (m_CreatedIsSet)
{
multipart->add(ModelBase::toHttpContent(
namePrefix + utility::conversions::to_string_t(_XPLATSTR("created")), m_Created));
}
if (m_UpdatedIsSet)
{
multipart->add(ModelBase::toHttpContent(
namePrefix + utility::conversions::to_string_t(_XPLATSTR("updated")), m_Updated));
}
}
bool Subscription::fromMultiPart(std::shared_ptr<MultipartFormData> 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(_XPLATSTR(".")))
{
namePrefix += utility::conversions::to_string_t(_XPLATSTR("."));
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("id"))))
{
utility::string_t refVal_setId;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("id"))), refVal_setId);
setId(refVal_setId);
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("name"))))
{
utility::string_t refVal_setName;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("name"))), refVal_setName);
setName(refVal_setName);
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("description"))))
{
utility::string_t refVal_setDescription;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("description"))),
refVal_setDescription);
setDescription(refVal_setDescription);
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("image_url"))))
{
utility::string_t refVal_setImageUrl;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("image_url"))),
refVal_setImageUrl);
setImageUrl(refVal_setImageUrl);
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("prices"))))
{
std::map<utility::string_t, double> refVal_setPrices;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("prices"))), refVal_setPrices);
setPrices(refVal_setPrices);
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("created"))))
{
utility::datetime refVal_setCreated;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("created"))), refVal_setCreated);
setCreated(refVal_setCreated);
}
if (multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("updated"))))
{
utility::datetime refVal_setUpdated;
ok &= ModelBase::fromHttpContent(
multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("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<utility::string_t, double> Subscription::getPrices() const
{
return m_Prices;
}
void Subscription::setPrices(std::map<utility::string_t, double> 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;
}
}
}