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... | |
void | set_proxy (string_view proxy) |
Set the proxy to use. More... | |
string | get_new_stream_contents () |
Copy new stream contents and delete the “original”. 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. |
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.
void mastodonpp::Connection::set_proxy | ( | string_view | proxy | ) |
Set the proxy to use.
See CURLOPT_PROXY(3).
proxy | Examples: "socks4a://127.0.0.1:9050", "http://[::1]:3128". |
Sets also the proxy for the Instance you used to initialize this Connection.