/** * Jungfraujoch * Jungfraujoch Broker Web API * * The version of the OpenAPI document: 1.0.1 * * * 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& rtr) : router(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 + "/config/detector", Routes::bind(&DefaultApi::config_detector_get_handler, this)); Routes::Put(*router, base + "/config/detector", Routes::bind(&DefaultApi::config_detector_put_handler, this)); Routes::Put(*router, base + "/config/internal_generator_image", Routes::bind(&DefaultApi::config_internal_generator_image_put_handler, this)); Routes::Get(*router, base + "/config/rad_int", Routes::bind(&DefaultApi::config_rad_int_get_handler, this)); Routes::Put(*router, base + "/config/rad_int", Routes::bind(&DefaultApi::config_rad_int_put_handler, this)); Routes::Get(*router, base + "/config/select_detector", Routes::bind(&DefaultApi::config_select_detector_get_handler, this)); Routes::Put(*router, base + "/config/select_detector", Routes::bind(&DefaultApi::config_select_detector_put_handler, this)); Routes::Get(*router, base + "/config/spot_finding", Routes::bind(&DefaultApi::config_spot_finding_get_handler, this)); Routes::Put(*router, base + "/config/spot_finding", Routes::bind(&DefaultApi::config_spot_finding_put_handler, this)); Routes::Post(*router, base + "/deactivate", Routes::bind(&DefaultApi::deactivate_post_handler, this)); Routes::Get(*router, base + "/detector/status", Routes::bind(&DefaultApi::detector_status_get_handler, this)); Routes::Post(*router, base + "/initialize", Routes::bind(&DefaultApi::initialize_post_handler, this)); Routes::Post(*router, base + "/pedestal", Routes::bind(&DefaultApi::pedestal_post_handler, this)); Routes::Post(*router, base + "/plot/bkg_estimate", Routes::bind(&DefaultApi::plot_bkg_estimate_post_handler, this)); Routes::Post(*router, base + "/plot/error_pixel", Routes::bind(&DefaultApi::plot_error_pixel_post_handler, this)); Routes::Post(*router, base + "/plot/image_collection_efficiency", Routes::bind(&DefaultApi::plot_image_collection_efficiency_post_handler, this)); Routes::Get(*router, base + "/plot/indexing_rate_per_file", Routes::bind(&DefaultApi::plot_indexing_rate_per_file_get_handler, this)); Routes::Post(*router, base + "/plot/indexing_rate", Routes::bind(&DefaultApi::plot_indexing_rate_post_handler, this)); Routes::Get(*router, base + "/plot/rad_int", Routes::bind(&DefaultApi::plot_rad_int_get_handler, this)); Routes::Get(*router, base + "/plot/rad_int_per_file", Routes::bind(&DefaultApi::plot_rad_int_per_file_get_handler, this)); Routes::Post(*router, base + "/plot/receiver_delay", Routes::bind(&DefaultApi::plot_receiver_delay_post_handler, this)); Routes::Post(*router, base + "/plot/receiver_free_send_buffers", Routes::bind(&DefaultApi::plot_receiver_free_send_buffers_post_handler, this)); Routes::Get(*router, base + "/plot/resolution_estimate_histogram", Routes::bind(&DefaultApi::plot_resolution_estimate_histogram_get_handler, this)); Routes::Post(*router, base + "/plot/roi_max_count", Routes::bind(&DefaultApi::plot_roi_max_count_post_handler, this)); Routes::Post(*router, base + "/plot/roi_sum", Routes::bind(&DefaultApi::plot_roi_sum_post_handler, this)); Routes::Post(*router, base + "/plot/roi_valid_pixels", Routes::bind(&DefaultApi::plot_roi_valid_pixels_post_handler, this)); Routes::Post(*router, base + "/plot/spot_count", Routes::bind(&DefaultApi::plot_spot_count_post_handler, this)); Routes::Post(*router, base + "/plot/strong_pixel", Routes::bind(&DefaultApi::plot_strong_pixel_post_handler, this)); Routes::Get(*router, base + "/preview/calibration.tiff", Routes::bind(&DefaultApi::preview_calibration_tiff_get_handler, this)); Routes::Get(*router, base + "/preview/image.jpeg", Routes::bind(&DefaultApi::preview_image_jpeg_get_handler, this)); Routes::Post(*router, base + "/preview/image.jpeg", Routes::bind(&DefaultApi::preview_image_jpeg_post_handler, this)); Routes::Get(*router, base + "/preview/image.tiff", Routes::bind(&DefaultApi::preview_image_tiff_get_handler, this)); Routes::Get(*router, base + "/roi/box", Routes::bind(&DefaultApi::roi_box_get_handler, this)); Routes::Put(*router, base + "/roi/box", Routes::bind(&DefaultApi::roi_box_put_handler, this)); Routes::Get(*router, base + "/roi/circle", Routes::bind(&DefaultApi::roi_circle_get_handler, this)); Routes::Put(*router, base + "/roi/circle", Routes::bind(&DefaultApi::roi_circle_put_handler, this)); Routes::Post(*router, base + "/start", Routes::bind(&DefaultApi::start_post_handler, this)); Routes::Get(*router, base + "/statistics/calibration", Routes::bind(&DefaultApi::statistics_calibration_get_handler, this)); Routes::Get(*router, base + "/statistics/data_collection", Routes::bind(&DefaultApi::statistics_data_collection_get_handler, this)); Routes::Get(*router, base + "/status", Routes::bind(&DefaultApi::status_get_handler, this)); Routes::Post(*router, base + "/trigger", Routes::bind(&DefaultApi::trigger_post_handler, this)); Routes::Post(*router, base + "/wait_till_done", Routes::bind(&DefaultApi::wait_till_done_post_handler, this)); Routes::Get(*router, base + "/xfel/event_code", Routes::bind(&DefaultApi::xfel_event_code_get_handler, this)); Routes::Get(*router, base + "/xfel/pulse_id", Routes::bind(&DefaultApi::xfel_pulse_id_get_handler, this)); // Default handler, called when a route is not found router->addCustomHandler(Routes::bind(&DefaultApi::default_api_default_handler, this)); } std::pair 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()); } } std::pair 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(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_detector_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_detector_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_detector_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Detector_settings detectorSettings; try { nlohmann::json::parse(request.body()).get_to(detectorSettings); detectorSettings.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->config_detector_put(detectorSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_internal_generator_image_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { try { this->config_internal_generator_image_put(request, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_rad_int_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_rad_int_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_rad_int_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Rad_int_settings radIntSettings; try { nlohmann::json::parse(request.body()).get_to(radIntSettings); radIntSettings.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->config_rad_int_put(radIntSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_select_detector_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_select_detector_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_select_detector_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Detector_selection detectorSelection; try { nlohmann::json::parse(request.body()).get_to(detectorSelection); detectorSelection.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->config_select_detector_put(detectorSelection, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_spot_finding_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_spot_finding_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_spot_finding_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Spot_finding_settings spotFindingSettings; try { nlohmann::json::parse(request.body()).get_to(spotFindingSettings); spotFindingSettings.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->config_spot_finding_put(spotFindingSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::deactivate_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->deactivate_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::detector_status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->detector_status_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::initialize_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->initialize_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::pedestal_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->pedestal_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_bkg_estimate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_bkg_estimate_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_error_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_error_pixel_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_image_collection_efficiency_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_image_collection_efficiency_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_indexing_rate_per_file_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->plot_indexing_rate_per_file_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_indexing_rate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_indexing_rate_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_rad_int_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->plot_rad_int_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_rad_int_per_file_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->plot_rad_int_per_file_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_receiver_delay_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_receiver_delay_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_receiver_free_send_buffers_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_receiver_free_send_buffers_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_resolution_estimate_histogram_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->plot_resolution_estimate_histogram_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_roi_max_count_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_roi_max_count_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_roi_sum_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_roi_sum_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_roi_valid_pixels_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_roi_valid_pixels_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_spot_count_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_spot_count_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::plot_strong_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Plot_request plotRequest; try { nlohmann::json::parse(request.body()).get_to(plotRequest); plotRequest.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->plot_strong_pixel_post(plotRequest, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::preview_calibration_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->preview_calibration_tiff_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::preview_image_jpeg_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->preview_image_jpeg_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::preview_image_jpeg_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Preview_settings previewSettings; try { nlohmann::json::parse(request.body()).get_to(previewSettings); previewSettings.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->preview_image_jpeg_post(previewSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::preview_image_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->preview_image_tiff_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::roi_box_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->roi_box_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::roi_box_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Roi_box_list roiBoxList; try { nlohmann::json::parse(request.body()).get_to(roiBoxList); roiBoxList.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->roi_box_put(roiBoxList, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::roi_circle_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->roi_circle_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::roi_circle_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Roi_circle_list roiCircleList; try { nlohmann::json::parse(request.body()).get_to(roiCircleList); roiCircleList.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->roi_circle_put(roiCircleList, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::start_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Dataset_settings datasetSettings; try { nlohmann::json::parse(request.body()).get_to(datasetSettings); datasetSettings.validate(); } catch (std::exception &e) { const std::pair errorInfo = this->handleParsingException(e); response.send(errorInfo.first, errorInfo.second); return; } try { this->start_post(datasetSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::statistics_calibration_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->statistics_calibration_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::statistics_data_collection_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->statistics_data_collection_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); 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(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::trigger_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->trigger_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::wait_till_done_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->wait_till_done_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::xfel_event_code_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->xfel_event_code_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::xfel_pulse_id_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->xfel_pulse_id_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; } catch (std::exception &e) { const std::pair errorInfo = this->handleOperationException(e); response.send(errorInfo.first, errorInfo.second); 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