mastodonpp
0.0.0
|
Represents a connection to an instance. Used for requests. More...
#include <mastodonpp/connection.hpp>
Public Member Functions | |
Connection (Instance &instance) | |
Construct a new Connection object. More... | |
answer_type | get (const endpoint_variant &endpoint, const parametermap ¶meters) |
Make a HTTP GET call with parameters. More... | |
answer_type | get (const endpoint_variant &endpoint) |
Make a HTTP GET call. More... | |
string | get_new_stream_contents () |
Copy new stream contents and delete the “original”. More... | |
vector< event_type > | get_new_events () |
Get new stream events. More... | |
Public Member Functions inherited from mastodonpp::CURLWrapper | |
CURLWrapper () | |
Initializes curl and sets up connection. More... | |
CURLWrapper (const CURLWrapper &other)=delete | |
Copy constructor. More... | |
CURLWrapper (CURLWrapper &&other) noexcept=delete | |
Move constructor. More... | |
virtual | ~CURLWrapper () noexcept |
Cleans up curl and connection. More... | |
CURLWrapper & | operator= (const CURLWrapper &other)=delete |
Copy assignment operator. More... | |
CURLWrapper & | operator= (CURLWrapper &&other) noexcept=delete |
Move assignment operator. More... | |
CURL * | get_curl_easy_handle () |
Returns pointer to the CURL easy handle. More... | |
void | set_proxy (string_view proxy) |
Set the proxy to use. More... | |
void | cancel_stream () |
Cancel the stream. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mastodonpp::CURLWrapper | |
answer_type | make_request (const http_method &method, string uri, const parametermap ¶meters) |
Make a HTTP request. More... | |
string & | get_buffer () |
Returns a reference to the buffer libcurl writes into. More... | |
Protected Attributes inherited from mastodonpp::CURLWrapper | |
mutex | buffer_mutex |
Mutex for get_buffer a.k.a. _curl_buffer_body. More... | |
Represents a connection to an instance. Used for requests.
|
explicit |
|
inline |
Make a HTTP GET call.
Example:
endpoint | Endpoint as API::endpoint_type or std::string_view . |
answer_type mastodonpp::Connection::get | ( | const endpoint_variant & | endpoint, |
const parametermap & | parameters | ||
) |
Make a HTTP GET call with parameters.
Example:
endpoint | Endpoint as API::endpoint_type or std::string_view . |
parameters | A map of parameters. |
vector< event_type > mastodonpp::Connection::get_new_events | ( | ) |
Get new stream events.
string mastodonpp::Connection::get_new_stream_contents | ( | ) |
Copy new stream contents and delete the “original”.
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.