8 #include <oatpp/web/server/api/ApiController.hpp>
9 #include <oatpp/parser/json/mapping/ObjectMapper.hpp>
10 #include <oatpp/core/macro/codegen.hpp>
11 #include <oatpp/core/macro/component.hpp>
13 #include OATPP_CODEGEN_BEGIN(ApiController)
27 const std::string& publicDir)
28 : oatpp::web::server::api::ApiController(objectMapper)
37 info->summary =
"List all RW command specs including hidden status";
39 "Returns all registered RW task/set types merged with any existing configuration "
40 "from commandSpecs.json. Types not yet present in the file appear with only "
41 "CommandType and DisplayName.";
42 info->addTag(
"Configure");
43 info->addResponse<oatpp::String>(Status::CODE_200,
"application/json");
45 ENDPOINT(
"GET",
"/api/configure/command-specs", getRwCommandSpecs,
46 REQUEST(std::shared_ptr<IncomingRequest>, request))
53 info->summary =
"Update a command spec entry in commandSpecs.json";
55 "Upserts the configuration for the given command type. The entire entry JSON "
56 "replaces any existing entry for that type. Accepted fields include "
57 "DisplayName, Level, Group, Icon, hidden (bool), and Parameters.";
58 info->addTag(
"Configure");
59 info->pathParams[
"commandType"].description =
"Command type identifier";
60 info->addConsumes<oatpp::String>(
"application/json");
61 info->addResponse<oatpp::String>(Status::CODE_200,
"application/json");
62 info->addResponse<oatpp::String>(Status::CODE_400,
"application/json");
63 info->addResponse<oatpp::String>(Status::CODE_500,
"application/json");
65 ENDPOINT(
"PUT",
"/api/configure/command-specs/{commandType}", updateRwCommandSpec,
66 PATH(String, commandType), REQUEST(std::shared_ptr<IncomingRequest>, request))
73 info->summary =
"List icon filenames available in public/icons/";
75 "Returns a JSON object with an \"icons\" array of URL paths (e.g. \"/icons/foo.svg\") "
76 "for every file found in the server's public/icons/ directory.";
77 info->addTag(
"Configure");
78 info->addResponse<oatpp::String>(Status::CODE_200,
"application/json");
80 ENDPOINT(
"GET",
"/api/configure/icons", getIcons,
81 REQUEST(std::shared_ptr<IncomingRequest>, request))
88 info->summary =
"List entity filter available in public/filters/";
89 info->description =
"Returns a JSON object with a \"filters\" array of named filters";
90 info->addTag(
"Configure");
91 info->addResponse<oatpp::String>(Status::CODE_200,
"application/json");
93 ENDPOINT(
"GET",
"/api/configure/filters", getFilters, REQUEST(std::shared_ptr<IncomingRequest>, request))
100 info->summary =
"Forcibly close an active session by integer session ID";
102 "Immediately invalidates the session with the given ID. "
103 "The affected client's next API call will receive a 401. "
104 "Requires the 'session.write' permission.";
105 info->addTag(
"Configure");
106 info->pathParams[
"sessionId"].description =
"Integer session ID as shown in GET /api/status";
107 info->addResponse<oatpp::String>(Status::CODE_200,
"application/json");
108 info->addResponse<oatpp::String>(Status::CODE_400,
"application/json");
109 info->addResponse<oatpp::String>(Status::CODE_404,
"application/json");
111 ENDPOINT(
"DELETE",
"/api/configure/sessions/{sessionId}", deleteSession,
112 PATH(String, sessionId), REQUEST(std::shared_ptr<IncomingRequest>, request))
121 const std::shared_ptr<IncomingRequest>& req);
124 const std::shared_ptr<IncomingRequest>& req,
const String& commandType);
127 const std::shared_ptr<IncomingRequest>& req);
130 const std::shared_ptr<IncomingRequest>& req);
133 const std::shared_ptr<IncomingRequest>& req,
const String& sessionId);
136 #include OATPP_CODEGEN_END(ApiController)