![JAR search and dependency download from the Maven repository](/logo.png)
cpp-pistache-server.api-header.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
{{#operations}}/*
* {{classname}}.h
*
* {{description}}
*/
#ifndef {{classname}}_H_
#define {{classname}}_H_
{{{defaultInclude}}}
#include "ApiBase.h"
#include
#include
#include
{{^hasModelImport}}#include {{/hasModelImport}}
#include
#include
{{#imports}}{{{import}}}
{{/imports}}
namespace {{apiNamespace}}
{
class {{declspec}} {{classname}} : public ApiBase {
public:
explicit {{classname}}(const std::shared_ptr& rtr);
~{{classname}}() override = default;
void init() override;
static const std::string base;
private:
void setupRoutes();
{{#operation}}
void {{operationIdSnakeCase}}_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
{{/operation}}
void {{classnameSnakeLowerCase}}_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
///
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
/// May be overridden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
///
virtual std::pair handleParsingException(const std::exception& ex) const noexcept;
///
/// Helper function to handle unexpected Exceptions during processing of the request in handler functions.
/// May be overridden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
///
virtual std::pair handleOperationException(const std::exception& ex) const noexcept;
{{#operation}}
///
/// {{summary}}
///
///
/// {{notes}}
///
{{#vendorExtensions.x-codegen-pistache-is-parsing-supported}}
{{#allParams}}
/// {{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
{{/allParams}}
virtual void {{operationIdSnakeCase}}({{#allParams}}const {{#isModel}}{{modelNamespace}}::{{/isModel}}{{{dataType}}} &{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Pistache::Http::ResponseWriter &response) = 0;
{{/vendorExtensions.x-codegen-pistache-is-parsing-supported}}
{{^vendorExtensions.x-codegen-pistache-is-parsing-supported}}
virtual void {{operationIdSnakeCase}}(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
{{/vendorExtensions.x-codegen-pistache-is-parsing-supported}}
{{/operation}}
};
} // namespace {{apiNamespace}}
#endif /* {{classname}}_H_ */
{{/operations}}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy