Renamed “Request” to “Connection”.

It will be used not for only one request, but for all requests to an instance.
This commit is contained in:
tastytea 2020-01-05 09:38:13 +01:00
parent edc2bba718
commit f872707036
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 16 additions and 16 deletions

View File

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MASTODONPP_REQUEST_HPP
#define MASTODONPP_REQUEST_HPP
#ifndef MASTODONPP_CONNECTION_HPP
#define MASTODONPP_CONNECTION_HPP
#include "api.hpp"
#include "curl_wrapper.hpp"
@ -30,23 +30,23 @@ namespace mastodonpp
using std::string;
/*!
* @brief Used to make a request to the Mastodon %API.
* @brief Represents a connection to an instance. Used for requests.
*
* @since 0.1.0
*
* @headerfile request.hpp mastodonpp/request.hpp
* @headerfile connection.hpp mastodonpp/connection.hpp
*/
class Request : public CURLWrapper
class Connection : public CURLWrapper
{
public:
/*!
* @brief Construct a new Request object.
* @brief Construct a new Connection object.
*
* @param instance An Instance with the access data.
*
* @since 0.1.0
*/
explicit Request(Instance &instance);
explicit Connection(Instance &instance);
/*!
* @brief Make a HTTP GET call.
@ -75,4 +75,4 @@ private:
} // namespace mastodonpp
#endif // MASTODONPP_REQUEST_HPP
#endif // MASTODONPP_CONNECTION_HPP

View File

@ -20,7 +20,7 @@
#include "api.hpp"
#include "exceptions.hpp"
#include "instance.hpp"
#include "request.hpp"
#include "connection.hpp"
#include "return_types.hpp"
/*!

View File

@ -14,23 +14,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "request.hpp"
#include "connection.hpp"
namespace mastodonpp
{
Request::Request(Instance &instance)
Connection::Connection(Instance &instance)
: _instance{instance}
{}
answer_type Request::get(API::endpoint_type endpoint)
answer_type Connection::get(API::endpoint_type endpoint)
{
answer_type answer;
answer.body = API{endpoint}.to_string();
return answer;
}
answer_type Request::get(string endpoint)
answer_type Connection::get(string endpoint)
{
answer_type answer;
answer.body = make_request(http_method::GET, "https://ip.tastytea.de/");

View File

@ -15,7 +15,7 @@
*/
#include "instance.hpp"
#include "request.hpp"
#include "connection.hpp"
#include <catch.hpp>
@ -48,12 +48,12 @@ SCENARIO ("Instantiations.")
}
}
WHEN ("Request is instantiated.")
WHEN ("Connection is instantiated.")
{
try
{
Instance instance{"example.com", ""};
Request request{instance};
Connection connection{instance};
}
catch (const std::exception &e)
{