forked from loafle/openapi-generator-original
[C++][Pistache] Fix optional error and wrong function signatures (#264)
* Added missing includes for optional * Removed shared pointer from pistache generator * Changed Net namespace to Pistache Namespace * Clean up code and removed unnecessary lines in mustache files * Removed remaining shared pointer syntax * Code review fixes + updated samples * Added const to all model setter functions, and reference to all params in setters that are not primitives * Refactored modelbase * Removed const * Updated samples
This commit is contained in:
parent
825e4e99e3
commit
23ab5177b3
@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.0.1-SNAPSHOT
|
@ -219,14 +219,14 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
|||||||
|
|
||||||
//TODO: This changes the info about the real type but it is needed to parse the header params
|
//TODO: This changes the info about the real type but it is needed to parse the header params
|
||||||
if (param.isHeaderParam) {
|
if (param.isHeaderParam) {
|
||||||
param.dataType = "Optional<Net::Http::Header::Raw>";
|
param.dataType = "Pistache::Optional<Pistache::Http::Header::Raw>";
|
||||||
param.baseType = "Optional<Net::Http::Header::Raw>";
|
param.baseType = "Pistache::Optional<Pistache::Http::Header::Raw>";
|
||||||
} else if (param.isQueryParam) {
|
} else if (param.isQueryParam) {
|
||||||
if (param.isPrimitiveType) {
|
if (param.isPrimitiveType) {
|
||||||
param.dataType = "Optional<" + param.dataType + ">";
|
param.dataType = "Pistache::Optional<" + param.dataType + ">";
|
||||||
} else {
|
} else {
|
||||||
param.dataType = "Optional<" + param.baseType + ">";
|
param.dataType = "Pistache::Optional<" + param.baseType + ">";
|
||||||
param.baseType = "Optional<" + param.baseType + ">";
|
param.baseType = "Pistache::Optional<" + param.baseType + ">";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
|||||||
return toModelName(openAPIType);
|
return toModelName(openAPIType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "std::shared_ptr<" + openAPIType + ">";
|
return openAPIType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -326,30 +326,14 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
|||||||
} else if (ModelUtils.isArraySchema(p)) {
|
} else if (ModelUtils.isArraySchema(p)) {
|
||||||
ArraySchema ap = (ArraySchema) p;
|
ArraySchema ap = (ArraySchema) p;
|
||||||
String inner = getSchemaType(ap.getItems());
|
String inner = getSchemaType(ap.getItems());
|
||||||
if (!languageSpecificPrimitives.contains(inner)) {
|
|
||||||
inner = "std::shared_ptr<" + inner + ">";
|
|
||||||
}
|
|
||||||
return "std::vector<" + inner + ">()";
|
return "std::vector<" + inner + ">()";
|
||||||
} else if (!StringUtils.isEmpty(p.get$ref())) { // model
|
} else if (!StringUtils.isEmpty(p.get$ref())) { // model
|
||||||
return "new " + toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()";
|
return toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()";
|
||||||
} else if (ModelUtils.isStringSchema(p)) {
|
} else if (ModelUtils.isStringSchema(p)) {
|
||||||
return "\"\"";
|
return "\"\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "nullptr";
|
return "";
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postProcessParameter(CodegenParameter parameter) {
|
|
||||||
super.postProcessParameter(parameter);
|
|
||||||
|
|
||||||
boolean isPrimitiveType = parameter.isPrimitiveType == Boolean.TRUE;
|
|
||||||
boolean isListContainer = parameter.isListContainer == Boolean.TRUE;
|
|
||||||
boolean isString = parameter.isString == Boolean.TRUE;
|
|
||||||
|
|
||||||
if (!isPrimitiveType && !isListContainer && !isString && !parameter.dataType.startsWith("std::shared_ptr")) {
|
|
||||||
parameter.dataType = "std::shared_ptr<" + parameter.dataType + ">";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include <pistache/router.h>
|
#include <pistache/router.h>
|
||||||
#include <pistache/http_headers.h>
|
#include <pistache/http_headers.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
{{#imports}}{{{import}}}
|
{{#imports}}{{{import}}}
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ private:
|
|||||||
{{/operation}}
|
{{/operation}}
|
||||||
void {{classnameSnakeLowerCase}}_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void {{classnameSnakeLowerCase}}_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
|
|
||||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
Pistache::Http::Endpoint httpEndpoint;
|
||||||
Pistache::Rest::Router router;
|
Pistache::Rest::Router router;
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include <{{classname}}.h>
|
#include <{{classname}}.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
{{#imports}}{{{import}}}
|
{{#imports}}{{{import}}}
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
|
@ -10,24 +10,24 @@ namespace {{this}} {
|
|||||||
using namespace {{modelNamespace}};
|
using namespace {{modelNamespace}};
|
||||||
|
|
||||||
{{classname}}::{{classname}}(Pistache::Address addr)
|
{{classname}}::{{classname}}(Pistache::Address addr)
|
||||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
: httpEndpoint(addr)
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
void {{classname}}::init(size_t thr = 2) {
|
void {{classname}}::init(size_t thr = 2) {
|
||||||
auto opts = Pistache::Http::Endpoint::options()
|
auto opts = Pistache::Http::Endpoint::options()
|
||||||
.threads(thr)
|
.threads(thr)
|
||||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||||
httpEndpoint->init(opts);
|
httpEndpoint.init(opts);
|
||||||
setupRoutes();
|
setupRoutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void {{classname}}::start() {
|
void {{classname}}::start() {
|
||||||
httpEndpoint->setHandler(router.handler());
|
httpEndpoint.setHandler(router.handler());
|
||||||
httpEndpoint->serve();
|
httpEndpoint.serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void {{classname}}::shutdown() {
|
void {{classname}}::shutdown() {
|
||||||
httpEndpoint->shutdown();
|
httpEndpoint.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void {{classname}}::setupRoutes() {
|
void {{classname}}::setupRoutes() {
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
{{^isNotContainer}}{{{dataType}}}& {{getter}}();
|
{{^isNotContainer}}{{{dataType}}}& {{getter}}();
|
||||||
{{/isNotContainer}}{{#isNotContainer}}{{{dataType}}} {{getter}}() const;
|
{{/isNotContainer}}{{#isNotContainer}}{{{dataType}}} {{getter}}() const;
|
||||||
void {{setter}}({{{dataType}}} value);
|
void {{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value);
|
||||||
{{/isNotContainer}}{{^required}}bool {{nameInCamelCase}}IsSet() const;
|
{{/isNotContainer}}{{^required}}bool {{nameInCamelCase}}IsSet() const;
|
||||||
void unset{{name}}();
|
void unset{{name}}();
|
||||||
{{/required}}
|
{{/required}}
|
||||||
|
@ -84,7 +84,7 @@ void {{classname}}::fromJson(nlohmann::json& val)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
{{{items.datatype}}} newItem({{{items.defaultValue}}});
|
{{{items.datatype}}} newItem({{{items.defaultValue}}});
|
||||||
newItem->fromJson(item);
|
newItem.fromJson(item);
|
||||||
m_{{name}}.push_back( newItem );
|
m_{{name}}.push_back( newItem );
|
||||||
}
|
}
|
||||||
{{/items.isDateTime}}{{/items.isString}}{{/isPrimitiveType}}
|
{{/items.isDateTime}}{{/items.isString}}{{/isPrimitiveType}}
|
||||||
@ -100,7 +100,7 @@ void {{classname}}::fromJson(nlohmann::json& val)
|
|||||||
{{/isDateTime}}{{^isDateTime}}if(!val["{{baseName}}"].is_null())
|
{{/isDateTime}}{{^isDateTime}}if(!val["{{baseName}}"].is_null())
|
||||||
{
|
{
|
||||||
{{{dataType}}} newItem({{{defaultValue}}});
|
{{{dataType}}} newItem({{{defaultValue}}});
|
||||||
newItem->fromJson(val["{{baseName}}"]);
|
newItem.fromJson(val["{{baseName}}"]);
|
||||||
{{setter}}( newItem );
|
{{setter}}( newItem );
|
||||||
}
|
}
|
||||||
{{/isDateTime}}{{/isString}}
|
{{/isDateTime}}{{/isString}}
|
||||||
@ -119,7 +119,7 @@ void {{classname}}::fromJson(nlohmann::json& val)
|
|||||||
{
|
{
|
||||||
return m_{{name}};
|
return m_{{name}};
|
||||||
}
|
}
|
||||||
void {{classname}}::{{setter}}({{{dataType}}} value)
|
void {{classname}}::{{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value)
|
||||||
{
|
{
|
||||||
m_{{name}} = value;
|
m_{{name}} = value;
|
||||||
{{^required}}m_{{name}}IsSet = true;{{/required}}
|
{{^required}}m_{{name}}IsSet = true;{{/required}}
|
||||||
|
@ -28,13 +28,13 @@ public:
|
|||||||
virtual nlohmann::json toJson() const = 0;
|
virtual nlohmann::json toJson() const = 0;
|
||||||
virtual void fromJson(nlohmann::json& json) = 0;
|
virtual void fromJson(nlohmann::json& json) = 0;
|
||||||
|
|
||||||
static std::string toJson( const std::string& value );
|
static std::string toJson( std::string const& value );
|
||||||
static std::string toJson( const std::time_t& value );
|
static std::string toJson( std::time_t const& value );
|
||||||
static int32_t toJson( int32_t value );
|
static int32_t toJson( int32_t const value );
|
||||||
static int64_t toJson( int64_t value );
|
static int64_t toJson( int64_t const value );
|
||||||
static double toJson( double value );
|
static double toJson( double const value );
|
||||||
static bool toJson( bool value );
|
static bool toJson( bool const value );
|
||||||
static nlohmann::json toJson( std::shared_ptr<ModelBase> content );
|
static nlohmann::json toJson(ModelBase const& content );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,41 +12,41 @@ ModelBase::~ModelBase()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModelBase::toJson( const std::string& value )
|
std::string ModelBase::toJson( std::string const& value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModelBase::toJson( const std::time_t& value )
|
std::string ModelBase::toJson( std::time_t const& value )
|
||||||
{
|
{
|
||||||
char buf[sizeof "2011-10-08T07:07:09Z"];
|
char buf[sizeof "2011-10-08T07:07:09Z"];
|
||||||
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&value));
|
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&value));
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModelBase::toJson( int32_t value )
|
int32_t ModelBase::toJson( int32_t const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t ModelBase::toJson( int64_t value )
|
int64_t ModelBase::toJson( int64_t const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
double ModelBase::toJson( double value )
|
double ModelBase::toJson( double const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelBase::toJson( bool value )
|
bool ModelBase::toJson( bool const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json ModelBase::toJson( std::shared_ptr<ModelBase> content )
|
nlohmann::json ModelBase::toJson(ModelBase content )
|
||||||
{
|
{
|
||||||
return content.get() ? content->toJson() : nlohmann::json();
|
return content.toJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#modelNamespaceDeclarations}}
|
{{#modelNamespaceDeclarations}}
|
||||||
|
@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.0.2-SNAPSHOT
|
@ -20,24 +20,24 @@ namespace api {
|
|||||||
using namespace org::openapitools::server::model;
|
using namespace org::openapitools::server::model;
|
||||||
|
|
||||||
PetApi::PetApi(Pistache::Address addr)
|
PetApi::PetApi(Pistache::Address addr)
|
||||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
: httpEndpoint(addr)
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
void PetApi::init(size_t thr = 2) {
|
void PetApi::init(size_t thr = 2) {
|
||||||
auto opts = Pistache::Http::Endpoint::options()
|
auto opts = Pistache::Http::Endpoint::options()
|
||||||
.threads(thr)
|
.threads(thr)
|
||||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||||
httpEndpoint->init(opts);
|
httpEndpoint.init(opts);
|
||||||
setupRoutes();
|
setupRoutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PetApi::start() {
|
void PetApi::start() {
|
||||||
httpEndpoint->setHandler(router.handler());
|
httpEndpoint.setHandler(router.handler());
|
||||||
httpEndpoint->serve();
|
httpEndpoint.serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PetApi::shutdown() {
|
void PetApi::shutdown() {
|
||||||
httpEndpoint->shutdown();
|
httpEndpoint.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PetApi::setupRoutes() {
|
void PetApi::setupRoutes() {
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <pistache/router.h>
|
#include <pistache/router.h>
|
||||||
#include <pistache/http_headers.h>
|
#include <pistache/http_headers.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
#include "ApiResponse.h"
|
#include "ApiResponse.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -58,7 +60,7 @@ private:
|
|||||||
void upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
void pet_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void pet_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
|
|
||||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
Pistache::Http::Endpoint httpEndpoint;
|
||||||
Pistache::Rest::Router router;
|
Pistache::Rest::Router router;
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +81,7 @@ private:
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="petId">Pet id to delete</param>
|
/// <param name="petId">Pet id to delete</param>
|
||||||
/// <param name="apiKey"> (optional)</param>
|
/// <param name="apiKey"> (optional)</param>
|
||||||
virtual void delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response) = 0;
|
virtual void delete_pet(const int64_t &petId, const Pistache::Optional<Pistache::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response) = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds Pets by status
|
/// Finds Pets by status
|
||||||
@ -88,7 +90,7 @@ private:
|
|||||||
/// Multiple status values can be provided with comma separated strings
|
/// Multiple status values can be provided with comma separated strings
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="status">Status values that need to be considered for filter</param>
|
/// <param name="status">Status values that need to be considered for filter</param>
|
||||||
virtual void find_pets_by_status(const Optional<std::string> &status, Pistache::Http::ResponseWriter &response) = 0;
|
virtual void find_pets_by_status(const Pistache::Optional<std::string> &status, Pistache::Http::ResponseWriter &response) = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds Pets by tags
|
/// Finds Pets by tags
|
||||||
@ -97,7 +99,7 @@ private:
|
|||||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="tags">Tags to filter by</param>
|
/// <param name="tags">Tags to filter by</param>
|
||||||
virtual void find_pets_by_tags(const Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) = 0;
|
virtual void find_pets_by_tags(const Pistache::Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find pet by ID
|
/// Find pet by ID
|
||||||
|
@ -20,24 +20,24 @@ namespace api {
|
|||||||
using namespace org::openapitools::server::model;
|
using namespace org::openapitools::server::model;
|
||||||
|
|
||||||
StoreApi::StoreApi(Pistache::Address addr)
|
StoreApi::StoreApi(Pistache::Address addr)
|
||||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
: httpEndpoint(addr)
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
void StoreApi::init(size_t thr = 2) {
|
void StoreApi::init(size_t thr = 2) {
|
||||||
auto opts = Pistache::Http::Endpoint::options()
|
auto opts = Pistache::Http::Endpoint::options()
|
||||||
.threads(thr)
|
.threads(thr)
|
||||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||||
httpEndpoint->init(opts);
|
httpEndpoint.init(opts);
|
||||||
setupRoutes();
|
setupRoutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreApi::start() {
|
void StoreApi::start() {
|
||||||
httpEndpoint->setHandler(router.handler());
|
httpEndpoint.setHandler(router.handler());
|
||||||
httpEndpoint->serve();
|
httpEndpoint.serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreApi::shutdown() {
|
void StoreApi::shutdown() {
|
||||||
httpEndpoint->shutdown();
|
httpEndpoint.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreApi::setupRoutes() {
|
void StoreApi::setupRoutes() {
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <pistache/router.h>
|
#include <pistache/router.h>
|
||||||
#include <pistache/http_headers.h>
|
#include <pistache/http_headers.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
#include "Order.h"
|
#include "Order.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -54,7 +56,7 @@ private:
|
|||||||
void place_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void place_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
void store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
|
|
||||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
Pistache::Http::Endpoint httpEndpoint;
|
||||||
Pistache::Rest::Router router;
|
Pistache::Rest::Router router;
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,24 +20,24 @@ namespace api {
|
|||||||
using namespace org::openapitools::server::model;
|
using namespace org::openapitools::server::model;
|
||||||
|
|
||||||
UserApi::UserApi(Pistache::Address addr)
|
UserApi::UserApi(Pistache::Address addr)
|
||||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
: httpEndpoint(addr)
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
void UserApi::init(size_t thr = 2) {
|
void UserApi::init(size_t thr = 2) {
|
||||||
auto opts = Pistache::Http::Endpoint::options()
|
auto opts = Pistache::Http::Endpoint::options()
|
||||||
.threads(thr)
|
.threads(thr)
|
||||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||||
httpEndpoint->init(opts);
|
httpEndpoint.init(opts);
|
||||||
setupRoutes();
|
setupRoutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserApi::start() {
|
void UserApi::start() {
|
||||||
httpEndpoint->setHandler(router.handler());
|
httpEndpoint.setHandler(router.handler());
|
||||||
httpEndpoint->serve();
|
httpEndpoint.serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserApi::shutdown() {
|
void UserApi::shutdown() {
|
||||||
httpEndpoint->shutdown();
|
httpEndpoint.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserApi::setupRoutes() {
|
void UserApi::setupRoutes() {
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <pistache/router.h>
|
#include <pistache/router.h>
|
||||||
#include <pistache/http_headers.h>
|
#include <pistache/http_headers.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -58,7 +60,7 @@ private:
|
|||||||
void update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
void user_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void user_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
|
|
||||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
Pistache::Http::Endpoint httpEndpoint;
|
||||||
Pistache::Rest::Router router;
|
Pistache::Rest::Router router;
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="user">List of user object</param>
|
/// <param name="user">List of user object</param>
|
||||||
virtual void create_users_with_array_input(const std::vector<std::shared_ptr<User>> &user, Pistache::Http::ResponseWriter &response) = 0;
|
virtual void create_users_with_array_input(const std::vector<User> &user, Pistache::Http::ResponseWriter &response) = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates list of users with given input array
|
/// Creates list of users with given input array
|
||||||
@ -87,7 +89,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="user">List of user object</param>
|
/// <param name="user">List of user object</param>
|
||||||
virtual void create_users_with_list_input(const std::vector<std::shared_ptr<User>> &user, Pistache::Http::ResponseWriter &response) = 0;
|
virtual void create_users_with_list_input(const std::vector<User> &user, Pistache::Http::ResponseWriter &response) = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete user
|
/// Delete user
|
||||||
@ -115,7 +117,7 @@ private:
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="username">The user name for login</param>
|
/// <param name="username">The user name for login</param>
|
||||||
/// <param name="password">The password for login in clear text</param>
|
/// <param name="password">The password for login in clear text</param>
|
||||||
virtual void login_user(const Optional<std::string> &username, const Optional<std::string> &password, Pistache::Http::ResponseWriter &response) = 0;
|
virtual void login_user(const Pistache::Optional<std::string> &username, const Pistache::Optional<std::string> &password, Pistache::Http::ResponseWriter &response) = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs out current logged in user session
|
/// Logs out current logged in user session
|
||||||
|
@ -26,13 +26,13 @@ PetApiImpl::PetApiImpl(Pistache::Address addr)
|
|||||||
void PetApiImpl::add_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response) {
|
void PetApiImpl::add_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void PetApiImpl::delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response) {
|
void PetApiImpl::delete_pet(const int64_t &petId, const Pistache::Optional<Pistache::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void PetApiImpl::find_pets_by_status(const Optional<std::string> &status, Pistache::Http::ResponseWriter &response) {
|
void PetApiImpl::find_pets_by_status(const Pistache::Optional<std::string> &status, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void PetApiImpl::find_pets_by_tags(const Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) {
|
void PetApiImpl::find_pets_by_tags(const Pistache::Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void PetApiImpl::get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) {
|
void PetApiImpl::get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) {
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <PetApi.h>
|
#include <PetApi.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
#include "ApiResponse.h"
|
#include "ApiResponse.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -44,9 +46,9 @@ public:
|
|||||||
~PetApiImpl() { };
|
~PetApiImpl() { };
|
||||||
|
|
||||||
void add_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response);
|
void add_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response);
|
||||||
void delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response);
|
void delete_pet(const int64_t &petId, const Pistache::Optional<Pistache::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response);
|
||||||
void find_pets_by_status(const Optional<std::string> &status, Pistache::Http::ResponseWriter &response);
|
void find_pets_by_status(const Pistache::Optional<std::string> &status, Pistache::Http::ResponseWriter &response);
|
||||||
void find_pets_by_tags(const Optional<std::string> &tags, Pistache::Http::ResponseWriter &response);
|
void find_pets_by_tags(const Pistache::Optional<std::string> &tags, Pistache::Http::ResponseWriter &response);
|
||||||
void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response);
|
void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response);
|
||||||
void update_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response);
|
void update_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response);
|
||||||
void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response);
|
void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response);
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <StoreApi.h>
|
#include <StoreApi.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
#include "Order.h"
|
#include "Order.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -26,10 +26,10 @@ UserApiImpl::UserApiImpl(Pistache::Address addr)
|
|||||||
void UserApiImpl::create_user(const std::shared_ptr<User> &user, Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::create_user(const std::shared_ptr<User> &user, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void UserApiImpl::create_users_with_array_input(const std::vector<std::shared_ptr<User>> &user, Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::create_users_with_array_input(const std::vector<User> &user, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void UserApiImpl::create_users_with_list_input(const std::vector<std::shared_ptr<User>> &user, Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::create_users_with_list_input(const std::vector<User> &user, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void UserApiImpl::delete_user(const std::string &username, Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::delete_user(const std::string &username, Pistache::Http::ResponseWriter &response) {
|
||||||
@ -38,7 +38,7 @@ void UserApiImpl::delete_user(const std::string &username, Pistache::Http::Respo
|
|||||||
void UserApiImpl::get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void UserApiImpl::login_user(const Optional<std::string> &username, const Optional<std::string> &password, Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::login_user(const Pistache::Optional<std::string> &username, const Pistache::Optional<std::string> &password, Pistache::Http::ResponseWriter &response) {
|
||||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||||
}
|
}
|
||||||
void UserApiImpl::logout_user(Pistache::Http::ResponseWriter &response) {
|
void UserApiImpl::logout_user(Pistache::Http::ResponseWriter &response) {
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <UserApi.h>
|
#include <UserApi.h>
|
||||||
|
|
||||||
|
#include <pistache/optional.h>
|
||||||
|
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -44,11 +46,11 @@ public:
|
|||||||
~UserApiImpl() { };
|
~UserApiImpl() { };
|
||||||
|
|
||||||
void create_user(const std::shared_ptr<User> &user, Pistache::Http::ResponseWriter &response);
|
void create_user(const std::shared_ptr<User> &user, Pistache::Http::ResponseWriter &response);
|
||||||
void create_users_with_array_input(const std::vector<std::shared_ptr<User>> &user, Pistache::Http::ResponseWriter &response);
|
void create_users_with_array_input(const std::vector<User> &user, Pistache::Http::ResponseWriter &response);
|
||||||
void create_users_with_list_input(const std::vector<std::shared_ptr<User>> &user, Pistache::Http::ResponseWriter &response);
|
void create_users_with_list_input(const std::vector<User> &user, Pistache::Http::ResponseWriter &response);
|
||||||
void delete_user(const std::string &username, Pistache::Http::ResponseWriter &response);
|
void delete_user(const std::string &username, Pistache::Http::ResponseWriter &response);
|
||||||
void get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response);
|
void get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response);
|
||||||
void login_user(const Optional<std::string> &username, const Optional<std::string> &password, Pistache::Http::ResponseWriter &response);
|
void login_user(const Pistache::Optional<std::string> &username, const Pistache::Optional<std::string> &password, Pistache::Http::ResponseWriter &response);
|
||||||
void logout_user(Pistache::Http::ResponseWriter &response);
|
void logout_user(Pistache::Http::ResponseWriter &response);
|
||||||
void update_user(const std::string &username, const std::shared_ptr<User> &user, Pistache::Http::ResponseWriter &response);
|
void update_user(const std::string &username, const std::shared_ptr<User> &user, Pistache::Http::ResponseWriter &response);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ int32_t ApiResponse::getCode() const
|
|||||||
{
|
{
|
||||||
return m_Code;
|
return m_Code;
|
||||||
}
|
}
|
||||||
void ApiResponse::setCode(int32_t value)
|
void ApiResponse::setCode(int32_t const value)
|
||||||
{
|
{
|
||||||
m_Code = value;
|
m_Code = value;
|
||||||
m_CodeIsSet = true;
|
m_CodeIsSet = true;
|
||||||
@ -100,7 +100,7 @@ std::string ApiResponse::getType() const
|
|||||||
{
|
{
|
||||||
return m_Type;
|
return m_Type;
|
||||||
}
|
}
|
||||||
void ApiResponse::setType(std::string value)
|
void ApiResponse::setType(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Type = value;
|
m_Type = value;
|
||||||
m_TypeIsSet = true;
|
m_TypeIsSet = true;
|
||||||
@ -117,7 +117,7 @@ std::string ApiResponse::getMessage() const
|
|||||||
{
|
{
|
||||||
return m_Message;
|
return m_Message;
|
||||||
}
|
}
|
||||||
void ApiResponse::setMessage(std::string value)
|
void ApiResponse::setMessage(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Message = value;
|
m_Message = value;
|
||||||
m_MessageIsSet = true;
|
m_MessageIsSet = true;
|
||||||
|
@ -53,21 +53,21 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int32_t getCode() const;
|
int32_t getCode() const;
|
||||||
void setCode(int32_t value);
|
void setCode(int32_t const value);
|
||||||
bool codeIsSet() const;
|
bool codeIsSet() const;
|
||||||
void unsetCode();
|
void unsetCode();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getType() const;
|
std::string getType() const;
|
||||||
void setType(std::string value);
|
void setType(std::string const& value);
|
||||||
bool typeIsSet() const;
|
bool typeIsSet() const;
|
||||||
void unsetType();
|
void unsetType();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getMessage() const;
|
std::string getMessage() const;
|
||||||
void setMessage(std::string value);
|
void setMessage(std::string const& value);
|
||||||
bool messageIsSet() const;
|
bool messageIsSet() const;
|
||||||
void unsetMessage();
|
void unsetMessage();
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ int64_t Category::getId() const
|
|||||||
{
|
{
|
||||||
return m_Id;
|
return m_Id;
|
||||||
}
|
}
|
||||||
void Category::setId(int64_t value)
|
void Category::setId(int64_t const value)
|
||||||
{
|
{
|
||||||
m_Id = value;
|
m_Id = value;
|
||||||
m_IdIsSet = true;
|
m_IdIsSet = true;
|
||||||
@ -89,7 +89,7 @@ std::string Category::getName() const
|
|||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
void Category::setName(std::string value)
|
void Category::setName(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Name = value;
|
m_Name = value;
|
||||||
m_NameIsSet = true;
|
m_NameIsSet = true;
|
||||||
|
@ -53,14 +53,14 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int64_t getId() const;
|
int64_t getId() const;
|
||||||
void setId(int64_t value);
|
void setId(int64_t const value);
|
||||||
bool idIsSet() const;
|
bool idIsSet() const;
|
||||||
void unsetId();
|
void unsetId();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
void setName(std::string value);
|
void setName(std::string const& value);
|
||||||
bool nameIsSet() const;
|
bool nameIsSet() const;
|
||||||
void unsetName();
|
void unsetName();
|
||||||
|
|
||||||
|
@ -23,41 +23,41 @@ ModelBase::~ModelBase()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModelBase::toJson( const std::string& value )
|
std::string ModelBase::toJson( std::string const& value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModelBase::toJson( const std::time_t& value )
|
std::string ModelBase::toJson( std::time_t const& value )
|
||||||
{
|
{
|
||||||
char buf[sizeof "2011-10-08T07:07:09Z"];
|
char buf[sizeof "2011-10-08T07:07:09Z"];
|
||||||
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&value));
|
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&value));
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModelBase::toJson( int32_t value )
|
int32_t ModelBase::toJson( int32_t const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t ModelBase::toJson( int64_t value )
|
int64_t ModelBase::toJson( int64_t const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
double ModelBase::toJson( double value )
|
double ModelBase::toJson( double const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelBase::toJson( bool value )
|
bool ModelBase::toJson( bool const value )
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json ModelBase::toJson( std::shared_ptr<ModelBase> content )
|
nlohmann::json ModelBase::toJson(ModelBase content )
|
||||||
{
|
{
|
||||||
return content.get() ? content->toJson() : nlohmann::json();
|
return content.toJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,13 @@ public:
|
|||||||
virtual nlohmann::json toJson() const = 0;
|
virtual nlohmann::json toJson() const = 0;
|
||||||
virtual void fromJson(nlohmann::json& json) = 0;
|
virtual void fromJson(nlohmann::json& json) = 0;
|
||||||
|
|
||||||
static std::string toJson( const std::string& value );
|
static std::string toJson( std::string const& value );
|
||||||
static std::string toJson( const std::time_t& value );
|
static std::string toJson( std::time_t const& value );
|
||||||
static int32_t toJson( int32_t value );
|
static int32_t toJson( int32_t const value );
|
||||||
static int64_t toJson( int64_t value );
|
static int64_t toJson( int64_t const value );
|
||||||
static double toJson( double value );
|
static double toJson( double const value );
|
||||||
static bool toJson( bool value );
|
static bool toJson( bool const value );
|
||||||
static nlohmann::json toJson( std::shared_ptr<ModelBase> content );
|
static nlohmann::json toJson(ModelBase const& content );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ int64_t Order::getId() const
|
|||||||
{
|
{
|
||||||
return m_Id;
|
return m_Id;
|
||||||
}
|
}
|
||||||
void Order::setId(int64_t value)
|
void Order::setId(int64_t const value)
|
||||||
{
|
{
|
||||||
m_Id = value;
|
m_Id = value;
|
||||||
m_IdIsSet = true;
|
m_IdIsSet = true;
|
||||||
@ -130,7 +130,7 @@ int64_t Order::getPetId() const
|
|||||||
{
|
{
|
||||||
return m_PetId;
|
return m_PetId;
|
||||||
}
|
}
|
||||||
void Order::setPetId(int64_t value)
|
void Order::setPetId(int64_t const value)
|
||||||
{
|
{
|
||||||
m_PetId = value;
|
m_PetId = value;
|
||||||
m_PetIdIsSet = true;
|
m_PetIdIsSet = true;
|
||||||
@ -147,7 +147,7 @@ int32_t Order::getQuantity() const
|
|||||||
{
|
{
|
||||||
return m_Quantity;
|
return m_Quantity;
|
||||||
}
|
}
|
||||||
void Order::setQuantity(int32_t value)
|
void Order::setQuantity(int32_t const value)
|
||||||
{
|
{
|
||||||
m_Quantity = value;
|
m_Quantity = value;
|
||||||
m_QuantityIsSet = true;
|
m_QuantityIsSet = true;
|
||||||
@ -164,7 +164,7 @@ std::string Order::getShipDate() const
|
|||||||
{
|
{
|
||||||
return m_ShipDate;
|
return m_ShipDate;
|
||||||
}
|
}
|
||||||
void Order::setShipDate(std::string value)
|
void Order::setShipDate(std::string const& value)
|
||||||
{
|
{
|
||||||
m_ShipDate = value;
|
m_ShipDate = value;
|
||||||
m_ShipDateIsSet = true;
|
m_ShipDateIsSet = true;
|
||||||
@ -181,7 +181,7 @@ std::string Order::getStatus() const
|
|||||||
{
|
{
|
||||||
return m_Status;
|
return m_Status;
|
||||||
}
|
}
|
||||||
void Order::setStatus(std::string value)
|
void Order::setStatus(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Status = value;
|
m_Status = value;
|
||||||
m_StatusIsSet = true;
|
m_StatusIsSet = true;
|
||||||
@ -198,7 +198,7 @@ bool Order::isComplete() const
|
|||||||
{
|
{
|
||||||
return m_Complete;
|
return m_Complete;
|
||||||
}
|
}
|
||||||
void Order::setComplete(bool value)
|
void Order::setComplete(bool const value)
|
||||||
{
|
{
|
||||||
m_Complete = value;
|
m_Complete = value;
|
||||||
m_CompleteIsSet = true;
|
m_CompleteIsSet = true;
|
||||||
|
@ -53,42 +53,42 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int64_t getId() const;
|
int64_t getId() const;
|
||||||
void setId(int64_t value);
|
void setId(int64_t const value);
|
||||||
bool idIsSet() const;
|
bool idIsSet() const;
|
||||||
void unsetId();
|
void unsetId();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int64_t getPetId() const;
|
int64_t getPetId() const;
|
||||||
void setPetId(int64_t value);
|
void setPetId(int64_t const value);
|
||||||
bool petIdIsSet() const;
|
bool petIdIsSet() const;
|
||||||
void unsetPetId();
|
void unsetPetId();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int32_t getQuantity() const;
|
int32_t getQuantity() const;
|
||||||
void setQuantity(int32_t value);
|
void setQuantity(int32_t const value);
|
||||||
bool quantityIsSet() const;
|
bool quantityIsSet() const;
|
||||||
void unsetQuantity();
|
void unsetQuantity();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getShipDate() const;
|
std::string getShipDate() const;
|
||||||
void setShipDate(std::string value);
|
void setShipDate(std::string const& value);
|
||||||
bool shipDateIsSet() const;
|
bool shipDateIsSet() const;
|
||||||
void unsetShipDate();
|
void unsetShipDate();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order Status
|
/// Order Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getStatus() const;
|
std::string getStatus() const;
|
||||||
void setStatus(std::string value);
|
void setStatus(std::string const& value);
|
||||||
bool statusIsSet() const;
|
bool statusIsSet() const;
|
||||||
void unsetStatus();
|
void unsetStatus();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool isComplete() const;
|
bool isComplete() const;
|
||||||
void setComplete(bool value);
|
void setComplete(bool const value);
|
||||||
bool completeIsSet() const;
|
bool completeIsSet() const;
|
||||||
void unsetComplete();
|
void unsetComplete();
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ void Pet::fromJson(nlohmann::json& val)
|
|||||||
{
|
{
|
||||||
if(!val["category"].is_null())
|
if(!val["category"].is_null())
|
||||||
{
|
{
|
||||||
std::shared_ptr<Category> newItem(new Category());
|
Category newItem(Category());
|
||||||
newItem->fromJson(val["category"]);
|
newItem.fromJson(val["category"]);
|
||||||
setCategory( newItem );
|
setCategory( newItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,12 +117,12 @@ void Pet::fromJson(nlohmann::json& val)
|
|||||||
|
|
||||||
if(item.is_null())
|
if(item.is_null())
|
||||||
{
|
{
|
||||||
m_Tags.push_back( std::shared_ptr<Tag>(nullptr) );
|
m_Tags.push_back( Tag(nullptr) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::shared_ptr<Tag> newItem(new Tag());
|
Tag newItem(Tag());
|
||||||
newItem->fromJson(item);
|
newItem.fromJson(item);
|
||||||
m_Tags.push_back( newItem );
|
m_Tags.push_back( newItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ int64_t Pet::getId() const
|
|||||||
{
|
{
|
||||||
return m_Id;
|
return m_Id;
|
||||||
}
|
}
|
||||||
void Pet::setId(int64_t value)
|
void Pet::setId(int64_t const value)
|
||||||
{
|
{
|
||||||
m_Id = value;
|
m_Id = value;
|
||||||
m_IdIsSet = true;
|
m_IdIsSet = true;
|
||||||
@ -155,11 +155,11 @@ void Pet::unsetId()
|
|||||||
{
|
{
|
||||||
m_IdIsSet = false;
|
m_IdIsSet = false;
|
||||||
}
|
}
|
||||||
std::shared_ptr<Category> Pet::getCategory() const
|
Category Pet::getCategory() const
|
||||||
{
|
{
|
||||||
return m_Category;
|
return m_Category;
|
||||||
}
|
}
|
||||||
void Pet::setCategory(std::shared_ptr<Category> value)
|
void Pet::setCategory(Category const& value)
|
||||||
{
|
{
|
||||||
m_Category = value;
|
m_Category = value;
|
||||||
m_CategoryIsSet = true;
|
m_CategoryIsSet = true;
|
||||||
@ -176,7 +176,7 @@ std::string Pet::getName() const
|
|||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
void Pet::setName(std::string value)
|
void Pet::setName(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Name = value;
|
m_Name = value;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ std::vector<std::string>& Pet::getPhotoUrls()
|
|||||||
{
|
{
|
||||||
return m_PhotoUrls;
|
return m_PhotoUrls;
|
||||||
}
|
}
|
||||||
std::vector<std::shared_ptr<Tag>>& Pet::getTags()
|
std::vector<Tag>& Pet::getTags()
|
||||||
{
|
{
|
||||||
return m_Tags;
|
return m_Tags;
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ std::string Pet::getStatus() const
|
|||||||
{
|
{
|
||||||
return m_Status;
|
return m_Status;
|
||||||
}
|
}
|
||||||
void Pet::setStatus(std::string value)
|
void Pet::setStatus(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Status = value;
|
m_Status = value;
|
||||||
m_StatusIsSet = true;
|
m_StatusIsSet = true;
|
||||||
|
@ -56,21 +56,21 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int64_t getId() const;
|
int64_t getId() const;
|
||||||
void setId(int64_t value);
|
void setId(int64_t const value);
|
||||||
bool idIsSet() const;
|
bool idIsSet() const;
|
||||||
void unsetId();
|
void unsetId();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::shared_ptr<Category> getCategory() const;
|
Category getCategory() const;
|
||||||
void setCategory(std::shared_ptr<Category> value);
|
void setCategory(Category const& value);
|
||||||
bool categoryIsSet() const;
|
bool categoryIsSet() const;
|
||||||
void unsetCategory();
|
void unsetCategory();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
void setName(std::string value);
|
void setName(std::string const& value);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -78,27 +78,27 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<std::shared_ptr<Tag>>& getTags();
|
std::vector<Tag>& getTags();
|
||||||
bool tagsIsSet() const;
|
bool tagsIsSet() const;
|
||||||
void unsetTags();
|
void unsetTags();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pet status in the store
|
/// pet status in the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getStatus() const;
|
std::string getStatus() const;
|
||||||
void setStatus(std::string value);
|
void setStatus(std::string const& value);
|
||||||
bool statusIsSet() const;
|
bool statusIsSet() const;
|
||||||
void unsetStatus();
|
void unsetStatus();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int64_t m_Id;
|
int64_t m_Id;
|
||||||
bool m_IdIsSet;
|
bool m_IdIsSet;
|
||||||
std::shared_ptr<Category> m_Category;
|
Category m_Category;
|
||||||
bool m_CategoryIsSet;
|
bool m_CategoryIsSet;
|
||||||
std::string m_Name;
|
std::string m_Name;
|
||||||
|
|
||||||
std::vector<std::string> m_PhotoUrls;
|
std::vector<std::string> m_PhotoUrls;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Tag>> m_Tags;
|
std::vector<Tag> m_Tags;
|
||||||
bool m_TagsIsSet;
|
bool m_TagsIsSet;
|
||||||
std::string m_Status;
|
std::string m_Status;
|
||||||
bool m_StatusIsSet;
|
bool m_StatusIsSet;
|
||||||
|
@ -72,7 +72,7 @@ int64_t Tag::getId() const
|
|||||||
{
|
{
|
||||||
return m_Id;
|
return m_Id;
|
||||||
}
|
}
|
||||||
void Tag::setId(int64_t value)
|
void Tag::setId(int64_t const value)
|
||||||
{
|
{
|
||||||
m_Id = value;
|
m_Id = value;
|
||||||
m_IdIsSet = true;
|
m_IdIsSet = true;
|
||||||
@ -89,7 +89,7 @@ std::string Tag::getName() const
|
|||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
void Tag::setName(std::string value)
|
void Tag::setName(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Name = value;
|
m_Name = value;
|
||||||
m_NameIsSet = true;
|
m_NameIsSet = true;
|
||||||
|
@ -53,14 +53,14 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int64_t getId() const;
|
int64_t getId() const;
|
||||||
void setId(int64_t value);
|
void setId(int64_t const value);
|
||||||
bool idIsSet() const;
|
bool idIsSet() const;
|
||||||
void unsetId();
|
void unsetId();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
void setName(std::string value);
|
void setName(std::string const& value);
|
||||||
bool nameIsSet() const;
|
bool nameIsSet() const;
|
||||||
void unsetName();
|
void unsetName();
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ int64_t User::getId() const
|
|||||||
{
|
{
|
||||||
return m_Id;
|
return m_Id;
|
||||||
}
|
}
|
||||||
void User::setId(int64_t value)
|
void User::setId(int64_t const value)
|
||||||
{
|
{
|
||||||
m_Id = value;
|
m_Id = value;
|
||||||
m_IdIsSet = true;
|
m_IdIsSet = true;
|
||||||
@ -154,7 +154,7 @@ std::string User::getUsername() const
|
|||||||
{
|
{
|
||||||
return m_Username;
|
return m_Username;
|
||||||
}
|
}
|
||||||
void User::setUsername(std::string value)
|
void User::setUsername(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Username = value;
|
m_Username = value;
|
||||||
m_UsernameIsSet = true;
|
m_UsernameIsSet = true;
|
||||||
@ -171,7 +171,7 @@ std::string User::getFirstName() const
|
|||||||
{
|
{
|
||||||
return m_FirstName;
|
return m_FirstName;
|
||||||
}
|
}
|
||||||
void User::setFirstName(std::string value)
|
void User::setFirstName(std::string const& value)
|
||||||
{
|
{
|
||||||
m_FirstName = value;
|
m_FirstName = value;
|
||||||
m_FirstNameIsSet = true;
|
m_FirstNameIsSet = true;
|
||||||
@ -188,7 +188,7 @@ std::string User::getLastName() const
|
|||||||
{
|
{
|
||||||
return m_LastName;
|
return m_LastName;
|
||||||
}
|
}
|
||||||
void User::setLastName(std::string value)
|
void User::setLastName(std::string const& value)
|
||||||
{
|
{
|
||||||
m_LastName = value;
|
m_LastName = value;
|
||||||
m_LastNameIsSet = true;
|
m_LastNameIsSet = true;
|
||||||
@ -205,7 +205,7 @@ std::string User::getEmail() const
|
|||||||
{
|
{
|
||||||
return m_Email;
|
return m_Email;
|
||||||
}
|
}
|
||||||
void User::setEmail(std::string value)
|
void User::setEmail(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Email = value;
|
m_Email = value;
|
||||||
m_EmailIsSet = true;
|
m_EmailIsSet = true;
|
||||||
@ -222,7 +222,7 @@ std::string User::getPassword() const
|
|||||||
{
|
{
|
||||||
return m_Password;
|
return m_Password;
|
||||||
}
|
}
|
||||||
void User::setPassword(std::string value)
|
void User::setPassword(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Password = value;
|
m_Password = value;
|
||||||
m_PasswordIsSet = true;
|
m_PasswordIsSet = true;
|
||||||
@ -239,7 +239,7 @@ std::string User::getPhone() const
|
|||||||
{
|
{
|
||||||
return m_Phone;
|
return m_Phone;
|
||||||
}
|
}
|
||||||
void User::setPhone(std::string value)
|
void User::setPhone(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Phone = value;
|
m_Phone = value;
|
||||||
m_PhoneIsSet = true;
|
m_PhoneIsSet = true;
|
||||||
@ -256,7 +256,7 @@ int32_t User::getUserStatus() const
|
|||||||
{
|
{
|
||||||
return m_UserStatus;
|
return m_UserStatus;
|
||||||
}
|
}
|
||||||
void User::setUserStatus(int32_t value)
|
void User::setUserStatus(int32_t const value)
|
||||||
{
|
{
|
||||||
m_UserStatus = value;
|
m_UserStatus = value;
|
||||||
m_UserStatusIsSet = true;
|
m_UserStatusIsSet = true;
|
||||||
|
@ -53,56 +53,56 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int64_t getId() const;
|
int64_t getId() const;
|
||||||
void setId(int64_t value);
|
void setId(int64_t const value);
|
||||||
bool idIsSet() const;
|
bool idIsSet() const;
|
||||||
void unsetId();
|
void unsetId();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getUsername() const;
|
std::string getUsername() const;
|
||||||
void setUsername(std::string value);
|
void setUsername(std::string const& value);
|
||||||
bool usernameIsSet() const;
|
bool usernameIsSet() const;
|
||||||
void unsetUsername();
|
void unsetUsername();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getFirstName() const;
|
std::string getFirstName() const;
|
||||||
void setFirstName(std::string value);
|
void setFirstName(std::string const& value);
|
||||||
bool firstNameIsSet() const;
|
bool firstNameIsSet() const;
|
||||||
void unsetFirstName();
|
void unsetFirstName();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getLastName() const;
|
std::string getLastName() const;
|
||||||
void setLastName(std::string value);
|
void setLastName(std::string const& value);
|
||||||
bool lastNameIsSet() const;
|
bool lastNameIsSet() const;
|
||||||
void unsetLastName();
|
void unsetLastName();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getEmail() const;
|
std::string getEmail() const;
|
||||||
void setEmail(std::string value);
|
void setEmail(std::string const& value);
|
||||||
bool emailIsSet() const;
|
bool emailIsSet() const;
|
||||||
void unsetEmail();
|
void unsetEmail();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getPassword() const;
|
std::string getPassword() const;
|
||||||
void setPassword(std::string value);
|
void setPassword(std::string const& value);
|
||||||
bool passwordIsSet() const;
|
bool passwordIsSet() const;
|
||||||
void unsetPassword();
|
void unsetPassword();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string getPhone() const;
|
std::string getPhone() const;
|
||||||
void setPhone(std::string value);
|
void setPhone(std::string const& value);
|
||||||
bool phoneIsSet() const;
|
bool phoneIsSet() const;
|
||||||
void unsetPhone();
|
void unsetPhone();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User Status
|
/// User Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int32_t getUserStatus() const;
|
int32_t getUserStatus() const;
|
||||||
void setUserStatus(int32_t value);
|
void setUserStatus(int32_t const value);
|
||||||
bool userStatusIsSet() const;
|
bool userStatusIsSet() const;
|
||||||
void unsetUserStatus();
|
void unsetUserStatus();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user