Files
Jungfraujoch/writer/gen/api/DefaultApi.cpp
Filip Leonarski 33aeb64e4c
All checks were successful
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 7m51s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 7m19s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 7m46s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 8m32s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 8m6s
Build Packages / build:rpm (rocky8) (push) Successful in 8m7s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 7m37s
Build Packages / Generate python client (push) Successful in 17s
Build Packages / Create release (push) Has been skipped
Build Packages / Build documentation (push) Successful in 32s
Build Packages / build:rpm (rocky9) (push) Successful in 9m6s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 6m53s
Build Packages / Unit tests (push) Successful in 1h9m39s
v1.0.0-rc.103 (#8)
This is an UNSTABLE release.

* jfjoch_viewer: Minor improvements to the viewer
* jfjoch_broker: Change behavior for modular detectors: coordinates of 0-th pixel can be now arbitrary and detector will be cropped to the smallest rectangle limited by module coordinates

Reviewed-on: #8
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
2025-11-19 09:40:50 +01:00

138 lines
4.3 KiB
C++

/**
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0-rc.103
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "DefaultApi.h"
#include "Helpers.h"
namespace org::openapitools::server::api
{
using namespace org::openapitools::server::helpers;
using namespace org::openapitools::server::model;
const std::string DefaultApi::base = "";
DefaultApi::DefaultApi(const std::shared_ptr<Pistache::Rest::Router>& rtr)
: ApiBase(rtr)
{
}
void DefaultApi::init() {
setupRoutes();
}
void DefaultApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(*router, base + "/cancel", Routes::bind(&DefaultApi::cancel_post_handler, this));
Routes::Get(*router, base + "/status", Routes::bind(&DefaultApi::status_get_handler, this));
Routes::Get(*router, base + "/version", Routes::bind(&DefaultApi::version_get_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&DefaultApi::default_api_default_handler, this));
}
void DefaultApi::handleParsingException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept
{
std::pair<Pistache::Http::Code, std::string> codeAndError = handleParsingException(ex);
response.send(codeAndError.first, codeAndError.second);
}
std::pair<Pistache::Http::Code, std::string> DefaultApi::handleParsingException(const std::exception& ex) const noexcept
{
try {
throw;
} catch (nlohmann::detail::exception &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (org::openapitools::server::helpers::ValidationException &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (std::exception &e) {
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what());
}
}
void DefaultApi::handleOperationException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept
{
std::pair<Pistache::Http::Code, std::string> codeAndError = handleOperationException(ex);
response.send(codeAndError.first, codeAndError.second);
}
std::pair<Pistache::Http::Code, std::string> DefaultApi::handleOperationException(const std::exception& ex) const noexcept
{
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what());
}
void DefaultApi::cancel_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
try {
try {
this->cancel_post(response);
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
this->handleOperationException(e, response);
return;
}
} catch (std::exception &e) {
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
}
}
void DefaultApi::status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
try {
try {
this->status_get(response);
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
this->handleOperationException(e, response);
return;
}
} catch (std::exception &e) {
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
}
}
void DefaultApi::version_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
try {
try {
this->version_get(response);
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
this->handleOperationException(e, response);
return;
}
} catch (std::exception &e) {
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
}
}
void DefaultApi::default_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
} // namespace org::openapitools::server::api