Skip to content

Commit

Permalink
update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed May 3, 2022
1 parent af60ec7 commit 1e48c95
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,29 @@ bool ApiResponse::fromJson(const web::json::value& val)
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code")));
if(!fieldValue.is_null())
{
int32_t refVal_code;
ok &= ModelBase::fromJson(fieldValue, refVal_code);
setCode(refVal_code);
int32_t refVal_setCode;
ok &= ModelBase::fromJson(fieldValue, refVal_setCode);
setCode(refVal_setCode);
}
}
if(val.has_field(utility::conversions::to_string_t(U("type"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type")));
if(!fieldValue.is_null())
{
utility::string_t refVal_type;
ok &= ModelBase::fromJson(fieldValue, refVal_type);
setType(refVal_type);
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"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("message")));
if(!fieldValue.is_null())
{
utility::string_t refVal_message;
ok &= ModelBase::fromJson(fieldValue, refVal_message);
setMessage(refVal_message);
utility::string_t refVal_setMessage;
ok &= ModelBase::fromJson(fieldValue, refVal_setMessage);
setMessage(refVal_setMessage);
}
}
return ok;
Expand Down Expand Up @@ -129,21 +129,21 @@ bool ApiResponse::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, co

if(multipart->hasContent(utility::conversions::to_string_t(U("code"))))
{
int32_t refVal_code;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code"))), refVal_code );
setCode(refVal_code);
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_type;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_type );
setType(refVal_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_message;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("message"))), refVal_message );
setMessage(refVal_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;
}
Expand Down
24 changes: 12 additions & 12 deletions samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ bool Category::fromJson(const web::json::value& val)
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
if(!fieldValue.is_null())
{
int64_t refVal_id;
ok &= ModelBase::fromJson(fieldValue, refVal_id);
setId(refVal_id);
int64_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_name;
ok &= ModelBase::fromJson(fieldValue, refVal_name);
setName(refVal_name);
utility::string_t refVal_setName;
ok &= ModelBase::fromJson(fieldValue, refVal_setName);
setName(refVal_setName);
}
}
return ok;
Expand Down Expand Up @@ -109,15 +109,15 @@ bool Category::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const

if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
{
int64_t refVal_id;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
setId(refVal_id);
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_name;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name );
setName(refVal_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;
}
Expand Down
72 changes: 36 additions & 36 deletions samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,59 +87,59 @@ bool Order::fromJson(const web::json::value& val)
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
if(!fieldValue.is_null())
{
int64_t refVal_id;
ok &= ModelBase::fromJson(fieldValue, refVal_id);
setId(refVal_id);
int64_t refVal_setId;
ok &= ModelBase::fromJson(fieldValue, refVal_setId);
setId(refVal_setId);
}
}
if(val.has_field(utility::conversions::to_string_t(U("petId"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("petId")));
if(!fieldValue.is_null())
{
int64_t refVal_petId;
ok &= ModelBase::fromJson(fieldValue, refVal_petId);
setPetId(refVal_petId);
int64_t refVal_setPetId;
ok &= ModelBase::fromJson(fieldValue, refVal_setPetId);
setPetId(refVal_setPetId);
}
}
if(val.has_field(utility::conversions::to_string_t(U("quantity"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("quantity")));
if(!fieldValue.is_null())
{
int32_t refVal_quantity;
ok &= ModelBase::fromJson(fieldValue, refVal_quantity);
setQuantity(refVal_quantity);
int32_t refVal_setQuantity;
ok &= ModelBase::fromJson(fieldValue, refVal_setQuantity);
setQuantity(refVal_setQuantity);
}
}
if(val.has_field(utility::conversions::to_string_t(U("shipDate"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("shipDate")));
if(!fieldValue.is_null())
{
utility::datetime refVal_shipDate;
ok &= ModelBase::fromJson(fieldValue, refVal_shipDate);
setShipDate(refVal_shipDate);
utility::datetime refVal_setShipDate;
ok &= ModelBase::fromJson(fieldValue, refVal_setShipDate);
setShipDate(refVal_setShipDate);
}
}
if(val.has_field(utility::conversions::to_string_t(U("status"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status")));
if(!fieldValue.is_null())
{
utility::string_t refVal_status;
ok &= ModelBase::fromJson(fieldValue, refVal_status);
setStatus(refVal_status);
utility::string_t refVal_setStatus;
ok &= ModelBase::fromJson(fieldValue, refVal_setStatus);
setStatus(refVal_setStatus);
}
}
if(val.has_field(utility::conversions::to_string_t(U("complete"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("complete")));
if(!fieldValue.is_null())
{
bool refVal_complete;
ok &= ModelBase::fromJson(fieldValue, refVal_complete);
setComplete(refVal_complete);
bool refVal_setComplete;
ok &= ModelBase::fromJson(fieldValue, refVal_setComplete);
setComplete(refVal_setComplete);
}
}
return ok;
Expand Down Expand Up @@ -189,39 +189,39 @@ bool Order::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const ut

if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
{
int64_t refVal_id;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
setId(refVal_id);
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_petId;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("petId"))), refVal_petId );
setPetId(refVal_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_quantity;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("quantity"))), refVal_quantity );
setQuantity(refVal_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_shipDate;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("shipDate"))), refVal_shipDate );
setShipDate(refVal_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_status;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_status );
setStatus(refVal_status);
utility::string_t refVal_setStatus;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus );
setStatus(refVal_setStatus);
}
if(multipart->hasContent(utility::conversions::to_string_t(U("complete"))))
{
bool refVal_complete;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_complete );
setComplete(refVal_complete);
bool refVal_setComplete;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_setComplete );
setComplete(refVal_setComplete);
}
return ok;
}
Expand Down
72 changes: 36 additions & 36 deletions samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,59 +84,59 @@ bool Pet::fromJson(const web::json::value& val)
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
if(!fieldValue.is_null())
{
int64_t refVal_id;
ok &= ModelBase::fromJson(fieldValue, refVal_id);
setId(refVal_id);
int64_t refVal_setId;
ok &= ModelBase::fromJson(fieldValue, refVal_setId);
setId(refVal_setId);
}
}
if(val.has_field(utility::conversions::to_string_t(U("category"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("category")));
if(!fieldValue.is_null())
{
std::shared_ptr<Category> refVal_category;
ok &= ModelBase::fromJson(fieldValue, refVal_category);
setCategory(refVal_category);
std::shared_ptr<Category> refVal_setCategory;
ok &= ModelBase::fromJson(fieldValue, refVal_setCategory);
setCategory(refVal_setCategory);
}
}
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_name;
ok &= ModelBase::fromJson(fieldValue, refVal_name);
setName(refVal_name);
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"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photoUrls")));
if(!fieldValue.is_null())
{
std::vector<utility::string_t> refVal_photoUrls;
ok &= ModelBase::fromJson(fieldValue, refVal_photoUrls);
setPhotoUrls(refVal_photoUrls);
std::vector<utility::string_t> refVal_setPhotoUrls;
ok &= ModelBase::fromJson(fieldValue, refVal_setPhotoUrls);
setPhotoUrls(refVal_setPhotoUrls);
}
}
if(val.has_field(utility::conversions::to_string_t(U("tags"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tags")));
if(!fieldValue.is_null())
{
std::vector<std::shared_ptr<Tag>> refVal_tags;
ok &= ModelBase::fromJson(fieldValue, refVal_tags);
setTags(refVal_tags);
std::vector<std::shared_ptr<Tag>> refVal_setTags;
ok &= ModelBase::fromJson(fieldValue, refVal_setTags);
setTags(refVal_setTags);
}
}
if(val.has_field(utility::conversions::to_string_t(U("status"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status")));
if(!fieldValue.is_null())
{
utility::string_t refVal_status;
ok &= ModelBase::fromJson(fieldValue, refVal_status);
setStatus(refVal_status);
utility::string_t refVal_setStatus;
ok &= ModelBase::fromJson(fieldValue, refVal_setStatus);
setStatus(refVal_setStatus);
}
}
return ok;
Expand Down Expand Up @@ -186,39 +186,39 @@ bool Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util

if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
{
int64_t refVal_id;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
setId(refVal_id);
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<Category> refVal_category;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("category"))), refVal_category );
setCategory(refVal_category);
std::shared_ptr<Category> 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_name;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name );
setName(refVal_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<utility::string_t> refVal_photoUrls;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photoUrls"))), refVal_photoUrls );
setPhotoUrls(refVal_photoUrls);
std::vector<utility::string_t> 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<std::shared_ptr<Tag>> refVal_tags;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_tags );
setTags(refVal_tags);
std::vector<std::shared_ptr<Tag>> 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_status;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_status );
setStatus(refVal_status);
utility::string_t refVal_setStatus;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus );
setStatus(refVal_setStatus);
}
return ok;
}
Expand Down
Loading

0 comments on commit 1e48c95

Please sign in to comment.