#include "Request.h" Request::Request(){ } void Request::setup(std::string ip, int port, std::string page){ request.method = ofHttpRequest::POST; request.url = "http://" + ip + ":" + ofToString(port) + "/" + page; request.headers["Content-Type"] = "application/json"; } VPQuery Request::query(Vector7D input){ request.body = "{\"vector\": [" + ofToString(input.angry) + "," + ofToString(input.disgust) + "," + ofToString(input.fear) + "," + ofToString(input.happy) + "," + ofToString(input.sad) + "," + ofToString(input.surprise) + "," + ofToString(input.neutral) + "]}"; auto response = http.handleRequest(request); jsonResponse = ofJson::parse(response.data.getText()); VPQuery queryResponse; queryResponse.folder = jsonResponse["folder"]; queryResponse.image = jsonResponse["image"]; queryResponse.video = jsonResponse["video"]; queryResponse.frame = ofToInt(jsonResponse["frame"]) + 10; return queryResponse; }