Revert "Requests: Add Compare"

This reverts commit 3687086ce0.

I realized that I'm adding too much too fast, and that we should
focus on getting v5 out first.
This commit is contained in:
tt2468 2021-10-05 20:17:45 -07:00
parent 3687086ce0
commit 1b25e98dc2
5 changed files with 1 additions and 34 deletions

View File

@ -12,7 +12,6 @@ const std::map<std::string, RequestMethodHandler> RequestHandler::_handlerMap
{"GetStudioModeEnabled", &RequestHandler::GetStudioModeEnabled},
{"SetStudioModeEnabled", &RequestHandler::SetStudioModeEnabled},
{"Sleep", &RequestHandler::Sleep},
{"Compare", &RequestHandler::Compare},
// Config
{"GetPersistentData", &RequestHandler::GetPersistentData},

View File

@ -33,7 +33,6 @@ class RequestHandler {
RequestResult GetStudioModeEnabled(const Request&);
RequestResult SetStudioModeEnabled(const Request&);
RequestResult Sleep(const Request&);
RequestResult Compare(const Request&);
// Config
RequestResult GetPersistentData(const Request&);

View File

@ -165,32 +165,3 @@ RequestResult RequestHandler::Sleep(const Request& request)
return RequestResult::Error(RequestStatus::UnsupportedRequestBatchExecutionType);
}
}
RequestResult RequestHandler::Compare(const Request& request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
if (!(request.ValidateBasic("compareValueOne", statusCode, comment) && request.ValidateBasic("compareValueTwo", statusCode, comment) && request.ValidateNumber("newRequestIndex", statusCode, comment, 0)))
return RequestResult::Error(statusCode, comment);
if (!(request.RequestBatchExecutionType == OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME || request.RequestBatchExecutionType == OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME))
return RequestResult::Error(RequestStatus::UnsupportedRequestBatchExecutionType);
bool invert = false;
if (request.Contains("compareInvert")) {
if (!request.ValidateOptionalBoolean("compareInvert", statusCode, comment))
return RequestResult::Error(statusCode, comment);
invert = request.RequestData["compareInvert"];
}
bool result = (request.RequestData["compareValueOne"] == request.RequestData["compareValueTwo"]);
if (invert)
result = !result;
json responseData;
responseData["compareResult"] = result;
RequestResult ret = RequestResult::Success(responseData);
if (result)
ret.NewRequestIndex = request.RequestData["newRequestIndex"];
return ret;
}

View File

@ -4,8 +4,7 @@ RequestResult::RequestResult(RequestStatus::RequestStatus statusCode, json respo
StatusCode(statusCode),
ResponseData(responseData),
Comment(comment),
SleepFrames(0),
NewRequestIndex(0)
SleepFrames(0)
{
}

View File

@ -12,5 +12,4 @@ struct RequestResult
json ResponseData;
std::string Comment;
size_t SleepFrames;
size_t NewRequestIndex;
};