Updated README-examples.
the build failed Details

This commit is contained in:
tastytea 2019-03-03 11:22:11 +01:00
parent f28fac5579
commit c244b2bb94
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 4 additions and 8 deletions

View File

@ -29,15 +29,13 @@ There are [examples](https://schlomp.space/tastytea/mastodon-cpp/src/branch/mast
```C++ ```C++
#include <iostream> #include <iostream>
#include <string>
#include <mastodon-cpp/mastodon-cpp.hpp> #include <mastodon-cpp/mastodon-cpp.hpp>
int main() int main()
{ {
Mastodon::API masto("social.example.com", "auth_token"); Mastodon::API masto("social.example.com", "auth_token");
std::string answer; std::cout << masto.get(Mastodon::API::v1::accounts_verify_credentials);
masto.get(Mastodon::API::v1::accounts_verify_credentials, answer); std::cout << std::endl;
std::cout << answer << '\n';
} }
``` ```
@ -48,7 +46,6 @@ Using the `Easy`-class.
```C++ ```C++
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector>
#include <mastodon-cpp/mastodon-cpp.hpp> #include <mastodon-cpp/mastodon-cpp.hpp>
#include <mastodon-cpp/easy/all.hpp> #include <mastodon-cpp/easy/all.hpp>
@ -57,10 +54,9 @@ using Mastodon::Easy;
int main() int main()
{ {
Easy masto("social.example", ""); Easy masto("social.example", "");
std::string answer; return_call ret = masto.get(Mastodon::API::v1::timelines_public);
masto.get(Mastodon::API::v1::timelines_public, answer);
for (const std::string &str : Easy::json_array_to_vector(answer)) for (const std::string &str : Easy::json_array_to_vector(ret.answer))
{ {
Easy::Status status(str); Easy::Status status(str);
std::cout << " " << status.account().acct() << " wrote:\n"; std::cout << " " << status.account().acct() << " wrote:\n";