From 7c44fd17bb6be54a2ea4b60761e91053ca988977 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 29 Nov 2016 16:18:25 -0500 Subject: Made tweets, users, and notifications into copyable objects Notifications are now also mutable. Users and tweets no longer have helper methods for interacting with the client. Fixed a bug (possibly introduced by a change to the Twitter API) that caused non-reply tweets to be marked as unknown notifications. --- src/client.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index f8908fd..e16e30b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -330,7 +330,7 @@ namespace twitter { _oauth_token.get()); _current_user = - make_unique(*this, + make_unique( get(*_oauth_client, "https://api.twitter.com/1.1/account/verify_credentials.json") .perform()); @@ -349,7 +349,7 @@ namespace twitter { datastrstream << twitter::implode(std::begin(media_ids), std::end(media_ids), ","); } - return tweet(*this, + return tweet( post(*_oauth_client, "https://api.twitter.com/1.1/statuses/update.json", datastrstream.str()) @@ -369,7 +369,7 @@ namespace twitter { datastrstream << twitter::implode(std::begin(media_ids), std::end(media_ids), ","); } - return tweet(*this, + return tweet( post(*_oauth_client, "https://api.twitter.com/1.1/statuses/update.json", datastrstream.str()) @@ -533,6 +533,16 @@ namespace twitter { return result; } + std::set client::getFriends(const user& id) const + { + return getFriends(id.getID()); + } + + std::set client::getFriends() const + { + return getFriends(getUser().getID()); + } + std::set client::getFollowers(user_id id) const { long long cursor = -1; @@ -567,6 +577,16 @@ namespace twitter { return result; } + std::set client::getFollowers(const user& id) const + { + return getFollowers(id.getID()); + } + + std::set client::getFollowers() const + { + return getFollowers(getUser().getID()); + } + void client::follow(user_id toFollow) const { std::stringstream datastrstream; @@ -576,6 +596,11 @@ namespace twitter { post(*_oauth_client, "https://api.twitter.com/1.1/friendships/create.json", datastrstream.str()).perform(); } + void client::follow(const user& toFollow) const + { + return follow(toFollow.getID()); + } + void client::unfollow(user_id toUnfollow) const { std::stringstream datastrstream; @@ -584,6 +609,11 @@ namespace twitter { post(*_oauth_client, "https://api.twitter.com/1.1/friendships/destroy.json", datastrstream.str()).perform(); } + + void client::unfollow(const user& toUnfollow) const + { + return unfollow(toUnfollow.getID()); + } const user& client::getUser() const { -- cgit 1.4.1