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;
|
string answer;
|
||||||
return _http.request_sync(http::method::DELETE, strcall,
|
return _http.request(http::method::DELETE, strcall,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::uint16_t API::del(const Mastodon::API::v1 &call,
|
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;
|
string answer;
|
||||||
return _http.request_sync(http::method::DELETE, strcall,
|
return _http.request(http::method::DELETE, strcall,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::uint16_t API::del(const std::string &call,
|
const std::uint16_t API::del(const std::string &call,
|
||||||
const parametermap ¶meters, string &answer)
|
const parametermap ¶meters, string &answer)
|
||||||
{
|
{
|
||||||
|
|
||||||
return _http.request_sync(http::method::DELETE, call,
|
return _http.request(http::method::DELETE, call,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ const std::uint16_t API::get(const Mastodon::API::v1 &call,
|
||||||
strcall += maptostr(parameters);
|
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,
|
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);
|
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)
|
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);
|
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,
|
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);
|
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,
|
const std::uint16_t API::get_stream(const std::string &call, string &answer,
|
||||||
std::unique_ptr<http> &ptr)
|
std::unique_ptr<http> &ptr)
|
||||||
{
|
{
|
||||||
ptr = std::make_unique<http>(*this, _instance, _access_token);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _http.request_sync(API::http::method::PATCH,
|
return _http.request(API::http::method::PATCH,
|
||||||
strcall, maptoformdata(parameters), answer);
|
strcall, maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ const std::uint16_t API::post(const Mastodon::API::v1 &call,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _http.request_sync(http::method::POST, strcall,
|
return _http.request(http::method::POST, strcall,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::uint16_t API::post(const Mastodon::API::v1 &call,
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _http.request_sync(http::method::POST, strcall,
|
return _http.request(http::method::POST, strcall,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::uint16_t API::post(const std::string &call,
|
const std::uint16_t API::post(const std::string &call,
|
||||||
const parametermap ¶meters, string &answer)
|
const parametermap ¶meters, string &answer)
|
||||||
{
|
{
|
||||||
|
|
||||||
return _http.request_sync(http::method::POST, call,
|
return _http.request(http::method::POST, call,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,14 @@ const std::uint16_t API::put(const Mastodon::API::v1 &call,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _http.request_sync(http::method::PUT, strcall,
|
return _http.request(http::method::PUT, strcall,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::uint16_t API::put(const std::string &call,
|
const std::uint16_t API::put(const std::string &call,
|
||||||
const parametermap ¶meters, string &answer)
|
const parametermap ¶meters, string &answer)
|
||||||
{
|
{
|
||||||
|
|
||||||
return _http.request_sync(http::method::PUT, call,
|
return _http.request(http::method::PUT, call,
|
||||||
maptoformdata(parameters), answer);
|
maptoformdata(parameters), answer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,17 +48,17 @@ API::http::~http()
|
||||||
curlpp::terminate();
|
curlpp::terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::uint16_t API::http::request_sync(const method &meth,
|
const std::uint16_t API::http::request(const method &meth,
|
||||||
const string &path,
|
const string &path,
|
||||||
string &answer)
|
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 std::uint16_t API::http::request(const method &meth,
|
||||||
const string &path,
|
const string &path,
|
||||||
const curlpp::Forms &formdata,
|
const curlpp::Forms &formdata,
|
||||||
string &answer)
|
string &answer)
|
||||||
{
|
{
|
||||||
using namespace std::placeholders; // _1, _2, _3
|
using namespace std::placeholders; // _1, _2, _3
|
||||||
|
|
|
@ -82,9 +82,9 @@ public:
|
||||||
explicit http(const API &api, const std::string &instance,
|
explicit http(const API &api, const std::string &instance,
|
||||||
const std::string &access_token);
|
const std::string &access_token);
|
||||||
~http();
|
~http();
|
||||||
const std::uint16_t request_sync(const method &meth,
|
const std::uint16_t request(const method &meth,
|
||||||
const std::string &path,
|
const std::string &path,
|
||||||
std::string &answer);
|
std::string &answer);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Blocking request.
|
* @brief Blocking request.
|
||||||
|
@ -99,10 +99,10 @@ public:
|
||||||
* @return @ref error "Error code". If the URL has permanently changed,
|
* @return @ref error "Error code". If the URL has permanently changed,
|
||||||
* 13 is returned and answer is set to the new URL.
|
* 13 is returned and answer is set to the new URL.
|
||||||
*/
|
*/
|
||||||
const std::uint16_t request_sync(const method &meth,
|
const std::uint16_t request(const method &meth,
|
||||||
const std::string &path,
|
const std::string &path,
|
||||||
const curlpp::Forms &formdata,
|
const curlpp::Forms &formdata,
|
||||||
std::string &answer);
|
std::string &answer);
|
||||||
|
|
||||||
const void get_headers(std::string &headers) const;
|
const void get_headers(std::string &headers) const;
|
||||||
|
|
||||||
|
|
Reference in New Issue