diff --git a/docs/annotated.html b/docs/annotated.html
index ccb5802..d3e10be 100644
--- a/docs/annotated.html
+++ b/docs/annotated.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/answer_8hpp_source.html b/docs/answer_8hpp_source.html
index 744d7b2..77859b6 100644
--- a/docs/answer_8hpp_source.html
+++ b/docs/answer_8hpp_source.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/api_8hpp_source.html b/docs/api_8hpp_source.html
index 6fee414..83d60e0 100644
--- a/docs/api_8hpp_source.html
+++ b/docs/api_8hpp_source.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
@@ -307,9 +307,9 @@ $(function() {
- 284 pleroma_notification_settings,
-
-
+ 284 notification_settings,
+
+
diff --git a/docs/classes.html b/docs/classes.html
index 03a5e88..4402b3d 100644
--- a/docs/classes.html
+++ b/docs/classes.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/classmastodonpp_1_1API-members.html b/docs/classmastodonpp_1_1API-members.html
index 12b20e7..9db919e 100644
--- a/docs/classmastodonpp_1_1API-members.html
+++ b/docs/classmastodonpp_1_1API-members.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/classmastodonpp_1_1API.html b/docs/classmastodonpp_1_1API.html
index 4e53a32..2de18d6 100644
--- a/docs/classmastodonpp_1_1API.html
+++ b/docs/classmastodonpp_1_1API.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
@@ -282,9 +282,9 @@ Public Types
disable_account,
account_register,
-pleroma_notification_settings,
-pleroma_healthcheck,
-pleroma_change_email
+notification_settings,
+healthcheck,
+change_email
}
| An enumeration of all pleroma API endpoints. More...
|
@@ -443,9 +443,9 @@ Public Member Functions
- 284 pleroma_notification_settings,
-
-
+ 284 notification_settings,
+
+
diff --git a/docs/classmastodonpp_1_1CURLException-members.html b/docs/classmastodonpp_1_1CURLException-members.html
index c4e2916..d235803 100644
--- a/docs/classmastodonpp_1_1CURLException-members.html
+++ b/docs/classmastodonpp_1_1CURLException-members.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/classmastodonpp_1_1CURLException.html b/docs/classmastodonpp_1_1CURLException.html
index 5ee22c8..fc1c1fd 100644
--- a/docs/classmastodonpp_1_1CURLException.html
+++ b/docs/classmastodonpp_1_1CURLException.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/classmastodonpp_1_1CURLWrapper-members.html b/docs/classmastodonpp_1_1CURLWrapper-members.html
index b530241..d085831 100644
--- a/docs/classmastodonpp_1_1CURLWrapper-members.html
+++ b/docs/classmastodonpp_1_1CURLWrapper-members.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
diff --git a/docs/classmastodonpp_1_1CURLWrapper.html b/docs/classmastodonpp_1_1CURLWrapper.html
index 27ce838..2de9447 100644
--- a/docs/classmastodonpp_1_1CURLWrapper.html
+++ b/docs/classmastodonpp_1_1CURLWrapper.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
@@ -300,9 +300,9 @@ Protected Attributes
Cancel the stream.
The stream will be cancelled, usually whithin a second. The curl_error_code of the answer will be set to 42 (CURLE_ABORTED_BY_CALLBACK
).
- Since
- 0.1.0
-
-
201 _stream_cancelled =
true;
-
+
+
206 _stream_cancelled =
true;
+
@@ -331,9 +331,9 @@ Protected Attributes
Returns a reference to the buffer libcurl writes into.
- Since
- 0.1.0
-
-
187 return _curl_buffer_body;
-
+
+
192 return _curl_buffer_body;
+
@@ -363,9 +363,9 @@ Protected Attributes
Returns pointer to the CURL easy handle.
You can use this handle to set or modify curl options. For more information consult curl_easy_setopt(3).
- Since
- 0.1.0
-
@@ -454,61 +454,85 @@ Protected Attributes
112 case http_method::PATCH:
-
- 115 code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST,
"PATCH");
-
-
- 118 case http_method::PUT:
-
-
- 121 code = curl_easy_setopt(_connection, CURLOPT_UPLOAD, 1L);
-
-
- 124 case http_method::DELETE:
-
-
- 127 code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST,
"DELETE");
-
-
-
- 131 if (code != CURLE_OK)
-
- 133 throw CURLException{code,
"Failed to set HTTP method",
-
-
- 136 debuglog <<
"Making request to: " << uri <<
'\n';
+ 114 if (!parameters.empty())
+
+ 116 curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
+
+ 118 code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
+
+
+
+ 122 code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST,
"PATCH");
+
+
+
+ 126 case http_method::PUT:
+
+ 128 if (!parameters.empty())
+
+ 130 curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
+
+ 132 code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
+
+
+
+ 136 code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST,
"PUT");
-
- 139 code = curl_easy_setopt(_connection, CURLOPT_URL, uri.data());
- 140 if (code != CURLE_OK)
+
+
+ 140 case http_method::DELETE:
- 142 throw CURLException{code,
"Failed to set URI", _curl_buffer_error};
-
-
-
- 146 code = curl_easy_perform(_connection);
-
- 148 || (code == CURLE_ABORTED_BY_CALLBACK && _stream_cancelled))
-
-
-
- 152 curl_easy_getinfo(_connection, CURLINFO_RESPONSE_CODE, &http_status);
- 153 answer.http_status = static_cast<uint16_t>(http_status);
- 154 debuglog <<
"HTTP status code: " << http_status <<
'\n';
-
- 156 answer.headers = _curl_buffer_headers;
- 157 answer.body = _curl_buffer_body;
-
-
-
- 161 answer.curl_error_code = static_cast<uint8_t>(code);
- 162 answer.error_message = _curl_buffer_error;
- 163 debuglog <<
"libcurl error: " << code <<
'\n';
- 164 debuglog << _curl_buffer_error <<
'\n';
-
-
-
-
+ 142 if (!parameters.empty())
+
+ 144 curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
+
+ 146 code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
+
+
+
+ 150 code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST,
"DELETE");
+
+
+
+
+ 155 if (code != CURLE_OK)
+
+ 157 throw CURLException{code,
"Failed to set HTTP method",
+
+
+ 160 debuglog <<
"Making request to: " << uri <<
'\n';
+
+
+ 163 code = curl_easy_setopt(_connection, CURLOPT_URL, uri.data());
+ 164 if (code != CURLE_OK)
+
+ 166 throw CURLException{code,
"Failed to set URI", _curl_buffer_error};
+
+
+
+ 170 code = curl_easy_perform(_connection);
+
+ 172 || (code == CURLE_ABORTED_BY_CALLBACK && _stream_cancelled))
+
+
+
+ 176 curl_easy_getinfo(_connection, CURLINFO_RESPONSE_CODE, &http_status);
+ 177 answer.http_status = static_cast<uint16_t>(http_status);
+ 178 debuglog <<
"HTTP status code: " << http_status <<
'\n';
+
+ 180 answer.headers = _curl_buffer_headers;
+ 181 answer.body = _curl_buffer_body;
+
+
+
+ 185 answer.curl_error_code = static_cast<uint8_t>(code);
+ 186 answer.error_message = _curl_buffer_error;
+ 187 debuglog <<
"libcurl error: " << code <<
'\n';
+ 188 debuglog << _curl_buffer_error <<
'\n';
+
+
+
+
@@ -594,30 +618,30 @@ Protected Attributes
Set OAuth 2.0 Bearer Access Token.
- Since
- 0.1.0
-
-
-
173 CURLcode code{curl_easy_setopt(_connection, CURLOPT_XOAUTH2_BEARER,
-
174 access_token.data())};
-
175 if (code != CURLE_OK)
-
-
177 throw CURLException{code,
"Could not set authorization token.",
-
-
-
-
181 #if (LIBCURL_VERSION_NUM < 0x073d00) // libcurl < 7.61.0.
-
182 #define CURLAUTH_BEARER CURLAUTH_ANY
-
-
-
-
186 code = curl_easy_setopt(_connection, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);
-
187 if (code != CURLE_OK)
-
-
189 throw CURLException{code,
"Could not set authorization token.",
-
-
-
-
193 debuglog <<
"Set authorization token.\n";
-
+
+
+
197 CURLcode code{curl_easy_setopt(_connection, CURLOPT_XOAUTH2_BEARER,
+
198 access_token.data())};
+
199 if (code != CURLE_OK)
+
+
201 throw CURLException{code,
"Could not set authorization token.",
+
+
+
+
205 #if (LIBCURL_VERSION_NUM < 0x073d00) // libcurl < 7.61.0.
+
206 #define CURLAUTH_BEARER CURLAUTH_ANY
+
+
+
+
210 code = curl_easy_setopt(_connection, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);
+
211 if (code != CURLE_OK)
+
+
213 throw CURLException{code,
"Could not set authorization token.",
+
+
+
+
217 debuglog <<
"Set authorization token.\n";
+
diff --git a/docs/classmastodonpp_1_1Connection-members.html b/docs/classmastodonpp_1_1Connection-members.html
index b1ebb6d..d11b165 100644
--- a/docs/classmastodonpp_1_1Connection-members.html
+++ b/docs/classmastodonpp_1_1Connection-members.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
@@ -79,6 +79,8 @@ $(function() {
CURLWrapper() | mastodonpp::CURLWrapper | |
CURLWrapper(const CURLWrapper &other)=delete | mastodonpp::CURLWrapper | |
CURLWrapper(CURLWrapper &&other) noexcept=delete | mastodonpp::CURLWrapper | |
+ del(const endpoint_variant &endpoint, const parametermap ¶meters) | mastodonpp::Connection | |
+ del(const endpoint_variant &endpoint) | mastodonpp::Connection | inline |
get(const endpoint_variant &endpoint, const parametermap ¶meters) | mastodonpp::Connection | |
get(const endpoint_variant &endpoint) | mastodonpp::Connection | inline |
get_buffer() | mastodonpp::CURLWrapper | inlineprotected |
@@ -88,8 +90,12 @@ $(function() {
make_request(const http_method &method, string uri, const parametermap ¶meters) | mastodonpp::CURLWrapper | protected |
operator=(const CURLWrapper &other)=delete | mastodonpp::CURLWrapper | |
operator=(CURLWrapper &&other) noexcept=delete | mastodonpp::CURLWrapper | |
+ patch(const endpoint_variant &endpoint, const parametermap ¶meters) | mastodonpp::Connection | |
+ patch(const endpoint_variant &endpoint) | mastodonpp::Connection | inline |
post(const endpoint_variant &endpoint, const parametermap ¶meters) | mastodonpp::Connection | |
post(const endpoint_variant &endpoint) | mastodonpp::Connection | inline |
+ put(const endpoint_variant &endpoint, const parametermap ¶meters) | mastodonpp::Connection | |
+ put(const endpoint_variant &endpoint) | mastodonpp::Connection | inline |
set_access_token(const string_view access_token) | mastodonpp::CURLWrapper | protected |
set_proxy(string_view proxy) | mastodonpp::CURLWrapper | |
~CURLWrapper() noexcept | mastodonpp::CURLWrapper | virtual |
diff --git a/docs/classmastodonpp_1_1Connection.html b/docs/classmastodonpp_1_1Connection.html
index 0a1fe79..1b043ba 100644
--- a/docs/classmastodonpp_1_1Connection.html
+++ b/docs/classmastodonpp_1_1Connection.html
@@ -22,7 +22,7 @@
mastodonpp
- 0.1.0
+ 0.2.0
|
@@ -105,6 +105,24 @@ Public Member Functions
answer_type | post (const endpoint_variant &endpoint) |
| Make a HTTP POST call. More...
|
|
+answer_type | patch (const endpoint_variant &endpoint, const parametermap ¶meters) |
+ | Make a HTTP PATCH call with parameters. More...
|
+ |
+answer_type | patch (const endpoint_variant &endpoint) |
+ | Make a HTTP PATCH call. More...
|
+ |
+answer_type | put (const endpoint_variant &endpoint, const parametermap ¶meters) |
+ | Make a HTTP PUT call with parameters. More...
|
+ |
+answer_type | put (const endpoint_variant &endpoint) |
+ | Make a HTTP PUT call. More...
|
+ |
+answer_type | del (const endpoint_variant &endpoint, const parametermap ¶meters) |
+ | Make a HTTP DELETE call with parameters. More...
|
+ |
+answer_type | del (const endpoint_variant &endpoint) |
+ | Make a HTTP DELETE call. More...
|
+ |
string | get_new_stream_contents () |
| Copy new stream contents and delete the “original”. More...
|
|
@@ -240,9 +258,89 @@ Additional Inherited Members
Cancel the stream.
The stream will be cancelled, usually whithin a second. The curl_error_code of the answer will be set to 42 (CURLE_ABORTED_BY_CALLBACK
).
- Since
- 0.1.0
-
+
+
+◆ del() [1/2]
+
+
+
+
+
Make a HTTP DELETE call.
+
- Parameters
-
+
+
+
+
- Since
- 0.2.0
+
+
239 return del(endpoint, {});
+
+
+
+
+
+◆ del() [2/2]
+
+
+
+
+
Make a HTTP DELETE call with parameters.
+
- Parameters
-
+
+ endpoint | Endpoint as API::endpoint_type or std::string_view . |
+ parameters | A map of parameters. |
+
+
+
+
- Since
- 0.2.0
+
+
+
82 endpoint_to_uri(endpoint), parameters);
+
@@ -349,33 +447,33 @@ Additional Inherited Members
Get new stream events.
- Since
- 0.1.0
-
-
-
-
78 vector<event_type> events;
-
-
-
81 while ((pos = buffer.find(
"event: ")) != string::npos)
-
-
83 const auto endpos{buffer.find(
"\n\n", pos)};
-
84 if (endpos == string::npos)
-
-
-
-
-
-
-
91 event.type = buffer.substr(pos, buffer.find(
'\n', pos) - pos);
-
92 pos = buffer.find(
"data: ") + 6;
-
93 event.data = buffer.substr(pos, endpos - pos);
-
94 events.push_back(event);
-
-
96 buffer.erase(0, endpos);
-
-
-
-
-
+
+
+
+
99 vector<event_type> events;
+
+
+
102 while ((pos = buffer.find(
"event: ")) != string::npos)
+
+
104 const auto endpos{buffer.find(
"\n\n", pos)};
+
105 if (endpos == string::npos)
+
+
+
+
+
+
+
112 event.type = buffer.substr(pos, buffer.find(
'\n', pos) - pos);
+
113 pos = buffer.find(
"data: ") + 6;
+
114 event.data = buffer.substr(pos, endpos - pos);
+
115 events.push_back(event);
+
+
117 buffer.erase(0, endpos);
+
+
+
+
+
@@ -398,14 +496,94 @@ Additional Inherited Members
Note that the last event is not necessarily complete, it could happen that you are calling this function mid-transfer. You have to check the data integrity yourself.
Using get_new_events() instead is recommended.
- Since
- 0.1.0
-
-
-
-
68 auto buffer_copy{buffer};
-
-
-
-
+
+
+
+
89 auto buffer_copy{buffer};
+
+
+
+
+
+
+
+
+◆ patch() [1/2]
+
+
+
+
+
Make a HTTP PATCH call.
+
- Parameters
-
+
+
+
+
- Since
- 0.2.0
+
+
187 return patch(endpoint, {});
+
+
+
+
+
+◆ patch() [2/2]
+
+
+
+
+
Make a HTTP PATCH call with parameters.
+
- Parameters
-
+
+ endpoint | Endpoint as API::endpoint_type or std::string_view . |
+ parameters | A map of parameters. |
+
+
+
+
- Since
- 0.2.0
+
+
+
68 endpoint_to_uri(endpoint), parameters);
+
@@ -496,6 +674,86 @@ Additional Inherited Members
+
+◆ put() [1/2]
+
+
+
+
+
Make a HTTP PUT call.
+
- Parameters
-
+
+
+
+
- Since
- 0.2.0
+
+
213 return put(endpoint, {});
+
+
+
+
+
+◆ put() [2/2]
+
+
+
+
+
Make a HTTP PUT call with parameters.
+
- Parameters
-
+
+ endpoint | Endpoint as API::endpoint_type or std::string_view . |
+ parameters | A map of parameters. |
+
+
+
+
- Since
- 0.2.0
+
+
+
75 endpoint_to_uri(endpoint), parameters);
+
+
+
+
The documentation for this class was generated from the following files:
- include/connection.hpp
- src/connection.cpp
@@ -503,14 +761,17 @@ Additional Inherited Members
answer_type get(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP GET call with parameters.
Definition: connection.cpp:50
string_view get_proxy() const
Returns the proxy string that was previously set.
Definition: instance.hpp:132
-void set_access_token(const string_view access_token)
Set OAuth 2.0 Bearer Access Token.
Definition: curl_wrapper.cpp:170
+void set_access_token(const string_view access_token)
Set OAuth 2.0 Bearer Access Token.
Definition: curl_wrapper.cpp:194
string_view get_access_token() const
Returns the access token.
Definition: instance.hpp:87
-mutex buffer_mutex
Mutex for get_buffer a.k.a. _curl_buffer_body.
Definition: curl_wrapper.hpp:164
-string & get_buffer()
Returns a reference to the buffer libcurl writes into.
Definition: curl_wrapper.hpp:185
+answer_type put(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP PUT call with parameters.
Definition: connection.cpp:71
+mutex buffer_mutex
Mutex for get_buffer a.k.a. _curl_buffer_body.
Definition: curl_wrapper.hpp:169
+string & get_buffer()
Returns a reference to the buffer libcurl writes into.
Definition: curl_wrapper.hpp:190
+answer_type del(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP DELETE call with parameters.
Definition: connection.cpp:78
void set_proxy(string_view proxy)
Set the proxy to use.
Definition: curl_wrapper.cpp:67
+answer_type patch(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP PATCH call with parameters.
Definition: connection.cpp:64
answer_type post(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP POST call with parameters.
Definition: connection.cpp:57
answer_type make_request(const http_method &method, string uri, const parametermap ¶meters)
Make a HTTP request.
Definition: curl_wrapper.cpp:77
-void cancel_stream()
Cancel the stream.
Definition: curl_wrapper.hpp:199
+void cancel_stream()
Cancel the stream.
Definition: curl_wrapper.hpp:204