cmake | ||
examples | ||
include | ||
pkg-config | ||
src | ||
tests | ||
.drone.yml | ||
.editorconfig | ||
.gitignore | ||
build_doc.sh | ||
CMakeLists.txt | ||
CODE_OF_CONDUCT.adoc | ||
CONTRIBUTING.adoc | ||
Doxyfile | ||
LICENSE | ||
README.adoc |
mastodonpp
mastodonpp is a C++ wrapper for the Mastodon API. It replaces mastodon-cpp.
We aim to create a library that is comfortable, yet minimal. All API endpoints
from Mastodon and Pleroma are stored in enum class
es, to counteract typos and
make your life easier. The network-facing code is built on
libcurl, a mature and stable library that is available on
virtually every operating system. The library does not parse the responses
itself, but returns to you the raw data, because we know everyone has their
favorite JSON library and we don’t want to impose our choice on you!
Features
This is still a work in progress; here is a rough overview of the features:
-
❏ Requests
-
✓
GET
requests. -
✓ Streaming
GET
requests. -
❏
POST
requests. -
❏
PATCH
requests. -
❏
PUT
requests. -
❏
DELETE
requests.
-
-
✓ Report maximum allowed character per post.
-
❏ Comfortable access to pagination headers.
-
❏ Comfortable function to register a new “app” (get an access token).
Usage
Have a look at the reference.
Example
#include "mastodonpp.hpp"
#include <iostream>
int main()
{
mastodonpp::Instance instance{"example.com", {}};
mastodonpp::Connection connection{instance};
auto answer{connection.get(mastodonpp::API::v1::instance)};
if (answer)
{
std::cout << answer << std::endl;
}
}
More examples are included in the reference.
Install
From source
Dependencies
Get sourcecode
Release
Download the current release at schlomp.space.
Development version
git clone https://schlomp.space/tastytea/mastodonpp.git
Compile
mkdir -p build && cd build
cmake ..
cmake --build . -- -j$(nproc --ignore=1)
-
-DCMAKE_BUILD_TYPE=Debug
for a debug build. -
-DWITH_TESTS=YES
if you want to compile the tests. -
-DWITH_EXAMPLES=YES
if you want to compile the examples.