mastodonpp  0.0.0
mastodonpp Reference

Using the library

Include mastodonpp.hpp, which then includes all other headers.

#include <mastodonpp/mastodonpp.hpp>

Use it in your CMake project like this:

find_package(mastodonpp REQUIRED CONFIG)
target_link_libraries(MyProject mastodonpp::mastodonpp)

Or compile your code with g++ $(pkg-config --cflags --libs mastodonpp).

Example

#include <mastodonpp/mastodonpp.hpp>
#include <iostream>
int main()
{
mastodonpp::Instance instance{"example.com", ""};
std::cout << "Maximum characters per post: "
<< instance.get_max_chars() << std::endl;
mastodonpp::Connection connection{instance};
auto answer{connection.get(mastodonpp::API::v1::instance)};
if (answer)
{
std::cout << answer << std::endl;
}
}

Input

All text input is expected to be UTF-8.

Exceptions

Any unrecoverable libcurl error will be thrown as a mastodonpp::CURLException. Network errors will not be thrown, but reported via the return value.

Thread safety

The first time you construct an Instance or Connection , curl_global_init(3) is called. When the last Instance or Connection is destroyed, curl_global_cleanup(3) is called. Both are not thread safe.

mastodonpp::Connection::get
answer_type get(const endpoint_variant &endpoint, const parametermap &parameters)
Make a HTTP GET call with parameters.
Definition: connection.cpp:29
mastodonpp
C++ wrapper for the Mastodon API.
Definition: answer.cpp:19
mastodonpp::Instance::get_max_chars
uint64_t get_max_chars()
Returns the maximum number of characters per post.
Definition: instance.cpp:33
mastodonpp::Instance
Holds the access data of an instance.
Definition: instance.hpp:40
mastodonpp::Connection
Represents a connection to an instance. Used for requests.
Definition: connection.hpp:50