17 #ifndef MASTODONPP_CONNECTION_HPP
18 #define MASTODONPP_CONNECTION_HPP
22 #include "curl_wrapper.hpp"
23 #include "instance.hpp"
26 #include <string_view>
34 using std::string_view;
124 return get(endpoint, {});
161 return post(endpoint, {});
187 return patch(endpoint, {});
213 return put(endpoint, {});
239 return del(endpoint, {});
269 const string_view _baseuri;
277 #endif // MASTODONPP_CONNECTION_HPP
answer_type get(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP GET call with parameters.
Definition: connection.cpp:50
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:159
map< string_view, variant< string_view, vector< string_view > >> parametermap
std::map of parameters for API calls.
Definition: curl_wrapper.hpp:77
Connection(Instance &instance)
Construct a new Connection object.
Definition: connection.cpp:24
answer_type put(const endpoint_variant &endpoint)
Make a HTTP PUT call.
Definition: connection.hpp:211
answer_type get(const endpoint_variant &endpoint)
Make a HTTP GET call.
Definition: connection.hpp:122
string data
The payload.
Definition: connection.hpp:65
C++ wrapper for the Mastodon API.
Definition: answer.cpp:22
answer_type patch(const endpoint_variant &endpoint)
Make a HTTP PATCH call.
Definition: connection.hpp:185
answer_type put(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP PUT call with parameters.
Definition: connection.cpp:71
vector< event_type > get_new_events()
Get new stream events.
Definition: connection.cpp:95
answer_type del(const endpoint_variant &endpoint)
Make a HTTP DELETE call.
Definition: connection.hpp:237
void cancel_stream()
Cancel the stream.
Definition: connection.hpp:263
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:78
A stream event.
Definition: connection.hpp:52
Return type for Requests.
Definition: answer.hpp:40
answer_type patch(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP PATCH call with parameters.
Definition: connection.cpp:64
Holds the access data of an instance.
Definition: instance.hpp:42
answer_type post(const endpoint_variant &endpoint, const parametermap ¶meters)
Make a HTTP POST call with parameters.
Definition: connection.cpp:57
Represents a connection to an instance. Used for requests.
Definition: connection.hpp:75
Handles the details of network connections.
Definition: curl_wrapper.hpp:96
string get_new_stream_contents()
Copy new stream contents and delete the “original”.
Definition: connection.cpp:85
void cancel_stream()
Cancel the stream.
Definition: curl_wrapper.hpp:204