Files
espurna/code/espurna/api.h
Maxim Prokhorov b64e7f91c1 web: revert to per-file include checks
minimal & single-source builds should coexist yet again
2023-04-13 19:22:49 +03:00

49 lines
1020 B
C++

/*
API MODULE
Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
Copyright (C) 2020-2021 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
*/
#pragma once
#include <functional>
#include <ArduinoJson.h>
#include "api_path.h"
#include "api_impl.h"
namespace espurna {
namespace api {
using BasicHandler = std::function<bool(Request&)>;
using JsonHandler = std::function<bool(Request&, JsonObject& reponse)>;
} // namespace api
} // namespace espurna
using ApiRequest = espurna::api::Request;
using ApiBasicHandler = espurna::api::BasicHandler;
using ApiJsonHandler = espurna::api::JsonHandler;
void apiRegister(String path,
espurna::api::BasicHandler&& get,
espurna::api::BasicHandler&& put);
void apiRegister(String path,
espurna::api::JsonHandler&& get,
espurna::api::JsonHandler&& put);
bool apiError(espurna::api::Request&);
bool apiOk(espurna::api::Request&);
String apiKey();
bool apiEnabled();
bool apiRestFul();
void apiCommonSetup();
void apiSetup();