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;
}
}

Exceptions

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

mastodonpp
C++ wrapper for the Mastodon API.
Definition: api.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::Connection::get
answer_type get(const API::endpoint_type &endpoint)
Make a HTTP GET call.
Definition: connection.cpp:27
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:41