summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/api.hpp10
-rw-r--r--include/connection.hpp7
-rw-r--r--include/curl_wrapper.hpp4
3 files changed, 13 insertions, 8 deletions
diff --git a/include/api.hpp b/include/api.hpp
index 2fb26d8..72ca3f7 100644
--- a/include/api.hpp
+++ b/include/api.hpp
@@ -18,13 +18,13 @@
#define MASTODONPP_API_HPP
#include <map>
-#include <string>
+#include <string_view>
#include <variant>
namespace mastodonpp
{
-using std::string;
+using std::string_view;
using std::variant;
/*!
@@ -76,15 +76,15 @@ public:
*
* @since 0.1.0
*/
- explicit API(endpoint_type &endpoint);
+ explicit API(const endpoint_type &endpoint);
/*!
- * @brief Convert #endpoint_type to string.
+ * @brief Convert #endpoint_type to `std::string_view`.
*
* @since 0.1.0
*/
[[nodiscard]]
- string to_string() const;
+ string_view to_string_view() const;
private:
const endpoint_type _endpoint;
diff --git a/include/connection.hpp b/include/connection.hpp
index 1db8286..a26120c 100644
--- a/include/connection.hpp
+++ b/include/connection.hpp
@@ -23,11 +23,13 @@
#include "return_types.hpp"
#include <string>
+#include <string_view>
namespace mastodonpp
{
using std::string;
+using std::string_view;
/*!
* @brief Represents a connection to an instance. Used for requests.
@@ -57,7 +59,7 @@ public:
* @since 0.1.0
*/
[[nodiscard]]
- answer_type get(API::endpoint_type endpoint);
+ answer_type get(const API::endpoint_type &endpoint);
/*!
* @brief Make a HTTP GET call.
@@ -67,10 +69,11 @@ public:
* @since 0.1.0
*/
[[nodiscard]]
- answer_type get(string endpoint);
+ answer_type get(const string_view &endpoint);
private:
Instance &_instance;
+ const string_view _baseuri;
};
} // namespace mastodonpp
diff --git a/include/curl_wrapper.hpp b/include/curl_wrapper.hpp
index 6a088ff..c98a6a9 100644
--- a/include/curl_wrapper.hpp
+++ b/include/curl_wrapper.hpp
@@ -17,6 +17,8 @@
#ifndef MASTODONPP_CURL_WRAPPER_HPP
#define MASTODONPP_CURL_WRAPPER_HPP
+#include "return_types.hpp"
+
#include "curl/curl.h"
#include <string>
@@ -89,7 +91,7 @@ public:
* @since 0.1.0
*/
[[nodiscard]]
- string make_request(const http_method &meth, const string_view &uri);
+ answer_type make_request(const http_method &meth, const string_view &uri);
private:
CURL *_connection;