mastodonpp
0.5.7
C++ wrapper for the Mastodon and Pleroma APIs.
|
17 #ifndef MASTODONPP_CONNECTION_HPP
18 #define MASTODONPP_CONNECTION_HPP
21 #include "curl_wrapper.hpp"
22 #include "instance.hpp"
26 #include <string_view>
34 using std::string_view;
149 return get(endpoint, {});
184 return post(endpoint, {});
208 return patch(endpoint, {});
232 return put(endpoint, {});
256 return del(endpoint, {});
287 const string_view _baseuri;
295 #endif // MASTODONPP_CONNECTION_HPP
answer_type get(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP GET call with parameters.
Definition: connection.cpp:34
void copy_connection_properties(CURLWrapper &curlwrapper) const
Set the properties of the connection of the calling class up.
Definition: instance.hpp:90
Connection(const Instance &instance)
Construct a new Connection object.
Definition: connection.hpp:88
string type
The type of the event.
Definition: connection.hpp:62
answer_type post(const endpoint_variant &endpoint)
Make a HTTP POST call.
Definition: connection.hpp:182
map< string_view, variant< string_view, vector< string_view > >> parametermap
std::map of parameters for API calls.
Definition: types.hpp:64
answer_type put(const endpoint_variant &endpoint)
Make a HTTP PUT call.
Definition: connection.hpp:230
string data
The payload.
Definition: connection.hpp:65
string_view get_baseuri() const noexcept
Returns the base URI.
Definition: instance.hpp:113
C++ wrapper for the Mastodon API.
Definition: api.hpp:24
answer_type patch(const endpoint_variant &endpoint)
Make a HTTP PATCH call.
Definition: connection.hpp:206
answer_type put(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP PUT call with parameters.
Definition: connection.cpp:55
vector< event_type > get_new_events()
Get new stream events.
Definition: connection.cpp:79
~Connection() noexcept override=default
Destructor.
answer_type del(const endpoint_variant &endpoint)
Make a HTTP DELETE call.
Definition: connection.hpp:254
void cancel_stream()
Cancel the stream.
Definition: connection.hpp:280
answer_type del(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP DELETE call with parameters.
Definition: connection.cpp:62
A stream event.
Definition: connection.hpp:52
Return type for Requests.
Definition: types.hpp:79
answer_type patch(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP PATCH call with parameters.
Definition: connection.cpp:48
Holds the access data of an instance.
Definition: instance.hpp:48
answer_type post(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP POST call with parameters.
Definition: connection.cpp:41
Represents a connection to an instance. Used for requests.
Definition: connection.hpp:78
Handles the details of network connections.
Definition: curl_wrapper.hpp:57
variant< API::endpoint_type, string_view > endpoint_variant
An endpoint. Either API::endpoint_type or std::string_view.
Definition: connection.hpp:43
string get_new_stream_contents()
Copy new stream contents and delete the “original”.
Definition: connection.cpp:69
void cancel_stream()
Cancel the stream.
Definition: curl_wrapper.hpp:209