From a9080f8cda37d4d201f7d50da72012d49ebd6f43 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 13 Mar 2018 14:37:44 +0100 Subject: [PATCH] changed request_sync() to request() --- src/api_delete.cpp | 12 ++++++------ src/api_get.cpp | 6 +++--- src/api_get_stream.cpp | 6 +++--- src/api_patch.cpp | 4 ++-- src/api_post.cpp | 12 ++++++------ src/api_put.cpp | 8 ++++---- src/{http_sync.cpp => http.cpp} | 16 ++++++++-------- src/mastodon-cpp.hpp | 14 +++++++------- 8 files changed, 39 insertions(+), 39 deletions(-) rename src/{http_sync.cpp => http.cpp} (91%) diff --git a/src/api_delete.cpp b/src/api_delete.cpp index 3e5169a..c0a9c65 100644 --- a/src/api_delete.cpp +++ b/src/api_delete.cpp @@ -41,8 +41,8 @@ const std::uint16_t API::del(const Mastodon::API::v1 &call, } string answer; - return _http.request_sync(http::method::DELETE, strcall, - maptoformdata(parameters), answer); + return _http.request(http::method::DELETE, strcall, + maptoformdata(parameters), answer); } const std::uint16_t API::del(const Mastodon::API::v1 &call, @@ -76,14 +76,14 @@ const std::uint16_t API::del(const Mastodon::API::v1 &call, } string answer; - return _http.request_sync(http::method::DELETE, strcall, - maptoformdata(parameters), answer); + return _http.request(http::method::DELETE, strcall, + maptoformdata(parameters), answer); } const std::uint16_t API::del(const std::string &call, const parametermap ¶meters, string &answer) { - return _http.request_sync(http::method::DELETE, call, - maptoformdata(parameters), answer); + return _http.request(http::method::DELETE, call, + maptoformdata(parameters), answer); } diff --git a/src/api_get.cpp b/src/api_get.cpp index cc6906c..c39d0f1 100644 --- a/src/api_get.cpp +++ b/src/api_get.cpp @@ -88,7 +88,7 @@ const std::uint16_t API::get(const Mastodon::API::v1 &call, strcall += maptostr(parameters); } - return _http.request_sync(http::method::GET, strcall, answer); + return _http.request(http::method::GET, strcall, answer); } const std::uint16_t API::get(const Mastodon::API::v1 &call, @@ -175,10 +175,10 @@ const std::uint16_t API::get(const Mastodon::API::v1 &call, strcall += maptostr(parameters, firstparam); } - return _http.request_sync(http::method::GET, strcall, answer); + return _http.request(http::method::GET, strcall, answer); } const std::uint16_t API::get(const std::string &call, string &answer) { - return _http.request_sync(http::method::GET, call, answer); + return _http.request(http::method::GET, call, answer); } diff --git a/src/api_get_stream.cpp b/src/api_get_stream.cpp index 313b52d..92d946b 100644 --- a/src/api_get_stream.cpp +++ b/src/api_get_stream.cpp @@ -47,7 +47,7 @@ const std::uint16_t API::get_stream(const Mastodon::API::v1 &call, } ptr = std::make_unique(*this, _instance, _access_token); - return ptr->request_sync(http::method::GET_STREAM, strcall, answer); + return ptr->request(http::method::GET_STREAM, strcall, answer); } const std::uint16_t API::get_stream(const Mastodon::API::v1 &call, @@ -74,12 +74,12 @@ const std::uint16_t API::get_stream(const Mastodon::API::v1 &call, } ptr = std::make_unique(*this, _instance, _access_token); - return ptr->request_sync(http::method::GET_STREAM, strcall, answer); + return ptr->request(http::method::GET_STREAM, strcall, answer); } const std::uint16_t API::get_stream(const std::string &call, string &answer, std::unique_ptr &ptr) { ptr = std::make_unique(*this, _instance, _access_token); - return ptr->request_sync(http::method::GET_STREAM, call, answer); + return ptr->request(http::method::GET_STREAM, call, answer); } diff --git a/src/api_patch.cpp b/src/api_patch.cpp index c167061..bd8857b 100644 --- a/src/api_patch.cpp +++ b/src/api_patch.cpp @@ -39,6 +39,6 @@ const std::uint16_t API::patch(const Mastodon::API::v1 &call, break; } - return _http.request_sync(API::http::method::PATCH, - strcall, maptoformdata(parameters), answer); + return _http.request(API::http::method::PATCH, + strcall, maptoformdata(parameters), answer); } diff --git a/src/api_post.cpp b/src/api_post.cpp index 3238f1f..8085ce4 100644 --- a/src/api_post.cpp +++ b/src/api_post.cpp @@ -70,8 +70,8 @@ const std::uint16_t API::post(const Mastodon::API::v1 &call, break; } - return _http.request_sync(http::method::POST, strcall, - maptoformdata(parameters), answer); + return _http.request(http::method::POST, strcall, + maptoformdata(parameters), answer); } const std::uint16_t API::post(const Mastodon::API::v1 &call, @@ -146,14 +146,14 @@ const std::uint16_t API::post(const Mastodon::API::v1 &call, break; } - return _http.request_sync(http::method::POST, strcall, - maptoformdata(parameters), answer); + return _http.request(http::method::POST, strcall, + maptoformdata(parameters), answer); } const std::uint16_t API::post(const std::string &call, const parametermap ¶meters, string &answer) { - return _http.request_sync(http::method::POST, call, - maptoformdata(parameters), answer); + return _http.request(http::method::POST, call, + maptoformdata(parameters), answer); } diff --git a/src/api_put.cpp b/src/api_put.cpp index 01cb1e4..4acbe89 100644 --- a/src/api_put.cpp +++ b/src/api_put.cpp @@ -42,14 +42,14 @@ const std::uint16_t API::put(const Mastodon::API::v1 &call, break; } - return _http.request_sync(http::method::PUT, strcall, - maptoformdata(parameters), answer); + return _http.request(http::method::PUT, strcall, + maptoformdata(parameters), answer); } const std::uint16_t API::put(const std::string &call, const parametermap ¶meters, string &answer) { - return _http.request_sync(http::method::PUT, call, - maptoformdata(parameters), answer); + return _http.request(http::method::PUT, call, + maptoformdata(parameters), answer); } diff --git a/src/http_sync.cpp b/src/http.cpp similarity index 91% rename from src/http_sync.cpp rename to src/http.cpp index 361b67d..01592f0 100644 --- a/src/http_sync.cpp +++ b/src/http.cpp @@ -48,17 +48,17 @@ API::http::~http() curlpp::terminate(); } -const std::uint16_t API::http::request_sync(const method &meth, - const string &path, - string &answer) +const std::uint16_t API::http::request(const method &meth, + const string &path, + string &answer) { - return request_sync(meth, path, curlpp::Forms(), answer); + return request(meth, path, curlpp::Forms(), answer); } -const std::uint16_t API::http::request_sync(const method &meth, - const string &path, - const curlpp::Forms &formdata, - string &answer) +const std::uint16_t API::http::request(const method &meth, + const string &path, + const curlpp::Forms &formdata, + string &answer) { using namespace std::placeholders; // _1, _2, _3 diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index d954587..422e51e 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -82,9 +82,9 @@ public: explicit http(const API &api, const std::string &instance, const std::string &access_token); ~http(); - const std::uint16_t request_sync(const method &meth, - const std::string &path, - std::string &answer); + const std::uint16_t request(const method &meth, + const std::string &path, + std::string &answer); /*! * @brief Blocking request. @@ -99,10 +99,10 @@ public: * @return @ref error "Error code". If the URL has permanently changed, * 13 is returned and answer is set to the new URL. */ - const std::uint16_t request_sync(const method &meth, - const std::string &path, - const curlpp::Forms &formdata, - std::string &answer); + const std::uint16_t request(const method &meth, + const std::string &path, + const curlpp::Forms &formdata, + std::string &answer); const void get_headers(std::string &headers) const;