mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-15 11:04:19 +00:00
659 lines
18 KiB
C++
659 lines
18 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.12.0.
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
|
|
#include "tribufu++/model/Package.h"
|
|
|
|
namespace tribufu {
|
|
namespace models {
|
|
|
|
Package::Package()
|
|
{
|
|
m_Id = utility::conversions::to_string_t("");
|
|
m_IdIsSet = false;
|
|
m_Name = utility::conversions::to_string_t("");
|
|
m_NameIsSet = false;
|
|
m_Description = utility::conversions::to_string_t("");
|
|
m_DescriptionIsSet = false;
|
|
m_Image_url = utility::conversions::to_string_t("");
|
|
m_Image_urlIsSet = false;
|
|
m_Author_id = utility::conversions::to_string_t("");
|
|
m_Author_idIsSet = false;
|
|
m_Version = utility::conversions::to_string_t("");
|
|
m_VersionIsSet = false;
|
|
m_File_url = utility::conversions::to_string_t("");
|
|
m_File_urlIsSet = false;
|
|
m_Raw_size = 0.0;
|
|
m_Raw_sizeIsSet = false;
|
|
m_Download_count = 0;
|
|
m_Download_countIsSet = false;
|
|
m_Last_download = utility::datetime();
|
|
m_Last_downloadIsSet = false;
|
|
m_Created = utility::datetime();
|
|
m_CreatedIsSet = false;
|
|
m_Updated = utility::datetime();
|
|
m_UpdatedIsSet = false;
|
|
}
|
|
|
|
Package::~Package()
|
|
{
|
|
}
|
|
|
|
void Package::validate()
|
|
{
|
|
// TODO: implement validation
|
|
}
|
|
|
|
web::json::value Package::toJson() const
|
|
{
|
|
web::json::value val = web::json::value::object();
|
|
if(m_IdIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id);
|
|
}
|
|
if(m_NameIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name);
|
|
}
|
|
if(m_DescriptionIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("description"))] = ModelBase::toJson(m_Description);
|
|
}
|
|
if(m_Image_urlIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("image_url"))] = ModelBase::toJson(m_Image_url);
|
|
}
|
|
if(m_Author_idIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("author_id"))] = ModelBase::toJson(m_Author_id);
|
|
}
|
|
if(m_VersionIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("version"))] = ModelBase::toJson(m_Version);
|
|
}
|
|
if(m_File_urlIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("file_url"))] = ModelBase::toJson(m_File_url);
|
|
}
|
|
if(m_Raw_sizeIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("raw_size"))] = ModelBase::toJson(m_Raw_size);
|
|
}
|
|
if(m_Download_countIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("download_count"))] = ModelBase::toJson(m_Download_count);
|
|
}
|
|
if(m_Last_downloadIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("last_download"))] = ModelBase::toJson(m_Last_download);
|
|
}
|
|
if(m_CreatedIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("created"))] = ModelBase::toJson(m_Created);
|
|
}
|
|
if(m_UpdatedIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("updated"))] = ModelBase::toJson(m_Updated);
|
|
}
|
|
|
|
return val;
|
|
}
|
|
|
|
bool Package::fromJson(const web::json::value& val)
|
|
{
|
|
bool ok = true;
|
|
if(val.has_field(utility::conversions::to_string_t(U("id"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setId;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setId);
|
|
setId(refVal_setId);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("name"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setName;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setName);
|
|
setName(refVal_setName);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("description"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("description")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setDescription;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setDescription);
|
|
setDescription(refVal_setDescription);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("image_url"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("image_url")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setImageUrl;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setImageUrl);
|
|
setImageUrl(refVal_setImageUrl);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("author_id"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("author_id")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setAuthorId;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setAuthorId);
|
|
setAuthorId(refVal_setAuthorId);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("version"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("version")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setVersion;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setVersion);
|
|
setVersion(refVal_setVersion);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("file_url"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("file_url")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setFileUrl;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setFileUrl);
|
|
setFileUrl(refVal_setFileUrl);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("raw_size"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("raw_size")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
double refVal_setRawSize;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setRawSize);
|
|
setRawSize(refVal_setRawSize);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("download_count"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("download_count")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
int32_t refVal_setDownloadCount;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setDownloadCount);
|
|
setDownloadCount(refVal_setDownloadCount);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("last_download"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("last_download")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::datetime refVal_setLastDownload;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setLastDownload);
|
|
setLastDownload(refVal_setLastDownload);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("created"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("created")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::datetime refVal_setCreated;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setCreated);
|
|
setCreated(refVal_setCreated);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("updated"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("updated")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::datetime refVal_setUpdated;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setUpdated);
|
|
setUpdated(refVal_setUpdated);
|
|
|
|
}
|
|
}
|
|
return ok;
|
|
}
|
|
|
|
void Package::toMultipart(std::shared_ptr<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(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<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(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;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|