mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-15 11:04:19 +00:00
267 lines
7.3 KiB
C++
267 lines
7.3 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/LoginResponse.h"
|
|
|
|
namespace tribufu {
|
|
namespace models {
|
|
|
|
LoginResponse::LoginResponse()
|
|
{
|
|
m_UserIsSet = false;
|
|
m_Access_token = utility::conversions::to_string_t("");
|
|
m_Access_tokenIsSet = false;
|
|
m_Refresh_token = utility::conversions::to_string_t("");
|
|
m_Refresh_tokenIsSet = false;
|
|
m_Expires_in = 0L;
|
|
m_Expires_inIsSet = false;
|
|
}
|
|
|
|
LoginResponse::~LoginResponse()
|
|
{
|
|
}
|
|
|
|
void LoginResponse::validate()
|
|
{
|
|
// TODO: implement validation
|
|
}
|
|
|
|
web::json::value LoginResponse::toJson() const
|
|
{
|
|
web::json::value val = web::json::value::object();
|
|
if(m_UserIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("user"))] = ModelBase::toJson(m_User);
|
|
}
|
|
if(m_Access_tokenIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("access_token"))] = ModelBase::toJson(m_Access_token);
|
|
}
|
|
if(m_Refresh_tokenIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("refresh_token"))] = ModelBase::toJson(m_Refresh_token);
|
|
}
|
|
if(m_Expires_inIsSet)
|
|
{
|
|
|
|
val[utility::conversions::to_string_t(U("expires_in"))] = ModelBase::toJson(m_Expires_in);
|
|
}
|
|
|
|
return val;
|
|
}
|
|
|
|
bool LoginResponse::fromJson(const web::json::value& val)
|
|
{
|
|
bool ok = true;
|
|
if(val.has_field(utility::conversions::to_string_t(U("user"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("user")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
std::shared_ptr<UserInfo> refVal_setUser;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setUser);
|
|
setUser(refVal_setUser);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("access_token"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("access_token")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setAccessToken;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setAccessToken);
|
|
setAccessToken(refVal_setAccessToken);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("refresh_token"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("refresh_token")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
utility::string_t refVal_setRefreshToken;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setRefreshToken);
|
|
setRefreshToken(refVal_setRefreshToken);
|
|
|
|
}
|
|
}
|
|
if(val.has_field(utility::conversions::to_string_t(U("expires_in"))))
|
|
{
|
|
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("expires_in")));
|
|
if(!fieldValue.is_null())
|
|
{
|
|
int64_t refVal_setExpiresIn;
|
|
ok &= ModelBase::fromJson(fieldValue, refVal_setExpiresIn);
|
|
setExpiresIn(refVal_setExpiresIn);
|
|
|
|
}
|
|
}
|
|
return ok;
|
|
}
|
|
|
|
void LoginResponse::toMultipart(std::shared_ptr<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_UserIsSet)
|
|
{
|
|
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("user")), m_User));
|
|
}
|
|
if(m_Access_tokenIsSet)
|
|
{
|
|
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("access_token")), m_Access_token));
|
|
}
|
|
if(m_Refresh_tokenIsSet)
|
|
{
|
|
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("refresh_token")), m_Refresh_token));
|
|
}
|
|
if(m_Expires_inIsSet)
|
|
{
|
|
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("expires_in")), m_Expires_in));
|
|
}
|
|
}
|
|
|
|
bool LoginResponse::fromMultiPart(std::shared_ptr<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("user"))))
|
|
{
|
|
std::shared_ptr<UserInfo> refVal_setUser;
|
|
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("user"))), refVal_setUser );
|
|
setUser(refVal_setUser);
|
|
}
|
|
if(multipart->hasContent(utility::conversions::to_string_t(U("access_token"))))
|
|
{
|
|
utility::string_t refVal_setAccessToken;
|
|
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("access_token"))), refVal_setAccessToken );
|
|
setAccessToken(refVal_setAccessToken);
|
|
}
|
|
if(multipart->hasContent(utility::conversions::to_string_t(U("refresh_token"))))
|
|
{
|
|
utility::string_t refVal_setRefreshToken;
|
|
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("refresh_token"))), refVal_setRefreshToken );
|
|
setRefreshToken(refVal_setRefreshToken);
|
|
}
|
|
if(multipart->hasContent(utility::conversions::to_string_t(U("expires_in"))))
|
|
{
|
|
int64_t refVal_setExpiresIn;
|
|
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("expires_in"))), refVal_setExpiresIn );
|
|
setExpiresIn(refVal_setExpiresIn);
|
|
}
|
|
return ok;
|
|
}
|
|
|
|
|
|
std::shared_ptr<UserInfo> LoginResponse::getUser() const
|
|
{
|
|
return m_User;
|
|
}
|
|
|
|
|
|
void LoginResponse::setUser(const std::shared_ptr<UserInfo>& value)
|
|
{
|
|
m_User = value;
|
|
m_UserIsSet = true;
|
|
}
|
|
|
|
bool LoginResponse::userIsSet() const
|
|
{
|
|
return m_UserIsSet;
|
|
}
|
|
|
|
void LoginResponse::unsetUser()
|
|
{
|
|
m_UserIsSet = false;
|
|
}
|
|
utility::string_t LoginResponse::getAccessToken() const
|
|
{
|
|
return m_Access_token;
|
|
}
|
|
|
|
|
|
void LoginResponse::setAccessToken(const utility::string_t& value)
|
|
{
|
|
m_Access_token = value;
|
|
m_Access_tokenIsSet = true;
|
|
}
|
|
|
|
bool LoginResponse::accessTokenIsSet() const
|
|
{
|
|
return m_Access_tokenIsSet;
|
|
}
|
|
|
|
void LoginResponse::unsetAccess_token()
|
|
{
|
|
m_Access_tokenIsSet = false;
|
|
}
|
|
utility::string_t LoginResponse::getRefreshToken() const
|
|
{
|
|
return m_Refresh_token;
|
|
}
|
|
|
|
|
|
void LoginResponse::setRefreshToken(const utility::string_t& value)
|
|
{
|
|
m_Refresh_token = value;
|
|
m_Refresh_tokenIsSet = true;
|
|
}
|
|
|
|
bool LoginResponse::refreshTokenIsSet() const
|
|
{
|
|
return m_Refresh_tokenIsSet;
|
|
}
|
|
|
|
void LoginResponse::unsetRefresh_token()
|
|
{
|
|
m_Refresh_tokenIsSet = false;
|
|
}
|
|
int64_t LoginResponse::getExpiresIn() const
|
|
{
|
|
return m_Expires_in;
|
|
}
|
|
|
|
void LoginResponse::setExpiresIn(int64_t value)
|
|
{
|
|
m_Expires_in = value;
|
|
m_Expires_inIsSet = true;
|
|
}
|
|
|
|
bool LoginResponse::expiresInIsSet() const
|
|
{
|
|
return m_Expires_inIsSet;
|
|
}
|
|
|
|
void LoginResponse::unsetExpires_in()
|
|
{
|
|
m_Expires_inIsSet = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|