2019-07-14 22:39:37 +00:00
|
|
|
#pragma once
|
|
|
|
#include <drogon/HttpController.h>
|
|
|
|
using namespace drogon;
|
2019-09-08 21:24:31 +00:00
|
|
|
namespace api::v1
|
2019-07-14 22:39:37 +00:00
|
|
|
{
|
2019-07-22 20:06:13 +00:00
|
|
|
class controllers:public drogon::HttpController<controllers>
|
2019-07-14 22:39:37 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
METHOD_LIST_BEGIN
|
2019-09-24 21:33:35 +00:00
|
|
|
METHOD_ADD(controllers::post_discover, "/discover", Post, Options);
|
|
|
|
METHOD_ADD(controllers::get_all, "/", Get, Options);
|
|
|
|
METHOD_ADD(controllers::get_one_by_id, "/{1}", Get, Options);
|
|
|
|
METHOD_ADD(controllers::get_one_by_tag, "/tag/{1}", Get, Options);
|
|
|
|
METHOD_ADD(controllers::delete_one_by_id, "/{1}", Delete, Options);
|
|
|
|
METHOD_ADD(controllers::put_one_by_id, "/{1}", Put, Options, "filters::json_required", "filters::controllers::valid_json");
|
2019-07-20 21:33:17 +00:00
|
|
|
|
2019-09-24 21:33:35 +00:00
|
|
|
METHOD_ADD(controllers::get_relays_all, "/{1}/relays/", Get, Options);
|
|
|
|
METHOD_ADD(controllers::get_relays_one_by_id_and_num, "/{1}/relays/{2}", Get, Options);
|
|
|
|
METHOD_ADD(controllers::put_relays_one_by_id_and_num, "/{1}/relays/{2}", Put, Options, "filters::json_required", "filters::relays::valid_json");
|
2019-07-14 22:39:37 +00:00
|
|
|
METHOD_LIST_END
|
|
|
|
|
2019-07-20 21:33:17 +00:00
|
|
|
static void post_discover(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
|
|
|
|
static void get_all(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
|
2019-07-22 20:06:13 +00:00
|
|
|
static void get_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_id);
|
2019-09-24 21:33:35 +00:00
|
|
|
static void get_one_by_tag(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_tag);
|
2019-07-22 20:06:13 +00:00
|
|
|
static void delete_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_id);
|
2019-07-29 21:59:16 +00:00
|
|
|
static void put_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_id);
|
2019-07-20 21:33:17 +00:00
|
|
|
|
2019-07-22 20:06:13 +00:00
|
|
|
static void get_relays_all(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_id);
|
|
|
|
static void get_relays_one_by_id_and_num(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_id, int relay_num);
|
|
|
|
static void put_relays_one_by_id_and_num(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& controller_id, int relay_num);
|
2019-07-14 22:39:37 +00:00
|
|
|
};
|
|
|
|
}
|