mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-09 09:47:08 +01:00
When building single source, enums for HTTP status codes have a name conflict. ESP8266WebServer is included only in the OTA_WEB_SUPPORT=1 and WEB_SUPPORT=0, so guard by checking for WEB_SUPPORT before including anything related to the async variant.
43 lines
985 B
C++
43 lines
985 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 "espurna.h"
|
|
|
|
#include "api_path.h"
|
|
#include <functional>
|
|
|
|
#if WEB_SUPPORT
|
|
#include "api_impl.h"
|
|
#include "web.h"
|
|
|
|
bool apiAuthenticateHeader(AsyncWebServerRequest*, const String& key);
|
|
bool apiAuthenticateParam(AsyncWebServerRequest*, const String& key);
|
|
bool apiAuthenticate(AsyncWebServerRequest*);
|
|
#endif
|
|
|
|
void apiCommonSetup();
|
|
bool apiEnabled();
|
|
bool apiRestFul();
|
|
String apiKey();
|
|
|
|
#if WEB_SUPPORT
|
|
using ApiBasicHandler = std::function<bool(ApiRequest&)>;
|
|
using ApiJsonHandler = std::function<bool(ApiRequest&, JsonObject& reponse)>;
|
|
|
|
void apiRegister(const String& path, ApiBasicHandler&& get, ApiBasicHandler&& put);
|
|
void apiRegister(const String& path, ApiJsonHandler&& get, ApiJsonHandler&& put);
|
|
|
|
bool apiError(ApiRequest&);
|
|
bool apiOk(ApiRequest&);
|
|
#endif
|
|
|
|
void apiSetup();
|