/** * Jungfraujoch * API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. * * The version of the OpenAPI document: 1.0.0-rc.123 * 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& 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 + "/config/azim_int", Routes::bind(&DefaultApi::config_azim_int_get_handler, this)); Routes::Put(*router, base + "/config/azim_int", Routes::bind(&DefaultApi::config_azim_int_put_handler, this)); Routes::Get(*router, base + "/config/dark_mask", Routes::bind(&DefaultApi::config_dark_mask_get_handler, this)); Routes::Put(*router, base + "/config/dark_mask", Routes::bind(&DefaultApi::config_dark_mask_put_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::Get(*router, base + "/config/file_writer", Routes::bind(&DefaultApi::config_file_writer_get_handler, this)); Routes::Put(*router, base + "/config/file_writer", Routes::bind(&DefaultApi::config_file_writer_put_handler, this)); Routes::Post(*router, base + "/config/image_format/conversion", Routes::bind(&DefaultApi::config_image_format_conversion_post_handler, this)); Routes::Get(*router, base + "/config/image_format", Routes::bind(&DefaultApi::config_image_format_get_handler, this)); Routes::Put(*router, base + "/config/image_format", Routes::bind(&DefaultApi::config_image_format_put_handler, this)); Routes::Post(*router, base + "/config/image_format/raw", Routes::bind(&DefaultApi::config_image_format_raw_post_handler, this)); Routes::Get(*router, base + "/config/indexing", Routes::bind(&DefaultApi::config_indexing_get_handler, this)); Routes::Put(*router, base + "/config/indexing", Routes::bind(&DefaultApi::config_indexing_put_handler, this)); Routes::Get(*router, base + "/config/instrument", Routes::bind(&DefaultApi::config_instrument_get_handler, this)); Routes::Put(*router, base + "/config/instrument", Routes::bind(&DefaultApi::config_instrument_put_handler, this)); Routes::Put(*router, base + "/config/internal_generator_image", Routes::bind(&DefaultApi::config_internal_generator_image_put_handler, this)); Routes::Put(*router, base + "/config/internal_generator_image.tiff", Routes::bind(&DefaultApi::config_internal_generator_image_tiff_put_handler, this)); Routes::Get(*router, base + "/config/mask", Routes::bind(&DefaultApi::config_mask_get_handler, this)); Routes::Get(*router, base + "/config/mask.tiff", Routes::bind(&DefaultApi::config_mask_tiff_get_handler, this)); Routes::Get(*router, base + "/config/roi", Routes::bind(&DefaultApi::config_roi_get_handler, this)); Routes::Put(*router, base + "/config/roi", Routes::bind(&DefaultApi::config_roi_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::Get(*router, base + "/config/user_mask", Routes::bind(&DefaultApi::config_user_mask_get_handler, this)); Routes::Put(*router, base + "/config/user_mask", Routes::bind(&DefaultApi::config_user_mask_put_handler, this)); Routes::Get(*router, base + "/config/user_mask.tiff", Routes::bind(&DefaultApi::config_user_mask_tiff_get_handler, this)); Routes::Put(*router, base + "/config/user_mask.tiff", Routes::bind(&DefaultApi::config_user_mask_tiff_put_handler, this)); Routes::Get(*router, base + "/config/zeromq_metadata", Routes::bind(&DefaultApi::config_zeromq_metadata_get_handler, this)); Routes::Put(*router, base + "/config/zeromq_metadata", Routes::bind(&DefaultApi::config_zeromq_metadata_put_handler, this)); Routes::Get(*router, base + "/config/zeromq_preview", Routes::bind(&DefaultApi::config_zeromq_preview_get_handler, this)); Routes::Put(*router, base + "/config/zeromq_preview", Routes::bind(&DefaultApi::config_zeromq_preview_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::Get(*router, base + "/fpga_status", Routes::bind(&DefaultApi::fpga_status_get_handler, this)); Routes::Post(*router, base + "/image_buffer/clear", Routes::bind(&DefaultApi::image_buffer_clear_post_handler, this)); Routes::Get(*router, base + "/image_buffer/image.cbor", Routes::bind(&DefaultApi::image_buffer_image_cbor_get_handler, this)); Routes::Get(*router, base + "/image_buffer/image.jpeg", Routes::bind(&DefaultApi::image_buffer_image_jpeg_get_handler, this)); Routes::Get(*router, base + "/image_buffer/image.tiff", Routes::bind(&DefaultApi::image_buffer_image_tiff_get_handler, this)); Routes::Get(*router, base + "/image_buffer/start.cbor", Routes::bind(&DefaultApi::image_buffer_start_cbor_get_handler, this)); Routes::Get(*router, base + "/image_buffer/status", Routes::bind(&DefaultApi::image_buffer_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::Get(*router, base + "/preview/pedestal.tiff", Routes::bind(&DefaultApi::preview_pedestal_tiff_get_handler, this)); Routes::Get(*router, base + "/preview/plot.bin", Routes::bind(&DefaultApi::preview_plot_bin_get_handler, this)); Routes::Get(*router, base + "/preview/plot", Routes::bind(&DefaultApi::preview_plot_get_handler, this)); Routes::Get(*router, base + "/result/scan", Routes::bind(&DefaultApi::result_scan_get_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 + "/statistics", Routes::bind(&DefaultApi::statistics_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::Get(*router, base + "/version", Routes::bind(&DefaultApi::version_get_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)); } void DefaultApi::handleParsingException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept { std::pair codeAndError = handleParsingException(ex); response.send(codeAndError.first, codeAndError.second); } 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()); } } void DefaultApi::handleOperationException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept { std::pair codeAndError = handleOperationException(ex); response.send(codeAndError.first, codeAndError.second); } 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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_azim_int_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_azim_int_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_azim_int_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Azim_int_settings azimIntSettings; try { nlohmann::json::parse(request.body()).get_to(azimIntSettings); azimIntSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_azim_int_put(azimIntSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_dark_mask_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_dark_mask_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_dark_mask_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Dark_mask_settings darkMaskSettings; try { nlohmann::json::parse(request.body()).get_to(darkMaskSettings); darkMaskSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_dark_mask_put(darkMaskSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleOperationException(e, response); 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) { this->handleParsingException(e, response); 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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_file_writer_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_file_writer_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_file_writer_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param File_writer_settings fileWriterSettings; try { nlohmann::json::parse(request.body()).get_to(fileWriterSettings); fileWriterSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_file_writer_put(fileWriterSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_image_format_conversion_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_image_format_conversion_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_image_format_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_image_format_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_image_format_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Image_format_settings imageFormatSettings; try { nlohmann::json::parse(request.body()).get_to(imageFormatSettings); imageFormatSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_image_format_put(imageFormatSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_image_format_raw_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_image_format_raw_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_indexing_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_indexing_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_indexing_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Indexing_settings indexingSettings; try { nlohmann::json::parse(request.body()).get_to(indexingSettings); indexingSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_indexing_put(indexingSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_instrument_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_instrument_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_instrument_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Instrument_metadata instrumentMetadata; try { nlohmann::json::parse(request.body()).get_to(instrumentMetadata); instrumentMetadata.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_instrument_put(instrumentMetadata, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_internal_generator_image_tiff_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { try { this->config_internal_generator_image_tiff_put(request, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_mask_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_mask_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_mask_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_mask_tiff_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_roi_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_roi_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_roi_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Roi_definitions roiDefinitions; try { nlohmann::json::parse(request.body()).get_to(roiDefinitions); roiDefinitions.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_roi_put(roiDefinitions, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleOperationException(e, response); 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) { this->handleParsingException(e, response); 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) { this->handleOperationException(e, response); 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) { this->handleOperationException(e, response); 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) { this->handleParsingException(e, response); 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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::config_user_mask_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_user_mask_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_user_mask_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { try { this->config_user_mask_put(request, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_user_mask_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_user_mask_tiff_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_user_mask_tiff_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { try { this->config_user_mask_tiff_put(request, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_zeromq_metadata_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_zeromq_metadata_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_zeromq_metadata_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Zeromq_metadata_settings zeromqMetadataSettings; try { nlohmann::json::parse(request.body()).get_to(zeromqMetadataSettings); zeromqMetadataSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_zeromq_metadata_put(zeromqMetadataSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_zeromq_preview_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->config_zeromq_preview_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::config_zeromq_preview_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the body param Zeromq_preview_settings zeromqPreviewSettings; try { nlohmann::json::parse(request.body()).get_to(zeromqPreviewSettings); zeromqPreviewSettings.validate(); } catch (std::exception &e) { this->handleParsingException(e, response); return; } try { this->config_zeromq_preview_put(zeromqPreviewSettings, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleOperationException(e, response); 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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::fpga_status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->fpga_status_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::image_buffer_clear_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->image_buffer_clear_post(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::image_buffer_image_cbor_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto idQuery = request.query().get("id"); std::optional id; if(idQuery.has_value()){ int64_t valueQuery_instance; if(fromStringValue(idQuery.value(), valueQuery_instance)){ id = valueQuery_instance; } } try { this->image_buffer_image_cbor_get(id, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::image_buffer_image_jpeg_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto idQuery = request.query().get("id"); std::optional id; if(idQuery.has_value()){ int64_t valueQuery_instance; if(fromStringValue(idQuery.value(), valueQuery_instance)){ id = valueQuery_instance; } } auto showUserMaskQuery = request.query().get("show_user_mask"); std::optional showUserMask; if(showUserMaskQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(showUserMaskQuery.value(), valueQuery_instance)){ showUserMask = valueQuery_instance; } } auto showRoiQuery = request.query().get("show_roi"); std::optional showRoi; if(showRoiQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(showRoiQuery.value(), valueQuery_instance)){ showRoi = valueQuery_instance; } } auto showSpotsQuery = request.query().get("show_spots"); std::optional showSpots; if(showSpotsQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(showSpotsQuery.value(), valueQuery_instance)){ showSpots = valueQuery_instance; } } auto showBeamCenterQuery = request.query().get("show_beam_center"); std::optional showBeamCenter; if(showBeamCenterQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(showBeamCenterQuery.value(), valueQuery_instance)){ showBeamCenter = valueQuery_instance; } } auto saturationQuery = request.query().get("saturation"); std::optional saturation; if(saturationQuery.has_value()){ float valueQuery_instance; if(fromStringValue(saturationQuery.value(), valueQuery_instance)){ saturation = valueQuery_instance; } } auto jpegQualityQuery = request.query().get("jpeg_quality"); std::optional jpegQuality; if(jpegQualityQuery.has_value()){ int64_t valueQuery_instance; if(fromStringValue(jpegQualityQuery.value(), valueQuery_instance)){ jpegQuality = valueQuery_instance; } } auto showResRingQuery = request.query().get("show_res_ring"); std::optional showResRing; if(showResRingQuery.has_value()){ float valueQuery_instance; if(fromStringValue(showResRingQuery.value(), valueQuery_instance)){ showResRing = valueQuery_instance; } } auto colorQuery = request.query().get("color"); std::optional color; if(colorQuery.has_value()){ std::string valueQuery_instance; if(fromStringValue(colorQuery.value(), valueQuery_instance)){ color = valueQuery_instance; } } auto showResEstQuery = request.query().get("show_res_est"); std::optional showResEst; if(showResEstQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(showResEstQuery.value(), valueQuery_instance)){ showResEst = valueQuery_instance; } } try { this->image_buffer_image_jpeg_get(id, showUserMask, showRoi, showSpots, showBeamCenter, saturation, jpegQuality, showResRing, color, showResEst, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::image_buffer_image_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto idQuery = request.query().get("id"); std::optional id; if(idQuery.has_value()){ int64_t valueQuery_instance; if(fromStringValue(idQuery.value(), valueQuery_instance)){ id = valueQuery_instance; } } try { this->image_buffer_image_tiff_get(id, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::image_buffer_start_cbor_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->image_buffer_start_cbor_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::image_buffer_status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->image_buffer_status_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleOperationException(e, response); 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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::preview_pedestal_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto gainLevelQuery = request.query().get("gain_level"); std::optional gainLevel; if(gainLevelQuery.has_value()){ int32_t valueQuery_instance; if(fromStringValue(gainLevelQuery.value(), valueQuery_instance)){ gainLevel = valueQuery_instance; } } auto scQuery = request.query().get("sc"); std::optional sc; if(scQuery.has_value()){ int32_t valueQuery_instance; if(fromStringValue(scQuery.value(), valueQuery_instance)){ sc = valueQuery_instance; } } try { this->preview_pedestal_tiff_get(gainLevel, sc, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::preview_plot_bin_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto typeQuery = request.query().get("type"); std::optional type; if(typeQuery.has_value()){ std::string valueQuery_instance; if(fromStringValue(typeQuery.value(), valueQuery_instance)){ type = valueQuery_instance; } } auto roiQuery = request.query().get("roi"); std::optional roi; if(roiQuery.has_value()){ std::string valueQuery_instance; if(fromStringValue(roiQuery.value(), valueQuery_instance)){ roi = valueQuery_instance; } } try { this->preview_plot_bin_get(type, roi, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::preview_plot_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto binningQuery = request.query().get("binning"); std::optional binning; if(binningQuery.has_value()){ int32_t valueQuery_instance; if(fromStringValue(binningQuery.value(), valueQuery_instance)){ binning = valueQuery_instance; } } auto compressionQuery = request.query().get("compression"); std::optional compression; if(compressionQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(compressionQuery.value(), valueQuery_instance)){ compression = valueQuery_instance; } } auto typeQuery = request.query().get("type"); std::optional type; if(typeQuery.has_value()){ std::string valueQuery_instance; if(fromStringValue(typeQuery.value(), valueQuery_instance)){ type = valueQuery_instance; } } auto fillQuery = request.query().get("fill"); std::optional fill; if(fillQuery.has_value()){ float valueQuery_instance; if(fromStringValue(fillQuery.value(), valueQuery_instance)){ fill = valueQuery_instance; } } auto experimentalCoordQuery = request.query().get("experimental_coord"); std::optional experimentalCoord; if(experimentalCoordQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(experimentalCoordQuery.value(), valueQuery_instance)){ experimentalCoord = valueQuery_instance; } } auto azintUnitQuery = request.query().get("azint_unit"); std::optional azintUnit; if(azintUnitQuery.has_value()){ std::string valueQuery_instance; if(fromStringValue(azintUnitQuery.value(), valueQuery_instance)){ azintUnit = valueQuery_instance; } } try { this->preview_plot_get(type, binning, compression, fill, experimentalCoord, azintUnit, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::result_scan_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { try { this->result_scan_get(response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleParsingException(e, response); 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) { this->handleOperationException(e, response); 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) { this->handleOperationException(e, response); 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) { this->handleOperationException(e, response); return; } } catch (std::exception &e) { response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } } void DefaultApi::statistics_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto compressionQuery = request.query().get("compression"); std::optional compression; if(compressionQuery.has_value()){ bool valueQuery_instance; if(fromStringValue(compressionQuery.value(), valueQuery_instance)){ compression = valueQuery_instance; } } try { this->statistics_get(compression, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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(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::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) { 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(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::wait_till_done_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { // Getting the query params auto timeoutQuery = request.query().get("timeout"); std::optional timeout; if(timeoutQuery.has_value()){ int32_t valueQuery_instance; if(fromStringValue(timeoutQuery.value(), valueQuery_instance)){ timeout = valueQuery_instance; } } try { this->wait_till_done_post(timeout, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(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::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) { this->handleOperationException(e, response); 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) { 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