ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
api.hpp File Reference
#include <reusex/pipeline/JobRunner.hpp>
#include <reusex/pipeline/stages.hpp>
#include <nlohmann/json.hpp>
#include <cstdint>
#include <filesystem>
#include <functional>
#include <map>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
Include dependency graph for api.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  rux::gui::HttpError
 Thrown by a handler to produce a non-200 JSON error response. More...
struct  rux::gui::Blob
 A non-JSON response body (image, mesh blob). More...
struct  rux::gui::Endpoint
 One row of the route table. More...
class  rux::gui::Params
 Already-decoded query parameters, so handlers never touch crow::request. More...
struct  rux::gui::PageRequest
 A validated, clamped offset/limit window over a collection. More...
struct  rux::gui::PageWindow
 The half-open [first, last) index range a page covers, plus the size of the collection it was taken from. More...
struct  rux::gui::PointsResponse
 One points-endpoint response. More...
struct  rux::gui::ValueRange
 Range of the valid stored values a normalize=true rendering mapped. More...
struct  rux::gui::ImageResponse
 An encoded image plus the provenance of any rendering applied to it. More...
struct  rux::gui::JobSubmission
 A validated POST /jobs body. More...

Namespaces

namespace  reusex
namespace  rux
namespace  rux::gui

Functions

const std::vector< Endpoint > & rux::gui::endpoint_table ()
 Every endpoint this server serves, in documentation order.
PageRequest rux::gui::parse_page_request (const Params &params, long long default_limit, long long max_limit)
 Parse and clamp offset/limit for a paged collection.
PageWindow rux::gui::page_window (const PageRequest &page, size_t total)
 Clamp page onto a collection of total items.
void rux::gui::add_page_envelope (nlohmann::json &object, const PageWindow &window)
 Add the shared offset/count/total envelope to a collection response.
nlohmann::json rux::gui::error_json (int status, std::string_view message)
nlohmann::json rux::gui::health_json (const reusex::ProjectDB *db, const std::filesystem::path &project)
nlohmann::json rux::gui::endpoints_json ()
nlohmann::json rux::gui::project_summary_json (const reusex::ProjectDB &db)
 The dashboard payload.
nlohmann::json rux::gui::projects_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::clouds_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::cloud_json (const reusex::ProjectDB &db, const std::string &name)
nlohmann::json rux::gui::cloud_labels_json (const reusex::ProjectDB &db, const std::string &name)
 Label id → name for one cloud, as {"labels": {...}}.
nlohmann::json rux::gui::cloud_points_json (const reusex::ProjectDB &db, const std::string &name, const Params &params)
 One page of point data as JSON, ignoring format.
PointsResponse rux::gui::cloud_points (const reusex::ProjectDB &db, const std::string &name, const Params &params)
 Serve one page of point data in the requested wire format.
nlohmann::json rux::gui::meshes_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::mesh_json (const reusex::ProjectDB &db, const std::string &name)
nlohmann::json rux::gui::mesh_textures_json (const reusex::ProjectDB &db, const std::string &name)
Blob rux::gui::mesh_data_blob (const reusex::ProjectDB &db, const std::string &name)
Blob rux::gui::mesh_texture_blob (const reusex::ProjectDB &db, const std::string &name, const std::string &texture)
nlohmann::json rux::gui::frames_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::frame_json (const reusex::ProjectDB &db, int id)
ImageResponse rux::gui::frame_image (const reusex::ProjectDB &db, int id, const Params &params)
 One of a frame's images, encoded as PNG.
nlohmann::json rux::gui::panoramas_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::panorama_json (const reusex::ProjectDB &db, int id)
Blob rux::gui::panorama_image_blob (const reusex::ProjectDB &db, int id, const Params &params)
 The equirectangular image, JPEG-encoded.
nlohmann::json rux::gui::components_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::component_json (const reusex::ProjectDB &db, const std::string &name)
nlohmann::json rux::gui::materials_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::material_json (const reusex::ProjectDB &db, const std::string &guid)
nlohmann::json rux::gui::instances_json (const reusex::ProjectDB &db, const std::string &cloud, const Params &params)
nlohmann::json rux::gui::stages_json (const reusex::ProjectDB &db)
nlohmann::json rux::gui::stage_validation_json (const reusex::ProjectDB &db, const std::string &stage)
 Input-contract validation for a single stage.
nlohmann::json rux::gui::pipeline_log_json (const reusex::ProjectDB &db, const Params &params)
nlohmann::json rux::gui::job_json (const reusex::pipeline::JobRecord &record, std::string_view project)
nlohmann::json rux::gui::jobs_json (const std::vector< reusex::pipeline::JobRecord > &jobs, std::string_view project)
 Every supplied job, unpaged, as {"jobs": [...]}.
nlohmann::json rux::gui::jobs_page_json (const std::vector< reusex::pipeline::JobRecord > &jobs, std::string_view project, const Params &params)
 GET /jobs: one page of the job store, with the shared envelope.
nlohmann::json rux::gui::job_event_json (const reusex::pipeline::JobEvent &event, std::string_view project)
nlohmann::json rux::gui::hello_json (const std::vector< reusex::pipeline::JobRecord > &jobs, const std::filesystem::path &project)
JobSubmission rux::gui::parse_job_request (std::string_view body)
 Parse and validate a job submission body.
void rux::gui::check_job_project (const JobSubmission &submission, std::string_view open_project)
 Reject a submission aimed at a different project.
std::optional< nlohmann::json > rux::gui::handle_ws_message (std::string_view body, const std::function< void(std::optional< std::string >)> &subscribe)
 Handle one client message on the WebSocket channel.
bool rux::gui::event_matches_subscription (const reusex::pipeline::JobEvent &event, const std::optional< std::string > &subscription)
 True when event should be delivered to a connection filtered to subscription (nullopt = unfiltered, receives everything).

Variables

constexpr std::string_view rux::gui::kApiVersion = "1.0.0"
 Contract version served under kApiPrefix.
constexpr std::string_view rux::gui::kApiPrefix = "/api/v1"
constexpr std::string_view rux::gui::kImplementation = "rux-gui"
 Identifies which implementation of the contract is answering.
constexpr size_t rux::gui::kMaxPointsPerPage = 1000000
 Upper bound on limit for the paged points endpoint, so a stray query cannot ask the server to materialize an unbounded response.
constexpr size_t rux::gui::kDefaultPointsPerPage = 100000
constexpr int rux::gui::kMaxLogEntries = 1000
 Upper bound on limit for the pipeline-log endpoint.
constexpr int rux::gui::kDefaultLogEntries = 100
constexpr int rux::gui::kMaxCollectionItems = 1000
 Upper bound on limit for the ordinary object collections (clouds, meshes, panoramas, components, materials, instances, jobs, project records).
constexpr int rux::gui::kMaxFrameIds = 10000
 Upper bound on limit for the sensor-frame id list.
constexpr int rux::gui::kMaxImageSize = 4096
 Upper bound on the max_size image parameter.
constexpr int rux::gui::kWriteLockTimeoutMs = 250
 How long a mutating request waits for the project's writer lock before answering 503.