diff --git a/README.md b/README.md index 1f0f37b..588e596 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ **mastodon-cpp** is a C++ wrapper for the Mastodon API. -The library takes care of the network stuff. You submit a query and get the raw JSON. +The library takes care of the network stuff. You submit a query and use the raw +JSON or abstract classes. [TODO-list](https://github.com/tastytea/mastodon-cpp/milestones) @@ -29,6 +30,34 @@ int main() } ``` +## Another simple example + +Using the `Easy-class`. + +```C++ +#include +#include +#include +#include +#include + +using Mastodon::Easy; + +int main() +{ + Easy masto("social.example", ""); + std::string answer; + masto.get(Mastodon::API::v1::timelines_public, answer); + + for (const std::string &str : Easy::json_array_to_vector(answer)) + { + Easy::Status status(str); + std::cout << " " << status.account().acct() << " wrote:\n"; + std::cout << status.content() << '\n'; + } +} +``` + ## Compiling your project A project consisting of one file can be compiled as follows: