11#ifndef RESTCMD_SRC_RESTENDPOINT_HPP_
12#define RESTCMD_SRC_RESTENDPOINT_HPP_
14#include <nlohmann/json.hpp>
16#include <pistache/http.h>
17#include <pistache/http_header.h>
18#include <pistache/description.h>
19#include <pistache/router.h>
20#include <pistache/endpoint.h>
21#include <pistache/client.h>
22#include <pistache/mime.h>
43 :
port_{
static_cast<uint16_t
>(port) }
48 ,
http_client_{ std::make_shared<Pistache::Http::Client>() }
52 void init(
size_t threads);
60 return static_cast<uint16_t
>(
port_);
71 void handle_route_command(
const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response);
void init(size_t threads)
Pistache::Address address_
RestEndpoint(const std::string &, int port, std::function< void(const cmdobj_t &, cmdlib::cmd::CommandReply)> callback) noexcept
std::shared_ptr< Pistache::Http::Client > getHttpClient() const
Pistache::Rest::Router router_
Pistache::Rest::Description description_
std::thread server_thread_
std::shared_ptr< Pistache::Http::Client > http_client_
void handle_route_command(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response)
std::shared_ptr< Pistache::Http::Endpoint > http_endpoint_
Pistache::Http::Client::Options http_client_options_
Pistache::Http::Mime::MediaType accepted_mime_
std::function< void(const cmdobj_t &, cmdlib::cmd::CommandReply)> command_callback_
void handleResponseCommand(const cmdobj_t &cmd, cmdlib::cmd::CommandReply &meta)
std::vector< Pistache::Async::Promise< Pistache::Http::Response > > http_client_responses_