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

try
{
mastodonpp::Instance instance{"example.com", ""};
mastodonpp::Request request{instance};
auto answer{request.get(mastodonpp::API::v1::instance)};
std::cout << answer << std::endl;
}
catch (const mastodonpp::CURLException &e)
{
std::cerr << e.what() << std::endl;
}

Exceptions

Any unrecoverable libcurl error will be thrown as a mastodonpp::CURLException.

mastodonpp::CURLException
Exception for libcurl errors.
Definition: exceptions.hpp:40
mastodonpp
C++ wrapper for the Mastodon API.
Definition: api.cpp:21
mastodonpp::CURLException::what
const char * what() const noexcept override
Returns the error code, message and error buffer.
Definition: exceptions.cpp:39
mastodonpp::Instance
Holds the access data of an instance.
Definition: instance.hpp:40