summaryrefslogtreecommitdiffstats
path: root/server/src/http/handler.cppm
blob: d28e765fb3128729aa0fc981895ba791200bafab (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module;

#include <boost/asio/awaitable.hpp>

export module routemon:http.handler;

import :api;
import :http.core.server;
import :rwgps;

namespace routemon::http {

class handler
{
  log::logger l_;
  api::handler inner_;
  std::shared_ptr<rwgps::credentials> rwgps_creds_;

public:
  using outer_ctx = core::base_ctx;
  using l0_ctx = core::routed_ctx<outer_ctx>;

private:
  auto handle_process_gpx(l0_ctx ctx, core::readable_request r)
      -> net::awaitable<core::presponse>;

  auto handle_sysinfo(l0_ctx ctx, core::readable_request r)
      -> net::awaitable<core::presponse>;

  auto handle_rwgps_webhook(l0_ctx ctx, core::readable_request r)
      -> net::awaitable<core::presponse>;

public:
  handler(
      log::logger const& l, api::handler&& inner,
      std::shared_ptr<rwgps::credentials> rwgps_creds);

  auto make_routes() -> core::route_tree<core::routed_ctx<outer_ctx>>;
};

} // namespace routemon::http