core-legacy/controllers/api_v1_schedules.h
Tobias Reisinger a38a6e63b3 add: filters
add: schedule api calls
2019-07-20 14:51:45 +02:00

30 lines
1.8 KiB
C++

#pragma once
#include <drogon/HttpController.h>
using namespace drogon;
namespace api
{
namespace v1
{
class schedules:public drogon::HttpController<schedules>
{
public:
METHOD_LIST_BEGIN
METHOD_ADD(schedules::post_new, "/", Post, "filters::json_required", "filters::schedules::valid_json");
METHOD_ADD(schedules::get_all, "/", Get);
METHOD_ADD(schedules::get_one_by_id, "/{1}", Get);
METHOD_ADD(schedules::delete_one_by_id, "/{1}", Delete);
METHOD_ADD(schedules::put_one_by_id, "/{1}", Put, "filters::json_required", "filters::schedules::valid_json");
//METHOD_ADD(Devices::get_relays_all,"/{1}/relays",Get);
//METHOD_ADD(Devices::get_relays_one,"/{1}/relays/{2}",Get);
METHOD_LIST_END
static void post_new(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
static void get_all(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
static void get_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& schedule_id);
static void delete_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& schedule_id);
static void put_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& schedule_id);
//void get_relays_all(const HttpRequestPtr& req,std::function<void (const HttpResponsePtr &)> &&callback,std::string schedule_id);
//void get_relays_one(const HttpRequestPtr& req,std::function<void (const HttpResponsePtr &)> &&callback,std::string schedule_id,std::string relay_id);
};
}
}