From 444caeb1d7f6203f977e41e3ccc47fb81ad36c67 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 16 Jan 2024 00:03:53 -0800 Subject: [PATCH] requesthandler: Add `GetSourceFilterKindList` Closes #1198 --- src/requesthandler/RequestHandler.cpp | 1 + src/requesthandler/RequestHandler.h | 1 + src/requesthandler/RequestHandler_Filters.cpp | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/requesthandler/RequestHandler.cpp b/src/requesthandler/RequestHandler.cpp index 9383ca7e3..e99981aeb 100644 --- a/src/requesthandler/RequestHandler.cpp +++ b/src/requesthandler/RequestHandler.cpp @@ -111,6 +111,7 @@ const std::unordered_map RequestHandler::_han {"SetTBarPosition", &RequestHandler::SetTBarPosition}, // Filters + {"GetSourceFilterKindList", &RequestHandler::GetSourceFilterKindList}, {"GetSourceFilterList", &RequestHandler::GetSourceFilterList}, {"GetSourceFilterDefaultSettings", &RequestHandler::GetSourceFilterDefaultSettings}, {"CreateSourceFilter", &RequestHandler::CreateSourceFilter}, diff --git a/src/requesthandler/RequestHandler.h b/src/requesthandler/RequestHandler.h index a3c24963c..92a4d947d 100644 --- a/src/requesthandler/RequestHandler.h +++ b/src/requesthandler/RequestHandler.h @@ -130,6 +130,7 @@ class RequestHandler { RequestResult SetTBarPosition(const Request &); // Filters + RequestResult GetSourceFilterKindList(const Request &); RequestResult GetSourceFilterList(const Request &); RequestResult GetSourceFilterDefaultSettings(const Request &); RequestResult CreateSourceFilter(const Request &); diff --git a/src/requesthandler/RequestHandler_Filters.cpp b/src/requesthandler/RequestHandler_Filters.cpp index fb07feb5d..bd35161aa 100644 --- a/src/requesthandler/RequestHandler_Filters.cpp +++ b/src/requesthandler/RequestHandler_Filters.cpp @@ -19,6 +19,27 @@ with this program. If not, see #include "RequestHandler.h" +/** + * Gets an array of all available source filter kinds. + * + * Similar to `GetInputKindList` + * + * @responseField sourceFilterKinds | Array | Array of source filter kinds + * + * @requestType GetSourceFilterKindList + * @complexity 2 + * @rpcVersion -1 + * @initialVersion 5.4.0 + * @api requests + * @category filters + */ +RequestResult RequestHandler::GetSourceFilterKindList(const Request &) +{ + json responseData; + responseData["sourceFilterKinds"] = Utils::Obs::ArrayHelper::GetFilterKindList(); + return RequestResult::Success(responseData); +} + /** * Gets an array of all of a source's filters. *