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;
129 return get(endpoint, {});
166 return post(endpoint, {});
192 return patch(endpoint, {});
218 return put(endpoint, {});
244 return del(endpoint, {});
274 const string_view _baseuri;
282 #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
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:164
map< string_view, variant< string_view, vector< string_view > >> parametermap
std::map of parameters for API calls.
Definition: types.hpp:66
Connection(Instance &instance)
Construct a new Connection object.
Definition: connection.hpp:85
answer_type put(const endpoint_variant &endpoint)
Make a HTTP PUT call.
Definition: connection.hpp:216
answer_type get(const endpoint_variant &endpoint)
Make a HTTP GET call.
Definition: connection.hpp:127
string data
The payload.
Definition: connection.hpp:65
string_view get_baseuri() const noexcept
Returns the base URI.
Definition: instance.hpp:99
C++ wrapper for the Mastodon API.
Definition: api.cpp:19
answer_type patch(const endpoint_variant &endpoint)
Make a HTTP PATCH call.
Definition: connection.hpp:190
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
answer_type del(const endpoint_variant &endpoint)
Make a HTTP DELETE call.
Definition: connection.hpp:242
void cancel_stream()
Cancel the stream.
Definition: connection.hpp:268
variant< API::endpoint_type, string_view > endpoint_variant
An endpoint. Either API::endpoint_type or std::string_view.
Definition: connection.hpp:43
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:81
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:45
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:75
Handles the details of network connections.
Definition: curl_wrapper.hpp:58
void copy_connection_properties(CURLWrapper &curlwrapper)
Set the properties of the connection of the calling class up.
Definition: instance.hpp:74
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:210