summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api.cpp10
-rw-r--r--src/connection.cpp3
2 files changed, 7 insertions, 6 deletions
diff --git a/src/api.cpp b/src/api.cpp
index 98a1d7f..fd7eede 100644
--- a/src/api.cpp
+++ b/src/api.cpp
@@ -19,8 +19,11 @@
namespace mastodonpp
{
-API::API()
- : _endpoint_map
+API::API(const endpoint_type &endpoint)
+ : _endpoint{endpoint}
+{}
+
+const map<API::endpoint_type,string_view> API::_endpoint_map
{
{v1::apps, "/api/v1/apps"},
{v1::apps_verify_credentials, "/api/v1/apps/verify/credentials"},
@@ -238,7 +241,6 @@ API::API()
"/api/pleroma/pleroma/notification_settings"},
{pleroma::pleroma_healthcheck, "/api/pleroma/pleroma/healthcheck"},
{pleroma::pleroma_change_email, "/api/pleroma/pleroma/change_email"},
-}
-{}
+};
} // namespace mastodonpp
diff --git a/src/connection.cpp b/src/connection.cpp
index cc956e0..e6bca95 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -22,14 +22,13 @@ namespace mastodonpp
Connection::Connection(Instance &instance)
: _instance{instance}
, _baseuri{instance.get_baseuri()}
- , _api{}
{}
answer_type Connection::get(const API::endpoint_type &endpoint)
{
return make_request(
http_method::GET,
- string(_baseuri).append(_api.endpoint_to_string_view(endpoint)));
+ string(_baseuri).append(API{endpoint}.to_string_view()));
}
answer_type Connection::get(const string_view &endpoint)