Skip to content
Merged

MCP #1532

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pkg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[openapi-cpp]
url=git@github.com:triptix-tech/openapi-cpp.git
branch=master
commit=10085e12d4c4006512cfee5a114f9fe04cb0caa0
commit=22492d0eb82ea257e666c29e66c402a45d5d7e25
[unordered_dense]
url=git@github.com:motis-project/unordered_dense.git
branch=main
Expand Down
14 changes: 7 additions & 7 deletions .pkg.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2997906892316894464
12814269521098154637
cista 427f0a873be43f1de94289bd53d5678e07cd243f
zlib-ng d68e1d908e789c31c1f2fafe4bd8e09cb91e21c5
boost b050b3988ba25ea7757462d26a38d225bfe20f75
Expand All @@ -17,7 +17,7 @@ libressl 660f532fa29e1e934e530f22faa79cf7ea345a40
res b759b93316afeb529b6cb5b2548b24c41e382fb0
date ce88cc33b5551f66655614eeebb7c5b7189025fb
yaml-cpp 39f737443b05e4135e697cb91c2b7b18095acd53
openapi-cpp 10085e12d4c4006512cfee5a114f9fe04cb0caa0
openapi-cpp 22492d0eb82ea257e666c29e66c402a45d5d7e25
net d1d445326a5d3ec77e14394fee60962d08894ba0
PEGTL 0d37dcf8f02c12a84fdf521973801a5baab78e8f
oh d9eb908452e808179afeb7954e8beaa5b3626c36
Expand All @@ -39,22 +39,22 @@ nigiri c9a8d9350d681643dd5809a5e415e4cb0cbc2285
conf f9bf4bd83bf55a2170725707e526cbacc45dcc66
expat 636c9861e8e7c119f3626d1e6c260603ab624516
libosmium aec81a466451d5c6913df503e543806129df02d1
oneTBB cda5d37ce8303c58ac506259387e75de4ffcf26b
protozero a94574f49d3820dc2f90121f8d5c5ffb6210b5b2
osm 4b9644b8b3753ac13903f1f08a7b06cc19943d27
rapidjson 8b92de0bfdcf2127e67903959c9c48d580829da7
osr 5b51bdf072062a6caa88539e2a2619cd7222f5c1
prometheus-cpp e420cd7cf3995a994220b40a36c987ac8e67c0bf
reflect-cpp 86fdcdd09a54b0f55de97110e1911d27f60e498a
clipper 2abf72015b85f1cfd38706b21d4f28b8c359c7d5
concurrentqueue ab6b0b5334a005ef6ff1365ba5af87404de39d29
lmdb 39d8127e5697b1323a67e61c3ad8f087384c7429
osm 4b9644b8b3753ac13903f1f08a7b06cc19943d27
pbf-sdf-fonts 32e9dfe72fcf0be3477f262880f66f8a1248a381
variant 5aa73631dc969087c77433a5cdef246303051f69
tiles f94499b4defcb807156743b9bb2fc047394b9fab
osr 5b51bdf072062a6caa88539e2a2619cd7222f5c1
prometheus-cpp e420cd7cf3995a994220b40a36c987ac8e67c0bf
reflect-cpp 86fdcdd09a54b0f55de97110e1911d27f60e498a
FTXUI dd6a5d371fd7a3e2937bb579955003c54b727233
Mustache 3f654942a70c46a775070d7a09ca7acfa3e205b7
address-formatting d08c98b5b2c57f51bf03cae6c4f6586edab23a5c
oneTBB cda5d37ce8303c58ac506259387e75de4ffcf26b
Nominatim c0c8a26c3915c928ff5fcc2a78e47e851603a06b
utf8proc 779b780da3b99d123133eb99707b65c7e4324cc8
adr 381a389f4d6ce634cc6608d59d1d4525c2608dc6
21 changes: 21 additions & 0 deletions include/motis/endpoints/mcp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <optional>
#include <string>

#include "net/web_server/query_router.h"

#include "motis/endpoints/adr/geocode.h"
#include "motis/endpoints/routing.h"

namespace motis::ep {

struct mcp {
net::reply operator()(net::route_request const&, bool) const;

std::optional<routing> routing_ep_;
std::optional<geocode> geocoding_ep_;
std::string motis_version_;
};

} // namespace motis::ep
7 changes: 7 additions & 0 deletions include/motis/motis_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "motis/endpoints/map/stops.h"
#include "motis/endpoints/map/trips.h"
#include "motis/endpoints/matches.h"
#include "motis/endpoints/mcp.h"
#include "motis/endpoints/metrics.h"
#include "motis/endpoints/ojp.h"
#include "motis/endpoints/one_to_all.h"
Expand Down Expand Up @@ -168,6 +169,12 @@ struct motis_instance {
.trip_ep_ = utl::init_from<ep::trip>(d),
});

auto mcp = ep::mcp{.routing_ep_ = utl::init_from<ep::routing>(d),
.geocoding_ep_ = utl::init_from<ep::geocode>(d),
.motis_version_ = std::string{motis_version}};
qr_.route("GET", "/api/mcp", mcp); // answered with 405 (no SSE stream)
qr_.route("POST", "/api/mcp", std::move(mcp));

qr_.route("GET", "/metrics",
ep::metrics{d.tt_.get(), d.tags_.get(), d.rt_, d.metrics_.get()});
qr_.route("GET", "/gtfsrt",
Expand Down
Loading
Loading