updated examples
This commit is contained in:
parent
90452a9ec9
commit
f37557cd64
@ -35,11 +35,12 @@ int main(int argc, char *argv[])
|
||||
std::string uid = answer.substr(7, answer.find("\"", 7) - 7);
|
||||
API::parametermap parameters =
|
||||
{
|
||||
{ "id", { uid } },
|
||||
{ "limit", { "1" } },
|
||||
{ "only_media", { "1" } }
|
||||
};
|
||||
|
||||
ret = masto.get(API::v1::accounts_id_statuses, uid,parameters, answer);
|
||||
ret = masto.get(API::v1::accounts_id_statuses, parameters, answer);
|
||||
if (ret == 0)
|
||||
{
|
||||
std::cout << answer << '\n';
|
||||
|
@ -58,10 +58,11 @@ int main(int argc, char *argv[])
|
||||
// Only get toots we haven't seen yet
|
||||
API::parametermap params =
|
||||
{
|
||||
{ "hashtag", { hashtag } },
|
||||
{ "limit", { limit } },
|
||||
{ "since_id", { lastid } }
|
||||
};
|
||||
ret = masto.get(API::v1::timelines_tag_hashtag, hashtag, params, answer);
|
||||
ret = masto.get(API::v1::timelines_tag_hashtag, params, answer);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ int main(int argc, char *argv[])
|
||||
// If no @ is found, it is presumably an ID
|
||||
if (id.find('@') == std::string::npos)
|
||||
{
|
||||
ret = masto.post(API::v1::accounts_id_follow, id, answer);
|
||||
ret = masto.post(API::v1::accounts_id_follow, {{"id", {id}}}, answer);
|
||||
if (ret == 0)
|
||||
{
|
||||
// std::cout << answer << '\n';
|
||||
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::cout << "Unfollowing in 30 seconds...\n";
|
||||
std::this_thread::sleep_for(std::chrono::seconds(30));
|
||||
ret = masto.post(API::v1::accounts_id_unfollow, id, answer);
|
||||
ret = masto.post(API::v1::accounts_id_unfollow, {{"id", {id}}}, answer);
|
||||
if (ret == 0)
|
||||
{
|
||||
// std::cout << answer << '\n';
|
||||
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::cout << "Unfollowing " << id << " in 30 seconds...\n";
|
||||
std::this_thread::sleep_for(std::chrono::seconds(30));
|
||||
ret = masto.post(API::v1::accounts_id_unfollow, id, answer);
|
||||
ret = masto.post(API::v1::accounts_id_unfollow, {{"id", {id}}}, answer);
|
||||
if (ret == 0)
|
||||
{
|
||||
// std::cout << answer << '\n';
|
||||
|
@ -47,7 +47,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::cout << "Deleting in 30 seconds...\n";
|
||||
std::this_thread::sleep_for(std::chrono::seconds(30));
|
||||
ret = masto.del(API::v1::statuses_id, id);
|
||||
ret = masto.del(API::v1::statuses_id, {{"id", {id}}});
|
||||
if (ret == 0)
|
||||
{
|
||||
std::cout << "Status " << id << " deleted.\n";
|
||||
|
@ -59,7 +59,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Mastodon::API masto(argv[1], argv[2]);
|
||||
masto.set_useragent("mastodon-cpp-example/1.3.3.7");
|
||||
masto.get_stream(API::v1::streaming_hashtag, "np", answer, ptr);
|
||||
masto.get_stream(API::v1::streaming_hashtag, {{ "hashtag", {"np"} }},
|
||||
answer, ptr);
|
||||
});
|
||||
std::this_thread::sleep_for(std::chrono::seconds(20));
|
||||
ptr->abort_stream();
|
||||
|
@ -44,8 +44,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Get last status
|
||||
ret = masto.get(API::v1::accounts_id_statuses,
|
||||
std::to_string(acc.id()),
|
||||
{{ "limit", { "1" } }},
|
||||
{
|
||||
{ "id", { std::to_string(acc.id()) } },
|
||||
{ "limit", { "1" } }
|
||||
},
|
||||
answer);
|
||||
if (ret == 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user