summaryrefslogtreecommitdiff
path: root/discord/http.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2020-10-12 18:17:53 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2020-10-12 18:17:53 -0400
commitf5ae8c3d3fd4c6b928da6c7c3c785525fc60b7b4 (patch)
treeecc57ee465504d787fd368c634a31ba8fae7f928 /discord/http.cpp
parentd48fe29da9d8a19cec982be5a8ea50589fb92c87 (diff)
downloadabaddon-portaudio-f5ae8c3d3fd4c6b928da6c7c3c785525fc60b7b4.tar.gz
abaddon-portaudio-f5ae8c3d3fd4c6b928da6c7c3c785525fc60b7b4.zip
add kick/ban
Diffstat (limited to 'discord/http.cpp')
-rw-r--r--discord/http.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/discord/http.cpp b/discord/http.cpp
index 4c9cf87..41f6c17 100644
--- a/discord/http.cpp
+++ b/discord/http.cpp
@@ -71,6 +71,27 @@ void HTTPClient::MakePOST(std::string path, std::string payload, std::function<v
#endif
}
+void HTTPClient::MakePUT(std::string path, std::string payload, std::function<void(cpr::Response r)> cb) {
+ printf("PUT %s\n", path.c_str());
+ auto url = cpr::Url { m_api_base + path };
+ auto headers = cpr::Header {
+ { "Authorization", m_authorization },
+ { "Content-Type", "application/json" },
+ };
+ auto body = cpr::Body { payload };
+#ifdef USE_LOCAL_PROXY
+ m_futures.push_back(cpr::PutCallback(
+ std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb),
+ url, headers, body,
+ cpr::Proxies { { "http", "127.0.0.1:8888" }, { "https", "127.0.0.1:8888" } },
+ cpr::VerifySsl { false }));
+#else
+ m_futures.push_back(cpr::PutCallback(
+ std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb),
+ url, headers, body));
+#endif
+}
+
void HTTPClient::MakeGET(std::string path, std::function<void(cpr::Response r)> cb) {
printf("GET %s\n", path.c_str());
auto url = cpr::Url { m_api_base + path };