#ifndef API_MESSAGE_HPP_ #define API_MESSAGE_HPP_ #include #include #include #include #include #include using std::string; using std::cout; using std::endl; class Message { private: json data; WebSocket& web; NetworkManager& req; public: Message(const json& data) : data(data), web(WebSocket::getInstance()), req(NetworkManager::getInstance()) {}; string send(const string& id, const json& msg) { return req.request("POST", dapi + "/channels/" + id + "/messages", msg.dump()); } string getMessages(const string& id, const string& count, const string& before = "") { if (before.empty()) { return req.request("GET", dapi + "/channels/" + id + "/messages?limit=" + count); } else { return req.request("GET", dapi + "/channels/" + id + "/messages?before=" + before + "&limit=" + count); } return "pizda"; } string deleteMessage(const string& channel_id, const string& message_id) { return req.request("DELETE", dapi + "/channels/" + channel_id + "/messages/" + message_id); } }; #endif