mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Pistache server (#6189)
* Added C++ generator for Pistache * Revert of CodegenOperation * Updated template * Removed isRestful from method declaration * Updated httpMethod variable * Changed isRestfulCreate * Updated pistache library name * Update pistache petstore sample with the new library name
This commit is contained in:
parent
927055a681
commit
1eadb4201b
@ -25,7 +25,7 @@ using namespace {{modelNamespace}};
|
||||
|
||||
class {{declspec}} {{classname}} {
|
||||
public:
|
||||
{{classname}}(Net::Address addr);
|
||||
{{classname}}(Pistache::Address addr);
|
||||
virtual ~{{classname}}() {};
|
||||
void init(size_t thr);
|
||||
void start();
|
||||
@ -37,12 +37,12 @@ private:
|
||||
void setupRoutes();
|
||||
|
||||
{{#operation}}
|
||||
void {{operationIdSnakeCase}}_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void {{operationIdSnakeCase}}_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
{{/operation}}
|
||||
void {{classnameSnakeLowerCase}}_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void {{classnameSnakeLowerCase}}_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
|
||||
std::shared_ptr<Net::Http::Endpoint> httpEndpoint;
|
||||
Net::Rest::Router router;
|
||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
||||
Pistache::Rest::Router router;
|
||||
|
||||
{{#operation}}
|
||||
|
||||
@ -56,10 +56,10 @@ private:
|
||||
{{#allParams}}
|
||||
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
|
||||
{{/allParams}}
|
||||
virtual void {{operationIdSnakeCase}}({{#allParams}}const {{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{{baseType}}}{{/isPrimitiveType}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void {{operationIdSnakeCase}}({{#allParams}}const {{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{{baseType}}}{{/isPrimitiveType}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Pistache::Http::ResponseWriter &response) = 0;
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{^vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
virtual void {{operationIdSnakeCase}}(const Net::Rest::Request &request, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void {{operationIdSnakeCase}}(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{/operation}}
|
||||
|
||||
|
@ -28,15 +28,15 @@ using namespace {{modelNamespace}};
|
||||
|
||||
class {{classname}}Impl : public {{apiNamespace}}::{{classname}} {
|
||||
public:
|
||||
{{classname}}Impl(Net::Address addr);
|
||||
{{classname}}Impl(Pistache::Address addr);
|
||||
~{{classname}}Impl() { };
|
||||
|
||||
{{#operation}}
|
||||
{{#vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
void {{operationIdSnakeCase}}({{#allParams}}const {{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{{baseType}}}{{/isPrimitiveType}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Net::Http::ResponseWriter &response);
|
||||
void {{operationIdSnakeCase}}({{#allParams}}const {{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{{baseType}}}{{/isPrimitiveType}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Pistache::Http::ResponseWriter &response);
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{^vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
void {{operationIdSnakeCase}}(const Net::Rest::Request &request, Net::Http::ResponseWriter &response);
|
||||
void {{operationIdSnakeCase}}(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response);
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{/operation}}
|
||||
|
||||
|
@ -9,19 +9,19 @@ namespace {{this}} {
|
||||
|
||||
using namespace {{modelNamespace}};
|
||||
|
||||
{{classname}}Impl::{{classname}}Impl(Net::Address addr)
|
||||
{{classname}}Impl::{{classname}}Impl(Pistache::Address addr)
|
||||
: {{classname}}(addr)
|
||||
{ }
|
||||
|
||||
{{#operation}}
|
||||
{{#vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
void {{classname}}Impl::{{operationIdSnakeCase}}({{#allParams}}const {{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{{baseType}}}{{/isPrimitiveType}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void {{classname}}Impl::{{operationIdSnakeCase}}({{#allParams}}const {{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{{baseType}}}{{/isPrimitiveType}} &{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{^vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
void {{classname}}Impl::{{operationIdSnakeCase}}(const Net::Rest::Request &request, Net::Http::ResponseWriter &response){
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void {{classname}}Impl::{{operationIdSnakeCase}}(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{/operation}}
|
||||
|
@ -9,14 +9,14 @@ namespace {{this}} {
|
||||
|
||||
using namespace {{modelNamespace}};
|
||||
|
||||
{{classname}}::{{classname}}(Net::Address addr)
|
||||
: httpEndpoint(std::make_shared<Net::Http::Endpoint>(addr))
|
||||
{{classname}}::{{classname}}(Pistache::Address addr)
|
||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
||||
{ };
|
||||
|
||||
void {{classname}}::init(size_t thr = 2) {
|
||||
auto opts = Net::Http::Endpoint::options()
|
||||
auto opts = Pistache::Http::Endpoint::options()
|
||||
.threads(thr)
|
||||
.flags(Net::Tcp::Options::InstallSignalHandler);
|
||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||
httpEndpoint->init(opts);
|
||||
setupRoutes();
|
||||
}
|
||||
@ -31,7 +31,7 @@ void {{classname}}::shutdown() {
|
||||
}
|
||||
|
||||
void {{classname}}::setupRoutes() {
|
||||
using namespace Net::Rest;
|
||||
using namespace Pistache::Rest;
|
||||
|
||||
{{#operation}}
|
||||
Routes::{{httpMethod}}(router, base + "{{{vendorExtensions.x-codegen-pistache-path}}}", Routes::bind(&{{classname}}::{{operationIdSnakeCase}}_handler, this));
|
||||
@ -42,7 +42,7 @@ void {{classname}}::setupRoutes() {
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
void {{classname}}::{{operationIdSnakeCase}}_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void {{classname}}::{{operationIdSnakeCase}}_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
{{#vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
{{#hasPathParams}}
|
||||
// Getting the path params
|
||||
@ -90,15 +90,15 @@ void {{classname}}::{{operationIdSnakeCase}}_handler(const Net::Rest::Request &r
|
||||
{{/vendorExtensions.x-codegen-pistache-isParsingSupported}}
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
{{/operation}}
|
||||
|
||||
void {{classname}}::{{classnameSnakeLowerCase}}_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
response.send(Net::Http::Code::Not_Found, "The requested method does not exist");
|
||||
void {{classname}}::{{classnameSnakeLowerCase}}_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
|
||||
}
|
||||
|
||||
{{#apiNamespaceDeclarations}}
|
||||
|
@ -41,7 +41,7 @@ ${<%classnameSnakeUpperCase%>_SERVER_SOURCES})
|
||||
|
||||
<%#apiInfo.apis%>
|
||||
<%#operations%>
|
||||
target_link_libraries(<%classnameSnakeLowerCase%>_server net)
|
||||
target_link_libraries(<%classnameSnakeLowerCase%>_server pistache pthread)
|
||||
<%/operations%>
|
||||
<%/apiInfo.apis%>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace {{apiNamespace}};
|
||||
|
||||
int main() {
|
||||
Net::Address addr(Net::Ipv4::any(), Net::Port(8080));
|
||||
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
|
||||
|
||||
{{classname}}Impl server(addr);
|
||||
server.init(2);
|
||||
|
@ -1 +1 @@
|
||||
2.2.3-SNAPSHOT
|
||||
2.3.0-SNAPSHOT
|
@ -50,7 +50,7 @@ ${STORE_API_SERVER_SOURCES})
|
||||
add_executable(user_api_server
|
||||
${USER_API_SERVER_SOURCES})
|
||||
|
||||
target_link_libraries(pet_api_server net)
|
||||
target_link_libraries(store_api_server net)
|
||||
target_link_libraries(user_api_server net)
|
||||
target_link_libraries(pet_api_server pistache pthread)
|
||||
target_link_libraries(store_api_server pistache pthread)
|
||||
target_link_libraries(user_api_server pistache pthread)
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
using namespace io::swagger::server::api;
|
||||
|
||||
int main() {
|
||||
Net::Address addr(Net::Ipv4::any(), Net::Port(8080));
|
||||
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
|
||||
|
||||
PetApiImpl server(addr);
|
||||
server.init(2);
|
||||
|
@ -18,7 +18,7 @@
|
||||
using namespace io::swagger::server::api;
|
||||
|
||||
int main() {
|
||||
Net::Address addr(Net::Ipv4::any(), Net::Port(8080));
|
||||
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
|
||||
|
||||
StoreApiImpl server(addr);
|
||||
server.init(2);
|
||||
|
@ -18,7 +18,7 @@
|
||||
using namespace io::swagger::server::api;
|
||||
|
||||
int main() {
|
||||
Net::Address addr(Net::Ipv4::any(), Net::Port(8080));
|
||||
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
|
||||
|
||||
UserApiImpl server(addr);
|
||||
server.init(2);
|
||||
|
@ -19,14 +19,14 @@ namespace api {
|
||||
|
||||
using namespace io::swagger::server::model;
|
||||
|
||||
PetApi::PetApi(Net::Address addr)
|
||||
: httpEndpoint(std::make_shared<Net::Http::Endpoint>(addr))
|
||||
PetApi::PetApi(Pistache::Address addr)
|
||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
||||
{ };
|
||||
|
||||
void PetApi::init(size_t thr = 2) {
|
||||
auto opts = Net::Http::Endpoint::options()
|
||||
auto opts = Pistache::Http::Endpoint::options()
|
||||
.threads(thr)
|
||||
.flags(Net::Tcp::Options::InstallSignalHandler);
|
||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||
httpEndpoint->init(opts);
|
||||
setupRoutes();
|
||||
}
|
||||
@ -41,7 +41,7 @@ void PetApi::shutdown() {
|
||||
}
|
||||
|
||||
void PetApi::setupRoutes() {
|
||||
using namespace Net::Rest;
|
||||
using namespace Pistache::Rest;
|
||||
|
||||
Routes::Post(router, base + "/pet", Routes::bind(&PetApi::add_pet_handler, this));
|
||||
Routes::Delete(router, base + "/pet/:petId", Routes::bind(&PetApi::delete_pet_handler, this));
|
||||
@ -56,7 +56,7 @@ void PetApi::setupRoutes() {
|
||||
router.addCustomHandler(Routes::bind(&PetApi::pet_api_default_handler, this));
|
||||
}
|
||||
|
||||
void PetApi::add_pet_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::add_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the body param
|
||||
Pet body;
|
||||
@ -67,12 +67,12 @@ void PetApi::add_pet_handler(const Net::Rest::Request &request, Net::Http::Respo
|
||||
this->add_pet(body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::delete_pet_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::delete_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto petId = request.param(":petId").as<int64_t>();
|
||||
|
||||
@ -83,12 +83,12 @@ void PetApi::delete_pet_handler(const Net::Rest::Request &request, Net::Http::Re
|
||||
this->delete_pet(petId, apiKey, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::find_pets_by_status_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the query params
|
||||
auto status = request.query().get("status");
|
||||
@ -97,12 +97,12 @@ void PetApi::find_pets_by_status_handler(const Net::Rest::Request &request, Net:
|
||||
this->find_pets_by_status(status, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::find_pets_by_tags_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::find_pets_by_tags_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the query params
|
||||
auto tags = request.query().get("tags");
|
||||
@ -111,12 +111,12 @@ void PetApi::find_pets_by_tags_handler(const Net::Rest::Request &request, Net::H
|
||||
this->find_pets_by_tags(tags, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::get_pet_by_id_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::get_pet_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto petId = request.param(":petId").as<int64_t>();
|
||||
|
||||
@ -124,12 +124,12 @@ void PetApi::get_pet_by_id_handler(const Net::Rest::Request &request, Net::Http:
|
||||
this->get_pet_by_id(petId, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::update_pet_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::update_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the body param
|
||||
Pet body;
|
||||
@ -140,34 +140,34 @@ void PetApi::update_pet_handler(const Net::Rest::Request &request, Net::Http::Re
|
||||
this->update_pet(body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::update_pet_with_form_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::update_pet_with_form_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
try {
|
||||
this->update_pet_with_form(request, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void PetApi::upload_file_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void PetApi::upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
try {
|
||||
this->upload_file(request, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PetApi::pet_api_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
response.send(Net::Http::Code::Not_Found, "The requested method does not exist");
|
||||
void PetApi::pet_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ using namespace io::swagger::server::model;
|
||||
|
||||
class PetApi {
|
||||
public:
|
||||
PetApi(Net::Address addr);
|
||||
PetApi(Pistache::Address addr);
|
||||
virtual ~PetApi() {};
|
||||
void init(size_t thr);
|
||||
void start();
|
||||
@ -48,18 +48,18 @@ public:
|
||||
private:
|
||||
void setupRoutes();
|
||||
|
||||
void add_pet_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void delete_pet_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void find_pets_by_status_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void find_pets_by_tags_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void get_pet_by_id_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void update_pet_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void update_pet_with_form_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void upload_file_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void pet_api_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void add_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void delete_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void find_pets_by_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void find_pets_by_tags_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void get_pet_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void update_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void update_pet_with_form_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);
|
||||
|
||||
std::shared_ptr<Net::Http::Endpoint> httpEndpoint;
|
||||
Net::Rest::Router router;
|
||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
||||
Pistache::Rest::Router router;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -69,7 +69,7 @@ private:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
virtual void add_pet(const Pet &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void add_pet(const Pet &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a pet
|
||||
@ -79,7 +79,7 @@ private:
|
||||
/// </remarks>
|
||||
/// <param name="petId">Pet id to delete</param>
|
||||
/// <param name="apiKey"> (optional)</param>
|
||||
virtual void delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by status
|
||||
@ -88,7 +88,7 @@ private:
|
||||
/// Multiple status values can be provided with comma separated strings
|
||||
/// </remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
virtual void find_pets_by_status(const Optional<std::string> &status, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void find_pets_by_status(const Optional<std::string> &status, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by tags
|
||||
@ -97,7 +97,7 @@ private:
|
||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
/// </remarks>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
virtual void find_pets_by_tags(const Optional<std::string> &tags, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void find_pets_by_tags(const Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Find pet by ID
|
||||
@ -106,7 +106,7 @@ private:
|
||||
/// Returns a single pet
|
||||
/// </remarks>
|
||||
/// <param name="petId">ID of pet to return</param>
|
||||
virtual void get_pet_by_id(const int64_t &petId, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
@ -115,7 +115,7 @@ private:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
virtual void update_pet(const Pet &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void update_pet(const Pet &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a pet in the store with form data
|
||||
@ -123,7 +123,7 @@ private:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
virtual void update_pet_with_form(const Net::Rest::Request &request, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// uploads an image
|
||||
@ -131,7 +131,7 @@ private:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
virtual void upload_file(const Net::Rest::Request &request, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,14 +19,14 @@ namespace api {
|
||||
|
||||
using namespace io::swagger::server::model;
|
||||
|
||||
StoreApi::StoreApi(Net::Address addr)
|
||||
: httpEndpoint(std::make_shared<Net::Http::Endpoint>(addr))
|
||||
StoreApi::StoreApi(Pistache::Address addr)
|
||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
||||
{ };
|
||||
|
||||
void StoreApi::init(size_t thr = 2) {
|
||||
auto opts = Net::Http::Endpoint::options()
|
||||
auto opts = Pistache::Http::Endpoint::options()
|
||||
.threads(thr)
|
||||
.flags(Net::Tcp::Options::InstallSignalHandler);
|
||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||
httpEndpoint->init(opts);
|
||||
setupRoutes();
|
||||
}
|
||||
@ -41,7 +41,7 @@ void StoreApi::shutdown() {
|
||||
}
|
||||
|
||||
void StoreApi::setupRoutes() {
|
||||
using namespace Net::Rest;
|
||||
using namespace Pistache::Rest;
|
||||
|
||||
Routes::Delete(router, base + "/store/order/:orderId", Routes::bind(&StoreApi::delete_order_handler, this));
|
||||
Routes::Get(router, base + "/store/inventory", Routes::bind(&StoreApi::get_inventory_handler, this));
|
||||
@ -52,7 +52,7 @@ void StoreApi::setupRoutes() {
|
||||
router.addCustomHandler(Routes::bind(&StoreApi::store_api_default_handler, this));
|
||||
}
|
||||
|
||||
void StoreApi::delete_order_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void StoreApi::delete_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto orderId = request.param(":orderId").as<std::string>();
|
||||
|
||||
@ -60,23 +60,23 @@ void StoreApi::delete_order_handler(const Net::Rest::Request &request, Net::Http
|
||||
this->delete_order(orderId, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void StoreApi::get_inventory_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void StoreApi::get_inventory_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
try {
|
||||
this->get_inventory(response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void StoreApi::get_order_by_id_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void StoreApi::get_order_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto orderId = request.param(":orderId").as<int64_t>();
|
||||
|
||||
@ -84,12 +84,12 @@ void StoreApi::get_order_by_id_handler(const Net::Rest::Request &request, Net::H
|
||||
this->get_order_by_id(orderId, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void StoreApi::place_order_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void StoreApi::place_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the body param
|
||||
Order body;
|
||||
@ -100,14 +100,14 @@ void StoreApi::place_order_handler(const Net::Rest::Request &request, Net::Http:
|
||||
this->place_order(body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void StoreApi::store_api_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
response.send(Net::Http::Code::Not_Found, "The requested method does not exist");
|
||||
void StoreApi::store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ using namespace io::swagger::server::model;
|
||||
|
||||
class StoreApi {
|
||||
public:
|
||||
StoreApi(Net::Address addr);
|
||||
StoreApi(Pistache::Address addr);
|
||||
virtual ~StoreApi() {};
|
||||
void init(size_t thr);
|
||||
void start();
|
||||
@ -48,14 +48,14 @@ public:
|
||||
private:
|
||||
void setupRoutes();
|
||||
|
||||
void delete_order_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void get_inventory_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void get_order_by_id_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void place_order_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void store_api_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void delete_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void get_inventory_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void get_order_by_id_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);
|
||||
|
||||
std::shared_ptr<Net::Http::Endpoint> httpEndpoint;
|
||||
Net::Rest::Router router;
|
||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
||||
Pistache::Rest::Router router;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -65,7 +65,7 @@ private:
|
||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
/// </remarks>
|
||||
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
||||
virtual void delete_order(const std::string &orderId, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns pet inventories by status
|
||||
@ -73,7 +73,7 @@ private:
|
||||
/// <remarks>
|
||||
/// Returns a map of status codes to quantities
|
||||
/// </remarks>
|
||||
virtual void get_inventory(Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void get_inventory(Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Find purchase order by ID
|
||||
@ -82,7 +82,7 @@ private:
|
||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
/// </remarks>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
virtual void get_order_by_id(const int64_t &orderId, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
@ -91,7 +91,7 @@ private:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
virtual void place_order(const Order &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void place_order(const Order &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,14 +19,14 @@ namespace api {
|
||||
|
||||
using namespace io::swagger::server::model;
|
||||
|
||||
UserApi::UserApi(Net::Address addr)
|
||||
: httpEndpoint(std::make_shared<Net::Http::Endpoint>(addr))
|
||||
UserApi::UserApi(Pistache::Address addr)
|
||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
||||
{ };
|
||||
|
||||
void UserApi::init(size_t thr = 2) {
|
||||
auto opts = Net::Http::Endpoint::options()
|
||||
auto opts = Pistache::Http::Endpoint::options()
|
||||
.threads(thr)
|
||||
.flags(Net::Tcp::Options::InstallSignalHandler);
|
||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||
httpEndpoint->init(opts);
|
||||
setupRoutes();
|
||||
}
|
||||
@ -41,7 +41,7 @@ void UserApi::shutdown() {
|
||||
}
|
||||
|
||||
void UserApi::setupRoutes() {
|
||||
using namespace Net::Rest;
|
||||
using namespace Pistache::Rest;
|
||||
|
||||
Routes::Post(router, base + "/user", Routes::bind(&UserApi::create_user_handler, this));
|
||||
Routes::Post(router, base + "/user/createWithArray", Routes::bind(&UserApi::create_users_with_array_input_handler, this));
|
||||
@ -56,7 +56,7 @@ void UserApi::setupRoutes() {
|
||||
router.addCustomHandler(Routes::bind(&UserApi::user_api_default_handler, this));
|
||||
}
|
||||
|
||||
void UserApi::create_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::create_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the body param
|
||||
User body;
|
||||
@ -67,12 +67,12 @@ void UserApi::create_user_handler(const Net::Rest::Request &request, Net::Http::
|
||||
this->create_user(body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::create_users_with_array_input_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::create_users_with_array_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the body param
|
||||
User body;
|
||||
@ -83,12 +83,12 @@ void UserApi::create_users_with_array_input_handler(const Net::Rest::Request &re
|
||||
this->create_users_with_array_input(body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::create_users_with_list_input_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::create_users_with_list_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the body param
|
||||
User body;
|
||||
@ -99,12 +99,12 @@ void UserApi::create_users_with_list_input_handler(const Net::Rest::Request &req
|
||||
this->create_users_with_list_input(body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::delete_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::delete_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto username = request.param(":username").as<std::string>();
|
||||
|
||||
@ -112,12 +112,12 @@ void UserApi::delete_user_handler(const Net::Rest::Request &request, Net::Http::
|
||||
this->delete_user(username, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::get_user_by_name_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::get_user_by_name_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto username = request.param(":username").as<std::string>();
|
||||
|
||||
@ -125,12 +125,12 @@ void UserApi::get_user_by_name_handler(const Net::Rest::Request &request, Net::H
|
||||
this->get_user_by_name(username, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::login_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
// Getting the query params
|
||||
auto username = request.query().get("username");
|
||||
@ -140,23 +140,23 @@ void UserApi::login_user_handler(const Net::Rest::Request &request, Net::Http::R
|
||||
this->login_user(username, password, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::logout_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::logout_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
|
||||
try {
|
||||
this->logout_user(response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void UserApi::update_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
void UserApi::update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
// Getting the path params
|
||||
auto username = request.param(":username").as<std::string>();
|
||||
|
||||
@ -169,14 +169,14 @@ void UserApi::update_user_handler(const Net::Rest::Request &request, Net::Http::
|
||||
this->update_user(username, body, response);
|
||||
} catch (std::runtime_error & e) {
|
||||
//send a 400 error
|
||||
response.send(Net::Http::Code::Bad_Request, e.what());
|
||||
response.send(Pistache::Http::Code::Bad_Request, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UserApi::user_api_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response) {
|
||||
response.send(Net::Http::Code::Not_Found, "The requested method does not exist");
|
||||
void UserApi::user_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ using namespace io::swagger::server::model;
|
||||
|
||||
class UserApi {
|
||||
public:
|
||||
UserApi(Net::Address addr);
|
||||
UserApi(Pistache::Address addr);
|
||||
virtual ~UserApi() {};
|
||||
void init(size_t thr);
|
||||
void start();
|
||||
@ -48,18 +48,18 @@ public:
|
||||
private:
|
||||
void setupRoutes();
|
||||
|
||||
void create_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void create_users_with_array_input_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void create_users_with_list_input_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void delete_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void get_user_by_name_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void login_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void logout_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void update_user_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void user_api_default_handler(const Net::Rest::Request &request, Net::Http::ResponseWriter response);
|
||||
void create_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void create_users_with_array_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void create_users_with_list_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void delete_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void get_user_by_name_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void login_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||
void logout_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);
|
||||
|
||||
std::shared_ptr<Net::Http::Endpoint> httpEndpoint;
|
||||
Net::Rest::Router router;
|
||||
std::shared_ptr<Pistache::Http::Endpoint> httpEndpoint;
|
||||
Pistache::Rest::Router router;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -69,7 +69,7 @@ private:
|
||||
/// This can only be done by the logged in user.
|
||||
/// </remarks>
|
||||
/// <param name="body">Created user object</param>
|
||||
virtual void create_user(const User &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void create_user(const User &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
@ -78,7 +78,7 @@ private:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">List of user object</param>
|
||||
virtual void create_users_with_array_input(const User &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void create_users_with_array_input(const User &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
@ -87,7 +87,7 @@ private:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="body">List of user object</param>
|
||||
virtual void create_users_with_list_input(const User &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void create_users_with_list_input(const User &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Delete user
|
||||
@ -96,7 +96,7 @@ private:
|
||||
/// This can only be done by the logged in user.
|
||||
/// </remarks>
|
||||
/// <param name="username">The name that needs to be deleted</param>
|
||||
virtual void delete_user(const std::string &username, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void delete_user(const std::string &username, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get user by user name
|
||||
@ -105,7 +105,7 @@ private:
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing. </param>
|
||||
virtual void get_user_by_name(const std::string &username, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Logs user into the system
|
||||
@ -115,7 +115,7 @@ private:
|
||||
/// </remarks>
|
||||
/// <param name="username">The user name for login</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, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void login_user(const Optional<std::string> &username, const Optional<std::string> &password, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Logs out current logged in user session
|
||||
@ -123,7 +123,7 @@ private:
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
virtual void logout_user(Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void logout_user(Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Updated user
|
||||
@ -133,7 +133,7 @@ private:
|
||||
/// </remarks>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
virtual void update_user(const std::string &username, const User &body, Net::Http::ResponseWriter &response) = 0;
|
||||
virtual void update_user(const std::string &username, const User &body, Pistache::Http::ResponseWriter &response) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,33 +19,33 @@ namespace api {
|
||||
|
||||
using namespace io::swagger::server::model;
|
||||
|
||||
PetApiImpl::PetApiImpl(Net::Address addr)
|
||||
PetApiImpl::PetApiImpl(Pistache::Address addr)
|
||||
: PetApi(addr)
|
||||
{ }
|
||||
|
||||
void PetApiImpl::add_pet(const Pet &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::add_pet(const Pet &body, Pistache::Http::ResponseWriter &response) {
|
||||
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, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::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) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void PetApiImpl::find_pets_by_status(const Optional<std::string> &status, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::find_pets_by_status(const Optional<std::string> &status, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void PetApiImpl::find_pets_by_tags(const Optional<std::string> &tags, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::find_pets_by_tags(const Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void PetApiImpl::get_pet_by_id(const int64_t &petId, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void PetApiImpl::update_pet(const Pet &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::update_pet(const Pet &body, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void PetApiImpl::update_pet_with_form(const Net::Rest::Request &request, Net::Http::ResponseWriter &response){
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void PetApiImpl::upload_file(const Net::Rest::Request &request, Net::Http::ResponseWriter &response){
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void PetApiImpl::upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,17 +40,17 @@ using namespace io::swagger::server::model;
|
||||
|
||||
class PetApiImpl : public io::swagger::server::api::PetApi {
|
||||
public:
|
||||
PetApiImpl(Net::Address addr);
|
||||
PetApiImpl(Pistache::Address addr);
|
||||
~PetApiImpl() { };
|
||||
|
||||
void add_pet(const Pet &body, Net::Http::ResponseWriter &response);
|
||||
void delete_pet(const int64_t &petId, const Optional<Net::Http::Header::Raw> &apiKey, Net::Http::ResponseWriter &response);
|
||||
void find_pets_by_status(const Optional<std::string> &status, Net::Http::ResponseWriter &response);
|
||||
void find_pets_by_tags(const Optional<std::string> &tags, Net::Http::ResponseWriter &response);
|
||||
void get_pet_by_id(const int64_t &petId, Net::Http::ResponseWriter &response);
|
||||
void update_pet(const Pet &body, Net::Http::ResponseWriter &response);
|
||||
void update_pet_with_form(const Net::Rest::Request &request, Net::Http::ResponseWriter &response);
|
||||
void upload_file(const Net::Rest::Request &request, Net::Http::ResponseWriter &response);
|
||||
void add_pet(const Pet &body, Pistache::Http::ResponseWriter &response);
|
||||
void delete_pet(const int64_t &petId, const Optional<Net::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_tags(const Optional<std::string> &tags, Pistache::Http::ResponseWriter &response);
|
||||
void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response);
|
||||
void update_pet(const Pet &body, Pistache::Http::ResponseWriter &response);
|
||||
void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response);
|
||||
void upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response);
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,21 +19,21 @@ namespace api {
|
||||
|
||||
using namespace io::swagger::server::model;
|
||||
|
||||
StoreApiImpl::StoreApiImpl(Net::Address addr)
|
||||
StoreApiImpl::StoreApiImpl(Pistache::Address addr)
|
||||
: StoreApi(addr)
|
||||
{ }
|
||||
|
||||
void StoreApiImpl::delete_order(const std::string &orderId, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void StoreApiImpl::delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void StoreApiImpl::get_inventory(Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void StoreApiImpl::get_inventory(Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void StoreApiImpl::get_order_by_id(const int64_t &orderId, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void StoreApiImpl::get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void StoreApiImpl::place_order(const Order &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void StoreApiImpl::place_order(const Order &body, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ using namespace io::swagger::server::model;
|
||||
|
||||
class StoreApiImpl : public io::swagger::server::api::StoreApi {
|
||||
public:
|
||||
StoreApiImpl(Net::Address addr);
|
||||
StoreApiImpl(Pistache::Address addr);
|
||||
~StoreApiImpl() { };
|
||||
|
||||
void delete_order(const std::string &orderId, Net::Http::ResponseWriter &response);
|
||||
void get_inventory(Net::Http::ResponseWriter &response);
|
||||
void get_order_by_id(const int64_t &orderId, Net::Http::ResponseWriter &response);
|
||||
void place_order(const Order &body, Net::Http::ResponseWriter &response);
|
||||
void delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response);
|
||||
void get_inventory(Pistache::Http::ResponseWriter &response);
|
||||
void get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response);
|
||||
void place_order(const Order &body, Pistache::Http::ResponseWriter &response);
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,33 +19,33 @@ namespace api {
|
||||
|
||||
using namespace io::swagger::server::model;
|
||||
|
||||
UserApiImpl::UserApiImpl(Net::Address addr)
|
||||
UserApiImpl::UserApiImpl(Pistache::Address addr)
|
||||
: UserApi(addr)
|
||||
{ }
|
||||
|
||||
void UserApiImpl::create_user(const User &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::create_user(const User &body, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::create_users_with_array_input(const User &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::create_users_with_array_input(const User &body, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::create_users_with_list_input(const User &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::create_users_with_list_input(const User &body, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::delete_user(const std::string &username, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::delete_user(const std::string &username, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::get_user_by_name(const std::string &username, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::login_user(const Optional<std::string> &username, const Optional<std::string> &password, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::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) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::logout_user(Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::logout_user(Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
void UserApiImpl::update_user(const std::string &username, const User &body, Net::Http::ResponseWriter &response) {
|
||||
response.send(Net::Http::Code::Ok, "Do some magic\n");
|
||||
void UserApiImpl::update_user(const std::string &username, const User &body, Pistache::Http::ResponseWriter &response) {
|
||||
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,17 +40,17 @@ using namespace io::swagger::server::model;
|
||||
|
||||
class UserApiImpl : public io::swagger::server::api::UserApi {
|
||||
public:
|
||||
UserApiImpl(Net::Address addr);
|
||||
UserApiImpl(Pistache::Address addr);
|
||||
~UserApiImpl() { };
|
||||
|
||||
void create_user(const User &body, Net::Http::ResponseWriter &response);
|
||||
void create_users_with_array_input(const User &body, Net::Http::ResponseWriter &response);
|
||||
void create_users_with_list_input(const User &body, Net::Http::ResponseWriter &response);
|
||||
void delete_user(const std::string &username, Net::Http::ResponseWriter &response);
|
||||
void get_user_by_name(const std::string &username, Net::Http::ResponseWriter &response);
|
||||
void login_user(const Optional<std::string> &username, const Optional<std::string> &password, Net::Http::ResponseWriter &response);
|
||||
void logout_user(Net::Http::ResponseWriter &response);
|
||||
void update_user(const std::string &username, const User &body, Net::Http::ResponseWriter &response);
|
||||
void create_user(const User &body, Pistache::Http::ResponseWriter &response);
|
||||
void create_users_with_array_input(const User &body, Pistache::Http::ResponseWriter &response);
|
||||
void create_users_with_list_input(const User &body, 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 login_user(const Optional<std::string> &username, const Optional<std::string> &password, Pistache::Http::ResponseWriter &response);
|
||||
void logout_user(Pistache::Http::ResponseWriter &response);
|
||||
void update_user(const std::string &username, const User &body, Pistache::Http::ResponseWriter &response);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user