changed request_sync() to request()
This commit is contained in:
parent
61878d6371
commit
a9080f8cda
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ const std::uint16_t API::get_stream(const Mastodon::API::v1 &call,
|
|||
}
|
||||
|
||||
ptr = std::make_unique<http>(*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<http>(*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<http> &ptr)
|
||||
{
|
||||
ptr = std::make_unique<http>(*this, _instance, _access_token);
|
||||
return ptr->request_sync(http::method::GET_STREAM, call, answer);
|
||||
return ptr->request(http::method::GET_STREAM, call, answer);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
Reference in New Issue