Enhanced documentation

This commit is contained in:
tastytea 2018-04-01 05:03:35 +02:00
parent 04f9a34dcd
commit 1bd9dbff30
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
1 changed files with 30 additions and 1 deletions

View File

@ -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 <iostream>
#include <string>
#include <vector>
#include <mastodon-cpp/mastodon-cpp.hpp>
#include <mastodon-cpp/easy/all.hpp>
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: